#include <define.h>

//#define NAME                    SCRIPT_

#include <command.h>
//#include <ModReact.h>


variable GVar0;
variable GVar1;
variable GVar2;
variable GVar3;
variable GVar4;
variable GVar5;
variable GVar6;
variable GVar7;
variable GVar8;
variable GVar9;
variable GVar10;
variable GVar11;
variable GVar12;
variable GVar13;
variable GVar14;
variable GVar15;
variable GVar16;

procedure start;
#include <push.h>
procedure critter_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure map_enter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure KillianEnd;
procedure KillianCbt;
procedure Killian0a;
procedure Killian01;
procedure Killian02;
procedure Killian03;
procedure Killian03a;
procedure Killian04;
procedure Killian05;
procedure Killian06;
procedure Killian08;
procedure Killian09;
procedure Killian09a;
procedure Killian10;
procedure Killian11;
procedure Killian11a;
procedure Killian12;
procedure Killian13;
procedure Killian13a;
procedure Killian13b;
procedure Killian14;
procedure Killian15;
procedure Killian16;
procedure Killian21;
procedure Killian22;
procedure Killian23;
procedure Killian24;
procedure Killian26;
procedure Killian27;
procedure Killian28;
procedure Killian29;
procedure Killian30;
procedure Killian31;
procedure Killian32;
procedure Killian34;
procedure Killian35;
procedure Killian36;
procedure Killian37;
procedure Killian38;
procedure Killian39;
procedure Killian40;
procedure Killian41;
procedure Killian42;
procedure Killian43;
procedure Killian44;
procedure Killian45;
procedure Killian45a;
procedure Killian46;
procedure Killian47;
procedure Killian48;
procedure Killian49;
procedure Killian50;
procedure Killian51;
procedure Killian52;
procedure Killian53;
procedure Killian54;
procedure Killian55;
procedure Killian56;
procedure Killian57;
procedure Killian58;
procedure Killian59;
procedure Killian60;
procedure Killian61;
procedure Killian62;
procedure Killian63;
procedure Killian64;
procedure Killian65;
procedure Killian66;
procedure Killian67;
procedure Killian68;
procedure Killian71;
procedure Killian72;
procedure Killian73;
procedure Killian74;
procedure Killian75;
procedure Killian76;
procedure Killian88;
procedure Killian89;
procedure Killian90;
procedure Killianx;
procedure Killianx1;
procedure Killianx2;
procedure Killianx3;
procedure Killianx4;
procedure Killian_barter;
procedure Killian_give_stuff;
procedure Killian_give_shotgun;
procedure Killian_give_armor;
procedure Killian_give_doctor_bag;
procedure Killian_give_stimpaks;
procedure soundcheck;
procedure playback;
procedure Killian02a;
procedure Killian02b;
procedure Killian03aa;
procedure Killian03ba;
procedure Killian03ca;
procedure Killian32a;
procedure Killian63a;
procedure get_stuff_from_safe;
procedure put_stuff_in_safe;
procedure sleeping;

import variable KillSafe_ptr;
import variable Killian_ptr;
import variable Killian_barter_var;
import variable Killian_store1_ptr;
import variable Killian_store2_ptr;
import variable Killian_store3_ptr;
import variable Killian_store4_ptr;

procedure Get_Reaction;
procedure React_To_Level;
procedure Level_To_React;
procedure Up_React;
procedure Down_React;
procedure Bottom_React;
procedure Top_React;
procedure Big_Up_React;
procedure Big_Down_React;
procedure Up_React_Level;
procedure Down_React_Level;
procedure Goodbyes;
procedure killian00;
procedure killian69;
procedure killian70;
procedure killian76a;
procedure killian77;
procedure killian78;
procedure killian79;
procedure killian80;
procedure killian81;
procedure killian82;
procedure killian83;
procedure killian84;
procedure killian85;
procedure killian86;
procedure killian87;


procedure start
begin
if (script_action == critter_proc) then begin
    call critter_p_proc;
  end
  else begin
    if (script_action == destroy_proc) then begin
      call destroy_p_proc;
    end
    else begin
      if (script_action == look_at_proc) then begin
        call look_at_p_proc;
      end
      else begin
        if (script_action == map_enter_proc) then begin
          call map_enter_p_proc;
        end
        else begin
          if (script_action == pickup_proc) then begin
            call pickup_p_proc;
          end
          else begin
            if (script_action == talk_proc) then begin
              call talk_p_proc;
            end
          end
        end
      end
    end
  end
end

procedure critter_p_proc
begin
  if ((game_time_hour >= 1900) or (game_time_hour < 600) and (tile_distance_objs(self_obj, dude_obj) < 12) and obj_can_see_obj(self_obj, dude_obj) and (cur_map_index == MAP_JUNKKILL)) then begin
    GVar5 := 1;
    GVar7 := 1;
    dialogue_system_enter;
  end
  if (map_var(9) == 1) then begin
    if ((cur_map_index == MAP_JUNKKILL) and (local_var(7) == 0) and (tile_distance_objs(self_obj, dude_obj) < 12) and obj_can_see_obj(self_obj, dude_obj)) then begin
      set_map_var(9, 0);
      GVar5 := 1;
      GVar7 := 1;
      dialogue_system_enter;
    end
    else begin
      GVar5 := 0;
      GVar7 := 0;
      set_map_var(9, 0);
    end
  end
  if (GVar8) then begin
    GVar8 := 0;
    attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
  end
  if (obj_can_see_obj(self_obj, dude_obj) and (tile_distance_objs(self_obj, dude_obj) < 12) and map_var(2) and (cur_map_index == MAP_JUNKKILL)) then begin
    dialogue_system_enter;
  end
  call sleeping;
  if ((game_time_hour > 730) and (game_time_hour < 1900)) then begin
    if (tile_num(self_obj) != GVar14) then begin
      animate_move_obj_to_tile(self_obj, GVar14, ANIMATE_WALK);
    end
    else begin
      if (has_trait(1, self_obj, 10) != 2) then begin
        anim(self_obj, 1000, 2);
      end
    end
  end
  if (Killian_barter_var != 0) then begin
    if ((local_var(7) == 0) and (cur_map_index == MAP_JUNKKILL)) then begin
      if (tile_distance_objs(self_obj, dude_obj) < 12) then begin
        dialogue_system_enter;
      end
      else begin
        animate_move_obj_to_tile(self_obj, tile_num_in_direction(tile_num(dude_obj), random(0, 5), 1), ANIMATE_WALK);
      end
    end
    else begin
      Killian_barter_var := 0;
    end
  end
