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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
// TMW-2 Script
// Author:
// Crazyfefe
// Jesusalva
//
// Do not add void items to the array.
// note: the rare item system sucks.
003-1,97,97,0 script Ishi NPC_PLAYER_ARGAES,{
if (!MPQUEST) {
mesn l("Ishi, the Rewards Master");
mesq l("Hey, it seems like you didn't register as a Monster Hunting Quest participant yet! You can sign up with Aidan.");
close;
}
if (BaseLevel < 10) {
if (REBIRTH) bye(E_UPSET); // Formulas break otherwise
// TODO: make jail stuff a function and replace this with the new function
dispbottom l("##1You abused a bug and will be jailed. If this was done in error, you have found a bug. Contact the nearest developer if this is the case.");
atcommand "@jailfor 5mn "+strcharinfo(0);
end;
}
if (BaseLevel < 37) {
@mpq_cost=((BaseLevel*2/3) ** 2);
} else if (BaseLevel <= 50) {
// From level 37 onwards, we will notice a small drop on price increase factor (until level 50)
@mpq_cost=((BaseLevel*2/3) ** 2)-(BaseLevel*2);
} else {
// After level 50, the formula changes. We don't have exponential anymore.
// Previous increase reached 67 and will stop at this value.
@mpq_cost=((50*2/3) ** 2)-(50*2);
@mpq_cost+=(BaseLevel-50)*67;
// Of course... We still need to act as if exponent was still there...
// So we raise it a bit each 3 levels
@mpq_cost+=(BaseLevel/3)*3;
}
if (TotalBaseLevel() >= 100) {
mesn l("Ishi, the Rewards Master");
mesq l("Welcome! You're now officially eligible to issue Monster Grants to other adventurers, whom you deem to have done significant deeds to the Alliance equiparable to slaying a lot of monsters.");
dnext;
mesq l("Do you wish to trade your monster points for items, or do you want to acquire monster grants?");
select
l("Trade monster points"),
l("Acquire monster grants");
mes "";
clear;
if (@menu == 2) goto L_Grants;
}
if (Mobpt < @mpq_cost)
{
mesn l("Ishi, the Rewards Master");
mesq l("Welcome! I see you have %d Monster Points. But that isn't enough to get items at your current level, sorry!", Mobpt);
mesc l("I need at minimum %d Monster Points to get items at current level.",@mpq_cost);
close;
}
if (TotalBaseLevel() < 25) {
setarray @Items, Bread,
Candy,Orange,BugLeg,
CobaltHerb,GambogeHerb,
MauveHerb,MaggotSlime,ScorpionStinger,SilkCocoon,
RustyKnife,Coral,PiouLegs,Cheese,RoastedMaggot,RawLog;
} else {
setarray @Items, Bread, Croconut,Plushroom,
RedApple,Beer,Candy,Orange,ChocolateBar,BugLeg,CoinBag,
Coal,SnakeSkin,CottonCloth,GrassSeeds,HardSpike,CobaltHerb,GambogeHerb,
MauveHerb,CopperOre,MaggotSlime,RawLog,ScorpionStinger,SilkCocoon,TreasureKey,
WhiteFur,EmptyBottle,RustyKnife,Coral,PiouLegs,Cheese,SnakeEgg,RoastedMaggot,BlueDye;
}
setarray @Rares, BrimmedHat, 5, IronIngot, 10, BronzeGift, 10, ScrollSMaggot, 15, MercBoxB, 15;
// Push blueprints based on your Job Level
array_push(@Rares, AlchemyBlueprintA);
array_push(@Rares, (JobLevel/3));
array_push(@Rares, EquipmentBlueprintA);
array_push(@Rares, (JobLevel/3));
// Additional Loot for level 45+
if (TotalBaseLevel() >= 45) {
array_push(@Items, IronOre);
array_push(@Items, SilverOre);
array_push(@Items, TinOre);
array_push(@Items, ChocolateMouboo);
array_push(@Items, MoubooSteak);
array_push(@Items, Milk);
array_push(@Items, TolchiAmmoBox);
array_push(@Items, ShadowHerb);
array_push(@Rares, AlchemyBlueprintB);
array_push(@Rares, (JobLevel/6));
array_push(@Rares, EquipmentBlueprintB);
array_push(@Rares, (JobLevel/6));
}
// Additional Loot for level 75+
if (TotalBaseLevel() >= 75) {
array_push(@Items, LeadOre);
array_push(@Items, TitaniumOre);
array_push(@Items, IridiumOre);
array_push(@Items, GoldOre);
array_push(@Items, IronAmmoBox);
array_push(@Rares, TulimWarpCrystal);
array_push(@Rares, 40);
array_push(@Rares, MercBoxA);
array_push(@Rares, 40);
array_push(@Rares, AlchemyBlueprintC);
array_push(@Rares, (JobLevel/9));
array_push(@Rares, EquipmentBlueprintC);
array_push(@Rares, (JobLevel/9));
}
// Additional Loot for level 150+
if (TotalBaseLevel() >= 150) {
array_push(@Items, PlatinumOre);
array_push(@Items, CursedAmmoBox);
array_remove(@Items, RustyKnife);
array_push(@Rares, MercBoxB);
array_push(@Rares, 30);
array_push(@Rares, AlchemyBlueprintD);
array_push(@Rares, (JobLevel/15));
array_push(@Rares, EquipmentBlueprintD);
array_push(@Rares, (JobLevel/15));
}
// Additional Loot for level 300+
if (TotalBaseLevel() >= 300) {
array_push(@Items, ThornAmmoBox);
array_remove(@Items, PiouLegs);
array_push(@Rares, MercBoxC);
array_push(@Rares, 20);
array_push(@Rares, AlchemyBlueprintE);
array_push(@Rares, (JobLevel/21));
array_push(@Rares, EquipmentBlueprintE);
array_push(@Rares, (JobLevel/21));
}
// Additional Loot for level 500+
if (TotalBaseLevel() >= 500) {
array_remove(@Items, Plushroom);
array_remove(@Items, Candy);
array_remove(@Items, BugLeg);
array_push(@Rares, MercBoxD);
array_push(@Rares, 10);
}
// Just an excuse
if (TotalBaseLevel() >= 700) {
array_push(@Rares, MercBoxE);
array_push(@Rares, 5);
}
mesn l("Ishi, the Rewards Master");
// Highlight the amount of monster points in bold for better visibility since players will probably exchange monster points a lot
mesq l("Welcome! I see you have ##B%d Monster Points##b. Would you like to exchange some of those for items?", Mobpt);
next;
if (@mpq_cost > 0)
mesc l("You can get up to %d items.", (Mobpt/@mpq_cost));
menuint
rif(Mobpt >= @mpq_cost, "1"), 1,
rif(Mobpt >= (@mpq_cost)*2, "2"), 2,
rif(Mobpt >= (@mpq_cost)*3, "3"), 3,
rif(Mobpt >= (@mpq_cost)*4, "4"), 4,
rif(Mobpt >= (@mpq_cost)*5, "5"), 5,
rif(Mobpt >= (@mpq_cost)*6, "6"), 6,
rif(Mobpt >= (@mpq_cost)*7, "7"), 7,
rif(Mobpt >= (@mpq_cost)*8, "8"), 8,
rif(Mobpt >= (@mpq_cost)*9, "9"), 9,
rif(Mobpt >= (@mpq_cost)*10,"10"), 10,
rif(Mobpt >= (@mpq_cost)*11,l("Gimme as many as I deserve!")), -1,
l("Sorry, I have to go now."), 0;
.@var=@menuret;
// Special cases
if (!.@var)
goto L_Close;
if (.@var < 0)
goto L_Give_all;
goto L_Items;
L_Close:
.@var=0;
closedialog;
goodbye;
close;
L_Items:
//debugmes "Reaching item loop";
freeloop(true);
for (.@i = 0; .@i < .@var; .@i ++)
{
//debugmes "Items: "+str(.@var);
.@lucked=0;
.@reward=0;
if (TotalBaseLevel() > 25) {
//debugmes "Testing rares";
@lucky = rand(10000) + 1;
for (.@b = 0; .@b < getarraysize(@Rares); .@b=.@b+2) {
//debugmes "Checking "+@Rares[.@b]+" - b is now "+.@b;
//debugmes l("Check @@ <= @@", @lucky, @Rares[.@b+1]);
if (.@b == 0)
@control = 0;
if(@lucky >= (@control + 1) && @lucky <= @control + (@Rares[.@b+1]))
{
.@lucked=1;
.@reward = @Rares[.@b];
}
@control = @control + (@Rares[.@b+1]);
}
}
//debugmes "Setting reward"; // could be if (!.@lucked) but for sanity...
if (!.@reward)
.@reward=any_of(@Items);
//debugmes "Check weight";
inventoryplace .@reward, 1;
//debugmes "Processing...";
Mobpt = Mobpt - @mpq_cost;
getitem .@reward,1;
//debugmes "Printing...";
if (.@lucked) {
mes "";
mes l("Wow!");
mes l("I can't believe it.");
mes l("You got lucky and got a(n) %s!", getitemlink(.@reward));
mes "";
} else {
mesq l("You received one %s!", getitemlink(.@reward));
}
}
freeloop(false);
X24Event(X24_GROUP2, X24_G2_MPT);
close;
// TODO FIXME: Is this statement even reachable?
L_Continue:
mesq l("You still have ##B%d Monster Points##b! Do you want more items?", Mobpt);
select
l("Yes"),
l("No");
switch (@menu)
{
case 1:
goto L_Give_all;
break;
case 2:
goto L_Close;
break;
}
close;
L_Give_all:
.@var = Mobpt / @mpq_cost;
if (.@var > 50) { // limit to avoid lag server. Probably a bad idea.
.@var = 50;
mes l("You have too many points. I can't allow you to take all at once right now. I'll try to give you 50, and you can come back later!");
next;
}
goto L_Items;
close;
L_Grants:
clear;
mesn l("Ishi, the Rewards Master");
mesq l("Perfect! You have %s Monster Points. Here's the grant selection.", fnum(Mobpt));
select
l("On hindsight, I've changed my mind."),
rif(REBIRTH >= 1, l("I want a Monster Grant I")),
rif(REBIRTH >= 2, l("I want a Monster Grant II")),
rif(REBIRTH >= 3, l("I want a Monster Grant III")),
rif(REBIRTH >= 4, l("I want a Monster Grant IV")),
rif(REBIRTH >= 5, l("I want a Monster Grant V"));
mes "";
switch (@menu) {
case 2:
.@grant = MonsterGrantI;
.@value = 1000;
break;
case 3:
.@grant = MonsterGrantII;
.@value = 2500;
break;
case 4:
.@grant = MonsterGrantIII;
.@value = 10000;
break;
case 5:
.@grant = MonsterGrantIV;
.@value = 25000;
break;
case 6:
.@grant = MonsterGrantV;
.@value = 100000;
break;
default:
closeclientdialog;
close;
}
// Base purchase tax
.@value += 500;
// World Hero / Hunter reverse discount (30%)
if ($WORLD_HERO$ != strcharinfo(0) && !(JobClass & CLASS_HUNTER))
.@value = .@value * 4 / 3;
// Academy reverse base tax (up to 200)
.@value += 25 * min(1, 8-ACADEMIC_RANK);
// Legendary Heroes reverse discount (10%)
if (!islegendary())
.@value = .@value * 11 / 10;
// Evil alignment discount
if (alignment() < 0)
.@value -= 250;
// Base price (+20%)
.@value = .@value * 6 / 5;
mesc l("A %s will cost you %s Monster Points.", getitemlink(.@grant), fnum(.@value));
if (Mobpt < .@value) {
mesc l("You do not have enough monster points."), 1;
next;
goto L_Grants;
}
mesc l("Do you wish to purchase it?");
if (askyesno() == ASK_YES) {
inventoryplace .@grant, 1;
Mobpt -= .@value;
getitem .@grant, 1;
}
next;
goto L_Grants;
OnInit:
.@npcId = getnpcid(.name$);
//setunitdata(.@npcId, UDT_HEADTOP, NPCEyes);
setunitdata(.@npcId, UDT_HEADMIDDLE, CopperArmor);
setunitdata(.@npcId, UDT_HEADBOTTOM, CottonTrousers);
setunitdata(.@npcId, UDT_WEAPON, DeepBlackBoots); // Boots
setunitdata(.@npcId, UDT_HAIRSTYLE, 4);
setunitdata(.@npcId, UDT_HAIRCOLOR, 13);
.sex = G_MALE;
.distance = 5;
end;
}
|