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
|
//===== eAthena Script =======================================
//= Kafra Expres - Stat/Skill Market Module
//===== By: ==================================================
//= Skotlex
//===== Current Version: =====================================
//= 2.0
//===== Compatible With: =====================================
//= eAthena SVN R3579+
//===== Description: =========================================
//= Part of the Kafra Express Script Package.
//= Lets players buy/sell skill points/stat points
//===== Additional Comments: =================================
//= See config.txt for configuration.
//============================================================
- script keInit_statmarket {
OnInit: //Load Config
donpcevent "keConfig::OnLoadStatMarket";
end;
}
function script F_keStatMarket {
set @discount,callfunc("F_keCost",100,$@kesm_discount);
do {
set @kmenu, select (
"- Return",
"- Buy Stat points ("+($@kesm_stBuyPrice*@discount/100)+"z each)",
"- Sell Stat points (up to "+StatusPoint+"/"+$@kesm_stSellPrice+"z each)",
"- Buy Skill points ("+($@kesm_skBuyPrice*@discount/100)+"z each)",
"- Sell Skill points (up to "+SkillPoint+"/"+$@kesm_skSellPrice+"z each)",
"- Trade Stats -> Skill ("+$@kesm_skTradePrice+" stats/skill)",
"- Trade Skills -> Stats ("+$@kesm_stTradePrice+" stats/skill)"
);
if (@kmenu > 1)
input @qty;
switch (@kmenu) {
case 2: //Buy Stat
set @min, 1;
set @max, 9999;
set @cost, @qty*$@kesm_stBuyPrice;
break;
case 3: //Sell Stat
input @qty;
set @min, 1;
set @max, StatusPoint;
set @cost, @qty*$@kesm_stSellPrice;
break;
case 4: //Buy Skill
set @min, 1;
set @max, 9999;
set @cost, @qty*$@kesm_skBuyPrice;
break;
case 5: //Sell Skill
set @min, 1;
set @max, SkillPoint;
set @cost, @qty*$@kesm_skSellPrice;
break;
case 6: //Convert stats -> skills
set @min, $@kesm_skTradePrice;
set @max, StatusPoint;
set @cost, @qty/$@kesm_skTradePrice;
break;
case 7: //Convert skills -> stats
set @min, 1;
set @max, SkillPoint;
set @cost, @qty*$@kesm_stTradePrice;
break;
default:
return;
}
if (@qty < @min) {
if (@min == 1)
callfunc "F_keIntro", e_dots, "Was that supposed to be funny?";
else
callfunc "F_keIntro", e_dots, "That is not enough to buy a single skill...";
} else
if (@qty > @max) {
if (@max == 9999)
callfunc "F_keIntro", e_X, "You can't buy that many!";
else
callfunc "F_keIntro", e_X, "You don't have that many to sell...";
} else
if (@cost < 0) {
callfunc "F_keIntro", e_swt2, "That is too much for a single transaction! Try a smaller quantity... please?";
} else {
switch(@kmenu) {
case 2: //Buy Stat
if (!(callfunc("F_keCharge",@cost,$@kesm_discount,1))) {
callfunc "F_keIntro", e_X, "You do not have enough zeny to buy that many.";
break;
}
set StatusPoint,StatusPoint+@qty;
emotion e_oh;
break;
case 3: //Sell Stat
set StatusPoint,StatusPoint-@qty;
set Zeny,Zeny+@cost;
emotion e_oh;
break;
case 4: //Buy Skill
if (!(callfunc("F_keCharge",@cost,$@kesm_discount,1))) {
callfunc "F_keIntro", e_X, "You do not have enough zeny to buy that many.";
break;
}
set SkillPoint,SkillPoint+@qty;
emotion e_oh;
break;
case 5: //Sell Skill
set SkillPoint,SkillPoint-@qty;
set Zeny,Zeny+@cost;
emotion e_oh;
break;
case 6: //Convert stats -> skills
set @qty, @cost*$@kesm_skTradePrice;
set StatusPoint,StatusPoint-@qty;
set SkillPoint,SkillPoint+@cost;
emotion e_oh;
break;
case 7: //Convert skills -> stats
set SkillPoint,SkillPoint-@qty;
set StatusPoint,StatusPoint+@cost;
emotion e_oh;
break;
}
}
} while (@kmenu > 1);
return;
}
|