end

procedure destroy_p_proc
begin
  variable LVar0 := 0;
  LVar0 := create_object_sid(56, 0, 0, -1);
  add_obj_to_inven(self_obj, LVar0);
  if (source_obj == dude_obj) then begin
    if (global_var(GVAR_ENEMY_JUNKTOWN) == 0) then begin
      set_global_var(GVAR_ENEMY_JUNKTOWN, 1);
      set_global_var(GVAR_PLAYER_REPUTATION, global_var(GVAR_PLAYER_REPUTATION) - 5);
    end
  end
  set_global_var(GVAR_KILLIAN_DEAD, 1);
  if (source_obj == dude_obj) then begin
    if (((global_var(GVAR_BAD_MONSTER) + global_var(GVAR_GOOD_MONSTER)) >= 25) and ((global_var(GVAR_GOOD_MONSTER) > (2 * global_var(GVAR_BAD_MONSTER))) or (global_var(GVAR_BERSERKER_REPUTATION) == 1))) then begin
      set_global_var(GVAR_BERSERKER_REPUTATION, 1);
      set_global_var(GVAR_CHAMPION_REPUTATION, 0);
    end
    if (((global_var(GVAR_BAD_MONSTER) + global_var(GVAR_GOOD_MONSTER)) >= 25) and ((global_var(GVAR_BAD_MONSTER) > (3 * global_var(GVAR_GOOD_MONSTER))) or (global_var(GVAR_CHAMPION_REPUTATION) == 1))) then begin
      set_global_var(GVAR_CHAMPION_REPUTATION, 1);
      set_global_var(GVAR_BERSERKER_REPUTATION, 0);
    end
    set_global_var(GVAR_GOOD_MONSTER, global_var(GVAR_GOOD_MONSTER) + 1);
    if ((global_var(GVAR_GOOD_MONSTER) % 2) == 0) then begin
      set_global_var(GVAR_PLAYER_REPUTATION, global_var(GVAR_PLAYER_REPUTATION) - 1);
    end
  end
  if (global_var(GVAR_KILL_KILLIAN) == 1) then begin
    set_global_var(GVAR_KILL_KILLIAN, 2);
  end
  Killian_ptr := 0;
end

procedure look_at_p_proc
begin
  script_overrides;
  display_msg(message_str(SCRIPT_KILLIAN, 100));
end

procedure map_enter_p_proc
begin
  GVar15 := 27896;
  GVar13 := 1900;
  GVar12 := 700;
  GVar14 := 25683;
  Killian_ptr := self_obj;
  if (cur_map_index == MAP_JUNKCSNO) then begin
    if (global_var(GVAR_GIZMO_DEAD) == 1) then begin
      destroy_object(self_obj);
    end
    else begin
      float_msg(self_obj, message_str(SCRIPT_KILLIAN, 271), FLOAT_MSG_GREEN);
    end
    critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_TEAM_NUM, 0);
  end
  else begin
    critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_TEAM_NUM, 12);
  end
  if (item_caps_total(self_obj) == 0) then begin
    item_caps_adjust(self_obj, random(10, 150));
  end
end

procedure pickup_p_proc
begin
  GVar5 := 1;
  GVar6 := 1;
  GVar7 := 0;
  dialogue_system_enter;
end

