summaryrefslogtreecommitdiff
path: root/world/map/npc/099-7/chronos.txt
blob: c0e0c9e8bd587aa5c0316df43aed8ea471e3fe2f (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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
// Chronos, the lord of time and apparently a shopkeeper
// There's also Father Time in the GM stuff

099-7,95,27,0|script|Chronos|313
{
    cleararray @items$, "", getarraysize(@items$); // must be cleared here if someone used the close button last time then items would remain in list
    cleararray @item_names$, "", getarraysize(@item_names$);
    cleararray @shopopt$, "", getarraysize(@shopopt$);

    mes "[Chronos]";
    mes "\"I'm Chronos, lord of time, the immortal, the head editor of the Almanach, the... Alright, let's forget that.\"";
    if (BOSS_POINTS < .price) goto L_Close;
    // (Does this even work? I'm not sure)
    // Wouldn't (gettime(7) * 10000 + gettime(6)) work better?
    set @cur_date, (gettime(7) << 5) | (gettime(6) << 1);
    if (#CHRONOS == @cur_date) goto L_Maxed;
    if ($CHRONOS_STOCK < 1) goto L_Maxed;
    set @cur_date, 0;
    next;

    // Boss Points validation
    set @cur, BOSS_POINTS / .price;
    set @BOSS_MEDALS, (KESHLAM_STATE & BYTE_0_MASK);
    set @BOSS_MEDALS_AVAILABLE, (KESHLAM_STATE & BYTE_1_MASK) >> BYTE_1_SHIFT;
    if ( @BOSS_MEDALS >= CHRONOS_BOSS_MEDALS_MAX) goto L_CantGiveMedals;

    set @dif, @cur - @BOSS_MEDALS;
    if (@dif >= 1) goto L_GiveMedals;
    mes "[Chronos]";
    mes "\"You haven't made any progress, so I can't give you any Boss Medals at this time.\"";
    mes "";
    goto L_CheckAvailableMedals;

L_CantGiveMedals:
    mes "[Chronos]";
    mes "\"You reached the maximum possible Boss Medals I can keep track for you already so I will not look if you deserve more sorry.\"";
    mes "";
    goto L_CheckAvailableMedals;

L_CheckAvailableMedals:
    if (@BOSS_MEDALS_AVAILABLE >= 1) goto L_Question;
    mes "[Chronos]";
    mes "\"Sadly there are no Boss Medals for you to do shopping left.\"";
    goto L_Close;

L_GiveMedals:
    set @BOSS_MEDALS, @BOSS_MEDALS + @dif;
    if (@BOSS_MEDALS > CHRONOS_BOSS_MEDALS_MAX) goto L_ExededMaxMedals;
    set @BOSS_MEDALS_AVAILABLE, @BOSS_MEDALS_AVAILABLE + @dif;
    set KESHLAM_STATE, (KESHLAM_STATE & ~(BYTE_0_MASK + BYTE_1_MASK)) | @BOSS_MEDALS | @BOSS_MEDALS_AVAILABLE << BYTE_1_SHIFT;
    mes "[Chronos]";
    mes "\"For your deeds, I shall bestow upon you " + @dif + " Boss Medals. Use them wisely, they are the results of your hard effort.";
    mes "Boss Medals are earned each " + .price + " boss points. They are character-bound and cannot be given to other players, not even other versions of you.";
    mes "I will keep them for you until you evolved a bit.\"";
    next;
    if (@BOSS_MEDALS == CHRONOS_BOSS_MEDALS_MAX) goto L_MaxedMedals;
    goto L_Question;

L_MaxedMedals:
    wgm "=> Player `"+strcharinfo(0) + "` reached maximum possible Boss Medals (" + CHRONOS_BOSS_MEDALS_MAX + ") from Chronos.";
    debugmes "=> Player `"+strcharinfo(0) + "` reached maximum possible Boss Medals (" + CHRONOS_BOSS_MEDALS_MAX + ") from Chronos.";
    mes "[Chronos]";
    mes "\"Oh you just reached the maximum possible Boss Medals I can keep track for you this means I can't give you more in the future.";
    mes "I just reached out telepatically to the invisible forces that keep this world into motion and told them what happened to you, so they are aware of your situation.\"";
    next;
    goto L_Question;
    
L_ExededMaxMedals:
    set @cur, CHRONOS_BOSS_MEDALS_MAX - (@BOSS_MEDALS - @dif);
    set @BOSS_MEDALS, CHRONOS_BOSS_MEDALS_MAX;
    set @BOSS_MEDALS_AVAILABLE, @BOSS_MEDALS_AVAILABLE + @cur;
    set @dif, @dif - @cur;
    set KESHLAM_STATE, (KESHLAM_STATE & ~(BYTE_0_MASK + BYTE_1_MASK)) | @BOSS_MEDALS | @BOSS_MEDALS_AVAILABLE << BYTE_1_SHIFT;
    wgm "=> Player `"+strcharinfo(0) + "` exeded maximum possible Boss Medals (" + CHRONOS_BOSS_MEDALS_MAX + ") from Chronos by " + @dif +  " .";
    debugmes "=> Player `"+strcharinfo(0) + "` exeded maximum possible Boss Medals (" + CHRONOS_BOSS_MEDALS_MAX + ") from Chronos by " + @dif +  " .";
    mes "[Chronos]";
    mes "\"Oh you just exeded the maximum possible Boss Medals I can keep track for you by " + @dif + " so I can only bestow upon you " + @cur +  " Boss Medals now and this means I can't give you more in the future.";
    mes "I just reached out telepatically to the invisible forces that keep this world into motion and told them what happened to you, maybe they can help you.\"";
    next;
    goto L_Question;

L_Question:
    // Shopkeeping
    mes "[Chronos]";
    mes "\"All things shall pass, but with the limited time you have, please enjoy shopkeeping.\"";
    if (countitem("UnderworldKey")<1) goto L_Shop;
        menu
            "Thanks.", L_Shop,
            "Do you know what the Underworld Key is for?", L_UKey; // not needed here but why not?
L_UKey:
    mes "";
    mes "[Chronos]";
    mes "\"Yes, I do. But now is not the time. One day, when the event horizon aligns itself and the lazy titans move, then I shall tell you what you need to know.\""; // lazy titans = The developers and shout out to Kronus from mythology
    goto L_Close;

L_Shop:
    set @num_medals, 0; // set to 0 to be safe

    set @default_choice$, "I'm not sure right now maybe later.";
    set @r, 0;

    set @shopoptcounter, 0;
    setarray @shopopt$, "", "", "", "", "";

    if(@BOSS_MEDALS_AVAILABLE < 1) goto L_Close;
    set @shopopt$[@shopoptcounter], "1 Boss Medal";
    set @shopoptcounter, @shopoptcounter + 1;

    if(@BOSS_MEDALS_AVAILABLE < 2) goto L_ShopMenuCreated;
    set @shopopt$[@shopoptcounter], "2 Boss Medals";
    set @shopoptcounter, @shopoptcounter + 1;

    if(@BOSS_MEDALS_AVAILABLE < 3) goto L_ShopMenuCreated;
    set @shopopt$[@shopoptcounter], "3 Boss Medals";
    set @shopoptcounter, @shopoptcounter + 1;

    if(@BOSS_MEDALS_AVAILABLE < 4) goto L_ShopMenuCreated;
    set @shopopt$[@shopoptcounter], "4 Boss Medals";
    set @shopoptcounter, @shopoptcounter + 1;
    goto L_ShopMenuCreated;

L_ShopMenuCreated:
    set @shopopt$[@shopoptcounter], "I must think about this again, good bye.";
    mes "";
    mes "[Chronos]";
    mes "\"You have " + @BOSS_MEDALS_AVAILABLE + " Boss Medals left.";
    mes "For which amount of Boss Medals you want to get a reward?\"";
    menu
        @shopopt$[0], L_MenuItems,
        @shopopt$[1], L_MenuItems,
        @shopopt$[2], L_MenuItems,
        @shopopt$[3], L_MenuItems,
        @shopopt$[4], L_MenuItems;

L_MenuItems:
    set @menu, @menu - 1;
    if(@menu >= @shopoptcounter) goto L_Close;
    if(@menu == 0) goto L_Show1MedalRewards;
    if(@menu == 1) goto L_Show2MedalRewards;
    if(@menu == 2) goto L_Show3MedalRewards;
    if(@menu == 3) goto L_Show4MedalRewards;
    goto L_Close;

L_Show1MedalRewards:
    set @num_medals, 1;
    cleararray @items$, "", getarraysize($@chronos_1_medal$);
    cleararray @item_names$, "", getarraysize($@chronos_1_medal_n$);
    set @j, getarraysize($@chronos_1_medal$);
    goto L_CloneArray;

L_Show2MedalRewards:
    set @num_medals, 2;
    cleararray @items$, "", getarraysize($@chronos_2_medal$);
    cleararray @item_names$, "", getarraysize($@chronos_2_medal_n$);
    set @j, getarraysize($@chronos_2_medal$);
    goto L_CloneArray;

L_Show3MedalRewards:
    set @num_medals, 3;
    cleararray @items$, "", getarraysize($@chronos_3_medal$);
    cleararray @item_names$, "", getarraysize($@chronos_3_medal_n$);
    set @j, getarraysize($@chronos_3_medal$);
    goto L_CloneArray;

L_Show4MedalRewards:
    set @num_medals, 4;
    cleararray @items$, "", getarraysize($@chronos_4_medal$);
    cleararray @item_names$, "", getarraysize($@chronos_4_medal_n$);
    set @j, getarraysize($@chronos_4_medal$);
    goto L_CloneArray;

L_CloneArray:
    if(@num_medals==1) goto L_CloneArray1;
    if(@num_medals==2) goto L_CloneArray2;
    if(@num_medals==3) goto L_CloneArray3;
    if(@num_medals==4) goto L_CloneArray4;
    goto L_Close;

L_CloneArray1:
    set @items$[@r], $@chronos_1_medal$[@r];
    set @item_names$[@r], $@chronos_1_medal_n$[@r];
    goto L_CloneArrayNext;
L_CloneArray2:
    set @items$[@r], $@chronos_2_medal$[@r];
    set @item_names$[@r], $@chronos_2_medal_n$[@r];
    goto L_CloneArrayNext;
L_CloneArray3:
    set @items$[@r], $@chronos_3_medal$[@r];
    set @item_names$[@r], $@chronos_3_medal_n$[@r];
    goto L_CloneArrayNext;
L_CloneArray4:
    set @items$[@r], $@chronos_4_medal$[@r];
    set @item_names$[@r], $@chronos_4_medal_n$[@r];
    goto L_CloneArrayNext;

L_CloneArrayNext:
    set @r, @r + 1;
    if(@r < @j) goto L_CloneArray;
    goto L_rewards_choice;

L_rewards_choice:
    mes "";
    mes "[Chronos]";
    mes "\"What Item you want?\"";
    next;
    callfunc "ItemMenu$";
    if(@item$ == "") goto L_Close;

    mes "";
    mes "\"You really want the " + @item_names$[@index] + "? For only time will reveal the wisdom of this choice, but then, it'll be too late.\"";
    menu
        "No", L_Close,
        "Yes", L_Yes;
    // to prevent fast key pressers and clickers from doing an error put No first as it's the highlighted item then.
    // but its not able to handle if someone moves the mouse on the wrong menu item and double clicks.

L_Yes:
    getinventorylist;
    if ((checkweight(@item$, 1) == 0) || (@inventorylist_count == 100)) goto L_InvFull;
    if ($CHRONOS_STOCK < 1) goto L_Maxed;

    mes "";
    mes "[Chronos]";
    mes "\"Here's your " + @item_names$[@index] + ", good bye.\"";
    wgm "=> Player `"+strcharinfo(0) + "` obtained the following item from Chronos: "+ @item_names$[@index];
    debugmes "=> Player `"+strcharinfo(0) + "` obtained the following item from Chronos: "+ @item_names$[@index];
    set @BOSS_MEDALS_AVAILABLE, @BOSS_MEDALS_AVAILABLE - @num_medals;
    set KESHLAM_STATE, (KESHLAM_STATE & ~BYTE_1_MASK) | @BOSS_MEDALS_AVAILABLE << BYTE_1_SHIFT;
    set $CHRONOS_STOCK, $CHRONOS_STOCK - 1;
    set @cur_date, (gettime(7) << 5) | (gettime(6) << 1);
    set #CHRONOS, @cur_date;
    set @cur_date, 0;
    getitem @item$, 1;
    goto L_Close;

L_Maxed:
    set @cur_date, 0;
    mes "";
    mes "[Chronos]";
    mes "\"I'm afraid I don't have anything now, please wait until my next travel, or complete the Tree of Knowledge quest for my amusement.\"";
    goto L_Close;

L_InvFull:
    mes "";
    mes "[Chronos]";
    mes "\"Your inventory is full come again when you have some free space, good bye.\"";
    goto L_Close;

L_Close:
    set @BOSS_MEDALS, 0;
    set @BOSS_MEDALS_AVAILABLE, 0;
    set @cur, 0;
    set @dif, 0;
    set @num_medals, 0;
    set @item$, 0;
    set @index, 0;
    set @default_choice$, "";
    set @r, 0;
    set @j, 0;
    cleararray @items$, "", getarraysize(@items$);
    cleararray @item_names$, "", getarraysize(@item_names$);
    set @shopoptcounter, 0;
    cleararray @shopopt$, "", getarraysize(@shopopt$);
    close;

OnClock0010:
    if (gettime(5) == 1)
        set $CHRONOS_STOCK, 5;
    end;

OnInit:
    set .price, 5000;
    if ($CHRONOS_STOCK < 1)
        set $CHRONOS_STOCK, 3;

    setarray $@chronos_1_medal$, "MovieCap", "BlueWolfHelmet", "CloverHat", "RabbitEars", "Goggles", "LeatherGoggles", "Crown", "Cap",
                                 "GuyFawkesMask", "WitchDoctorsMask", "ElfNightcap", "Sunglasses", "ChristmasTreeHat", "SantaBeardHat", "MoubooHead", "PaperBag", "BunchOfParsley", "SkullMask",
                                 "SnowGoggles", "HeartGlasses", "OperaMask", "JesterMask", "WitchHat", "GoblinMask",
                                 "ChefHat", "EskimoHat", "AFKCap", "SmileyCap",
                                 "RedShades", "GreenShades", "DarkBlueShades", "YellowShades", "LightBlueShades", "PinkShades", "BlackShades", "OrangeShades", "PurpleShades", "DarkGreenShades",
                                 "SnowLauncher";
    setarray $@chronos_1_medal_n$, "Movie Cap", "Blue Wolf Helmet", "Clover Top Hat", "White Rabbit Ears", "Goggles", "Leather Goggles", "Crown", "Cap",
                                   "Guy Fawkes Mask", "Witch Doctor's Mask", "Elf Nightcap", "Sunglasses", "Christmas Tree Hat", "Santa Beard Hat", "Mouboo Head", "Paper Bag", "Bunch of Parsley", "Skull Mask",
                                   "Snow Goggles", "Heart Glasses", "Opera Mask", "Jester Mask", "Witch Hat", "Goblin Mask",
                                   "Chef Hat", "Eskimo Hat", "AFK Cap", "Smiley Cap",
                                   "Red Shades", "Green Shades", "Dark Blue Shades", "Yellow Shades", "Light Blue Shades", "Pink Shades", "Black Shades", "Orange Shades", "Purple Shades", "Dark Green Shades",
                                   "Candy-Caned Anti-Grinch-Rifle 2020";

    setarray $@chronos_2_medal$, "Eyepatch", "TopHat", "FunkyHat", "MushHat", "ShroomHat", "ChristmasElfHat", "FaceMask", "CaptainsHat", "TamOShanter", "BunnyEars", "PanHat", "PilotHat",
                                 "CarbonGasMask", "GroovyHat", "JazzyHat", "AnniversaryHat", "ChicSantaHat", "ReadingGlasses", "EggshellHat", "Pipe", "ScarabArmlet",
                                 "BlinkingEvil", "BlinkingEvilRed", "BlinkingEvilBlue", "BlinkingEvilPink", "BlinkingEvilYellow", "BlinkingHocus", "GoldenPlatemail", "Earmuffs";
    setarray $@chronos_2_medal_n$, "Eyepatch", "Top Hat", "Funky Hat", "Mush Hat", "Shroom Hat", "Christmas Elf Hat", "Face Mask", "Captain's Hat", "Tam O' Shanter", "Bunny Ears", "Pan Hat", "Pilot Hat",
                                   "Carbon Gas Mask", "Groovy Hat", "Jazzy Hat", "Anniversary Hat", "Chic Santa Hat", "Reading Glasses", "Eggshell Hat", "Smoking Pipe", "Scarab Armlet",
                                   "Mask of Blinking Evil (Green)", "Mask of Blinking Evil (Red)", "Mask of Blinking Evil (Blue)", "Mask of Blinking Evil (Pink)", "Mask of Blinking Evil (Yellow)", "Mask of Blinking Hocus", "Golden Platemail", "Earmuffs";

    setarray $@chronos_3_medal$, "BlinkingEvilHalloween", "MoonshroomHat", "WhiteEvokersRobeBlue", "BlackEvokersRobeBlue", "ApprenticeRobe", "GoldenWarlordPlate", "MageRing";
    setarray $@chronos_3_medal_n$, "Mask of Blinking Evil (Orange)", "Moonshroom Hat", "White Evoker's Robe (Blue)", "Black Evoker's Robe (Blue)", "Apprentice Robe", "Golden Warlord Plate", "Magic Ring";

    setarray $@chronos_4_medal$, "OverlordsHelmet", "DarkTalisman", "Aureole", "PaladinsHelmet", "EnchantersAmulet",
                                 "HeartOfIsis", "BansheeBow", "BullHelmet", "AssassinShirt", "LazuriteRobe", "DarkHelm", "UnderworldMask", "Phylactery";
    setarray $@chronos_4_medal_n$, "Overlord's Helmet", "Dark Talisman", "Prsm Aura", "Paladin's Helmet", "Enchanter's Amulet",
                                   "Heart of Isis", "Banshee Bow", "Bull Helmet", "Assassin Shirt", "Lazurite Robe", "Dark Helm", "Underworld Mask", "Phylactery";
    end;
}