diff options
author | Haru <haru@dotalux.com> | 2017-11-18 19:01:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-18 19:01:51 +0100 |
commit | a63c82c8bd29fd829a5d8cfba7d02d11cf4634c5 (patch) | |
tree | 8f369881467a3d1a9a5a0a4fb16631ad6d33e44e /src/map/atcommand.c | |
parent | 93fe9834c3075bad0fc1ba1dd075147d7de3b73a (diff) | |
parent | 13b1d22dccc7a0e816963f070248e11c73538bd1 (diff) | |
download | hercules-a63c82c8bd29fd829a5d8cfba7d02d11cf4634c5.tar.gz hercules-a63c82c8bd29fd829a5d8cfba7d02d11cf4634c5.tar.bz2 hercules-a63c82c8bd29fd829a5d8cfba7d02d11cf4634c5.tar.xz hercules-a63c82c8bd29fd829a5d8cfba7d02d11cf4634c5.zip |
Merge pull request #1896 from MishimaHaruna/skill_id_idx
Skill ID / IDX fixes
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index d9f4810ee..1590c3f0c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5296,12 +5296,13 @@ ACMD(skillid) iter = db_iterator(skill->name2id_db); for (data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key)) { - int idx = skill->get_index(DB->data2i(data)); - if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill->dbs->db[idx].desc, message, skillen) == 0) { - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1164), DB->data2i(data), skill->dbs->db[idx].desc, key.str); // skill %d: %s (%s) + int skill_id = DB->data2i(data); + const char *skill_desc = skill->get_desc(skill_id); + if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_desc, message, skillen) == 0) { + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1164), skill_id, skill_desc, key.str); // skill %d: %s (%s) clif->message(fd, atcmd_output); - } else if ( found < MAX_SKILLID_PARTIAL_RESULTS && ( stristr(key.str,message) || stristr(skill->dbs->db[idx].desc,message) ) ) { - snprintf(partials[found], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_fd(fd,1164), DB->data2i(data), skill->dbs->db[idx].desc, key.str); + } else if (found < MAX_SKILLID_PARTIAL_RESULTS && (stristr(key.str, message) != NULL || stristr(skill_desc, message) != NULL)) { + snprintf(partials[found], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_fd(fd, 1164), skill_id, skill_desc, key.str); found++; } } @@ -5428,7 +5429,7 @@ ACMD(skilltree) for (j = 0; j < VECTOR_LENGTH(entry->need); j++) { struct skill_tree_requirement *req = &VECTOR_INDEX(entry->need, j); if (pc->checkskill(sd, req->id) < req->lv) { - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1170), req->lv, skill->dbs->db[req->id].desc); // Player requires level %d of skill %s. + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1170), req->lv, skill->get_desc(req->id)); // Player requires level %d of skill %s. clif->message(fd, atcmd_output); meets = 0; } @@ -8686,7 +8687,7 @@ ACMD(cart) { int val = atoi(message); bool need_skill = pc->checkskill(sd, MC_PUSHCART) ? false : true; - unsigned int index = skill->get_index(MC_PUSHCART); + int index = skill->get_index(MC_PUSHCART); if (!*message || val < 0 || val > MAX_CARTS) { safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>). @@ -9394,7 +9395,7 @@ ACMD(cddebug) { } if (!cd || (*message && !strcmpi(message,"reset"))) { - for(i = 0; i < MAX_SKILL; i++) { + for (i = 0; i < MAX_SKILL_DB; i++) { if( sd->blockskill[i] ) { clif->messages(fd,"Found skill '%s', unblocking...",skill->dbs->db[i].name); sd->blockskill[i] = false; |