procedure talk_p_proc
begin
  variable LVar0 := 0;
  variable LVar1 := 0;
  call get_stuff_from_safe;
  if ((local_var(7) == 1) and (GVar7 == 0)) then begin
    float_msg(self_obj, message_str(SCRIPT_GENVAULT, 166), FLOAT_MSG_NORMAL);
  end
  else begin
    if ((global_var(GVAR_GOT_CONFESSION) != 1) and (global_var(GVAR_BUG_PLANTED) != 1) and (global_var(GVAR_GIZMO_DEAD) == 1) and (local_var(9) == 0)) then begin
      call Killian89;
    end
    else begin
      call Get_Reaction;
      if (Killian_barter_var >= 0) then begin
        if (Killian_barter_var == 1) then begin
          move_obj_inven_to_obj(Killian_store1_ptr, self_obj);
        end
        else begin
          if (Killian_barter_var == 2) then begin
            move_obj_inven_to_obj(Killian_store2_ptr, self_obj);
          end
          else begin
            if (Killian_barter_var == 3) then begin
              move_obj_inven_to_obj(Killian_store3_ptr, self_obj);
            end
            else begin
              if (Killian_barter_var == 4) then begin
                move_obj_inven_to_obj(Killian_store4_ptr, self_obj);
              end
            end
          end
        end
      end
      start_gdialog(SCRIPT_KILLIAN, self_obj, 4, HEAD_KILLIAN, BACKGROUND_JUNKTOWN);
      gsay_start;
      if (GVar5) then begin
        if (GVar6) then begin
          call Killian30;
        end
        else begin
          GVar6 := 1;
          if (GVar7) then begin
            call Killian31;
          end
          else begin
            call Killian29;
          end
        end
      end
      else begin
        if (Killian_barter_var == -1) then begin
          set_local_var(8, local_var(8) + 1);
          Killian_barter_var := 0;
          if (local_var(8) == 1) then begin
            call Killian42;
          end
          else begin
            if (local_var(8) == 2) then begin
              call Killian43;
            end
            else begin
              if (local_var(8) == 3) then begin
                call Killian44;
              end
              else begin
                call Killian30;
              end
            end
          end
        end
        else begin
          if (Killian_barter_var != 0) then begin
            gsay_reply(SCRIPT_KILLIAN, 115);
            giq_option(4, SCRIPT_KILLIAN, 118, Killian_barter, NEUTRAL_REACTION);
            giq_option(4, SCRIPT_KILLIAN, 121, Killianx, NEUTRAL_REACTION);
            giq_option(-3, SCRIPT_KILLIAN, 122, Killianx, NEUTRAL_REACTION);
          end
          else begin
            if (map_var(2)) then begin
              call Killian47;
            end
            else begin
              if (local_var(5) == 1) then begin
                if ((global_var(GVAR_GOT_CONFESSION) == 1) or (global_var(GVAR_BUG_PLANTED) == 1) and (map_var(6) == 0)) then begin
                  call Killian54;
                end
                else begin
                  if (local_var(1) >= 2) then begin
                    call Killian24;
                  end
                  else begin
                    call Killian26;
                  end
                end
              end
              else begin
                call Killian01;
              end
            end
          end
        end
      end
      gsay_end;
      end_dialogue;
    end
  end
  if ((map_var(5) == 1) and (local_var(7) == 0) and (global_var(GVAR_HIRED_BY_GIZMO) == 0)) then begin
    LVar1 := create_object_sid(16777528, 0, 0, 510);
    GVar9 := create_object_sid(10, 0, 0, -1);
    add_obj_to_inven(LVar1, GVar9);
    critter_add_trait(LVar1, 1, 6, 13);
    critter_add_trait(LVar1, 1, 5, 1);
    critter_attempt_placement(LVar1, 28283, 0);
    set_map_var(5, 2);
  end
  if (map_var(6) == 1) then begin
    set_map_var(6, 2);
    display_msg(message_str(SCRIPT_KILLIAN, 270));
    give_exp_points(500);
  end
  call put_stuff_in_safe;
  if (Killian_barter_var >= 0) then begin
    LVar0 := obj_carrying_pid_obj(self_obj, 18);
    rm_obj_from_inven(self_obj, LVar0);
    if (Killian_barter_var == 1) then begin
      move_obj_inven_to_obj(self_obj, Killian_store1_ptr);
    end
    else begin
      if (Killian_barter_var == 2) then begin
        move_obj_inven_to_obj(self_obj, Killian_store2_ptr);
      end
      else begin
        if (Killian_barter_var == 3) then begin
          move_obj_inven_to_obj(self_obj, Killian_store3_ptr);
        end
        else begin
          move_obj_inven_to_obj(self_obj, Killian_store4_ptr);
        end
      end
    end
    Killian_barter_var := 0;
    add_obj_to_inven(self_obj, LVar0);
  end
  if (GVar10) then begin
    set_global_var(GVAR_PLAYER_REPUTATION, global_var(GVAR_PLAYER_REPUTATION) - 1);
    GVar10 := 0;
    load_map(10, 6);
  end
end

procedure KillianEnd
begin
end

procedure KillianCbt
begin
  GVar8 := 1;
end

procedure Killian0a
begin
  gsay_reply(SCRIPT_KILLIAN, 109);
  gsay_option(SCRIPT_KILLIAN, 110, Killianx, NEUTRAL_REACTION);
  gsay_option(SCRIPT_KILLIAN, 111, Killianx, NEUTRAL_REACTION);
end

procedure Killian01
begin
  set_local_var(5, 1);
  if ((map_var(5) == 0) and (global_var(GVAR_GIZMO_DEAD) == 0) and (map_var(6) == 0) and (global_var(GVAR_HIRED_BY_KILLIAN) == 0)) then begin
    set_map_var(5, 1);
  end
  if (local_var(1) == 3) then begin
    if (dude_is_male) then begin
      gsay_reply(SCRIPT_KILLIAN, 112);
    end
    else begin
      gsay_reply(SCRIPT_KILLIAN, 113);
    end
  end
  else begin
    if (local_var(1) == 1) then begin
      gsay_reply(SCRIPT_KILLIAN, 114);
    end
    else begin
      gsay_reply(SCRIPT_KILLIAN, 115);
    end
  end
  call killian00;
end

procedure Killian02
begin
  set_local_var(4, 1);
  gsay_reply(SCRIPT_KILLIAN, 123);
  giq_option(4, SCRIPT_KILLIAN, message_str(SCRIPT_KILLIAN, 124) + proto_data(obj_pid(dude_obj), 1) + message_str(SCRIPT_KILLIAN, 125), Killian02b, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, message_str(SCRIPT_KILLIAN, 126) + proto_data(obj_pid(dude_obj), 1) + message_str(SCRIPT_KILLIAN, 127), Killian03, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 128, Killian02a, BAD_REACTION);
end

procedure Killian03
begin
  gsay_reply(SCRIPT_KILLIAN, 129);
  giq_option(4, SCRIPT_KILLIAN, 130, Killian05, BAD_REACTION);
  giq_option(6, SCRIPT_KILLIAN, 131, Killian03aa, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 132, Killian03ba, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 133, Killian03ca, BAD_REACTION);
end

procedure Killian03a
begin
  gsay_message(SCRIPT_KILLIAN, 134, NEUTRAL_REACTION);
  call Killian08;
end

procedure Killian04
begin
  gsay_message(SCRIPT_KILLIAN, 135, NEUTRAL_REACTION);
  call killian00;
end

procedure Killian05
begin
  gsay_reply(SCRIPT_KILLIAN, 136);
  giq_option(4, SCRIPT_KILLIAN, 137, Killian06, GOOD_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 138, Killian04, GOOD_REACTION);
end

procedure Killian06
begin
  gsay_reply(SCRIPT_KILLIAN, 139);
  call killian00;
end

procedure Killian08
begin
  gsay_reply(SCRIPT_KILLIAN, 140);
  giq_option(5, SCRIPT_KILLIAN, 141, Killian09, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 142, killian00, NEUTRAL_REACTION);
end

