summaryrefslogtreecommitdiff
path: root/world/map/npc/052-2/chest.txt
blob: d7644054361cbfb254d7a11fa53f8532ffbe138c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//-----------------------------------------------------------------------------
// Illia Forsaken Inn - Chest room
// $@illia_progress = 8
//
// Level progress:
//     No progress: Players pick the rewards, then leave,
//                  with the Hero forced to leave last.
// @illia_got_rewards value:
//     0: player did not pick his reward yet
//     1: player picked his common rewards
//     2: player picked his unique rewards
//     3: player choosed to leave the room
//-----------------------------------------------------------------------------

052-2,136,73,0|script|Chest#illia|111
{
    set @step, 8;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if (@illia_got_rewards > 2) end;
    if (@illia_got_rewards == 2) goto L_AlreadyGotReward;
    if (@illia_current_num_rewards > 0) goto L_ResumePick;
    set @illia_current_num_rewards, 0;
    mes "You find an opened chest which seems full of equipments.";
    next;
    mes "You realize again you were not the first one to visit this place. But where the others failed, you succeeded.";
    goto L_Pick;

L_ShouldNotBeHere:
    heal -Hp, 0;
    end;

OnInit:
    setarray $@illia_common_rewards$,   "SteelShield",  "WarlordHelmet",  "KnightsHelmet",  "InfantryHelmet",  "CrusadeHelmet",  "ChainmailShirt",  "LightPlatemail",  "WarlordPlate",  "Setzer", "RockKnife",  "WarlordBoots",  "ForestArmor",  "ForestBow",  "WoodenStaff",  "WizardHat",  "ShortSword", "BoneKnife",  "JeansChaps",  "PointyWitchHat", "AssassinPants", "AssassinGloves", "AssassinBoots";
    setarray $@illia_common_rewards_n$, "Steel Shield", "Warlord Helmet", "Knights Helmet", "Infantry Helmet", "Crusade Helmet", "Chainmail Shirt", "Light Platemail", "Warlord Plate", "Setzer", "Rock Knife", "Warlord Boots", "Forest Armor", "Forest Bow", "Wooden Staff", "Wizard Hat", "Short Sword", "Bone Knife", "Jeans Chaps",   "Pointy Witch Hat", "Assassin Pants", "Assassin Gloves", "Assassin Boots";
    setarray $@illia_unique_rewards$,   "BullHelmet",  "BansheeBow",  "HeartOfIsis",   "LazuriteRobe", "AssassinShirt";
    setarray $@illia_unique_rewards_n$, "Bull Helmet", "Banshee Bow", "Heart of Isis", "Lazurite Robe", "Assassin Shirt";
    end;

L_ResumePick:
    mes "Ok. I should continue to dig in this chest...";
    menu
        "... and quickly.", L_GetReward,
        "... or maybe not. I am out of time.", L_AskLeaving,
        "... but I can't carry more stuff.", L_AskLeaving,
        "... no, wait a minute.", L_Close;

L_Pick:
    menu
        "Let's take what I deserve for all this.", L_GetReward,
        "Wait.", L_Close;

L_GetReward:
    if (@illia_got_rewards == 0)
        goto L_GetCommonReward;
    if (@illia_got_rewards == 1)
        goto L_GetUniqueReward;
    goto L_Close;

L_GetCommonReward:
    if (@illia_current_num_rewards == $@illia_num_common_reward_items)
        goto L_RewardDone;
    getinventorylist;
    set @index, rand(getarraysize($@illia_common_rewards$));
    set @reward$, $@illia_common_rewards$[@index];
    if ((checkweight(@reward$, 1) == 0) || (@inventorylist_count == 100))
        goto L_InventoryNoSpace;
    set @illia_current_num_rewards, @illia_current_num_rewards + 1;
    getitem @reward$, 1;
    mes "You found a " + $@illia_common_rewards_n$[@index] + "!";
    set @reward$, "";
    goto L_GetCommonReward;

L_GetUniqueReward:
    if (@illia_current_num_rewards == $@illia_num_unique_reward_items)
        goto L_RewardDone;
    if (Illia_Uniques_Count >= 2)
        goto L_GetUniqueReward2;
    getinventorylist;
    set @index, rand(getarraysize($@illia_unique_rewards$));
    set @reward$, $@illia_unique_rewards$[@index];
    if ((checkweight(@reward$, 1) == 0) || (@inventorylist_count == 100))
        goto L_InventoryNoSpace;
    next;
    mes "You notice an interesting shape hidden under a cover...";
    next;
    set @illia_current_num_rewards, @illia_current_num_rewards + 1;
    getitem @reward$, 1;
    mes "You found a " + $@illia_unique_rewards_n$[@index] + "!";
    set Illia_Uniques_Count, Illia_Uniques_Count + 1;
    set @reward$, "";
    goto L_GetUniqueReward;

L_GetUniqueReward2:
    next;
    mes "You find a bunch of gold pieces!";
    next;
    set Zeny, Zeny + 100000*($@illia_num_unique_reward_items - @illia_current_num_rewards);
    getexp 200000*($@illia_num_unique_reward_items - @illia_current_num_rewards), 0;
    set @illia_current_num_rewards, $@illia_num_unique_reward_items;
    goto L_GetUniqueReward;

L_AlreadyGotReward:
    mes "I already took my part.";
    next;
    goto L_AskLeaving;

L_RewardDone:
    set @illia_got_rewards, @illia_got_rewards + 1;
    set @illia_current_num_rewards, 0;
    next;
    if (@illia_got_rewards == 1)
        goto L_GetUniqueReward;
    goto L_AskLeaving; // @illia_got_rewards == 2

L_InventoryNoSpace:
    mes "You cannot carry more stuff. Make some room first.";
    close;

L_AskLeaving:
    mes "It's time to leave this place now.";
    next;
    // Force the hero to leave last, as this event triggers the end of the quest
    // as well as some dialogs from Valia, when the hero returns.
    if (strcharinfo(0) == $@ILLIA_HERO$ && getareausers("052-2", 19, 8, 137, 88) > 1)
        goto L_WaitHelpersLeave;
    goto L_PrepareLeaving;

L_WaitHelpersLeave:
    mes "However, I'd better wait my friends leave before I do.";
    next;
    mes "I prefer to know they left safely this place.";
    close;

L_PrepareLeaving:
    mes "Use Valia's ring to teleport now?";
    menu
        "Yes. Time to make her pay for her trick!", L_Leave,
        "No, I still need to see things here.", L_Close;

L_Leave:
    set @illia_got_rewards, 3;
    set @illia_current_num_rewards, 0;
    addtimer 1000, "Chest#illia::OnMsg1";
    addtimer 4000, "Chest#illia::OnMsg2";
    addtimer 7000, "Chest#illia::OnMsg3";
    addtimer 9000, "Chest#illia::OnFx";
    addtimer 10000, "Chest#illia::OnRing";
    close;

OnMsg1:
    message strcharinfo(0), "At the moment you are wearing the ring, you start to feel dizzy...";
    end;

OnMsg2:
    message strcharinfo(0), "Who is Luvia? Something isn't right... It looks like your memory is rewritten.";
    end;

OnMsg3:
    message strcharinfo(0), "Damn, this ring! That Valia! Someone...";
    end;

OnFx:
    misceffect FX_MAGIC_BLUE_TELEPORT, strcharinfo(0);
    end;

OnRing:
    warp "007-2",31 + rand(0,2),23 + rand(0,2);
    if (strcharinfo(0) == $@ILLIA_HERO$)
        goto L_ScheduleEnd;
    end;

L_ScheduleEnd:
    set $@ILLIA_STATUS, 253;
    startnpctimer "Valia";
    donpcevent "#IlliaDaemon::OnCommandToggle";
    end;

L_Close:
    close;

}