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
|
// TMW-2 Script.
// Author:
// Jesusalva
// Description:
// Modifies the sell price for crafts
// Always run this when casting @reloaditemdb
function script _fix_cPrice {
.@const$ = data_to_string(getarg(0));
.@m = getarg(1, 35);
// Shady code by gumi
if (startswith(.@const$, "Craft")) {
// infer the item constant from the craft constant
.@recipe = getarg(0);
.@item = string_to_data(substr(.@const$, 5, getstrlen(.@const$) - 1));
} else {
// infer the craft constant from the item constant
.@recipe = string_to_data(sprintf("Craft%s", .@const$));
.@item = getarg(0);
}
if (.@item <= 0) {
// target item not found
consolebug("ERROR, INVALID ITEM ID DETECTED at _fix_cPrice");
return;
}
.@price = 0;
// More shady code by gumi
for (.@inv = 0; .@inv < 9; ++.@inv) {
.@size = getcraftrecipe(.@recipe, .@inv, .@qty[0], .@item_id[0]);
if (.@size < 0) {
if (.@size == -1) {
// recipe does not exist
break;
}
// inventory does not exist
break;
}
// More shady code to build new price
for (.@it = 0; .@it < .@size; ++.@it) {
.@recipe_item = .@item_id[.@it];
.@recipe_qty = .@qty[.@it];
if (.@recipe_item <= 0) {
break;
}
// Increase the final price
//debugmes("Price %d + %d GP (%dx %s)", .@price, getiteminfo(.@recipe_item, ITEMINFO_SELLPRICE),
// .@recipe_qty, getitemname(.@recipe_item));
.@price += getiteminfo(.@recipe_item, ITEMINFO_SELLPRICE) * .@recipe_qty;
//debugmes("New price: %d", .@price);
}
// Update the final price
if (.@price > 0) {
consoleinfo("Price for %s adjusted from %d (%d) to %d (%d) GP", getitemname(.@item), getiteminfo(.@item, ITEMINFO_BUYPRICE), getiteminfo(.@item, ITEMINFO_SELLPRICE), .@price * .@m / 10, .@price);
setiteminfo(.@item, ITEMINFO_BUYPRICE, .@price * .@m / 10);
setiteminfo(.@item, ITEMINFO_SELLPRICE, .@price);
//debugmes("New Price for %s is now %d (%d) GP", getitemname(.@item), getiteminfo(.@item, ITEMINFO_BUYPRICE), getiteminfo(.@item, ITEMINFO_SELLPRICE));
}
}
return;
}
function script fix_cPrice {
// In some cases, we don't care
if (debug) return;
// Otherwise...
freeloop(true);
// Fix potions prices
_fix_cPrice(AgiPotionA);
_fix_cPrice(AgiPotionB);
_fix_cPrice(AgiPotionC);
_fix_cPrice(VitPotionA);
_fix_cPrice(VitPotionB);
_fix_cPrice(VitPotionC);
_fix_cPrice(IntPotionA);
_fix_cPrice(IntPotionB);
_fix_cPrice(IntPotionC);
_fix_cPrice(DexPotionA);
_fix_cPrice(DexPotionB);
_fix_cPrice(DexPotionC);
_fix_cPrice(LukPotionA);
_fix_cPrice(LukPotionB);
_fix_cPrice(LukPotionC);
//_fix_cPrice(HastePotion); // 240 -> 75
//_fix_cPrice(StrengthPotion); // 240 -> 195
// TODO: Scrolls? Reagents?
// And reagents should happen before potions
// And weapons
_fix_cPrice(WoodenSword);
_fix_cPrice(BugSlayer);
_fix_cPrice(ShortGladius);
_fix_cPrice(Backsword);
_fix_cPrice(ShortSword);
_fix_cPrice(Kitana);
_fix_cPrice(BoneKnife);
_fix_cPrice(LongSword);
_fix_cPrice(RockKnife);
_fix_cPrice(DivineSword);
// And two hand weapons
_fix_cPrice(MiereCleaver);
_fix_cPrice(Broadsword);
_fix_cPrice(Halberd);
_fix_cPrice(ImmortalSword);
// And archery
_fix_cPrice(ShortBow);
_fix_cPrice(ForestBow);
_fix_cPrice(ElficBow);
_fix_cPrice(ChampionshipBow);
_fix_cPrice(BansheeBow);
// And magic
_fix_cPrice(TrainingWand, 22);
_fix_cPrice(NoviceWand, 27);
_fix_cPrice(ApprenticeWand);
_fix_cPrice(LeaderWand);
_fix_cPrice(MysticWand);
// And Firestaves
_fix_cPrice(PynRevolver);
_fix_cPrice(PynRifle);
_fix_cPrice(PynGatling);
_fix_cPrice(PynShotgun);
// And misc
_fix_cPrice(TerranitePants);
_fix_cPrice(TerraniteArmor);
_fix_cPrice(Skypiercer, 40);
// And shields
_fix_cPrice(WoodenShield);
_fix_cPrice(BladeShield);
_fix_cPrice(BraknarShield);
_fix_cPrice(BritShield);
_fix_cPrice(BromenalShield);
_fix_cPrice(BlueKnightShield);
_fix_cPrice(SteelShield);
_fix_cPrice(DragonShield);
_fix_cPrice(SaviorShield, 40);
// Chest Armor
_fix_cPrice(LeatherShirt);
_fix_cPrice(LieutenantArmor);
_fix_cPrice(Chainmail);
_fix_cPrice(CopperArmor);
_fix_cPrice(LightPlatemail);
_fix_cPrice(GoldenLightPlatemail);
_fix_cPrice(WarlordPlate);
_fix_cPrice(GoldenWarlordPlate);
_fix_cPrice(BromenalChest);
_fix_cPrice(AssassinChest);
// Pants
//_fix_cPrice(JeansShorts);
_fix_cPrice(RaidTrousers);
_fix_cPrice(LeatherTrousers);
_fix_cPrice(JeansChaps);
_fix_cPrice(SilkPants);
_fix_cPrice(ChainmailSkirt); // <= Pre-Fortress
_fix_cPrice(BromenalPants); // <= Fortress
_fix_cPrice(WarlordPants);
_fix_cPrice(AssassinPants);
// Gloves (more expensive due ASPD)
_fix_cPrice(SilkGloves, 40);
_fix_cPrice(LeatherGloves, 40);
_fix_cPrice(BromenalGloves, 40);
_fix_cPrice(ManaGloves, 40);
_fix_cPrice(WarlordGloves, 40);
_fix_cPrice(AssassinGloves, 40);
// Helmets
_fix_cPrice(InfantryHelmet);
_fix_cPrice(DesertHelmet);
_fix_cPrice(BromenalHelmet);
_fix_cPrice(CandleHelmet);
_fix_cPrice(CrusadeHelmet);
_fix_cPrice(WarlordHelmet);
_fix_cPrice(VikingHelmet);
_fix_cPrice(TerraniteHelmet); // Cheaper than the real cost due 2x Earth Powder
_fix_cPrice(CenturionHelmet);
_fix_cPrice(BullHelmet);
_fix_cPrice(DarkHelm);
_fix_cPrice(DarkKnightHelmet);
_fix_cPrice(SamuraiHelmet);
// TODO: Verify drops and the new GP exploit
// TODO: Rewrite meltdown forge to similar formula
// Giving 30%~50% instead of 50%~70%
// Max rounded down, Min rounded up
freeloop(false);
return;
}
- script craft_price_fix -1,{
end;
OnCall:
atcommand("@reloaditemdb");
fix_cPrice();
end;
OnInit:
bindatcmd "reloaditemdb2", "craft_price_fix::OnCall", 99, 100, 1;
// This should be called last? Maybe?
sleep(750);
fix_cPrice();
end;
}
|