procedure Killian09
begin
  if (not(global_var(GVAR_THE_HUB))) then begin
    set_global_var(GVAR_THE_HUB, 1);
  end
  if (not(global_var(GVAR_NECROPOLIS))) then begin
    set_global_var(GVAR_NECROPOLIS, 1);
  end
  gsay_reply(SCRIPT_KILLIAN, 143);
  giq_option(5, SCRIPT_KILLIAN, 144, Killian10, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 145, Killian09a, BAD_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 146, Killianx, NEUTRAL_REACTION);
end

procedure Killian09a
begin
  call Down_React_Level;
  call Killian04;
end

procedure Killian10
begin
  if (local_var(1) >= 2) then begin
    gsay_reply(SCRIPT_KILLIAN, 147);
  end
  else begin
    gsay_reply(SCRIPT_KILLIAN, 148);
  end
  call killian00;
end

procedure Killian11
begin
  gsay_reply(SCRIPT_KILLIAN, 149);
  giq_option(4, SCRIPT_KILLIAN, 150, Killian12, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 151, Killian13, NEUTRAL_REACTION);
  giq_option(6, SCRIPT_KILLIAN, 152, Killian08, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 153, Killian11a, NEUTRAL_REACTION);
end

procedure Killian11a
begin
  gsay_reply(SCRIPT_KILLIAN, " ");
  call killian00;
end

procedure Killian12
begin
  gsay_reply(SCRIPT_KILLIAN, 154);
  call killian00;
end

procedure Killian13
begin
  gsay_reply(SCRIPT_KILLIAN, 155);
  giq_option(4, SCRIPT_KILLIAN, 156, Killian13b, NEUTRAL_REACTION);
  giq_option(6, SCRIPT_KILLIAN, 157, Killian13a, BAD_REACTION);
end

procedure Killian13a
begin
  call Down_React_Level;
  call Killian14;
end

procedure Killian13b
begin
  gsay_reply(0, 0);
  call killian00;
end

procedure Killian14
begin
  gsay_reply(SCRIPT_KILLIAN, 158);
  giq_option(4, SCRIPT_KILLIAN, 159, Killian15, NEUTRAL_REACTION);
  giq_option(6, SCRIPT_KILLIAN, 160, Killian16, BAD_REACTION);
end

procedure Killian15
begin
  gsay_reply(SCRIPT_KILLIAN, 161);
  call killian00;
end

procedure Killian16
begin
  gsay_message(SCRIPT_KILLIAN, 162, BAD_REACTION);
end

procedure Killian21
begin
  gsay_reply(SCRIPT_KILLIAN, 163);
  giq_option(4, SCRIPT_MODREACT, 106, Killian_barter, NEUTRAL_REACTION);
end

procedure Killian22
begin
  gsay_message(SCRIPT_KILLIAN, 164, NEUTRAL_REACTION);
end

procedure Killian23
begin
  gsay_message(SCRIPT_KILLIAN, 165, NEUTRAL_REACTION);
end

procedure Killian24
begin
  gsay_reply(SCRIPT_KILLIAN, 166);
  call killian00;
end

procedure Killian26
begin
  gsay_reply(SCRIPT_KILLIAN, 167);
  call killian00;
end

procedure Killian27
begin
  gsay_message(SCRIPT_KILLIAN, 168, NEUTRAL_REACTION);
end

procedure Killian28
begin
  gsay_reply(SCRIPT_KILLIAN, 169);
  call Killianx1;
end

procedure Killian29
begin
  gsay_message(SCRIPT_KILLIAN, 170, NEUTRAL_REACTION);
end

procedure Killian30
begin
  GVar5 := 0;
  GVar6 := 0;
  gsay_reply(SCRIPT_KILLIAN, 171);
  call Killianx1;
end

procedure Killian31
begin
  GVar7 := 0;
  gsay_reply(SCRIPT_KILLIAN, 172);
  giq_option(4, SCRIPT_KILLIAN, 173, Killian34, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 174, Killian32, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 175, Killian35, NEUTRAL_REACTION);
end

procedure Killian32
begin
  gsay_reply(SCRIPT_KILLIAN, 176);
  giq_option(4, SCRIPT_KILLIAN, 177, Killian32a, BAD_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 178, KillianCbt, BAD_REACTION);
end

procedure Killian34
begin
  gsay_reply(SCRIPT_KILLIAN, 179);
  giq_option(4, SCRIPT_KILLIAN, 180, Killianx2, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 181, KillianCbt, BAD_REACTION);
end

procedure Killian35
begin
  gsay_reply(SCRIPT_KILLIAN, 182);
  call Killianx1;
end

procedure Killian36
begin
  gsay_message(SCRIPT_KILLIAN, 185, NEUTRAL_REACTION);
end

procedure Killian37
begin
  gsay_message(SCRIPT_KILLIAN, 186, NEUTRAL_REACTION);
end

procedure Killian38
begin
  gsay_message(SCRIPT_KILLIAN, 187, NEUTRAL_REACTION);
end

procedure Killian39
begin
  gsay_message(SCRIPT_KILLIAN, 188, NEUTRAL_REACTION);
end

procedure Killian40
begin
  gsay_message(SCRIPT_KILLIAN, 189, NEUTRAL_REACTION);
end

procedure Killian41
begin
  gsay_message(SCRIPT_KILLIAN, 190, NEUTRAL_REACTION);
end

procedure Killian42
begin
  gsay_message(SCRIPT_KILLIAN, 191, NEUTRAL_REACTION);
  call Killianx;
end

procedure Killian43
begin
  gsay_message(SCRIPT_KILLIAN, 192, NEUTRAL_REACTION);
  call Killianx;
end

procedure Killian44
begin
  gsay_reply(SCRIPT_KILLIAN, 193);
  call Killianx1;
end

procedure Killian45
begin
  gsay_reply(SCRIPT_KILLIAN, 194);
  giq_option(4, SCRIPT_KILLIAN, 195, Killian45a, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 196, Killian46, NEUTRAL_REACTION);
end

