diff options
author | shennetsind <ind@henn.et> | 2013-04-27 13:33:10 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-04-27 13:33:10 -0300 |
commit | 0f4a50d13538c3e5d3ca4d3822f92217c8da0479 (patch) | |
tree | 2daf0a99ca0104d6a7fa95637e0377e7a9a0d6ed /src/map/atcommand.c | |
parent | 1f6360f2e157d8eb742a32baed4c5ec7c68c0ef1 (diff) | |
download | hercules-0f4a50d13538c3e5d3ca4d3822f92217c8da0479.tar.gz hercules-0f4a50d13538c3e5d3ca4d3822f92217c8da0479.tar.bz2 hercules-0f4a50d13538c3e5d3ca4d3822f92217c8da0479.tar.xz hercules-0f4a50d13538c3e5d3ca4d3822f92217c8da0479.zip |
Skill ID Processing Overhaul
http://hercules.ws/board/topic/512-skill-id-processing-overhaul/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 31 |
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 |