summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index e3b4077cb..85332905e 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3111,7 +3111,7 @@ ACMD(allskill)
*------------------------------------------*/
ACMD(questskill)
{
- uint16 skill_id;
+ uint16 skill_id, index;
nullpo_retr(-1, sd);
if (!message || !*message || (skill_id = atoi(message)) <= 0)
@@ -3131,7 +3131,7 @@ ACMD(questskill)
return false;
}
- if (skill_id >= MAX_SKILL_DB) {
+ if( !(index = skill->get_index(skill_id)) ) {
clif->message(fd, msg_txt(198)); // This skill number doesn't exist.
return false;
}
@@ -3139,7 +3139,7 @@ ACMD(questskill)
clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill.
return false;
}
- if (pc_checkskill(sd, skill_id) > 0) {
+ if (pc_checkskill2(sd, index) > 0) {
clif->message(fd, msg_txt(196)); // You already have this quest skill.
return false;
}
@@ -3155,7 +3155,7 @@ ACMD(questskill)
*------------------------------------------*/
ACMD(lostskill)
{
- uint16 skill_id;
+ uint16 skill_id, index;
nullpo_retr(-1, sd);
if (!message || !*message || (skill_id = atoi(message)) <= 0)
@@ -3175,7 +3175,7 @@ ACMD(lostskill)
return false;
}
- if (skill_id >= MAX_SKILL) {
+ if ( !( index = skill->get_index(skill_id) ) ) {
clif->message(fd, msg_txt(198)); // This skill number doesn't exist.
return false;
}
@@ -3183,13 +3183,13 @@ ACMD(lostskill)
clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill.
return false;
}
- if (pc_checkskill(sd, skill_id) == 0) {
+ if (pc_checkskill2(sd, index) == 0) {
clif->message(fd, msg_txt(201)); // You don't have this quest skill.
return false;
}
- sd->status.skill[skill_id].lv = 0;
- sd->status.skill[skill_id].flag = 0;
+ sd->status.skill[index].lv = 0;
+ sd->status.skill[index].flag = 0;
clif->deleteskill(sd,skill_id);
clif->message(fd, msg_txt(71)); // You have forgotten the skill.
@@ -8728,13 +8728,14 @@ ACMD(unloadnpcfile) {
return true;
}
ACMD(cart) {
-#define MC_CART_MDFY(x) \
-sd->status.skill[MC_PUSHCART].id = x?MC_PUSHCART:0; \
-sd->status.skill[MC_PUSHCART].lv = x?1:0; \
-sd->status.skill[MC_PUSHCART].flag = x?1:0;
+#define MC_CART_MDFY(x,idx) \
+sd->status.skill[idx].id = x?MC_PUSHCART:0; \
+sd->status.skill[idx].lv = x?1:0; \
+sd->status.skill[idx].flag = x?1:0;
int val = atoi(message);
bool need_skill = pc_checkskill(sd, MC_PUSHCART) ? false : true;
+ unsigned int index = skill->get_index(MC_PUSHCART);
if( !message || !*message || val < 0 || val > MAX_CARTS ) {
sprintf(atcmd_output, msg_txt(1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>).
@@ -8748,18 +8749,18 @@ sd->status.skill[MC_PUSHCART].flag = x?1:0;
}
if( need_skill ) {
- MC_CART_MDFY(1);
+ MC_CART_MDFY(1,index);
}
if( pc_setcart(sd, val) ) {
if( need_skill ) {
- MC_CART_MDFY(0);
+ MC_CART_MDFY(0,index);
}
return false;/* @cart failed */
}
if( need_skill ) {
- MC_CART_MDFY(0);
+ MC_CART_MDFY(0,index);
}
clif->message(fd, msg_txt(1392)); // Cart Added