procedure Killian45a
begin
  gsay_reply(SCRIPT_KILLIAN, " ");
  call killian00;
end

procedure Killian46
begin
  gsay_message(SCRIPT_KILLIAN, 197, NEUTRAL_REACTION);
  call Killianx;
end

procedure Killian47
begin
  set_map_var(2, 0);
  gsay_reply(SCRIPT_KILLIAN, 198);
  giq_option(4, SCRIPT_KILLIAN, 199, Killian48, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 200, Killian50, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 201, Killian90, GOOD_REACTION);
  giq_option(-3, SCRIPT_KILLIAN, 110, Killian90, GOOD_REACTION);
  giq_option(-3, SCRIPT_KILLIAN, 111, Killian52, NEUTRAL_REACTION);
end

procedure Killian48
begin
  gsay_reply(SCRIPT_KILLIAN, 202);
  giq_option(4, SCRIPT_KILLIAN, 203, Killian49, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 204, Killian51, NEUTRAL_REACTION);
  giq_option(6, SCRIPT_KILLIAN, 205, Killian52, NEUTRAL_REACTION);
end

procedure Killian49
begin
  gsay_reply(SCRIPT_KILLIAN, 206);
  giq_option(4, SCRIPT_KILLIAN, 207, Killian50, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 208, Killian51, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 209, Killian52, NEUTRAL_REACTION);
end

procedure Killian50
begin
  gsay_reply(SCRIPT_KILLIAN, 210);
  giq_option(4, SCRIPT_KILLIAN, 211, Killian53, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 212, Killian52, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 213, Killian51, NEUTRAL_REACTION);
end

procedure Killian51
begin
  gsay_reply(SCRIPT_KILLIAN, 214);
  giq_option(4, SCRIPT_KILLIAN, 215, Killian53, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 216, Killian52, BAD_REACTION);
end

procedure Killian52
begin
  set_global_var(GVAR_CAPTURE_GIZMO, 2);
  set_map_var(6, 2);
  gsay_message(SCRIPT_KILLIAN, 217, BAD_REACTION);
  set_global_var(GVAR_CURE_JARVIS_9, 1);
  call Killianx1;
end

procedure Killian53
begin
  gsay_message(SCRIPT_KILLIAN, 218, NEUTRAL_REACTION);
  call Killianx4;
end

procedure Killian54
begin
  gsay_reply(SCRIPT_KILLIAN, 219);
  giq_option(4, SCRIPT_KILLIAN, 220, Killian55, NEUTRAL_REACTION);
  giq_option(-3, SCRIPT_KILLIAN, 111, Killian55, NEUTRAL_REACTION);
  if ((global_var(GVAR_BUG_PLANTED) == 1) or (global_var(GVAR_GOT_CONFESSION) == 1)) then begin
    giq_option(4, SCRIPT_KILLIAN, 221, Killian56, GOOD_REACTION);
    giq_option(-3, SCRIPT_KILLIAN, 110, Killian56, GOOD_REACTION);
  end
end

procedure Killian55
begin
  gsay_message(SCRIPT_KILLIAN, 222, NEUTRAL_REACTION);
  call Killianx;
end

procedure Killian56
begin
  gsay_reply(SCRIPT_KILLIAN, 223);
  if (global_var(GVAR_BUG_PLANTED)) then begin
    giq_option(4, SCRIPT_KILLIAN, 224, Killian57, NEUTRAL_REACTION);
    giq_option(-3, SCRIPT_KILLIAN, 108, Killian57, NEUTRAL_REACTION);
  end
  if (global_var(GVAR_GOT_CONFESSION)) then begin
    giq_option(4, SCRIPT_KILLIAN, 225, Killian58, NEUTRAL_REACTION);
  end
end

procedure Killian57
begin
  gsay_message(SCRIPT_KILLIAN, 226, GOOD_REACTION);
  call soundcheck;
end

procedure Killian58
begin
  gsay_reply(SCRIPT_KILLIAN, 228);
  giq_option(0, SCRIPT_MODREACT, 106, playback, GOOD_REACTION);
end

procedure Killian59
begin
  if (map_var(6) == 0) then begin
    set_map_var(6, 1);
  end
  gsay_reply(SCRIPT_KILLIAN, 230);
  giq_option(4, SCRIPT_KILLIAN, 231, Killian60, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 232, Killian61, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 233, Killian64, NEUTRAL_REACTION);
  giq_option(-3, SCRIPT_KILLIAN, 110, Killian60, NEUTRAL_REACTION);
  giq_option(-3, SCRIPT_KILLIAN, 111, Killian64, NEUTRAL_REACTION);
end

procedure Killian60
begin
  set_local_var(1, 3);
  call Level_To_React;
  set_global_var(GVAR_CAPTURE_GIZMO, 1);
  gsay_message(SCRIPT_KILLIAN, 234, GOOD_REACTION);
  call Killianx;
end

procedure Killian61
begin
  gsay_reply(SCRIPT_KILLIAN, 235);
  giq_option(4, SCRIPT_KILLIAN, 236, Killian62, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 237, Killian63, NEUTRAL_REACTION);
end

procedure Killian62
begin
  set_global_var(GVAR_CAPTURE_GIZMO, 1);
  gsay_message(SCRIPT_KILLIAN, 238, NEUTRAL_REACTION);
  call Killianx;
end

procedure Killian63
begin
  gsay_reply(SCRIPT_KILLIAN, 239);
  giq_option(4, SCRIPT_KILLIAN, 240, Killian62, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 241, Killian63a, BAD_REACTION);
end

procedure Killian64
begin
  gsay_message(SCRIPT_KILLIAN, 242, NEUTRAL_REACTION);
  call Killianx;
end

procedure Killian65
begin
  gsay_message(SCRIPT_KILLIAN, 243, NEUTRAL_REACTION);
end

procedure Killian66
begin
  gsay_message(SCRIPT_KILLIAN, 244, NEUTRAL_REACTION);
end

procedure Killian67
begin
  gsay_message(SCRIPT_KILLIAN, 245, NEUTRAL_REACTION);
