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 | |
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')
-rw-r--r-- | src/map/atcommand.c | 17 | ||||
-rw-r--r-- | src/map/chrif.c | 6 | ||||
-rw-r--r-- | src/map/clif.c | 10 | ||||
-rw-r--r-- | src/map/elemental.c | 2 | ||||
-rw-r--r-- | src/map/homunculus.h | 2 | ||||
-rw-r--r-- | src/map/mercenary.c | 2 | ||||
-rw-r--r-- | src/map/mercenary.h | 2 | ||||
-rw-r--r-- | src/map/mob.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 50 | ||||
-rw-r--r-- | src/map/pc.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 4 | ||||
-rw-r--r-- | src/map/skill.c | 672 | ||||
-rw-r--r-- | src/map/skill.h | 101 | ||||
-rw-r--r-- | src/map/status.c | 4 | ||||
-rw-r--r-- | src/map/status.h | 2 |
15 files changed, 634 insertions, 244 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; diff --git a/src/map/chrif.c b/src/map/chrif.c index 39aa046d7..96f144523 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1360,10 +1360,10 @@ void chrif_skillid2idx(int fd) { if (!sockt->session_is_valid(fd)) return; - WFIFOHEAD(fd,4 + (MAX_SKILL * 4)); + WFIFOHEAD(fd,4 + (MAX_SKILL_DB * 4)); WFIFOW(fd,0) = 0x2b0b; - for(i = 0; i < MAX_SKILL; i++) { - if( skill->dbs->db[i].nameid ) { + for (i = 0; i < MAX_SKILL_DB; i++) { + if (skill->dbs->db[i].nameid != 0) { WFIFOW(fd, 4 + (count*4)) = skill->dbs->db[i].nameid; WFIFOW(fd, 6 + (count*4)) = i; count++; diff --git a/src/map/clif.c b/src/map/clif.c index 4dc36be6d..4bf3cdf94 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4866,9 +4866,9 @@ void clif_skillinfoblock(struct map_session_data *sd) fd=sd->fd; if (!fd) return; - WFIFOHEAD(fd, MAX_SKILL * 37 + 4); + WFIFOHEAD(fd, MAX_SKILL_DB * 37 + 4); WFIFOW(fd,0) = 0x10f; - for ( i = 0, len = 4; i < MAX_SKILL; i++) { + for ( i = 0, len = 4; i < MAX_SKILL_DB; i++) { if( (id = sd->status.skill[i].id) != 0 ) { int level; // workaround for bugreport:5348 @@ -4899,7 +4899,7 @@ void clif_skillinfoblock(struct map_session_data *sd) WFIFOSET(fd,len); // workaround for bugreport:5348; send the remaining skills one by one to bypass packet size limit - for ( ; i < MAX_SKILL; i++) { + for ( ; i < MAX_SKILL_DB; i++) { if( (id = sd->status.skill[i].id) != 0 ) { clif->addskill(sd, id); clif->skillinfo(sd, id, 0); @@ -5001,7 +5001,7 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) int skill_lv; nullpo_retv(sd); - Assert_retv(idx >= 0 && idx < MAX_SKILL); + Assert_retv(idx >= 0 && idx < MAX_SKILL_DB); skill_lv = sd->status.skill[idx].lv; @@ -17642,7 +17642,7 @@ int clif_autoshadowspell_list(struct map_session_data *sd) { WFIFOHEAD(fd, 2 * 6 + 4); WFIFOW(fd,0) = 0x442; - for( i = 0, c = 0; i < MAX_SKILL; i++ ) + for (i = 0, c = 0; i < MAX_SKILL_DB; i++) if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) { // Can't auto cast both Extended class and 3rd class skills. diff --git a/src/map/elemental.c b/src/map/elemental.c index ae1fda0a2..cf1d485e1 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -885,7 +885,7 @@ int read_elementaldb(void) { estatus->race = atoi(str[20]); ele = atoi(str[21]); - estatus->def_ele = ele%10; + estatus->def_ele = ele % ELE_MAX; estatus->ele_lv = ele/20; if( estatus->def_ele >= ELE_MAX ) { ShowWarning("Elemental %d has invalid element type %d (max element is %d)\n", db->class_, estatus->def_ele, ELE_MAX - 1); diff --git a/src/map/homunculus.h b/src/map/homunculus.h index a80392cf6..f3b10fc19 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -124,7 +124,7 @@ struct homun_data { struct map_session_data *master; //pointer back to its master int hungry_timer; //[orn] unsigned int exp_next; - char blockskill[MAX_SKILL]; // [orn] + char blockskill[MAX_SKILL_DB]; // [orn] int64 masterteleport_timer; }; diff --git a/src/map/mercenary.c b/src/map/mercenary.c index f5d3fe11c..c4b692008 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -465,7 +465,7 @@ bool read_mercenarydb_sub(char* str[], int columns, int current) { mstatus->race = atoi(str[20]); ele = atoi(str[21]); - mstatus->def_ele = ele%10; + mstatus->def_ele = ele % ELE_MAX; mstatus->ele_lv = ele/20; if( mstatus->def_ele >= ELE_MAX ) { ShowWarning("Mercenary %d has invalid element type %d (max element is %d)\n", db->class_, mstatus->def_ele, ELE_MAX - 1); diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 0af75e8a2..f3773f191 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -92,7 +92,7 @@ struct mercenary_data { struct regen_data regen; struct s_mercenary_db *db; struct s_mercenary mercenary; - char blockskill[MAX_SKILL]; + char blockskill[MAX_SKILL_DB]; struct map_session_data *master; int contract_timer; diff --git a/src/map/mob.c b/src/map/mob.c index 208617b5d..f509ecace 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4846,7 +4846,7 @@ bool mob_parse_row_mobskilldb(char** str, int columns, int current) struct mob_skill *ms, gms; int mob_id; int i =0, j, tmp; - uint16 sidx = 0; + int sidx = 0; nullpo_retr(false, str); mob_id = atoi(str[0]); diff --git a/src/map/pc.c b/src/map/pc.c index 0636ebafa..d5d359557 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1560,7 +1560,7 @@ int pc_calc_skillpoint(struct map_session_data* sd) { nullpo_ret(sd); - for (i = 1; i < MAX_SKILL; i++) { + for (i = 1; i < MAX_SKILL_DB; i++) { int skill_lv = pc->checkskill2(sd,i); if (skill_lv > 0) { inf2 = skill->dbs->db[i].inf2; @@ -1596,7 +1596,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } classidx = pc->class2idx(class); - for( i = 0; i < MAX_SKILL; i++ ) { + for (i = 0; i < MAX_SKILL_DB; i++) { if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED ) //Don't touch these sd->status.skill[i].id = 0; //First clear skills. /* permanent skills that must be re-checked */ @@ -1613,7 +1613,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } } - for( i = 0; i < MAX_SKILL; i++ ) { + for (i = 0; i < MAX_SKILL_DB; i++) { if( sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) { // Restore original level of skills after deleting earned skills. sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0; @@ -1622,18 +1622,25 @@ int pc_calc_skilltree(struct map_session_data *sd) if( sd->sc.count && sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_BARDDANCER && skill->dbs->db[i].nameid >= DC_HUMMING && skill->dbs->db[i].nameid <= DC_SERVICEFORYOU ) { //Enable Bard/Dancer spirit linked skills. - if( sd->status.sex ) - { //Link dancer skills to bard. - // i can be < 8? - if( sd->status.skill[i-8].lv < 10 ) + if (sd->status.sex) { + // Link dancer skills to bard. + if (i < 8) { + Assert_report(i >= 8); + continue; + } + if (sd->status.skill[i-8].lv < 10) continue; sd->status.skill[i].id = skill->dbs->db[i].nameid; sd->status.skill[i].lv = sd->status.skill[i-8].lv; // Set the level to the same as the linking skill sd->status.skill[i].flag = SKILL_FLAG_TEMPORARY; // Tag it as a non-savable, non-uppable, bonus skill - } else { //Link bard skills to dancer. - if( sd->status.skill[i].lv < 10 ) + } else { + // Link bard skills to dancer. + if (i < 8) { + Assert_report(i >= 8); + continue; + } + if (sd->status.skill[i].lv < 10) continue; - // i can be < 8? sd->status.skill[i-8].id = skill->dbs->db[i-8].nameid; sd->status.skill[i-8].lv = sd->status.skill[i].lv; // Set the level to the same as the linking skill sd->status.skill[i-8].flag = SKILL_FLAG_TEMPORARY; // Tag it as a non-savable, non-uppable, bonus skill @@ -1642,7 +1649,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } if( pc_has_permission(sd, PC_PERM_ALL_SKILL) ) { - for( i = 0; i < MAX_SKILL; i++ ) { + for (i = 0; i < MAX_SKILL_DB; i++) { switch(skill->dbs->db[i].nameid) { /** * Dummy skills must be added here otherwise they'll be displayed in the, @@ -1836,7 +1843,7 @@ int pc_clean_skilltree(struct map_session_data *sd) { int i; nullpo_ret(sd); - for (i = 0; i < MAX_SKILL; i++){ + for (i = 0; i < MAX_SKILL_DB; i++) { if (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY || sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED) { sd->status.skill[i].id = 0; sd->status.skill[i].lv = 0; @@ -4143,7 +4150,7 @@ int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4 *------------------------------------------*/ int pc_skill(struct map_session_data *sd, int id, int level, int flag) { - uint16 index = 0; + int index = 0; nullpo_ret(sd); if (!(index = skill->get_index(id))) { @@ -5869,7 +5876,7 @@ int pc_memo(struct map_session_data* sd, int pos) { * Return player sd skill_lv learned for given skill *------------------------------------------*/ int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { - uint16 index = 0; + int index = 0; if(sd == NULL) return 0; if( skill_id >= GD_SKILLBASE && skill_id < GD_MAX ) { struct guild *g; @@ -5888,8 +5895,9 @@ int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { return 0; } int pc_checkskill2(struct map_session_data *sd,uint16 index) { - if(sd == NULL) return 0; - if(index >= ARRAYLENGTH(sd->status.skill) ) { + if (sd == NULL) + return 0; + if (index >= MAX_SKILL_DB) { ShowError("pc_checkskill: Invalid skill index %d (char_id=%d).\n", index, sd->status.char_id); return 0; } @@ -7229,7 +7237,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val) * Skill point allocation *------------------------------------------*/ int pc_skillup(struct map_session_data *sd,uint16 skill_id) { - uint16 index = 0; + int index = 0; nullpo_ret(sd); if( skill_id >= GD_SKILLBASE && skill_id < GD_SKILLBASE+MAX_GUILDSKILL ) { @@ -7286,7 +7294,7 @@ int pc_allskillup(struct map_session_data *sd) nullpo_ret(sd); - for(i=0;i<MAX_SKILL;i++){ + for (i = 0; i < MAX_SKILL_DB; i++) { if (sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED) { sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0; sd->status.skill[i].flag = SKILL_FLAG_PERMANENT; @@ -7297,7 +7305,7 @@ int pc_allskillup(struct map_session_data *sd) if (pc_has_permission(sd, PC_PERM_ALL_SKILL)) { //Get ALL skills except npc/guild ones. [Skotlex] //and except SG_DEVIL [Komurka] and MO_TRIPLEATTACK and RG_SNATCHER [ultramage] - for(i=0;i<MAX_SKILL;i++){ + for (i = 0; i < MAX_SKILL_DB; i++) { switch( skill->dbs->db[i].nameid ) { case SG_DEVIL: case MO_TRIPLEATTACK: @@ -7537,9 +7545,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER); } - for( i = 1; i < MAX_SKILL; i++ ) { - // FIXME: We're looping on i = [1..MAX_SKILL-1] (which makes sense as index for sd->status.skill[]) but then we're using the - // same i to access skill->dbs->db[], and especially to check skill_ischangesex(). This is wrong. + for (i = 1; i < MAX_SKILL_DB; i++) { uint16 skill_id = 0; int lv = sd->status.skill[i].lv; if (lv < 1) continue; diff --git a/src/map/pc.h b/src/map/pc.h index 50cb1b68e..df0df979d 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -292,7 +292,7 @@ struct map_session_data { uint16 skill_id_old,skill_lv_old; uint16 skill_id_dance,skill_lv_dance; short cook_mastery; // range: [0,1999] [Inkfish] - bool blockskill[MAX_SKILL]; + bool blockskill[MAX_SKILL_DB]; int cloneskill_id, reproduceskill_id; int menuskill_id, menuskill_val, menuskill_val2; int invincible_timer; diff --git a/src/map/script.c b/src/map/script.c index 1dc02bf82..4dcfa5687 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12190,7 +12190,7 @@ BUILDIN(homunculus_mutate) if (script_hasdata(st,2)) homun_id = script_getnum(st,2); else - homun_id = 6048 + (rnd() % 4); + homun_id = HOMID_EIRA + (rnd() % 4); m_class = homun->class2type(sd->hd->homunculus.class_); m_id = homun->class2type(homun_id); @@ -14590,7 +14590,7 @@ BUILDIN(getskilllist) int i,j=0; if (sd == NULL) return true; - for(i=0;i<MAX_SKILL;i++) { + for (i = 0; i < MAX_SKILL_DB; i++) { if(sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0) { pc->setreg(sd,reference_uid(script->add_str("@skilllist_id"), j),sd->status.skill[i].id); pc->setreg(sd,reference_uid(script->add_str("@skilllist_lv"), j),sd->status.skill[i].lv); diff --git a/src/map/skill.c b/src/map/skill.c index 726deaa9a..1b7d40e83 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -105,7 +105,7 @@ int skill_name2id(const char* name) /// Maps skill ids to skill db offsets. /// Returns the skill's array index, or 0 (Unknown Skill). -int skill_get_index (uint16 skill_id) +int skill_get_index(int skill_id) { // avoid ranges reserved for mapping guild/homun/mercenary skills if( (skill_id >= GD_SKILLRANGEMIN && skill_id <= GD_SKILLRANGEMAX) @@ -138,88 +138,461 @@ int skill_get_index (uint16 skill_id) } // validate result - if( !skill_id || skill_id >= MAX_SKILL_DB ) + if (skill_id <= 0|| skill_id >= MAX_SKILL_DB) return 0; return skill_id; } -const char* skill_get_name( uint16 skill_id ) { +const char *skill_get_name(int skill_id) +{ return skill->dbs->db[skill->get_index(skill_id)].name; } -const char* skill_get_desc( uint16 skill_id ) { +const char *skill_get_desc(int skill_id) +{ return skill->dbs->db[skill->get_index(skill_id)].desc; } -// out of bounds error checking [celest] -void skill_chk(uint16* skill_id) { - *skill_id = skill->get_index(*skill_id); // checks/adjusts id -} +#define skill_get_lvl_idx(lv) (min((lv), MAX_SKILL_LEVEL) - 1) +#define skill_adjust_over_level(val, lv, max_lv) ((val) > 1 ? ((val) + ((lv) - (max_lv)) / 2) : (val)) -#define skill_get(var,id) do { skill->chk(&(id)); if(!(id)) return 0; return (var); } while(0) -#define skill_get2(var,id,lv) do { \ - skill->chk(&(id)); \ - if(!(id)) return 0; \ - if( (lv) > MAX_SKILL_LEVEL && (var) > 1 ) { \ - int lv2__ = (lv); (lv) = skill->dbs->db[(id)].max; \ - return (var) + ((lv2__-(lv))/2);\ - } \ - return (var);\ -} while(0) -#define skill_glv(lv) min((lv),MAX_SKILL_LEVEL-1) // Skill DB -int skill_get_hit( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].hit, skill_id); } -int skill_get_inf( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].inf, skill_id); } -int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get (skill->dbs->db[skill_id].element[skill_glv(skill_lv-1)], skill_id); } -int skill_get_nk( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].nk, skill_id); } -int skill_get_max( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].max, skill_id); } -int skill_get_range( uint16 skill_id , uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].range[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 ( (skill->dbs->db[skill_id].splash[skill_glv(skill_lv-1)]>=0?skill->dbs->db[skill_id].splash[skill_glv(skill_lv-1)]:AREA_SIZE), skill_id, skill_lv); } -int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].hp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].sp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].hp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].sp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_state(uint16 skill_id) { skill_get (skill->dbs->db[skill_id].state, skill_id); } -int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].spiritball[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_itemid(uint16 skill_id, int idx) { skill_get (skill->dbs->db[skill_id].itemid[idx], skill_id); } -int skill_get_itemqty(uint16 skill_id, int idx) { skill_get (skill->dbs->db[skill_id].amount[idx], skill_id); } -int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].zeny[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].num[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].cast[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].delay[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].walkdelay[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].upkeep_time[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].upkeep_time2[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_castdef( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].cast_def_rate, skill_id); } -int skill_get_weapontype( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].weapon, skill_id); } -int skill_get_ammotype( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].ammo, skill_id); } -int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].ammo_qty[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_inf2( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].inf2, skill_id); } -int skill_get_castcancel( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].castcancel, skill_id); } -int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].maxcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].blewcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].mhp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].castnodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].delaynodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_type( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].skill_type, skill_id); } -int skill_get_unit_id ( uint16 skill_id, int flag ){ skill_get (skill->dbs->db[skill_id].unit_id[flag], skill_id); } -int skill_get_unit_interval( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].unit_interval, skill_id); } -int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].unit_range[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_unit_target( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].unit_target&BCT_ALL, skill_id); } -int skill_get_unit_bl_target( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].unit_target&BL_ALL, skill_id); } -int skill_get_unit_flag( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].unit_flag, skill_id); } -int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].unit_layout_type[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].cooldown[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ) { + +int skill_get_hit(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].hit; +} + +int skill_get_inf(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].inf; +} + +int skill_get_ele(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].element[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].element[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_nk(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].nk; +} + +int skill_get_max(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].max; +} + +int skill_get_range(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].range[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].range[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_splash(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].splash[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].splash[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_hp(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].hp[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].hp[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_sp(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].sp[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].sp[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_hp_rate(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].hp_rate[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].hp_rate[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_sp_rate(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].sp_rate[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].sp_rate[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_state(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].state; +} + +int skill_get_spiritball(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].spiritball[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].spiritball[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_itemid(int skill_id, int item_idx) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(item_idx >= 0 && item_idx < MAX_SKILL_ITEM_REQUIRE); + return skill->dbs->db[idx].itemid[item_idx]; +} + +int skill_get_itemqty(int skill_id, int item_idx) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(item_idx >= 0 && item_idx < MAX_SKILL_ITEM_REQUIRE); + return skill->dbs->db[idx].amount[item_idx]; +} + +int skill_get_zeny(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].zeny[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].zeny[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_num(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].num[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].num[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_cast(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].cast[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].cast[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_delay(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].delay[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].delay[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_walkdelay(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].walkdelay[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].walkdelay[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_time(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].upkeep_time[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].upkeep_time[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_time2(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].upkeep_time2[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].upkeep_time2[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_castdef(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].cast_def_rate; +} + +int skill_get_weapontype(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].weapon; +} + +int skill_get_ammotype(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].ammo; +} + +int skill_get_ammo_qty(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].ammo_qty[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].ammo_qty[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_inf2(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].inf2; +} + +int skill_get_castcancel(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].castcancel; +} + +int skill_get_maxcount(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].maxcount[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].maxcount[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_blewcount(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].blewcount[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].blewcount[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_mhp(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].mhp[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].mhp[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_castnodex(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].castnodex[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].castnodex[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_delaynodex(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].delaynodex[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].delaynodex[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_type(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].skill_type; +} + +int skill_get_unit_id(int skill_id, int flag) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(flag >= 0 && flag < ARRAYLENGTH(skill->dbs->db[0].unit_id)); + return skill->dbs->db[idx].unit_id[flag]; +} + +int skill_get_unit_interval(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].unit_interval; +} + +int skill_get_unit_range(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].unit_range[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].unit_range[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_unit_target(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].unit_target & BCT_ALL; +} + +int skill_get_unit_bl_target(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].unit_target & BL_ALL; +} + +int skill_get_unit_flag(int skill_id) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].unit_flag; +} + +int skill_get_unit_layout_type(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].unit_layout_type[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].unit_layout_type[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_cooldown(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].cooldown[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].cooldown[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_fixed_cast(int skill_id, int skill_lv) +{ + int idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); #ifdef RENEWAL_CAST - Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].fixed_cast[skill_glv(skill_lv-1)], skill_id, skill_lv); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].fixed_cast[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].fixed_cast[skill_get_lvl_idx(skill_lv)]; #else return 0; #endif } -int skill_tree_get_max(uint16 skill_id, int class) +int skill_tree_get_max(int skill_id, int class) { int i; int class_idx = pc->class2idx(class); @@ -231,7 +604,7 @@ int skill_tree_get_max(uint16 skill_id, int class) return skill->get_max(skill_id); } -int skill_get_casttype(uint16 skill_id) +int skill_get_casttype(int skill_id) { int inf = skill->get_inf(skill_id); if (inf&(INF_GROUND_SKILL)) @@ -248,7 +621,7 @@ int skill_get_casttype(uint16 skill_id) return CAST_DAMAGE; } -int skill_get_casttype2(uint16 index) +int skill_get_casttype2(int index) { int inf; Assert_retr(CAST_NODAMAGE, index < MAX_SKILL_DB); @@ -268,7 +641,7 @@ int skill_get_casttype2(uint16 index) } //Returns actual skill range taking into account attack range and AC_OWL [Skotlex] -int skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv) +int skill_get_range2(struct block_list *bl, int skill_id, int skill_lv) { int range; struct map_session_data *sd = BL_CAST(BL_PC, bl); @@ -3175,8 +3548,8 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, struct status_data *st; struct map_session_data *sd = NULL; int i, hp, sp, hp_rate, sp_rate, state, mhp; - uint16 idx; - int itemid[MAX_SKILL_ITEM_REQUIRE],amount[ARRAYLENGTH(itemid)],index[ARRAYLENGTH(itemid)]; + int idx; + int itemid[MAX_SKILL_ITEM_REQUIRE], amount[MAX_SKILL_ITEM_REQUIRE], index[MAX_SKILL_ITEM_REQUIRE]; if( lv < 1 || lv > MAX_SKILL_LEVEL ) return 0; @@ -3192,8 +3565,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, return 0; // Requirements - for( i = 0; i < ARRAYLENGTH(itemid); i++ ) - { + for (i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++) { itemid[i] = skill->dbs->db[idx].itemid[i]; amount[i] = skill->dbs->db[idx].amount[i]; } @@ -6666,7 +7038,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin // custom hack to make the mob display the skill, because these skills don't show the skill use text themselves //NOTE: mobs don't have the sprite animation that is used when performing this skill (will cause glitches) char temp[70]; - snprintf(temp, sizeof(temp), "%s : %s !!",md->name,skill->dbs->db[skill_id].desc); + snprintf(temp, sizeof(temp), "%s : %s !!", md->name, skill->get_desc(skill_id)); clif->disp_overhead(&md->bl,temp); } break; @@ -6865,7 +7237,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin return 1; } if( sd->skillitem != skill_id ) - status_zap(src,0,skill->dbs->db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded + status_zap(src, 0, skill->get_sp(skill_id, skill_lv)); // consume sp only if succeeded } break; @@ -7041,21 +7413,22 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin return 1; } if( sd ) { - int x,bonus=100, potion = min(500+skill_lv,505); - x = skill_lv%11 - 1; - i = pc->search_inventory(sd,skill->dbs->db[skill_id].itemid[x]); - if (i == INDEX_NOT_FOUND || skill->dbs->db[skill_id].itemid[x] <= 0) { + int bonus = 100, potion = min(500+skill_lv,505); + int item_idx = (skill_lv - 1) % MAX_SKILL_ITEM_REQUIRE; + int item_id = skill->get_itemid(skill_id, item_idx); + int inventory_idx = pc->search_inventory(sd, item_id); + if (inventory_idx == INDEX_NOT_FOUND || item_id <= 0) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); return 1; } - if(sd->inventory_data[i] == NULL || sd->status.inventory[i].amount < skill->dbs->db[skill_id].amount[x]) { + if (sd->inventory_data[inventory_idx] == NULL || sd->status.inventory[inventory_idx].amount < skill->get_itemqty(skill_id, item_idx)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); return 1; } if( skill_id == AM_BERSERKPITCHER ) { - if (dstsd && dstsd->status.base_level < sd->inventory_data[i]->elv) { + if (dstsd != NULL && dstsd->status.base_level < sd->inventory_data[inventory_idx]->elv) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); return 1; @@ -7064,7 +7437,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin script->potion_flag = 1; script->potion_hp = script->potion_sp = script->potion_per_hp = script->potion_per_sp = 0; script->potion_target = bl->id; - script->run_use_script(sd, sd->inventory_data[i], 0); + script->run_use_script(sd, sd->inventory_data[inventory_idx], 0); script->potion_flag = script->potion_target = 0; if( sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_ALCHEMIST ) bonus += sd->status.base_level; @@ -7384,7 +7757,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin maxlv = skill_lv - 4; } else if(skill_lv >=2) { - int i = rnd()%3; + int i = rnd() % ARRAYLENGTH(spellarray); spellid = spellarray[i]; maxlv = skill_lv - 1; } @@ -7591,14 +7964,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case WE_MALE: { - int hp_rate = (!skill_lv)? 0:skill->dbs->db[skill_id].hp_rate[skill_lv-1]; + int hp_rate = skill_lv == 0 ? 0 : skill->get_hp_rate(skill_id, skill_lv); int gain_hp = tstatus->max_hp*abs(hp_rate)/100; // The earned is the same % of the target HP than it cost the caster. [Skotlex] clif->skill_nodamage(src,bl,skill_id,status->heal(bl, gain_hp, 0, 0),1); } break; case WE_FEMALE: { - int sp_rate = (!skill_lv)? 0:skill->dbs->db[skill_id].sp_rate[skill_lv-1]; + int sp_rate = skill_lv == 0 ? 0 : skill->get_sp_rate(skill_id, skill_lv); int gain_sp = tstatus->max_sp*abs(sp_rate)/100;// The earned is the same % of the target SP than it cost the caster. [Skotlex] clif->skill_nodamage(src,bl,skill_id,status->heal(bl, 0, gain_sp, 0),1); } @@ -7661,16 +8034,17 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if( battle_config.skill_removetrap_type ) { int i; // get back all items used to deploy the trap - for( i = 0; i < 10; i++ ) { - if( skill->dbs->db[su->group->skill_id].itemid[i] > 0 ) { + for (i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++) { + int nameid = skill->get_itemid(su->group->skill_id, i); + if (nameid > 0) { int success; - struct item item_tmp; - memset(&item_tmp,0,sizeof(item_tmp)); - item_tmp.nameid = skill->dbs->db[su->group->skill_id].itemid[i]; + struct item item_tmp = { 0 }; + int amount = skill->get_itemqty(su->group->skill_id, i); + item_tmp.nameid = nameid; item_tmp.identify = 1; - if (item_tmp.nameid && (success=pc->additem(sd,&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],LOG_TYPE_SKILL)) != 0) { + if ((success = pc->additem(sd, &item_tmp, amount, LOG_TYPE_SKILL)) != 0) { clif->additem(sd,0,0,success); - map->addflooritem(&sd->bl, &item_tmp, skill->dbs->db[su->group->skill_id].amount[i], sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } @@ -7902,7 +8276,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin map->freeblock_unlock(); return 0; } - status_zap(src,0,skill->dbs->db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded [Inkfish] + status_zap(src, 0, skill->get_sp(skill_id, skill_lv)); // consume sp only if succeeded [Inkfish] do { int eff = rnd() % 14; if( eff == 5 ) @@ -7926,7 +8300,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->damage(src,bl,0,0,1000,0,BDT_NORMAL,0); if( !status->isdead(bl) ) { int where[] = { EQP_ARMOR, EQP_SHIELD, EQP_HELM, EQP_SHOES, EQP_GARMENT }; - skill->break_equip(bl, where[rnd()%5], 10000, BCT_ENEMY); + skill->break_equip(bl, where[rnd() % ARRAYLENGTH(where)], 10000, BCT_ENEMY); } } break; @@ -7947,7 +8321,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case 7: // stop freeze or stoned { enum sc_type sc[] = { SC_STOP, SC_FREEZE, SC_STONE }; - sc_start(src,bl,sc[rnd()%3],100,skill_lv,skill->get_time2(skill_id,skill_lv)); + sc_start(src,bl,sc[rnd() % ARRAYLENGTH(sc)],100,skill_lv,skill->get_time2(skill_id,skill_lv)); } break; case 8: // curse coma and poison @@ -10837,10 +11211,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui // Slim Pitcher [Celest] case CR_SLIMPITCHER: if (sd) { - int i = skill_lv%11 - 1; - int j = pc->search_inventory(sd,skill->dbs->db[skill_id].itemid[i]); - if (j == INDEX_NOT_FOUND || skill->dbs->db[skill_id].itemid[i] <= 0 - || sd->inventory_data[j] == NULL || sd->status.inventory[j].amount < skill->dbs->db[skill_id].amount[i] + int item_idx = (skill_lv - 1) % MAX_SKILL_ITEM_REQUIRE; + int item_id = skill->get_itemid(skill_id, item_idx); + int inventory_idx = pc->search_inventory(sd, item_id); + int bonus; + if (inventory_idx == INDEX_NOT_FOUND || item_id <= 0 + || sd->inventory_data[inventory_idx] == NULL + || sd->status.inventory[inventory_idx].amount < skill->get_itemqty(skill_id, item_idx) ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; @@ -10848,44 +11225,44 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui script->potion_flag = 1; script->potion_hp = 0; script->potion_sp = 0; - script->run_use_script(sd, sd->inventory_data[j], 0); + script->run_use_script(sd, sd->inventory_data[inventory_idx], 0); script->potion_flag = 0; //Apply skill bonuses - i = pc->checkskill(sd,CR_SLIMPITCHER)*10 + bonus = pc->checkskill(sd,CR_SLIMPITCHER)*10 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5 + pc->skillheal_bonus(sd, skill_id); - script->potion_hp = script->potion_hp * (100+i)/100; - script->potion_sp = script->potion_sp * (100+i)/100; + script->potion_hp = script->potion_hp * (100 + bonus) / 100; + script->potion_sp = script->potion_sp * (100 + bonus) / 100; - if(script->potion_hp > 0 || script->potion_sp > 0) { - i = skill->get_splash(skill_id, skill_lv); + if (script->potion_hp > 0 || script->potion_sp > 0) { + r = skill->get_splash(skill_id, skill_lv); map->foreachinarea(skill->area_sub, - src->m,x-i,y-i,x+i,y+i,BL_CHAR, - src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1, + src->m, x - r, y - r, x + r, y + r, BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_PARTY|BCT_GUILD|1, skill->castend_nodamage_id); } } else { - int i = skill_lv%11 - 1; - struct item_data *item; - i = skill->dbs->db[skill_id].itemid[i]; - item = itemdb->search(i); + int item_idx = (skill_lv - 1) % MAX_SKILL_ITEM_REQUIRE; + int item_id = skill->get_itemid(skill_id, item_idx); + struct item_data *item = itemdb->search(item_id); + int bonus; script->potion_flag = 1; script->potion_hp = 0; script->potion_sp = 0; script->run(item->script,0,src->id,0); script->potion_flag = 0; - i = skill->get_max(CR_SLIMPITCHER)*10; + bonus = skill->get_max(CR_SLIMPITCHER)*10; - script->potion_hp = script->potion_hp * (100+i)/100; - script->potion_sp = script->potion_sp * (100+i)/100; + script->potion_hp = script->potion_hp * (100 + bonus)/100; + script->potion_sp = script->potion_sp * (100 + bonus)/100; - if(script->potion_hp > 0 || script->potion_sp > 0) { - i = skill->get_splash(skill_id, skill_lv); + if (script->potion_hp > 0 || script->potion_sp > 0) { + r = skill->get_splash(skill_id, skill_lv); map->foreachinarea(skill->area_sub, - src->m,x-i,y-i,x+i,y+i,BL_CHAR, - src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1, + src->m, x - r, y - r, x + r, y + r, BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_PARTY|BCT_GUILD|1, skill->castend_nodamage_id); } } @@ -11636,27 +12013,27 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ int element[5]={ELE_WIND,ELE_DARK,ELE_POISON,ELE_WATER,ELE_FIRE}; val1 = st->rhw.ele; - if (!val1) - val1=element[rnd()%5]; + if (val1 == ELE_NEUTRAL) + val1 = element[rnd() % ARRAYLENGTH(element)]; - switch (val1) - { + switch (val1) { case ELE_FIRE: - subunt++; - FALLTHROUGH + subunt = 4; + break; case ELE_WATER: - subunt++; - FALLTHROUGH + subunt = 3; + break; case ELE_POISON: - subunt++; - FALLTHROUGH + subunt = 2; + break; case ELE_DARK: - subunt++; - FALLTHROUGH + subunt = 1; + break; case ELE_WIND: + subunt = 0; break; default: - subunt=rnd()%5; + subunt = rnd() % 5; break; } @@ -14824,7 +15201,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 } for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++ ) { - if( (skill_id == AM_POTIONPITCHER || skill_id == CR_SLIMPITCHER || skill_id == CR_CULTIVATION) && i != skill_lv%11 - 1 ) + int item_idx = (skill_lv - 1) % MAX_SKILL_ITEM_REQUIRE; + if ((skill_id == AM_POTIONPITCHER || skill_id == CR_SLIMPITCHER || skill_id == CR_CULTIVATION) && i != item_idx) continue; switch( skill_id ) { @@ -16618,15 +16996,16 @@ struct skill_unit_group* skill_id2group(int group_id) /// Fatal error if nothing is available. int skill_get_new_group_id(void) { - if( skill->unit_group_newid >= MAX_SKILL_DB && skill->id2group(skill->unit_group_newid) == NULL ) + if (skill->unit_group_newid > MAX_SKILL_ID && skill->id2group(skill->unit_group_newid) == NULL) return skill->unit_group_newid++;// available - {// find next id + + { + // find next id int base_id = skill->unit_group_newid; - while( base_id != ++skill->unit_group_newid ) - { - if( skill->unit_group_newid < MAX_SKILL_DB ) - skill->unit_group_newid = MAX_SKILL_DB; - if( skill->id2group(skill->unit_group_newid) == NULL ) + while (base_id != ++skill->unit_group_newid) { + if (skill->unit_group_newid <= MAX_SKILL_ID) + skill->unit_group_newid = MAX_SKILL_ID + 1; + if (skill->id2group(skill->unit_group_newid) == NULL) return skill->unit_group_newid++;// available } // full loop, nothing available @@ -17719,7 +18098,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int difficulty = 30 + rnd()%120; // Random number between (30 ~ 150) make_per = sd->status.job_level / 4 + st->luk / 2 + st->dex / 3; // (Caster?s Job Level / 4) + (Caster?s LUK / 2) + (Caster?s DEX / 3) - qty = ~(5 + rnd()%5) + 1; + qty = ~(5 + rnd()%5) + 1; // FIXME[Haru]: This smells, if anyone knows the intent, please rewrite the expression in a more clear form. switch(nameid){// difficulty factor case ITEMID_APPLE_BOMB: @@ -17755,7 +18134,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, qty = 5; if( qty < 0 || (skill_lv == 1 && make_per < difficulty)){ - qty = ~qty + 1; + qty = ~qty + 1; // FIXME[Haru]: This smells. If anyone knows the intent, please rewrite the expression in a more clear form. make_per = 0; }else make_per = 10000; @@ -18012,7 +18391,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int rate = rnd()%500; memset(&tmp_item,0,sizeof(tmp_item)); if( rate < 50) i = 4; - else if( rate < 100) i = 2+rnd()%1; + else if( rate < 100) i = 2+rnd()%1; // FIXME[Haru]: This '%1' is certainly not intended. If anyone knows the purpose, please rewrite this code. else if( rate < 250 ) i = 1; else if( rate < 500 ) i = 0; tmp_item.nameid = compensation[i]; @@ -18435,7 +18814,7 @@ int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data) struct map_session_data *sd = map->id2sd(id); struct skill_cd * cd = NULL; - if (data <= 0 || data >= MAX_SKILL) + if (data <= 0 || data >= MAX_SKILL_DB) return 0; if (!sd || !sd->blockskill[data]) return 0; @@ -18571,7 +18950,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) int skill_blockhomun_end(int tid, int64 tick, int id, intptr_t data) { struct homun_data *hd = map->id2hd(id); - if (data <= 0 || data >= MAX_SKILL) + if (data <= 0 || data >= MAX_SKILL_DB) return 0; if (hd != NULL) hd->blockskill[data] = 0; @@ -18600,7 +18979,7 @@ int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) int skill_blockmerc_end(int tid, int64 tick, int id, intptr_t data) { struct mercenary_data *md = map->id2mc(id); - if (data <= 0 || data >= MAX_SKILL) + if (data <= 0 || data >= MAX_SKILL_DB) return 0; if (md != NULL) md->blockskill[data] = 0; @@ -20477,7 +20856,7 @@ bool skill_read_skilldb(const char *filename) struct config_setting_t *sk, *conf; char filepath[256]; int count=0, index=0; - bool duplicate[MAX_SKILL] = {0}; + bool duplicate[MAX_SKILL_DB] = {0}; nullpo_retr(false, filename); @@ -20902,8 +21281,12 @@ void skill_defaults(void) skill->get_hp = skill_get_hp; skill->get_mhp = skill_get_mhp; skill->get_sp = skill_get_sp; + skill->get_hp_rate = skill_get_hp_rate; + skill->get_sp_rate = skill_get_sp_rate; skill->get_state = skill_get_state; skill->get_spiritball = skill_get_spiritball; + skill->get_itemid = skill_get_itemid; + skill->get_itemqty = skill_get_itemqty; skill->get_zeny = skill_get_zeny; skill->get_num = skill_get_num; skill->get_cast = skill_get_cast; @@ -20932,7 +21315,6 @@ void skill_defaults(void) skill->tree_get_max = skill_tree_get_max; skill->get_name = skill_get_name; skill->get_desc = skill_get_desc; - skill->chk = skill_chk; skill->get_casttype = skill_get_casttype; skill->get_casttype2 = skill_get_casttype2; skill->is_combo = skill_is_combo; diff --git a/src/map/skill.h b/src/map/skill.h index bba440107..fa95a1a99 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -25,7 +25,7 @@ #include "map/status.h" // enum sc_type #include "common/hercules.h" #include "common/db.h" -#include "common/mmo.h" // MAX_SKILL, struct square +#include "common/mmo.h" // MAX_SKILL_DB, struct square /** * Declarations @@ -43,7 +43,6 @@ struct status_change_entry; /** * Defines **/ -#define MAX_SKILL_DB MAX_SKILL #define MAX_SKILL_PRODUCE_DB 270 #define MAX_PRODUCE_RESOURCE 10 #define MAX_SKILL_ARROW_DB 140 @@ -1930,54 +1929,56 @@ struct skill_interface { int unit_temp[20]; // temporary storage for tracking skill unit skill ids as players move in/out of them int unit_group_newid; /* accesssors */ - int (*get_index) ( uint16 skill_id ); - int (*get_type) ( uint16 skill_id ); - int (*get_hit) ( uint16 skill_id ); - int (*get_inf) ( uint16 skill_id ); - int (*get_ele) ( uint16 skill_id, uint16 skill_lv ); - int (*get_nk) ( uint16 skill_id ); - int (*get_max) ( uint16 skill_id ); - int (*get_range) ( uint16 skill_id, uint16 skill_lv ); - int (*get_range2) (struct block_list *bl, uint16 skill_id, uint16 skill_lv); - int (*get_splash) ( uint16 skill_id, uint16 skill_lv ); - int (*get_hp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_mhp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_sp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_state) (uint16 skill_id); - int (*get_spiritball) (uint16 skill_id, uint16 skill_lv); - int (*get_zeny) ( uint16 skill_id, uint16 skill_lv ); - int (*get_num) ( uint16 skill_id, uint16 skill_lv ); - int (*get_cast) ( uint16 skill_id, uint16 skill_lv ); - int (*get_delay) ( uint16 skill_id, uint16 skill_lv ); - int (*get_walkdelay) ( uint16 skill_id, uint16 skill_lv ); - int (*get_time) ( uint16 skill_id, uint16 skill_lv ); - int (*get_time2) ( uint16 skill_id, uint16 skill_lv ); - int (*get_castnodex) ( uint16 skill_id, uint16 skill_lv ); - int (*get_delaynodex) ( uint16 skill_id ,uint16 skill_lv ); - int (*get_castdef) ( uint16 skill_id ); - int (*get_weapontype) ( uint16 skill_id ); - int (*get_ammotype) ( uint16 skill_id ); - int (*get_ammo_qty) ( uint16 skill_id, uint16 skill_lv ); - int (*get_unit_id) (uint16 skill_id,int flag); - int (*get_inf2) ( uint16 skill_id ); - int (*get_castcancel) ( uint16 skill_id ); - int (*get_maxcount) ( uint16 skill_id, uint16 skill_lv ); - int (*get_blewcount) ( uint16 skill_id, uint16 skill_lv ); - int (*get_unit_flag) ( uint16 skill_id ); - int (*get_unit_target) ( uint16 skill_id ); - int (*get_unit_interval) ( uint16 skill_id ); - int (*get_unit_bl_target) ( uint16 skill_id ); - int (*get_unit_layout_type) ( uint16 skill_id ,uint16 skill_lv ); - int (*get_unit_range) ( uint16 skill_id, uint16 skill_lv ); - int (*get_cooldown) ( uint16 skill_id, uint16 skill_lv ); - int (*tree_get_max) (uint16 skill_id, int class); - const char *(*get_name) ( uint16 skill_id ); - const char *(*get_desc) ( uint16 skill_id ); - /* check */ - void (*chk) (uint16* skill_id); + int (*get_index) (int skill_id); + int (*get_type) (int skill_id); + int (*get_hit) (int skill_id); + int (*get_inf) (int skill_id); + int (*get_ele) (int skill_id, int skill_lv); + int (*get_nk) (int skill_id); + int (*get_max) (int skill_id); + int (*get_range) (int skill_id, int skill_lv); + int (*get_range2) (struct block_list *bl, int skill_id, int skill_lv); + int (*get_splash) (int skill_id, int skill_lv); + int (*get_hp) (int skill_id, int skill_lv); + int (*get_mhp) (int skill_id, int skill_lv); + int (*get_sp) (int skill_id, int skill_lv); + int (*get_hp_rate) (int skill_id, int skill_lv); + int (*get_sp_rate) (int skill_id, int skill_lv); + int (*get_state) (int skill_id); + int (*get_spiritball) (int skill_id, int skill_lv); + int (*get_itemid) (int skill_id, int item_idx); + int (*get_itemqty) (int skill_id, int item_idx); + int (*get_zeny) (int skill_id, int skill_lv); + int (*get_num) (int skill_id, int skill_lv); + int (*get_cast) (int skill_id, int skill_lv); + int (*get_delay) (int skill_id, int skill_lv); + int (*get_walkdelay) (int skill_id, int skill_lv); + int (*get_time) (int skill_id, int skill_lv); + int (*get_time2) (int skill_id, int skill_lv); + int (*get_castnodex) (int skill_id, int skill_lv); + int (*get_delaynodex) (int skill_id, int skill_lv); + int (*get_castdef) (int skill_id); + int (*get_weapontype) (int skill_id); + int (*get_ammotype) (int skill_id); + int (*get_ammo_qty) (int skill_id, int skill_lv); + int (*get_unit_id) (int skill_id, int flag); + int (*get_inf2) (int skill_id); + int (*get_castcancel) (int skill_id); + int (*get_maxcount) (int skill_id, int skill_lv); + int (*get_blewcount) (int skill_id, int skill_lv); + int (*get_unit_flag) (int skill_id); + int (*get_unit_target) (int skill_id); + int (*get_unit_interval) (int skill_id); + int (*get_unit_bl_target) (int skill_id); + int (*get_unit_layout_type) (int skill_id, int skill_lv); + int (*get_unit_range) (int skill_id, int skill_lv); + int (*get_cooldown) (int skill_id, int skill_lv); + int (*tree_get_max) (int skill_id, int class); + const char *(*get_name) (int skill_id); + const char *(*get_desc) (int skill_id); /* whether its CAST_GROUND, CAST_DAMAGE or CAST_NODAMAGE */ - int (*get_casttype) (uint16 skill_id); - int (*get_casttype2) (uint16 index); + int (*get_casttype) (int skill_id); + int (*get_casttype2) (int index); bool (*is_combo) (int skill_id); int (*name2id) (const char* name); int (*isammotype) (struct map_session_data *sd, int skill_id); @@ -2071,7 +2072,7 @@ struct skill_interface { int (*check_condition_mob_master_sub) (struct block_list *bl, va_list ap); void (*brandishspear_first) (struct square *tc, uint8 dir, int16 x, int16 y); void (*brandishspear_dir) (struct square* tc, uint8 dir, int are); - int (*get_fixed_cast) ( uint16 skill_id ,uint16 skill_lv ); + int (*get_fixed_cast) (int skill_id, int skill_lv); int (*sit_count) (struct block_list *bl, va_list ap); int (*sit_in) (struct block_list *bl, va_list ap); int (*sit_out) (struct block_list *bl, va_list ap); diff --git a/src/map/status.c b/src/map/status.c index ccd1e6b11..ddb8c7e6a 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -159,7 +159,7 @@ void initChangeTables(void) for (i = 0; i < SC_MAX; i++) status->dbs->IconChangeTable[i] = SI_BLANK; - for (i = 0; i < MAX_SKILL; i++) + for (i = 0; i < MAX_SKILL_DB; i++) status->dbs->Skill2SCTable[i] = SC_NONE; for (i = 0; i < SI_MAX; i++) @@ -2329,7 +2329,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) static int calculating = 0; //Check for recursive call preemption. [Skotlex] struct status_data *bstatus; // pointer to the player's base status const struct status_change *sc; - struct s_skill b_skill[MAX_SKILL]; // previous skill tree + struct s_skill b_skill[MAX_SKILL_DB]; // previous skill tree int b_weight, b_max_weight, b_cart_weight_max, // previous weight i, k, index, skill_lv,refinedef=0; int64 i64; diff --git a/src/map/status.h b/src/map/status.h index a104c66ab..e9c2218e8 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -2257,7 +2257,7 @@ BEGIN_ZEROED_BLOCK; /* Everything within this block will be memset to 0 when sta int HP_table[CLASS_COUNT][MAX_LEVEL + 1]; int SP_table[CLASS_COUNT][MAX_LEVEL + 1]; int aspd_base[CLASS_COUNT][MAX_SINGLE_WEAPON_TYPE+1]; // +1 for RENEWAL_ASPD - sc_type Skill2SCTable[MAX_SKILL]; // skill -> status + sc_type Skill2SCTable[MAX_SKILL_DB]; // skill -> status int IconChangeTable[SC_MAX]; // status -> "icon" (icon is a bit of a misnomer, since there exist values with no icon associated) unsigned int ChangeFlagTable[SC_MAX]; // status -> flags int SkillChangeTable[SC_MAX]; // status -> skill |