end

procedure Killian68
begin
  gsay_message(SCRIPT_KILLIAN, 246, NEUTRAL_REACTION);
end

procedure Killian71
begin
  gsay_message(SCRIPT_KILLIAN, 249, NEUTRAL_REACTION);
end

procedure Killian72
begin
  gsay_message(SCRIPT_KILLIAN, 250, NEUTRAL_REACTION);
end

procedure Killian73
begin
  gsay_message(SCRIPT_KILLIAN, 251, NEUTRAL_REACTION);
end

procedure Killian74
begin
  gsay_message(SCRIPT_KILLIAN, 252, NEUTRAL_REACTION);
end

procedure Killian75
begin
  gsay_message(SCRIPT_KILLIAN, 253, NEUTRAL_REACTION);
end

procedure Killian76
begin
  gsay_message(SCRIPT_KILLIAN, 254, NEUTRAL_REACTION);
end

procedure Killian88
begin
  gsay_reply(SCRIPT_KILLIAN, 243);
  giq_option(4, SCRIPT_KILLIAN, 273, Killianx, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 274, KillianCbt, BAD_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 275, Killian48, GOOD_REACTION);
end

procedure Killian89
begin
  set_local_var(9, 1);
  set_map_var(2, 0);
  float_msg(self_obj, message_str(SCRIPT_KILLIAN, 284), FLOAT_MSG_NORMAL);
end

procedure Killian90
begin
  gsay_reply(SCRIPT_KILLIAN, 165);
  giq_option(4, SCRIPT_MODREACT, 106, Killian53, GOOD_REACTION);
end

procedure Killianx
begin
end

procedure Killianx1
begin
  giq_option(4, SCRIPT_KILLIAN, 183, Killianx3, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 184, KillianCbt, BAD_REACTION);
  giq_option(-3, SCRIPT_KILLIAN, 108, KillianCbt, BAD_REACTION);
end

procedure Killianx2
begin
end

procedure Killianx3
begin
  GVar10 := 1;
end

procedure Killianx4
begin
  GVar9 := create_object_sid(57, 0, 0, -1);
  add_obj_to_inven(dude_obj, GVar9);
  if (get_critter_stat(dude_obj, 4) > 3) then begin
    GVar9 := create_object_sid(104, 0, 0, -1);
    add_obj_to_inven(dude_obj, GVar9);
  end
  set_global_var(GVAR_HIRED_BY_KILLIAN, 1);
end

procedure Killian_barter
begin
  gdialog_mod_barter(0);
  gsay_reply(SCRIPT_KILLIAN, " ");
  giq_option(0, SCRIPT_MODREACT, 108, Killianx, NEUTRAL_REACTION);
end

procedure Killian_give_stuff
begin
  if (obj_is_carrying_obj_pid(dude_obj, 104)) then begin
    destroy_object(obj_carrying_pid_obj(dude_obj, 104));
  end
  if (obj_is_carrying_obj_pid(dude_obj, 57)) then begin
    destroy_object(obj_carrying_pid_obj(dude_obj, 57));
  end
  giq_option(4, SCRIPT_KILLIAN, 276, Killian_give_shotgun, GOOD_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 277, Killian_give_armor, GOOD_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 278, Killian_give_doctor_bag, GOOD_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 279, Killian_give_stimpaks, GOOD_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 280, Killian59, GOOD_REACTION);
  giq_option(-3, SCRIPT_KILLIAN, 111, Killian59, GOOD_REACTION);
end

procedure Killian_give_shotgun
begin
  GVar9 := create_object_sid(94, 0, 0, -1);
  add_obj_to_inven(dude_obj, GVar9);
  GVar9 := create_object_sid(95, 0, 0, -1);
  add_mult_objs_to_inven(dude_obj, GVar9, 5);
  call Killian59;
end

procedure Killian_give_armor
begin
  GVar9 := create_object_sid(1, 0, 0, -1);
  add_obj_to_inven(dude_obj, GVar9);
  call Killian59;
end

procedure Killian_give_doctor_bag
begin
  GVar9 := create_object_sid(91, 0, 0, -1);
  add_obj_to_inven(dude_obj, GVar9);
  call Killian59;
end

procedure Killian_give_stimpaks
begin
  GVar9 := create_object_sid(40, 0, 0, -1);
  add_mult_objs_to_inven(dude_obj, GVar9, 5);
  call Killian59;
end

procedure soundcheck
begin
  gsay_reply(SCRIPT_KILLIAN, 227);
  call Killian_give_stuff;
end

procedure playback
begin
  gsay_reply(SCRIPT_KILLIAN, 229);
  call Killian_give_stuff;
end

procedure Killian02a
begin
  call Down_React_Level;
  call Killian16;
end

procedure Killian02b
begin
  gsay_reply(0, 0);
  call killian00;
end

procedure Killian03aa
begin
  call Down_React_Level;
  call Killian04;
end

procedure Killian03ba
begin
  call Down_React_Level;
  call Killian03a;
end

procedure Killian03ca
begin
  call Down_React_Level;
  call Killian16;
end

procedure Killian32a
begin
  call Down_React_Level;
  call Killianx2;
end

procedure Killian63a
begin
  call Down_React_Level;
  call Killian64;
end

procedure get_stuff_from_safe
begin
  variable LVar0 := 0;
  if (item_caps_total(KillSafe_ptr) != 0) then begin
    item_caps_adjust(self_obj, item_caps_total(KillSafe_ptr));
    item_caps_adjust(KillSafe_ptr, -item_caps_total(KillSafe_ptr));
  end
  if (obj_is_carrying_obj_pid(KillSafe_ptr, 18) != 0) then begin
    GVar9 := obj_carrying_pid_obj(KillSafe_ptr, 18);
    rm_obj_from_inven(KillSafe_ptr, GVar9);
    add_obj_to_inven(self_obj, GVar9);
  end
  if (obj_is_carrying_obj_pid(KillSafe_ptr, 40) != 0) then begin
    GVar9 := obj_carrying_pid_obj(KillSafe_ptr, 40);
    rm_obj_from_inven(KillSafe_ptr, GVar9);
    add_obj_to_inven(self_obj, GVar9);
  end
  if (obj_is_carrying_obj_pid(KillSafe_ptr, 31) != 0) then begin
    GVar9 := obj_carrying_pid_obj(KillSafe_ptr, 31);
    rm_obj_from_inven(KillSafe_ptr, GVar9);
    add_obj_to_inven(self_obj, GVar9);
  end
  if (obj_is_carrying_obj_pid(KillSafe_ptr, 34) != 0) then begin
    GVar9 := obj_carrying_pid_obj(KillSafe_ptr, 34);
    rm_obj_from_inven(KillSafe_ptr, GVar9);
    add_obj_to_inven(self_obj, GVar9);
  end
  if (obj_is_carrying_obj_pid(KillSafe_ptr, 30) != 0) then begin
    GVar9 := obj_carrying_pid_obj(KillSafe_ptr, 30);
    rm_obj_from_inven(KillSafe_ptr, GVar9);
    add_obj_to_inven(self_obj, GVar9);
  end
  if (obj_is_carrying_obj_pid(KillSafe_ptr, 4) != 0) then begin
    GVar9 := obj_carrying_pid_obj(KillSafe_ptr, 4);
    rm_obj_from_inven(KillSafe_ptr, GVar9);
    add_obj_to_inven(self_obj, GVar9);
  end
end

procedure put_stuff_in_safe
begin
  variable LVar0 := 0;
  if (item_caps_total(self_obj) != 0) then begin
    item_caps_adjust(KillSafe_ptr, item_caps_total(self_obj));
    item_caps_adjust(self_obj, -item_caps_total(self_obj));
  end
  if (obj_is_carrying_obj_pid(self_obj, 18) > 1) then begin
    GVar9 := obj_carrying_pid_obj(self_obj, 18);
    rm_obj_from_inven(self_obj, GVar9);
    add_obj_to_inven(KillSafe_ptr, GVar9);
  end
  if (obj_is_carrying_obj_pid(self_obj, 40) > 1) then begin
    GVar9 := obj_carrying_pid_obj(self_obj, 40);
    rm_obj_from_inven(self_obj, GVar9);
    add_obj_to_inven(KillSafe_ptr, GVar9);
  end
  if (obj_is_carrying_obj_pid(self_obj, 31) > 1) then begin
    GVar9 := obj_carrying_pid_obj(self_obj, 31);
    rm_obj_from_inven(self_obj, GVar9);
    add_obj_to_inven(KillSafe_ptr, GVar9);
  end
  if (obj_is_carrying_obj_pid(self_obj, 34) > 1) then begin
    GVar9 := obj_carrying_pid_obj(self_obj, 34);
    rm_obj_from_inven(self_obj, GVar9);
    add_obj_to_inven(KillSafe_ptr, GVar9);
  end
  if (obj_is_carrying_obj_pid(self_obj, 30) > 1) then begin
    GVar9 := obj_carrying_pid_obj(self_obj, 30);
    rm_obj_from_inven(self_obj, GVar9);
    add_obj_to_inven(KillSafe_ptr, GVar9);
  end
  if (obj_is_carrying_obj_pid(self_obj, 4) > 1) then begin
    GVar9 := obj_carrying_pid_obj(self_obj, 4);
    rm_obj_from_inven(self_obj, GVar9);
    add_obj_to_inven(KillSafe_ptr, GVar9);
  end
end

procedure sleeping
begin
  if (local_var(7) == 1) then begin
    if (not(GVar11) and (game_time_hour >= GVar12) and (game_time_hour < GVar13) or (GVar11 and ((game_time_hour >= GVar12) or (game_time_hour < GVar13)))) then begin
      if (((game_time_hour - GVar12) < 10) and ((game_time_hour - GVar12) > 0)) then begin
        if (tile_num(self_obj) != GVar14) then begin
          animate_move_obj_to_tile(self_obj, GVar14, ANIMATE_WALK);
        end
        else begin
          set_local_var(7, 0);
        end
      end
      else begin
        move_to(self_obj, GVar14, elevation(self_obj));
        if (tile_num(self_obj) == GVar14) then begin
          set_local_var(7, 0);
        end
      end
    end
  end
  else begin
    if (GVar11 and (game_time_hour >= GVar13) and (game_time_hour < GVar12) or (not(GVar11) and ((game_time_hour >= GVar13) or (game_time_hour < GVar12)))) then begin
      if (((game_time_hour - GVar13) < 10) and ((game_time_hour - GVar13) > 0)) then begin
        if (tile_num(self_obj) != GVar15) then begin
          animate_move_obj_to_tile(self_obj, self_obj, ANIMATE_WALK);
        end
        else begin
          set_local_var(7, 1);
        end
      end
      else begin
        if (tile_num(self_obj) != GVar15) then begin
          move_to(self_obj, GVar15, elevation(self_obj));
        end
        else begin
          set_local_var(7, 1);
        end
      end
    end
  end
end

procedure Get_Reaction
begin
  if (local_var(2) == 0) then begin
    set_local_var(0, 50);
    set_local_var(1, 2);
    set_local_var(2, 1);
    set_local_var(0, local_var(0) + (5 * get_critter_stat(dude_obj, 3)) - 25);
    set_local_var(0, local_var(0) + (10 * has_trait(0, dude_obj, 10)));
    if (has_trait(0, dude_obj, 39)) then begin
      if (global_var(GVAR_PLAYER_REPUTATION) > 0) then begin
        set_local_var(0, local_var(0) + global_var(GVAR_PLAYER_REPUTATION));
      end
      else begin
        set_local_var(0, local_var(0) - global_var(GVAR_PLAYER_REPUTATION));
      end
    end
    else begin
      if (local_var(3) == 1) then begin
        set_local_var(0, local_var(0) - global_var(GVAR_PLAYER_REPUTATION));
      end
      else begin
        set_local_var(0, local_var(0) + global_var(GVAR_PLAYER_REPUTATION));
      end
    end
    if (global_var(GVAR_CHILDKILLER_REPUTATION) > 2) then begin
      set_local_var(0, local_var(0) - 30);
    end
    if (((global_var(GVAR_BAD_MONSTER) + global_var(GVAR_GOOD_MONSTER)) >= 25) and ((global_var(GVAR_BAD_MONSTER) > (3 * global_var(GVAR_GOOD_MONSTER))) or (global_var(GVAR_CHAMPION_REPUTATION) == 1))) then begin
      set_local_var(0, local_var(0) + 20);
    end
    if (((global_var(GVAR_BAD_MONSTER) + global_var(GVAR_GOOD_MONSTER)) >= 25) and ((global_var(GVAR_GOOD_MONSTER) > (2 * global_var(GVAR_BAD_MONSTER))) or (global_var(GVAR_BERSERKER_REPUTATION) == 1))) then begin
      set_local_var(0, local_var(0) - 20);
    end
    call React_To_Level;
  end
end

procedure React_To_Level
begin
  if (local_var(0) <= 25) then begin
    set_local_var(1, 1);
  end
  else begin
    if (local_var(0) <= 75) then begin
      set_local_var(1, 2);
    end
    else begin
      set_local_var(1, 3);
    end
  end
end

procedure Level_To_React
begin
  if (local_var(1) == 1) then begin
    set_local_var(0, random(1, 25));
  end
  else begin
    if (local_var(1) == 2) then begin
      set_local_var(0, random(26, 75));
    end
    else begin
      set_local_var(0, random(76, 100));
    end
  end
end

procedure Up_React
begin
  set_local_var(0, local_var(0) + 10);
  call React_To_Level;
end

procedure Down_React
begin
  set_local_var(0, local_var(0) - 10);
  call React_To_Level;
end

procedure Bottom_React
begin
  set_local_var(1, 1);
  set_local_var(0, 1);
end

procedure Top_React
begin
  set_local_var(0, 100);
  set_local_var(1, 3);
end

procedure Big_Up_React
begin
  set_local_var(0, local_var(0) + 25);
  call React_To_Level;
end

procedure Big_Down_React
begin
  set_local_var(0, local_var(0) - 25);
  call React_To_Level;
end

procedure Up_React_Level
begin
  set_local_var(1, local_var(1) + 1);
  if (local_var(1) > 3) then begin
    set_local_var(1, 3);
  end
  call Level_To_React;
end

procedure Down_React_Level
begin
  set_local_var(1, local_var(1) - 1);
  if (local_var(1) < 1) then begin
    set_local_var(1, 1);
  end
  call Level_To_React;
end

procedure Goodbyes
begin
  GVar16 := message_str(SCRIPT_MODREACT, random(100, 105));
end

procedure killian00
begin
  if (local_var(4) == 0) then begin
    giq_option(4, SCRIPT_KILLIAN, 101, Killian02, NEUTRAL_REACTION);
  end
  giq_option(5, SCRIPT_KILLIAN, 102, Killian11, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 103, Killian22, NEUTRAL_REACTION);
  giq_option(4, SCRIPT_KILLIAN, 104, Killian21, NEUTRAL_REACTION);
  giq_option(5, SCRIPT_KILLIAN, 105, Killian13, NEUTRAL_REACTION);
  if ((global_var(GVAR_HIRED_BY_GIZMO) == 1) and (global_var(GVAR_GIZMO_DEAD) == 0) and (global_var(GVAR_HIRED_BY_KILLIAN) == 0)) then begin
    giq_option(4, SCRIPT_KILLIAN, 272, Killian88, NEUTRAL_REACTION);
  end
  if ((global_var(GVAR_HIRED_BY_KILLIAN) == 1) and (global_var(GVAR_GIZMO_DEAD) == 0) and (map_var(6) == 0)) then begin
    giq_option(5, SCRIPT_KILLIAN, 106, Killian23, NEUTRAL_REACTION);
  end
  giq_option(4, SCRIPT_KILLIAN, 107, Killianx, NEUTRAL_REACTION);
  giq_option(-3, SCRIPT_KILLIAN, 108, Killian0a, NEUTRAL_REACTION);
end

procedure killian69
begin
  gsay_message(SCRIPT_KILLIAN, 247, NEUTRAL_REACTION);
end

procedure killian70
begin
  gsay_message(SCRIPT_KILLIAN, 248, NEUTRAL_REACTION);
end

procedure killian76a
begin
  gsay_message(SCRIPT_KILLIAN, 255, NEUTRAL_REACTION);
end

procedure killian77
begin
  gsay_message(SCRIPT_KILLIAN, 256, NEUTRAL_REACTION);
end

procedure killian78
begin
  gsay_message(SCRIPT_KILLIAN, 257, NEUTRAL_REACTION);
end

procedure killian79
begin
  gsay_message(SCRIPT_KILLIAN, 258, NEUTRAL_REACTION);
end

procedure killian80
begin
  gsay_message(SCRIPT_KILLIAN, 259, NEUTRAL_REACTION);
end

procedure killian81
begin
  gsay_message(SCRIPT_KILLIAN, 260, NEUTRAL_REACTION);
end

procedure killian82
begin
  gsay_message(SCRIPT_KILLIAN, 261, NEUTRAL_REACTION);
end

procedure killian83
begin
  gsay_message(SCRIPT_KILLIAN, 262, NEUTRAL_REACTION);
end

procedure killian84
begin
  gsay_message(SCRIPT_KILLIAN, 263, NEUTRAL_REACTION);
end

procedure killian85
begin
  gsay_message(SCRIPT_KILLIAN, 264, NEUTRAL_REACTION);
end

procedure killian86
begin
  gsay_message(SCRIPT_KILLIAN, 265, NEUTRAL_REACTION);
end

procedure killian87
begin
  gsay_message(SCRIPT_KILLIAN, 266, NEUTRAL_REACTION);
end
