diff options
author | glighta <glighta@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-12-30 16:00:24 +0000 |
---|---|---|
committer | glighta <glighta@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-12-30 16:00:24 +0000 |
commit | e81fad940ac591a6a76ecd0aa0b1d26cff688705 (patch) | |
tree | 03e7cad0b1bd243837b40cd5045957806291b992 | |
parent | a31cce3c60cc170db0d4a8ff707626e8777b0801 (diff) | |
download | hercules-e81fad940ac591a6a76ecd0aa0b1d26cff688705.tar.gz hercules-e81fad940ac591a6a76ecd0aa0b1d26cff688705.tar.bz2 hercules-e81fad940ac591a6a76ecd0aa0b1d26cff688705.tar.xz hercules-e81fad940ac591a6a76ecd0aa0b1d26cff688705.zip |
-Harmonize skillid, skill_num, skillnum, skill, to skill_id and same for skill_lv
-Optimise type from int to int16 in order to reduce ram consumtion.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17065 54d463be-8e91-2dee-dedb-b68131a5f0ec
40 files changed, 3448 insertions, 3435 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 0966d2344..305847c1d 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -1031,12 +1031,12 @@ int mapif_guild_memberinfochanged(int guild_id,int account_id,int char_id, int t } // ACK guild skill up -int mapif_guild_skillupack(int guild_id,int skill_num,int account_id) +int mapif_guild_skillupack(int guild_id,uint16 skill_id,int account_id) { unsigned char buf[14]; WBUFW(buf, 0)=0x383c; WBUFL(buf, 2)=guild_id; - WBUFL(buf, 6)=skill_num; + WBUFL(buf, 6)=skill_id; WBUFL(buf,10)=account_id; mapif_sendall(buf,14); return 0; @@ -1620,10 +1620,10 @@ int mapif_parse_GuildPosition(int fd,int guild_id,int idx,struct guild_position } // Guild Skill UP -int mapif_parse_GuildSkillUp(int fd,int guild_id,int skill_num,int account_id,int max) +int mapif_parse_GuildSkillUp(int fd,int guild_id,uint16 skill_id,int account_id,int max) { struct guild * g; - int idx = skill_num - GD_SKILLBASE; + int idx = skill_id - GD_SKILLBASE; g = inter_guild_fromsql(guild_id); if(g == NULL || idx < 0 || idx >= MAX_GUILDSKILL) @@ -1635,7 +1635,7 @@ int mapif_parse_GuildSkillUp(int fd,int guild_id,int skill_num,int account_id,in g->skill_point--; if (!guild_calcinfo(g)) mapif_guild_info(-1,g); - mapif_guild_skillupack(guild_id,skill_num,account_id); + mapif_guild_skillupack(guild_id,skill_id,account_id); g->save_flag |= (GS_LEVEL|GS_SKILL); // Change guild & guild_skill } return 0; diff --git a/src/common/mmo.h b/src/common/mmo.h index 4284e7f72..744108a31 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -545,7 +545,7 @@ enum { //Change Guild Infos GBI_EXP =1, // Guild Experience (EXP) GBI_GUILDLV, // Guild level GBI_SKILLPOINT, // Guild skillpoints - GBI_SKILLLV, // Guild skilllv ?? seem unused + GBI_skill_lv, // Guild skill_lv ?? seem unused }; enum { //Change Member Infos diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a48fe17bc..8f6fa41ac 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -445,7 +445,7 @@ ACMD_FUNC(mapmove) char map_name[MAP_NAME_LENGTH_EXT]; unsigned short mapindex; short x = 0, y = 0; - int m = -1; + int16 m = -1; nullpo_retr(-1, sd); @@ -815,7 +815,7 @@ ACMD_FUNC(save) *------------------------------------------*/ ACMD_FUNC(load) { - int m; + int16 m; nullpo_retr(-1, sd); @@ -1742,7 +1742,7 @@ ACMD_FUNC(go) int i; int town; char map_name[MAP_NAME_LENGTH]; - int m; + int16 m; const struct { char map[MAP_NAME_LENGTH]; @@ -3151,10 +3151,10 @@ ACMD_FUNC(allskill) *------------------------------------------*/ ACMD_FUNC(questskill) { - int skill_id; + uint16 skill_id; nullpo_retr(-1, sd); - if (!message || !*message || (skill_id = atoi(message)) < 0) + if (!message || !*message || (skill_id = atoi(message)) <= 0) {// also send a list of skills applicable to this command const char* text; @@ -3195,10 +3195,10 @@ ACMD_FUNC(questskill) *------------------------------------------*/ ACMD_FUNC(lostskill) { - int skill_id; + uint16 skill_id; nullpo_retr(-1, sd); - if (!message || !*message || (skill_id = atoi(message)) < 0) + if (!message || !*message || (skill_id = atoi(message)) <= 0) {// also send a list of skills applicable to this command const char* text; @@ -5298,13 +5298,13 @@ ACMD_FUNC(clearstorage) clif_displaymessage(fd, msg_txt(250)); return -1; } - + j = sd->status.storage.storage_amount; for (i = 0; i < j; ++i) { storage_delitem(sd, i, sd->status.storage.items[i].amount); } storage_storageclose(sd); - + clif_displaymessage(fd, msg_txt(1394)); // Your storage was cleaned. return 0; } @@ -5315,14 +5315,14 @@ ACMD_FUNC(cleargstorage) struct guild *g; struct guild_storage *gstorage; nullpo_retr(-1, sd); - + g = guild_search(sd->status.guild_id); - + if (g == NULL) { clif_displaymessage(fd, msg_txt(43)); return -1; } - + if (sd->state.storage_flag == 1) { clif_displaymessage(fd, msg_txt(250)); return -1; @@ -5332,7 +5332,7 @@ ACMD_FUNC(cleargstorage) clif_displaymessage(fd, msg_txt(251)); return -1; } - + gstorage = guild2storage2(sd->status.guild_id); if (gstorage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there. return -1; @@ -5345,7 +5345,7 @@ ACMD_FUNC(cleargstorage) } storage_guild_storageclose(sd); gstorage->lock = 0; // Cleaning done, release lock - + clif_displaymessage(fd, msg_txt(1395)); // Your guild storage was cleaned. return 0; } @@ -5354,23 +5354,23 @@ ACMD_FUNC(clearcart) { int i; nullpo_retr(-1, sd); - + if (pc_iscarton(sd) == 0) { clif_displaymessage(fd, msg_txt(1396)); // You do not have a cart to be cleaned. return -1; } - + if (sd->state.vending == 1) { //Somehow... return -1; } - + for( i = 0; i < MAX_CART; i++ ) if(sd->status.cart[i].nameid > 0) pc_cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER); - + clif_clearcart(fd); clif_updatestatus(sd,SP_CARTINFO); - + clif_displaymessage(fd, msg_txt(1397)); // Your cart was cleaned. return 0; } @@ -5411,12 +5411,12 @@ ACMD_FUNC(useskill) { struct map_session_data *pl_sd = NULL; struct block_list *bl; - int skillnum; - int skilllv; + uint16 skill_id; + uint16 skill_lv; char target[100]; nullpo_retr(-1, sd); - if(!message || !*message || sscanf(message, "%d %d %23[^\n]", &skillnum, &skilllv, target) != 3) { + if(!message || !*message || sscanf(message, "%hui %hui %23[^\n]", &skill_id, &skill_lv, target) != 3) { clif_displaymessage(fd, msg_txt(1165)); // Usage: @useskill <skill ID> <skill level> <target> return -1; } @@ -5433,16 +5433,16 @@ ACMD_FUNC(useskill) return -1; } - if (skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE+MAX_HOMUNSKILL + if (skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE+MAX_HOMUNSKILL && sd->hd && merc_is_hom_active(sd->hd)) // (If used with @useskill, put the homunc as dest) bl = &sd->hd->bl; else bl = &sd->bl; - if (skill_get_inf(skillnum)&INF_GROUND_SKILL) - unit_skilluse_pos(bl, pl_sd->bl.x, pl_sd->bl.y, skillnum, skilllv); + if (skill_get_inf(skill_id)&INF_GROUND_SKILL) + unit_skilluse_pos(bl, pl_sd->bl.x, pl_sd->bl.y, skill_id, skill_lv); else - unit_skilluse_id(bl, pl_sd->bl.id, skillnum, skilllv); + unit_skilluse_id(bl, pl_sd->bl.id, skill_id, skill_lv); return 0; } @@ -5456,20 +5456,20 @@ ACMD_FUNC(displayskill) { struct status_data * status; unsigned int tick; - int skillnum; - int skilllv = 1; + uint16 skill_id; + uint16 skill_lv = 1; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%d %d", &skillnum, &skilllv) < 1) + if (!message || !*message || sscanf(message, "%hui %hui", &skill_id, &skill_lv) < 1) { clif_displaymessage(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>} return -1; } status = status_get_status_data(&sd->bl); tick = gettick(); - clif_skill_damage(&sd->bl,&sd->bl, tick, status->amotion, status->dmotion, 1, 1, skillnum, skilllv, 5); - clif_skill_nodamage(&sd->bl, &sd->bl, skillnum, skilllv, 1); - clif_skill_poseffect(&sd->bl, skillnum, skilllv, sd->bl.x, sd->bl.y, tick); + clif_skill_damage(&sd->bl,&sd->bl, tick, status->amotion, status->dmotion, 1, 1, skill_id, skill_lv, 5); + clif_skill_nodamage(&sd->bl, &sd->bl, skill_id, skill_lv, 1); + clif_skill_poseffect(&sd->bl, skill_id, skill_lv, sd->bl.x, sd->bl.y, tick); return 0; } @@ -5480,13 +5480,13 @@ ACMD_FUNC(displayskill) ACMD_FUNC(skilltree) { struct map_session_data *pl_sd = NULL; - int skillnum; + uint16 skill_id; int meets, j, c=0; char target[NAME_LENGTH]; struct skill_tree_entry *ent; nullpo_retr(-1, sd); - if(!message || !*message || sscanf(message, "%d %23[^\r\n]", &skillnum, target) != 2) { + if(!message || !*message || sscanf(message, "%hui %23[^\r\n]", &skill_id, target) != 2) { clif_displaymessage(fd, msg_txt(1167)); // Usage: @skilltree <skill ID> <target> return -1; } @@ -5503,7 +5503,7 @@ ACMD_FUNC(skilltree) sprintf(atcmd_output, msg_txt(1168), job_name(c), pc_checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points). clif_displaymessage(fd, atcmd_output); - ARR_FIND( 0, MAX_SKILL_TREE, j, skill_tree[c][j].id == 0 || skill_tree[c][j].id == skillnum ); + ARR_FIND( 0, MAX_SKILL_TREE, j, skill_tree[c][j].id == 0 || skill_tree[c][j].id == skill_id ); if( j == MAX_SKILL_TREE || skill_tree[c][j].id == 0 ) { clif_displaymessage(fd, msg_txt(1169)); // The player cannot use that skill. @@ -7591,16 +7591,16 @@ ACMD_FUNC(mapflag) { #define setflag( cmd ) \ if ( strcmp( flag_name , #cmd ) == 0 ){\ map[ sd->bl.m ].flag.cmd = flag;\ - sprintf(atcmd_output,"[ @mapflag ] %s flag has been set to %s",#cmd,flag?"On":"Off");\ + sprintf(atcmd_output,"[ @mapflag ] %s flag has been set to %s value = %hd",#cmd,flag?"On":"Off",flag);\ clif_displaymessage(sd->fd,atcmd_output);\ return 0;\ } - unsigned char flag_name[100]; - int flag=0,i; + char flag_name[100]; + short flag=0,i; nullpo_retr(-1, sd); memset(flag_name, '\0', sizeof(flag_name)); - if (!message || !*message || (sscanf(message, "%99s %d", flag_name, &flag) < 1)) { + if (!message || !*message || (sscanf(message, "%99s %hd", flag_name, &flag) < 1)) { clif_displaymessage(sd->fd,msg_txt(1311)); // Enabled Mapflags in this map: clif_displaymessage(sd->fd,"----------------------------------"); checkflag(autotrade); checkflag(allowks); checkflag(nomemo); checkflag(noteleport); @@ -7620,7 +7620,7 @@ ACMD_FUNC(mapflag) { clif_displaymessage(sd->fd,msg_txt(1313)); // Type "@mapflag available" to list the available mapflags. return 1; } - for (i = 0; flag_name[i]; i++) flag_name[i] = tolower(flag_name[i]); //lowercase + for (i = 0; flag_name[i]; i++) flag_name[i] = (char)tolower(flag_name[i]); //lowercase setflag(autotrade); setflag(allowks); setflag(nomemo); setflag(noteleport); setflag(noreturn); setflag(monster_noteleport);setflag(nosave); setflag(nobranch); diff --git a/src/map/battle.c b/src/map/battle.c index f80148d57..7910006e3 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -53,7 +53,7 @@ int battle_getcurrentskill(struct block_list *bl) { //Returns the current/last s ud = unit_bl2ud(bl); - return ud?ud->skillid:0; + return ud?ud->skill_id:0; } /*========================================== @@ -207,8 +207,8 @@ struct delay_damage { int damage; int delay; unsigned short distance; - unsigned short skill_lv; - unsigned short skill_id; + uint16 skill_lv; + uint16 skill_id; enum damage_lv dmg_lv; unsigned short attack_type; }; @@ -251,7 +251,7 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) { return 0; } -int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, enum damage_lv dmg_lv, int ddelay) +int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int damage, enum damage_lv dmg_lv, int ddelay) { struct delay_damage *dat; struct status_change *sc; @@ -422,7 +422,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li if( !damage ) return 0; - + sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); t_class = status_get_class(target); @@ -729,7 +729,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li * ATK may be MISS, BLOCKED FAIL, reduc, increase, end status... * After this we apply bg/gvg reduction *------------------------------------------*/ -int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,int skill_num,int skill_lv) +int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,uint16 skill_id,uint16 skill_lv) { struct map_session_data *sd = NULL; struct status_change *sc; @@ -763,7 +763,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( sc && sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF] ) return 1; - if (skill_num == PA_PRESSURE) + if (skill_id == PA_PRESSURE) return damage; //This skill bypass everything else. if( sc && sc->count ) @@ -774,14 +774,14 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag d->dmg_lv = ATK_BLOCK; return 0; } - if( sc->data[SC_WHITEIMPRISON] && skill_num != HW_GRAVITATION ) { // Gravitation and Pressure do damage without removing the effect - if( skill_num == MG_NAPALMBEAT || - skill_num == MG_SOULSTRIKE || - skill_num == WL_SOULEXPANSION || - (skill_num && skill_get_ele(skill_num, skill_lv) == ELE_GHOST) || - (!skill_num && (status_get_status_data(src))->rhw.ele == ELE_GHOST) + if( sc->data[SC_WHITEIMPRISON] && skill_id != HW_GRAVITATION ) { // Gravitation and Pressure do damage without removing the effect + if( skill_id == MG_NAPALMBEAT || + skill_id == MG_SOULSTRIKE || + skill_id == WL_SOULEXPANSION || + (skill_id && skill_get_ele(skill_id, skill_lv) == ELE_GHOST) || + (!skill_id && (status_get_status_data(src))->rhw.ele == ELE_GHOST) ){ - if( skill_num == WL_SOULEXPANSION ) + if( skill_id == WL_SOULEXPANSION ) damage <<= 1; // If used against a player in White Imprison, the skill deals double damage. status_change_end(bl,SC_WHITEIMPRISON,INVALID_TIMER); // Those skills do damage and removes effect }else{ @@ -799,7 +799,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( sc->data[SC_SAFETYWALL] && (flag&(BF_SHORT|BF_MAGIC))==BF_SHORT ) { struct skill_unit_group* group = skill_id2group(sc->data[SC_SAFETYWALL]->val3); - int skill_id = sc->data[SC_SAFETYWALL]->val2; + uint16 skill_id = sc->data[SC_SAFETYWALL]->val2; if (group) { if(skill_id == MH_STEINWAND){ if (--group->val2<=0) @@ -839,7 +839,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag sc_start2(bl,SC_COMBO,100,GC_WEAPONBLOCKING,src->id,2000); return 0; } - if( (sce=sc->data[SC_AUTOGUARD]) && flag&BF_WEAPON && !(skill_get_nk(skill_num)&NK_NO_CARDFIX_ATK) && rnd()%100 < sce->val2 ) + if( (sce=sc->data[SC_AUTOGUARD]) && flag&BF_WEAPON && !(skill_get_nk(skill_id)&NK_NO_CARDFIX_ATK) && rnd()%100 < sce->val2 ) { int delay; clif_skill_nodamage(bl,bl,CR_AUTOGUARD,sce->val1,1); @@ -875,7 +875,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag } - if( (sce=sc->data[SC_PARRYING]) && flag&BF_WEAPON && skill_num != WS_CARTTERMINATION && rnd()%100 < sce->val2 ) + if( (sce=sc->data[SC_PARRYING]) && flag&BF_WEAPON && skill_id != WS_CARTTERMINATION && rnd()%100 < sce->val2 ) { // attack blocked by Parrying clif_skill_nodamage(bl, bl, LK_PARRYING, sce->val1,1); return 0; @@ -906,7 +906,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag { //Kaupe blocks damage (skill or otherwise) from players, mobs, homuns, mercenaries. clif_specialeffect(bl, 462, AREA); //Shouldn't end until Breaker's non-weapon part connects. - if (skill_num != ASC_BREAKER || !(flag&BF_WEAPON)) + if (skill_id != ASC_BREAKER || !(flag&BF_WEAPON)) if (--(sce->val3) <= 0) //We make it work like Safety Wall, even though it only blocks 1 time. status_change_end(bl, SC_KAUPE, INVALID_TIMER); return 0; @@ -918,11 +918,11 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag } if (((sce=sc->data[SC_UTSUSEMI]) || sc->data[SC_BUNSINJYUTSU]) - && flag&BF_WEAPON && !(skill_get_nk(skill_num)&NK_NO_CARDFIX_ATK)) { + && flag&BF_WEAPON && !(skill_get_nk(skill_id)&NK_NO_CARDFIX_ATK)) { - skill_additional_effect (src, bl, skill_num, skill_lv, flag, ATK_BLOCK, gettick() ); + skill_additional_effect (src, bl, skill_id, skill_lv, flag, ATK_BLOCK, gettick() ); if( !status_isdead(src) ) - skill_counter_additional_effect( src, bl, skill_num, skill_lv, flag, gettick() ); + skill_counter_additional_effect( src, bl, skill_id, skill_lv, flag, gettick() ); if (sce) { clif_specialeffect(bl, 462, AREA); skill_blown(src,bl,sce->val3,-1,0); @@ -937,12 +937,12 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag } //Now damage increasing effects - if( sc->data[SC_AETERNA] && skill_num != PF_SOULBURN ) + if( sc->data[SC_AETERNA] && skill_id != PF_SOULBURN ) { - if( src->type != BL_MER || skill_num == 0 ) + if( src->type != BL_MER || skill_id == 0 ) damage <<= 1; // Lex Aeterna only doubles damage of regular attacks from mercenaries - if( skill_num != ASC_BREAKER || !(flag&BF_WEAPON) ) + if( skill_id != ASC_BREAKER || !(flag&BF_WEAPON) ) status_change_end(bl, SC_AETERNA, INVALID_TIMER); //Shouldn't end until Breaker's non-weapon part connects. } @@ -1011,7 +1011,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag (flag&(BF_LONG|BF_WEAPON)) == (BF_LONG|BF_WEAPON)) DAMAGE_SUBRATE(20) - if(sc->data[SC_FOGWALL] && skill_num != RK_DRAGONBREATH) { + if(sc->data[SC_FOGWALL] && skill_id != RK_DRAGONBREATH) { if(flag&BF_SKILL) //25% reduction DAMAGE_SUBRATE(25) else if ((flag&(BF_LONG|BF_WEAPON)) == (BF_LONG|BF_WEAPON)) @@ -1040,9 +1040,9 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag DAMAGE_SUBRATE(sc->data[SC_ARMOR]->val2) #ifdef RENEWAL - if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON || flag&BF_MAGIC) && skill_num != WS_CARTTERMINATION) + if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON || flag&BF_MAGIC) && skill_id != WS_CARTTERMINATION) #else - if(sc->data[SC_ENERGYCOAT] && flag&BF_WEAPON && skill_num != WS_CARTTERMINATION) + if(sc->data[SC_ENERGYCOAT] && flag&BF_WEAPON && skill_id != WS_CARTTERMINATION) #endif { struct status_data *status = status_get_status_data(bl); @@ -1074,7 +1074,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag #endif //Finally added to remove the status of immobile when aimedbolt is used. [Jobbie] - if( skill_num == RA_AIMEDBOLT && (sc->data[SC_BITE] || sc->data[SC_ANKLE] || sc->data[SC_ELECTRICSHOCKER]) ) + if( skill_id == RA_AIMEDBOLT && (sc->data[SC_BITE] || sc->data[SC_ANKLE] || sc->data[SC_ELECTRICSHOCKER]) ) { status_change_end(bl, SC_BITE, INVALID_TIMER); status_change_end(bl, SC_ANKLE, INVALID_TIMER); @@ -1084,13 +1084,13 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag //Finally Kyrie because it may, or not, reduce damage to 0. if((sce = sc->data[SC_KYRIE]) && damage > 0){ sce->val2-=damage; - if(flag&BF_WEAPON || skill_num == TF_THROWSTONE){ + if(flag&BF_WEAPON || skill_id == TF_THROWSTONE){ if(sce->val2>=0) damage=0; else damage=-sce->val2; } - if((--sce->val3)<=0 || (sce->val2<=0) || skill_num == AL_HOLYLIGHT) + if((--sce->val3)<=0 || (sce->val2<=0) || skill_id == AL_HOLYLIGHT) status_change_end(bl, SC_KYRIE, INVALID_TIMER); } @@ -1103,7 +1103,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( (sce = sc->data[SC_LIGHTNINGWALK]) && flag&BF_LONG && rnd()%100 < sce->val1 ) { int dx[8]={0,-1,-1,-1,0,1,1,1}; int dy[8]={1,1,0,-1,-1,-1,0,1}; - int dir = map_calc_dir(bl, src->x, src->y); + uint8 dir = map_calc_dir(bl, src->x, src->y); if( unit_movepos(bl, src->x-dx[dir], src->y-dy[dir], 1, 1) ) { clif_slide(bl,src->x-dx[dir],src->y-dy[dir]); unit_setdir(bl, dir); @@ -1180,7 +1180,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag break; } } - if( sc->data[SC_POISONINGWEAPON] && skill_num != GC_VENOMPRESSURE && (flag&BF_WEAPON) && damage > 0 && rnd()%100 < sc->data[SC_POISONINGWEAPON]->val3 ) + if( sc->data[SC_POISONINGWEAPON] && skill_id != GC_VENOMPRESSURE && (flag&BF_WEAPON) && damage > 0 && rnd()%100 < sc->data[SC_POISONINGWEAPON]->val3 ) sc_start(bl,sc->data[SC_POISONINGWEAPON]->val2,100,sc->data[SC_POISONINGWEAPON]->val1,skill_get_time2(GC_POISONINGWEAPON, 1)); if( sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 ) status_change_spread(src, bl); @@ -1220,13 +1220,13 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( bl->type == BL_MOB && !status_isdead(bl) && src != bl) { if (damage > 0 ) mobskill_event((TBL_MOB*)bl,src,gettick(),flag); - if (skill_num) - mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_num<<16)); + if (skill_id) + mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_id<<16)); } if( sd ) { if( pc_ismadogear(sd) && rnd()%100 < 50 ) { - short element = skill_get_ele(skill_num, skill_lv); - if( !skill_num || element == -1 ) { //Take weapon's element + short element = skill_get_ele(skill_id, skill_lv); + if( !skill_id || element == -1 ) { //Take weapon's element struct status_data *sstatus = NULL; if( src->type == BL_PC && ((TBL_PC*)src)->bonus.arrow_ele ) element = ((TBL_PC*)src)->bonus.arrow_ele; @@ -1249,7 +1249,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag /*========================================== * Calculates BG related damage adjustments. *------------------------------------------*/ -int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int damage, int div_, int skill_num, int skill_lv, int flag) +int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int damage, int div_, uint16 skill_id, uint16 skill_lv, int flag) { if( !damage ) return 0; @@ -1261,7 +1261,7 @@ int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int dam return 0; // Crystal cannot receive skill damage on battlegrounds } - switch( skill_num ) + switch( skill_id ) { case PA_PRESSURE: case HW_GRAVITATION: @@ -1295,7 +1295,7 @@ int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int dam /*========================================== * Calculates GVG related damage adjustments. *------------------------------------------*/ -int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag) +int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,uint16 skill_id,uint16 skill_lv,int flag) { struct mob_data* md = BL_CAST(BL_MOB, bl); int class_ = status_get_class(bl); @@ -1306,7 +1306,7 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama if(md && md->guardian_data) { if(class_ == MOBID_EMPERIUM && flag&BF_SKILL) { //Skill immunity. - switch (skill_num) { + switch (skill_id) { #ifndef RENEWAL case MO_TRIPLEATTACK: #endif @@ -1327,7 +1327,7 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama } } - switch (skill_num) { + switch (skill_id) { //Skills with no damage reduction. case PA_PRESSURE: case HW_GRAVITATION: @@ -1604,7 +1604,7 @@ void battle_consume_ammo(TBL_PC*sd, int skill, int lv) static int battle_range_type( struct block_list *src, struct block_list *target, - int skill_num, int skill_lv) + uint16 skill_id, uint16 skill_lv) { //Skill Range Criteria if (battle_config.skillrange_by_distance && (src->type&battle_config.skillrange_by_distance) @@ -1614,33 +1614,33 @@ static int battle_range_type( return BF_LONG; } //based on used skill's range - if (skill_get_range2(src, skill_num, skill_lv) < 5) + if (skill_get_range2(src, skill_id, skill_lv) < 5) return BF_SHORT; return BF_LONG; } -static int battle_blewcount_bonus(struct map_session_data *sd, int skill_num) +static int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id) { int i; if (!sd->skillblown[0].id) return 0; //Apply the bonus blewcount. [Skotlex] for (i = 0; i < ARRAYLENGTH(sd->skillblown) && sd->skillblown[i].id; i++) { - if (sd->skillblown[i].id == skill_num) + if (sd->skillblown[i].id == skill_id) return sd->skillblown[i].val; } return 0; } -struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag); -struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag); +struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag); +struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag); //For quick div adjustment. #define damage_div_fix(dmg, div) { if (div > 1) (dmg)*=div; else if (div < 0) (div)*=-1; } /*========================================== * battle_calc_weapon_attack (by Skotlex) *------------------------------------------*/ -static struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int wflag) +static struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int wflag) { unsigned int skillratio = 100; //Skill dmg modifiers. short skill=0; @@ -1679,9 +1679,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo //Initial flag flag.rh=1; flag.weapon=1; - flag.infdef=(tstatus->mode&MD_PLANT && skill_num != RA_CLUSTERBOMB + flag.infdef=(tstatus->mode&MD_PLANT && skill_id != RA_CLUSTERBOMB #ifdef RENEWAL - && skill_num != HT_FREEZINGTRAP + && skill_id != HT_FREEZINGTRAP #endif ?1:0); if( target->type == BL_SKILL){ @@ -1692,17 +1692,17 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo //Initial Values wd.type=0; //Normal attack - wd.div_=skill_num?skill_get_num(skill_num,skill_lv):1; - wd.amotion=(skill_num && skill_get_inf(skill_num)&INF_GROUND_SKILL)?0:sstatus->amotion; //Amotion should be 0 for ground skills. - if(skill_num == KN_AUTOCOUNTER) + wd.div_=skill_id?skill_get_num(skill_id,skill_lv):1; + wd.amotion=(skill_id && skill_get_inf(skill_id)&INF_GROUND_SKILL)?0:sstatus->amotion; //Amotion should be 0 for ground skills. + if(skill_id == KN_AUTOCOUNTER) wd.amotion >>= 1; wd.dmotion=tstatus->dmotion; - wd.blewcount=skill_get_blewcount(skill_num,skill_lv); + wd.blewcount=skill_get_blewcount(skill_id,skill_lv); wd.flag = BF_WEAPON; //Initial Flag - wd.flag |= (skill_num||wflag)?BF_SKILL:BF_NORMAL; // Baphomet card's splash damage is counted as a skill. [Inkfish] + wd.flag |= (skill_id||wflag)?BF_SKILL:BF_NORMAL; // Baphomet card's splash damage is counted as a skill. [Inkfish] wd.dmg_lv=ATK_DEF; //This assumption simplifies the assignation later - nk = skill_get_nk(skill_num); - if( !skill_num && wflag ) //If flag, this is splash damage from Baphomet Card and it always hits. + nk = skill_get_nk(skill_id); + if( !skill_id && wflag ) //If flag, this is splash damage from Baphomet Card and it always hits. nk |= NK_NO_CARDFIX_ATK|NK_IGNORE_FLEE; flag.hit = nk&NK_IGNORE_FLEE?1:0; flag.idef = flag.idef2 = nk&NK_IGNORE_DEF?1:0; @@ -1716,18 +1716,18 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo tsd = BL_CAST(BL_PC, target); if(sd) - wd.blewcount += battle_blewcount_bonus(sd, skill_num); + wd.blewcount += battle_blewcount_bonus(sd, skill_id); //Set miscellaneous data that needs be filled regardless of hit/miss if( (sd && sd->state.arrow_atk) || - (!sd && ((skill_num && skill_get_ammotype(skill_num)) || sstatus->rhw.range>3)) + (!sd && ((skill_id && skill_get_ammotype(skill_id)) || sstatus->rhw.range>3)) ) flag.arrow = 1; - if(skill_num){ - wd.flag |= battle_range_type(src, target, skill_num, skill_lv); - switch(skill_num) + if(skill_id){ + wd.flag |= battle_range_type(src, target, skill_id, skill_lv); + switch(skill_id) { case MO_FINGEROFFENSIVE: if(sd) { @@ -1785,7 +1785,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } else //Range for normal attacks. wd.flag |= flag.arrow?BF_LONG:BF_SHORT; - if ( (!skill_num || skill_num == PA_SACRIFICE) && tstatus->flee2 && rnd()%1000 < tstatus->flee2 ) + if ( (!skill_id || skill_id == PA_SACRIFICE) && tstatus->flee2 && rnd()%1000 < tstatus->flee2 ) { //Check for Lucky Dodge wd.type=0x0b; wd.dmg_lv=ATK_LUCKY; @@ -1794,8 +1794,8 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } t_class = status_get_class(target); - s_ele = s_ele_ = skill_get_ele(skill_num, skill_lv); - if( !skill_num || s_ele == -1 ) + s_ele = s_ele_ = skill_get_ele(skill_id, skill_lv); + if( !skill_id || s_ele == -1 ) { //Take weapon's element s_ele = sstatus->rhw.ele; s_ele_ = sstatus->lhw.ele; @@ -1812,7 +1812,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo s_ele = s_ele_ = status_get_attack_sc_element(src,sc); else if( s_ele == -3 ) //Use random element s_ele = s_ele_ = rnd()%ELE_MAX; - switch( skill_num ) + switch( skill_id ) { case GS_GROUNDDRIFT: s_ele = s_ele_ = wflag; //element comes in flag. @@ -1825,12 +1825,12 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if (!(nk & NK_NO_ELEFIX) && !n_ele) if (src->type == BL_HOM) n_ele = true; //skill is "not elemental" - if (sc && sc->data[SC_GOLDENE_FERSE] && ((!skill_num && (rnd() % 100 < sc->data[SC_GOLDENE_FERSE]->val4)) || skill_num == MH_STAHL_HORN)) { + if (sc && sc->data[SC_GOLDENE_FERSE] && ((!skill_id && (rnd() % 100 < sc->data[SC_GOLDENE_FERSE]->val4)) || skill_id == MH_STAHL_HORN)) { s_ele = s_ele_ = ELE_HOLY; n_ele = false; } - if(!skill_num) + if(!skill_id) { //Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2) if (sd && sd->weapontype1 == 0 && sd->weapontype2 > 0) { @@ -1841,7 +1841,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo flag.lh=1; } - if( sd && !skill_num ) { //Check for double attack. + if( sd && !skill_id ) { //Check for double attack. if( ( ( skill_lv = pc_checkskill(sd,TF_DOUBLE) ) > 0 && sd->weapontype1 == W_DAGGER ) || ( sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST ) //Will fail bare-handed || ( sc && sc->data[SC_KAGEMUSYA] && sd->weapontype1 != W_FIST )) // Need confirmation @@ -1875,10 +1875,10 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo //Check for critical if( !flag.cri && !(wd.type&0x08) && sstatus->cri && - (!skill_num || - skill_num == KN_AUTOCOUNTER || - skill_num == SN_SHARPSHOOTING || skill_num == MA_SHARPSHOOTING || - skill_num == NJ_KIRIKAGE)) + (!skill_id || + skill_id == KN_AUTOCOUNTER || + skill_id == SN_SHARPSHOOTING || skill_id == MA_SHARPSHOOTING || + skill_id == NJ_KIRIKAGE)) { short cri = sstatus->cri; if (sd) @@ -1896,7 +1896,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( tsc && tsc->data[SC_SLEEP] ) { cri <<= 1; } - switch (skill_num) { + switch (skill_id) { case KN_AUTOCOUNTER: if(battle_config.auto_counter_type && (battle_config.auto_counter_type&src->type)) @@ -1929,7 +1929,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo flag.idef = flag.idef2 = 1; //def ignore [Komurka] } if( !flag.hit ) - switch(skill_num) + switch(skill_id) { case AS_SPLASHER: if( !wflag ) // Always hits the one exploding. @@ -1968,7 +1968,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo hitrate+= sstatus->hit - flee; - if(wd.flag&BF_LONG && !skill_num && //Fogwall's hit penalty is only for normal ranged attacks. + if(wd.flag&BF_LONG && !skill_id && //Fogwall's hit penalty is only for normal ranged attacks. tsc && tsc->data[SC_FOGWALL]) hitrate -= 50; @@ -1978,8 +1978,8 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( sd ) //in Renewal hit bonus from Vultures Eye is not anymore shown in status window hitrate += pc_checkskill(sd,AC_VULTURE); #endif - if(skill_num) - switch(skill_num) + if(skill_id) + switch(skill_id) { //Hit skill modifiers //It is proven that bonus is applied on final hitrate, not hit. case SM_BASH: @@ -2057,7 +2057,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo #define ATK_ADD( a ) { wd.damage+= a; if (flag.lh) wd.damage2+= a; } #define ATK_ADD2( a , b ) { wd.damage+= a; if (flag.lh) wd.damage2+= b; } - switch (skill_num) + switch (skill_id) { //Calc base damage according to skill case NJ_ISSEN: wd.damage = 40*sstatus->str +skill_lv*(sstatus->hp/10 + 35); @@ -2120,9 +2120,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo { i = (flag.cri?1:0)| (flag.arrow?2:0)| - (skill_num == HW_MAGICCRASHER?4:0)| - (!skill_num && sc && sc->data[SC_CHANGE]?4:0)| - (skill_num == MO_EXTREMITYFIST?8:0)| + (skill_id == HW_MAGICCRASHER?4:0)| + (!skill_id && sc && sc->data[SC_CHANGE]?4:0)| + (skill_id == MO_EXTREMITYFIST?8:0)| (sc && sc->data[SC_WEAPONPERFECTION]?8:0); if (flag.arrow && sd) switch(sd->status.weapon) { @@ -2143,7 +2143,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if(wflag>0) wd.damage/= wflag; else - ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num)); + ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id)); } //Add any bonuses that modify the base baseatk+watk (pre-skills) @@ -2161,10 +2161,10 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } break; } //End default case - } //End switch(skill_num) + } //End switch(skill_id) //Skill damage modifiers that stack linearly - if(sc && skill_num != PA_SACRIFICE) + if(sc && skill_id != PA_SACRIFICE) { if(sc->data[SC_OVERTHRUST]) skillratio += sc->data[SC_OVERTHRUST]->val3; @@ -2175,13 +2175,13 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if(sc->data[SC_ZENKAI] && sstatus->rhw.ele == sc->data[SC_ZENKAI]->val2 ) skillratio += sc->data[SC_ZENKAI]->val1 * 2; } - if( !skill_num ) + if( !skill_id ) { ATK_RATE(skillratio); } else { - switch( skill_num ) + switch( skill_id ) { case SM_BASH: case MS_BASH: @@ -2435,7 +2435,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo break; case TK_JUMPKICK: skillratio += -70 + 10*skill_lv; - if (sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == skill_num) + if (sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == skill_id) skillratio += 10*status_get_lv(src)/3; //Tumble bonus if (wflag) { @@ -2822,7 +2822,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo RE_LVL_DMOD(100); break; case WM_SEVERE_RAINSTORM_MELEE: - //ATK [{(Caster痴 DEX + AGI) x (Skill Level / 5)} x Caster痴 Base Level / 100] % + //ATK [{(Caster DEX + AGI) x (Skill Level / 5)} x Caster Base Level / 100] % skillratio = (sstatus->dex + sstatus->agi) * (skill_lv * 2); RE_LVL_DMOD(100); skillratio /= 10; @@ -2831,7 +2831,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo skillratio += 800 + 100 * skill_lv; if( sd ) { // Still need official value [pakpil] short lv = (short)skill_lv; - skillratio += 100 * skill_check_pc_partner(sd,skill_num,&lv,skill_get_splash(skill_num,skill_lv),0); + skillratio += 100 * skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),0); } break; case WM_SOUND_OF_DESTRUCTION: @@ -2873,7 +2873,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } else skillratio += 300; // Bombs break; - case SO_VARETYR_SPEAR://ATK [{( Striking Level x 50 ) + ( Varetyr Spear Skill Level x 50 )} x Caster痴 Base Level / 100 ] % + case SO_VARETYR_SPEAR://ATK [{( Striking Level x 50 ) + ( Varetyr Spear Skill Level x 50 )} x Caster Base Level / 100 ] % skillratio = 50 * skill_lv + ( sd ? pc_checkskill(sd, SO_STRIKING) * 50 : 0 ); if( sc && sc->data[SC_BLAST_OPTION] ) skillratio += sd ? sd->status.job_level * 5 : 0; @@ -2937,7 +2937,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo ATK_RATE(skillratio); //Constant/misc additions from skills - switch (skill_num) { + switch (skill_id) { case MO_EXTREMITYFIST: ATK_ADD(250 + 150*skill_lv); break; @@ -2975,7 +2975,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo case LG_RAYOFGENESIS: if( sc && sc->data[SC_BANDING] ) {// Increase only if the RG is under Banding. short lv = (short)skill_lv; - ATK_ADDRATE( 190 * ((sd) ? skill_check_pc_partner(sd,(short)skill_num,&lv,skill_get_splash(skill_num,skill_lv),0) : 1)); + ATK_ADDRATE( 190 * ((sd) ? skill_check_pc_partner(sd,(short)skill_id,&lv,skill_get_splash(skill_id,skill_lv),0) : 1)); } break; case SR_GATEOFHELL: @@ -3026,12 +3026,12 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( sc->data[SC_TRUESIGHT] ) ATK_ADDRATE(2*sc->data[SC_TRUESIGHT]->val1); if( sc->data[SC_GLOOMYDAY_SK] && - ( skill_num == LK_SPIRALPIERCE || skill_num == KN_BRANDISHSPEAR || - skill_num == CR_SHIELDBOOMERANG || skill_num == PA_SHIELDCHAIN || - skill_num == LG_SHIELDPRESS ) ) + ( skill_id == LK_SPIRALPIERCE || skill_id == KN_BRANDISHSPEAR || + skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN || + skill_id == LG_SHIELDPRESS ) ) ATK_ADDRATE(sc->data[SC_GLOOMYDAY_SK]->val2); if( sc->data[SC_EDP] ){ - switch(skill_num){ + switch(skill_id){ case AS_SPLASHER: case AS_VENOMKNIFE: case AS_GRIMTOOTH: break; @@ -3054,7 +3054,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } } - switch (skill_num) { + switch (skill_id) { case AS_SONICBLOW: if (sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_ASSASIN) @@ -3076,10 +3076,10 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( sd ) { - if (skill_num && (i = pc_skillatk_bonus(sd, skill_num))) + if (skill_id && (i = pc_skillatk_bonus(sd, skill_id))) ATK_ADDRATE(i); - if( skill_num != PA_SACRIFICE && skill_num != MO_INVESTIGATE && skill_num != CR_GRANDCROSS && skill_num != NPC_GRANDDARKNESS && skill_num != PA_SHIELDCHAIN && !flag.cri ) + if( skill_id != PA_SACRIFICE && skill_id != MO_INVESTIGATE && skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS && skill_id != PA_SHIELDCHAIN && !flag.cri ) { //Elemental/Racial adjustments if( sd->right_weapon.def_ratio_atk_ele & (1<<tstatus->def_ele) || sd->right_weapon.def_ratio_atk_race & (1<<tstatus->race) || @@ -3099,7 +3099,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } } - if (skill_num != CR_GRANDCROSS && skill_num != NPC_GRANDDARKNESS) + if (skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS) { //Ignore Defense? if (!flag.idef && ( sd->right_weapon.ignore_def_ele & (1<<tstatus->def_ele) || @@ -3168,12 +3168,12 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo def2 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; } } - if(skill_num == AM_ACIDTERROR) def1 = 0; //Acid Terror ignores only armor defense. [Skotlex] + if(skill_id == AM_ACIDTERROR) def1 = 0; //Acid Terror ignores only armor defense. [Skotlex] if(def2 < 1) def2 = 1; } //Vitality reduction from rodatazone: http://rodatazone.simgaming.net/mechanics/substats.php#def if (tsd) //Sd vit-eq - { + { #ifndef RENEWAL //[VIT*0.5] + rnd([VIT*0.3], max([VIT*0.3],[VIT^2/150]-1)) vit_def = def2*(def2-15)/150; @@ -3187,7 +3187,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( src->type == BL_MOB && (skill=pc_checkskill(tsd,RA_RANGERMAIN))>0 && (sstatus->race == RC_BRUTE || sstatus->race == RC_FISH || sstatus->race == RC_PLANT) ) vit_def += skill*5; - } + } else { //Mob-Pet vit-eq #ifndef RENEWAL //VIT + rnd(0,[VIT/20]^2-1) @@ -3218,7 +3218,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo wd.damage = wd.damage * (4000+def1) / (4000+10*def1) - vit_def; if( flag.lh && !flag.idef2 ) wd.damage2 = wd.damage2 * (4000+def1) / (4000+10*def1) - vit_def; - + #else if (def1 > 100) def1 = 100; @@ -3238,12 +3238,12 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo { //SC skill damages if(sc->data[SC_AURABLADE] #ifndef RENEWAL - && skill_num != LK_SPIRALPIERCE && skill_num != ML_SPIRALPIERCE + && skill_id != LK_SPIRALPIERCE && skill_id != ML_SPIRALPIERCE #endif ){ int lv = sc->data[SC_AURABLADE]->val1; #ifdef RENEWAL - lv *= ((skill_num == LK_SPIRALPIERCE || skill_num == ML_SPIRALPIERCE)?wd.div_:1); // +100 per hit in lv 5 + lv *= ((skill_id == LK_SPIRALPIERCE || skill_id == ML_SPIRALPIERCE)?wd.div_:1); // +100 per hit in lv 5 #endif ATK_ADD(20*lv); } @@ -3262,9 +3262,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } //Refine bonus - if( sd && flag.weapon && skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST ) + if( sd && flag.weapon && skill_id != MO_INVESTIGATE && skill_id != MO_EXTREMITYFIST ) { // Counts refine bonus multiple times - if( skill_num == MO_FINGEROFFENSIVE ) + if( skill_id == MO_FINGEROFFENSIVE ) { ATK_ADD2(wd.div_*sstatus->rhw.atk2, wd.div_*sstatus->lhw.atk2); } else { @@ -3277,11 +3277,11 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if (flag.lh && wd.damage2 < 1) wd.damage2 = 1; if (sd && flag.weapon && - skill_num != MO_INVESTIGATE && - skill_num != MO_EXTREMITYFIST && - skill_num != CR_GRANDCROSS) + skill_id != MO_INVESTIGATE && + skill_id != MO_EXTREMITYFIST && + skill_id != CR_GRANDCROSS) { //Add mastery damage - if(skill_num != ASC_BREAKER && sd->status.weapon == W_KATAR && + if(skill_id != ASC_BREAKER && sd->status.weapon == W_KATAR && (skill=pc_checkskill(sd,ASC_KATAR)) > 0) { //Adv Katar Mastery is does not applies to ASC_BREAKER, // but other masteries DO apply >_> @@ -3303,9 +3303,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo skillratio /= 12-3*skill; ATK_ADDRATE(skillratio); } - if (skill_num == NJ_SYURIKEN && (skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) + if (skill_id == NJ_SYURIKEN && (skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) ATK_ADD(3*skill); - if (skill_num == NJ_KUNAI) + if (skill_id == NJ_KUNAI) ATK_ADD(60); } } //Here ends flag.hit section, the rest of the function applies to both hitting and missing attacks @@ -3315,7 +3315,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if(sd && (skill=pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0) ATK_ADD(skill*2); - if(skill_num==TF_POISON) + if(skill_id==TF_POISON) ATK_ADD(15*skill_lv); if( !(nk&NK_NO_ELEFIX) && !n_ele ) @@ -3323,9 +3323,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( wd.damage > 0 ) { wd.damage=battle_attr_fix(src,target,wd.damage,s_ele,tstatus->def_ele, tstatus->ele_lv); - if( skill_num == MC_CARTREVOLUTION ) //Cart Revolution applies the element fix once more with neutral element + if( skill_id == MC_CARTREVOLUTION ) //Cart Revolution applies the element fix once more with neutral element wd.damage = battle_attr_fix(src,target,wd.damage,ELE_NEUTRAL,tstatus->def_ele, tstatus->ele_lv); - if( skill_num== GS_GROUNDDRIFT ) //Additional 50*lv Neutral damage. + if( skill_id== GS_GROUNDDRIFT ) //Additional 50*lv Neutral damage. wd.damage += battle_attr_fix(src,target,50*skill_lv,ELE_NEUTRAL,tstatus->def_ele, tstatus->ele_lv); } if( flag.lh && wd.damage2 > 0 ) @@ -3346,19 +3346,19 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo * In RE Shield Bommerang takes weapon element only for damage calculation, * - resist calculation is always against neutral **/ - if ( skill_num == CR_SHIELDBOOMERANG ) + if ( skill_id == CR_SHIELDBOOMERANG ) s_ele = s_ele_ = ELE_NEUTRAL; #endif } - if(skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS) + if(skill_id == CR_GRANDCROSS || skill_id == NPC_GRANDDARKNESS) return wd; //Enough, rest is not needed. if (sd) { - if (skill_num != CR_SHIELDBOOMERANG) //Only Shield boomerang doesn't takes the Star Crumbs bonus. + if (skill_id != CR_SHIELDBOOMERANG) //Only Shield boomerang doesn't takes the Star Crumbs bonus. ATK_ADD2(wd.div_*sd->right_weapon.star, wd.div_*sd->left_weapon.star); - if (skill_num==MO_FINGEROFFENSIVE) { //The finger offensive spheres on moment of attack do count. [Skotlex] + if (skill_id==MO_FINGEROFFENSIVE) { //The finger offensive spheres on moment of attack do count. [Skotlex] ATK_ADD(wd.div_*sd->spiritball_old*3); } else { ATK_ADD(wd.div_*sd->spiritball*3); @@ -3369,7 +3369,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( flag.lh ) wd.damage2 = battle_calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag); - if( skill_num == CR_SHIELDBOOMERANG || skill_num == PA_SHIELDCHAIN ) + if( skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN ) { //Refine bonus applies after cards and elements. short index= sd->equip_index[EQI_HAND_L]; if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR ) @@ -3391,11 +3391,11 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( flag.hit && class_ == MOBID_EMPERIUM ) { if(wd.damage2 > 0) { wd.damage2 = battle_attr_fix(src,target,wd.damage2,s_ele_,tstatus->def_ele, tstatus->ele_lv); - wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_id,skill_lv,wd.flag); } else if(wd.damage > 0) { wd.damage = battle_attr_fix(src,target,wd.damage,s_ele_,tstatus->def_ele, tstatus->ele_lv); - wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag); } return wd; } @@ -3425,7 +3425,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo ATK_RATEL(50 + (skill * 10)) if(wd.damage2 < 1) wd.damage2 = 1; } - } else if(sd->status.weapon == W_KATAR && !skill_num) { //Katars (offhand damage only applies to normal attacks, tested on Aegis 10.2) + } else if(sd->status.weapon == W_KATAR && !skill_id) { //Katars (offhand damage only applies to normal attacks, tested on Aegis 10.2) skill = pc_checkskill(sd,TF_DOUBLE); wd.damage2 = (int64)wd.damage * (1 + (skill * 2))/100; @@ -3444,28 +3444,28 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo { //There is a total damage value if(!wd.damage2) { - wd.damage = battle_calc_damage(src,target,&wd,wd.damage,skill_num,skill_lv); + wd.damage = battle_calc_damage(src,target,&wd,wd.damage,skill_id,skill_lv); if( map_flag_gvg2(target->m) ) - wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag); else if( map[target->m].flag.battleground ) - wd.damage=battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage=battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag); } else if(!wd.damage) { - wd.damage2 = battle_calc_damage(src,target,&wd,wd.damage2,skill_num,skill_lv); + wd.damage2 = battle_calc_damage(src,target,&wd,wd.damage2,skill_id,skill_lv); if( map_flag_gvg2(target->m) ) - wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_id,skill_lv,wd.flag); else if( map[target->m].flag.battleground ) - wd.damage = battle_calc_bg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage = battle_calc_bg_damage(src,target,wd.damage2,wd.div_,skill_id,skill_lv,wd.flag); } else { int d1 = wd.damage + wd.damage2,d2 = wd.damage2; - wd.damage = battle_calc_damage(src,target,&wd,d1,skill_num,skill_lv); + wd.damage = battle_calc_damage(src,target,&wd,d1,skill_id,skill_lv); if( map_flag_gvg2(target->m) ) - wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag); else if( map[target->m].flag.battleground ) - wd.damage = battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage = battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag); wd.damage2 = (int64)d2*100/d1 * wd.damage/100; if(wd.damage > 1 && wd.damage2 < 1) wd.damage2 = 1; wd.damage-=wd.damage2; @@ -3486,8 +3486,8 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( --(tsc->data[SC_REJECTSWORD]->val3) <= 0 ) status_change_end(target, SC_REJECTSWORD, INVALID_TIMER); } - if(skill_num == ASC_BREAKER) { //Breaker's int-based damage (a misc attack?) - struct Damage md = battle_calc_misc_attack(src, target, skill_num, skill_lv, wflag); + if(skill_id == ASC_BREAKER) { //Breaker's int-based damage (a misc attack?) + struct Damage md = battle_calc_misc_attack(src, target, skill_id, skill_lv, wflag); wd.damage += md.damage; } if( sc ) { @@ -3505,7 +3505,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo /** * affecting non-skills **/ - if( !skill_num ) { + if( !skill_id ) { /** * RK Enchant Blade **/ @@ -3516,8 +3516,8 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER); } - if( skill_num == LG_RAYOFGENESIS ) { - struct Damage md = battle_calc_magic_attack(src, target, skill_num, skill_lv, wflag); + if( skill_id == LG_RAYOFGENESIS ) { + struct Damage md = battle_calc_magic_attack(src, target, skill_id, skill_lv, wflag); wd.damage += md.damage; } @@ -3527,7 +3527,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo /*========================================== * battle_calc_magic_attack [DracoRPG] *------------------------------------------*/ -struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag) +struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag) { int i, nk; short s_ele = 0; @@ -3554,13 +3554,13 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list } //Initial Values ad.damage = 1; - ad.div_=skill_get_num(skill_num,skill_lv); - ad.amotion=skill_get_inf(skill_num)&INF_GROUND_SKILL?0:sstatus->amotion; //Amotion should be 0 for ground skills. + ad.div_=skill_get_num(skill_id,skill_lv); + ad.amotion=skill_get_inf(skill_id)&INF_GROUND_SKILL?0:sstatus->amotion; //Amotion should be 0 for ground skills. ad.dmotion=tstatus->dmotion; - ad.blewcount = skill_get_blewcount(skill_num,skill_lv); + ad.blewcount = skill_get_blewcount(skill_id,skill_lv); ad.flag=BF_MAGIC|BF_SKILL; ad.dmg_lv=ATK_DEF; - nk = skill_get_nk(skill_num); + nk = skill_get_nk(skill_id); flag.imdef = nk&NK_IGNORE_DEF?1:0; sd = BL_CAST(BL_PC, src); @@ -3569,7 +3569,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list tsc = status_get_sc(target); //Initialize variables that will be used afterwards - s_ele = skill_get_ele(skill_num, skill_lv); + s_ele = skill_get_ele(skill_id, skill_lv); if (s_ele == -1){ // pl=-1 : the skill takes the weapon's element s_ele = sstatus->rhw.ele; @@ -3582,7 +3582,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list else if( s_ele == -3 ) //Use random element s_ele = rnd()%ELE_MAX; - if( skill_num == SO_PSYCHIC_WAVE ) { + if( skill_id == SO_PSYCHIC_WAVE ) { if( sc && sc->count ) { if( sc->data[SC_HEATER_OPTION] ) s_ele = sc->data[SC_HEATER_OPTION]->val4; else if( sc->data[SC_COOLER_OPTION] ) s_ele = sc->data[SC_COOLER_OPTION]->val4; @@ -3590,15 +3590,15 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list else if( sc->data[SC_CURSED_SOIL_OPTION] ) s_ele = sc->data[SC_CURSED_SOIL_OPTION]->val4; } } - + //Set miscellaneous data that needs be filled if(sd) { sd->state.arrow_atk = 0; - ad.blewcount += battle_blewcount_bonus(sd, skill_num); + ad.blewcount += battle_blewcount_bonus(sd, skill_id); } //Skill Range Criteria - ad.flag |= battle_range_type(src, target, skill_num, skill_lv); + ad.flag |= battle_range_type(src, target, skill_id, skill_lv); flag.infdef=(tstatus->mode&MD_PLANT?1:0); if( target->type == BL_SKILL){ TBL_SKILL *su = (TBL_SKILL*)target; @@ -3606,7 +3606,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list flag.infdef = 1; } - switch(skill_num) + switch(skill_id) { case MG_FIREWALL: case NJ_KAENSIN: @@ -3631,7 +3631,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list //Adds an absolute value to damage. 100 = +100 damage #define MATK_ADD( a ) { ad.damage+= a; } - switch (skill_num) + switch (skill_id) { //Calc base damage according to skill case AL_HEAL: case PR_BENEDICTIO: @@ -3640,7 +3640,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list * Arch Bishop **/ case AB_HIGHNESSHEAL: - ad.damage = skill_calc_heal(src, target, skill_num, skill_lv, false); + ad.damage = skill_calc_heal(src, target, skill_id, skill_lv, false); break; case PR_ASPERSIO: ad.damage = 40; @@ -3692,10 +3692,10 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list if(mflag>0) ad.damage/= mflag; else - ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num)); + ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id)); } - switch(skill_num){ + switch(skill_id){ case MG_NAPALMBEAT: skillratio += skill_lv*10-30; break; @@ -3922,7 +3922,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list /*case WM_SEVERE_RAINSTORM: skillratio += 50 * skill_lv; break; - + WM_SEVERE_RAINSTORM just set a unit place, refer to WM_SEVERE_RAINSTORM_MELEE to set the formula. */ @@ -3974,7 +3974,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list skillratio += sc->data[SC_CURSED_SOIL_OPTION]->val3; } break; - case SO_VARETYR_SPEAR: //MATK [{( Endow Tornado skill level x 50 ) + ( Caster痴 INT x Varetyr Spear Skill level )} x Caster痴 Base Level / 100 ] % + case SO_VARETYR_SPEAR: //MATK [{( Endow Tornado skill level x 50 ) + ( Caster INT x Varetyr Spear Skill level )} x Caster Base Level / 100 ] % skillratio = status_get_int(src) * skill_lv + ( sd ? pc_checkskill(sd, SA_LIGHTNINGLOADER) * 50 : 0 ); RE_LVL_DMOD(100); if( sc && sc->data[SC_BLAST_OPTION] ) @@ -4036,7 +4036,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list MATK_RATE(skillratio); //Constant/misc additions from skills - if (skill_num == WZ_FIREPILLAR) + if (skill_id == WZ_FIREPILLAR) MATK_ADD(50); } } @@ -4045,7 +4045,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list #endif if(sd) { //Damage bonuses - if ((i = pc_skillatk_bonus(sd, skill_num))) + if ((i = pc_skillatk_bonus(sd, skill_id))) ad.damage += (int64)ad.damage*i/100; //Ignore Defense? @@ -4084,20 +4084,20 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list #endif } - if (skill_num == NPC_EARTHQUAKE) + if (skill_id == NPC_EARTHQUAKE) { //Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex] //Also divide the extra bonuses from atk2 based on the number in range [Kevin] if(mflag>0) ad.damage+= (sstatus->rhw.atk2*skillratio/100)/mflag; else - ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num)); + ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id)); } if(ad.damage<1) ad.damage=1; else if(sc){//only applies when hit // TODO: there is another factor that contribute with the damage and need to be formulated. [malufett] - switch(skill_num){ + switch(skill_id){ case MG_LIGHTNINGBOLT: case MG_THUNDERSTORM: case MG_FIREBOLT: @@ -4106,7 +4106,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list case MG_FROSTDIVER: case WZ_EARTHSPIKE: case WZ_HEAVENDRIVE: - if(sc->data[SC_GUST_OPTION] || sc->data[SC_PETROLOGY_OPTION] + if(sc->data[SC_GUST_OPTION] || sc->data[SC_PETROLOGY_OPTION] || sc->data[SC_PYROTECHNIC_OPTION] || sc->data[SC_AQUAPLAY_OPTION]) ad.damage += (6 + sstatus->int_/4) + max(sstatus->dex-10,0)/30; break; @@ -4116,9 +4116,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list if (!(nk&NK_NO_ELEFIX)) ad.damage=battle_attr_fix(src, target, ad.damage, s_ele, tstatus->def_ele, tstatus->ele_lv); - if( skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS ) + if( skill_id == CR_GRANDCROSS || skill_id == NPC_GRANDDARKNESS ) { //Apply the physical part of the skill's damage. [Skotlex] - struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag); + struct Damage wd = battle_calc_weapon_attack(src,target,skill_id,skill_lv,mflag); ad.damage = battle_attr_fix(src, target, wd.damage + ad.damage, s_ele, tstatus->def_ele, tstatus->ele_lv) * (100 + 40*skill_lv)/100; if( src == target ) { @@ -4139,15 +4139,15 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list if (flag.infdef && ad.damage) ad.damage = ad.damage>0?1:-1; - ad.damage=battle_calc_damage(src,target,&ad,ad.damage,skill_num,skill_lv); + ad.damage=battle_calc_damage(src,target,&ad,ad.damage,skill_id,skill_lv); if( map_flag_gvg2(target->m) ) - ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); + ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_id,skill_lv,ad.flag); else if( map[target->m].flag.battleground ) - ad.damage=battle_calc_bg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); + ad.damage=battle_calc_bg_damage(src,target,ad.damage,ad.div_,skill_id,skill_lv,ad.flag); - switch( skill_num ) { /* post-calc modifiers */ + switch( skill_id ) { /* post-calc modifiers */ case SO_VARETYR_SPEAR: { // Physical damage. - struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag); + struct Damage wd = battle_calc_weapon_attack(src,target,skill_id,skill_lv,mflag); if(!flag.infdef && ad.damage > 1) ad.damage += wd.damage; break; @@ -4159,9 +4159,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list } /*========================================== - * Calculate Misc dammage for skillid + * Calculate Misc dammage for skill_id *------------------------------------------*/ -struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag) +struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag) { int skill; short i, nk; @@ -4180,33 +4180,33 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * } //Some initial values - md.amotion=skill_get_inf(skill_num)&INF_GROUND_SKILL?0:sstatus->amotion; + md.amotion=skill_get_inf(skill_id)&INF_GROUND_SKILL?0:sstatus->amotion; md.dmotion=tstatus->dmotion; - md.div_=skill_get_num( skill_num,skill_lv ); - md.blewcount=skill_get_blewcount(skill_num,skill_lv); + md.div_=skill_get_num( skill_id,skill_lv ); + md.blewcount=skill_get_blewcount(skill_id,skill_lv); md.dmg_lv=ATK_DEF; md.flag=BF_MISC|BF_SKILL; - nk = skill_get_nk(skill_num); + nk = skill_get_nk(skill_id); sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); if(sd) { sd->state.arrow_atk = 0; - md.blewcount += battle_blewcount_bonus(sd, skill_num); + md.blewcount += battle_blewcount_bonus(sd, skill_id); } - s_ele = skill_get_ele(skill_num, skill_lv); + s_ele = skill_get_ele(skill_id, skill_lv); if (s_ele < 0 && s_ele != -3) //Attack that takes weapon's element for misc attacks? Make it neutral [Skotlex] s_ele = ELE_NEUTRAL; else if (s_ele == -3) //Use random element s_ele = rnd()%ELE_MAX; //Skill Range Criteria - md.flag |= battle_range_type(src, target, skill_num, skill_lv); + md.flag |= battle_range_type(src, target, skill_id, skill_lv); - switch( skill_num ) + switch( skill_id ) { #ifdef RENEWAL case HT_LANDMINE: @@ -4238,7 +4238,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * if(mflag > 1) //Autocasted Blitz. nk|=NK_SPLASHSPLIT; - if (skill_num == SN_FALCONASSAULT) + if (skill_id == SN_FALCONASSAULT) { //Div fix of Blitzbeat skill = skill_get_num(HT_BLITZBEAT, 5); @@ -4285,11 +4285,11 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * break; case NJ_ZENYNAGE: case KO_MUCHANAGE: - md.damage = skill_get_zeny(skill_num ,skill_lv); + md.damage = skill_get_zeny(skill_id ,skill_lv); if (!md.damage) md.damage = 2; - md.damage = rand()%md.damage + md.damage / (skill_num==NJ_ZENYNAGE?1:2) ; + md.damage = rand()%md.damage + md.damage / (skill_id==NJ_ZENYNAGE?1:2) ; if (is_boss(target)) - md.damage=md.damage / (skill_num==NJ_ZENYNAGE?3:2); + md.damage=md.damage / (skill_id==NJ_ZENYNAGE?3:2); else if (tsd) // need confirmation for KO_MUCHANAGE md.damage=md.damage/2; break; @@ -4308,7 +4308,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.dmotion = 0; //No flinch animation. break; case NPC_EVILLAND: - md.damage = skill_calc_heal(src,target,skill_num,skill_lv,false); + md.damage = skill_calc_heal(src,target,skill_id,skill_lv,false); break; case RK_DRAGONBREATH: md.damage = ((status_get_hp(src) / 50) + (status_get_max_sp(src) / 4)) * skill_lv; @@ -4326,13 +4326,13 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * RE_LVL_TMDMOD(); if(sd) { - int researchSkillLv = pc_checkskill(sd,RA_RESEARCHTRAP); - if(researchSkillLv) - md.damage = (int64)md.damage * 20 * researchSkillLv / (skill_num == RA_CLUSTERBOMB?50:100); + int researchskill_lv = pc_checkskill(sd,RA_RESEARCHTRAP); + if(researchskill_lv) + md.damage = (int64)md.damage * 20 * researchskill_lv / (skill_id == RA_CLUSTERBOMB?50:100); else md.damage = 0; }else - md.damage = (int64)md.damage * 200 / (skill_num == RA_CLUSTERBOMB?50:100); + md.damage = (int64)md.damage * 200 / (skill_id == RA_CLUSTERBOMB?50:100); break; /** @@ -4355,7 +4355,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * break; case KO_HAPPOKUNAI: { - struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag); + struct Damage wd = battle_calc_weapon_attack(src,target,skill_id,skill_lv,mflag); short totaldef = tstatus->def2 + (short)status_get_def(target); md.damage = (int64)wd.damage * 60 * (5 + skill_lv) / 100; md.damage -= totaldef; @@ -4370,7 +4370,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * if(mflag>0) md.damage/= mflag; else - ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num)); + ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id)); } damage_div_fix(md.damage, md.div_); @@ -4421,13 +4421,13 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.damage = battle_calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag); - if (sd && (i = pc_skillatk_bonus(sd, skill_num))) + if (sd && (i = pc_skillatk_bonus(sd, skill_id))) md.damage += (int64)md.damage*i/100; if(md.damage < 0) md.damage = 0; else if(md.damage && tstatus->mode&MD_PLANT){ - switch(skill_num){ + switch(skill_id){ case HT_LANDMINE: case MA_LANDMINE: case HT_BLASTMINE: @@ -4448,20 +4448,20 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * if(!(nk&NK_NO_ELEFIX)) md.damage=battle_attr_fix(src, target, md.damage, s_ele, tstatus->def_ele, tstatus->ele_lv); - md.damage=battle_calc_damage(src,target,&md,md.damage,skill_num,skill_lv); + md.damage=battle_calc_damage(src,target,&md,md.damage,skill_id,skill_lv); if( map_flag_gvg2(target->m) ) - md.damage=battle_calc_gvg_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag); + md.damage=battle_calc_gvg_damage(src,target,md.damage,md.div_,skill_id,skill_lv,md.flag); else if( map[target->m].flag.battleground ) - md.damage=battle_calc_bg_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag); + md.damage=battle_calc_bg_damage(src,target,md.damage,md.div_,skill_id,skill_lv,md.flag); - switch( skill_num ) { + switch( skill_id ) { case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: if( md.damage == 1 ) break; case RA_CLUSTERBOMB: { struct Damage wd; - wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag); + wd = battle_calc_weapon_attack(src,target,skill_id,skill_lv,mflag); md.damage += wd.damage; } break; @@ -4479,13 +4479,13 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * /*========================================== * Battle main entry, from skill_attack *------------------------------------------*/ -struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int count) +struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int count) { struct Damage d; switch(attack_type) { - case BF_WEAPON: d = battle_calc_weapon_attack(bl,target,skill_num,skill_lv,count); break; - case BF_MAGIC: d = battle_calc_magic_attack(bl,target,skill_num,skill_lv,count); break; - case BF_MISC: d = battle_calc_misc_attack(bl,target,skill_num,skill_lv,count); break; + case BF_WEAPON: d = battle_calc_weapon_attack(bl,target,skill_id,skill_lv,count); break; + case BF_MAGIC: d = battle_calc_magic_attack(bl,target,skill_id,skill_lv,count); break; + case BF_MISC: d = battle_calc_misc_attack(bl,target,skill_id,skill_lv,count); break; default: ShowError("battle_calc_attack: unknown attack type! %d\n",attack_type); memset(&d,0,sizeof(d)); @@ -4504,7 +4504,7 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl } //Calculates BF_WEAPON returned damage. -int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int *dmg, int flag, int skillid){ +int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int *dmg, int flag, uint16 skill_id){ struct map_session_data* sd = NULL; int rdamage = 0, damage = *dmg; struct status_change* sc; @@ -4534,12 +4534,12 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int if(rdamage < 1) rdamage = 1; } if( sc && sc->count ) { - if ( sc->data[SC_REFLECTSHIELD] && skillid != WS_CARTTERMINATION ) { + if ( sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION ) { rdamage += (int64)damage * sc->data[SC_REFLECTSHIELD]->val2 / 100; if (rdamage < 1) rdamage = 1; } - if(sc->data[SC_DEATHBOUND] && skillid != WS_CARTTERMINATION && !(src->type == BL_MOB && is_boss(src)) ) { - int dir = map_calc_dir(bl,src->x,src->y), + if(sc->data[SC_DEATHBOUND] && skill_id != WS_CARTTERMINATION && !(src->type == BL_MOB && is_boss(src)) ) { + uint8 dir = map_calc_dir(bl,src->x,src->y), t_dir = unit_getdir(bl), rd1 = 0; if( distance_bl(src,bl) <= 0 || !map_check_dir(dir,t_dir) ) { @@ -4721,30 +4721,30 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t } if( tsc && tsc->data[SC_AUTOCOUNTER] && status_check_skilluse(target, src, KN_AUTOCOUNTER, 1) ) { - int dir = map_calc_dir(target,src->x,src->y); + uint8 dir = map_calc_dir(target,src->x,src->y); int t_dir = unit_getdir(target); int dist = distance_bl(src, target); if(dist <= 0 || (!map_check_dir(dir,t_dir) && dist <= tstatus->rhw.range+1)) { - int skilllv = tsc->data[SC_AUTOCOUNTER]->val1; + uint16 skill_lv = tsc->data[SC_AUTOCOUNTER]->val1; clif_skillcastcancel(target); //Remove the casting bar. [Skotlex] clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS. status_change_end(target, SC_AUTOCOUNTER, INVALID_TIMER); - skill_attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skilllv,tick,0); + skill_attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skill_lv,tick,0); return ATK_BLOCK; } } if( tsc && tsc->data[SC_BLADESTOP_WAIT] && !is_boss(src) && (src->type == BL_PC || tsd == NULL || distance_bl(src, target) <= (tsd->status.weapon == W_FIST ? 1 : 2)) ) { - int skilllv = tsc->data[SC_BLADESTOP_WAIT]->val1; - int duration = skill_get_time2(MO_BLADESTOP,skilllv); + uint16 skill_lv = tsc->data[SC_BLADESTOP_WAIT]->val1; + int duration = skill_get_time2(MO_BLADESTOP,skill_lv); status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER); if(sc_start4(src, SC_BLADESTOP, 100, sd?pc_checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration)) { //Target locked. clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS. clif_bladestop(target, src->id, 1); - sc_start4(target, SC_BLADESTOP, 100, skilllv, 0, 0, src->id, duration); + sc_start4(target, SC_BLADESTOP, 100, skill_lv, 0, 0, src->id, duration); return ATK_BLOCK; } } @@ -4764,7 +4764,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t if (sc) { if (sc->data[SC_SACRIFICE]) { - int skilllv = sc->data[SC_SACRIFICE]->val1; + uint16 skill_lv = sc->data[SC_SACRIFICE]->val1; damage_lv ret_val; if( --sc->data[SC_SACRIFICE]->val2 <= 0 ) @@ -4774,7 +4774,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t * We need to calculate the DMG before the hp reduction, because it can kill the source. * For futher information: bugreport:4950 **/ - ret_val = (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skilllv,tick,0); + ret_val = (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skill_lv,tick,0); status_zap(src, sstatus->max_hp*9/100, 0);//Damage to self is always 9% if( ret_val == ATK_NONE ) @@ -4799,9 +4799,9 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t tsc->data[SC_GT_ENERGYGAIN]->val1); } if( sc && sc->data[SC_CRUSHSTRIKE] ){ - int skilllv = sc->data[SC_CRUSHSTRIKE]->val1; + uint16 skill_lv = sc->data[SC_CRUSHSTRIKE]->val1; status_change_end(src, SC_CRUSHSTRIKE, INVALID_TIMER); - if( skill_attack(BF_WEAPON,src,src,target,RK_CRUSHSTRIKE,skilllv,tick,0) ) + if( skill_attack(BF_WEAPON,src,src,target,RK_CRUSHSTRIKE,skill_lv,tick,0) ) return ATK_DEF; return ATK_MISS; } @@ -4840,12 +4840,12 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t { if( sc && sc->data[SC_DUPLELIGHT] && (wd.flag&BF_SHORT) && rnd()%100 <= 10+2*sc->data[SC_DUPLELIGHT]->val1 ) { // Activates it only from melee damage - int skillid; + uint16 skill_id; if( rnd()%2 == 1 ) - skillid = AB_DUPLELIGHT_MELEE; + skill_id = AB_DUPLELIGHT_MELEE; else - skillid = AB_DUPLELIGHT_MAGIC; - skill_attack(skill_get_type(skillid), src, src, target, skillid, sc->data[SC_DUPLELIGHT]->val1, tick, SD_LEVEL); + skill_id = AB_DUPLELIGHT_MAGIC; + skill_attack(skill_get_type(skill_id), src, src, target, skill_id, sc->data[SC_DUPLELIGHT]->val1, tick, SD_LEVEL); } rdamage = battle_calc_return_damage(target,src, &damage, wd.flag, 0); @@ -4908,26 +4908,26 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t } if (sc && sc->data[SC_AUTOSPELL] && rnd()%100 < sc->data[SC_AUTOSPELL]->val4) { int sp = 0; - int skillid = sc->data[SC_AUTOSPELL]->val2; - int skilllv = sc->data[SC_AUTOSPELL]->val3; + uint16 skill_id = sc->data[SC_AUTOSPELL]->val2; + uint16 skill_lv = sc->data[SC_AUTOSPELL]->val3; int i = rnd()%100; if (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_SAGE) - i = 0; //Max chance, no skilllv reduction. [Skotlex] - if (i >= 50) skilllv -= 2; - else if (i >= 15) skilllv--; - if (skilllv < 1) skilllv = 1; - sp = skill_get_sp(skillid,skilllv) * 2 / 3; + i = 0; //Max chance, no skill_lv reduction. [Skotlex] + if (i >= 50) skill_lv -= 2; + else if (i >= 15) skill_lv--; + if (skill_lv < 1) skill_lv = 1; + sp = skill_get_sp(skill_id,skill_lv) * 2 / 3; if (status_charge(src, 0, sp)) { - switch (skill_get_casttype(skillid)) { + switch (skill_get_casttype(skill_id)) { case CAST_GROUND: - skill_castend_pos2(src, target->x, target->y, skillid, skilllv, tick, flag); + skill_castend_pos2(src, target->x, target->y, skill_id, skill_lv, tick, flag); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(src, target, skillid, skilllv, tick, flag); + skill_castend_nodamage_id(src, target, skill_id, skill_lv, tick, flag); break; case CAST_DAMAGE: - skill_castend_damage_id(src, target, skillid, skilllv, tick, flag); + skill_castend_damage_id(src, target, skill_id, skill_lv, tick, flag); break; } } @@ -5091,7 +5091,8 @@ struct block_list* battle_get_master(struct block_list *src) *------------------------------------------*/ int battle_check_target( struct block_list *src, struct block_list *target,int flag) { - int m,state = 0; //Initial state none + int16 m; //map + int state = 0; //Initial state none int strip_enemy = 1; //Flag which marks whether to remove the BCT_ENEMY status if it's also friend/ally. struct block_list *s_bl = src, *t_bl = target; diff --git a/src/map/battle.h b/src/map/battle.h index 800aab2b2..12ce62c8b 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -33,9 +33,9 @@ struct block_list; // Damage Calculation -struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int count); +struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int count); -int battle_calc_return_damage(struct block_list *bl, struct block_list *src, int *, int flag, int skillid); +int battle_calc_return_damage(struct block_list *bl, struct block_list *src, int *, int flag, uint16 skill_id); void battle_drain(struct map_session_data *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss); @@ -44,9 +44,9 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int damage, int left, int flag); // Final calculation Damage -int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,int skill_num,int skill_lv); -int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag); -int battle_calc_bg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag); +int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,uint16 skill_id,uint16 skill_lv); +int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,uint16 skill_id,uint16 skill_lv,int flag); +int battle_calc_bg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,uint16 skill_id,uint16 skill_lv,int flag); enum { // Flag of the final calculation BF_WEAPON = 0x0001, @@ -61,7 +61,7 @@ enum { // Flag of the final calculation BF_SKILLMASK= 0x0f00, }; -int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, enum damage_lv dmg_lv, int ddelay); +int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int damage, enum damage_lv dmg_lv, int ddelay); // Summary normal attack treatment (basic attack) enum damage_lv battle_weapon_attack( struct block_list *bl,struct block_list *target,unsigned int tick,int flag); @@ -312,8 +312,8 @@ extern struct Battle_Config int pk_level_range; int manner_system; // end additions [Valaris] - int show_mob_info; - + int show_mob_info; + int gx_allhit; int gx_disptype; int devotion_level_difference; @@ -336,7 +336,7 @@ extern struct Battle_Config int night_duration; // added by [Yor] int ban_hack_trade; // added by [Yor] int packet_ver_flag; // added by [Yor] - + int min_hair_style; // added by [MouseJstr] int max_hair_style; // added by [MouseJstr] int min_hair_color; // added by [MouseJstr] @@ -349,7 +349,7 @@ extern struct Battle_Config int area_size; // added by [MouseJstr] int max_def, over_def_bonus; //added by [Skotlex] - + int zeny_from_mobs; // [Valaris] int mobs_level_up; // [Valaris] int mobs_level_up_exp_rate; // [Valaris] @@ -404,7 +404,7 @@ extern struct Battle_Config int duel_autoleave_when_die; // [LuzZza] int duel_time_interval; // [LuzZza] int duel_only_on_same_map; // [Toms] - + int skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza] int allow_skill_without_day; // [Komurka] @@ -477,11 +477,11 @@ extern struct Battle_Config int vcast_stat_scale; int mvp_tomb_enabled; - + int atcommand_suggestions_enabled; int min_npc_vending_distance; int atcommand_mobinfo_type; - + int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95] } battle_config; diff --git a/src/map/clif.c b/src/map/clif.c index 667093218..2199bf12a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1268,7 +1268,8 @@ static void clif_talisman_single(int fd, struct map_session_data *sd, short type *------------------------------------------*/ static void clif_weather_check(struct map_session_data *sd) { - int m = sd->bl.m, fd = sd->fd; + int16 m = sd->bl.m; + int fd = sd->fd; if (map[m].flag.snow || map[m].flag.clouds @@ -1309,7 +1310,7 @@ static void clif_weather_check(struct map_session_data *sd) /** * Run when the weather on a map changes, throws all players in map id 'm' to clif_weather_check function **/ -void clif_weather(int m) +void clif_weather(int16 m) { struct s_mapiterator* iter; struct map_session_data *sd=NULL; @@ -1524,23 +1525,23 @@ int clif_homskillinfoblock(struct map_session_data *sd) return 0; } -void clif_homskillup(struct map_session_data *sd, int skill_num) +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { //[orn] struct homun_data *hd; - int fd, skillid; + int fd, idx; nullpo_retv(sd); - skillid = skill_num - HM_SKILLBASE; + idx = skill_id - HM_SKILLBASE; fd=sd->fd; hd=sd->hd; WFIFOHEAD(fd, packet_len(0x239)); WFIFOW(fd,0) = 0x239; - WFIFOW(fd,2) = skill_num; - WFIFOW(fd,4) = hd->homunculus.hskill[skillid].lv; - WFIFOW(fd,6) = skill_get_sp(skill_num,hd->homunculus.hskill[skillid].lv); - WFIFOW(fd,8) = skill_get_range2(&hd->bl, skill_num,hd->homunculus.hskill[skillid].lv); - WFIFOB(fd,10) = (hd->homunculus.hskill[skillid].lv < skill_get_max(hd->homunculus.hskill[skillid].id)) ? 1 : 0; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill_get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill_get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill_get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; WFIFOSET(fd,packet_len(0x239)); } @@ -4336,7 +4337,7 @@ void clif_standing(struct block_list* bl) /// Inform client(s) about a map-cell change (ZC_UPDATE_MAPINFO). /// 0192 <x>.W <y>.W <type>.W <map name>.16B -void clif_changemapcell(int fd, int m, int x, int y, int type, enum send_target target) +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { unsigned char buf[32]; @@ -4705,7 +4706,7 @@ void clif_deleteskill(struct map_session_data *sd, int id) /// Updates a skill in the skill tree (ZC_SKILLINFO_UPDATE). /// 010e <skill id>.W <level>.W <sp cost>.W <attack range>.W <upgradable>.B -void clif_skillup(struct map_session_data *sd,int skill_num) +void clif_skillup(struct map_session_data *sd,uint16 skill_id) { int fd; @@ -4714,11 +4715,11 @@ void clif_skillup(struct map_session_data *sd,int skill_num) fd=sd->fd; WFIFOHEAD(fd,packet_len(0x10e)); WFIFOW(fd,0) = 0x10e; - WFIFOW(fd,2) = skill_num; - WFIFOW(fd,4) = sd->status.skill[skill_num].lv; - WFIFOW(fd,6) = skill_get_sp(skill_num,sd->status.skill[skill_num].lv); - WFIFOW(fd,8) = skill_get_range2(&sd->bl,skill_num,sd->status.skill[skill_num].lv); - WFIFOB(fd,10) = (sd->status.skill[skill_num].lv < skill_tree_get_max(sd->status.skill[skill_num].id, sd->status.class_)) ? 1 : 0; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = sd->status.skill[skill_id].lv; + WFIFOW(fd,6) = skill_get_sp(skill_id,sd->status.skill[skill_id].lv); + WFIFOW(fd,8) = skill_get_range2(&sd->bl,skill_id,sd->status.skill[skill_id].lv); + WFIFOB(fd,10) = (sd->status.skill[skill_id].lv < skill_tree_get_max(sd->status.skill[skill_id].id, sd->status.class_)) ? 1 : 0; WFIFOSET(fd,packet_len(0x10e)); } @@ -4759,7 +4760,7 @@ void clif_skillinfo(struct map_session_data *sd,int skill, int inf) /// is disposable: /// 0 = yellow chat text "[src name] will use skill [skill name]." /// 1 = no text -void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, int skill_num, int property, int casttime) +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) { #if PACKETVER < 20091124 const int cmd = 0x13e; @@ -4773,7 +4774,7 @@ void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, WBUFL(buf,6) = dst_id; WBUFW(buf,10) = dst_x; WBUFW(buf,12) = dst_y; - WBUFW(buf,14) = skill_num; + WBUFW(buf,14) = skill_id; WBUFL(buf,16) = property<0?0:property; //Avoid sending negatives as element [Skotlex] WBUFL(buf,20) = casttime; #if PACKETVER >= 20091124 @@ -4826,7 +4827,7 @@ void clif_skillcastcancel(struct block_list* bl) /// if(result!=0) doesn't display any of the previous messages /// Note: when this packet is received an unknown flag is always set to 0, /// suggesting this is an ACK packet for the UseSkill packets and should be sent on success too [FlavioJS] -void clif_skill_fail(struct map_session_data *sd,int skill_id,enum useskill_fail_cause cause,int btype) +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) { int fd; @@ -4862,7 +4863,7 @@ void clif_skill_fail(struct map_session_data *sd,int skill_id,enum useskill_fail /// Skill cooldown display icon (ZC_SKILL_POSTDELAY). /// 043d <skill ID>.W <tick>.L -void clif_skill_cooldown(struct map_session_data *sd, int skillid, unsigned int tick) +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int tick) { #if PACKETVER>=20081112 int fd; @@ -4872,7 +4873,7 @@ void clif_skill_cooldown(struct map_session_data *sd, int skillid, unsigned int fd=sd->fd; WFIFOHEAD(fd,packet_len(0x43d)); WFIFOW(fd,0) = 0x43d; - WFIFOW(fd,2) = skillid; + WFIFOW(fd,2) = skill_id; WFIFOL(fd,4) = tick; WFIFOSET(fd,packet_len(0x43d)); #endif @@ -4882,7 +4883,7 @@ void clif_skill_cooldown(struct map_session_data *sd, int skillid, unsigned int /// Skill attack effect and damage. /// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL) /// 01de <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.L <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL2) -int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type) +int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type) { unsigned char buf[64]; struct status_change *sc; @@ -4969,7 +4970,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int /// Ground skill attack effect and damage (ZC_NOTIFY_SKILL_POSITION). /// 0115 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <x>.W <y>.W <damage>.W <level>.W <div>.W <type>.B /* -int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type) +int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type) { unsigned char buf[64]; struct status_change *sc; @@ -5027,7 +5028,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned in /// Non-damaging skill effect (ZC_USE_SKILL). /// 011a <skill id>.W <skill lv>.W <dst id>.L <src id>.L <result>.B -int clif_skill_nodamage(struct block_list *src,struct block_list *dst,int skill_id,int heal,int fail) +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) { unsigned char buf[32]; @@ -5060,7 +5061,7 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst,int skill_ /// Non-damaging ground skill effect (ZC_NOTIFY_GROUNDSKILL). /// 0117 <skill id>.W <src id>.L <level>.W <x>.W <y>.W <tick>.L -void clif_skill_poseffect(struct block_list *src,int skill_id,int val,int x,int y,int tick) +void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,int tick) { unsigned char buf[32]; @@ -5128,7 +5129,7 @@ void clif_skill_setunit(struct skill_unit *unit) /// Presents a list of available warp destinations (ZC_WARPLIST). /// 011c <skill id>.W { <map name>.16B }*4 -void clif_skill_warppoint(struct map_session_data* sd, short skill_num, short skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) { int fd; nullpo_retv(sd); @@ -5136,7 +5137,7 @@ void clif_skill_warppoint(struct map_session_data* sd, short skill_num, short sk WFIFOHEAD(fd,packet_len(0x11c)); WFIFOW(fd,0) = 0x11c; - WFIFOW(fd,2) = skill_num; + WFIFOW(fd,2) = skill_id; memset(WFIFOP(fd,4), 0x00, 4*MAP_NAME_LENGTH_EXT); if (map1 == (unsigned short)-1) strcpy((char*)WFIFOP(fd,4), "Random"); else // normal map name @@ -5146,8 +5147,8 @@ void clif_skill_warppoint(struct map_session_data* sd, short skill_num, short sk if (map4 > 0) mapindex_getmapname_ext(mapindex_id2name(map4), (char*)WFIFOP(fd,52)); WFIFOSET(fd,packet_len(0x11c)); - sd->menuskill_id = skill_num; - if (skill_num == AL_WARP) + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP) sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; //Store warp position here. else sd->menuskill_val = skill_lv; @@ -5240,15 +5241,15 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) /// 018d <packet len>.W { <name id>.W { <material id>.W }*3 }* /// material id: /// unused by the client -void clif_skill_produce_mix_list(struct map_session_data *sd, int skillid , int trigger) +void clif_skill_produce_mix_list(struct map_session_data *sd, uint16 skill_id , int trigger) { int i,c,view,fd; nullpo_retv(sd); - if(sd->menuskill_id == skillid) + if(sd->menuskill_id == skill_id) return; //Avoid resending the menu twice or more times... - if( skillid == GC_CREATENEWPOISON ) - skillid = GC_RESEARCHNEWPOISON; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; fd=sd->fd; WFIFOHEAD(fd, MAX_SKILL_PRODUCE_DB * 8 + 8); @@ -5256,7 +5257,7 @@ void clif_skill_produce_mix_list(struct map_session_data *sd, int skillid , int for(i=0,c=0;i<MAX_SKILL_PRODUCE_DB;i++){ if( skill_can_produce_mix(sd,skill_produce_db[i].nameid, trigger, 1) && - ( ( skillid > 0 && skill_produce_db[i].req_skill == skillid ) || skillid < 0 ) + ( ( skill_id > 0 && skill_produce_db[i].req_skill == skill_id ) || skill_id < 0 ) ){ if((view = itemdb_viewid(skill_produce_db[i].nameid)) > 0) WFIFOW(fd,c*8+ 4)= view; @@ -5271,7 +5272,7 @@ void clif_skill_produce_mix_list(struct map_session_data *sd, int skillid , int WFIFOW(fd, 2)=c*8+8; WFIFOSET(fd,WFIFOW(fd,2)); if(c > 0) { - sd->menuskill_id = skillid; + sd->menuskill_id = skill_id; sd->menuskill_val = trigger; return; } @@ -5287,7 +5288,7 @@ void clif_skill_produce_mix_list(struct map_session_data *sd, int skillid , int /// 4 = GN_MIX_COOKING /// 5 = GN_MAKEBOMB /// 6 = GN_S_PHARMACY -void clif_cooking_list(struct map_session_data *sd, int trigger, int skill_id, int qty, int list_type) +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) { int fd; int i, c; @@ -5853,7 +5854,7 @@ void clif_item_repair_list(struct map_session_data *sd,struct map_session_data * sd->menuskill_val = dstsd->bl.id; sd->menuskill_val2 = lv; }else - clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); } @@ -5901,13 +5902,13 @@ void clif_item_refine_list(struct map_session_data *sd) { int i,c; int fd; - int skilllv; + uint16 skill_lv; int wlv; int refine_item[5]; nullpo_retv(sd); - skilllv = pc_checkskill(sd,WS_WEAPONREFINE); + skill_lv = pc_checkskill(sd,WS_WEAPONREFINE); fd=sd->fd; @@ -5919,7 +5920,7 @@ void clif_item_refine_list(struct map_session_data *sd) WFIFOHEAD(fd, MAX_INVENTORY * 13 + 4); WFIFOW(fd,0)=0x221; for(i=c=0;i<MAX_INVENTORY;i++){ - if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].refine < skilllv && + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].refine < skill_lv && sd->status.inventory[i].identify && (wlv=itemdb_wlv(sd->status.inventory[i].nameid)) >=1 && refine_item[wlv]!=-1 && !(sd->status.inventory[i].equip&EQP_ARMS)){ WFIFOW(fd,c*13+ 4)=i+2; @@ -5933,14 +5934,14 @@ void clif_item_refine_list(struct map_session_data *sd) WFIFOSET(fd,WFIFOW(fd,2)); if (c > 0) { sd->menuskill_id = WS_WEAPONREFINE; - sd->menuskill_val = skilllv; + sd->menuskill_val = skill_lv; } } /// Notification of an auto-casted skill (ZC_AUTORUN_SKILL). /// 0147 <skill id>.W <type>.L <level>.W <sp cost>.W <atk range>.W <skill name>.24B <upgradable>.B -void clif_item_skill(struct map_session_data *sd,int skillid,int skilllv) +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) { int fd; @@ -5949,13 +5950,13 @@ void clif_item_skill(struct map_session_data *sd,int skillid,int skilllv) fd=sd->fd; WFIFOHEAD(fd,packet_len(0x147)); WFIFOW(fd, 0)=0x147; - WFIFOW(fd, 2)=skillid; - WFIFOW(fd, 4)=skill_get_inf(skillid); + WFIFOW(fd, 2)=skill_id; + WFIFOW(fd, 4)=skill_get_inf(skill_id); WFIFOW(fd, 6)=0; - WFIFOW(fd, 8)=skilllv; - WFIFOW(fd,10)=skill_get_sp(skillid,skilllv); - WFIFOW(fd,12)=skill_get_range2(&sd->bl, skillid,skilllv); - safestrncpy((char*)WFIFOP(fd,14),skill_get_name(skillid),NAME_LENGTH); + WFIFOW(fd, 8)=skill_lv; + WFIFOW(fd,10)=skill_get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill_get_range2(&sd->bl, skill_id,skill_lv); + safestrncpy((char*)WFIFOP(fd,14),skill_get_name(skill_id),NAME_LENGTH); WFIFOB(fd,38)=0; WFIFOSET(fd,packet_len(0x147)); } @@ -6816,7 +6817,7 @@ void clif_pet_food(struct map_session_data *sd,int foodid,int fail) /// Presents a list of skills that can be auto-spelled (ZC_AUTOSPELLLIST). /// 01cd { <skill id>.L }*7 -void clif_autospell(struct map_session_data *sd,int skilllv) +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) { int fd; @@ -6826,38 +6827,38 @@ void clif_autospell(struct map_session_data *sd,int skilllv) WFIFOHEAD(fd,packet_len(0x1cd)); WFIFOW(fd, 0)=0x1cd; - if(skilllv>0 && pc_checkskill(sd,MG_NAPALMBEAT)>0) + if(skill_lv>0 && pc_checkskill(sd,MG_NAPALMBEAT)>0) WFIFOL(fd,2)= MG_NAPALMBEAT; else WFIFOL(fd,2)= 0x00000000; - if(skilllv>1 && pc_checkskill(sd,MG_COLDBOLT)>0) + if(skill_lv>1 && pc_checkskill(sd,MG_COLDBOLT)>0) WFIFOL(fd,6)= MG_COLDBOLT; else WFIFOL(fd,6)= 0x00000000; - if(skilllv>1 && pc_checkskill(sd,MG_FIREBOLT)>0) + if(skill_lv>1 && pc_checkskill(sd,MG_FIREBOLT)>0) WFIFOL(fd,10)= MG_FIREBOLT; else WFIFOL(fd,10)= 0x00000000; - if(skilllv>1 && pc_checkskill(sd,MG_LIGHTNINGBOLT)>0) + if(skill_lv>1 && pc_checkskill(sd,MG_LIGHTNINGBOLT)>0) WFIFOL(fd,14)= MG_LIGHTNINGBOLT; else WFIFOL(fd,14)= 0x00000000; - if(skilllv>4 && pc_checkskill(sd,MG_SOULSTRIKE)>0) + if(skill_lv>4 && pc_checkskill(sd,MG_SOULSTRIKE)>0) WFIFOL(fd,18)= MG_SOULSTRIKE; else WFIFOL(fd,18)= 0x00000000; - if(skilllv>7 && pc_checkskill(sd,MG_FIREBALL)>0) + if(skill_lv>7 && pc_checkskill(sd,MG_FIREBALL)>0) WFIFOL(fd,22)= MG_FIREBALL; else WFIFOL(fd,22)= 0x00000000; - if(skilllv>9 && pc_checkskill(sd,MG_FROSTDIVER)>0) + if(skill_lv>9 && pc_checkskill(sd,MG_FROSTDIVER)>0) WFIFOL(fd,26)= MG_FROSTDIVER; else WFIFOL(fd,26)= 0x00000000; WFIFOSET(fd,packet_len(0x1cd)); sd->menuskill_id = SA_AUTOSPELL; - sd->menuskill_val = skilllv; + sd->menuskill_val = skill_lv; } @@ -7632,9 +7633,9 @@ void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) /*========================================== - * Server tells client 'sd' that his guild skill 'skill_num' gone to level 'lv' + * Server tells client 'sd' that his guild skill 'skill_id' gone to level 'lv' *------------------------------------------*/ -int clif_guild_skillup(struct map_session_data *sd,int skill_num,int lv) +int clif_guild_skillup(struct map_session_data *sd,uint16 skill_id,int lv) {// TODO: Merge with clif_skillup (same packet). int fd; @@ -7643,10 +7644,10 @@ int clif_guild_skillup(struct map_session_data *sd,int skill_num,int lv) fd=sd->fd; WFIFOHEAD(fd,11); WFIFOW(fd,0) = 0x10e; - WFIFOW(fd,2) = skill_num; + WFIFOW(fd,2) = skill_id; WFIFOW(fd,4) = lv; - WFIFOW(fd,6) = skill_get_sp(skill_num,lv); - WFIFOW(fd,8) = skill_get_range(skill_num,lv); + WFIFOW(fd,6) = skill_get_sp(skill_id,lv); + WFIFOW(fd,8) = skill_get_range(skill_id,lv); WFIFOB(fd,10) = 1; WFIFOSET(fd,11); return 0; @@ -8807,7 +8808,7 @@ void clif_msg_value(struct map_session_data* sd, unsigned short id, int value) /// /// NOTE: Message has following format and is printed in color 0xCDCDFF (purple): /// "[SkillName] Message" -void clif_msg_skill(struct map_session_data* sd, unsigned short skill_id, int msg_id) +void clif_msg_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) { int fd = sd->fd; @@ -10663,97 +10664,97 @@ void clif_parse_SkillUp(int fd,struct map_session_data *sd) pc_skillup(sd,RFIFOW(fd,2)); } -static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, int target_id) +static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id) { int lv; if( !hd ) return; - if( skillnotok_hom(skillnum, hd) ) + if( skillnotok_hom(skill_id, hd) ) return; - if( hd->bl.id != target_id && skill_get_inf(skillnum)&INF_SELF_SKILL ) + if( hd->bl.id != target_id && skill_get_inf(skill_id)&INF_SELF_SKILL ) target_id = hd->bl.id; if( hd->ud.skilltimer != INVALID_TIMER ) { - if( skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST ) return; + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; } else if( DIFF_TICK(tick, hd->ud.canact_tick) < 0 ) return; - lv = merc_hom_checkskill(hd, skillnum); - if( skilllv > lv ) - skilllv = lv; - if( skilllv ) - unit_skilluse_id(&hd->bl, target_id, skillnum, skilllv); + lv = merc_hom_checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit_skilluse_id(&hd->bl, target_id, skill_id, skill_lv); } -static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, short x, short y, int skillmoreinfo) +static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { int lv; if( !hd ) return; - if( skillnotok_hom(skillnum, hd) ) + if( skillnotok_hom(skill_id, hd) ) return; if( hd->ud.skilltimer != INVALID_TIMER ) { - if( skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST ) return; + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; } else if( DIFF_TICK(tick, hd->ud.canact_tick) < 0 ) return; if( hd->sc.data[SC_BASILICA] ) return; - lv = merc_hom_checkskill(hd, skillnum); - if( skilllv > lv ) - skilllv = lv; - if( skilllv ) - unit_skilluse_pos(&hd->bl, x, y, skillnum, skilllv); + lv = merc_hom_checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit_skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); } -static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, int target_id) +static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id) { int lv; if( !md ) return; - if( skillnotok_mercenary(skillnum, md) ) + if( skillnotok_mercenary(skill_id, md) ) return; - if( md->bl.id != target_id && skill_get_inf(skillnum)&INF_SELF_SKILL ) + if( md->bl.id != target_id && skill_get_inf(skill_id)&INF_SELF_SKILL ) target_id = md->bl.id; if( md->ud.skilltimer != INVALID_TIMER ) { - if( skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST ) return; + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; } else if( DIFF_TICK(tick, md->ud.canact_tick) < 0 ) return; - lv = mercenary_checkskill(md, skillnum); - if( skilllv > lv ) - skilllv = lv; - if( skilllv ) - unit_skilluse_id(&md->bl, target_id, skillnum, skilllv); + lv = mercenary_checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit_skilluse_id(&md->bl, target_id, skill_id, skill_lv); } -static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, short x, short y, int skillmoreinfo) +static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { int lv; if( !md ) return; - if( skillnotok_mercenary(skillnum, md) ) + if( skillnotok_mercenary(skill_id, md) ) return; if( md->ud.skilltimer != INVALID_TIMER ) return; if( DIFF_TICK(tick, md->ud.canact_tick) < 0 ) { - clif_skill_fail(md->master, skillnum, USESKILL_FAIL_SKILLINTERVAL, 0); + clif_skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return; } if( md->sc.data[SC_BASILICA] ) return; - lv = mercenary_checkskill(md, skillnum); - if( skilllv > lv ) - skilllv = lv; - if( skilllv ) - unit_skilluse_pos(&md->bl, x, y, skillnum, skilllv); + lv = mercenary_checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit_skilluse_pos(&md->bl, x, y, skill_id, skill_lv); } @@ -10763,41 +10764,41 @@ static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct /// There are various variants of this packet, some of them have padding between fields. void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { - short skillnum, skilllv; + uint16 skill_id, skill_lv; int tmp, target_id; unsigned int tick = gettick(); - skilllv = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); - skillnum = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]); + skill_lv = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]); target_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[2]); - if( skilllv < 1 ) skilllv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex] + if( skill_lv < 1 ) skill_lv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex] - tmp = skill_get_inf(skillnum); + tmp = skill_get_inf(skill_id); if (tmp&INF_GROUND_SKILL || !tmp) return; //Using a ground/passive skill on a target? WRONG. - if( skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE + MAX_HOMUNSKILL ) + if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL ) { - clif_parse_UseSkillToId_homun(sd->hd, sd, tick, skillnum, skilllv, target_id); + clif_parse_UseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); return; } - if( skillnum >= MC_SKILLBASE && skillnum < MC_SKILLBASE + MAX_MERCSKILL ) + if( skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL ) { - clif_parse_UseSkillToId_mercenary(sd->md, sd, tick, skillnum, skilllv, target_id); + clif_parse_UseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); return; } // Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex] sd->idletime = last_tick; - if( pc_cant_act(sd) && skillnum != RK_REFRESH && !(skillnum == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) ) + if( pc_cant_act(sd) && skill_id != RK_REFRESH && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) ) return; if( pc_issit(sd) ) return; - if( skillnotok(skillnum, sd) ) + if( skillnotok(skill_id, sd) ) return; if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) @@ -10808,14 +10809,14 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( sd->ud.skilltimer != INVALID_TIMER ) { - if( skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST ) + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; } else if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 ) { - if( sd->skillitem != skillnum ) + if( sd->skillitem != skill_id ) { - clif_skill_fail(sd, skillnum, USESKILL_FAIL_SKILLINTERVAL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return; } } @@ -10823,7 +10824,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER) ) return; - if( sd->sc.data[SC_BASILICA] && (skillnum != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) return; // On basilica only caster can use Basilica again to stop it. if( sd->menuskill_id ) { @@ -10832,65 +10833,65 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) } else if( sd->menuskill_id != SA_AUTOSPELL ) return; //Can't use skills while a menu is open. } - if( sd->skillitem == skillnum ) { - if( skilllv != sd->skillitemlv ) - skilllv = sd->skillitemlv; + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; if( !(tmp&INF_SELF_SKILL) ) pc_delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish] - unit_skilluse_id(&sd->bl, target_id, skillnum, skilllv); + unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv); return; } sd->skillitem = sd->skillitemlv = 0; - if( skillnum >= GD_SKILLBASE ) { + if( skill_id >= GD_SKILLBASE ) { if( sd->state.gmaster_flag ) - skilllv = guild_checkskill(sd->state.gmaster_flag, skillnum); + skill_lv = guild_checkskill(sd->state.gmaster_flag, skill_id); else - skilllv = 0; + skill_lv = 0; } else { - tmp = pc_checkskill(sd, skillnum); - if( skilllv > tmp ) - skilllv = tmp; + tmp = pc_checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; } pc_delinvincibletimer(sd); - if( skilllv ) - unit_skilluse_id(&sd->bl, target_id, skillnum, skilllv); + if( skill_lv ) + unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv); } /*========================================== - * Client tells server he'd like to use AoE skill id 'skillnum' of level 'skilllv' on 'x','y' location + * Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location *------------------------------------------*/ -static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, short skilllv, short skillnum, short x, short y, int skillmoreinfo) +static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) { unsigned int tick = gettick(); - if( !(skill_get_inf(skillnum)&INF_GROUND_SKILL) ) + if( !(skill_get_inf(skill_id)&INF_GROUND_SKILL) ) return; //Using a target skill on the ground? WRONG. - if( skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE + MAX_HOMUNSKILL ) { - clif_parse_UseSkillToPos_homun(sd->hd, sd, tick, skillnum, skilllv, x, y, skillmoreinfo); + if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL ) { + clif_parse_UseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); return; } - if( skillnum >= MC_SKILLBASE && skillnum < MC_SKILLBASE + MAX_MERCSKILL ) + if( skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL ) { - clif_parse_UseSkillToPos_mercenary(sd->md, sd, tick, skillnum, skilllv, x, y, skillmoreinfo); + clif_parse_UseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); return; } //Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex] sd->idletime = last_tick; - if( skillnotok(skillnum, sd) ) + if( skillnotok(skill_id, sd) ) return; if( skillmoreinfo != -1 ) { if( pc_issit(sd) ) { - clif_skill_fail(sd, skillnum, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); return; } //You can't use Graffiti/TalkieBox AND have a vending open, so this is safe. @@ -10901,8 +10902,8 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, sho return; if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 ) { - if( sd->skillitem != skillnum ) { - clif_skill_fail(sd, skillnum, USESKILL_FAIL_SKILLINTERVAL, 0); + if( sd->skillitem != skill_id ) { + clif_skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return; } } @@ -10910,7 +10911,7 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, sho if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER) ) return; - if( sd->sc.data[SC_BASILICA] && (skillnum != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) return; // On basilica only caster can use Basilica again to stop it. if( sd->menuskill_id ) { @@ -10922,17 +10923,17 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, sho pc_delinvincibletimer(sd); - if( sd->skillitem == skillnum ) { - if( skilllv != sd->skillitemlv ) - skilllv = sd->skillitemlv; - unit_skilluse_pos(&sd->bl, x, y, skillnum, skilllv); + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit_skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); } else { int lv; sd->skillitem = sd->skillitemlv = 0; - if( (lv = pc_checkskill(sd, skillnum)) > 0 ) { - if( skilllv > lv ) - skilllv = lv; - unit_skilluse_pos(&sd->bl, x, y, skillnum,skilllv); + if( (lv = pc_checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit_skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); } } } @@ -10984,11 +10985,11 @@ void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) /// 011b <skill id>.W <map name>.16B void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) { - short skill_num = RFIFOW(fd,2); + uint16 skill_id = RFIFOW(fd,2); char map_name[MAP_NAME_LENGTH]; mapindex_getmapname((char*)RFIFOP(fd,4), map_name); - if(skill_num != sd->menuskill_id) + if(skill_id != sd->menuskill_id) return; if( pc_cant_act(sd) ) { @@ -10997,7 +10998,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) } pc_delinvincibletimer(sd); - skill_castend_map(sd,skill_num,map_name); + skill_castend_map(sd,skill_id,map_name); } @@ -11025,7 +11026,7 @@ void clif_parse_ProduceMix(int fd,struct map_session_data *sd) } if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11053,7 +11054,7 @@ void clif_parse_Cooking(int fd,struct map_session_data *sd) { if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11071,7 +11072,7 @@ void clif_parse_RepairItem(int fd, struct map_session_data *sd) return; if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11090,7 +11091,7 @@ void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) return; if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11196,7 +11197,7 @@ void clif_parse_SelectArrow(int fd,struct map_session_data *sd) { if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -13340,14 +13341,14 @@ void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) /// 0 = sun /// 1 = moon /// 2 = star -void clif_feel_req(int fd, struct map_session_data *sd, int skilllv) +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) { WFIFOHEAD(fd,packet_len(0x253)); WFIFOW(fd,0)=0x253; - WFIFOB(fd,2)=TOB(skilllv-1); + WFIFOB(fd,2)=TOB(skill_lv-1); WFIFOSET(fd, packet_len(0x253)); sd->menuskill_id = SG_FEEL; - sd->menuskill_val = skilllv; + sd->menuskill_val = skill_lv; } @@ -15097,7 +15098,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd) /// Notifies client of a battleground score change (ZC_BATTLEFIELD_NOTIFY_POINT). /// 02de <camp A points>.W <camp B points>.W -void clif_bg_updatescore(int m) +void clif_bg_updatescore(int16 m) { struct block_list bl; unsigned char buf[6]; @@ -16058,7 +16059,7 @@ int clif_spellbook_list(struct map_session_data *sd) /*========================================== * Magic Decoy Material List *------------------------------------------*/ -int clif_magicdecoy_list(struct map_session_data *sd, int skill_lv, short x, short y) { +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { int i, c; int fd; @@ -16094,7 +16095,7 @@ int clif_magicdecoy_list(struct map_session_data *sd, int skill_lv, short x, sho /*========================================== * Guillotine Cross Poisons List *------------------------------------------*/ -int clif_poison_list(struct map_session_data *sd, int skill_lv) { +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { int i, c; int fd; @@ -16158,7 +16159,7 @@ int clif_autoshadowspell_list(struct map_session_data *sd) { * Skill list for Four Elemental Analysis * and Change Material skills. *------------------------------------------*/ -int clif_skill_itemlistwindow( struct map_session_data *sd, int skill_id, int skill_lv ) +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) { #if PACKETVER >= 20090922 int fd; @@ -16247,7 +16248,7 @@ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { return; if( pc_istrading(sd) ) { - clif_skill_fail(sd,sd->ud.skillid,0,0); + clif_skill_fail(sd,sd->ud.skill_id,0,0); clif_menuskill_clear(sd); return; } diff --git a/src/map/clif.h b/src/map/clif.h index 0948a12c1..723c55cf8 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -425,25 +425,25 @@ void clif_class_change(struct block_list *bl,int class_,int type); #define clif_mob_class_change(md, class_) clif_class_change(&md->bl, class_, 1) void clif_skillinfoblock(struct map_session_data *sd); -void clif_skillup(struct map_session_data *sd,int skill_num); +void clif_skillup(struct map_session_data *sd,uint16 skill_id); void clif_skillinfo(struct map_session_data *sd,int skill, int inf); void clif_addskill(struct map_session_data *sd, int id); void clif_deleteskill(struct map_session_data *sd, int id); -void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, int skill_num, int property, int casttime); +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime); void clif_skillcastcancel(struct block_list* bl); -void clif_skill_fail(struct map_session_data *sd,int skill_id,enum useskill_fail_cause cause,int btype); -void clif_skill_cooldown(struct map_session_data *sd, int skillid, unsigned int tick); -int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type); -//int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type); -int clif_skill_nodamage(struct block_list *src,struct block_list *dst,int skill_id,int heal,int fail); -void clif_skill_poseffect(struct block_list *src,int skill_id,int val,int x,int y,int tick); +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype); +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int tick); +int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type); +//int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type); +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail); +void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,int tick); void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst); -void clif_skill_warppoint(struct map_session_data* sd, short skill_num, short skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4); +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4); void clif_skill_memomessage(struct map_session_data* sd, int type); void clif_skill_teleportmessage(struct map_session_data *sd, int type); -void clif_skill_produce_mix_list(struct map_session_data *sd, int skillid, int trigger); -void clif_cooking_list(struct map_session_data *sd, int trigger, int skill_id, int qty, int list_type); +void clif_skill_produce_mix_list(struct map_session_data *sd, uint16 skill_id, int trigger); +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type); void clif_produceeffect(struct map_session_data* sd,int flag,int nameid); @@ -452,12 +452,12 @@ void clif_skill_delunit(struct skill_unit *unit); void clif_skillunit_update(struct block_list* bl); -void clif_autospell(struct map_session_data *sd,int skilllv); +void clif_autospell(struct map_session_data *sd,uint16 skill_lv); void clif_devotion(struct block_list *src, struct map_session_data *tsd); void clif_spiritball(struct block_list *bl); void clif_combo_delay(struct block_list *bl,int wait); void clif_bladestop(struct block_list *src, int dst_id, int active); -void clif_changemapcell(int fd, int m, int x, int y, int type, enum send_target target); +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target); #define clif_status_load(bl, type, flag) clif_status_change((bl), (type), (flag), 0, 0, 0, 0) void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3); @@ -487,7 +487,7 @@ void clif_item_repaireffect(struct map_session_data *sd, int idx, int flag); void clif_item_damaged(struct map_session_data* sd, unsigned short position); void clif_item_refine_list(struct map_session_data *sd); -void clif_item_skill(struct map_session_data *sd,int skillid,int skilllv); +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv); void clif_mvp_effect(struct map_session_data *sd); void clif_mvp_item(struct map_session_data *sd,int nameid); @@ -540,7 +540,7 @@ void clif_guild_emblem(struct map_session_data *sd,struct guild *g); void clif_guild_emblem_area(struct block_list* bl); void clif_guild_notice(struct map_session_data* sd, struct guild* g); void clif_guild_message(struct guild *g,int account_id,const char *mes,int len); -int clif_guild_skillup(struct map_session_data *sd,int skill_num,int lv); +int clif_guild_skillup(struct map_session_data *sd,uint16 skill_id,int lv); void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name); void clif_guild_allianceack(struct map_session_data *sd,int flag); void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag); @@ -555,7 +555,7 @@ void clif_bg_hp(struct map_session_data *sd); void clif_bg_xy(struct map_session_data *sd); void clif_bg_xy_remove(struct map_session_data *sd); void clif_bg_message(struct battleground_data *bg, int src_id, const char *name, const char *mes, int len); -void clif_bg_updatescore(int m); +void clif_bg_updatescore(int16 m); void clif_bg_updatescore_single(struct map_session_data *sd); void clif_sendbgemblem_area(struct map_session_data *sd); void clif_sendbgemblem_single(int fd, struct map_session_data *sd); @@ -600,7 +600,7 @@ int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap); void clif_friendslist_send(struct map_session_data *sd); void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type); -void clif_weather(int m); // [Valaris] +void clif_weather(int16 m); // [Valaris] void clif_specialeffect(struct block_list* bl, int type, enum send_target target); // special effects [Valaris] void clif_specialeffect_single(struct block_list* bl, int type, int fd); void clif_messagecolor(struct block_list* bl, unsigned long color, const char* msg); // Mob/Npc color talk [SnakeDrak] @@ -618,7 +618,7 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un void clif_party_xy_remove(struct map_session_data *sd); //Fix for minimap [Kevin] void clif_gospel_info(struct map_session_data *sd, int type); -void clif_feel_req(int fd, struct map_session_data *sd, int skilllv); +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv); void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result); void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type); void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type); @@ -628,7 +628,7 @@ void clif_feel_hate_reset(struct map_session_data *sd); // [blackhole89] void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag); int clif_homskillinfoblock(struct map_session_data *sd); -void clif_homskillup(struct map_session_data *sd, int skill_num); //[orn] +void clif_homskillup(struct map_session_data *sd, uint16 skill_id); //[orn] int clif_hom_food(struct map_session_data *sd,int foodid,int fail); //[orn] void clif_send_homdata(struct map_session_data *sd, int state, int param); //[orn] @@ -639,7 +639,7 @@ void clif_equipcheckbox(struct map_session_data* sd); void clif_msg(struct map_session_data* sd, unsigned short id); void clif_msg_value(struct map_session_data* sd, unsigned short id, int value); -void clif_msg_skill(struct map_session_data* sd, unsigned short skill_id, int msg_id); +void clif_msg_skill(struct map_session_data* sd, uint16 skill_id, int msg_id); //quest system [Kevin] [Inkfish] void clif_quest_send_list(struct map_session_data * sd); @@ -737,9 +737,9 @@ void clif_millenniumshield(struct map_session_data *sd, short shields ); int clif_spellbook_list(struct map_session_data *sd); -int clif_magicdecoy_list(struct map_session_data *sd, int skill_lv, short x, short y); +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y); -int clif_poison_list(struct map_session_data *sd, int skill_lv); +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv); int clif_autoshadowspell_list(struct map_session_data *sd); @@ -747,7 +747,7 @@ int clif_status_load_notick(struct block_list *bl,int type,int flag,int val1, in int clif_status_load_single(int fd, int id,int type,int flag,int val1, int val2, int val3); -int clif_skill_itemlistwindow( struct map_session_data *sd, int skill_id, int skill_lv ); +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ); void clif_elemental_info(struct map_session_data *sd); void clif_elemental_updatestatus(struct map_session_data *sd, int type); diff --git a/src/map/elemental.c b/src/map/elemental.c index 4d9121575..a787b1be4 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -53,7 +53,7 @@ struct view_data * elemental_get_viewdata(int class_) { int i = elemental_search_index(class_); if( i < 0 ) return 0; - + return &elemental_db[i].vd; } @@ -61,15 +61,15 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet struct s_elemental ele; struct s_elemental_db *db; int i; - + nullpo_retr(1,sd); - + if( (i = elemental_search_index(class_)) < 0 ) return 0; - + db = &elemental_db[i]; memset(&ele,0,sizeof(struct s_elemental)); - + ele.char_id = sd->status.char_id; ele.class_ = class_; ele.mode = EL_MODE_PASSIVE; // Initial mode @@ -97,7 +97,7 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet ele.flee = sd->status.base_level / (5-i); //Caster痴 HIT + (Caster痴 Base Level ) ele.hit = sd->battle_status.hit + sd->status.base_level; - + //per individual bonuses switch(db->class_){ case 2114: case 2115: @@ -133,10 +133,10 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet } ele.life_time = lifetime; - + // Request Char Server to create this elemental intif_elemental_create(&ele); - + return 1; } @@ -144,7 +144,7 @@ int elemental_get_lifetime(struct elemental_data *ed) { const struct TimerData * td; if( ed == NULL || ed->summon_timer == INVALID_TIMER ) return 0; - + td = get_timer(ed->summon_timer); return (td != NULL) ? DIFF_TICK(td->tick, gettick()) : 0; } @@ -170,20 +170,20 @@ int elemental_save(struct elemental_data *ed) { static int elemental_summon_end(int tid, unsigned int tick, int id, intptr_t data) { struct map_session_data *sd; struct elemental_data *ed; - + if( (sd = map_id2sd(id)) == NULL ) return 1; if( (ed = sd->ed) == NULL ) return 1; - + if( ed->summon_timer != tid ) { ShowError("elemental_summon_end %d != %d.\n", ed->summon_timer, tid); return 0; } - + ed->summon_timer = INVALID_TIMER; elemental_delete(ed, 0); // Elemental's summon time is over. - + return 0; } @@ -196,28 +196,28 @@ void elemental_summon_stop(struct elemental_data *ed) { int elemental_delete(struct elemental_data *ed, int reply) { struct map_session_data *sd; - + nullpo_ret(ed); - + sd = ed->master; ed->elemental.life_time = 0; - + elemental_clean_effect(ed); elemental_summon_stop(ed); - + if( !sd ) return unit_free(&ed->bl, 0); - + sd->ed = NULL; sd->status.ele_id = 0; - + return unit_remove_map(&ed->bl, 0); } void elemental_summon_init(struct elemental_data *ed) { if( ed->summon_timer == INVALID_TIMER ) ed->summon_timer = add_timer(gettick() + ed->elemental.life_time, elemental_summon_end, ed->master->bl.id, 0); - + ed->regen.state.block = 0; } @@ -226,15 +226,15 @@ int elemental_data_received(struct s_elemental *ele, bool flag) { struct elemental_data *ed; struct s_elemental_db *db; int i = elemental_search_index(ele->class_); - + if( (sd = map_charid2sd(ele->char_id)) == NULL ) return 0; - + if( !flag || i < 0 ) { // Not created - loaded - DB info sd->status.ele_id = 0; return 0; } - + db = &elemental_db[i]; if( !sd->ed ) { // Initialize it after first summon. sd->ed = ed = (struct elemental_data*)aCalloc(1,sizeof(struct elemental_data)); @@ -248,14 +248,14 @@ int elemental_data_received(struct s_elemental *ele, bool flag) { status_change_init(&ed->bl); unit_dataset(&ed->bl); ed->ud.dir = sd->ud.dir; - + ed->bl.m = sd->bl.m; ed->bl.x = sd->bl.x; ed->bl.y = sd->bl.y; unit_calc_pos(&ed->bl, sd->bl.x, sd->bl.y, sd->ud.dir); ed->bl.x = ed->ud.to_x; ed->bl.y = ed->ud.to_y; - + map_addiddb(&ed->bl); status_calc_elemental(ed,1); ed->last_spdrain_time = ed->last_thinktime = gettick(); @@ -265,9 +265,9 @@ int elemental_data_received(struct s_elemental *ele, bool flag) { memcpy(&sd->ed->elemental, ele, sizeof(struct s_elemental)); ed = sd->ed; } - + sd->status.ele_id = ele->elemental_id; - + if( ed->bl.prev == NULL && sd->bl.prev != NULL ) { map_addblock(&ed->bl); clif_spawn(&ed->bl); @@ -276,18 +276,18 @@ int elemental_data_received(struct s_elemental *ele, bool flag) { clif_hpmeter_single(sd->fd,ed->bl.id,ed->battle_status.hp,ed->battle_status.max_hp); clif_elemental_updatestatus(sd,SP_SP); } - + return 1; } -int elemental_clean_single_effect(struct elemental_data *ed, int skill_num) { +int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id) { struct block_list *bl; - sc_type type = status_skill2sc(skill_num); - + sc_type type = status_skill2sc(skill_id); + nullpo_ret(ed); - + bl = battle_get_master(&ed->bl); - + if( type ) { switch( type ) { // Just remove status change. @@ -323,15 +323,15 @@ int elemental_clean_single_effect(struct elemental_data *ed, int skill_num) { break; } } - + return 1; } int elemental_clean_effect(struct elemental_data *ed) { struct map_session_data *sd; - + nullpo_ret(ed); - + // Elemental side status_change_end(&ed->bl, SC_TROPIC, INVALID_TIMER); status_change_end(&ed->bl, SC_HEATER, INVALID_TIMER); @@ -354,10 +354,10 @@ int elemental_clean_effect(struct elemental_data *ed) { status_change_end(&ed->bl, SC_UPHEAVAL, INVALID_TIMER); status_change_end(&ed->bl, SC_CIRCLE_OF_FIRE, INVALID_TIMER); status_change_end(&ed->bl, SC_TIDAL_WEAPON, INVALID_TIMER); - + if( (sd = ed->master) == NULL ) return 0; - + // Master side status_change_end(&sd->bl, SC_TROPIC_OPTION, INVALID_TIMER); status_change_end(&sd->bl, SC_HEATER_OPTION, INVALID_TIMER); @@ -383,68 +383,68 @@ int elemental_clean_effect(struct elemental_data *ed) { status_change_end(&sd->bl, SC_UPHEAVAL_OPTION, INVALID_TIMER); status_change_end(&sd->bl, SC_CIRCLE_OF_FIRE_OPTION, INVALID_TIMER); status_change_end(&sd->bl, SC_TIDAL_WEAPON_OPTION, INVALID_TIMER); - + return 1; } int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned int tick) { struct skill_condition req; - short skillnum, skilllv; + uint16 skill_id, skill_lv; int i; - + nullpo_ret(ed); nullpo_ret(bl); - + if( !ed->master ) return 0; - + if( ed->target_id ) elemental_unlocktarget(ed); // Remove previous target. - + ARR_FIND(0, MAX_ELESKILLTREE, i, ed->db->skill[i].id && (ed->db->skill[i].mode&EL_SKILLMODE_AGGRESSIVE)); if( i == MAX_ELESKILLTREE ) return 0; - - skillnum = ed->db->skill[i].id; - skilllv = ed->db->skill[i].lv; - - if( elemental_skillnotok(skillnum, ed) ) + + skill_id = ed->db->skill[i].id; + skill_lv = ed->db->skill[i].lv; + + if( elemental_skillnotok(skill_id, ed) ) return 0; - + if( ed->ud.skilltimer != INVALID_TIMER ) return 0; else if( DIFF_TICK(tick, ed->ud.canact_tick) < 0 ) return 0; - + ed->target_id = ed->ud.skilltarget = bl->id; // Set new target ed->last_thinktime = tick; - + // Not in skill range. - if( !battle_check_range(&ed->bl,bl,skill_get_range(skillnum,skilllv)) ) { + if( !battle_check_range(&ed->bl,bl,skill_get_range(skill_id,skill_lv)) ) { // Try to walk to the target. - if( !unit_walktobl(&ed->bl, bl, skill_get_range(skillnum,skilllv), 2) ) + if( !unit_walktobl(&ed->bl, bl, skill_get_range(skill_id,skill_lv), 2) ) elemental_unlocktarget(ed); else { // Walking, waiting to be in range. Client don't handle it, then we must handle it here. - int walk_dist = distance_bl(&ed->bl,bl) - skill_get_range(skillnum,skilllv); - ed->ud.skillid = skillnum; - ed->ud.skilllv = skilllv; - - if( skill_get_inf(skillnum) & INF_GROUND_SKILL ) + int walk_dist = distance_bl(&ed->bl,bl) - skill_get_range(skill_id,skill_lv); + ed->ud.skill_id = skill_id; + ed->ud.skill_lv = skill_lv; + + if( skill_get_inf(skill_id) & INF_GROUND_SKILL ) ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill_castend_pos, ed->bl.id, 0 ); else ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill_castend_id, ed->bl.id, 0 ); } return 1; - + } - req = elemental_skill_get_requirements(skillnum, skilllv); + req = elemental_skill_get_requirements(skill_id, skill_lv); if(req.hp || req.sp){ struct map_session_data *sd = BL_CAST(BL_PC, battle_get_master(&ed->bl)); if( sd ){ - if( sd->skillid_old != SO_EL_ACTION && //regardless of remaining HP/SP it can be cast + if( sd->skill_id_old != SO_EL_ACTION && //regardless of remaining HP/SP it can be cast (status_get_hp(&ed->bl) < req.hp || status_get_sp(&ed->bl) < req.sp) ) return 1; else @@ -453,14 +453,14 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned } //Otherwise, just cast the skill. - if( skill_get_inf(skillnum) & INF_GROUND_SKILL ) - unit_skilluse_pos(&ed->bl, bl->x, bl->y, skillnum, skilllv); + if( skill_get_inf(skill_id) & INF_GROUND_SKILL ) + unit_skilluse_pos(&ed->bl, bl->x, bl->y, skill_id, skill_lv); else - unit_skilluse_id(&ed->bl, bl->id, skillnum, skilllv); - + unit_skilluse_id(&ed->bl, bl->id, skill_id, skill_lv); + // Reset target. ed->target_id = 0; - + return 1; } @@ -470,40 +470,40 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned *-------------------------------------------------------------*/ int elemental_change_mode_ack(struct elemental_data *ed, int mode) { struct block_list *bl = &ed->master->bl; - short skillnum, skilllv; + uint16 skill_id, skill_lv; int i; - + nullpo_ret(ed); - + if( !bl ) return 0; - + // Select a skill. ARR_FIND(0, MAX_ELESKILLTREE, i, ed->db->skill[i].id && (ed->db->skill[i].mode&mode)); if( i == MAX_ELESKILLTREE ) return 0; - - skillnum = ed->db->skill[i].id; - skilllv = ed->db->skill[i].lv; - - if( elemental_skillnotok(skillnum, ed) ) + + skill_id = ed->db->skill[i].id; + skill_lv = ed->db->skill[i].lv; + + if( elemental_skillnotok(skill_id, ed) ) return 0; - + if( ed->ud.skilltimer != INVALID_TIMER ) return 0; else if( DIFF_TICK(gettick(), ed->ud.canact_tick) < 0 ) return 0; - + ed->target_id = bl->id; // Set new target ed->last_thinktime = gettick(); - - if( skill_get_inf(skillnum) & INF_GROUND_SKILL ) - unit_skilluse_pos(&ed->bl, bl->x, bl->y, skillnum, skilllv); + + if( skill_get_inf(skill_id) & INF_GROUND_SKILL ) + unit_skilluse_pos(&ed->bl, bl->x, bl->y, skill_id, skill_lv); else - unit_skilluse_id(&ed->bl,bl->id,skillnum,skilllv); - + unit_skilluse_id(&ed->bl,bl->id,skill_id,skill_lv); + ed->target_id = 0; // Reset target after casting the skill to avoid continious attack. - + return 1; } @@ -512,20 +512,20 @@ int elemental_change_mode_ack(struct elemental_data *ed, int mode) { *-------------------------------------------------------------*/ int elemental_change_mode(struct elemental_data *ed, int mode) { nullpo_ret(ed); - + // Remove target elemental_unlocktarget(ed); - + // Removes the effects of the previous mode. if(ed->elemental.mode != mode ) elemental_clean_effect(ed); - + ed->battle_status.mode = ed->elemental.mode = mode; - + // Normalize elemental mode to elemental skill mode. if( mode == EL_MODE_AGGRESSIVE ) mode = EL_SKILLMODE_AGGRESSIVE; // Aggressive spirit mode -> Aggressive spirit skill. else if( mode == EL_MODE_ASSIST ) mode = EL_SKILLMODE_ASSIST; // Assist spirit mode -> Assist spirit skill. else mode = EL_SKILLMODE_PASIVE; // Passive spirit mode -> Passive spirit skill. - + // Use a skill inmediately after every change mode. if( mode != EL_SKILLMODE_AGGRESSIVE ) elemental_change_mode_ack(ed,mode); @@ -546,56 +546,56 @@ int elemental_dead(struct elemental_data *ed) { int elemental_unlocktarget(struct elemental_data *ed) { nullpo_ret(ed); - + ed->target_id = 0; elemental_stop_attack(ed); elemental_stop_walking(ed,1); return 0; } -int elemental_skillnotok(int skillid, struct elemental_data *ed) { - int i = skill_get_index(skillid); +int elemental_skillnotok(uint16 skill_id, struct elemental_data *ed) { + int idx = skill_get_index(skill_id); nullpo_retr(1,ed); - - if (i == 0) + + if (idx == 0) return 1; // invalid skill id - - return skillnotok(skillid, ed->master); + + return skillnotok(skill_id, ed->master); } -struct skill_condition elemental_skill_get_requirements(int skill, int lv){ +struct skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 skill_lv){ struct skill_condition req; - int id = skill_get_index(skill); + int idx = skill_get_index(skill_id); memset(&req,0,sizeof(req)); - if( id == 0 ) // invalid skill id + if( idx == 0 ) // invalid skill id return req; - if( lv < 1 || lv > MAX_SKILL_LEVEL ) + if( skill_lv < 1 || skill_lv > MAX_SKILL_LEVEL ) return req; - req.hp = skill_db[id].hp[lv-1]; - req.sp = skill_db[id].sp[lv-1]; + req.hp = skill_db[idx].hp[skill_lv-1]; + req.sp = skill_db[idx].sp[skill_lv-1]; return req; } int elemental_set_target( struct map_session_data *sd, struct block_list *bl ) { struct elemental_data *ed = sd->ed; - + nullpo_ret(ed); nullpo_ret(bl); - + if( ed->bl.m != bl->m || !check_distance_bl(&ed->bl, bl, ed->db->range2) ) return 0; - + if( !status_check_skilluse(&ed->bl, bl, 0, 0) ) return 0; - + if( ed->target_id == 0 ) ed->target_id = bl->id; - + return 1; } @@ -603,19 +603,19 @@ static int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap struct elemental_data *ed; struct block_list **target; int dist; - + nullpo_ret(bl); - + ed = va_arg(ap,struct elemental_data *); target = va_arg(ap,struct block_list**); - + //If can't seek yet, not an enemy, or you can't attack it, skip. if( (*target) == bl || !status_check_skilluse(&ed->bl, bl, 0, 0) ) return 0; - + if( battle_check_target(&ed->bl,bl,BCT_ENEMY) <= 0 ) return 0; - + switch( bl->type ) { case BL_PC: if( !map_flag_vs(ed->bl.m) ) @@ -638,10 +638,10 @@ static int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, unsigned int tick) { struct block_list *target = NULL; int master_dist, view_range, mode; - + nullpo_ret(ed); nullpo_ret(sd); - + if( ed->bl.prev == NULL || sd == NULL || sd->bl.prev == NULL ) return 0; @@ -660,7 +660,7 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_ break; } - if( status_get_sp(&sd->bl) < sp ){ // Can't sustain delete it. + if( status_get_sp(&sd->bl) < sp ){ // Can't sustain delete it. elemental_delete(sd->ed,0); return 0; } @@ -668,28 +668,28 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_ status_zap(&sd->bl,0,sp); ed->last_spdrain_time = tick; } - + if( DIFF_TICK(tick,ed->last_thinktime) < MIN_ELETHINKTIME ) return 0; - + ed->last_thinktime = tick; - + if( ed->ud.skilltimer != INVALID_TIMER ) return 0; - + if( ed->ud.walktimer != INVALID_TIMER && ed->ud.walkpath.path_pos <= 2 ) return 0; //No thinking when you just started to walk. - + if(ed->ud.walkpath.path_pos < ed->ud.walkpath.path_len && ed->ud.target == sd->bl.id) return 0; //No thinking until be near the master. - + if( ed->sc.count && ed->sc.data[SC_BLIND] ) view_range = 3; else view_range = ed->db->range2; - + mode = status_get_mode(&ed->bl); - + master_dist = distance_bl(&sd->bl, &ed->bl); if( master_dist > AREA_SIZE ) { // Master out of vision range. elemental_unlocktarget(ed); @@ -705,42 +705,42 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_ return 0; //Already walking to him if( DIFF_TICK(tick, ed->ud.canmove_tick) < 0 ) return 0; //Can't move yet. - if( map_search_freecell(&ed->bl, sd->bl.m, &x, &y, MIN_ELEDISTANCE, MIN_ELEDISTANCE, 1) + if( map_search_freecell(&ed->bl, sd->bl.m, &x, &y, MIN_ELEDISTANCE, MIN_ELEDISTANCE, 1) && unit_walktoxy(&ed->bl, x, y, 0) ) return 0; } - + if( mode == EL_MODE_AGGRESSIVE ) { target = map_id2bl(ed->ud.target); - + if( !target ) map_foreachinrange(elemental_ai_sub_timer_activesearch, &ed->bl, view_range, BL_CHAR, ed, &target, status_get_mode(&ed->bl)); - + if( !target ) { //No targets available. elemental_unlocktarget(ed); return 1; } - + if( battle_check_range(&ed->bl,target,view_range) && rnd()%100 < 2 ) { // 2% chance to cast attack skill. if( elemental_action(ed,target,tick) ) return 1; } - + //Attempt to attack. //At this point we know the target is attackable, we just gotta check if the range matches. if( ed->ud.target == target->id && ed->ud.attacktimer != INVALID_TIMER ) //Already locked. return 1; - + if( battle_check_range(&ed->bl, target, ed->base_status.rhw.range) ) {//Target within range, engage unit_attack(&ed->bl,target->id,1); return 1; } - + //Follow up if possible. if( !unit_walktobl(&ed->bl, target, ed->base_status.rhw.range, 2) ) elemental_unlocktarget(ed); } - + return 0; } @@ -748,7 +748,7 @@ static int elemental_ai_sub_foreachclient(struct map_session_data *sd, va_list a unsigned int tick = va_arg(ap,unsigned int); if(sd->status.ele_id && sd->ed) elemental_ai_sub_timer(sd->ed,sd,tick); - + return 0; } @@ -764,24 +764,24 @@ int read_elementaldb(void) { int i, j = 0, k = 0, ele; struct s_elemental_db *db; struct status_data *status; - + sprintf(line, "%s/%s", db_path, "elemental_db.txt"); memset(elemental_db,0,sizeof(elemental_db)); - + fp = fopen(line, "r"); if( !fp ) { ShowError("read_elementaldb : can't read elemental_db.txt\n"); return -1; } - + while( fgets(line, sizeof(line), fp) && j < MAX_ELEMENTAL_CLASS ) { k++; if( line[0] == '/' && line[1] == '/' ) continue; - + if( line[0] == '\0' || line[0] == '\n' || line[0] == '\r') continue; - + i = 0; p = strtok(line, ","); while( p != NULL && i < 26 ) { @@ -792,16 +792,16 @@ int read_elementaldb(void) { ShowError("read_elementaldb : Incorrect number of columns at elemental_db.txt line %d.\n", k); continue; } - + db = &elemental_db[j]; db->class_ = atoi(str[0]); strncpy(db->sprite, str[1], NAME_LENGTH); strncpy(db->name, str[2], NAME_LENGTH); db->lv = atoi(str[3]); - + status = &db->status; db->vd.class_ = db->class_; - + status->max_hp = atoi(str[4]); status->max_sp = atoi(str[5]); status->rhw.range = atoi(str[6]); @@ -819,7 +819,7 @@ int read_elementaldb(void) { db->range3 = atoi(str[18]); status->size = atoi(str[19]); status->race = atoi(str[20]); - + ele = atoi(str[21]); status->def_ele = ele%10; status->ele_lv = ele/20; @@ -831,19 +831,19 @@ int read_elementaldb(void) { ShowWarning("Elemental %d has invalid element level %d (max is 4)\n", db->class_, status->ele_lv); status->ele_lv = 1; } - + status->aspd_rate = 1000; status->speed = atoi(str[22]); status->adelay = atoi(str[23]); status->amotion = atoi(str[24]); status->dmotion = atoi(str[25]); - + j++; } - + fclose(fp); ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' elementals in '"CL_WHITE"db/elemental_db.txt"CL_RESET"'.\n",j); - + return 0; } @@ -853,23 +853,23 @@ int read_elemental_skilldb(void) { char *str[4]; struct s_elemental_db *db; int i, j = 0, k = 0, class_; - int skillid, skilllv, skillmode; - + uint16 skill_id, skill_lv, skillmode; + sprintf(line, "%s/%s", db_path, "elemental_skill_db.txt"); fp = fopen(line, "r"); if( !fp ) { ShowError("read_elemental_skilldb : can't read elemental_skill_db.txt\n"); return -1; } - + while( fgets(line, sizeof(line), fp) ) { k++; if( line[0] == '/' && line[1] == '/' ) continue; if( line[0] == '\0' || line[0] == '\n' || line[0] == '\r') - continue; - + continue; + i = 0; p = strtok(line, ","); while( p != NULL && i < 4 ) { @@ -880,39 +880,39 @@ int read_elemental_skilldb(void) { ShowError("read_elemental_skilldb : Incorrect number of columns at elemental_skill_db.txt line %d.\n", k); continue; } - + class_ = atoi(str[0]); ARR_FIND(0, MAX_ELEMENTAL_CLASS, i, class_ == elemental_db[i].class_); if( i == MAX_ELEMENTAL_CLASS ) { ShowError("read_elemental_skilldb : Class not found in elemental_db for skill entry, line %d.\n", k); continue; } - - skillid = atoi(str[1]); - if( skillid < EL_SKILLBASE || skillid >= EL_SKILLBASE + MAX_ELEMENTALSKILL ) { + + skill_id = atoi(str[1]); + if( skill_id < EL_SKILLBASE || skill_id >= EL_SKILLBASE + MAX_ELEMENTALSKILL ) { ShowError("read_elemental_skilldb : Skill out of range, line %d.\n", k); continue; } - + db = &elemental_db[i]; - skilllv = atoi(str[2]); - + skill_lv = atoi(str[2]); + skillmode = atoi(str[3]); if( skillmode < EL_SKILLMODE_PASIVE || skillmode > EL_SKILLMODE_AGGRESSIVE ) { ShowError("read_elemental_skilldb : Skillmode out of range, line %d.\n",k); continue; } - ARR_FIND( 0, MAX_ELESKILLTREE, i, db->skill[i].id == 0 || db->skill[i].id == skillid ); + ARR_FIND( 0, MAX_ELESKILLTREE, i, db->skill[i].id == 0 || db->skill[i].id == skill_id ); if( i == MAX_ELESKILLTREE ) { - ShowWarning("Unable to load skill %d into Elemental %d's tree. Maximum number of skills per elemental has been reached.\n", skillid, class_); + ShowWarning("Unable to load skill %d into Elemental %d's tree. Maximum number of skills per elemental has been reached.\n", skill_id, class_); continue; } - db->skill[i].id = skillid; - db->skill[i].lv = skilllv; + db->skill[i].id = skill_id; + db->skill[i].lv = skill_lv; db->skill[i].mode = skillmode; j++; } - + fclose(fp); ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"db/elemental_skill_db.txt"CL_RESET"'.\n",j); return 0; @@ -930,10 +930,10 @@ void reload_elemental_skilldb(void) { int do_init_elemental(void) { read_elementaldb(); read_elemental_skilldb(); - + add_timer_func_list(elemental_ai_timer,"elemental_ai_timer"); add_timer_interval(gettick()+MIN_ELETHINKTIME,elemental_ai_timer,0,0,MIN_ELETHINKTIME); - + return 0; } diff --git a/src/map/elemental.h b/src/map/elemental.h index ce8818563..f941f3dfd 100644 --- a/src/map/elemental.h +++ b/src/map/elemental.h @@ -43,14 +43,14 @@ struct elemental_data { struct status_data base_status, battle_status; struct status_change sc; struct regen_data regen; - + struct s_elemental_db *db; struct s_elemental elemental; - + struct map_session_data *master; int summon_timer; int skill_timer; - + unsigned last_thinktime, last_linktime, last_spdrain_time; short min_chase; int target_id, attacked_id; @@ -75,12 +75,12 @@ void elemental_summon_stop(struct elemental_data *ed); int elemental_get_lifetime(struct elemental_data *ed); int elemental_unlocktarget(struct elemental_data *ed); -int elemental_skillnotok(int skillid, struct elemental_data *ed); +int elemental_skillnotok(uint16 skill_id, struct elemental_data *ed); int elemental_set_target( struct map_session_data *sd, struct block_list *bl ); -int elemental_clean_single_effect(struct elemental_data *ed, int skill_num); +int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id); int elemental_clean_effect(struct elemental_data *ed); int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned int tick); -struct skill_condition elemental_skill_get_requirements(int skill, int lv); +struct skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 skill_lv); #define elemental_stop_walking(ed, type) unit_stop_walking(&(ed)->bl, type) #define elemental_stop_attack(ed) unit_stop_attack(&(ed)->bl) diff --git a/src/map/guild.c b/src/map/guild.c index f1d81b081..4e256fbd0 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -96,7 +96,7 @@ int guild_skill_get_max (int id) return guild_skill_tree[id-GD_SKILLBASE].max; } -// Retrive skilllv learned by guild +// Retrive skill_lv learned by guild int guild_checkskill(struct guild *g, int id) { int idx = id - GD_SKILLBASE; @@ -110,18 +110,18 @@ int guild_checkskill(struct guild *g, int id) { *------------------------------------------*/ static bool guild_read_guildskill_tree_db(char* split[], int columns, int current) {// <skill id>,<max lv>,<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5> - int k, id, skillid; + int k, id, skill_id; - skillid = atoi(split[0]); - id = skillid - GD_SKILLBASE; + skill_id = atoi(split[0]); + id = skill_id - GD_SKILLBASE; if( id < 0 || id >= MAX_GUILDSKILL ) { - ShowWarning("guild_read_guildskill_tree_db: Invalid skill id %d.\n", skillid); + ShowWarning("guild_read_guildskill_tree_db: Invalid skill id %d.\n", skill_id); return false; } - guild_skill_tree[id].id = skillid; + guild_skill_tree[id].id = skill_id; guild_skill_tree[id].max = atoi(split[1]); if( guild_skill_tree[id].id == GD_GLORYGUILD && battle_config.require_glory_guild && guild_skill_tree[id].max == 0 ) @@ -1238,13 +1238,13 @@ int guild_getexp(struct map_session_data *sd,int exp) } /*==================================================== - * Ask to increase guildskill skill_num + * Ask to increase guildskill skill_id *---------------------------------------------------*/ -int guild_skillup(TBL_PC* sd, int skill_num) +int guild_skillup(TBL_PC* sd, uint16 skill_id) { struct guild* g; - int idx = skill_num - GD_SKILLBASE; - int max = guild_skill_get_max(skill_num); + int idx = skill_id - GD_SKILLBASE; + int max = guild_skill_get_max(skill_id); nullpo_ret(sd); @@ -1256,15 +1256,15 @@ int guild_skillup(TBL_PC* sd, int skill_num) if( g->skill_point > 0 && g->skill[idx].id != 0 && g->skill[idx].lv < max ) - intif_guild_skillup(g->guild_id, skill_num, sd->status.account_id, max); + intif_guild_skillup(g->guild_id, skill_id, sd->status.account_id, max); return 0; } /*==================================================== - * Notification of guildskill skill_num increase request + * Notification of guildskill skill_id increase request *---------------------------------------------------*/ -int guild_skillupack(int guild_id,int skill_num,int account_id) +int guild_skillupack(int guild_id,uint16 skill_id,int account_id) { struct map_session_data *sd=map_id2sd(account_id); struct guild *g=guild_search(guild_id); @@ -1272,15 +1272,15 @@ int guild_skillupack(int guild_id,int skill_num,int account_id) if(g==NULL) return 0; if( sd != NULL ) { - clif_guild_skillup(sd,skill_num,g->skill[skill_num-GD_SKILLBASE].lv); + clif_guild_skillup(sd,skill_id,g->skill[skill_id-GD_SKILLBASE].lv); /* Guild Aura handling */ - switch( skill_num ) { + switch( skill_id ) { case GD_LEADERSHIP: case GD_GLORYWOUNDS: case GD_SOULCOLD: case GD_HAWKEYES: - guild_guildaura_refresh(sd,skill_num,g->skill[skill_num-GD_SKILLBASE].lv); + guild_guildaura_refresh(sd,skill_id,g->skill[skill_id-GD_SKILLBASE].lv); break; } } @@ -1293,9 +1293,9 @@ int guild_skillupack(int guild_id,int skill_num,int account_id) return 0; } -void guild_guildaura_refresh(struct map_session_data *sd, int skill_num, int skill_lv) { +void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { struct skill_unit_group* group = NULL; - int type = status_skill2sc(skill_num); + int type = status_skill2sc(skill_id); if( !(battle_config.guild_aura&((agit_flag || agit2_flag)?2:1)) && !(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)) ) return; @@ -1305,7 +1305,7 @@ void guild_guildaura_refresh(struct map_session_data *sd, int skill_num, int ski skill_delunitgroup(group); status_change_end(&sd->bl,type,INVALID_TIMER); } - group = skill_unitsetting(&sd->bl,skill_num,skill_lv,sd->bl.x,sd->bl.y,0); + group = skill_unitsetting(&sd->bl,skill_id,skill_lv,sd->bl.x,sd->bl.y,0); if( group ) { sc_start4(&sd->bl,type,100,(battle_config.guild_aura&16)?0:skill_lv,0,0,group->group_id,600000);//duration doesn't matter these status never end with val4 } @@ -1335,10 +1335,10 @@ int guild_get_alliance_count(struct guild *g,int flag) // Blocks all guild skills which have a common delay time. void guild_block_skill(struct map_session_data *sd, int time) { - int skill_num[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL }; + uint16 skill_id[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL }; int i; for (i = 0; i < 4; i++) - skill_blockpc_start_(sd, skill_num[i], time , true); + skill_blockpc_start_(sd, skill_id[i], time , true); } /*==================================================== diff --git a/src/map/guild.h b/src/map/guild.h index 3e7b98f59..0df93d138 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -60,7 +60,7 @@ int guild_member_withdraw(int guild_id,int account_id,int char_id,int flag, const char *name,const char *mes); int guild_expulsion(struct map_session_data *sd,int guild_id, int account_id,int char_id,const char *mes); -int guild_skillup(struct map_session_data* sd, int skill_num); +int guild_skillup(struct map_session_data* sd, uint16 skill_id); void guild_block_skill(struct map_session_data *sd, int time); int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd); int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag); @@ -84,7 +84,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data); int guild_send_message(struct map_session_data *sd,const char *mes,int len); int guild_recv_message(int guild_id,int account_id,const char *mes,int len); int guild_send_dot_remove(struct map_session_data *sd); -int guild_skillupack(int guild_id,int skill_num,int account_id); +int guild_skillupack(int guild_id,uint16 skill_id,int account_id); int guild_break(struct map_session_data *sd,char *name); int guild_broken(int guild_id,int flag); int guild_gm_change(int guild_id, struct map_session_data *sd); @@ -105,7 +105,7 @@ void guild_flag_add(struct npc_data *nd); void guild_flag_remove(struct npc_data *nd); void guild_flags_clear(void); -void guild_guildaura_refresh(struct map_session_data *sd, int skill_num, int skill_lv); +void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); void do_final_guild(void); diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 8f54481ff..081287d8a 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -250,7 +250,7 @@ int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve) return 0; } -int merc_hom_checkskill(struct homun_data *hd,int skill_id) +int merc_hom_checkskill(struct homun_data *hd,uint16 skill_id) { int i = skill_id - HM_SKILLBASE; if(!hd) @@ -263,15 +263,15 @@ int merc_hom_checkskill(struct homun_data *hd,int skill_id) } int merc_skill_tree_get_max(int id, int b_class){ - int i, skillid; + int i, skill_id; b_class -= HM_CLASS_BASE; - for(i=0;(skillid=hskill_tree[b_class][i].id)>0;i++) - if (id == skillid) + for(i=0;(skill_id=hskill_tree[b_class][i].id)>0;i++) + if (id == skill_id) return hskill_tree[b_class][i].max; return skill_get_max(id); } -void merc_hom_skillup(struct homun_data *hd,int skillnum) +void merc_hom_skillup(struct homun_data *hd,uint16 skill_id) { int i = 0 ; nullpo_retv(hd); @@ -279,18 +279,18 @@ void merc_hom_skillup(struct homun_data *hd,int skillnum) if(hd->homunculus.vaporize) return; - i = skillnum - HM_SKILLBASE; + i = skill_id - HM_SKILLBASE; if(hd->homunculus.skillpts > 0 && hd->homunculus.hskill[i].id && hd->homunculus.hskill[i].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex] - hd->homunculus.hskill[i].lv < merc_skill_tree_get_max(skillnum, hd->homunculus.class_) + hd->homunculus.hskill[i].lv < merc_skill_tree_get_max(skill_id, hd->homunculus.class_) ) { hd->homunculus.hskill[i].lv++; hd->homunculus.skillpts-- ; status_calc_homunculus(hd,0); if (hd->master) { - clif_homskillup(hd->master, skillnum); + clif_homskillup(hd->master, skill_id); clif_hominfo(hd->master,hd,0); clif_homskillinfoblock(hd->master); } diff --git a/src/map/homunculus.h b/src/map/homunculus.h index aafcb8132..50e82eeac 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -95,9 +95,9 @@ struct view_data* merc_get_hom_viewdata(int class_); int hom_class2mapid(int hom_class); void merc_damage(struct homun_data *hd); int merc_hom_dead(struct homun_data *hd); -void merc_hom_skillup(struct homun_data *hd,int skillnum); +void merc_hom_skillup(struct homun_data *hd,uint16 skill_id); int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve); -int merc_hom_checkskill(struct homun_data *hd,int skill_id); +int merc_hom_checkskill(struct homun_data *hd,uint16 skill_id); int merc_hom_gainexp(struct homun_data *hd,int exp); int merc_hom_levelup(struct homun_data *hd); int merc_hom_evolution(struct homun_data *hd); diff --git a/src/map/instance.c b/src/map/instance.c index f5ae125a6..44a208866 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -98,12 +98,13 @@ int instance_create(int party_id, const char *name) *--------------------------------------*/ int instance_add_map(const char *name, int instance_id, bool usebasename) { - int m = map_mapname2mapid(name), i, im = -1; + int16 m = map_mapname2mapid(name); + int i, im = -1; size_t num_cell, size; if( m < 0 ) return -1; // source map not found - + if( !instance_is_valid(instance_id) ) { ShowError("instance_add_map: trying to attach '%s' map to non-existing instance %d.\n", name, instance_id); @@ -171,7 +172,7 @@ int instance_add_map(const char *name, int instance_id, bool usebasename) * party_id : source party of this instance * type : result (0 = map id | 1 = instance id) *--------------------------------------*/ -int instance_map2imap(int m, int instance_id) +int instance_map2imap(int16 m, int instance_id) { int i; @@ -179,7 +180,7 @@ int instance_map2imap(int m, int instance_id) { return -1; } - + for( i = 0; i < instance[instance_id].num_map; i++ ) { if( instance[instance_id].map[i] && map[instance[instance_id].map[i]].instance_src_map == m ) @@ -193,7 +194,7 @@ int instance_map2imap(int m, int instance_id) * instance_id : where to search * result : mapid of map "m" in this instance *--------------------------------------*/ -int instance_mapid2imapid(int m, int instance_id) +int instance_mapid2imapid(int16 m, int instance_id) { if( map[m].flag.src4instance == 0 ) return m; // not instances found for this map @@ -216,7 +217,7 @@ int instance_mapid2imapid(int m, int instance_id) int instance_map_npcsub(struct block_list* bl, va_list args) { struct npc_data* nd = (struct npc_data*)bl; - int m = va_arg(args, int); // Destination Map + int16 m = va_arg(args, int); // Destination Map npc_duplicate4instance(nd, m); return 1; @@ -245,7 +246,7 @@ void instance_init(int instance_id) *--------------------------------------*/ int instance_del_load(struct map_session_data* sd, va_list args) { - int m = va_arg(args,int); + int16 m = va_arg(args,int); if( !sd || sd->bl.m != m ) return 0; @@ -256,7 +257,7 @@ int instance_del_load(struct map_session_data* sd, va_list args) /* for npcs behave differently when being unloaded within a instance */ int instance_cleanup_sub(struct block_list *bl, va_list ap) { nullpo_ret(bl); - + switch(bl->type) { case BL_PC: map_quit((struct map_session_data *) bl); @@ -277,14 +278,14 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) { skill_delunit((struct skill_unit *) bl); break; } - + return 1; } /*-------------------------------------- * Removes a simple instance map *--------------------------------------*/ -void instance_del_map(int m) +void instance_del_map(int16 m) { int i; if( m <= 0 || !map[m].instance_id ) @@ -323,7 +324,7 @@ void instance_del_map(int m) map_removemapdb(&map[m]); memset(&map[m], 0x00, sizeof(map[0])); - + /* for it is default and makes it not try to delete a non-existent timer since we did not delete this entry. */ map[m].mob_delete_timer = INVALID_TIMER; } @@ -421,7 +422,7 @@ void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsign if( !instance_is_valid(instance_id) ) return; - + if( instance[instance_id].progress_timer != INVALID_TIMER ) delete_timer( instance[instance_id].progress_timer, instance_destroy_timer); if( instance[instance_id].idle_timer != INVALID_TIMER ) @@ -437,7 +438,7 @@ void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsign instance[instance_id].progress_timeout = 0; instance[instance_id].progress_timer = INVALID_TIMER; } - + if( idle_timeout ) { instance[instance_id].idle_timeoutval = idle_timeout; @@ -460,7 +461,7 @@ void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsign *--------------------------------------*/ void instance_check_kick(struct map_session_data *sd) { - int m = sd->bl.m; + int16 m = sd->bl.m; clif_instance_leave(sd->fd); if( map[m].instance_id ) diff --git a/src/map/instance.h b/src/map/instance.h index f8f7387f7..03b0d0898 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -22,7 +22,7 @@ struct s_instance { int users; struct DBMap* vars; // Instance Variable for scripts - + int progress_timer; time_t progress_timeout; @@ -35,9 +35,9 @@ extern struct s_instance instance[MAX_INSTANCE]; int instance_create(int party_id, const char *name); int instance_add_map(const char *name, int instance_id, bool usebasename); -void instance_del_map(int m); -int instance_map2imap(int m, int instance_id); -int instance_mapid2imapid(int m, int instance_id); +void instance_del_map(int16 m); +int instance_map2imap(int16 m, int instance_id); +int instance_mapid2imapid(int16 m, int instance_id); void instance_destroy(int instance_id); void instance_init(int instance_id); diff --git a/src/map/intif.c b/src/map/intif.c index 5f3eb374e..9391e0275 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -463,7 +463,7 @@ int intif_party_leave(int party_id,int account_id, int char_id) // Request keeping party for new map ?? int intif_party_changemap(struct map_session_data *sd,int online) { - int m, mapindex; + int16 m, mapindex; if (CheckForCharServer()) return 0; @@ -702,15 +702,15 @@ int intif_guild_position(int guild_id,int idx,struct guild_position *p) return 0; } -// Request an update of Guildskill skillnum -int intif_guild_skillup(int guild_id, int skill_num, int account_id, int max) +// Request an update of Guildskill skill_id +int intif_guild_skillup(int guild_id, uint16 skill_id, int account_id, int max) { if( CheckForCharServer() ) return 0; WFIFOHEAD(inter_fd, 18); WFIFOW(inter_fd, 0) = 0x303c; WFIFOL(inter_fd, 2) = guild_id; - WFIFOL(inter_fd, 6) = skill_num; + WFIFOL(inter_fd, 6) = skill_id; WFIFOL(inter_fd, 10) = account_id; WFIFOL(inter_fd, 14) = max; WFIFOSET(inter_fd, 18); diff --git a/src/map/intif.h b/src/map/intif.h index 081667545..65cc19830 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -54,7 +54,7 @@ int intif_guild_change_gm(int guild_id, const char* name, int len); int intif_guild_change_basicinfo(int guild_id, int type, const void *data, int len); int intif_guild_change_memberinfo(int guild_id, int account_id, int char_id, int type, const void *data, int len); int intif_guild_position(int guild_id, int idx, struct guild_position *p); -int intif_guild_skillup(int guild_id, int skill_num, int account_id, int max); +int intif_guild_skillup(int guild_id, uint16 skill_id, int account_id, int max); int intif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); int intif_guild_notice(int guild_id, const char *mes1, const char *mes2); int intif_guild_emblem(int guild_id, int len, const char *data); diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 4d4b62818..2bc418cc4 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -85,7 +85,7 @@ enum { #define UNKNOWN_ITEM_ID 512 struct item_data { - int nameid; + uint16 nameid; char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH]; //Do not add stuff between value_buy and view_id (see how getiteminfo works) diff --git a/src/map/log.c b/src/map/log.c index 749bd5c28..8a114d989 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -172,7 +172,7 @@ void log_branch(struct map_session_data* sd) } /// logs item transactions (generic) -void log_pick(int id, int m, e_log_pick_type type, int amount, struct item* itm) +void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* itm) { nullpo_retv(itm); if( ( log_config.enable_logs&type ) == 0 ) @@ -287,7 +287,7 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp) e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ", log_config.log_mvpdrop, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex)); queryThread_log(entry,e_length); -#else +#else if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ", log_config.log_mvpdrop, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex)) ) { @@ -328,7 +328,7 @@ void log_atcommand(struct map_session_data* sd, const char* message) int e_length = 0; e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`atcommand_date`, `account_id`, `char_id`, `char_name`, `map`, `command`) VALUES (NOW(), '%d', '%d', '%s', '%s', '%s')", log_config.log_gm, sd->status.account_id, sd->status.char_id, sd->status.name ,mapindex_id2name(sd->mapindex), message); queryThread_log(entry,e_length); -#else +#else SqlStmt* stmt; stmt = SqlStmt_Malloc(logmysql_handle); @@ -375,7 +375,7 @@ void log_npc(struct map_session_data* sd, const char* message) int e_length = 0; e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`npc_date`, `account_id`, `char_id`, `char_name`, `map`, `mes`) VALUES (NOW(), '%d', '%d', '%s', '%s', '%s')", log_config.log_npc, sd->status.account_id, sd->status.char_id, sd->status.name, mapindex_id2name(sd->mapindex), message ); queryThread_log(entry,e_length); -#else +#else SqlStmt* stmt; stmt = SqlStmt_Malloc(logmysql_handle); if( SQL_SUCCESS != SqlStmt_Prepare(stmt, LOG_QUERY " INTO `%s` (`npc_date`, `account_id`, `char_id`, `char_name`, `map`, `mes`) VALUES (NOW(), '%d', '%d', ?, '%s', ?)", log_config.log_npc, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) ) @@ -425,7 +425,7 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, int e_length = 0; e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`time`, `type`, `type_id`, `src_charid`, `src_accountid`, `src_map`, `src_map_x`, `src_map_y`, `dst_charname`, `message`) VALUES (NOW(), '%c', '%d', '%d', '%d', '%s', '%d', '%d', '%s', '%s')", log_config.log_chat, log_chattype2char(type), type_id, src_charid, src_accid, map, x, y, dst_charname, message ); queryThread_log(entry,e_length); -#else +#else SqlStmt* stmt; stmt = SqlStmt_Malloc(logmysql_handle); diff --git a/src/map/map.c b/src/map/map.c index 60d063f7a..f6468e180 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -277,7 +277,8 @@ static void map_delblcell(struct block_list *bl) *------------------------------------------*/ int map_addblock(struct block_list* bl) { - int m, x, y, pos; + int16 m, x, y; + int pos; nullpo_ret(bl); @@ -475,7 +476,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) /*========================================== * Counts specified number of objects on given cell. *------------------------------------------*/ -int map_count_oncell(int m, int x, int y, int type) +int map_count_oncell(int16 m, int16 x, int16 y, int type) { int bx,by; struct block_list *bl; @@ -503,8 +504,8 @@ int map_count_oncell(int m, int x, int y, int type) * Looks for a skill unit on a given cell * flag&1: runs battle_check_target check based on unit->group->target_flag */ -struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int x,int y,int skill_id,struct skill_unit* out_unit, int flag) { - int m,bx,by; +struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x,int16 y,uint16 skill_id,struct skill_unit* out_unit, int flag) { + int16 m,bx,by; struct block_list *bl; struct skill_unit *unit; m = target->m; @@ -532,7 +533,7 @@ struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int x,in /*========================================== * Adapted from foreachinarea for an easier invocation. [Skotlex] *------------------------------------------*/ -int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int type, ...) +int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...) { int bx, by, m; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -561,7 +562,7 @@ int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_lis } } } - + if( type&BL_MOB ) for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for(bx=x0/BLOCK_SIZE;bx<=x1/BLOCK_SIZE;bx++) { @@ -597,7 +598,7 @@ int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_lis /*========================================== * Same as foreachinrange, but there must be a shoot-able range between center and target to be counted in. [Skotlex] *------------------------------------------*/ -int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block_list* center, int range, int type,...) +int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block_list* center, int16 range, int type,...) { int bx, by, m; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -605,7 +606,7 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block int blockcount = bl_list_count, i; int x0, x1, y0, y1; va_list ap; - + m = center->m; if ( m < 0 ) return 0; @@ -668,22 +669,22 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block * Apply *func with ... arguments for the range. * @type = BL_PC/BL_MOB etc.. *------------------------------------------*/ -int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int type, ...) +int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...) { int bx, by; int returnCount = 0; //total sum of returned values of func() [Skotlex] struct block_list *bl; int blockcount = bl_list_count, i; va_list ap; - + if ( m < 0 ) return 0; - + if ( x1 < x0 ) swap(x0, x1); if ( y1 < y0 ) swap(y0, y1); - + x0 = max(x0, 0); y0 = max(y0, 0); x1 = min(x1, map[ m ].xs - 1); @@ -722,7 +723,7 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, in /*========================================== * Adapted from forcountinarea for an easier invocation. [pakpil] *------------------------------------------*/ -int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int count, int type, ...) +int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...) { int bx, by, m; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -730,7 +731,7 @@ int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_li int blockcount = bl_list_count, i; int x0, x1, y0, y1; va_list ap; - + m = center->m; x0 = max(center->x - range, 0); y0 = max(center->y - range, 0); @@ -784,22 +785,22 @@ int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_li bl_list_count = blockcount; return returnCount; //[Skotlex] } -int map_forcountinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int count, int type, ...) +int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...) { int bx, by; int returnCount = 0; //total sum of returned values of func() [Skotlex] struct block_list *bl; int blockcount = bl_list_count, i; va_list ap; - + if ( m < 0 ) return 0; - + if ( x1 < x0 ) swap(x0, x1); if ( y1 < y0 ) swap(y0, y1); - + x0 = max(x0, 0); y0 = max(y0, 0); x1 = min(x1, map[ m ].xs - 1); @@ -844,7 +845,7 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int m, int x0, i * Move bl and do func* with va_list while moving. * Mouvement is set by dx dy wich are distance in x and y *------------------------------------------*/ -int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int dx, int dy, int type, ...) +int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...) { int bx, by, m; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -855,7 +856,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ if ( !range ) return 0; if ( !dx && !dy ) return 0; //No movement. - + m = center->m; x0 = center->x - range; @@ -867,7 +868,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ swap(x0, x1); if ( y1 < y0 ) swap(y0, y1); - + if( dx == 0 || dy == 0 ) { //Movement along one axis only. if( dx == 0 ){ @@ -881,12 +882,12 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ else //East x1 = x0 + dx - 1; } - + x0 = max(x0, 0); y0 = max(y0, 0); x1 = min(x1, map[ m ].xs - 1); y1 = min(y1, map[ m ].ys - 1); - + for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) { if ( type&~BL_MOB ) { @@ -909,12 +910,12 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ } } } else { // Diagonal movement - + x0 = max(x0, 0); y0 = max(y0, 0); x1 = min(x1, map[ m ].xs - 1); y1 = min(y1, map[ m ].ys - 1); - + for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) { if ( type & ~BL_MOB ) { @@ -969,7 +970,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ // which only checks the exact single x/y passed to it rather than an // area radius - may be more useful in some instances) // -int map_foreachincell(int (*func)(struct block_list*,va_list), int m, int x, int y, int type, ...) +int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x, int16 y, int type, ...) { int bx, by; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -1012,7 +1013,7 @@ int map_foreachincell(int (*func)(struct block_list*,va_list), int m, int x, int /*============================================================ * For checking a path between two points (x0, y0) and (x1, y1) *------------------------------------------------------------*/ -int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y0,int x1,int y1,int range,int length, int type,...) +int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,int16 y0,int16 x1,int16 y1,int16 range,int length, int type,...) { int returnCount = 0; //total sum of returned values of func() [Skotlex] ////////////////////////////////////////////////////////////// @@ -1057,7 +1058,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y int k, xi, yi, xu, yu; int mx0 = x0, mx1 = x1, my0 = y0, my1 = y1; va_list ap; - + //Avoid needless calculations by not getting the sqrt right away. #define MAGNITUDE2(x0, y0, x1, y1) ( ( ( x1 ) - ( x0 ) ) * ( ( x1 ) - ( x0 ) ) + ( ( y1 ) - ( y0 ) ) * ( ( y1 ) - ( y0 ) ) ) @@ -1113,7 +1114,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y yi = bl->y; k = ( xi - x0 ) * ( x1 - x0 ) + ( yi - y0 ) * ( y1 - y0 ); - + if ( k < 0 || k > len_limit ) //Since more skills use this, check for ending point as well. continue; @@ -1146,7 +1147,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y xi = bl->x; yi = bl->y; k = ( xi - x0 ) * ( x1 - x0 ) + ( yi - y0 ) * ( y1 - y0 ); - + if ( k < 0 || k > len_limit ) continue; @@ -1190,14 +1191,14 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y } // Copy of map_foreachincell, but applied to the whole map. [Skotlex] -int map_foreachinmap(int (*func)(struct block_list*,va_list), int m, int type,...) +int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type,...) { int b, bsize; int returnCount = 0; //total sum of returned values of func() [Skotlex] struct block_list *bl; int blockcount = bl_list_count, i; va_list ap; - + bsize = map[ m ].bxs * map[ m ].bys; if( type&~BL_MOB ) @@ -1286,15 +1287,15 @@ int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data) return 0; } -/* +/* * clears a single bl item out of the bazooonga. */ void map_clearflooritem(struct block_list *bl) { struct flooritem_data* fitem = (struct flooritem_data*)bl; - + if( fitem->cleartimer ) delete_timer(fitem->cleartimer,map_clearflooritem_timer); - + clif_clearflooritem(fitem, 0); map_deliddb(&fitem->bl); map_delblock(&fitem->bl); @@ -1306,7 +1307,7 @@ void map_clearflooritem(struct block_list *bl) { * to place an BL_ITEM object. Scan area is 9x9, returns 1 on success. * x and y are modified with the target cell when successful. *------------------------------------------*/ -int map_searchrandfreecell(int m,int *x,int *y,int stack) { +int map_searchrandfreecell(int16 m,int16 *x,int16 *y,int stack) { int free_cell,i,j; int free_cells[9][2]; @@ -1351,7 +1352,7 @@ static int map_count_sub(struct block_list *bl,va_list ap) * &2 = the target should be able to walk to the target tile. * &4 = there shouldn't be any players around the target tile (use the no_spawn_on_player setting) *------------------------------------------*/ -int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx, int ry, int flag) +int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int16 rx, int16 ry, int flag) { int tries, spawn=0; int bx, by; @@ -1424,7 +1425,7 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx * @first_charid, @second_charid, @third_charid, looting priority * @flag: &1 MVP item. &2 do stacking check. *------------------------------------------*/ -int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_charid,int second_charid,int third_charid,int flags) +int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags) { int r; struct flooritem_data *fitem=NULL; @@ -1706,7 +1707,7 @@ int map_quit(struct map_session_data *sd) { if( map[sd->bl.m].instance_id ) { // Avoid map conflicts and warnings on next login - int m; + int16 m; struct point *pt; if( map[sd->bl.m].save.map ) pt = &map[sd->bl.m].save; @@ -1865,7 +1866,7 @@ bool map_blid_exists( int id ) { /*========================================== * Convext Mirror *------------------------------------------*/ -struct mob_data * map_getmob_boss(int m) +struct mob_data * map_getmob_boss(int16 m) { DBIterator* iter; struct mob_data *md = NULL; @@ -2154,7 +2155,7 @@ bool mapit_exists(struct s_mapiterator* mapit) /*========================================== * Add npc-bl to id_db, basically register npc to map *------------------------------------------*/ -bool map_addnpc(int m,struct npc_data *nd) +bool map_addnpc(int16 m,struct npc_data *nd) { nullpo_ret(nd); @@ -2190,7 +2191,7 @@ int map_addmobtolist(unsigned short m, struct spawn_data *spawn) return -1; } -void map_spawnmobs(int m) +void map_spawnmobs(int16 m) { int i, k=0; if (map[m].mob_delete_timer != INVALID_TIMER) @@ -2242,7 +2243,7 @@ int map_removemobs_sub(struct block_list *bl, va_list ap) int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data) { int count; - const int m = id; + const int16 m = id; if (m < 0 || m >= MAX_MAP_PER_SERVER) { //Incorrect map id! @@ -2266,7 +2267,7 @@ int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data) return 1; } -void map_removemobs(int m) +void map_removemobs(int16 m) { if (map[m].mob_delete_timer != INVALID_TIMER) // should never happen return; //Mobs are already scheduled for removal @@ -2277,7 +2278,7 @@ void map_removemobs(int m) /*========================================== * Hookup, get map_id from map_name *------------------------------------------*/ -int map_mapname2mapid(const char* name) +int16 map_mapname2mapid(const char* name) { unsigned short map_index; map_index = mapindex_name2id(name); @@ -2289,7 +2290,7 @@ int map_mapname2mapid(const char* name) /*========================================== * Returns the map of the given mapindex. [Skotlex] *------------------------------------------*/ -int map_mapindex2mapid(unsigned short mapindex) +int16 map_mapindex2mapid(unsigned short mapindex) { struct map_data *md=NULL; @@ -2340,9 +2341,9 @@ int map_check_dir(int s_dir,int t_dir) /*========================================== * Returns the direction of the given cell, relative to 'src' *------------------------------------------*/ -uint8 map_calc_dir(struct block_list* src, int x, int y) +uint8 map_calc_dir(struct block_list* src, int16 x, int16 y) { - unsigned char dir = 0; + uint8 dir = 0; int dx, dy; nullpo_ret(src); @@ -2386,7 +2387,7 @@ uint8 map_calc_dir(struct block_list* src, int x, int y) * Randomizes target cell x,y to a random walkable cell that * has the same distance from object as given coordinates do. [Skotlex] *------------------------------------------*/ -int map_random_dir(struct block_list *bl, short *x, short *y) +int map_random_dir(struct block_list *bl, int16 *x, int16 *y) { short xi = *x-bl->x; short yi = *y-bl->y; @@ -2451,12 +2452,12 @@ static int map_cell2gat(struct mapcell cell) /*========================================== * Confirm if celltype in (m,x,y) match the one given in cellchk *------------------------------------------*/ -int map_getcell(int m,int x,int y,cell_chk cellchk) +int map_getcell(int16 m,int16 x,int16 y,cell_chk cellchk) { return (m < 0 || m >= MAX_MAP_PER_SERVER) ? 0 : map_getcellp(&map[m],x,y,cellchk); } -int map_getcellp(struct map_data* m,int x,int y,cell_chk cellchk) +int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) { struct mapcell cell; @@ -2533,7 +2534,7 @@ int map_getcellp(struct map_data* m,int x,int y,cell_chk cellchk) * 'cell' - which flag to modify * 'flag' - true = on, false = off *------------------------------------------*/ -void map_setcell(int m, int x, int y, cell_t cell, bool flag) +void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) { int j; @@ -2560,7 +2561,7 @@ void map_setcell(int m, int x, int y, cell_t cell, bool flag) } } -void map_setgatcell(int m, int x, int y, int gat) +void map_setgatcell(int16 m, int16 x, int16 y, int gat) { int j; struct mapcell cell; @@ -2581,7 +2582,7 @@ void map_setgatcell(int m, int x, int y, int gat) *------------------------------------------*/ static DBMap* iwall_db; -void map_iwall_nextxy(int x, int y, int dir, int pos, int *x1, int *y1) +void map_iwall_nextxy(int16 x, int16 y, int8 dir, int pos, int16 *x1, int16 *y1) { if( dir == 0 || dir == 4 ) *x1 = x; // Keep X @@ -2598,10 +2599,11 @@ void map_iwall_nextxy(int x, int y, int dir, int pos, int *x1, int *y1) *y1 = y + pos; } -bool map_iwall_set(int m, int x, int y, int size, int dir, bool shootable, const char* wall_name) +bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name) { struct iwall_data *iwall; - int i, x1 = 0, y1 = 0; + int i; + int16 x1 = 0, y1 = 0; if( size < 1 || !wall_name ) return false; @@ -2646,7 +2648,7 @@ void map_iwall_get(struct map_session_data *sd) { struct iwall_data *iwall; DBIterator* iter; - int x1, y1; + int16 x1, y1; int i; if( map[sd->bl.m].iwall_num < 1 ) @@ -2670,7 +2672,7 @@ void map_iwall_get(struct map_session_data *sd) void map_iwall_remove(const char *wall_name) { struct iwall_data *iwall; - int i, x1, y1; + int16 i, x1, y1; if( (iwall = (struct iwall_data *)strdb_get(iwall_db, wall_name)) == NULL ) return; // Nothing to do @@ -3111,16 +3113,16 @@ int parse_console(const char* buf) char type[64]; char command[64]; char map[64]; - int x = 0; - int y = 0; - int m; + int16 x = 0; + int16 y = 0; + int16 m; int n; struct map_session_data sd; memset(&sd, 0, sizeof(struct map_session_data)); strcpy(sd.status.name, "console"); - if( ( n = sscanf(buf, "%63[^:]:%63[^:]:%63s %d %d[^\n]", type, command, map, &x, &y) ) < 5 ) + if( ( n = sscanf(buf, "%63[^:]:%63[^:]:%63s %hd %hd[^\n]", type, command, map, &x, &y) ) < 5 ) { if( ( n = sscanf(buf, "%63[^:]:%63[^\n]", type, command) ) < 2 ) { diff --git a/src/map/map.h b/src/map/map.h index 4f90b1f2f..a9d5eb098 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -310,7 +310,7 @@ enum auto_trigger_flag { struct block_list { struct block_list *next,*prev; int id; - short m,x,y; + int16 m,x,y; enum bl_type type; }; @@ -496,14 +496,14 @@ struct iwall_data { struct map_data { char name[MAP_NAME_LENGTH]; - unsigned short index; // The map index used by the mapindex* functions. + uint16 index; // The map index used by the mapindex* functions. struct mapcell* cell; // Holds the information of each map cell (NULL if the map is not on this map-server). struct block_list **block; struct block_list **block_mob; - int m; - short xs,ys; // map dimensions (in cells) - short bxs,bys; // map dimensions (in blocks) - short bgscore_lion, bgscore_eagle; // Battleground ScoreBoard + int16 m; + int16 xs,ys; // map dimensions (in cells) + int16 bxs,bys; // map dimensions (in blocks) + int16 bgscore_lion, bgscore_eagle; // Battleground ScoreBoard int npc_num; int users; int users_pvp; @@ -598,10 +598,10 @@ struct map_data_other_server { uint16 port; }; -int map_getcell(int,int,int,cell_chk); -int map_getcellp(struct map_data*,int,int,cell_chk); -void map_setcell(int m, int x, int y, cell_t cell, bool flag); -void map_setgatcell(int m, int x, int y, int gat); +int map_getcell(int16 m,int16 x,int16 y,cell_chk cellchk); +int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk); +void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag); +void map_setgatcell(int16 m, int16 x, int16 y, int gat); extern struct map_data map[]; extern int map_num; @@ -635,31 +635,31 @@ int map_freeblock_unlock(void); int map_addblock(struct block_list* bl); int map_delblock(struct block_list* bl); int map_moveblock(struct block_list *, int, int, unsigned int); -int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int type, ...); -int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int type, ...); -int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int type, ...); -int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int count, int type, ...); -int map_forcountinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int count, int type, ...); -int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int dx, int dy, int type, ...); -int map_foreachincell(int (*func)(struct block_list*,va_list), int m, int x, int y, int type, ...); -int map_foreachinpath(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int range, int length, int type, ...); -int map_foreachinmap(int (*func)(struct block_list*,va_list), int m, int type, ...); +int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...); +int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...); +int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...); +int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...); +int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...); +int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...); +int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x, int16 y, int type, ...); +int map_foreachinpath(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...); +int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type, ...); //blocklist nb in one cell -int map_count_oncell(int m,int x,int y,int type); -struct skill_unit *map_find_skill_unit_oncell(struct block_list *,int x,int y,int skill_id,struct skill_unit *, int flag); +int map_count_oncell(int16 m,int16 x,int16 y,int type); +struct skill_unit *map_find_skill_unit_oncell(struct block_list *,int16 x,int16 y,uint16 skill_id,struct skill_unit *, int flag); // search and creation int map_get_new_object_id(void); -int map_search_freecell(struct block_list *src, int m, short *x, short *y, int rx, int ry, int flag); +int map_search_freecell(struct block_list *src, int16 m, int16 *x, int16 *y, int16 rx, int16 ry, int flag); // int map_quit(struct map_session_data *); // npc -bool map_addnpc(int,struct npc_data *); +bool map_addnpc(int16 m,struct npc_data *); // map item int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data); int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data); void map_clearflooritem(struct block_list* bl); -int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_charid,int second_charid,int third_charid,int flags); +int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags); // player to map session void map_addnickdb(int charid, const char* nick); @@ -678,8 +678,8 @@ struct block_list * map_id2bl(int id); bool map_blid_exists( int id ); #define map_id2index(id) map[(id)].index -int map_mapindex2mapid(unsigned short mapindex); -int map_mapname2mapid(const char* name); +int16 map_mapindex2mapid(unsigned short mapindex); +int16 map_mapname2mapid(const char* name); int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port); int map_setipport(unsigned short map, uint32 ip, uint16 port); int map_eraseipport(unsigned short map, uint32 ip, uint16 port); @@ -692,7 +692,7 @@ void map_foreachnpc(int (*func)(struct npc_data* nd, va_list args), ...); void map_foreachregen(int (*func)(struct block_list* bl, va_list args), ...); void map_foreachiddb(int (*func)(struct block_list* bl, va_list args), ...); struct map_session_data * map_nick2sd(const char*); -struct mob_data * map_getmob_boss(int m); +struct mob_data * map_getmob_boss(int16 m); struct mob_data * map_id2boss(int id); // reload config file looking only for npcs @@ -719,7 +719,7 @@ bool mapit_exists(struct s_mapiterator* mapit); #define mapit_geteachiddb() mapit_alloc(MAPIT_NORMAL,BL_ALL) int map_check_dir(int s_dir,int t_dir); -unsigned char map_calc_dir( struct block_list *src,int x,int y); +uint8 map_calc_dir( struct block_list *src,int16 x,int16 y); int map_random_dir(struct block_list *bl, short *x, short *y); // [Skotlex] int cleanup_sub(struct block_list *bl, va_list ap); @@ -727,13 +727,13 @@ int cleanup_sub(struct block_list *bl, va_list ap); int map_delmap(char* mapname); void map_flags_init(void); -bool map_iwall_set(int m, int x, int y, int size, int dir, bool shootable, const char* wall_name); +bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name); void map_iwall_get(struct map_session_data *sd); void map_iwall_remove(const char *wall_name); int map_addmobtolist(unsigned short m, struct spawn_data *spawn); // [Wizputer] -void map_spawnmobs(int); // [Wizputer] -void map_removemobs(int); // [Wizputer] +void map_spawnmobs(int16 m); // [Wizputer] +void map_removemobs(int16 m); // [Wizputer] void do_reconnect_map(void); //Invoked on map-char reconnection [Skotlex] void map_addmap2db(struct map_data *m); void map_removemapdb(struct map_data *m); diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 832cc835b..973dac33e 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -384,7 +384,7 @@ int mercenary_kills(struct mercenary_data *md) return 0; } -int mercenary_checkskill(struct mercenary_data *md, int skill_id) +int mercenary_checkskill(struct mercenary_data *md, uint16 skill_id) { int i = skill_id - MC_SKILLBASE; @@ -464,7 +464,7 @@ static bool read_mercenary_skilldb_sub(char* str[], int columns, int current) {// <merc id>,<skill id>,<skill level> struct s_mercenary_db *db; int i, class_; - int skillid, skilllv; + uint16 skill_id, skill_lv; class_ = atoi(str[0]); ARR_FIND(0, MAX_MERCENARY_CLASS, i, class_ == mercenary_db[i].class_); @@ -474,19 +474,19 @@ static bool read_mercenary_skilldb_sub(char* str[], int columns, int current) return false; } - skillid = atoi(str[1]); - if( skillid < MC_SKILLBASE || skillid >= MC_SKILLBASE + MAX_MERCSKILL ) + skill_id = atoi(str[1]); + if( skill_id < MC_SKILLBASE || skill_id >= MC_SKILLBASE + MAX_MERCSKILL ) { - ShowError("read_mercenary_skilldb : Skill %d out of range.\n", skillid); + ShowError("read_mercenary_skilldb : Skill %d out of range.\n", skill_id); return false; } db = &mercenary_db[i]; - skilllv = atoi(str[2]); + skill_lv = atoi(str[2]); - i = skillid - MC_SKILLBASE; - db->skill[i].id = skillid; - db->skill[i].lv = skilllv; + i = skill_id - MC_SKILLBASE; + db->skill[i].id = skill_id; + db->skill[i].lv = skill_lv; return true; } diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 014bd8937..994c7aaa4 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -70,7 +70,7 @@ int mercenary_get_calls(struct mercenary_data *md); int mercenary_set_calls(struct mercenary_data *md, int value); int mercenary_kills(struct mercenary_data *md); -int mercenary_checkskill(struct mercenary_data *md, int skill_id); +int mercenary_checkskill(struct mercenary_data *md, uint16 skill_id); /** * atcommand.c required diff --git a/src/map/mob.c b/src/map/mob.c index ade39b847..ac3c1dfe3 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -90,7 +90,7 @@ const int mob_splendide[5] = { 1991, 1992, 1993, 1994, 1995 }; *------------------------------------------*/ static int mob_makedummymobdb(int); static int mob_spawn_guardian_sub(int tid, unsigned int tick, int id, intptr_t data); -int mob_skillid2skillidx(int class_,int skillid); +int mob_skill_id2skill_idx(int class_,uint16 skill_id); /*========================================== * Mob is searched with a name. @@ -169,7 +169,7 @@ void mvptomb_destroy(struct mob_data *md) { struct npc_data *nd; if ( (nd = map_id2nd(md->tomb_nid)) ) { - int m, i; + int16 m, i; m = nd->bl.m; @@ -285,7 +285,7 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) md->lootitem = (struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); md->spawn_timer = INVALID_TIMER; md->deletetimer = INVALID_TIMER; - md->skillidx = -1; + md->skill_idx = -1; status_set_viewdata(&md->bl, md->class_); status_change_init(&md->bl); unit_dataset(&md->bl); @@ -420,7 +420,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target) return false; } -struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m, short x, short y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai) +struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai) { struct spawn_data data; @@ -462,7 +462,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m, short x, short /*========================================== * Spawn a single mob on the specified coordinates. *------------------------------------------*/ -int mob_once_spawn(struct map_session_data* sd, int m, short x, short y, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) +int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) { struct mob_data* md = NULL; int count, lv; @@ -514,7 +514,7 @@ int mob_once_spawn(struct map_session_data* sd, int m, short x, short y, const c /*========================================== * Spawn mobs in the specified area. *------------------------------------------*/ -int mob_once_spawn_area(struct map_session_data* sd, int m, int x0, int y0, int x1, int y1, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) +int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) { int i, max, id = 0; int lx = -1, ly = -1; @@ -624,7 +624,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam struct spawn_data data; struct guild *g=NULL; struct guild_castle *gc; - int m; + int16 m; memset(&data, 0, sizeof(struct spawn_data)); data.num = 1; @@ -727,7 +727,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int { struct mob_data *md = NULL; struct spawn_data data; - int m; + int16 m; if( (m = map_mapname2mapid(mapname)) < 0 ) { @@ -2858,7 +2858,7 @@ int mob_countslave(struct block_list *bl) /*========================================== * Summons amount slaves contained in the value[5] array using round-robin. [adapted by Skotlex] *------------------------------------------*/ -int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id) +int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id) { struct mob_data *md; struct spawn_data data; @@ -2954,10 +2954,10 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id) } /*========================================== - * MOBskill lookup (get skillindex through skillid) + * MOBskill lookup (get skillindex through skill_id) * Returns -1 if not found. *------------------------------------------*/ -int mob_skillid2skillidx(int class_,int skillid) +int mob_skill_id2skill_idx(int class_,uint16 skill_id) { int i, max = mob_db(class_)->maxskill; struct mob_skill *ms=mob_db(class_)->skill; @@ -2965,7 +2965,7 @@ int mob_skillid2skillidx(int class_,int skillid) if(ms==NULL) return -1; - ARR_FIND( 0, max, i, ms[i].skill_id == skillid ); + ARR_FIND( 0, max, i, ms[i].skill_id == skill_id ); return ( i < max ) ? i : -1; } @@ -3159,7 +3159,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) case MSC_ATTACKPCGE: // attack pc >= num flag = (unit_counttargeted(&md->bl) >= c2); break; case MSC_AFTERSKILL: - flag = (md->ud.skillid == c2); break; + flag = (md->ud.skill_id == c2); break; case MSC_RUDEATTACKED: flag = (md->state.attacked_count >= RUDE_ATTACKED_COUNT); if (flag) md->state.attacked_count = 0; //Rude attacked count should be reset after the skill condition is met. Thanks to Komurka [Skotlex] @@ -3217,7 +3217,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) (ms[i].target-MST_AROUND5) +1; map_search_freecell(&md->bl, md->bl.m, &x, &y, j, j, 3); } - md->skillidx = i; + md->skill_idx = i; map_freeblock_lock(); if( !battle_check_range(&md->bl,bl,skill_get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) || !unit_skilluse_pos2(&md->bl, x, y,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) ) @@ -3255,7 +3255,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) } if (!bl) continue; - md->skillidx = i; + md->skill_idx = i; map_freeblock_lock(); if( !battle_check_range(&md->bl,bl,skill_get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) || !unit_skilluse_id2(&md->bl, bl->id,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) ) @@ -3284,7 +3284,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) return 1; } //No skill was used. - md->skillidx = -1; + md->skill_idx = -1; return 0; } /*========================================== @@ -3335,7 +3335,7 @@ int mob_is_clone(int class_) //If mode is not passed, a default aggressive mode is used. //If master_id is passed, clone is attached to him. //Returns: ID of newly crafted copy. -int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char *event, int master_id, int mode, int flag, unsigned int duration) +int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, int mode, int flag, unsigned int duration) { int class_; int i,j,inf,skill_id, fd; diff --git a/src/map/mob.h b/src/map/mob.h index b052c3b16..1dbed9f53 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -79,7 +79,7 @@ enum ai { struct mob_skill { enum MobSkillState state; - short skill_id,skill_lv; + uint16 skill_id,skill_lv; short permillage; int casttime,delay; short cancel; @@ -175,7 +175,7 @@ struct mob_data { int deletetimer; int master_id,master_dist; - short skillidx; + uint16 skill_idx; unsigned int skilldelay[MAX_MOBSKILL]; char npc_event[EVENT_NAME_LENGTH]; /** @@ -238,7 +238,7 @@ struct item_drop { struct item_drop* next; }; struct item_drop_list { - int m, x, y; // coordinates + int16 m, x, y; // coordinates int first_charid, second_charid, third_charid; // charid's of players with higher pickup priority struct item_drop* item; // linked list of drops }; @@ -249,19 +249,19 @@ int mobdb_searchname_array(struct mob_db** data, int size, const char *str); int mobdb_checkid(const int id); struct view_data* mob_get_viewdata(int class_); -struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m, +struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, short x, short y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai); -int mob_once_spawn(struct map_session_data* sd, int m, short x, short y, +int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai); -int mob_once_spawn_area(struct map_session_data* sd, int m, - int x0, int y0, int x1, int y1, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai); +int mob_once_spawn_area(struct map_session_data* sd, int16 m, + int16 x0, int16 y0, int16 x1, int16 y1, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai); bool mob_ksprotected (struct block_list *src, struct block_list *target); -int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int guardian, bool has_index); // Spawning Guardians [Valaris] -int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, unsigned int bg_id); +int mob_spawn_guardian(const char* mapname, int16 x, int16 y, const char* mobname, int class_, const char* event, int guardian, bool has_index); // Spawning Guardians [Valaris] +int mob_spawn_bg(const char* mapname, int16 x, int16 y, const char* mobname, int class_, const char* event, unsigned int bg_id); int mob_guardian_guildchange(struct mob_data *md); //Change Guardian's ownership. [Skotlex] int mob_randomwalk(struct mob_data *md,unsigned int tick); @@ -302,13 +302,13 @@ int mobskill_use(struct mob_data *md,unsigned int tick,int event); int mobskill_event(struct mob_data *md,struct block_list *src,unsigned int tick, int flag); int mobskill_castend_id( int tid, unsigned int tick, int id,int data ); int mobskill_castend_pos( int tid, unsigned int tick, int id,int data ); -int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id); +int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id); int mob_countslave(struct block_list *bl); int mob_count_sub(struct block_list *bl, va_list ap); int mob_is_clone(int class_); -int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char *event, int master_id, int mode, int flag, unsigned int duration); +int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, int mode, int flag, unsigned int duration); int mob_clone_delete(struct mob_data *md); void mob_reload(void); diff --git a/src/map/npc.c b/src/map/npc.c index 67eff6f8c..5d8a0274e 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -874,7 +874,7 @@ int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap) /*========================================== * Exec OnTouch for player if in range of area event *------------------------------------------*/ -int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y) +int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) { int xs,ys; int f = 1; @@ -1023,7 +1023,7 @@ int npc_touch_areanpc2(struct mob_data *md) //Flag determines the type of object to check for: //&1: NPC Warps //&2: NPCs with on-touch events. -int npc_check_areanpc(int flag, int m, int x, int y, int range) +int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range) { int i; int x0,y0,x1,y1; @@ -1734,7 +1734,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list) //This doesn't remove it from map_db int npc_remove_map(struct npc_data* nd) { - int m,i; + int16 m,i; nullpo_retr(1, nd); if(nd->bl.prev == NULL || nd->bl.m < 0) @@ -2045,11 +2045,11 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short nd->bl.m = from_mapid; nd->bl.x = from_x; nd->bl.y = from_y; - + safestrncpy(nd->exname, name, ARRAYLENGTH(nd->exname)); if (npc_name2id(nd->exname) != NULL) flag = 1; - + if (flag == 1) snprintf(nd->exname, ARRAYLENGTH(nd->exname), "warp_%d_%d_%d", from_mapid, from_x, from_y); @@ -2652,7 +2652,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch return end; } -int npc_duplicate4instance(struct npc_data *snd, int m) { +int npc_duplicate4instance(struct npc_data *snd, int16 m) { char newname[NAME_LENGTH]; if( map[m].instance_id == 0 ) @@ -2728,7 +2728,7 @@ int npc_duplicate4instance(struct npc_data *snd, int m) { //Set mapcell CELL_NPC to trigger event later void npc_setcells(struct npc_data* nd) { - int m = nd->bl.m, x = nd->bl.x, y = nd->bl.y, xs, ys; + int16 m = nd->bl.m, x = nd->bl.x, y = nd->bl.y, xs, ys; int i,j; switch(nd->subtype) @@ -2768,7 +2768,7 @@ int npc_unsetcells_sub(struct block_list* bl, va_list ap) void npc_unsetcells(struct npc_data* nd) { - int m = nd->bl.m, x = nd->bl.x, y = nd->bl.y, xs, ys; + int16 m = nd->bl.m, x = nd->bl.x, y = nd->bl.y, xs, ys; int i,j, x0, x1, y0, y1; if (nd->subtype == WARP) { @@ -2798,9 +2798,9 @@ void npc_unsetcells(struct npc_data* nd) map_foreachinarea( npc_unsetcells_sub, m, x0, y0, x1, y1, BL_NPC, nd->bl.id ); } -void npc_movenpc(struct npc_data* nd, int x, int y) +void npc_movenpc(struct npc_data* nd, int16 x, int16 y) { - const int m = nd->bl.m; + const int16 m = nd->bl.m; if (m < 0 || nd->bl.prev == NULL) return; //Not on a map. x = cap_value(x, 0, map[m].xs-1); @@ -3013,19 +3013,19 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c ShowError("npc_parse_mob: Invalid number of monsters %d, must be inside the range [1,1000] (file '%s', line '%d').\n", num, filepath, strline(buffer,start-buffer)); return strchr(start,'\n');// skip and continue } - + if( (mob.state.size < 0 || mob.state.size > 2) && size != -1 ) { ShowError("npc_parse_mob: Invalid size number %d for mob ID %d (file '%s', line '%d').\n", mob.state.size, class_, filepath, strline(buffer, start - buffer)); return strchr(start, '\n'); } - + if( (mob.state.ai < 0 || mob.state.ai > 4) && ai != -1 ) { ShowError("npc_parse_mob: Invalid ai %d for mob ID %d (file '%s', line '%d').\n", mob.state.ai, class_, filepath, strline(buffer, start - buffer)); return strchr(start, '\n'); } - + if( (mob_lv == 0 || mob_lv > MAX_LEVEL) && mob_lv != -1 ) { ShowError("npc_parse_mob: Invalid level %d for mob ID %d (file '%s', line '%d').\n", mob_lv, class_, filepath, strline(buffer, start - buffer)); @@ -3140,7 +3140,7 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c *------------------------------------------*/ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath) { - int m; + int16 m; char mapname[32]; int state = 1; @@ -3405,7 +3405,8 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con //@runOnInit should we exec OnInit when it's done ? void npc_parsesrcfile(const char* filepath, bool runOnInit) { - int m, x, y, lines = 0; + int16 m, x, y; + int lines = 0; FILE* fp; size_t len; char* buffer; @@ -3488,7 +3489,7 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit) {// w1 = <map name>,<x>,<y>,<facing> char mapname[MAP_NAME_LENGTH*2]; x = y = 0; - sscanf(w1,"%23[^,],%d,%d[^,]",mapname,&x,&y); + sscanf(w1,"%23[^,],%hd,%hd[^,]",mapname,&x,&y); if( !mapindex_name2id(mapname) ) {// Incorrect map, we must skip the script info... ShowError("npc_parsesrcfile: Unknown map '%s' in file '%s', line '%d'. Skipping line...\n", mapname, filepath, strline(buffer,p-buffer)); @@ -3654,14 +3655,14 @@ void npc_clear_pathlist(void) { //Clear then reload npcs files int npc_reload(void) { struct npc_src_list *nsl; - int m, i; + int16 m, i; int npc_new_min = npc_id; struct s_mapiterator* iter; struct block_list* bl; /* clear guild flag cache */ guild_flags_clear(); - + npc_clear_pathlist(); db_clear(npc_path_db); @@ -3794,7 +3795,7 @@ int do_final_npc(void) { static void npc_debug_warps_sub(struct npc_data* nd) { - int m; + int16 m; if (nd->bl.type != BL_NPC || nd->subtype != WARP || nd->bl.m < 0) return; @@ -3820,7 +3821,7 @@ static void npc_debug_warps_sub(struct npc_data* nd) static void npc_debug_warps(void) { - int m, i; + int16 m, i; for (m = 0; m < map_num; m++) for (i = 0; i < map[m].npc_num; i++) npc_debug_warps_sub(map[m].npc[i]); diff --git a/src/map/npc.h b/src/map/npc.h index 041adb7b6..ee88da08c 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -113,9 +113,9 @@ struct view_data* npc_get_viewdata(int class_); int npc_chat_sub(struct block_list* bl, va_list ap); int npc_event_dequeue(struct map_session_data* sd); int npc_event(struct map_session_data* sd, const char* eventname, int ontouch); -int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y); +int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y); int npc_touch_areanpc2(struct mob_data *md); // [Skotlex] -int npc_check_areanpc(int flag, int m, int x, int y, int range); +int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range); int npc_touchnext_areanpc(struct map_session_data* sd,bool leavemap); int npc_click(struct map_session_data* sd, struct npc_data* nd); int npc_scriptcont(struct map_session_data* sd, int id); @@ -129,7 +129,7 @@ int npc_globalmessage(const char* name,const char* mes); void npc_setcells(struct npc_data* nd); void npc_unsetcells(struct npc_data* nd); -void npc_movenpc(struct npc_data* nd, int x, int y); +void npc_movenpc(struct npc_data* nd, int16 x, int16 y); int npc_enable(const char* name, int flag); void npc_setdisplayname(struct npc_data* nd, const char* newname); void npc_setclass(struct npc_data* nd, short class_); @@ -162,7 +162,7 @@ int npc_reload(void); void npc_read_event_script(void); int npc_script_event(struct map_session_data* sd, enum npce_event type); -int npc_duplicate4instance(struct npc_data *snd, int m); +int npc_duplicate4instance(struct npc_data *snd, int16 m); int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points); extern struct npc_data* fake_nd; diff --git a/src/map/party.c b/src/map/party.c index f7a2ebc6a..f6b711791 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -801,7 +801,7 @@ int party_recv_message(int party_id,int account_id,const char *mes,int len) return 0; } -int party_skill_check(struct map_session_data *sd, int party_id, int skillid, int skilllv) +int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv) { struct party_data *p; struct map_session_data *p_sd; @@ -809,7 +809,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, int skillid, in if(!party_id || (p=party_search(party_id))==NULL) return 0; - switch(skillid) { + switch(skill_id) { case TK_COUNTER: //Increase Triple Attack rate of Monks. if (!p->state.monk) return 0; break; @@ -829,12 +829,12 @@ int party_skill_check(struct map_session_data *sd, int party_id, int skillid, in continue; if (sd->bl.m != p_sd->bl.m) continue; - switch(skillid) { + switch(skill_id) { case TK_COUNTER: //Increase Triple Attack rate of Monks. if((p_sd->class_&MAPID_UPPERMASK) == MAPID_MONK && pc_checkskill(p_sd,MO_TRIPLEATTACK)) { sc_start4(&p_sd->bl,SC_SKILLRATE_UP,100,MO_TRIPLEATTACK, - 50+50*skilllv, //+100/150/200% rate + 50+50*skill_lv, //+100/150/200% rate 0,0,skill_get_time(SG_FRIEND, 1)); } break; diff --git a/src/map/party.h b/src/map/party.h index 9fde5a6a4..12fe7a2bc 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -76,7 +76,7 @@ void party_send_levelup(struct map_session_data *sd); int party_send_logout(struct map_session_data *sd); int party_send_message(struct map_session_data *sd,const char *mes,int len); int party_recv_message(int party_id,int account_id,const char *mes,int len); -int party_skill_check(struct map_session_data *sd, int party_id, int skillid, int skilllv); +int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv); int party_send_xy_clear(struct party_data *p); int party_exp_share(struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny); int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item_data, int first_charid); diff --git a/src/map/path.c b/src/map/path.c index 4505efcaa..3bbd8d20b 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -99,7 +99,7 @@ static int pop_heap_path(int *heap,struct tmp_path *tp) /*========================================== * calculate cost for the specified position *------------------------------------------*/ -static int calc_cost(struct tmp_path *p,int x1,int y1) +static int calc_cost(struct tmp_path *p,int16 x1,int16 y1) { int xd = abs(x1 - p->x); int yd = abs(y1 - p->y); @@ -109,7 +109,7 @@ static int calc_cost(struct tmp_path *p,int x1,int y1) /*========================================== * attach/adjust path if neccessary *------------------------------------------*/ -static int add_path(int *heap,struct tmp_path *tp,int x,int y,int dist,int before,int cost) +static int add_path(int *heap,struct tmp_path *tp,int16 x,int16 y,int dist,int before,int cost) { int i; @@ -149,7 +149,7 @@ static int add_path(int *heap,struct tmp_path *tp,int x,int y,int dist,int befor * Find the closest reachable cell, 'count' cells away from (x0,y0) in direction (dx,dy). * Income after the coordinates of the blow *------------------------------------------*/ -int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) +int path_blownpos(int16 m,int16 x0,int16 y0,int16 dx,int16 dy,int count) { struct map_data *md; @@ -166,7 +166,7 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) dx=(dx>0)?1:((dx<0)?-1:0); dy=(dy>0)?1:((dy<0)?-1:0); } - + while( count > 0 && (dx != 0 || dy != 0) ) { if( !map_getcellp(md,x0+dx,y0+dy,CELL_CHKPASS) ) @@ -197,7 +197,7 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) /*========================================== * is ranged attack from (x0,y0) to (x1,y1) possible? *------------------------------------------*/ -bool path_search_long(struct shootpath_data *spd,int m,int x0,int y0,int x1,int y1,cell_chk cell) +bool path_search_long(struct shootpath_data *spd,int16 m,int16 x0,int16 y0,int16 x1,int16 y1,cell_chk cell) { int dx, dy; int wx = 0, wy = 0; @@ -270,7 +270,7 @@ bool path_search_long(struct shootpath_data *spd,int m,int x0,int y0,int x1,int * flag: &1 = easy path search only * cell: type of obstruction to check for *------------------------------------------*/ -bool path_search(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int flag,cell_chk cell) +bool path_search(struct walkpath_data *wpd,int16 m,int16 x0,int16 y0,int16 x1,int16 y1,int flag,cell_chk cell) { int heap[MAX_HEAP+1]; struct tmp_path tp[MAX_WALKPATH*MAX_WALKPATH]; @@ -327,7 +327,7 @@ bool path_search(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int wpd->path_pos = 0; return true; } - + if( flag&1 ) return false; @@ -361,9 +361,9 @@ bool path_search(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int break; // dc[0] : y++ Incremental cost at the time - // dc[1] : x-- - // dc[2] : y-- - // dc[3] : x++ + // dc[1] : x-- + // dc[2] : y-- + // dc[3] : x++ if(y < ys && !map_getcellp(md,x ,y+1,cell)) { f |= 1; dc[0] = (y >= y1 ? 20 : 0); @@ -396,7 +396,7 @@ bool path_search(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int if( !(x==x1 && y==y1) ) // will never happen... return false; - + for(len=0,i=rp;len<100 && i!=calc_index(x0,y0);i=tp[i].before,len++); if(len==100 || len>=sizeof(wpd->path)) return false; @@ -406,7 +406,7 @@ bool path_search(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int for(i=rp,j=len-1;j>=0;i=tp[i].before,j--) { int dx = tp[i].x - tp[tp[i].before].x; int dy = tp[i].y - tp[tp[i].before].y; - int dir; + uint8 dir; if( dx == 0 ) { dir = (dy > 0 ? 0 : 4); } else if( dx > 0 ) { @@ -444,7 +444,7 @@ unsigned int distance(int dx, int dy) //There appears to be something wrong with the aproximation below when either dx/dy is 0! [Skotlex] if ( dx == 0 ) return dy; if ( dy == 0 ) return dx; - + if ( dx < dy ) { min = dx; diff --git a/src/map/path.h b/src/map/path.h index 1dc024655..b1ca71955 100644 --- a/src/map/path.h +++ b/src/map/path.h @@ -20,13 +20,13 @@ struct shootpath_data { }; // calculates destination cell for knockback -int path_blownpos(int m,int x0,int y0,int dx,int dy,int count); +int path_blownpos(int16 m,int16 x0,int16 y0,int16 dx,int16 dy,int count); // tries to find a walkable path -bool path_search(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int flag,cell_chk cell); +bool path_search(struct walkpath_data *wpd,int16 m,int16 x0,int16 y0,int16 x1,int16 y1,int flag,cell_chk cell); // tries to find a shootable path -bool path_search_long(struct shootpath_data *spd,int m,int x0,int y0,int x1,int y1,cell_chk cell); +bool path_search_long(struct shootpath_data *spd,int16 m,int16 x0,int16 y0,int16 x1,int16 y1,cell_chk cell); // distance related functions diff --git a/src/map/pc.c b/src/map/pc.c index c7c9d7114..3af065db8 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -277,7 +277,7 @@ static int pc_check_banding( struct block_list *bl, va_list ap ) { return 0; } -int pc_banding(struct map_session_data *sd, short skill_lv) { +int pc_banding(struct map_session_data *sd, uint16 skill_lv) { int c; int b_sd[MAX_PARTY]; // In case of a full Royal Guard party. int i, j, hp, extra_hp = 0, tmp_qty = 0, tmp_hp; @@ -3954,7 +3954,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) nullpo_ret(sd); nullpo_ret(fitem); - if(!check_distance_bl(&fitem->bl, &sd->bl, 2) && sd->ud.skillid!=BS_GREED) + if(!check_distance_bl(&fitem->bl, &sd->bl, 2) && sd->ud.skill_id!=BS_GREED) return 0; // Distance is too far if (sd->status.party_id) @@ -4502,7 +4502,7 @@ int pc_show_steal(struct block_list *bl,va_list ap) * 0 = fail * 1 = succes *------------------------------------------*/ -int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv) +int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv) { int i,itemid,flag; double rate; @@ -4531,7 +4531,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv) } // base skill success chance (percentual) - rate = (sd_status->dex - md_status->dex)/2 + lv*6 + 4; + rate = (sd_status->dex - md_status->dex)/2 + skill_lv*6 + 4; rate += sd->bonus.add_steal_rate; if( rate < 1 ) @@ -4622,7 +4622,7 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target) int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype) { struct party_data *p; - int m; + int16 m; nullpo_ret(sd); @@ -4796,7 +4796,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y int pc_randomwarp(struct map_session_data *sd, clr_type type) { int x,y,i=0; - int m; + int16 m; nullpo_ret(sd); @@ -4869,9 +4869,9 @@ int pc_memo(struct map_session_data* sd, int pos) // Skills // /*========================================== - * Return player sd skilllv learned for given skill + * Return player sd skill_lv learned for given skill *------------------------------------------*/ -int pc_checkskill(struct map_session_data *sd,int skill_id) +int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { if(sd == NULL) return 0; if( skill_id >= GD_SKILLBASE && skill_id < GD_MAX ) @@ -5957,45 +5957,45 @@ int pc_statusup2(struct map_session_data* sd, int type, int val) } /*========================================== - * Update skilllv for player sd + * Update skill_lv for player sd * Skill point allocation *------------------------------------------*/ -int pc_skillup(struct map_session_data *sd,int skill_num) +int pc_skillup(struct map_session_data *sd,uint16 skill_id) { nullpo_ret(sd); - if( skill_num >= GD_SKILLBASE && skill_num < GD_SKILLBASE+MAX_GUILDSKILL ) + if( skill_id >= GD_SKILLBASE && skill_id < GD_SKILLBASE+MAX_GUILDSKILL ) { - guild_skillup(sd, skill_num); + guild_skillup(sd, skill_id); return 0; } - if( skill_num >= HM_SKILLBASE && skill_num < HM_SKILLBASE+MAX_HOMUNSKILL && sd->hd ) + if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE+MAX_HOMUNSKILL && sd->hd ) { - merc_hom_skillup(sd->hd, skill_num); + merc_hom_skillup(sd->hd, skill_id); return 0; } - if( skill_num < 0 || skill_num >= MAX_SKILL ) + if( skill_id < 0 || skill_id >= MAX_SKILL ) return 0; if( sd->status.skill_point > 0 && - sd->status.skill[skill_num].id && - sd->status.skill[skill_num].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex] - sd->status.skill[skill_num].lv < skill_tree_get_max(skill_num, sd->status.class_) ) + sd->status.skill[skill_id].id && + sd->status.skill[skill_id].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex] + sd->status.skill[skill_id].lv < skill_tree_get_max(skill_id, sd->status.class_) ) { - sd->status.skill[skill_num].lv++; + sd->status.skill[skill_id].lv++; sd->status.skill_point--; - if( !skill_get_inf(skill_num) ) + if( !skill_get_inf(skill_id) ) status_calc_pc(sd,0); // Only recalculate for passive skills. else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) ) pc_calc_skilltree(sd); // Required to grant all TK Ranger skills. else - pc_check_skilltree(sd, skill_num); // Check if a new skill can Lvlup + pc_check_skilltree(sd, skill_id); // Check if a new skill can Lvlup - clif_skillup(sd,skill_num); + clif_skillup(sd,skill_id); clif_updatestatus(sd,SP_SKILLPOINT); - if( skill_num == GN_REMODELING_CART ) /* cart weight info was updated by status_calc_pc */ + if( skill_id == GN_REMODELING_CART ) /* cart weight info was updated by status_calc_pc */ clif_updatestatus(sd,SP_CARTINFO); if (!pc_has_permission(sd, PC_PERM_ALL_SKILL)) // may skill everything at any time anyways, and this would cause a huge slowdown clif_skillinfoblock(sd); @@ -6357,12 +6357,12 @@ int pc_resethate(struct map_session_data* sd) return 0; } -int pc_skillatk_bonus(struct map_session_data *sd, int skill_num) +int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id) { int i, bonus = 0; nullpo_ret(sd); - ARR_FIND(0, ARRAYLENGTH(sd->skillatk), i, sd->skillatk[i].id == skill_num); + ARR_FIND(0, ARRAYLENGTH(sd->skillatk), i, sd->skillatk[i].id == skill_id); if( i < ARRAYLENGTH(sd->skillatk) ) bonus = sd->skillatk[i].val; if(sd->sc.data[SC_PYROTECHNIC_OPTION] || sd->sc.data[SC_AQUAPLAY_OPTION]) @@ -6371,11 +6371,11 @@ int pc_skillatk_bonus(struct map_session_data *sd, int skill_num) return bonus; } -int pc_skillheal_bonus(struct map_session_data *sd, int skill_num) { +int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id) { int i, bonus = sd->bonus.add_heal_rate; if( bonus ) { - switch( skill_num ) { + switch( skill_id ) { case AL_HEAL: if( !(battle_config.skill_add_heal_rate&1) ) bonus = 0; break; case PR_SANCTUARY: if( !(battle_config.skill_add_heal_rate&2) ) bonus = 0; break; case AM_POTIONPITCHER: if( !(battle_config.skill_add_heal_rate&4) ) bonus = 0; break; @@ -6384,7 +6384,7 @@ int pc_skillheal_bonus(struct map_session_data *sd, int skill_num) { } } - ARR_FIND(0, ARRAYLENGTH(sd->skillheal), i, sd->skillheal[i].id == skill_num); + ARR_FIND(0, ARRAYLENGTH(sd->skillheal), i, sd->skillheal[i].id == skill_id); if( i < ARRAYLENGTH(sd->skillheal) ) bonus += sd->skillheal[i].val; @@ -6392,10 +6392,10 @@ int pc_skillheal_bonus(struct map_session_data *sd, int skill_num) { return bonus; } -int pc_skillheal2_bonus(struct map_session_data *sd, int skill_num) { +int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id) { int i, bonus = sd->bonus.add_heal2_rate; - ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == skill_num); + ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == skill_id); if( i < ARRAYLENGTH(sd->skillheal2) ) bonus += sd->skillheal2[i].val; @@ -6513,7 +6513,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) if( (bg = bg_team_search(sd->bg_id)) != NULL && bg->die_event[0] ) npc_event(sd, bg->die_event, 0); } - + // Clear anything NPC-related when you die and was interacting with one. if (sd->npc_id) { @@ -6525,7 +6525,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) sd->state.menu_or_input = 0; if (sd->npc_menu) sd->npc_menu = 0; - + sd->npc_id = 0; if (sd->st && sd->st->state != END) sd->st->state = END; @@ -7263,12 +7263,12 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) //Update skill tree. pc_calc_skilltree(sd); clif_skillinfoblock(sd); - + if (sd->ed) elemental_delete(sd->ed, 0); if (sd->state.vending) vending_closevending(sd); - + map_foreachinmap(jobchange_killclone, sd->bl.m, BL_MOB, sd->bl.id); //Remove peco/cart/falcon @@ -9290,14 +9290,14 @@ int pc_split_atoui(char* str, unsigned int* val, char sep, int max) *------------------------------------------*/ static bool pc_readdb_skilltree(char* fields[], int columns, int current) { - unsigned char joblv = 0, skilllv; - unsigned short skillid; + unsigned char joblv = 0, skill_lv; + uint16 skill_id; int idx, class_; - unsigned int i, offset = 3, skillidx; + unsigned int i, offset = 3, skill_idx; class_ = atoi(fields[0]); - skillid = (unsigned short)atoi(fields[1]); - skilllv = (unsigned char)atoi(fields[2]); + skill_id = (uint16)atoi(fields[1]); + skill_lv = (unsigned char)atoi(fields[2]); if(columns==4+MAX_PC_SKILL_REQUIRE*2) {// job level requirement extra column @@ -9313,25 +9313,25 @@ static bool pc_readdb_skilltree(char* fields[], int columns, int current) idx = pc_class2idx(class_); //This is to avoid adding two lines for the same skill. [Skotlex] - ARR_FIND( 0, MAX_SKILL_TREE, skillidx, skill_tree[idx][skillidx].id == 0 || skill_tree[idx][skillidx].id == skillid ); - if( skillidx == MAX_SKILL_TREE ) + ARR_FIND( 0, MAX_SKILL_TREE, skill_idx, skill_tree[idx][skill_idx].id == 0 || skill_tree[idx][skill_idx].id == skill_id ); + if( skill_idx == MAX_SKILL_TREE ) { - ShowWarning("pc_readdb_skilltree: Unable to load skill %hu into job %d's tree. Maximum number of skills per class has been reached.\n", skillid, class_); + ShowWarning("pc_readdb_skilltree: Unable to load skill %hu into job %d's tree. Maximum number of skills per class has been reached.\n", skill_id, class_); return false; } - else if(skill_tree[idx][skillidx].id) + else if(skill_tree[idx][skill_idx].id) { - ShowNotice("pc_readdb_skilltree: Overwriting skill %hu for job class %d.\n", skillid, class_); + ShowNotice("pc_readdb_skilltree: Overwriting skill %hu for job class %d.\n", skill_id, class_); } - skill_tree[idx][skillidx].id = skillid; - skill_tree[idx][skillidx].max = skilllv; - skill_tree[idx][skillidx].joblv = joblv; + skill_tree[idx][skill_idx].id = skill_id; + skill_tree[idx][skill_idx].max = skill_lv; + skill_tree[idx][skill_idx].joblv = joblv; for(i = 0; i < MAX_PC_SKILL_REQUIRE; i++) { - skill_tree[idx][skillidx].need[i].id = atoi(fields[i*2+offset]); - skill_tree[idx][skillidx].need[i].lv = atoi(fields[i*2+offset+1]); + skill_tree[idx][skill_idx].need[i].id = atoi(fields[i*2+offset]); + skill_tree[idx][skill_idx].need[i].lv = atoi(fields[i*2+offset+1]); } return true; } diff --git a/src/map/pc.h b/src/map/pc.h index e04602b99..3027c5f10 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -199,8 +199,8 @@ struct map_session_data { time_t emotionlasttime; // to limit flood with emotion packets short skillitem,skillitemlv; - short skillid_old,skilllv_old; - short skillid_dance,skilllv_dance; + uint16 skill_id_old,skill_lv_old; + uint16 skill_id_dance,skill_lv_dance; short cook_mastery; // range: [0,1999] [Inkfish] unsigned char blockskill[MAX_SKILL]; int cloneskill_id, reproduceskill_id; @@ -244,7 +244,7 @@ struct map_session_data { int magic_addele[ELE_MAX]; int magic_addrace[RC_MAX]; int magic_addsize[3]; - int magic_atk_ele[ELE_MAX]; + int magic_atk_ele[ELE_MAX]; int critaddrace[RC_MAX]; int expaddrace[RC_MAX]; int ignore_mdef[RC_MAX]; @@ -692,7 +692,7 @@ int pc_isequip(struct map_session_data *sd,int n); int pc_equippoint(struct map_session_data *sd,int n); int pc_setinventorydata(struct map_session_data *sd); -int pc_checkskill(struct map_session_data *sd,int skill_id); +int pc_checkskill(struct map_session_data *sd,uint16 skill_id); int pc_checkallowskill(struct map_session_data *sd); int pc_checkequip(struct map_session_data *sd,int pos); @@ -749,7 +749,7 @@ int pc_skill(struct map_session_data* sd, int id, int level, int flag); int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip); -int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int skilllv); +int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv); int pc_steal_coin(struct map_session_data *sd,struct block_list *bl); int pc_modifybuyvalue(struct map_session_data*,int); @@ -771,7 +771,7 @@ int pc_gets_status_point(int); int pc_need_status_point(struct map_session_data *,int,int); int pc_statusup(struct map_session_data*,int); int pc_statusup2(struct map_session_data*,int,int); -int pc_skillup(struct map_session_data*,int); +int pc_skillup(struct map_session_data*,uint16 skill_id); int pc_allskillup(struct map_session_data*); int pc_resetlvl(struct map_session_data*,int type); int pc_resetstate(struct map_session_data*); @@ -783,9 +783,9 @@ int pc_unequipitem(struct map_session_data*,int,int); int pc_checkitem(struct map_session_data*); int pc_useitem(struct map_session_data*,int); -int pc_skillatk_bonus(struct map_session_data *sd, int skill_num); -int pc_skillheal_bonus(struct map_session_data *sd, int skill_num); -int pc_skillheal2_bonus(struct map_session_data *sd, int skill_num); +int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id); +int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id); +int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id); void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp); int pc_dead(struct map_session_data *sd,struct block_list *src); @@ -910,7 +910,7 @@ bool pc_isautolooting(struct map_session_data *sd, int nameid); void pc_overheat(struct map_session_data *sd, int val); -int pc_banding(struct map_session_data *sd, short skill_lv); +int pc_banding(struct map_session_data *sd, uint16 skill_lv); void pc_itemcd_do(struct map_session_data *sd, bool load); diff --git a/src/map/script.c b/src/map/script.c index 5aeb91c0e..630a52abd 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5036,7 +5036,7 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap) } BUILDIN_FUNC(areawarp) { - int m, x0,y0,x1,y1, x2,y2,x3=0,y3=0; + int16 m, x0,y0,x1,y1, x2,y2,x3=0,y3=0; unsigned int index; const char *str; const char *mapname; @@ -8132,7 +8132,7 @@ BUILDIN_FUNC(getskilllv) BUILDIN_FUNC(getgdskilllv) { int guild_id; - int skill_id; + uint16 skill_id; struct guild* g; guild_id = script_getnum(st,2); @@ -8822,7 +8822,7 @@ BUILDIN_FUNC(monster) unsigned int ai = AI_NONE; struct map_session_data* sd; - int m; + int16 m; if (script_hasdata(st, 8)) { @@ -8929,7 +8929,7 @@ BUILDIN_FUNC(areamonster) unsigned int ai = AI_NONE; struct map_session_data* sd; - int m; + int16 m; if (script_hasdata(st,10)) { @@ -9016,7 +9016,7 @@ static int buildin_killmonster_sub(struct block_list *bl,va_list ap) BUILDIN_FUNC(killmonster) { const char *mapname,*event; - int m,allflag=0; + int16 m,allflag=0; mapname=script_getstr(st,2); event=script_getstr(st,3); if(strcmp(event,"All")==0) @@ -9062,7 +9062,7 @@ static int buildin_killmonsterall_sub(struct block_list *bl,va_list ap) BUILDIN_FUNC(killmonsterall) { const char *mapname; - int m; + int16 m; mapname=script_getstr(st,2); if( (m = map_mapname2mapid(mapname))<0 ) @@ -9568,7 +9568,7 @@ BUILDIN_FUNC(mapannounce) int fontSize = script_hasdata(st,7) ? script_getnum(st,7) : 12; // default fontSize int fontAlign = script_hasdata(st,8) ? script_getnum(st,8) : 0; // default fontAlign int fontY = script_hasdata(st,9) ? script_getnum(st,9) : 0; // default fontY - int m; + int16 m; if ((m = map_mapname2mapid(mapname)) < 0) return 0; @@ -9593,7 +9593,7 @@ BUILDIN_FUNC(areaannounce) int fontSize = script_hasdata(st,11) ? script_getnum(st,11) : 12; // default fontSize int fontAlign = script_hasdata(st,12) ? script_getnum(st,12) : 0; // default fontAlign int fontY = script_hasdata(st,13) ? script_getnum(st,13) : 0; // default fontY - int m; + int16 m; if ((m = map_mapname2mapid(mapname)) < 0) return 0; @@ -9677,7 +9677,8 @@ BUILDIN_FUNC(getusersname) BUILDIN_FUNC(getmapguildusers) { const char *str; - int m, gid; + int16 m; + int gid; int i=0,c=0; struct guild *g = NULL; str=script_getstr(st,2); @@ -9704,7 +9705,7 @@ BUILDIN_FUNC(getmapguildusers) BUILDIN_FUNC(getmapusers) { const char *str; - int m; + int16 m; str=script_getstr(st,2); if( (m=map_mapname2mapid(str))< 0){ script_pushint(st,-1); @@ -9724,7 +9725,7 @@ static int buildin_getareausers_sub(struct block_list *bl,va_list ap) BUILDIN_FUNC(getareausers) { const char *str; - int m,x0,y0,x1,y1,users=0; + int16 m,x0,y0,x1,y1,users=0; //doubt we can have more then 32k users on str=script_getstr(st,2); x0=script_getnum(st,3); y0=script_getnum(st,4); @@ -9756,7 +9757,8 @@ static int buildin_getareadropitem_sub(struct block_list *bl,va_list ap) BUILDIN_FUNC(getareadropitem) { const char *str; - int m,x0,y0,x1,y1,item,amount=0; + int16 m,x0,y0,x1,y1; + int item,amount=0; struct script_data *data; str=script_getstr(st,2); @@ -10616,7 +10618,7 @@ BUILDIN_FUNC(isloggedin) *------------------------------------------*/ BUILDIN_FUNC(setmapflagnosave) { - int m,x,y; + int16 m,x,y; unsigned short mapindex; const char *str,*str2; @@ -10639,7 +10641,7 @@ BUILDIN_FUNC(setmapflagnosave) BUILDIN_FUNC(getmapflag) { - int m,i; + int16 m,i; const char *str; str=script_getstr(st,2); @@ -10724,7 +10726,7 @@ static int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) { } BUILDIN_FUNC(setmapflag) { - int m,i; + int16 m,i; const char *str; int val=0; @@ -10810,7 +10812,7 @@ BUILDIN_FUNC(setmapflag) BUILDIN_FUNC(removemapflag) { - int m,i; + int16 m,i; const char *str; int val=0; @@ -10896,7 +10898,7 @@ BUILDIN_FUNC(removemapflag) BUILDIN_FUNC(pvpon) { - int m; + int16 m; const char *str; TBL_PC* sd = NULL; struct s_mapiterator* iter; @@ -10943,7 +10945,7 @@ static int buildin_pvpoff_sub(struct block_list *bl,va_list ap) BUILDIN_FUNC(pvpoff) { - int m; + int16 m; const char *str; str=script_getstr(st,2); @@ -10963,7 +10965,7 @@ BUILDIN_FUNC(pvpoff) BUILDIN_FUNC(gvgon) { - int m; + int16 m; const char *str; str=script_getstr(st,2); @@ -10977,7 +10979,7 @@ BUILDIN_FUNC(gvgon) } BUILDIN_FUNC(gvgoff) { - int m; + int16 m; const char *str; str=script_getstr(st,2); @@ -11028,7 +11030,7 @@ BUILDIN_FUNC(emotion) static int buildin_maprespawnguildid_sub_pc(struct map_session_data* sd, va_list ap) { - int m=va_arg(ap,int); + int16 m=va_arg(ap,int); int g_id=va_arg(ap,int); int flag=va_arg(ap,int); @@ -11059,7 +11061,7 @@ BUILDIN_FUNC(maprespawnguildid) int g_id=script_getnum(st,3); int flag=script_getnum(st,4); - int m=map_mapname2mapid(mapname); + int16 m=map_mapname2mapid(mapname); if(m == -1) return 0; @@ -11477,7 +11479,7 @@ static int buildin_mobcount_sub(struct block_list *bl,va_list ap) // Added by Ro BUILDIN_FUNC(mobcount) // Added by RoVeRT { const char *mapname,*event; - int m; + int16 m; mapname=script_getstr(st,2); event=script_getstr(st,3); @@ -12472,11 +12474,11 @@ BUILDIN_FUNC(skilleffect) { TBL_PC *sd; - int skillid=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); - int skilllv=script_getnum(st,3); + uint16 skill_id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + uint16 skill_lv=script_getnum(st,3); sd=script_rid2sd(st); - clif_skill_nodamage(&sd->bl,&sd->bl,skillid,skilllv,1); + clif_skill_nodamage(&sd->bl,&sd->bl,skill_id,skill_lv,1); return 0; } @@ -12490,13 +12492,13 @@ BUILDIN_FUNC(npcskilleffect) { struct block_list *bl= map_id2bl(st->oid); - int skillid=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); - int skilllv=script_getnum(st,3); + uint16 skill_id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) ); + uint16 skill_lv=script_getnum(st,3); int x=script_getnum(st,4); int y=script_getnum(st,5); if (bl) - clif_skill_poseffect(bl,skillid,skilllv,x,y,gettick()); + clif_skill_poseffect(bl,skill_id,skill_lv,x,y,gettick()); return 0; } @@ -15041,7 +15043,7 @@ BUILDIN_FUNC(searchitem) int axtoi(const char *hexStg) { int n = 0; // position in string - int m = 0; // position in digit[] to shift + int16 m = 0; // position in digit[] to shift int count; // loop index int intValue = 0; // integer value of hex string int digit[11]; // hold values to convert @@ -15381,8 +15383,8 @@ BUILDIN_FUNC(unitemote) BUILDIN_FUNC(unitskilluseid) { int unit_id; - int skill_id; - int skill_lv; + uint16 skill_id; + uint16 skill_lv; int target_id; struct block_list* bl; @@ -15405,8 +15407,8 @@ BUILDIN_FUNC(unitskilluseid) BUILDIN_FUNC(unitskillusepos) { int unit_id; - int skill_id; - int skill_lv; + uint16 skill_id; + uint16 skill_lv; int skill_x; int skill_y; struct block_list* bl; @@ -15646,9 +15648,9 @@ BUILDIN_FUNC(openauction) /// @see cell_chk* constants in const.txt for the types BUILDIN_FUNC(checkcell) { - int m = map_mapname2mapid(script_getstr(st,2)); - int x = script_getnum(st,3); - int y = script_getnum(st,4); + int16 m = map_mapname2mapid(script_getstr(st,2)); + int16 x = script_getnum(st,3); + int16 y = script_getnum(st,4); cell_chk type = (cell_chk)script_getnum(st,5); script_pushint(st, map_getcell(m, x, y, type)); @@ -15663,11 +15665,11 @@ BUILDIN_FUNC(checkcell) /// @see cell_* constants in const.txt for the types BUILDIN_FUNC(setcell) { - int m = map_mapname2mapid(script_getstr(st,2)); - int x1 = script_getnum(st,3); - int y1 = script_getnum(st,4); - int x2 = script_getnum(st,5); - int y2 = script_getnum(st,6); + int16 m = map_mapname2mapid(script_getstr(st,2)); + int16 x1 = script_getnum(st,3); + int16 y1 = script_getnum(st,4); + int16 x2 = script_getnum(st,5); + int16 y2 = script_getnum(st,6); cell_t type = (cell_t)script_getnum(st,7); bool flag = (bool)script_getnum(st,8); @@ -16126,7 +16128,8 @@ BUILDIN_FUNC(bg_destroy) BUILDIN_FUNC(bg_getareausers) { const char *str; - int m, x0, y0, x1, y1, bg_id; + int16 m, x0, y0, x1, y1; + int bg_id; int i = 0, c = 0; struct battleground_data *bg = NULL; struct map_session_data *sd; @@ -16161,7 +16164,7 @@ BUILDIN_FUNC(bg_getareausers) BUILDIN_FUNC(bg_updatescore) { const char *str; - int m; + int16 m; str = script_getstr(st,2); if( (m = map_mapname2mapid(str)) < 0 ) @@ -16261,7 +16264,7 @@ BUILDIN_FUNC(instance_destroy) BUILDIN_FUNC(instance_attachmap) { const char *name; - int m; + int16 m; int instance_id; bool usebasename = false; @@ -16286,7 +16289,8 @@ BUILDIN_FUNC(instance_detachmap) struct map_session_data *sd; struct party_data *p; const char *str; - int m, instance_id; + int16 m; + int instance_id; str = script_getstr(st, 2); if( script_hasdata(st, 3) ) @@ -16452,7 +16456,8 @@ BUILDIN_FUNC(has_instance) struct map_session_data *sd; struct party_data *p; const char *str; - int m, instance_id = 0; + int16 m; + int instance_id = 0; str = script_getstr(st, 2); if( script_hasdata(st, 3) ) @@ -16475,7 +16480,8 @@ BUILDIN_FUNC(has_instance) BUILDIN_FUNC(instance_warpall) { struct map_session_data *pl_sd; - int m, i, instance_id; + int16 m, i; + int instance_id; const char *mapn; int x, y; unsigned short mapindex; @@ -16587,8 +16593,8 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap) TBL_MOB* md = (TBL_MOB*)bl; struct block_list *tbl; int mobid = va_arg(ap,int); - int skillid = va_arg(ap,int); - int skilllv = va_arg(ap,int); + uint16 skill_id = va_arg(ap,int); + uint16 skill_lv = va_arg(ap,int); int casttime = va_arg(ap,int); int cancel = va_arg(ap,int); int emotion = va_arg(ap,int); @@ -16603,7 +16609,7 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap) case 0: tbl = map_id2bl(md->bl.id); break; case 1: tbl = map_id2bl(md->target_id); break; case 2: tbl = map_id2bl(md->master_id); break; - default:tbl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md),skill_get_range2(&md->bl, skillid, skilllv)); break; + default:tbl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md),skill_get_range2(&md->bl, skill_id, skill_lv)); break; } if( !tbl ) @@ -16612,10 +16618,10 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap) if( md->ud.skilltimer != INVALID_TIMER ) // Cancel the casting skill. unit_skillcastcancel(bl,0); - if( skill_get_casttype(skillid) == CAST_GROUND ) - unit_skilluse_pos2(&md->bl, tbl->x, tbl->y, skillid, skilllv, casttime, cancel); + if( skill_get_casttype(skill_id) == CAST_GROUND ) + unit_skilluse_pos2(&md->bl, tbl->x, tbl->y, skill_id, skill_lv, casttime, cancel); else - unit_skilluse_id2(&md->bl, tbl->id, skillid, skilllv, casttime, cancel); + unit_skilluse_id2(&md->bl, tbl->id, skill_id, skill_lv, casttime, cancel); clif_emotion(&md->bl, emotion); @@ -16627,7 +16633,8 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap) BUILDIN_FUNC(areamobuseskill) { struct block_list center; - int m,range,mobid,skillid,skilllv,casttime,emotion,target,cancel; + int16 m; + int range,mobid,skill_id,skill_lv,casttime,emotion,target,cancel; if( (m = map_mapname2mapid(script_getstr(st,2))) < 0 ) { @@ -16643,16 +16650,16 @@ BUILDIN_FUNC(areamobuseskill) center.y = script_getnum(st,4); range = script_getnum(st,5); mobid = script_getnum(st,6); - skillid = ( script_isstring(st,7) ? skill_name2id(script_getstr(st,7)) : script_getnum(st,7) ); - if( (skilllv = script_getnum(st,8)) > battle_config.mob_max_skilllvl ) - skilllv = battle_config.mob_max_skilllvl; + skill_id = ( script_isstring(st,7) ? skill_name2id(script_getstr(st,7)) : script_getnum(st,7) ); + if( (skill_lv = script_getnum(st,8)) > battle_config.mob_max_skilllvl ) + skill_lv = battle_config.mob_max_skilllvl; casttime = script_getnum(st,9); cancel = script_getnum(st,10); emotion = script_getnum(st,11); target = script_getnum(st,12); - map_foreachinrange(buildin_mobuseskill_sub, ¢er, range, BL_MOB, mobid, skillid, skilllv, casttime, cancel, emotion, target); + map_foreachinrange(buildin_mobuseskill_sub, ¢er, range, BL_MOB, mobid, skill_id, skill_lv, casttime, cancel, emotion, target); return 0; } @@ -16680,7 +16687,8 @@ BUILDIN_FUNC(progressbar) BUILDIN_FUNC(pushpc) { - int direction, cells, dx, dy; + uint8 dir; + int cells, dx, dy; struct map_session_data* sd; if((sd = script_rid2sd(st))==NULL) @@ -16688,15 +16696,15 @@ BUILDIN_FUNC(pushpc) return 0; } - direction = script_getnum(st,2); + dir = script_getnum(st,2); cells = script_getnum(st,3); - if(direction<0 || direction>7) + if(dir<0 || dir>7) { - ShowWarning("buildin_pushpc: Invalid direction %d specified.\n", direction); + ShowWarning("buildin_pushpc: Invalid direction %d specified.\n", dir); script_reportsrc(st); - direction%= 8; // trim spin-over + dir%= 8; // trim spin-over } if(!cells) @@ -16705,12 +16713,12 @@ BUILDIN_FUNC(pushpc) } else if(cells<0) {// pushing backwards - direction = (direction+4)%8; // turn around + dir = (dir+4)%8; // turn around cells = -cells; } - dx = dirx[direction]; - dy = diry[direction]; + dx = dirx[dir]; + dy = diry[dir]; unit_blown(&sd->bl, dx, dy, cells, 0); return 0; @@ -17241,18 +17249,15 @@ static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) BUILDIN_FUNC(cleanmap) { - const char *map; - int m = -1, index = -1; - short x0 = 0, y0 = 0, x1 = 0, y1 = 0; + const char *map; + int16 m = -1; + int16 x0 = 0, y0 = 0, x1 = 0, y1 = 0; - map = script_getstr(st, 2); - index = mapindex_name2id(map); - if (index) - m = map_mapindex2mapid(index); - + map = script_getstr(st, 2); + m = map_mapname2mapid(map); if (!m) return 1; - + if ((script_lastdata(st) - 2) < 4) { map_foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM); } else { @@ -17267,7 +17272,7 @@ BUILDIN_FUNC(cleanmap) return 1; } } - + return 0; } /* Cast a skill on the attached player. @@ -17275,7 +17280,7 @@ BUILDIN_FUNC(cleanmap) * npcskill "<skill name>", <skill lvl>, <stat point>, <NPC level>; */ BUILDIN_FUNC(npcskill) { - unsigned int skill_id; + uint16 skill_id; unsigned short skill_level; unsigned int stat_point; unsigned int npc_level; diff --git a/src/map/skill.c b/src/map/skill.c index ece45ce92..069485b5f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -83,7 +83,7 @@ struct skill_cd { **/ DBMap* skillusave_db = NULL; // char_id -> struct skill_usave struct skill_usave { - int skill_num, skill_lv; + uint16 skill_id, skill_lv; }; struct s_skill_db skill_db[MAX_SKILL_DB]; @@ -91,7 +91,7 @@ struct s_skill_produce_db skill_produce_db[MAX_SKILL_PRODUCE_DB]; struct s_skill_arrow_db skill_arrow_db[MAX_SKILL_ARROW_DB]; struct s_skill_abra_db skill_abra_db[MAX_SKILL_ABRA_DB]; struct s_skill_improvise_db { - int skillid; + uint16 skill_id; short per;//1-10000 }; struct s_skill_improvise_db skill_improvise_db[MAX_SKILL_IMPROVISE_DB]; @@ -107,7 +107,7 @@ struct s_skill_changematerial_db skill_changematerial_db[MAX_SKILL_PRODUCE_DB]; //Warlock struct s_skill_spellbook_db { int nameid; - int skillid; + uint16 skill_id; int point; }; @@ -120,9 +120,9 @@ int firewall_unit_pos; int icewall_unit_pos; int earthstrain_unit_pos; //early declaration -int skill_block_check(struct block_list *bl, enum sc_type type, int skillid); -static int skill_check_unit_range (struct block_list *bl, int x, int y, int skillid, int skilllv); -static int skill_check_unit_range2 (struct block_list *bl, int x, int y, int skillid, int skilllv); +int skill_block_check(struct block_list *bl, enum sc_type type, uint16 skill_id); +static int skill_check_unit_range (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv); +static int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv); static int skill_destroy_trap( struct block_list *bl, va_list ap ); //Since only mob-casted splash skills can hit ice-walls static inline int splash_target(struct block_list* bl) @@ -145,108 +145,108 @@ 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( int id ) +int skill_get_index( uint16 skill_id ) { // avoid ranges reserved for mapping guild/homun/mercenary skills - if( (id >= GD_SKILLRANGEMIN && id <= GD_SKILLRANGEMAX) - || (id >= HM_SKILLRANGEMIN && id <= HM_SKILLRANGEMAX) - || (id >= MC_SKILLRANGEMIN && id <= MC_SKILLRANGEMAX) - || (id >= EL_SKILLRANGEMIN && id <= EL_SKILLRANGEMAX) ) + if( (skill_id >= GD_SKILLRANGEMIN && skill_id <= GD_SKILLRANGEMAX) + || (skill_id >= HM_SKILLRANGEMIN && skill_id <= HM_SKILLRANGEMAX) + || (skill_id >= MC_SKILLRANGEMIN && skill_id <= MC_SKILLRANGEMAX) + || (skill_id >= EL_SKILLRANGEMIN && skill_id <= EL_SKILLRANGEMAX) ) return 0; // map skill id to skill db index - if( id >= GD_SKILLBASE ) - id = GD_SKILLRANGEMIN + id - GD_SKILLBASE; - else if( id >= EL_SKILLBASE ) - id = EL_SKILLRANGEMIN + id - EL_SKILLBASE; - else if( id >= MC_SKILLBASE ) - id = MC_SKILLRANGEMIN + id - MC_SKILLBASE; - else if( id >= HM_SKILLBASE ) - id = HM_SKILLRANGEMIN + id - HM_SKILLBASE; + if( skill_id >= GD_SKILLBASE ) + skill_id = GD_SKILLRANGEMIN + skill_id - GD_SKILLBASE; + else if( skill_id >= EL_SKILLBASE ) + skill_id = EL_SKILLRANGEMIN + skill_id - EL_SKILLBASE; + else if( skill_id >= MC_SKILLBASE ) + skill_id = MC_SKILLRANGEMIN + skill_id - MC_SKILLBASE; + else if( skill_id >= HM_SKILLBASE ) + skill_id = HM_SKILLRANGEMIN + skill_id - HM_SKILLBASE; // validate result - if( id <= 0 || id >= MAX_SKILL_DB ) + if( skill_id <= 0 || skill_id >= MAX_SKILL_DB ) return 0; - return id; + return skill_id; } -const char* skill_get_name( int id ) +const char* skill_get_name( uint16 skill_id ) { - return skill_db[skill_get_index(id)].name; + return skill_db[skill_get_index(skill_id)].name; } -const char* skill_get_desc( int id ) +const char* skill_get_desc( uint16 skill_id ) { - return skill_db[skill_get_index(id)].desc; + return skill_db[skill_get_index(skill_id)].desc; } // out of bounds error checking [celest] -static void skill_chk(int* id, int lv) +static void skill_chk(int16* skill_id, uint16 skill_lv) { - *id = skill_get_index(*id); // checks/adjusts id - if( lv <= 0 || lv > MAX_SKILL_LEVEL ) *id = 0; + *skill_id = skill_get_index(*skill_id); // checks/adjusts id + if( skill_lv <= 0 || skill_lv > MAX_SKILL_LEVEL ) *skill_id = 0; } #define skill_get(var,id,lv) { skill_chk(&id,lv); if(!id) return 0; return var; } // Skill DB -int skill_get_hit( int id ) { skill_get (skill_db[id].hit, id, 1); } -int skill_get_inf( int id ) { skill_get (skill_db[id].inf, id, 1); } -int skill_get_ele( int id , int lv ) { skill_get (skill_db[id].element[lv-1], id, lv); } -int skill_get_nk( int id ) { skill_get (skill_db[id].nk, id, 1); } -int skill_get_max( int id ) { skill_get (skill_db[id].max, id, 1); } -int skill_get_range( int id , int lv ) { skill_get (skill_db[id].range[lv-1], id, lv); } -int skill_get_splash( int id , int lv ) { skill_chk (&id, lv); return (skill_db[id].splash[lv-1]>=0?skill_db[id].splash[lv-1]:AREA_SIZE); } -int skill_get_hp( int id ,int lv ) { skill_get (skill_db[id].hp[lv-1], id, lv); } -int skill_get_sp( int id ,int lv ) { skill_get (skill_db[id].sp[lv-1], id, lv); } -int skill_get_hp_rate(int id, int lv ) { skill_get (skill_db[id].hp_rate[lv-1], id, lv); } -int skill_get_sp_rate(int id, int lv ) { skill_get (skill_db[id].sp_rate[lv-1], id, lv); } -int skill_get_state(int id) { skill_get (skill_db[id].state, id, 1); } -int skill_get_spiritball(int id, int lv) { skill_get (skill_db[id].spiritball[lv-1], id, lv); } -int skill_get_itemid(int id, int idx) { skill_get (skill_db[id].itemid[idx], id, 1); } -int skill_get_itemqty(int id, int idx) { skill_get (skill_db[id].amount[idx], id, 1); } -int skill_get_zeny( int id ,int lv ) { skill_get (skill_db[id].zeny[lv-1], id, lv); } -int skill_get_num( int id ,int lv ) { skill_get (skill_db[id].num[lv-1], id, lv); } -int skill_get_cast( int id ,int lv ) { skill_get (skill_db[id].cast[lv-1], id, lv); } -int skill_get_delay( int id ,int lv ) { skill_get (skill_db[id].delay[lv-1], id, lv); } -int skill_get_walkdelay( int id ,int lv ) { skill_get (skill_db[id].walkdelay[lv-1], id, lv); } -int skill_get_time( int id ,int lv ) { skill_get (skill_db[id].upkeep_time[lv-1], id, lv); } -int skill_get_time2( int id ,int lv ) { skill_get (skill_db[id].upkeep_time2[lv-1], id, lv); } -int skill_get_castdef( int id ) { skill_get (skill_db[id].cast_def_rate, id, 1); } -int skill_get_weapontype( int id ) { skill_get (skill_db[id].weapon, id, 1); } -int skill_get_ammotype( int id ) { skill_get (skill_db[id].ammo, id, 1); } -int skill_get_ammo_qty( int id, int lv ) { skill_get (skill_db[id].ammo_qty[lv-1], id, lv); } -int skill_get_inf2( int id ) { skill_get (skill_db[id].inf2, id, 1); } -int skill_get_castcancel( int id ) { skill_get (skill_db[id].castcancel, id, 1); } -int skill_get_maxcount( int id ,int lv ) { skill_get (skill_db[id].maxcount[lv-1], id, lv); } -int skill_get_blewcount( int id ,int lv ) { skill_get (skill_db[id].blewcount[lv-1], id, lv); } -int skill_get_mhp( int id ,int lv ) { skill_get (skill_db[id].mhp[lv-1], id, lv); } -int skill_get_castnodex( int id ,int lv ) { skill_get (skill_db[id].castnodex[lv-1], id, lv); } -int skill_get_delaynodex( int id ,int lv ){ skill_get (skill_db[id].delaynodex[lv-1], id, lv); } -int skill_get_nocast ( int id ) { skill_get (skill_db[id].nocast, id, 1); } -int skill_get_type( int id ) { skill_get (skill_db[id].skill_type, id, 1); } -int skill_get_unit_id ( int id, int flag ){ skill_get (skill_db[id].unit_id[flag], id, 1); } -int skill_get_unit_interval( int id ) { skill_get (skill_db[id].unit_interval, id, 1); } -int skill_get_unit_range( int id, int lv ){ skill_get (skill_db[id].unit_range[lv-1], id, lv); } -int skill_get_unit_target( int id ) { skill_get (skill_db[id].unit_target&BCT_ALL, id, 1); } -int skill_get_unit_bl_target( int id ) { skill_get (skill_db[id].unit_target&BL_ALL, id, 1); } -int skill_get_unit_flag( int id ) { skill_get (skill_db[id].unit_flag, id, 1); } -int skill_get_unit_layout_type( int id ,int lv ){ skill_get (skill_db[id].unit_layout_type[lv-1], id, lv); } -int skill_get_cooldown( int id ,int lv ) { skill_get (skill_db[id].cooldown[lv-1], id, lv); } +int skill_get_hit( uint16 skill_id ) { skill_get (skill_db[skill_id].hit, skill_id, 1); } +int skill_get_inf( uint16 skill_id ) { skill_get (skill_db[skill_id].inf, skill_id, 1); } +int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { skill_get (skill_db[skill_id].element[skill_lv-1], skill_id, skill_lv); } +int skill_get_nk( uint16 skill_id ) { skill_get (skill_db[skill_id].nk, skill_id, 1); } +int skill_get_max( uint16 skill_id ) { skill_get (skill_db[skill_id].max, skill_id, 1); } +int skill_get_range( uint16 skill_id , uint16 skill_lv ) { skill_get (skill_db[skill_id].range[skill_lv-1], skill_id, skill_lv); } +int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { skill_chk (&skill_id, skill_lv); return (skill_db[skill_id].splash[skill_lv-1]>=0?skill_db[skill_id].splash[skill_lv-1]:AREA_SIZE); } +int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].hp[skill_lv-1], skill_id, skill_lv); } +int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].sp[skill_lv-1], skill_id, skill_lv); } +int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get (skill_db[skill_id].hp_rate[skill_lv-1], skill_id, skill_lv); } +int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get (skill_db[skill_id].sp_rate[skill_lv-1], skill_id, skill_lv); } +int skill_get_state(uint16 skill_id) { skill_get (skill_db[skill_id].state, skill_id, 1); } +int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { skill_get (skill_db[skill_id].spiritball[skill_lv-1], skill_id, skill_lv); } +int skill_get_itemid(uint16 skill_id, int idx) { skill_get (skill_db[skill_id].itemid[idx], skill_id, 1); } +int skill_get_itemqty(uint16 skill_id, int idx) { skill_get (skill_db[skill_id].amount[idx], skill_id, 1); } +int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].zeny[skill_lv-1], skill_id, skill_lv); } +int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].num[skill_lv-1], skill_id, skill_lv); } +int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].cast[skill_lv-1], skill_id, skill_lv); } +int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].delay[skill_lv-1], skill_id, skill_lv); } +int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].walkdelay[skill_lv-1], skill_id, skill_lv); } +int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].upkeep_time[skill_lv-1], skill_id, skill_lv); } +int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].upkeep_time2[skill_lv-1], skill_id, skill_lv); } +int skill_get_castdef( uint16 skill_id ) { skill_get (skill_db[skill_id].cast_def_rate, skill_id, 1); } +int skill_get_weapontype( uint16 skill_id ) { skill_get (skill_db[skill_id].weapon, skill_id, 1); } +int skill_get_ammotype( uint16 skill_id ) { skill_get (skill_db[skill_id].ammo, skill_id, 1); } +int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { skill_get (skill_db[skill_id].ammo_qty[skill_lv-1], skill_id, skill_lv); } +int skill_get_inf2( uint16 skill_id ) { skill_get (skill_db[skill_id].inf2, skill_id, 1); } +int skill_get_castcancel( uint16 skill_id ) { skill_get (skill_db[skill_id].castcancel, skill_id, 1); } +int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].maxcount[skill_lv-1], skill_id, skill_lv); } +int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].blewcount[skill_lv-1], skill_id, skill_lv); } +int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].mhp[skill_lv-1], skill_id, skill_lv); } +int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { skill_get (skill_db[skill_id].castnodex[skill_lv-1], skill_id, skill_lv); } +int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ skill_get (skill_db[skill_id].delaynodex[skill_lv-1], skill_id, skill_lv); } +int skill_get_nocast ( uint16 skill_id ) { skill_get (skill_db[skill_id].nocast, skill_id, 1); } +int skill_get_type( uint16 skill_id ) { skill_get (skill_db[skill_id].skill_type, skill_id, 1); } +int skill_get_unit_id ( uint16 skill_id, int flag ){ skill_get (skill_db[skill_id].unit_id[flag], skill_id, 1); } +int skill_get_unit_interval( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_interval, skill_id, 1); } +int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ){ skill_get (skill_db[skill_id].unit_range[skill_lv-1], skill_id, skill_lv); } +int skill_get_unit_target( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_target&BCT_ALL, skill_id, 1); } +int skill_get_unit_bl_target( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_target&BL_ALL, skill_id, 1); } +int skill_get_unit_flag( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_flag, skill_id, 1); } +int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ skill_get (skill_db[skill_id].unit_layout_type[skill_lv-1], skill_id, skill_lv); } +int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { skill_get (skill_db[skill_id].cooldown[skill_lv-1], skill_id, skill_lv); } #ifdef RENEWAL_CAST -int skill_get_fixed_cast( int id ,int lv ){ skill_get (skill_db[id].fixed_cast[lv-1], id, lv); } +int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ){ skill_get (skill_db[skill_id].fixed_cast[skill_lv-1], skill_id, skill_lv); } #endif -int skill_tree_get_max(int id, int b_class) +int skill_tree_get_max(uint16 skill_id, int b_class) { int i; b_class = pc_class2idx(b_class); - ARR_FIND( 0, MAX_SKILL_TREE, i, skill_tree[b_class][i].id == 0 || skill_tree[b_class][i].id == id ); - if( i < MAX_SKILL_TREE && skill_tree[b_class][i].id == id ) + ARR_FIND( 0, MAX_SKILL_TREE, i, skill_tree[b_class][i].id == 0 || skill_tree[b_class][i].id == skill_id ); + if( i < MAX_SKILL_TREE && skill_tree[b_class][i].id == skill_id ) return skill_tree[b_class][i].max; else - return skill_get_max(id); + return skill_get_max(skill_id); } int skill_frostjoke_scream(struct block_list *bl,va_list ap); @@ -254,42 +254,42 @@ int skill_attack_area(struct block_list *bl,va_list ap); struct skill_unit_group *skill_locate_element_field(struct block_list *bl); // [Skotlex] int skill_graffitiremover(struct block_list *bl, va_list ap); // [Valaris] int skill_greed(struct block_list *bl, va_list ap); -static void skill_toggle_magicpower(struct block_list *bl, short skillid); +static void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id); static int skill_cell_overlap(struct block_list *bl, va_list ap); static int skill_trap_splash(struct block_list *bl, va_list ap); struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl,struct skill_unit_group *sg,int tick); static int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int tick); -static int skill_unit_onleft(int skill_id, struct block_list *bl,unsigned int tick); +static int skill_unit_onleft(uint16 skill_id, struct block_list *bl,unsigned int tick); static int skill_unit_effect(struct block_list *bl,va_list ap); int enchant_eff[5] = { 10, 14, 17, 19, 20 }; int deluge_eff[5] = { 5, 9, 12, 14, 15 }; -int skill_get_casttype (int id) +int skill_get_casttype (uint16 skill_id) { - int inf = skill_get_inf(id); + int inf = skill_get_inf(skill_id); if (inf&(INF_GROUND_SKILL)) return CAST_GROUND; if (inf&INF_SUPPORT_SKILL) return CAST_NODAMAGE; if (inf&INF_SELF_SKILL) { - if(skill_get_inf2(id)&INF2_NO_TARGET_SELF) + if(skill_get_inf2(skill_id)&INF2_NO_TARGET_SELF) return CAST_DAMAGE; //Combo skill. return CAST_NODAMAGE; } - if (skill_get_nk(id)&NK_NO_DAMAGE) + if (skill_get_nk(skill_id)&NK_NO_DAMAGE) return CAST_NODAMAGE; return CAST_DAMAGE; } //Returns actual skill range taking into account attack range and AC_OWL [Skotlex] -int skill_get_range2 (struct block_list *bl, int id, int lv) +int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { int range; if( bl->type == BL_MOB && battle_config.mob_ai&0x400 ) return 9; //Mobs have a range of 9 regardless of skill used. - range = skill_get_range(id, lv); + range = skill_get_range(skill_id, skill_lv); if( range < 0 ) { @@ -299,7 +299,7 @@ int skill_get_range2 (struct block_list *bl, int id, int lv) } //TODO: Find a way better than hardcoding the list of skills affected by AC_VULTURE - switch( id ) + switch( skill_id ) { case AC_SHOWER: case MA_SHOWER: case AC_DOUBLE: case MA_DOUBLE: @@ -371,7 +371,7 @@ int skill_get_range2 (struct block_list *bl, int id, int lv) return range; } -int skill_calc_heal(struct block_list *src, struct block_list *target, int skill_id, int skill_lv, bool heal) { +int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal) { int skill, hp; struct map_session_data *sd = BL_CAST(BL_PC, src); struct map_session_data *tsd = BL_CAST(BL_PC, target); @@ -471,14 +471,14 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, int skill } // Making plagiarize check its own function [Aru] -int can_copy (struct map_session_data *sd, int skillid, struct block_list* bl) +int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* bl) { // Never copy NPC/Wedding Skills - if (skill_get_inf2(skillid)&(INF2_NPC_SKILL|INF2_WEDDING_SKILL)) + if (skill_get_inf2(skill_id)&(INF2_NPC_SKILL|INF2_WEDDING_SKILL)) return 0; // High-class skills - if((skillid >= LK_AURABLADE && skillid <= ASC_CDP) || (skillid >= ST_PRESERVE && skillid <= CR_CULTIVATION)) + if((skill_id >= LK_AURABLADE && skill_id <= ASC_CDP) || (skill_id >= ST_PRESERVE && skill_id <= CR_CULTIVATION)) { if(battle_config.copyskill_restrict == 2) return 0; @@ -487,64 +487,64 @@ int can_copy (struct map_session_data *sd, int skillid, struct block_list* bl) } //Added so plagarize can't copy agi/bless if you're undead since it damages you - if ((skillid == AL_INCAGI || skillid == AL_BLESSING || - skillid == CASH_BLESSING || skillid == CASH_INCAGI || - skillid == MER_INCAGI || skillid == MER_BLESSING)) + if ((skill_id == AL_INCAGI || skill_id == AL_BLESSING || + skill_id == CASH_BLESSING || skill_id == CASH_INCAGI || + skill_id == MER_INCAGI || skill_id == MER_BLESSING)) return 0; // Couldn't preserve 3rd Class skills except only when using Reproduce skill. [Jobbie] - if( !(sd->sc.data[SC__REPRODUCE]) && (skillid >= RK_ENCHANTBLADE && skillid <= SR_RIDEINLIGHTNING) ) + if( !(sd->sc.data[SC__REPRODUCE]) && (skill_id >= RK_ENCHANTBLADE && skill_id <= SR_RIDEINLIGHTNING) ) return 0; // Reproduce will only copy skills according on the list. [Jobbie] - else if( sd->sc.data[SC__REPRODUCE] && !skill_reproduce_db[skillid] ) + else if( sd->sc.data[SC__REPRODUCE] && !skill_reproduce_db[skill_id] ) return 0; return 1; } // [MouseJstr] - skill ok to cast? and when? -int skillnotok (int skillid, struct map_session_data *sd) +int skillnotok (uint16 skill_id, struct map_session_data *sd) { - int i,m; + int16 idx,m; nullpo_retr (1, sd); m = sd->bl.m; - i = skill_get_index(skillid); + idx = skill_get_index(skill_id); - if (i == 0) + if (idx == 0) return 1; // invalid skill id if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL)) return 0; // can do any damn thing they want - if( skillid == AL_TELEPORT && sd->skillitem == skillid && sd->skillitemlv > 2 ) + if( skill_id == AL_TELEPORT && sd->skillitem == skill_id && sd->skillitemlv > 2 ) return 0; // Teleport lv 3 bypasses this check.[Inkfish] // Epoque: // This code will compare the player's attack motion value which is influenced by ASPD before // allowing a skill to be cast. This is to prevent no-delay ACT files from spamming skills such as // AC_DOUBLE which do not have a skill delay and are not regarded in terms of attack motion. - if( !sd->state.autocast && sd->skillitem != skillid && sd->canskill_tick && + if( !sd->state.autocast && sd->skillitem != skill_id && sd->canskill_tick && DIFF_TICK(gettick(), sd->canskill_tick) < (sd->battle_status.amotion * (100 + battle_config.skill_amotion_leniency) / 100) ) {// attempted to cast a skill before the attack motion has finished return 1; } - if (sd->blockskill[i] > 0){ - clif_skill_fail(sd, skillid, USESKILL_FAIL_SKILLINTERVAL, 0); + if (sd->blockskill[idx] > 0){ + clif_skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return 1; } /** * It has been confirmed on a official server (thanks to Yommy) that item-cast skills bypass all the restrictions above * Also, without this check, an exploit where an item casting + healing (or any other kind buff) isn't deleted after used on a restricted map **/ - if( sd->skillitem == skillid ) + if( sd->skillitem == skill_id ) return 0; // Check skill restrictions [Celest] - if( (!map_flag_vs(m) && skill_get_nocast (skillid) & 1) || - (map[m].flag.pvp && skill_get_nocast (skillid) & 2) || - (map_flag_gvg(m) && skill_get_nocast (skillid) & 4) || - (map[m].flag.battleground && skill_get_nocast (skillid) & 8) || - (map[m].flag.restricted && map[m].zone && skill_get_nocast (skillid) & (8*map[m].zone)) ){ + if( (!map_flag_vs(m) && skill_get_nocast (skill_id) & 1) || + (map[m].flag.pvp && skill_get_nocast (skill_id) & 2) || + (map_flag_gvg(m) && skill_get_nocast (skill_id) & 4) || + (map[m].flag.battleground && skill_get_nocast (skill_id) & 8) || + (map[m].flag.restricted && map[m].zone && skill_get_nocast (skill_id) & (8*map[m].zone)) ){ clif_msg(sd, 0x536); // This skill cannot be used within this area return 1; } @@ -552,7 +552,7 @@ int skillnotok (int skillid, struct map_session_data *sd) if( sd->sc.option&OPTION_MOUNTING ) return 1;//You can't use skills while in the new mounts (The client doesn't let you, this is to make cheat-safe) - switch (skillid) { + switch (skill_id) { case AL_WARP: case RETURN_TO_ELDICASTES: case ALL_GUARDIAN_RECALL: @@ -584,13 +584,13 @@ int skillnotok (int skillid, struct map_session_data *sd) case WZ_ICEWALL: // noicewall flag [Valaris] if (map[m].flag.noicewall) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } break; case GC_DARKILLUSION: if( map_flag_gvg(m) ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } break; @@ -600,7 +600,7 @@ int skillnotok (int skillid, struct map_session_data *sd) !(battle_config.emergency_call&(map[m].flag.gvg || map[m].flag.gvg_castle?8:4)) || (battle_config.emergency_call&16 && map[m].flag.nowarpto && !map[m].flag.gvg_castle) ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } break; @@ -617,7 +617,7 @@ int skillnotok (int skillid, struct map_session_data *sd) * These skills cannot be used while in mado gear (credits to Xantara) **/ if( pc_ismadogear(sd) ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } break; @@ -637,17 +637,17 @@ int skillnotok (int skillid, struct map_session_data *sd) return (map[m].flag.noskill); } -int skillnotok_hom(int skillid, struct homun_data *hd) +int skillnotok_hom(uint16 skill_id, struct homun_data *hd) { - int i = skill_get_index(skillid); + uint16 idx = skill_get_index(skill_id); nullpo_retr(1,hd); - if (i == 0) + if (idx == 0) return 1; // invalid skill id - if (hd->blockskill[i] > 0) + if (hd->blockskill[idx] > 0) return 1; - switch(skillid){ + switch(skill_id){ case MH_LIGHT_OF_REGENE: if(hd->homunculus.intimacy <= 750) //if not cordial return 1; @@ -665,29 +665,29 @@ int skillnotok_hom(int skillid, struct homun_data *hd) } //Use master's criteria. - return skillnotok(skillid, hd->master); + return skillnotok(skill_id, hd->master); } -int skillnotok_mercenary(int skillid, struct mercenary_data *md) +int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md) { - int i = skill_get_index(skillid); + uint16 idx = skill_get_index(skill_id); nullpo_retr(1,md); - if( i == 0 ) + if( idx == 0 ) return 1; // Invalid Skill ID - if( md->blockskill[i] > 0 ) + if( md->blockskill[idx] > 0 ) return 1; - return skillnotok(skillid, md->master); + return skillnotok(skill_id, md->master); } -struct s_skill_unit_layout* skill_get_unit_layout (int skillid, int skilllv, struct block_list* src, int x, int y) +struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill_lv, struct block_list* src, int x, int y) { - int pos = skill_get_unit_layout_type(skillid,skilllv); - int dir; + int pos = skill_get_unit_layout_type(skill_id,skill_lv); + uint8 dir; if (pos < -1 || pos >= MAX_SKILL_UNIT_LAYOUT) { - ShowError("skill_get_unit_layout: unsupported layout type %d for skill %d (level %d)\n", pos, skillid, skilllv); + ShowError("skill_get_unit_layout: unsupported layout type %d for skill %d (level %d)\n", pos, skill_id, skill_lv); pos = cap_value(pos, 0, MAX_SQUARE_LAYOUT); // cap to nearest square layout } @@ -696,21 +696,21 @@ struct s_skill_unit_layout* skill_get_unit_layout (int skillid, int skilllv, str dir = (src->x == x && src->y == y) ? 6 : map_calc_dir(src,x,y); // 6 - default aegis direction - if (skillid == MG_FIREWALL) + if (skill_id == MG_FIREWALL) return &skill_unit_layout [firewall_unit_pos + dir]; - else if (skillid == WZ_ICEWALL) + else if (skill_id == WZ_ICEWALL) return &skill_unit_layout [icewall_unit_pos + dir]; - else if( skillid == WL_EARTHSTRAIN ) //Warlock + else if( skill_id == WL_EARTHSTRAIN ) //Warlock return &skill_unit_layout [earthstrain_unit_pos + dir]; - ShowError("skill_get_unit_layout: unknown unit layout for skill %d (level %d)\n", skillid, skilllv); + ShowError("skill_get_unit_layout: unknown unit layout for skill %d (level %d)\n", skill_id, skill_lv); return &skill_unit_layout[0]; // default 1x1 layout } /*========================================== * *------------------------------------------*/ -int skill_additional_effect (struct block_list* src, struct block_list *bl, int skillid, int skilllv, int attack_type, int dmg_lv, unsigned int tick) +int skill_additional_effect (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int dmg_lv, unsigned int tick) { struct map_session_data *sd, *dstsd; struct mob_data *md, *dstmd; @@ -724,8 +724,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int nullpo_ret(src); nullpo_ret(bl); - if(skillid < 0) return 0; - if(skillid > 0 && skilllv <= 0) return 0; // don't forget auto attacks! - celest + if(skill_id < 0) return 0; + if(skill_id > 0 && skill_lv <= 0) return 0; // don't forget auto attacks! - celest if( dmg_lv < ATK_BLOCK ) // Don't apply effect if miss. return 0; @@ -745,7 +745,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int if( sd ) { // These statuses would be applied anyway even if the damage was blocked by some skills. [Inkfish] - if( skillid != WS_CARTTERMINATION && skillid != AM_DEMONSTRATION && skillid != CR_REFLECTSHIELD && skillid != MS_REFLECTSHIELD && skillid != ASC_BREAKER ) + if( skill_id != WS_CARTTERMINATION && skill_id != AM_DEMONSTRATION && skill_id != CR_REFLECTSHIELD && skill_id != MS_REFLECTSHIELD && skill_id != ASC_BREAKER ) { // Trigger status effects enum sc_type type; int i; @@ -783,13 +783,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int } } - if( skillid ) + if( skill_id ) { // Trigger status effects on skills enum sc_type type; int i; for( i = 0; i < ARRAYLENGTH(sd->addeff3) && sd->addeff3[i].skill; i++ ) { - if( skillid != sd->addeff3[i].skill || !sd->addeff3[i].rate ) + if( skill_id != sd->addeff3[i].skill || !sd->addeff3[i].rate ) continue; type = sd->addeff3[i].id; skill = skill_get_time2(status_sc2skill(type),7); @@ -805,7 +805,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int if( dmg_lv < ATK_DEF ) // no damage, return; return 0; - switch(skillid) + switch(skill_id) { case 0: // Normal attacks (no skill used) { @@ -873,46 +873,46 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int break; case SM_BASH: - if( sd && skilllv > 5 && pc_checkskill(sd,SM_FATALBLOW)>0 ){ + if( sd && skill_lv > 5 && pc_checkskill(sd,SM_FATALBLOW)>0 ){ //TODO: How much % per base level it actually is? - sc_start(bl,SC_STUN,(5*(skilllv-5)+(int)sd->status.base_level/10), - skilllv,skill_get_time2(SM_FATALBLOW,skilllv)); + sc_start(bl,SC_STUN,(5*(skill_lv-5)+(int)sd->status.base_level/10), + skill_lv,skill_get_time2(SM_FATALBLOW,skill_lv)); } break; case MER_CRASH: - sc_start(bl,SC_STUN,(6*skilllv),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,(6*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case AS_VENOMKNIFE: if (sd) //Poison chance must be that of Envenom. [Skotlex] - skilllv = pc_checkskill(sd, TF_POISON); + skill_lv = pc_checkskill(sd, TF_POISON); case TF_POISON: case AS_SPLASHER: - if(!sc_start2(bl,SC_POISON,(4*skilllv+10),skilllv,src->id,skill_get_time2(skillid,skilllv)) - && sd && skillid==TF_POISON + if(!sc_start2(bl,SC_POISON,(4*skill_lv+10),skill_lv,src->id,skill_get_time2(skill_id,skill_lv)) + && sd && skill_id==TF_POISON ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; case AS_SONICBLOW: - sc_start(bl,SC_STUN,(2*skilllv+10),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,(2*skill_lv+10),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case WZ_FIREPILLAR: - unit_set_walkdelay(bl, tick, skill_get_time2(skillid, skilllv), 1); + unit_set_walkdelay(bl, tick, skill_get_time2(skill_id, skill_lv), 1); break; case MG_FROSTDIVER: #ifndef RENEWAL case WZ_FROSTNOVA: #endif - sc_start(bl,SC_FREEZE,skilllv*3+35,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_FREEZE,skill_lv*3+35,skill_lv,skill_get_time2(skill_id,skill_lv)); break; #ifdef RENEWAL case WZ_FROSTNOVA: - sc_start(bl,SC_FREEZE,skilllv*5+33,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_FREEZE,skill_lv*5+33,skill_lv,skill_get_time2(skill_id,skill_lv)); break; #endif @@ -921,11 +921,11 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int * Storm Gust counter was dropped in renewal **/ #ifdef RENEWAL - sc_start(bl,SC_FREEZE,65-(5*skilllv),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_FREEZE,65-(5*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); #else //Tharis pointed out that this is normal freeze chance with a base of 300% if(tsc->sg_counter >= 3 && - sc_start(bl,SC_FREEZE,300,skilllv,skill_get_time2(skillid,skilllv))) + sc_start(bl,SC_FREEZE,300,skill_lv,skill_get_time2(skill_id,skill_lv))) tsc->sg_counter = 0; /** * being it only resets on success it'd keep stacking and eventually overflowing on mvps, so we reset at a high value @@ -936,116 +936,116 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int break; case WZ_METEOR: - sc_start(bl,SC_STUN,3*skilllv,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,3*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case WZ_VERMILION: - sc_start(bl,SC_BLIND,4*skilllv,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLIND,4*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case HT_FREEZINGTRAP: case MA_FREEZINGTRAP: - sc_start(bl,SC_FREEZE,(3*skilllv+35),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_FREEZE,(3*skill_lv+35),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case HT_FLASHER: - sc_start(bl,SC_BLIND,(10*skilllv+30),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLIND,(10*skill_lv+30),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case HT_LANDMINE: case MA_LANDMINE: - sc_start(bl,SC_STUN,(5*skilllv+30),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,(5*skill_lv+30),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case HT_SHOCKWAVE: - status_percent_damage(src, bl, 0, 15*skilllv+5, false); + status_percent_damage(src, bl, 0, 15*skill_lv+5, false); break; case HT_SANDMAN: case MA_SANDMAN: - sc_start(bl,SC_SLEEP,(10*skilllv+40),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_SLEEP,(10*skill_lv+40),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case TF_SPRINKLESAND: - sc_start(bl,SC_BLIND,20,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLIND,20,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case TF_THROWSTONE: - sc_start(bl,SC_STUN,3,skilllv,skill_get_time(skillid,skilllv)); - sc_start(bl,SC_BLIND,3,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,3,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,3,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case NPC_DARKCROSS: case CR_HOLYCROSS: - sc_start(bl,SC_BLIND,3*skilllv,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLIND,3*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case CR_GRANDCROSS: case NPC_GRANDDARKNESS: //Chance to cause blind status vs demon and undead element, but not against players if(!dstsd && (battle_check_undead(tstatus->race,tstatus->def_ele) || tstatus->race == RC_DEMON)) - sc_start(bl,SC_BLIND,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLIND,100,skill_lv,skill_get_time2(skill_id,skill_lv)); attack_type |= BF_WEAPON; break; case AM_ACIDTERROR: - sc_start(bl,SC_BLEEDING,(skilllv*3),skilllv,skill_get_time2(skillid,skilllv)); - if (skill_break_equip(bl, EQP_ARMOR, 100*skill_get_time(skillid,skilllv), BCT_ENEMY)) + sc_start(bl,SC_BLEEDING,(skill_lv*3),skill_lv,skill_get_time2(skill_id,skill_lv)); + if (skill_break_equip(bl, EQP_ARMOR, 100*skill_get_time(skill_id,skill_lv), BCT_ENEMY)) clif_emotion(bl,E_OMG); break; case AM_DEMONSTRATION: - skill_break_equip(bl, EQP_WEAPON, 100*skilllv, BCT_ENEMY); + skill_break_equip(bl, EQP_WEAPON, 100*skill_lv, BCT_ENEMY); break; case CR_SHIELDCHARGE: - sc_start(bl,SC_STUN,(15+skilllv*5),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,(15+skill_lv*5),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case PA_PRESSURE: - status_percent_damage(src, bl, 0, 15+5*skilllv, false); + status_percent_damage(src, bl, 0, 15+5*skill_lv, false); break; case RG_RAID: - sc_start(bl,SC_STUN,(10+3*skilllv),skilllv,skill_get_time(skillid,skilllv)); - sc_start(bl,SC_BLIND,(10+3*skilllv),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,(10+3*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,(10+3*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); #ifdef RENEWAL sc_start(bl,SC_RAID,100,7,5000); break; case RG_BACKSTAP: - sc_start(bl,SC_STUN,(5+2*skilllv),skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_STUN,(5+2*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv)); #endif break; case BA_FROSTJOKER: - sc_start(bl,SC_FREEZE,(15+5*skilllv),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_FREEZE,(15+5*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case DC_SCREAM: - sc_start(bl,SC_STUN,(25+5*skilllv),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,(25+5*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case BD_LULLABY: - sc_start(bl,SC_SLEEP,15,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_SLEEP,15,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case DC_UGLYDANCE: - rate = 5+5*skilllv; + rate = 5+5*skill_lv; if(sd && (skill=pc_checkskill(sd,DC_DANCINGLESSON))) rate += 5+skill; status_zap(bl, 0, rate); break; case SL_STUN: if (tstatus->size==SZ_MEDIUM) //Only stuns mid-sized mobs. - sc_start(bl,SC_STUN,(30+10*skilllv),skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_STUN,(30+10*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv)); break; case NPC_PETRIFYATTACK: - sc_start4(bl,status_skill2sc(skillid),50+10*skilllv, - skilllv,0,0,skill_get_time(skillid,skilllv), - skill_get_time2(skillid,skilllv)); + sc_start4(bl,status_skill2sc(skill_id),50+10*skill_lv, + skill_lv,0,0,skill_get_time(skill_id,skill_lv), + skill_get_time2(skill_id,skill_lv)); break; case NPC_CURSEATTACK: case NPC_SLEEPATTACK: @@ -1054,14 +1054,14 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int case NPC_SILENCEATTACK: case NPC_STUNATTACK: case NPC_HELLPOWER: - sc_start(bl,status_skill2sc(skillid),50+10*skilllv,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,status_skill2sc(skill_id),50+10*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case NPC_ACIDBREATH: case NPC_ICEBREATH: - sc_start(bl,status_skill2sc(skillid),70,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,status_skill2sc(skill_id),70,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case NPC_BLEEDING: - sc_start(bl,SC_BLEEDING,(20*skilllv),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLEEDING,(20*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case NPC_MENTALBREAKER: { //Based on observations by Tharis, Mental Breaker should do SP damage @@ -1069,82 +1069,82 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int rate = sstatus->matk_min; if (rate < sstatus->matk_max) rate += rnd()%(sstatus->matk_max - sstatus->matk_min); - rate*=skilllv; + rate*=skill_lv; status_zap(bl, 0, rate); break; } // Equipment breaking monster skills [Celest] case NPC_WEAPONBRAKER: - skill_break_equip(bl, EQP_WEAPON, 150*skilllv, BCT_ENEMY); + skill_break_equip(bl, EQP_WEAPON, 150*skill_lv, BCT_ENEMY); break; case NPC_ARMORBRAKE: - skill_break_equip(bl, EQP_ARMOR, 150*skilllv, BCT_ENEMY); + skill_break_equip(bl, EQP_ARMOR, 150*skill_lv, BCT_ENEMY); break; case NPC_HELMBRAKE: - skill_break_equip(bl, EQP_HELM, 150*skilllv, BCT_ENEMY); + skill_break_equip(bl, EQP_HELM, 150*skill_lv, BCT_ENEMY); break; case NPC_SHIELDBRAKE: - skill_break_equip(bl, EQP_SHIELD, 150*skilllv, BCT_ENEMY); + skill_break_equip(bl, EQP_SHIELD, 150*skill_lv, BCT_ENEMY); break; case CH_TIGERFIST: - sc_start(bl,SC_STOP,(10+skilllv*10),0,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STOP,(10+skill_lv*10),0,skill_get_time2(skill_id,skill_lv)); break; case LK_SPIRALPIERCE: case ML_SPIRALPIERCE: - sc_start(bl,SC_STOP,(15+skilllv*5),0,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STOP,(15+skill_lv*5),0,skill_get_time2(skill_id,skill_lv)); break; case ST_REJECTSWORD: - sc_start(bl,SC_AUTOCOUNTER,(skilllv*15),skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_AUTOCOUNTER,(skill_lv*15),skill_lv,skill_get_time(skill_id,skill_lv)); break; case PF_FOGWALL: if (src != bl && !tsc->data[SC_DELUGE]) - sc_start(bl,SC_BLIND,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLIND,100,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case LK_HEADCRUSH: //Headcrush has chance of causing Bleeding status, except on demon and undead element if (!(battle_check_undead(tstatus->race, tstatus->def_ele) || tstatus->race == RC_DEMON)) - sc_start(bl, SC_BLEEDING,50, skilllv, skill_get_time2(skillid,skilllv)); + sc_start(bl, SC_BLEEDING,50, skill_lv, skill_get_time2(skill_id,skill_lv)); break; case LK_JOINTBEAT: - status = status_skill2sc(skillid); + status = status_skill2sc(skill_id); if (tsc->jb_flag) { - sc_start2(bl,status,(5*skilllv+5),skilllv,tsc->jb_flag&BREAK_FLAGS,skill_get_time2(skillid,skilllv)); + sc_start2(bl,status,(5*skill_lv+5),skill_lv,tsc->jb_flag&BREAK_FLAGS,skill_get_time2(skill_id,skill_lv)); tsc->jb_flag = 0; } break; case ASC_METEORASSAULT: - //Any enemies hit by this skill will receive Stun, Darkness, or external bleeding status ailment with a 5%+5*SkillLV% chance. + //Any enemies hit by this skill will receive Stun, Darkness, or external bleeding status ailment with a 5%+5*skill_lv% chance. switch(rnd()%3) { case 0: - sc_start(bl,SC_BLIND,(5+skilllv*5),skilllv,skill_get_time2(skillid,1)); + sc_start(bl,SC_BLIND,(5+skill_lv*5),skill_lv,skill_get_time2(skill_id,1)); break; case 1: - sc_start(bl,SC_STUN,(5+skilllv*5),skilllv,skill_get_time2(skillid,2)); + sc_start(bl,SC_STUN,(5+skill_lv*5),skill_lv,skill_get_time2(skill_id,2)); break; default: - sc_start(bl,SC_BLEEDING,(5+skilllv*5),skilllv,skill_get_time2(skillid,3)); + sc_start(bl,SC_BLEEDING,(5+skill_lv*5),skill_lv,skill_get_time2(skill_id,3)); } break; case HW_NAPALMVULCAN: - sc_start(bl,SC_CURSE,5*skilllv,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_CURSE,5*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case WS_CARTTERMINATION: // Cart termination - sc_start(bl,SC_STUN,5*skilllv,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,5*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case CR_ACIDDEMONSTRATION: - skill_break_equip(bl, EQP_WEAPON|EQP_ARMOR, 100*skilllv, BCT_ENEMY); + skill_break_equip(bl, EQP_WEAPON|EQP_ARMOR, 100*skill_lv, BCT_ENEMY); break; case TK_DOWNKICK: - sc_start(bl,SC_STUN,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,100,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case TK_JUMPKICK: @@ -1161,87 +1161,87 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int case TK_TURNKICK: case MO_BALKYOUNG: //Note: attack_type is passed as BF_WEAPON for the actual target, BF_MISC for the splash-affected mobs. if(attack_type&BF_MISC) //70% base stun chance... - sc_start(bl,SC_STUN,70,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_STUN,70,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case GS_BULLSEYE: //0.1% coma rate. if(tstatus->race == RC_BRUTE || tstatus->race == RC_DEMIHUMAN) - status_change_start(bl,SC_COMA,10,skilllv,0,src->id,0,0,0); + status_change_start(bl,SC_COMA,10,skill_lv,0,src->id,0,0,0); break; case GS_PIERCINGSHOT: - sc_start(bl,SC_BLEEDING,(skilllv*3),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLEEDING,(skill_lv*3),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case NJ_HYOUSYOURAKU: - sc_start(bl,SC_FREEZE,(10+10*skilllv),skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_FREEZE,(10+10*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv)); break; case GS_FLING: - sc_start(bl,SC_FLING,100, sd?sd->spiritball_old:5,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_FLING,100, sd?sd->spiritball_old:5,skill_get_time(skill_id,skill_lv)); break; case GS_DISARM: - rate = 3*skilllv; + rate = 3*skill_lv; if (sstatus->dex > tstatus->dex) rate += (sstatus->dex - tstatus->dex)/5; //TODO: Made up formula - skill_strip_equip(bl, EQP_WEAPON, rate, skilllv, skill_get_time(skillid,skilllv)); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + skill_strip_equip(bl, EQP_WEAPON, rate, skill_lv, skill_get_time(skill_id,skill_lv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case NPC_EVILLAND: - sc_start(bl,SC_BLIND,5*skilllv,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_BLIND,5*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case NPC_HELLJUDGEMENT: - sc_start(bl,SC_CURSE,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_CURSE,100,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case NPC_CRITICALWOUND: - sc_start(bl,SC_CRITICALWOUND,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_CRITICALWOUND,100,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case RK_HUNDREDSPEAR: if( !sd || pc_checkskill(sd,KN_SPEARBOOMERANG) == 0 ) break; // Spear Boomerang auto cast chance only works if you have mastered Spear Boomerang. - rate = 10 + 3 * skilllv; + rate = 10 + 3 * skill_lv; if( rnd()%100 < rate ) skill_castend_damage_id(src,bl,KN_SPEARBOOMERANG,1,tick,0); break; case RK_WINDCUTTER: - sc_start(bl,SC_FEAR,3+2*skilllv,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_FEAR,3+2*skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)); break; case RK_DRAGONBREATH: - sc_start4(bl,SC_BURNING,5+5*skilllv,skilllv,1000,src->id,0,skill_get_time(skillid,skilllv)); + sc_start4(bl,SC_BURNING,5+5*skill_lv,skill_lv,1000,src->id,0,skill_get_time(skill_id,skill_lv)); break; case AB_ADORAMUS: if( tsc && !tsc->data[SC_DECREASEAGI] ) //Prevent duplicate agi-down effect. - sc_start(bl, SC_ADORAMUS, 100, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_ADORAMUS, 100, skill_lv, skill_get_time(skill_id, skill_lv)); break; case WL_CRIMSONROCK: - sc_start(bl, SC_STUN, 40, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_STUN, 40, skill_lv, skill_get_time(skill_id, skill_lv)); break; case WL_COMET: - sc_start4(bl,SC_BURNING,100,skilllv,1000,src->id,0,skill_get_time(skillid,skilllv)); + sc_start4(bl,SC_BURNING,100,skill_lv,1000,src->id,0,skill_get_time(skill_id,skill_lv)); break; case WL_EARTHSTRAIN: { int rate = 0, i; const int pos[5] = { EQP_WEAPON, EQP_HELM, EQP_SHIELD, EQP_ARMOR, EQP_ACC }; - rate = 6 * skilllv + sstatus->dex / 10 + (sd? sd->status.job_level / 4 : 0) - tstatus->dex /5;// The tstatus->dex / 5 part is unofficial, but players gotta have some kind of way to have resistance. [Rytech] + rate = 6 * skill_lv + sstatus->dex / 10 + (sd? sd->status.job_level / 4 : 0) - tstatus->dex /5;// The tstatus->dex / 5 part is unofficial, but players gotta have some kind of way to have resistance. [Rytech] //rate -= rate * tstatus->dex / 200; // Disabled until official resistance is found. - for( i = 0; i < skilllv; i++ ) - skill_strip_equip(bl,pos[i],rate,skilllv,skill_get_time2(skillid,skilllv)); + for( i = 0; i < skill_lv; i++ ) + skill_strip_equip(bl,pos[i],rate,skill_lv,skill_get_time2(skill_id,skill_lv)); } break; case WL_JACKFROST: - sc_start(bl,SC_FREEZE,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_FREEZE,100,skill_lv,skill_get_time(skill_id,skill_lv)); break; case RA_WUGBITE: - sc_start(bl, SC_BITE, (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*2 : 0), skilllv, (skill_get_time(skillid,skilllv) + (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*500 : 0)) ); + sc_start(bl, SC_BITE, (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*2 : 0), skill_lv, (skill_get_time(skill_id,skill_lv) + (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*500 : 0)) ); break; case RA_SENSITIVEKEEN: - if( rnd()%100 < 8 * skilllv ) - skill_castend_damage_id(src, bl, RA_WUGBITE, sd ? pc_checkskill(sd, RA_WUGBITE):skilllv, tick, SD_ANIMATION); + if( rnd()%100 < 8 * skill_lv ) + skill_castend_damage_id(src, bl, RA_WUGBITE, sd ? pc_checkskill(sd, RA_WUGBITE):skill_lv, tick, SD_ANIMATION); break; case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: - sc_start(bl, (skillid == RA_FIRINGTRAP) ? SC_BURNING:SC_FREEZING, 40 + 10 * skilllv, skilllv, skill_get_time2(skillid, skilllv)); + sc_start(bl, (skill_id == RA_FIRINGTRAP) ? SC_BURNING:SC_FREEZING, 40 + 10 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); break; case NC_PILEBUNKER: - if( rnd()%100 < 5 + 15*skilllv ) + if( rnd()%100 < 5 + 15*skill_lv ) { //Deactivatable Statuses: Kyrie Eleison, Auto Guard, Steel Body, Assumptio, and Millennium Shield status_change_end(bl, SC_KYRIE, INVALID_TIMER); status_change_end(bl, SC_AUTOGUARD, INVALID_TIMER); @@ -1251,76 +1251,76 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int } break; case NC_FLAMELAUNCHER: - sc_start4(bl, SC_BURNING, 50 + 10 * skilllv, skilllv, 1000, src->id, 0, skill_get_time2(skillid, skilllv)); + sc_start4(bl, SC_BURNING, 50 + 10 * skill_lv, skill_lv, 1000, src->id, 0, skill_get_time2(skill_id, skill_lv)); break; case NC_COLDSLOWER: - sc_start(bl, SC_FREEZE, 10 * skilllv, skilllv, skill_get_time(skillid, skilllv)); - sc_start(bl, SC_FREEZING, 20 + 10 * skilllv, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_FREEZE, 10 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, SC_FREEZING, 20 + 10 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); break; case NC_POWERSWING: - sc_start(bl, SC_STUN, 5*skilllv, skilllv, skill_get_time(skillid, skilllv)); - if( rnd()%100 < 5*skilllv ) + sc_start(bl, SC_STUN, 5*skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); + if( rnd()%100 < 5*skill_lv ) skill_castend_damage_id(src, bl, NC_AXEBOOMERANG, pc_checkskill(sd, NC_AXEBOOMERANG), tick, 1); break; case GC_WEAPONCRUSH: - skill_castend_nodamage_id(src,bl,skillid,skilllv,tick,BCT_ENEMY); + skill_castend_nodamage_id(src,bl,skill_id,skill_lv,tick,BCT_ENEMY); break; case LG_SHIELDPRESS: - sc_start(bl, SC_STUN, 30 + 8 * skilllv, skilllv, skill_get_time(skillid,skilllv)); + sc_start(bl, SC_STUN, 30 + 8 * skill_lv, skill_lv, skill_get_time(skill_id,skill_lv)); break; case LG_PINPOINTATTACK: - rate = 30 + (((5 * (sd?pc_checkskill(sd,LG_PINPOINTATTACK):skilllv)) + (sstatus->agi + status_get_lv(src))) / 10); - switch( skilllv ) { + rate = 30 + (((5 * (sd?pc_checkskill(sd,LG_PINPOINTATTACK):skill_lv)) + (sstatus->agi + status_get_lv(src))) / 10); + switch( skill_lv ) { case 1: - sc_start(bl,SC_BLEEDING,rate,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_BLEEDING,rate,skill_lv,skill_get_time(skill_id,skill_lv)); break; case 2: if( dstsd && dstsd->spiritball && rnd()%100 < rate ) pc_delspiritball(dstsd, dstsd->spiritball, 0); break; default: - skill_break_equip(bl,(skilllv == 3) ? EQP_SHIELD : (skilllv == 4) ? EQP_ARMOR : EQP_WEAPON,rate * 100,BCT_ENEMY); + skill_break_equip(bl,(skill_lv == 3) ? EQP_SHIELD : (skill_lv == 4) ? EQP_ARMOR : EQP_WEAPON,rate * 100,BCT_ENEMY); break; } break; case LG_MOONSLASHER: - rate = 32 + 8 * skilllv; + rate = 32 + 8 * skill_lv; if( rnd()%100 < rate && dstsd ) // Uses skill_addtimerskill to avoid damage and setsit packet overlaping. Officially clif_setsit is received about 500 ms after damage packet. - skill_addtimerskill(src,tick+500,bl->id,0,0,skillid,skilllv,BF_WEAPON,0); + skill_addtimerskill(src,tick+500,bl->id,0,0,skill_id,skill_lv,BF_WEAPON,0); else if( dstmd && !is_boss(bl) ) - sc_start(bl,SC_STOP,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_STOP,100,skill_lv,skill_get_time(skill_id,skill_lv)); break; case LG_RAYOFGENESIS: // 50% chance to cause Blind on Undead and Demon monsters. if ( battle_check_undead(tstatus->race, tstatus->def_ele) || tstatus->race == RC_DEMON ) - sc_start(bl, SC_BLIND,50, skilllv, skill_get_time(skillid,skilllv)); + sc_start(bl, SC_BLIND,50, skill_lv, skill_get_time(skill_id,skill_lv)); break; case LG_EARTHDRIVE: skill_break_equip(src, EQP_SHIELD, 500, BCT_SELF); - sc_start(bl, SC_EARTHDRIVE, 100, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_EARTHDRIVE, 100, skill_lv, skill_get_time(skill_id, skill_lv)); break; case SR_DRAGONCOMBO: - sc_start(bl, SC_STUN, 1 + skilllv, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_STUN, 1 + skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); break; case SR_FALLENEMPIRE: - sc_start(bl, SC_STOP, 100, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_STOP, 100, skill_lv, skill_get_time(skill_id, skill_lv)); break; case SR_WINDMILL: if( dstsd ) - skill_addtimerskill(src,tick+status_get_amotion(src),bl->id,0,0,skillid,skilllv,BF_WEAPON,0); + skill_addtimerskill(src,tick+status_get_amotion(src),bl->id,0,0,skill_id,skill_lv,BF_WEAPON,0); else if( dstmd && !is_boss(bl) ) - sc_start(bl, SC_STUN, 100, skilllv, 1000 + 1000 * (rnd() %3)); + sc_start(bl, SC_STUN, 100, skill_lv, 1000 + 1000 * (rnd() %3)); break; case SR_GENTLETOUCH_QUIET: // [(Skill Level x 5) + (Caster?s DEX + Caster?s Base Level) / 10] - sc_start(bl, SC_SILENCE, 5 * skilllv + (sstatus->dex + status_get_lv(src)) / 10, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_SILENCE, 5 * skill_lv + (sstatus->dex + status_get_lv(src)) / 10, skill_lv, skill_get_time(skill_id, skill_lv)); break; case SR_EARTHSHAKER: - sc_start(bl,SC_STUN, 25 + 5 * skilllv,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_STUN, 25 + 5 * skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)); break; case SR_HOWLINGOFLION: - sc_start(bl, SC_FEAR, 5 + 5 * skilllv, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_FEAR, 5 + 5 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); break; case WM_SOUND_OF_DESTRUCTION: - if( rnd()%100 < 5 + 5 * skilllv ) { // Temporarly Check Until We Get the Official Formula + if( rnd()%100 < 5 + 5 * skill_lv ) { // Temporarly Check Until We Get the Official Formula status_change_end(bl, SC_DANCING, INVALID_TIMER); status_change_end(bl, SC_RICHMANKIM, INVALID_TIMER); status_change_end(bl, SC_ETERNALCHAOS, INVALID_TIMER); @@ -1352,67 +1352,67 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int } break; case SO_EARTHGRAVE: - sc_start(bl, SC_BLEEDING, 5 * skilllv, skilllv, skill_get_time2(skillid, skilllv)); // Need official rate. [LimitLine] + sc_start(bl, SC_BLEEDING, 5 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); // Need official rate. [LimitLine] break; case SO_DIAMONDDUST: - rate = 5 + 5 * skilllv; + rate = 5 + 5 * skill_lv; if( sc && sc->data[SC_COOLER_OPTION] ) rate += rate * sc->data[SC_COOLER_OPTION]->val2 / 100; - sc_start(bl, SC_CRYSTALIZE, rate, skilllv, skill_get_time2(skillid, skilllv)); + sc_start(bl, SC_CRYSTALIZE, rate, skill_lv, skill_get_time2(skill_id, skill_lv)); break; case SO_VARETYR_SPEAR: - sc_start(bl, SC_STUN, 5 + 5 * skilllv, skilllv, skill_get_time2(skillid, skilllv)); + sc_start(bl, SC_STUN, 5 + 5 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); break; case GN_SLINGITEM_RANGEMELEEATK: if( sd ) { switch( sd->itemid ) { // Starting SCs here instead of do it in skill_additional_effect to simplify the code. case 13261: - sc_start(bl, SC_STUN, 100, skilllv, skill_get_time2(GN_SLINGITEM, skilllv)); - sc_start(bl, SC_BLEEDING, 100, skilllv, skill_get_time2(GN_SLINGITEM, skilllv)); + sc_start(bl, SC_STUN, 100, skill_lv, skill_get_time2(GN_SLINGITEM, skill_lv)); + sc_start(bl, SC_BLEEDING, 100, skill_lv, skill_get_time2(GN_SLINGITEM, skill_lv)); break; case 13262: - sc_start(bl, SC_MELON_BOMB, 100, skilllv, skill_get_time(GN_SLINGITEM, skilllv)); // Reduces ASPD and moviment speed + sc_start(bl, SC_MELON_BOMB, 100, skill_lv, skill_get_time(GN_SLINGITEM, skill_lv)); // Reduces ASPD and moviment speed break; case 13264: - sc_start(bl, SC_BANANA_BOMB, 100, skilllv, skill_get_time(GN_SLINGITEM, skilllv)); // Reduces LUK ??Needed confirm it, may be it's bugged in kRORE? - sc_start(bl, SC_BANANA_BOMB_SITDOWN, 75, skilllv, skill_get_time(GN_SLINGITEM_RANGEMELEEATK,skilllv)); // Sitdown for 3 seconds. + sc_start(bl, SC_BANANA_BOMB, 100, skill_lv, skill_get_time(GN_SLINGITEM, skill_lv)); // Reduces LUK ??Needed confirm it, may be it's bugged in kRORE? + sc_start(bl, SC_BANANA_BOMB_SITDOWN, 75, skill_lv, skill_get_time(GN_SLINGITEM_RANGEMELEEATK,skill_lv)); // Sitdown for 3 seconds. break; } sd->itemid = -1; } break; case GN_HELLS_PLANT_ATK: - sc_start(bl, SC_STUN, 5 + 5 * skilllv, skilllv, skill_get_time2(skillid, skilllv)); - sc_start(bl, SC_BLEEDING, 20 + 10 * skilllv, skilllv, skill_get_time2(skillid, skilllv)); + sc_start(bl, SC_STUN, 5 + 5 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); + sc_start(bl, SC_BLEEDING, 20 + 10 * skill_lv, skill_lv, skill_get_time2(skill_id, skill_lv)); break; case EL_WIND_SLASH: // Non confirmed rate. - sc_start(bl, SC_BLEEDING, 25, skilllv, skill_get_time(skillid,skilllv)); + sc_start(bl, SC_BLEEDING, 25, skill_lv, skill_get_time(skill_id,skill_lv)); break; case EL_STONE_HAMMER: - rate = 10 * skilllv; - sc_start(bl, SC_STUN, rate, skilllv, skill_get_time(skillid,skilllv)); + rate = 10 * skill_lv; + sc_start(bl, SC_STUN, rate, skill_lv, skill_get_time(skill_id,skill_lv)); break; case EL_ROCK_CRUSHER: case EL_ROCK_CRUSHER_ATK: - sc_start(bl,status_skill2sc(skillid),50,skilllv,skill_get_time(EL_ROCK_CRUSHER,skilllv)); + sc_start(bl,status_skill2sc(skill_id),50,skill_lv,skill_get_time(EL_ROCK_CRUSHER,skill_lv)); break; case EL_TYPOON_MIS: - sc_start(bl,SC_SILENCE,10*skilllv,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_SILENCE,10*skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)); break; case KO_JYUMONJIKIRI: // needs more info - sc_start(bl,SC_JYUMONJIKIRI,25,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_JYUMONJIKIRI,25,skill_lv,skill_get_time(skill_id,skill_lv)); break; case KO_MAKIBISHI: - sc_start(bl, SC_STUN, 100, skilllv, skill_get_time2(skillid,skilllv)); + sc_start(bl, SC_STUN, 100, skill_lv, skill_get_time2(skill_id,skill_lv)); break; case MH_LAVA_SLIDE: - if (tsc && !tsc->data[SC_BURNING]) sc_start4(bl, SC_BURNING, 10 * skilllv, skilllv, 1000, src->id, 0, skill_get_time(skillid, skilllv)); + if (tsc && !tsc->data[SC_BURNING]) sc_start4(bl, SC_BURNING, 10 * skill_lv, skill_lv, 1000, src->id, 0, skill_get_time(skill_id, skill_lv)); break; case MH_STAHL_HORN: - sc_start(bl, SC_STUN, (20 + 4 * (skilllv-1)), skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_STUN, (20 + 4 * (skill_lv-1)), skill_lv, skill_get_time(skill_id, skill_lv)); break; case MH_NEEDLE_OF_PARALYZE: - sc_start(bl, SC_PARALYSIS, 40 + (5*skilllv), skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_PARALYSIS, 40 + (5*skill_lv), skill_lv, skill_get_time(skill_id, skill_lv)); break; } @@ -1445,7 +1445,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int if( rate ) skill_break_equip(src, EQP_WEAPON, rate, BCT_SELF); } - if( battle_config.equip_skill_break_rate && skillid != WS_CARTTERMINATION && skillid != ITM_TOMAHAWK ) + if( battle_config.equip_skill_break_rate && skill_id != WS_CARTTERMINATION && skill_id != ITM_TOMAHAWK ) { // Cart Termination/Tomahawk won't trigger breaking data. Why? No idea, go ask Gravity. // Target weapon breaking rate = 0; @@ -1467,7 +1467,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int } } - if( sd && sd->ed && sc && !status_isdead(bl) && !skillid ){ + if( sd && sd->ed && sc && !status_isdead(bl) && !skill_id ){ struct unit_data *ud = unit_bl2ud(src); if( sc->data[SC_WILD_STORM_OPTION] ) @@ -1483,9 +1483,9 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int if ( rnd()%100 < 25 && skill ){ skill_castend_damage_id(src, bl, skill, 5, tick, 0); - + if (ud) { - rate = skill_delayfix(src, skill, skilllv); + rate = skill_delayfix(src, skill, skill_lv); if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers ) @@ -1500,7 +1500,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int { struct block_list *tbl; struct unit_data *ud; - int i, skilllv, type, notok; + int i, skill_lv, type, notok; for (i = 0; i < ARRAYLENGTH(sd->autospell) && sd->autospell[i].id; i++) { @@ -1518,8 +1518,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int if ( notok ) continue; - skilllv = sd->autospell[i].lv?sd->autospell[i].lv:1; - if (skilllv < 0) skilllv = 1+rnd()%(-skilllv); + skill_lv = sd->autospell[i].lv?sd->autospell[i].lv:1; + if (skill_lv < 0) skill_lv = 1+rnd()%(-skill_lv); rate = (!sd->state.arrow_atk) ? sd->autospell[i].rate : sd->autospell[i].rate / 2; @@ -1532,18 +1532,18 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int int maxcount = 0; if( !(BL_PC&battle_config.skill_reiteration) && skill_get_unit_flag(skill)&UF_NOREITERATION && - skill_check_unit_range(src,tbl->x,tbl->y,skill,skilllv) + skill_check_unit_range(src,tbl->x,tbl->y,skill,skill_lv) ) { continue; } if( BL_PC&battle_config.skill_nofootset && skill_get_unit_flag(skill)&UF_NOFOOTSET && - skill_check_unit_range2(src,tbl->x,tbl->y,skill,skilllv) + skill_check_unit_range2(src,tbl->x,tbl->y,skill,skill_lv) ) { continue; } if( BL_PC&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(skill, skilllv)) > 0 + (maxcount = skill_get_maxcount(skill, skill_lv)) > 0 ) { int v; for(v=0;v<MAX_SKILLUNITGROUP && sd->ud.skillunit[v] && maxcount;v++) { @@ -1556,7 +1556,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int } } if( battle_config.autospell_check_range && - !battle_check_range(src, tbl, skill_get_range2(src, skill,skilllv) + (skill == RG_CLOSECONFINE?0:1)) ) + !battle_check_range(src, tbl, skill_get_range2(src, skill,skill_lv) + (skill == RG_CLOSECONFINE?0:1)) ) continue; if (skill == AS_SONICBLOW) @@ -1565,24 +1565,24 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int type = CAST_GROUND; sd->state.autocast = 1; - skill_consume_requirement(sd,skill,skilllv,1); + skill_consume_requirement(sd,skill,skill_lv,1); skill_toggle_magicpower(src, skill); switch (type) { case CAST_GROUND: - skill_castend_pos2(src, tbl->x, tbl->y, skill, skilllv, tick, 0); + skill_castend_pos2(src, tbl->x, tbl->y, skill, skill_lv, tick, 0); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(src, tbl, skill, skilllv, tick, 0); + skill_castend_nodamage_id(src, tbl, skill, skill_lv, tick, 0); break; case CAST_DAMAGE: - skill_castend_damage_id(src, tbl, skill, skilllv, tick, 0); + skill_castend_damage_id(src, tbl, skill, skill_lv, tick, 0); break; } sd->state.autocast = 0; //Set canact delay. [Skotlex] ud = unit_bl2ud(src); if (ud) { - rate = skill_delayfix(src, skill, skilllv); + rate = skill_delayfix(src, skill, skill_lv); if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers && sd ) @@ -1635,15 +1635,15 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int return 0; } -int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int skillid, unsigned int tick) { - int skill, skilllv, i, type, notok; +int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint16 skill_id, unsigned int tick) { + int skill, skill_lv, i, type, notok; struct block_list *tbl; - if( sd == NULL || skillid <= 0 ) + if( sd == NULL || skill_id <= 0 ) return 0; for( i = 0; i < ARRAYLENGTH(sd->autospell3) && sd->autospell3[i].flag; i++ ) { - if( sd->autospell3[i].flag != skillid ) + if( sd->autospell3[i].flag != skill_id ) continue; if( sd->autospell3[i].lock ) @@ -1658,8 +1658,8 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s if ( notok ) continue; - skilllv = sd->autospell3[i].lv ? sd->autospell3[i].lv : 1; - if( skilllv < 0 ) skilllv = 1 + rnd()%(-skilllv); + skill_lv = sd->autospell3[i].lv ? sd->autospell3[i].lv : 1; + if( skill_lv < 0 ) skill_lv = 1 + rnd()%(-skill_lv); if( sd->autospell3[i].id >= 0 && bl == NULL ) continue; // No target @@ -1672,18 +1672,18 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s int maxcount = 0; if( !(BL_PC&battle_config.skill_reiteration) && skill_get_unit_flag(skill)&UF_NOREITERATION && - skill_check_unit_range(&sd->bl,tbl->x,tbl->y,skill,skilllv) + skill_check_unit_range(&sd->bl,tbl->x,tbl->y,skill,skill_lv) ) { continue; } if( BL_PC&battle_config.skill_nofootset && skill_get_unit_flag(skill)&UF_NOFOOTSET && - skill_check_unit_range2(&sd->bl,tbl->x,tbl->y,skill,skilllv) + skill_check_unit_range2(&sd->bl,tbl->x,tbl->y,skill,skill_lv) ) { continue; } if( BL_PC&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(skill, skilllv)) > 0 + (maxcount = skill_get_maxcount(skill, skill_lv)) > 0 ) { int v; for(v=0;v<MAX_SKILLUNITGROUP && sd->ud.skillunit[v] && maxcount;v++) { @@ -1696,17 +1696,17 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s } } if( battle_config.autospell_check_range && - !battle_check_range(&sd->bl, tbl, skill_get_range2(&sd->bl, skill,skilllv) + (skill == RG_CLOSECONFINE?0:1)) ) + !battle_check_range(&sd->bl, tbl, skill_get_range2(&sd->bl, skill,skill_lv) + (skill == RG_CLOSECONFINE?0:1)) ) continue; sd->state.autocast = 1; sd->autospell3[i].lock = true; - skill_consume_requirement(sd,skill,skilllv,1); + skill_consume_requirement(sd,skill,skill_lv,1); switch( type ) { - case CAST_GROUND: skill_castend_pos2(&sd->bl, tbl->x, tbl->y, skill, skilllv, tick, 0); break; - case CAST_NODAMAGE: skill_castend_nodamage_id(&sd->bl, tbl, skill, skilllv, tick, 0); break; - case CAST_DAMAGE: skill_castend_damage_id(&sd->bl, tbl, skill, skilllv, tick, 0); break; + case CAST_GROUND: skill_castend_pos2(&sd->bl, tbl->x, tbl->y, skill, skill_lv, tick, 0); break; + case CAST_NODAMAGE: skill_castend_nodamage_id(&sd->bl, tbl, skill, skill_lv, tick, 0); break; + case CAST_DAMAGE: skill_castend_damage_id(&sd->bl, tbl, skill, skill_lv, tick, 0); break; } sd->autospell3[i].lock = false; sd->state.autocast = 0; @@ -1720,7 +1720,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s continue; if( sd->autobonus3[i].active != INVALID_TIMER ) continue; - if( sd->autobonus3[i].atk_type != skillid ) + if( sd->autobonus3[i].atk_type != skill_id ) continue; pc_exeautobonus(sd,&sd->autobonus3[i]); } @@ -1737,7 +1737,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s * type of skills, so not every instance of skill_additional_effect needs a call * to this one. */ -int skill_counter_additional_effect (struct block_list* src, struct block_list *bl, int skillid, int skilllv, int attack_type, unsigned int tick) +int skill_counter_additional_effect (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, unsigned int tick) { int rate; struct map_session_data *sd=NULL; @@ -1746,8 +1746,8 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * nullpo_ret(src); nullpo_ret(bl); - if(skillid < 0) return 0; - if(skillid > 0 && skilllv <= 0) return 0; // don't forget auto attacks! - celest + if(skill_id < 0) return 0; + if(skill_id > 0 && skill_lv <= 0) return 0; // don't forget auto attacks! - celest sd = BL_CAST(BL_PC, src); dstsd = BL_CAST(BL_PC, bl); @@ -1780,12 +1780,12 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * } } - switch(skillid){ + switch(skill_id){ case MO_EXTREMITYFIST: - sc_start(src,SC_EXTREMITYFIST,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(src,SC_EXTREMITYFIST,100,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case GS_FULLBUSTER: - sc_start(src,SC_BLIND,2*skilllv,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(src,SC_BLIND,2*skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case HFLI_SBR44: //[orn] case HVAN_EXPLOSION: @@ -1806,8 +1806,8 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * rnd()%10000 < battle_config.sg_miracle_skill_ratio) //SG_MIRACLE [Komurka] sc_start(src,SC_MIRACLE,100,1,battle_config.sg_miracle_skill_duration); - if(sd && skillid && attack_type&BF_MAGIC && status_isdead(bl) && - !(skill_get_inf(skillid)&(INF_GROUND_SKILL|INF_SELF_SKILL)) && + if(sd && skill_id && attack_type&BF_MAGIC && status_isdead(bl) && + !(skill_get_inf(skill_id)&(INF_GROUND_SKILL|INF_SELF_SKILL)) && (rate=pc_checkskill(sd,HW_SOULDRAIN))>0 ){ //Soul Drain should only work on targetted spells [Skotlex] if (pc_issit(sd)) pc_setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex] @@ -1826,7 +1826,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * if( attack_type&BF_MAGIC ) { sp += sd->bonus.magic_sp_gain_value; hp += sd->bonus.magic_hp_gain_value; - if( skillid == WZ_WATERBALL ) {//(bugreport:5303) + if( skill_id == WZ_WATERBALL ) {//(bugreport:5303) struct status_change *sc = NULL; if( ( sc = status_get_sc(src) ) ) { if(sc->data[SC_SPIRIT] && @@ -1843,11 +1843,11 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * // Trigger counter-spells to retaliate against damage causing skills. if(dstsd && !status_isdead(bl) && dstsd->autospell2[0].id && - !(skillid && skill_get_nk(skillid)&NK_NO_DAMAGE)) + !(skill_id && skill_get_nk(skill_id)&NK_NO_DAMAGE)) { struct block_list *tbl; struct unit_data *ud; - int i, skillid, skilllv, rate, type, notok; + int i, skill_id, skill_lv, rate, type, notok; for (i = 0; i < ARRAYLENGTH(dstsd->autospell2) && dstsd->autospell2[i].id; i++) { @@ -1856,16 +1856,16 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * dstsd->autospell2[i].flag&attack_type&BF_SKILLMASK)) continue; // one or more trigger conditions were not fulfilled - skillid = (dstsd->autospell2[i].id > 0) ? dstsd->autospell2[i].id : -dstsd->autospell2[i].id; - skilllv = dstsd->autospell2[i].lv?dstsd->autospell2[i].lv:1; - if (skilllv < 0) skilllv = 1+rnd()%(-skilllv); + skill_id = (dstsd->autospell2[i].id > 0) ? dstsd->autospell2[i].id : -dstsd->autospell2[i].id; + skill_lv = dstsd->autospell2[i].lv?dstsd->autospell2[i].lv:1; + if (skill_lv < 0) skill_lv = 1+rnd()%(-skill_lv); rate = dstsd->autospell2[i].rate; if (attack_type&BF_LONG) rate>>=1; dstsd->state.autocast = 1; - notok = skillnotok(skillid, dstsd); + notok = skillnotok(skill_id, dstsd); dstsd->state.autocast = 0; if ( notok ) @@ -1876,26 +1876,26 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * tbl = (dstsd->autospell2[i].id < 0) ? bl : src; - if( (type = skill_get_casttype(skillid)) == CAST_GROUND ) { + if( (type = skill_get_casttype(skill_id)) == CAST_GROUND ) { int maxcount = 0; if( !(BL_PC&battle_config.skill_reiteration) && - skill_get_unit_flag(skillid)&UF_NOREITERATION && - skill_check_unit_range(bl,tbl->x,tbl->y,skillid,skilllv) + skill_get_unit_flag(skill_id)&UF_NOREITERATION && + skill_check_unit_range(bl,tbl->x,tbl->y,skill_id,skill_lv) ) { continue; } if( BL_PC&battle_config.skill_nofootset && - skill_get_unit_flag(skillid)&UF_NOFOOTSET && - skill_check_unit_range2(bl,tbl->x,tbl->y,skillid,skilllv) + skill_get_unit_flag(skill_id)&UF_NOFOOTSET && + skill_check_unit_range2(bl,tbl->x,tbl->y,skill_id,skill_lv) ) { continue; } if( BL_PC&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(skillid, skilllv)) > 0 + (maxcount = skill_get_maxcount(skill_id, skill_lv)) > 0 ) { int v; for(v=0;v<MAX_SKILLUNITGROUP && dstsd->ud.skillunit[v] && maxcount;v++) { - if(dstsd->ud.skillunit[v]->skill_id == skillid) + if(dstsd->ud.skillunit[v]->skill_id == skill_id) maxcount--; } if( maxcount == 0 ) { @@ -1904,27 +1904,27 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * } } - if( !battle_check_range(src, tbl, skill_get_range2(src, skillid,skilllv) + (skillid == RG_CLOSECONFINE?0:1)) && battle_config.autospell_check_range ) + if( !battle_check_range(src, tbl, skill_get_range2(src, skill_id,skill_lv) + (skill_id == RG_CLOSECONFINE?0:1)) && battle_config.autospell_check_range ) continue; dstsd->state.autocast = 1; - skill_consume_requirement(dstsd,skillid,skilllv,1); + skill_consume_requirement(dstsd,skill_id,skill_lv,1); switch (type) { case CAST_GROUND: - skill_castend_pos2(bl, tbl->x, tbl->y, skillid, skilllv, tick, 0); + skill_castend_pos2(bl, tbl->x, tbl->y, skill_id, skill_lv, tick, 0); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(bl, tbl, skillid, skilllv, tick, 0); + skill_castend_nodamage_id(bl, tbl, skill_id, skill_lv, tick, 0); break; case CAST_DAMAGE: - skill_castend_damage_id(bl, tbl, skillid, skilllv, tick, 0); + skill_castend_damage_id(bl, tbl, skill_id, skill_lv, tick, 0); break; } dstsd->state.autocast = 0; //Set canact delay. [Skotlex] ud = unit_bl2ud(bl); if (ud) { - rate = skill_delayfix(bl, skillid, skilllv); + rate = skill_delayfix(bl, skill_id, skill_lv); if (DIFF_TICK(ud->canact_tick, tick + rate) < 0){ ud->canact_tick = tick+rate; if ( battle_config.display_status_timers && dstsd ) @@ -1935,7 +1935,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * } //Autobonus when attacked - if( dstsd && !status_isdead(bl) && dstsd->autobonus2[0].rate && !(skillid && skill_get_nk(skillid)&NK_NO_DAMAGE) ) + if( dstsd && !status_isdead(bl) && dstsd->autobonus2[0].rate && !(skill_id && skill_get_nk(skill_id)&NK_NO_DAMAGE) ) { int i; for( i = 0; i < ARRAYLENGTH(dstsd->autobonus2); i++ ) @@ -2087,7 +2087,7 @@ static int skill_area_temp[8]; - if 'flag&0x1', position update packets must not be sent. - if 'flag&0x2', skill blown ignores players' special_state.no_knockback -------------------------------------------------------------------------*/ -int skill_blown(struct block_list* src, struct block_list* target, int count, int direction, int flag) +int skill_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag) { int dx = 0, dy = 0; struct skill_unit* su = NULL; @@ -2123,13 +2123,13 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in break; } - if (direction == -1) // <optimized>: do the computation here instead of outside - direction = map_calc_dir(target, src->x, src->y); // direction from src to target, reversed + if (dir == -1) // <optimized>: do the computation here instead of outside + dir = map_calc_dir(target, src->x, src->y); // direction from src to target, reversed - if (direction >= 0 && direction < 8) + if (dir >= 0 && dir < 8) { // take the reversed 'direction' and reverse it - dx = -dirx[direction]; - dy = -diry[direction]; + dx = -dirx[dir]; + dy = -diry[dir]; } return unit_blown(target, dx, dy, count, flag); // send over the proper flag @@ -2182,10 +2182,10 @@ static int skill_magic_reflect(struct block_list* src, struct block_list* bl, in * (usually holds number of targets, or just 1 for simple splash attacks) * flag&0x1000 is used to tag that this is a splash-attack (so the damage * packet shouldn't display a skill animation) - * flag&0x2000 is used to signal that the skilllv should be passed as -1 to the + * flag&0x2000 is used to signal that the skill_lv should be passed as -1 to the * client (causes player characters to not scream skill name) *-------------------------------------------------------------------------*/ -int skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, int skillid, int skilllv, unsigned int tick, int flag) +int skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { struct Damage dmg; struct status_data *sstatus, *tstatus; @@ -2194,7 +2194,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds int type,damage,rdamage=0; int8 rmdamage=0;//magic reflected - if(skillid > 0 && skilllv <= 0) return 0; + if(skill_id > 0 && skill_lv <= 0) return 0; nullpo_ret(src); //Source is the master behind the attack (player/mob/pet) nullpo_ret(dsrc); //dsrc is the actual originator of the damage, can be the same as src, or a skill casted by src. @@ -2202,11 +2202,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if (src != dsrc) { //When caster is not the src of attack, this is a ground skill, and as such, do the relevant target checking. [Skotlex] - if (!status_check_skilluse(battle_config.skill_caster_check?src:NULL, bl, skillid, 2)) + if (!status_check_skilluse(battle_config.skill_caster_check?src:NULL, bl, skill_id, 2)) return 0; - } else if ((flag&SD_ANIMATION) && skill_get_nk(skillid)&NK_SPLASH) { + } else if ((flag&SD_ANIMATION) && skill_get_nk(skill_id)&NK_SPLASH) { //Note that splash attacks often only check versus the targetted mob, those around the splash area normally don't get checked for being hidden/cloaked/etc. [Skotlex] - if (!status_check_skilluse(src, bl, skillid, 2)) + if (!status_check_skilluse(src, bl, skill_id, 2)) return 0; } @@ -2219,33 +2219,33 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if (sc && !sc->count) sc = NULL; //Don't need it. // Is this check really needed? FrostNova won't hurt you if you step right where the caster is? - if(skillid == WZ_FROSTNOVA && dsrc->x == bl->x && dsrc->y == bl->y) + if(skill_id == WZ_FROSTNOVA && dsrc->x == bl->x && dsrc->y == bl->y) return 0; //Trick Dead protects you from damage, but not from buffs and the like, hence it's placed here. if (sc && sc->data[SC_TRICKDEAD] && !(sstatus->mode&MD_BOSS)) return 0; - dmg = battle_calc_attack(attack_type,src,bl,skillid,skilllv,flag&0xFFF); + dmg = battle_calc_attack(attack_type,src,bl,skill_id,skill_lv,flag&0xFFF); //Skotlex: Adjusted to the new system if(src->type==BL_PET) { // [Valaris] struct pet_data *pd = (TBL_PET*)src; - if (pd->a_skill && pd->a_skill->div_ && pd->a_skill->id == skillid) + if (pd->a_skill && pd->a_skill->div_ && pd->a_skill->id == skill_id) { - int element = skill_get_ele(skillid, skilllv); - if (skillid == -1) + int element = skill_get_ele(skill_id, skill_lv); + if (skill_id == -1) element = sstatus->rhw.ele; if (element != ELE_NEUTRAL || !(battle_config.attack_attr_none&BL_PET)) - dmg.damage=battle_attr_fix(src, bl, skilllv, element, tstatus->def_ele, tstatus->ele_lv); + dmg.damage=battle_attr_fix(src, bl, skill_lv, element, tstatus->def_ele, tstatus->ele_lv); else - dmg.damage= skilllv; + dmg.damage= skill_lv; dmg.damage2=0; dmg.div_= pd->a_skill->div_; } } - if( dmg.flag&BF_MAGIC && ( skillid != NPC_EARTHQUAKE || (battle_config.eq_single_target_reflectable && (flag&0xFFF) == 1) ) ) + if( dmg.flag&BF_MAGIC && ( skill_id != NPC_EARTHQUAKE || (battle_config.eq_single_target_reflectable && (flag&0xFFF) == 1) ) ) { // Earthquake on multiple targets is not counted as a target skill. [Inkfish] if( (dmg.damage || dmg.damage2) && (type = skill_magic_reflect(src, bl, src==dsrc)) ) { //Magic reflection, switch caster/target @@ -2269,7 +2269,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if ( tsd ) pc_delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME); dmg.damage = dmg.damage2 = 0; dmg.dmg_lv = ATK_MISS; - sc->data[SC_SPIRIT]->val3 = skillid; + sc->data[SC_SPIRIT]->val3 = skill_id; sc->data[SC_SPIRIT]->val4 = dsrc->id; } } @@ -2279,30 +2279,30 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds **/ #if MAGIC_REFLECTION_TYPE if( dmg.dmg_lv != ATK_MISS )//Wiz SL cancelled and consumed fragment - dmg = battle_calc_attack(BF_MAGIC,bl,bl,skillid,skilllv,flag&0xFFF); + dmg = battle_calc_attack(BF_MAGIC,bl,bl,skill_id,skill_lv,flag&0xFFF); #endif } if(sc && sc->data[SC_MAGICROD] && src == dsrc) { - int sp = skill_get_sp(skillid,skilllv); + int sp = skill_get_sp(skill_id,skill_lv); dmg.damage = dmg.damage2 = 0; dmg.dmg_lv = ATK_MISS; //This will prevent skill additional effect from taking effect. [Skotlex] sp = sp * sc->data[SC_MAGICROD]->val2 / 100; - if(skillid == WZ_WATERBALL && skilllv > 1) - sp = sp/((skilllv|1)*(skilllv|1)); //Estimate SP cost of a single water-ball + if(skill_id == WZ_WATERBALL && skill_lv > 1) + sp = sp/((skill_lv|1)*(skill_lv|1)); //Estimate SP cost of a single water-ball status_heal(bl, 0, sp, 2); } } damage = dmg.damage + dmg.damage2; - if( (skillid == AL_INCAGI || skillid == AL_BLESSING || - skillid == CASH_BLESSING || skillid == CASH_INCAGI || - skillid == MER_INCAGI || skillid == MER_BLESSING) && tsd->sc.data[SC_CHANGEUNDEAD] ) + if( (skill_id == AL_INCAGI || skill_id == AL_BLESSING || + skill_id == CASH_BLESSING || skill_id == CASH_INCAGI || + skill_id == MER_INCAGI || skill_id == MER_BLESSING) && tsd->sc.data[SC_CHANGEUNDEAD] ) damage = 1; - if( damage > 0 && (( dmg.flag&BF_WEAPON && src != bl && ( src == dsrc || ( dsrc->type == BL_SKILL && ( skillid == SG_SUN_WARM || skillid == SG_MOON_WARM || skillid == SG_STAR_WARM ) ) )) + if( damage > 0 && (( dmg.flag&BF_WEAPON && src != bl && ( src == dsrc || ( dsrc->type == BL_SKILL && ( skill_id == SG_SUN_WARM || skill_id == SG_MOON_WARM || skill_id == SG_STAR_WARM ) ) )) || (sc && sc->data[SC_REFLECTDAMAGE])) ) - rdamage = battle_calc_return_damage(bl,src, &damage, dmg.flag, skillid); + rdamage = battle_calc_return_damage(bl,src, &damage, dmg.flag, skill_id); if( damage && sc && sc->data[SC_GENSOU] && dmg.flag&BF_MAGIC ){ struct block_list *nbl = NULL; @@ -2314,19 +2314,19 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } //Skill hit type - type=(skillid==0)?5:skill_get_hit(skillid); + type=(skill_id==0)?5:skill_get_hit(skill_id); if(damage < dmg.div_ //Only skills that knockback even when they miss. [Skotlex] - && skillid != CH_PALMSTRIKE) + && skill_id != CH_PALMSTRIKE) dmg.blewcount = 0; - if(skillid == CR_GRANDCROSS||skillid == NPC_GRANDDARKNESS) { + if(skill_id == CR_GRANDCROSS||skill_id == NPC_GRANDDARKNESS) { if(battle_config.gx_disptype) dsrc = src; if(src == bl) type = 4; else flag|=SD_ANIMATION; } - if(skillid == NJ_TATAMIGAESHI) { + if(skill_id == NJ_TATAMIGAESHI) { dsrc = src; //For correct knockback. flag|=SD_ANIMATION; } @@ -2335,14 +2335,14 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds int flag = 0; //Used to signal if this skill can be combo'ed later on. struct status_change_entry *sce; if ((sce = sd->sc.data[SC_COMBO])) {//End combo state after skill is invoked. [Skotlex] - switch (skillid) { + switch (skill_id) { case TK_TURNKICK: case TK_STORMKICK: case TK_DOWNKICK: case TK_COUNTER: if (pc_famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time. - sce->val1 = skillid; //Update combo-skill - sce->val3 = skillid; + sce->val1 = skill_id; //Update combo-skill + sce->val3 = skill_id; if( sce->timer != INVALID_TIMER ) delete_timer(sce->timer, status_change_timer); sce->timer = add_timer(tick+sce->val4, status_change_timer, src->id, SC_COMBO); @@ -2355,7 +2355,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds status_change_end(src, SC_COMBO, INVALID_TIMER); } } - switch(skillid) { + switch(skill_id) { case MO_TRIPLEATTACK: if (pc_checkskill(sd, MO_CHAINCOMBO) > 0 || pc_checkskill(sd, SR_DRAGONCOMBO) > 0) flag=1; @@ -2366,7 +2366,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds break; case MO_COMBOFINISH: if (sd->status.party_id>0) //bonus from SG_FRIEND [Komurka] - party_skill_check(sd, sd->status.party_id, MO_COMBOFINISH, skilllv); + party_skill_check(sd, sd->status.party_id, MO_COMBOFINISH, skill_lv); if (pc_checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0) flag=1; case CH_TIGERFIST: @@ -2393,8 +2393,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds break; case SL_STIN: case SL_STUN: - if (skilllv >= 7 && !sd->sc.data[SC_SMA]) - sc_start(src,SC_SMA,100,skilllv,skill_get_time(SL_SMA, skilllv)); + if (skill_lv >= 7 && !sd->sc.data[SC_SMA]) + sc_start(src,SC_SMA,100,skill_lv,skill_get_time(SL_SMA, skill_lv)); break; case GS_FULLBUSTER: //Can't attack nor use items until skill's delay expires. [Skotlex] @@ -2412,13 +2412,13 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if (flag) { //Possible to chain flag = DIFF_TICK(sd->ud.canact_tick, tick); if (flag < 1) flag = 1; - sc_start2(src,SC_COMBO,100,skillid,bl->id,flag); + sc_start2(src,SC_COMBO,100,skill_id,bl->id,flag); clif_combo_delay(src, flag); } } //Display damage. - switch( skillid ) + switch( skill_id ) { case PA_GOSPEL: //Should look like Holy Cross [Skotlex] dmg.dmotion = clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, CR_HOLYCROSS, -1, 5); @@ -2439,19 +2439,19 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case AS_SPLASHER: if( flag&SD_ANIMATION ) // the surrounding targets - dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skillid, -1, 5); // needs -1 as skill level + dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -1, 5); // needs -1 as skill level else // the central target doesn't display an animation - dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skillid, -2, 5); // needs -2(!) as skill level + dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -2, 5); // needs -2(!) as skill level break; case WL_HELLINFERNO: case SR_EARTHSHAKER: - dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,1,skillid,-2,6); + dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,1,skill_id,-2,6); break; case WL_SOULEXPANSION: case WL_COMET: case KO_MUCHANAGE: case NJ_HUUMA: - dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skillid,skilllv,8); + dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skill_id,skill_lv,8); break; case WL_CHAINLIGHTNING_ATK: dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,1,WL_CHAINLIGHTNING,-2,6); @@ -2476,16 +2476,16 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case EL_HURRICANE_ATK: case KO_BAKURETSU: case GN_CRAZYWEED_ATK: - dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skillid,-1,5); + dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skill_id,-1,5); break; case GN_SLINGITEM_RANGEMELEEATK: dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,GN_SLINGITEM,-2,6); break; case EL_STONE_RAIN: - dmg.dmotion = clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skillid,-1,(flag&1)?8:5); + dmg.dmotion = clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skill_id,-1,(flag&1)?8:5); break; case WM_SEVERE_RAINSTORM_MELEE: - dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,WM_SEVERE_RAINSTORM,skilllv,5); + dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,WM_SEVERE_RAINSTORM,skill_lv,5); break; case WM_REVERBERATION_MELEE: case WM_REVERBERATION_MAGIC: @@ -2498,14 +2498,14 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case RA_CLUSTERBOMB: case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: - dmg.dmotion = clif_skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skillid,flag&SD_LEVEL?-1:skilllv, 5); + dmg.dmotion = clif_skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id,flag&SD_LEVEL?-1:skill_lv, 5); if( dsrc != src ) // avoid damage display redundancy break; case HT_LANDMINE: - dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skillid, -1, type); + dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -1, type); break; case WZ_SIGHTBLASTER: - dmg.dmotion = clif_skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skillid, flag&SD_LEVEL?-1:skilllv, 5); + dmg.dmotion = clif_skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, flag&SD_LEVEL?-1:skill_lv, 5); break; case AB_DUPLELIGHT_MELEE: case AB_DUPLELIGHT_MAGIC: @@ -2516,9 +2516,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if( bl->type == BL_SKILL ){ TBL_SKILL *su = (TBL_SKILL*)bl; if( su->group && skill_get_inf2(su->group->skill_id)&INF2_TRAP )// show damage on trap targets - clif_skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skillid, flag&SD_LEVEL?-1:skilllv, 5); + clif_skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, flag&SD_LEVEL?-1:skill_lv, 5); } - dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skillid, flag&SD_LEVEL?-1:skilllv, type); + dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, flag&SD_LEVEL?-1:skill_lv, type); break; } @@ -2529,11 +2529,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds && (!sc || !sc->data[SC_PRESERVE]) && damage < tsd->battle_status.hp) { //Updated to not be able to copy skills if the blow will kill you. [Skotlex] - int copy_skill = skillid; + int copy_skill = skill_id; /** * Copy Referal: dummy skills should point to their source upon copying **/ - switch( skillid ) { + switch( skill_id ) { case AB_DUPLELIGHT_MELEE: case AB_DUPLELIGHT_MAGIC: copy_skill = AB_DUPLELIGHT; @@ -2583,7 +2583,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds tsd->status.skill[copy_skill].flag = SKILL_FLAG_PLAGIARIZED; clif_addskill(tsd,copy_skill); } else { - lv = skilllv; + lv = skill_lv; if (tsd->cloneskill_id && tsd->status.skill[tsd->cloneskill_id].flag == SKILL_FLAG_PLAGIARIZED){ tsd->status.skill[tsd->cloneskill_id].id = 0; tsd->status.skill[tsd->cloneskill_id].lv = 0; @@ -2598,15 +2598,15 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds pc_setglobalreg(tsd, "CLONE_SKILL", copy_skill); pc_setglobalreg(tsd, "CLONE_SKILL_LV", lv); - tsd->status.skill[skillid].id = copy_skill; - tsd->status.skill[skillid].lv = lv; - tsd->status.skill[skillid].flag = SKILL_FLAG_PLAGIARIZED; - clif_addskill(tsd,skillid); + tsd->status.skill[skill_id].id = copy_skill; + tsd->status.skill[skill_id].lv = lv; + tsd->status.skill[skill_id].flag = SKILL_FLAG_PLAGIARIZED; + clif_addskill(tsd,skill_id); } } } - if (dmg.dmg_lv >= ATK_MISS && (type = skill_get_walkdelay(skillid, skilllv)) > 0) + if (dmg.dmg_lv >= ATK_MISS && (type = skill_get_walkdelay(skill_id, skill_lv)) > 0) { //Skills with can't walk delay also stop normal attacking for that //duration when the attack connects. [Skotlex] struct unit_data *ud = unit_bl2ud(src); @@ -2616,25 +2616,25 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if( !dmg.amotion ) { //Instant damage - if( !sc || (!sc->data[SC_DEVOTION] && skillid != CR_REFLECTSHIELD) ) + if( !sc || (!sc->data[SC_DEVOTION] && skill_id != CR_REFLECTSHIELD) ) status_fix_damage(src,bl,damage,dmg.dmotion); //Deal damage before knockback to allow stuff like firewall+storm gust combo. if( !status_isdead(bl) ) - skill_additional_effect(src,bl,skillid,skilllv,dmg.flag,dmg.dmg_lv,tick); + skill_additional_effect(src,bl,skill_id,skill_lv,dmg.flag,dmg.dmg_lv,tick); if( damage > 0 ) //Counter status effects [Skotlex] - skill_counter_additional_effect(src,bl,skillid,skilllv,dmg.flag,tick); + skill_counter_additional_effect(src,bl,skill_id,skill_lv,dmg.flag,tick); } // Hell Inferno burning status only starts if Fire part hits. - if( skillid == WL_HELLINFERNO && dmg.damage > 0 ) - sc_start4(bl,SC_BURNING,55+5*skilllv,skilllv,1000,src->id,0,skill_get_time(skillid,skilllv)); + if( skill_id == WL_HELLINFERNO && dmg.damage > 0 ) + sc_start4(bl,SC_BURNING,55+5*skill_lv,skill_lv,1000,src->id,0,skill_get_time(skill_id,skill_lv)); // Apply knock back chance in SC_TRIANGLESHOT skill. - else if( skillid == SC_TRIANGLESHOT && rnd()%100 > (1 + skilllv) ) + else if( skill_id == SC_TRIANGLESHOT && rnd()%100 > (1 + skill_lv) ) dmg.blewcount = 0; //Only knockback if it's still alive, otherwise a "ghost" is left behind. [Skotlex] //Reflected spells do not bounce back (bl == dsrc since it only happens for direct skills) if (dmg.blewcount > 0 && bl!=dsrc && !status_isdead(bl)) { - int direction = -1; // default - switch(skillid) {//direction + int8 dir = -1; // default + switch(skill_id) {//direction case MG_FIREWALL: case PR_SANCTUARY: case SC_TRIANGLESHOT: @@ -2642,45 +2642,45 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case SR_KNUCKLEARROW: case GN_WALLOFTHORN: case EL_FIRE_MANTLE: - direction = unit_getdir(bl);// backwards + dir = unit_getdir(bl);// backwards break; // This ensures the storm randomly pushes instead of exactly a cell backwards per official mechanics. case WZ_STORMGUST: - direction = rand()%8; + dir = rand()%8; break; case WL_CRIMSONROCK: - direction = map_calc_dir(bl,skill_area_temp[4],skill_area_temp[5]); + dir = map_calc_dir(bl,skill_area_temp[4],skill_area_temp[5]); break; } //blown-specific handling - switch( skillid ) { + switch( skill_id ) { case LG_OVERBRAND: - if( skill_blown(dsrc,bl,dmg.blewcount,direction,0) ) { + if( skill_blown(dsrc,bl,dmg.blewcount,dir,0) ) { short dir_x, dir_y; - dir_x = dirx[(direction+4)%8]; - dir_y = diry[(direction+4)%8]; + dir_x = dirx[(dir+4)%8]; + dir_y = diry[(dir+4)%8]; if( map_getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 ) - skill_addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skilllv, BF_WEAPON, flag ); + skill_addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag ); } else - skill_addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skilllv, BF_WEAPON, flag ); + skill_addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag ); break; case SR_KNUCKLEARROW: - if( skill_blown(dsrc,bl,dmg.blewcount,direction,0) && !(flag&4) ) { + if( skill_blown(dsrc,bl,dmg.blewcount,dir,0) && !(flag&4) ) { short dir_x, dir_y; - dir_x = dirx[(direction+4)%8]; - dir_y = diry[(direction+4)%8]; + dir_x = dirx[(dir+4)%8]; + dir_y = diry[(dir+4)%8]; if( map_getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 ) - skill_addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag|4); + skill_addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|4); } break; case GN_WALLOFTHORN: unit_stop_walking(bl,1); - skill_blown(dsrc,bl,dmg.blewcount,direction, 0x2 ); + skill_blown(dsrc,bl,dmg.blewcount,dir, 0x2 ); clif_fixpos(bl); break; default: - skill_blown(dsrc,bl,dmg.blewcount,direction, 0x0 ); + skill_blown(dsrc,bl,dmg.blewcount,dir, 0x0 ); if ( !dmg.blewcount && bl->type == BL_SKILL && damage > 0 ){ TBL_SKILL *su = (TBL_SKILL*)bl; if( su->group && su->group->skill_id == HT_BLASTMINE) @@ -2692,9 +2692,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds //Delayed damage must be dealt after the knockback (it needs to know actual position of target) if (dmg.amotion) - battle_delay_damage(tick, dmg.amotion,src,bl,dmg.flag,skillid,skilllv,damage,dmg.dmg_lv,dmg.dmotion); + battle_delay_damage(tick, dmg.amotion,src,bl,dmg.flag,skill_id,skill_lv,damage,dmg.dmg_lv,dmg.dmotion); - if( sc && sc->data[SC_DEVOTION] && skillid != PA_PRESSURE ) + if( sc && sc->data[SC_DEVOTION] && skill_id != PA_PRESSURE ) { struct status_change_entry *sce = sc->data[SC_DEVOTION]; struct block_list *d_bl = map_id2bl(sce->val1); @@ -2723,20 +2723,20 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } if(damage > 0 && !(tstatus->mode&MD_BOSS)) { - if( skillid == RG_INTIMIDATE ) { - int rate = 50 + skilllv * 5; + if( skill_id == RG_INTIMIDATE ) { + int rate = 50 + skill_lv * 5; rate = rate + (status_get_lv(src) - status_get_lv(bl)); if(rnd()%100 < rate) - skill_addtimerskill(src,tick + 800,bl->id,0,0,skillid,skilllv,0,flag); - } else if( skillid == SC_FATALMENACE ) - skill_addtimerskill(src,tick + 800,bl->id,skill_area_temp[4],skill_area_temp[5],skillid,skilllv,0,flag); + skill_addtimerskill(src,tick + 800,bl->id,0,0,skill_id,skill_lv,0,flag); + } else if( skill_id == SC_FATALMENACE ) + skill_addtimerskill(src,tick + 800,bl->id,skill_area_temp[4],skill_area_temp[5],skill_id,skill_lv,0,flag); } - if(skillid == CR_GRANDCROSS || skillid == NPC_GRANDDARKNESS) + if(skill_id == CR_GRANDCROSS || skill_id == NPC_GRANDDARKNESS) dmg.flag |= BF_WEAPON; if( sd && src != bl && damage > 0 && ( dmg.flag&BF_WEAPON || - (dmg.flag&BF_MISC && (skillid == RA_CLUSTERBOMB || skillid == RA_FIRINGTRAP || skillid == RA_ICEBOUNDTRAP || skillid == RK_DRAGONBREATH)) ) ) + (dmg.flag&BF_MISC && (skill_id == RA_CLUSTERBOMB || skill_id == RA_FIRINGTRAP || skill_id == RA_ICEBOUNDTRAP || skill_id == RK_DRAGONBREATH)) ) ) { if (battle_config.left_cardfix_to_right) battle_drain(sd, bl, dmg.damage, dmg.damage, tstatus->race, tstatus->mode&MD_BOSS); @@ -2764,16 +2764,16 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds /** * Post-damage effects **/ - switch( skillid ) { + switch( skill_id ) { case RK_CRUSHSTRIKE: skill_break_equip(src,EQP_WEAPON,2000,BCT_SELF); // 20% chance to destroy the weapon. break; case GC_VENOMPRESSURE: { struct status_change *ssc = status_get_sc(src); - if( ssc && ssc->data[SC_POISONINGWEAPON] && rnd()%100 < 70 + 5*skilllv ) { + if( ssc && ssc->data[SC_POISONINGWEAPON] && rnd()%100 < 70 + 5*skill_lv ) { sc_start(bl,ssc->data[SC_POISONINGWEAPON]->val2,100,ssc->data[SC_POISONINGWEAPON]->val1,skill_get_time2(GC_POISONINGWEAPON, 1)); status_change_end(src,SC_POISONINGWEAPON,INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } } break; @@ -2785,19 +2785,19 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds break; } if( sd ) - skill_onskillusage(sd, bl, skillid, tick); + skill_onskillusage(sd, bl, skill_id, tick); } if (!(flag&2) && ( - skillid == MG_COLDBOLT || skillid == MG_FIREBOLT || skillid == MG_LIGHTNINGBOLT + skill_id == MG_COLDBOLT || skill_id == MG_FIREBOLT || skill_id == MG_LIGHTNINGBOLT ) && (sc = status_get_sc(src)) && sc->data[SC_DOUBLECAST] && rnd() % 100 < sc->data[SC_DOUBLECAST]->val2) { -// skill_addtimerskill(src, tick + dmg.div_*dmg.amotion, bl->id, 0, 0, skillid, skilllv, BF_MAGIC, flag|2); - skill_addtimerskill(src, tick + dmg.amotion, bl->id, 0, 0, skillid, skilllv, BF_MAGIC, flag|2); +// skill_addtimerskill(src, tick + dmg.div_*dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2); + skill_addtimerskill(src, tick + dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2); } map_freeblock_unlock(); @@ -2808,13 +2808,13 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds /*========================================== * sub fonction for recursive skill call. * Checking bl battle flag and display dammage - * then call func with source,target,skillid,skilllv,tick,flag + * then call func with source,target,skill_id,skill_lv,tick,flag *------------------------------------------*/ typedef int (*SkillFunc)(struct block_list *, struct block_list *, int, int, unsigned int, int); int skill_area_sub (struct block_list *bl, va_list ap) { struct block_list *src; - int skill_id,skill_lv,flag; + uint16 skill_id,skill_lv,flag; unsigned int tick; SkillFunc func; @@ -2844,7 +2844,7 @@ int skill_area_sub (struct block_list *bl, va_list ap) static int skill_check_unit_range_sub (struct block_list *bl, va_list ap) { struct skill_unit *unit; - int skillid,g_skillid; + uint16 skill_id,g_skill_id; unit = (struct skill_unit *)bl; @@ -2854,15 +2854,15 @@ static int skill_check_unit_range_sub (struct block_list *bl, va_list ap) if(!unit->alive) return 0; - skillid = va_arg(ap,int); - g_skillid = unit->group->skill_id; + skill_id = va_arg(ap,int); + g_skill_id = unit->group->skill_id; - switch (skillid) { + switch (skill_id) { case MH_STEINWAND: case MG_SAFETYWALL: case AL_PNEUMA: case SC_MAELSTROM: - if(g_skillid != MH_STEINWAND && g_skillid != MG_SAFETYWALL && g_skillid != AL_PNEUMA && g_skillid != SC_MAELSTROM) + if(g_skill_id != MH_STEINWAND && g_skill_id != MG_SAFETYWALL && g_skill_id != AL_PNEUMA && g_skill_id != SC_MAELSTROM) return 0; break; case AL_WARP: @@ -2892,11 +2892,11 @@ static int skill_check_unit_range_sub (struct block_list *bl, va_list ap) case SC_DIMENSIONDOOR: case SC_BLOODYLUST: //Non stackable on themselves and traps (including venom dust which does not has the trap inf2 set) - if (skillid != g_skillid && !(skill_get_inf2(g_skillid)&INF2_TRAP) && g_skillid != AS_VENOMDUST && g_skillid != MH_POISON_MIST) + if (skill_id != g_skill_id && !(skill_get_inf2(g_skill_id)&INF2_TRAP) && g_skill_id != AS_VENOMDUST && g_skill_id != MH_POISON_MIST) return 0; break; default: //Avoid stacking with same kind of trap. [Skotlex] - if (g_skillid != skillid) + if (g_skill_id != skill_id) return 0; break; } @@ -2904,56 +2904,56 @@ static int skill_check_unit_range_sub (struct block_list *bl, va_list ap) return 1; } -static int skill_check_unit_range (struct block_list *bl, int x, int y, int skillid, int skilllv) +static int skill_check_unit_range (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv) { //Non players do not check for the skill's splash-trigger area. - int range = bl->type==BL_PC?skill_get_unit_range(skillid, skilllv):0; - int layout_type = skill_get_unit_layout_type(skillid,skilllv); + int range = bl->type==BL_PC?skill_get_unit_range(skill_id, skill_lv):0; + int layout_type = skill_get_unit_layout_type(skill_id,skill_lv); if (layout_type==-1 || layout_type>MAX_SQUARE_LAYOUT) { - ShowError("skill_check_unit_range: unsupported layout type %d for skill %d\n",layout_type,skillid); + ShowError("skill_check_unit_range: unsupported layout type %d for skill %d\n",layout_type,skill_id); return 0; } range += layout_type; - return map_foreachinarea(skill_check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skillid); + return map_foreachinarea(skill_check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skill_id); } static int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) { - int skillid; + uint16 skill_id; if(bl->prev == NULL) return 0; - skillid = va_arg(ap,int); + skill_id = va_arg(ap,int); - if( status_isdead(bl) && skillid != AL_WARP ) + if( status_isdead(bl) && skill_id != AL_WARP ) return 0; - if( skillid == HP_BASILICA && bl->type == BL_PC ) + if( skill_id == HP_BASILICA && bl->type == BL_PC ) return 0; - if( skillid == AM_DEMONSTRATION && bl->type == BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPERIUM ) + if( skill_id == AM_DEMONSTRATION && bl->type == BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPERIUM ) return 0; //Allow casting Bomb/Demonstration Right under emperium [Skotlex] return 1; } -static int skill_check_unit_range2 (struct block_list *bl, int x, int y, int skillid, int skilllv) +static int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv) { int range, type; - switch (skillid) { // to be expanded later + switch (skill_id) { // to be expanded later case WZ_ICEWALL: range = 2; break; default: { - int layout_type = skill_get_unit_layout_type(skillid,skilllv); + int layout_type = skill_get_unit_layout_type(skill_id,skill_lv); if (layout_type==-1 || layout_type>MAX_SQUARE_LAYOUT) { - ShowError("skill_check_unit_range2: unsupported layout type %d for skill %d\n",layout_type,skillid); + ShowError("skill_check_unit_range2: unsupported layout type %d for skill %d\n",layout_type,skill_id); return 0; } - range = skill_get_unit_range(skillid,skilllv) + layout_type; + range = skill_get_unit_range(skill_id,skill_lv) + layout_type; } break; } @@ -2967,7 +2967,7 @@ static int skill_check_unit_range2 (struct block_list *bl, int x, int y, int ski return map_foreachinarea(skill_check_unit_range2_sub, bl->m, x - range, y - range, x + range, y + range, - type, skillid); + type, skill_id); } int skill_guildaura_sub (struct map_session_data* sd, int id, int strvit, int agidex) @@ -2998,7 +2998,8 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill, int { struct status_data *status; struct map_session_data *sd = NULL; - int i, j, hp, sp, hp_rate, sp_rate, state, mhp; + int i, hp, sp, hp_rate, sp_rate, state, mhp; + uint16 idx; int itemid[MAX_SKILL_ITEM_REQUIRE],amount[ARRAYLENGTH(itemid)],index[ARRAYLENGTH(itemid)]; if( lv < 1 || lv > MAX_SKILL_LEVEL ) @@ -3012,21 +3013,21 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill, int } status = status_get_status_data(bl); - if( (j = skill_get_index(skill)) == 0 ) + if( (idx = skill_get_index(skill)) == 0 ) return 0; // Requeriments for( i = 0; i < ARRAYLENGTH(itemid); i++ ) { - itemid[i] = skill_db[j].itemid[i]; - amount[i] = skill_db[j].amount[i]; - } - hp = skill_db[j].hp[lv-1]; - sp = skill_db[j].sp[lv-1]; - hp_rate = skill_db[j].hp_rate[lv-1]; - sp_rate = skill_db[j].sp_rate[lv-1]; - state = skill_db[j].state; - if( (mhp = skill_db[j].mhp[lv-1]) > 0 ) + itemid[i] = skill_db[idx].itemid[i]; + amount[i] = skill_db[idx].amount[i]; + } + hp = skill_db[idx].hp[lv-1]; + sp = skill_db[idx].sp[lv-1]; + hp_rate = skill_db[idx].hp_rate[lv-1]; + sp_rate = skill_db[idx].sp_rate[lv-1]; + state = skill_db[idx].state; + if( (mhp = skill_db[idx].mhp[lv-1]) > 0 ) hp += (status->max_hp * mhp) / 100; if( hp_rate > 0 ) hp += (status->hp * hp_rate) / 100; @@ -3112,7 +3113,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill, int /*========================================== * *------------------------------------------*/ -int skill_area_sub_count (struct block_list *src, struct block_list *target, int skillid, int skilllv, unsigned int tick, int flag) +int skill_area_sub_count (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { return 1; } @@ -3331,7 +3332,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) /*========================================== * *------------------------------------------*/ -int skill_addtimerskill (struct block_list *src, unsigned int tick, int target, int x,int y, int skill_id, int skill_lv, int type, int flag) +int skill_addtimerskill (struct block_list *src, unsigned int tick, int target, int x,int y, uint16 skill_id, uint16 skill_lv, int type, int flag) { int i; struct unit_data *ud; @@ -3408,13 +3409,13 @@ static int skill_reveal_trap (struct block_list *bl, va_list ap) * * *------------------------------------------*/ -int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int skillid, int skilllv, unsigned int tick, int flag) +int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { struct map_session_data *sd = NULL; struct status_data *tstatus; struct status_change *sc; - if (skillid > 0 && skilllv <= 0) return 0; + if (skill_id > 0 && skill_lv <= 0) return 0; nullpo_retr(1, src); nullpo_retr(1, bl); @@ -3430,12 +3431,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if (status_isdead(bl)) return 1; - if (skillid && skill_get_type(skillid) == BF_MAGIC && status_isimmune(bl) == 100) + if (skill_id && skill_get_type(skill_id) == BF_MAGIC && status_isimmune(bl) == 100) { //GTB makes all targetted magic display miss with a single bolt. - sc_type sct = status_skill2sc(skillid); + sc_type sct = status_skill2sc(skill_id); if(sct != SC_NONE) status_change_end(bl, sct, INVALID_TIMER); - clif_skill_damage(src, bl, tick, status_get_amotion(src), status_get_dmotion(bl), 0, 1, skillid, skilllv, skill_get_hit(skillid)); + clif_skill_damage(src, bl, tick, status_get_amotion(src), status_get_dmotion(bl), 0, 1, skill_id, skill_lv, skill_get_hit(skill_id)); return 1; } @@ -3447,7 +3448,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int map_freeblock_lock(); - switch(skillid) + switch(skill_id) { case MER_CRASH: case SM_BASH: @@ -3560,7 +3561,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case KO_JYUMONJIKIRI: case KO_SETSUDAN: case KO_KAIHOU: - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; /** @@ -3573,7 +3574,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case NC_ARMSCANNON: if (sd) pc_overheat(sd,1); case RK_WINDCUTTER: - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag|SD_ANIMATION); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); break; case LK_JOINTBEAT: // decide the ailment first (affects attack damage and effect) @@ -3588,33 +3589,33 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int //TODO: is there really no cleaner way to do this? sc = status_get_sc(bl); if (sc) sc->jb_flag = flag; - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case MO_COMBOFINISH: if (!(flag&1) && sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_MONK) { //Becomes a splash attack when Soul Linked. map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skillid, skilllv),splash_target(src), - src,skillid,skilllv,tick, flag|BCT_ENEMY|1, + skill_get_splash(skill_id, skill_lv),splash_target(src), + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); } else - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case TK_STORMKICK: // Taekwon kicks [Dralnu] - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); skill_area_temp[1] = 0; map_foreachinrange(skill_attack_area, src, - skill_get_splash(skillid, skilllv), splash_target(src), - BF_WEAPON, src, src, skillid, skilllv, tick, flag, BCT_ENEMY); + skill_get_splash(skill_id, skill_lv), splash_target(src), + BF_WEAPON, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY); break; case KN_CHARGEATK: { bool path = path_search_long(NULL, src->m, src->x, src->y, bl->x, bl->y,CELL_CHKWALL); unsigned int dist = distance_bl(src, bl); - unsigned int dir = map_calc_dir(bl, src->x, src->y); + uint8 dir = map_calc_dir(bl, src->x, src->y); // teleport to target (if not on WoE grounds) if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground && unit_movepos(src, bl->x, bl->y, 0, 1) ) @@ -3623,7 +3624,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int // cause damage and knockback if the path to target was a straight one if( path ) { - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, dist); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, dist); skill_blown(src, bl, dist, dir, 0); //HACK: since knockback officially defaults to the left, the client also turns to the left... therefore, // make the caster look in the direction of the target @@ -3643,8 +3644,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int //line of sight between caster and target. skill_area_temp[1] = bl->id; map_foreachinpath (skill_attack_area,src->m,src->x,src->y,bl->x,bl->y, - skill_get_splash(skillid, skilllv),skill_get_maxcount(skillid,skilllv), splash_target(src), - skill_get_type(skillid),src,src,skillid,skilllv,tick,flag,BCT_ENEMY); + skill_get_splash(skill_id, skill_lv),skill_get_maxcount(skill_id,skill_lv), splash_target(src), + skill_get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY); break; case NPC_ACIDBREATH: @@ -3654,41 +3655,41 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case NPC_THUNDERBREATH: skill_area_temp[1] = bl->id; map_foreachinpath(skill_attack_area,src->m,src->x,src->y,bl->x,bl->y, - skill_get_splash(skillid, skilllv),skill_get_maxcount(skillid,skilllv), splash_target(src), - skill_get_type(skillid),src,src,skillid,skilllv,tick,flag,BCT_ENEMY); + skill_get_splash(skill_id, skill_lv),skill_get_maxcount(skill_id,skill_lv), splash_target(src), + skill_get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY); break; case MO_INVESTIGATE: - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); break; case RG_BACKSTAP: { - int dir = map_calc_dir(src, bl->x, bl->y), t_dir = unit_getdir(bl); + uint8 dir = map_calc_dir(src, bl->x, bl->y), t_dir = unit_getdir(bl); if ((!check_distance_bl(src, bl, 0) && !map_check_dir(dir, t_dir)) || bl->type == BL_SKILL) { status_change_end(src, SC_HIDING, INVALID_TIMER); - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); dir = dir < 4 ? dir+4 : dir-4; // change direction [Celest] unit_setdir(bl,dir); } else if (sd) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; case MO_FINGEROFFENSIVE: - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); if (battle_config.finger_offensive_type && sd) { int i; for (i = 1; i < sd->spiritball_old; i++) - skill_addtimerskill(src, tick + i * 200, bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag); + skill_addtimerskill(src, tick + i * 200, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); } status_change_end(src, SC_BLADESTOP, INVALID_TIMER); break; case MO_CHAINCOMBO: - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); break; @@ -3697,12 +3698,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int status_change_end(src, SC_HIDING, INVALID_TIMER); // fall through case MO_EXTREMITYFIST: - if( skillid == MO_EXTREMITYFIST ) + if( skill_id == MO_EXTREMITYFIST ) { status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); #ifdef RENEWAL - sc_start(src,SC_EXTREMITYFIST2,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(src,SC_EXTREMITYFIST2,100,skill_lv,skill_get_time(skill_id,skill_lv)); #endif } //Client expects you to move to target regardless of distance @@ -3710,7 +3711,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int struct unit_data *ud = unit_bl2ud(src); short dx,dy; int i,speed; - i = skillid == MO_EXTREMITYFIST?1:2; //Move 2 cells for Issen, 1 for Asura + i = skill_id == MO_EXTREMITYFIST?1:2; //Move 2 cells for Issen, 1 for Asura dx = bl->x - src->x; dy = bl->y - src->y; if (dx < 0) dx-=i; @@ -3727,7 +3728,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int dy = src->y + dy; } - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); if(unit_walktoxy(src, dx, dy, 2) && ud) { //Increase can't walk delay to not alter your walk path @@ -3804,26 +3805,26 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int int sflag = skill_area_temp[0] & 0xFFF, heal; if( flag&SD_LEVEL ) sflag |= SD_LEVEL; // -1 will be used in packets instead of the skill level - if( skill_area_temp[1] != bl->id && !(skill_get_inf2(skillid)&INF2_NPC_SKILL) ) + if( skill_area_temp[1] != bl->id && !(skill_get_inf2(skill_id)&INF2_NPC_SKILL) ) sflag |= SD_ANIMATION; // original target gets no animation (as well as all NPC skills) - heal = skill_attack(skill_get_type(skillid), src, src, bl, skillid, skilllv, tick, sflag); - if( skillid == NPC_VAMPIRE_GIFT && heal > 0 ) { + heal = skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, sflag); + if( skill_id == NPC_VAMPIRE_GIFT && heal > 0 ) { clif_skill_nodamage(NULL, src, AL_HEAL, heal, 1); status_heal(src,heal,0,0); } } else { - switch ( skillid ) { + switch ( skill_id ) { case NJ_BAKUENRYU: case LG_EARTHDRIVE: case GN_CARTCANNON: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case LG_MOONSLASHER: - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; case NPC_EARTHQUAKE://FIXME: Isn't EarthQuake a ground skill after all? - skill_addtimerskill(src,tick+250,src->id,0,0,skillid,skilllv,2,flag|BCT_ENEMY|SD_SPLASH|1); + skill_addtimerskill(src,tick+250,src->id,0,0,skill_id,skill_lv,2,flag|BCT_ENEMY|SD_SPLASH|1); default: break; } @@ -3831,20 +3832,20 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int skill_area_temp[0] = 0; skill_area_temp[1] = bl->id; skill_area_temp[2] = 0; - if( skillid == WL_CRIMSONROCK ) { + if( skill_id == WL_CRIMSONROCK ) { skill_area_temp[4] = bl->x; skill_area_temp[5] = bl->y; } - if( skillid == WM_REVERBERATION_MELEE || skillid == WM_REVERBERATION_MAGIC ) + if( skill_id == WM_REVERBERATION_MELEE || skill_id == WM_REVERBERATION_MAGIC ) skill_area_temp[1] = 0; // if skill damage should be split among targets, count them //SD_LEVEL -> Forced splash damage for Auto Blitz-Beat -> count targets //special case: Venom Splasher uses a different range for searching than for splashing - if( flag&SD_LEVEL || skill_get_nk(skillid)&NK_SPLASHSPLIT ) - skill_area_temp[0] = map_foreachinrange(skill_area_sub, bl, (skillid == AS_SPLASHER)?1:skill_get_splash(skillid, skilllv), BL_CHAR, src, skillid, skilllv, tick, BCT_ENEMY, skill_area_sub_count); + if( flag&SD_LEVEL || skill_get_nk(skill_id)&NK_SPLASHSPLIT ) + skill_area_temp[0] = map_foreachinrange(skill_area_sub, bl, (skill_id == AS_SPLASHER)?1:skill_get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill_area_sub_count); // recursive invocation of skill_castend_damage_id() with flag|1 - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), ( skillid == WM_REVERBERATION_MELEE || skillid == WM_REVERBERATION_MAGIC )?BL_CHAR:splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), ( skill_id == WM_REVERBERATION_MELEE || skill_id == WM_REVERBERATION_MAGIC )?BL_CHAR:splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); } break; @@ -3852,9 +3853,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case ML_BRANDISH: //Coded apart for it needs the flag passed to the damage calculation. if (skill_area_temp[1] != bl->id) - skill_attack(skill_get_type(skillid), src, src, bl, skillid, skilllv, tick, flag|SD_ANIMATION); + skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag|SD_ANIMATION); else - skill_attack(skill_get_type(skillid), src, src, bl, skillid, skilllv, tick, flag); + skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); break; case KN_BOWLINGBASH: @@ -3863,26 +3864,26 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if(bl->id==skill_area_temp[1]) break; //two hits for 500% - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,SD_ANIMATION); - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,SD_ANIMATION); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION); } else { int i,c; - c = skill_get_blewcount(skillid,skilllv); + c = skill_get_blewcount(skill_id,skill_lv); // keep moving target in the direction that src is looking, square by square for(i=0;i<c;i++){ if (!skill_blown(src,bl,1,(unit_getdir(src)+4)%8,0x1)) break; //Can't knockback - skill_area_temp[0] = map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), BL_CHAR, src, skillid, skilllv, tick, flag|BCT_ENEMY, skill_area_sub_count); + skill_area_temp[0] = map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill_area_sub_count); if( skill_area_temp[0] > 1 ) break; // collision } clif_blown(bl); //Update target pos. if (i!=c) { //Splash skill_area_temp[1] = bl->id; - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); } //Weirdo dual-hit property, two attacks for 500% - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0); - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0); } break; @@ -3890,19 +3891,19 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if(flag&1) { if (bl->id==skill_area_temp[1]) break; - if (skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,SD_ANIMATION)) + if (skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,SD_ANIMATION)) skill_blown(src,bl,skill_area_temp[2],-1,0); } else { int x=bl->x,y=bl->y,i,dir; dir = map_calc_dir(bl,src->x,src->y); skill_area_temp[1] = bl->id; - skill_area_temp[2] = skill_get_blewcount(skillid,skilllv); + skill_area_temp[2] = skill_get_blewcount(skill_id,skill_lv); // all the enemies between the caster and the target are hit, as well as the target - if (skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0)) + if (skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0)) skill_blown(src,bl,skill_area_temp[2],-1,0); for (i=0;i<4;i++) { map_foreachincell(skill_area_sub,bl->m,x,y,BL_CHAR, - src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); x += dirx[dir]; y += diry[dir]; } @@ -3913,24 +3914,24 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case MO_BALKYOUNG: //Active part of the attack. Skill-attack [Skotlex] { skill_area_temp[1] = bl->id; //NOTE: This is used in skill_castend_nodamage_id to avoid affecting the target. - if (skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag)) + if (skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag)) map_foreachinrange(skill_area_sub,bl, - skill_get_splash(skillid, skilllv),BL_CHAR, - src,skillid,skilllv,tick,flag|BCT_ENEMY|1, + skill_get_splash(skill_id, skill_lv),BL_CHAR, + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1, skill_castend_nodamage_id); } break; case CH_PALMSTRIKE: // Palm Strike takes effect 1sec after casting. [Skotlex] - // clif_skill_nodamage(src,bl,skillid,skilllv,0); //Can't make this one display the correct attack animation delay :/ + // clif_skill_nodamage(src,bl,skill_id,skill_lv,0); //Can't make this one display the correct attack animation delay :/ clif_damage(src,bl,tick,status_get_amotion(src),0,-1,1,4,0); //Display an absorbed damage attack. - skill_addtimerskill(src, tick + 1000, bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag); + skill_addtimerskill(src, tick + 1000, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); break; case PR_TURNUNDEAD: case ALL_RESURRECTION: if (!battle_check_undead(tstatus->race, tstatus->def_ele)) break; - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case MG_SOULSTRIKE: @@ -3956,12 +3957,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case AB_DUPLELIGHT_MAGIC: case WM_METALICSOUND: case MH_ERASER_CUTTER: - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case NPC_MAGICALATTACK: - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); - sc_start(src,status_skill2sc(skillid),100,skilllv,skill_get_time(skillid,skilllv)); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + sc_start(src,status_skill2sc(skill_id),100,skill_lv,skill_get_time(skill_id,skill_lv)); break; case HVAN_CAPRICE: //[blackhole89] @@ -3975,20 +3976,20 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case 2: sid=MG_LIGHTNINGBOLT; break; case 3: sid=WZ_EARTHSPIKE; break; } - skill_attack(BF_MAGIC,src,src,bl,sid,skilllv,tick,flag|SD_LEVEL); + skill_attack(BF_MAGIC,src,src,bl,sid,skill_lv,tick,flag|SD_LEVEL); } break; case WZ_WATERBALL: { - int range = skilllv / 2; - int maxlv = skill_get_max(skillid); // learnable level + int range = skill_lv / 2; + int maxlv = skill_get_max(skill_id); // learnable level int count = 0; int x, y; struct skill_unit* unit; - if( skilllv > maxlv ) + if( skill_lv > maxlv ) { - if( src->type == BL_MOB && skilllv == 10 ) + if( src->type == BL_MOB && skill_lv == 10 ) range = 4; else range = maxlv / 2; @@ -4010,15 +4011,15 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int } if( count > 1 ) // queue the remaining count - 1 timerskill Waterballs - skill_addtimerskill(src,tick+150,bl->id,0,0,skillid,skilllv,count-1,flag); + skill_addtimerskill(src,tick+150,bl->id,0,0,skill_id,skill_lv,count-1,flag); } - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case PR_BENEDICTIO: //Should attack undead and demons. [Skotlex] if (battle_check_undead(tstatus->race, tstatus->def_ele) || tstatus->race == RC_DEMON) - skill_attack(BF_MAGIC, src, src, bl, skillid, skilllv, tick, flag); + skill_attack(BF_MAGIC, src, src, bl, skill_id, skill_lv, tick, flag); break; case SL_SMA: @@ -4026,11 +4027,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case SL_STIN: case SL_STUN: if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) { - status_change_start(src,SC_STUN,10000,skilllv,0,0,0,500,10); - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + status_change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,10); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case NPC_DARKBREATH: @@ -4044,7 +4045,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case NJ_ZENYNAGE: case GN_THORNS_TRAP: case GN_HELLS_PLANT_ATK: - skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); break; /** * Rune Knight @@ -4052,9 +4053,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case RK_DRAGONBREATH: { struct status_change *tsc = NULL; if( (tsc = status_get_sc(bl)) && (tsc->data[SC_HIDING] )) { - clif_skill_nodamage(src,src,skillid,skilllv,1); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); } else - skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); } break; @@ -4065,20 +4066,20 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int } case HVAN_EXPLOSION: if (src != bl) - skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); break; // Celest case PF_SOULBURN: - if (rnd()%100 < (skilllv < 5 ? 30 + skilllv * 10 : 70)) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if (skilllv == 5) - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + if (rnd()%100 < (skill_lv < 5 ? 30 + skill_lv * 10 : 70)) { + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + if (skill_lv == 5) + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); status_percent_damage(src, bl, 0, 100, false); } else { - clif_skill_nodamage(src,src,skillid,skilllv,1); - if (skilllv == 5) - skill_attack(BF_MAGIC,src,src,src,skillid,skilllv,tick,flag); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); + if (skill_lv == 5) + skill_attack(BF_MAGIC,src,src,src,skill_id,skill_lv,tick,flag); status_percent_damage(src, src, 0, 100, false); } break; @@ -4086,8 +4087,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case NPC_BLOODDRAIN: case NPC_ENERGYDRAIN: { - int heal = skill_attack( (skillid == NPC_BLOODDRAIN) ? BF_WEAPON : BF_MAGIC, - src, src, bl, skillid, skilllv, tick, flag); + int heal = skill_attack( (skill_id == NPC_BLOODDRAIN) ? BF_WEAPON : BF_MAGIC, + src, src, bl, skill_id, skill_lv, tick, flag); if (heal > 0){ clif_skill_nodamage(NULL, src, AL_HEAL, heal, 1); status_heal(src, heal, 0, 0); @@ -4096,12 +4097,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int break; case GS_BULLSEYE: - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case NJ_KASUMIKIRI: - if (skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag) > 0) - sc_start(src,SC_HIDING,100,skilllv,skill_get_time(skillid,skilllv)); + if (skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag) > 0) + sc_start(src,SC_HIDING,100,skill_lv,skill_get_time(skill_id,skill_lv)); break; case NJ_KIRIKAGE: if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground ) @@ -4112,26 +4113,26 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int clif_slide(src,src->x,src->y); } status_change_end(src, SC_HIDING, INVALID_TIMER); - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case RK_PHANTOMTHRUST: unit_setdir(src,map_calc_dir(src, bl->x, bl->y)); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); skill_blown(src,bl,distance_bl(src,bl)-1,unit_getdir(src),0); if( battle_check_target(src,bl,BCT_ENEMY) ) - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case RK_STORMBLAST: case RK_CRUSHSTRIKE: if( sd ) { - if( pc_checkskill(sd,RK_RUNEMASTERY) >= ( skillid == RK_CRUSHSTRIKE ? 7 : 3 ) ) - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + if( pc_checkskill(sd,RK_RUNEMASTERY) >= ( skill_id == RK_CRUSHSTRIKE ? 7 : 3 ) ) + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); else - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } else //non-sd support - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case GC_DARKILLUSION: { @@ -4149,9 +4150,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int { clif_slide(src,bl->x+x,bl->y+y); clif_fixpos(src); // the official server send these two packts. - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); - if( rnd()%100 < 4 * skilllv ) - skill_castend_damage_id(src,bl,GC_CROSSIMPACT,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + if( rnd()%100 < 4 * skill_lv ) + skill_castend_damage_id(src,bl,GC_CROSSIMPACT,skill_lv,tick,flag); } } @@ -4159,17 +4160,17 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case GC_WEAPONCRUSH: if( sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == GC_WEAPONBLOCKING ) - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); else if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_GC_WEAPONBLOCKING,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_GC_WEAPONBLOCKING,0); break; case GC_CROSSRIPPERSLASHER: if( sd && !(sc && sc->data[SC_ROLLINGCUTTER]) ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_CONDITION,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_CONDITION,0); else { - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(src,SC_ROLLINGCUTTER,INVALID_TIMER); } break; @@ -4179,19 +4180,19 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int { // Only Hits Invisible Targets struct status_change *tsc = status_get_sc(bl); if(tsc && (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || tsc->data[SC__INVISIBILITY]) ) - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); } break; case WL_CHAINLIGHTNING: - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_addtimerskill(src,tick + 150,bl->id,3,0,WL_CHAINLIGHTNING_ATK,skilllv,4+skilllv,flag); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + skill_addtimerskill(src,tick + 150,bl->id,3,0,WL_CHAINLIGHTNING_ATK,skill_lv,4+skill_lv,flag); break; case WL_DRAINLIFE: { - int heal = skill_attack(skill_get_type(skillid), src, src, bl, skillid, skilllv, tick, flag); - int rate = 70 + 5 * skilllv; + int heal = skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); + int rate = 70 + 5 * skill_lv; - heal = heal * (5 + 5 * skilllv) / 100; + heal = heal * (5 + 5 * skill_lv) / 100; if( bl->type == BL_SKILL ) heal = 0; // Don't absorb heal from Ice Walls or other skill units. @@ -4221,7 +4222,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if( j < 4 ) { // Need 4 spheres minimum - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } @@ -4244,8 +4245,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case WLS_WATER: subskill = WL_TETRAVORTEX_WATER; k |= 2; break; case WLS_STONE: subskill = WL_TETRAVORTEX_GROUND; k |= 8; break; } - skill_addtimerskill(src, tick + i * 200, bl->id, k, 0, subskill, skilllv, i, flag); - clif_skill_nodamage(src, bl, subskill, skilllv, 1); + skill_addtimerskill(src, tick + i * 200, bl->id, k, 0, subskill, skill_lv, i, flag); + clif_skill_nodamage(src, bl, subskill, skill_lv, 1); status_change_end(src, spheres[i], INVALID_TIMER); } } @@ -4258,7 +4259,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int // Priority is to release SpellBook if( sc && sc->data[SC_READING_SB] ) { // SpellBook - int skill_id, skill_lv, point, s = 0; + uint16 skill_id, skill_lv, point, s = 0; int spell[SC_MAXSPELLBOOK-SC_SPELLBOOK1 + 1]; for(i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--) // List all available spell to be released @@ -4281,7 +4282,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int else // Last spell to be released status_change_end(src, SC_READING_SB, INVALID_TIMER); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); if( !skill_check_condition_castbegin(sd, skill_id, skill_lv) ) break; @@ -4318,7 +4319,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if( j == 0 ) { // No Spheres - clif_skill_fail(sd,skillid,USESKILL_FAIL_SUMMON_NONE,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON_NONE,0); break; } @@ -4331,7 +4332,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int swap(spheres[i],spheres[k]); } - if( skilllv == 1 ) j = 1; // Limit only to one ball + if( skill_lv == 1 ) j = 1; // Limit only to one ball for( i = 0; i < j; i++ ) { skele = WL_RELEASE - 5 + sc->data[spheres[i]]->val1 - WLS_FIRE; // Convert Ball Element into Skill ATK for balls @@ -4339,40 +4340,40 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int skill_addtimerskill(src,tick+status_get_adelay(src)*i,bl->id,0,0,skele,sc->data[spheres[i]]->val3,BF_MAGIC,flag|SD_LEVEL); status_change_end(src, spheres[i], INVALID_TIMER); // Eliminate ball } - clif_skill_nodamage(src,bl,skillid,0,1); + clif_skill_nodamage(src,bl,skill_id,0,1); } } break; case WL_FROSTMISTY: // Causes Freezing status through walls. - sc_start(bl,status_skill2sc(skillid),20+12*skilllv+(sd ? sd->status.job_level : 50)/5,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,status_skill2sc(skill_id),20+12*skill_lv+(sd ? sd->status.job_level : 50)/5,skill_lv,skill_get_time(skill_id,skill_lv)); // Doesn't deal damage through non-shootable walls. if( path_search(NULL,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKWALL) ) - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag|SD_ANIMATION); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); break; case WL_HELLINFERNO: - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag|ELE_DARK); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|ELE_DARK); break; case RA_WUGSTRIKE: if( sd && pc_isridingwug(sd) ){ short x[8]={0,-1,-1,-1,0,1,1,1}; short y[8]={1,1,0,-1,-1,-1,0,1}; - int dir = map_calc_dir(bl, src->x, src->y); + uint8 dir = map_calc_dir(bl, src->x, src->y); if( unit_movepos(src, bl->x+x[dir], bl->y+y[dir], 1, 1) ) { clif_slide(src, bl->x+x[dir], bl->y+y[dir]); clif_fixpos(src); - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); } break; } case RA_WUGBITE: if( path_search(NULL,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKNOREACH) ) { - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); - }else if( sd && skillid == RA_WUGBITE ) // Only RA_WUGBITE has the skill fail message. - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); + }else if( sd && skill_id == RA_WUGBITE ) // Only RA_WUGBITE has the skill fail message. + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; @@ -4380,7 +4381,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if( bl->type != BL_SKILL ) { // Only Hits Invisible Targets struct status_change * tsc = status_get_sc(bl); if( tsc && tsc->option&(OPTION_HIDE|OPTION_CLOAK) ){ - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); } } @@ -4408,25 +4409,25 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if( flag&1 ) { //TODO: Need a confirmation if the other type of hidden status is included to be scanned. [Jobbie] if( rnd()%100 < 50 ) - sc_start(bl, SC_INFRAREDSCAN, 10000, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_INFRAREDSCAN, 10000, skill_lv, skill_get_time(skill_id, skill_lv)); status_change_end(bl, SC_HIDING, INVALID_TIMER); status_change_end(bl, SC_CLOAKING, INVALID_TIMER); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); // Need confirm it. } else { - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); - clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); + clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( sd ) pc_overheat(sd,1); } break; case NC_MAGNETICFIELD: - sc_start2(bl,SC_MAGNETICFIELD,100,skilllv,src->id,skill_get_time(skillid,skilllv)); + sc_start2(bl,SC_MAGNETICFIELD,100,skill_lv,src->id,skill_get_time(skill_id,skill_lv)); break; case SC_FATALMENACE: if( flag&1 ) - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); else { short x, y; @@ -4434,31 +4435,31 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int // Destination area skill_area_temp[4] = x; skill_area_temp[5] = y; - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); - skill_addtimerskill(src,tick + 800,src->id,x,y,skillid,skilllv,0,flag); // To teleport Self - clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skillid,skilllv,6); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); + skill_addtimerskill(src,tick + 800,src->id,x,y,skill_id,skill_lv,0,flag); // To teleport Self + clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6); } break; case LG_PINPOINTATTACK: if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground && unit_movepos(src, bl->x, bl->y, 1, 1) ) clif_slide(src,bl->x,bl->y); - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case LG_SHIELDSPELL: // flag&1: Phisycal Attack, flag&2: Magic Attack. - skill_attack((flag&1)?BF_WEAPON:BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack((flag&1)?BF_WEAPON:BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); break; case LG_OVERBRAND: - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag|SD_LEVEL); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_LEVEL); break; case LG_OVERBRAND_BRANDISH: - skill_addtimerskill(src, tick + status_get_amotion(src)*8/10, bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag|SD_LEVEL); + skill_addtimerskill(src, tick + status_get_amotion(src)*8/10, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|SD_LEVEL); break; case SR_DRAGONCOMBO: - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; case SR_KNUCKLEARROW: @@ -4468,9 +4469,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int } if( flag&1 ) - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag|SD_LEVEL); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_LEVEL); else - skill_addtimerskill(src, tick + 300, bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag|SD_LEVEL|2); + skill_addtimerskill(src, tick + 300, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|SD_LEVEL|2); break; case SR_HOWLINGOFLION: @@ -4487,42 +4488,42 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int status_change_end(bl, SC_MELODYOFSINK, INVALID_TIMER); status_change_end(bl, SC_BEYONDOFWARCRY, INVALID_TIMER); status_change_end(bl, SC_UNLIMITEDHUMMINGVOICE, INVALID_TIMER); - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag|SD_ANIMATION); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag|SD_ANIMATION); break; case SR_EARTHSHAKER: if( flag&1 ) { //by default cloaking skills are remove by aoe skills so no more checking/removing except hiding and cloaking exceed. - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); status_change_end(bl, SC_HIDING, INVALID_TIMER); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); } else{ - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); } break; case WM_LULLABY_DEEPSLEEP: - if( bl != src && rnd()%100 < 88 + 2 * skilllv ) - sc_start(bl,status_skill2sc(skillid),100,skilllv,skill_get_time(skillid,skilllv)); + if( bl != src && rnd()%100 < 88 + 2 * skill_lv ) + sc_start(bl,status_skill2sc(skill_id),100,skill_lv,skill_get_time(skill_id,skill_lv)); break; case SO_POISON_BUSTER: { struct status_change *tsc = status_get_sc(bl); if( tsc && tsc->data[SC_POISON] ) { - skill_attack(skill_get_type(skillid), src, src, bl, skillid, skilllv, tick, flag); + skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); status_change_end(bl, SC_POISON, INVALID_TIMER); } else if( sd ) - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); } break; case GN_SPORE_EXPLOSION: if( flag&1 ) - skill_attack(skill_get_type(skillid), src, src, bl, skillid, skilllv, tick, flag); + skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); else { - clif_skill_nodamage(src, bl, skillid, 0, 1); - skill_addtimerskill(src, gettick() + skill_get_time(skillid, skilllv) - 1000, bl->id, 0, 0, skillid, skilllv, 0, 0); + clif_skill_nodamage(src, bl, skill_id, 0, 1); + skill_addtimerskill(src, gettick() + skill_get_time(skill_id, skill_lv) - 1000, bl->id, 0, 0, skill_id, skill_lv, 0, 0); } break; @@ -4532,38 +4533,38 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case EL_HURRICANE: case EL_TYPOON_MIS: if( flag&1 ) - skill_attack(skill_get_type(skillid+1),src,src,bl,skillid+1,skilllv,tick,flag); + skill_attack(skill_get_type(skill_id+1),src,src,bl,skill_id+1,skill_lv,tick,flag); else { - int i = skill_get_splash(skillid,skilllv); - clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1); - clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + int i = skill_get_splash(skill_id,skill_lv); + clif_skill_nodamage(src,battle_get_master(src),skill_id,skill_lv,1); + clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rnd()%100 < 30 ) - map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); else - skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); + skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); } break; case EL_ROCK_CRUSHER: - clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1); - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_nodamage(src,battle_get_master(src),skill_id,skill_lv,1); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rnd()%100 < 50 ) - skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag); else - skill_attack(BF_WEAPON,src,src,bl,EL_ROCK_CRUSHER_ATK,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,EL_ROCK_CRUSHER_ATK,skill_lv,tick,flag); break; case EL_STONE_RAIN: if( flag&1 ) - skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); + skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); else { - int i = skill_get_splash(skillid,skilllv); - clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1); - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + int i = skill_get_splash(skill_id,skill_lv); + clif_skill_nodamage(src,battle_get_master(src),skill_id,skill_lv,1); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rnd()%100 < 30 ) - map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); else - skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); + skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); } break; @@ -4571,9 +4572,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case EL_ICE_NEEDLE: case EL_WIND_SLASH: case EL_STONE_HAMMER: - clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1); - clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); + clif_skill_nodamage(src,battle_get_master(src),skill_id,skill_lv,1); + clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); break; case EL_TIDAL_WEAPON: @@ -4581,21 +4582,21 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int struct elemental_data *ele = BL_CAST(BL_ELEM,src); struct status_change *sc = status_get_sc(&ele->bl); struct status_change *tsc = status_get_sc(bl); - sc_type type = status_skill2sc(skillid), type2; + sc_type type = status_skill2sc(skill_id), type2; type2 = type-1; - clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1); - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_nodamage(src,battle_get_master(src),skill_id,skill_lv,1); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { - elemental_clean_single_effect(ele, skillid); + elemental_clean_single_effect(ele, skill_id); } if( rnd()%100 < 50 ) - skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); + skill_attack(skill_get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag); else { - sc_start(src,type2,100,skilllv,skill_get_time(skillid,skilllv)); - sc_start(battle_get_master(src),type,100,ele->bl.id,skill_get_time(skillid,skilllv)); + sc_start(src,type2,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(battle_get_master(src),type,100,ele->bl.id,skill_get_time(skill_id,skill_lv)); } - clif_skill_nodamage(src,src,skillid,skilllv,1); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); } break; @@ -4605,39 +4606,39 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case MH_XENO_SLASHER: case MH_HEILIGE_STANGE: if(flag & 1) - skill_attack(skill_get_type(skillid), src, src, bl, skillid, skilllv, tick, flag); + skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); else { - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill_castend_damage_id); } break; case MH_STAHL_HORN: case MH_NEEDLE_OF_PARALYZE: - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); break; case MH_TINDER_BREAKER: if (unit_movepos(src, bl->x, bl->y, 1, 1)) { #if PACKETVER >= 20111005 clif_snap(src, bl->x, bl->y); #else - clif_skill_poseffect(src,skillid,skilllv,bl->x,bl->y,tick); + clif_skill_poseffect(src,skill_id,skill_lv,bl->x,bl->y,tick); #endif } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start4(bl,SC_CLOSECONFINE2,100,skilllv,src->id,0,0,skill_get_time(skillid,skilllv))); - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start4(bl,SC_CLOSECONFINE2,100,skill_lv,src->id,0,0,skill_get_time(skill_id,skill_lv))); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); break; case 0:/* no skill - basic/normal attack */ if(sd) { if (flag & 3){ if (bl->id != skill_area_temp[1]) - skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, SD_LEVEL|flag); + skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, SD_LEVEL|flag); } else { skill_area_temp[1] = bl->id; map_foreachinrange(skill_area_sub, bl, sd->bonus.splash_range, BL_CHAR, - src, skillid, skilllv, tick, flag | BCT_ENEMY | 1, + src, skill_id, skill_lv, tick, flag | BCT_ENEMY | 1, skill_castend_damage_id); flag|=1; //Set flag to 1 so ammo is not double-consumed. [Skotlex] } @@ -4645,10 +4646,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int break; default: - ShowWarning("skill_castend_damage_id: Unknown skill used:%d\n",skillid); + ShowWarning("skill_castend_damage_id: Unknown skill used:%d\n",skill_id); clif_skill_damage(src, bl, tick, status_get_amotion(src), tstatus->dmotion, - 0, abs(skill_get_num(skillid, skilllv)), - skillid, skilllv, skill_get_hit(skillid)); + 0, abs(skill_get_num(skill_id, skill_lv)), + skill_id, skill_lv, skill_get_hit(skill_id)); map_freeblock_unlock(); return 1; } @@ -4664,11 +4665,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if( sd->state.arrow_atk ) {// consume arrow on last invocation to this skill. - battle_consume_ammo(sd, skillid, skilllv); + battle_consume_ammo(sd, skill_id, skill_lv); } // perform skill requirement consumption - skill_consume_requirement(sd,skillid,skilllv,2); + skill_consume_requirement(sd,skill_id,skill_lv,2); } return 0; @@ -4677,7 +4678,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int /*========================================== * *------------------------------------------*/ -int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, int skillid, int skilllv, unsigned int tick, int flag) +int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { struct map_session_data *sd, *dstsd; struct mob_data *md, *dstmd; @@ -4690,7 +4691,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int i = 0; enum sc_type type; - if(skillid > 0 && skilllv <= 0) return 0; // celest + if(skill_id > 0 && skill_lv <= 0) return 0; // celest nullpo_retr(1, src); nullpo_retr(1, bl); @@ -4715,7 +4716,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in /** * Skills that may be cast on dead targets **/ - switch( skillid ) { + switch( skill_id ) { case NPC_WIDESOULDRAIN: case PR_REDEMPTIO: case ALL_RESURRECTION: @@ -4730,10 +4731,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in sstatus = status_get_status_data(src); //Check for undead skills that convert a no-damage skill into a damage one. [Skotlex] - switch (skillid) { + switch (skill_id) { case HLIF_HEAL: //[orn] if (bl->type != BL_HOM) { - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0) ; + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0) ; break ; } case AL_HEAL: @@ -4748,44 +4749,44 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (sd && battle_check_undead(tstatus->race,tstatus->def_ele)) { if (battle_check_target(src, bl, BCT_ENEMY) < 1) { //Offensive heal does not works on non-enemies. [Skotlex] - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } - return skill_castend_damage_id (src, bl, skillid, skilllv, tick, flag); + return skill_castend_damage_id (src, bl, skill_id, skill_lv, tick, flag); } break; case NPC_SMOKING: //Since it is a self skill, this one ends here rather than in damage_id. [Skotlex] - return skill_castend_damage_id (src, bl, skillid, skilllv, tick, flag); + return skill_castend_damage_id (src, bl, skill_id, skill_lv, tick, flag); case MH_STEINWAND: { struct block_list *s_src = battle_get_master(src); short ret = 0; - if(!skill_check_unit_range(src, src->x, src->y, skillid, skilllv)) //prevent reiteration - ret = skill_castend_pos2(src,src->x,src->y,skillid,skilllv,tick,flag); //cast on homon - if(s_src && !skill_check_unit_range(s_src, s_src->x, s_src->y, skillid, skilllv)) - ret |= skill_castend_pos2(s_src,s_src->x,s_src->y,skillid,skilllv,tick,flag); //cast on master + if(!skill_check_unit_range(src, src->x, src->y, skill_id, skill_lv)) //prevent reiteration + ret = skill_castend_pos2(src,src->x,src->y,skill_id,skill_lv,tick,flag); //cast on homon + if(s_src && !skill_check_unit_range(s_src, s_src->x, s_src->y, skill_id, skill_lv)) + ret |= skill_castend_pos2(s_src,s_src->x,s_src->y,skill_id,skill_lv,tick,flag); //cast on master if (hd) - skill_blockhomun_start(hd, skillid, skill_get_cooldown(skillid, skilllv)); + skill_blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); return ret; } break; default: //Skill is actually ground placed. - if (src == bl && skill_get_unit_id(skillid,0)) - return skill_castend_pos2(src,bl->x,bl->y,skillid,skilllv,tick,0); + if (src == bl && skill_get_unit_id(skill_id,0)) + return skill_castend_pos2(src,bl->x,bl->y,skill_id,skill_lv,tick,0); } - type = status_skill2sc(skillid); + type = status_skill2sc(skill_id); tsc = status_get_sc(bl); tsce = (tsc && type != -1)?tsc->data[type]:NULL; if (src!=bl && type > -1 && - (i = skill_get_ele(skillid, skilllv)) > ELE_NEUTRAL && - skill_get_inf(skillid) != INF_SUPPORT_SKILL && + (i = skill_get_ele(skill_id, skill_lv)) > ELE_NEUTRAL && + skill_get_inf(skill_id) != INF_SUPPORT_SKILL && battle_attr_fix(NULL, NULL, 100, i, tstatus->def_ele, tstatus->ele_lv) <= 0) return 1; //Skills that cause an status should be blocked if the target element blocks its element. map_freeblock_lock(); - switch(skillid) + switch(skill_id) { case HLIF_HEAL: //[orn] case AL_HEAL: @@ -4794,11 +4795,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in **/ case AB_HIGHNESSHEAL: { - int heal = skill_calc_heal(src, bl, (skillid == AB_HIGHNESSHEAL)?AL_HEAL:skillid, (skillid == AB_HIGHNESSHEAL)?10:skilllv, true); + int heal = skill_calc_heal(src, bl, (skill_id == AB_HIGHNESSHEAL)?AL_HEAL:skill_id, (skill_id == AB_HIGHNESSHEAL)?10:skill_lv, true); int heal_get_jobexp; //Highness Heal: starts at 1.5 boost + 0.5 for each level - if( skillid == AB_HIGHNESSHEAL ) { - heal = heal * ( 15 + 5 * skilllv ) / 10; + if( skill_id == AB_HIGHNESSHEAL ) { + heal = heal * ( 15 + 5 * skill_lv ) / 10; } if( status_isimmune(bl) || (dstmd && (dstmd->class_ == MOBID_EMPERIUM || mob_is_battleground(dstmd))) || @@ -4824,8 +4825,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in else if (tsc->data[SC_BERSERK] || tsc->data[SC_SATURDAYNIGHTFEVER] || tsc->data[SC__BLOODYLUST]) heal = 0; //Needed so that it actually displays 0 when healing. } - clif_skill_nodamage (src, bl, skillid, heal, 1); - if( tsc && tsc->data[SC_AKAITSUKI] && heal && skillid != HLIF_HEAL ) + clif_skill_nodamage (src, bl, skill_id, heal, 1); + if( tsc && tsc->data[SC_AKAITSUKI] && heal && skill_id != HLIF_HEAL ) heal = ~heal + 1; heal_get_jobexp = status_heal(bl,heal,0,0); @@ -4841,16 +4842,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case PR_REDEMPTIO: if (sd && !(flag&1)) { if (sd->status.party_id == 0) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } skill_area_temp[0] = 0; party_foreachsamemap(skill_area_sub, - sd,skill_get_splash(skillid, skilllv), - src,skillid,skilllv,tick, flag|BCT_PARTY|1, + sd,skill_get_splash(skill_id, skill_lv), + src,skill_id,skill_lv,tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); if (skill_area_temp[0] == 0) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } skill_area_temp[0] = 5 - skill_area_temp[0]; // The actual penalty... @@ -4865,14 +4866,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; } else if (status_isdead(bl) && flag&1) { //Revive skill_area_temp[0]++; //Count it in, then fall-through to the Resurrection code. - skilllv = 3; //Resurrection level 3 is used + skill_lv = 3; //Resurrection level 3 is used } else //Invalid target, skip resurrection. break; case ALL_RESURRECTION: if(sd && (map_flag_gvg(bl->m) || map[bl->m].flag.battleground)) { //No reviving in WoE grounds! - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } if (!status_isdead(bl)) @@ -4885,7 +4886,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (map[bl->m].flag.pvp && dstsd && dstsd->pvp_point < 0) break; - switch(skilllv){ + switch(skill_lv){ case 1: per=10; break; case 2: per=30; break; case 3: per=50; break; @@ -4895,7 +4896,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in per = sper = 100; if (status_revive(bl, per, sper)) { - clif_skill_nodamage(src,bl,ALL_RESURRECTION,skilllv,1); //Both Redemptio and Res show this skill-animation. + clif_skill_nodamage(src,bl,ALL_RESURRECTION,skill_lv,1); //Both Redemptio and Res show this skill-animation. if(sd && dstsd && battle_config.resurrection_exp > 0) { int exp = 0,jexp = 0; @@ -4917,17 +4918,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case AL_DECAGI: case MER_DECAGI: - clif_skill_nodamage (src, bl, skillid, skilllv, - sc_start(bl, type, (40 + skilllv * 2 + (status_get_lv(src) + sstatus->int_)/5), skilllv, skill_get_time(skillid,skilllv))); + clif_skill_nodamage (src, bl, skill_id, skill_lv, + sc_start(bl, type, (40 + skill_lv * 2 + (status_get_lv(src) + sstatus->int_)/5), skill_lv, skill_get_time(skill_id,skill_lv))); break; case AL_CRUCIS: if (flag&1) - sc_start(bl,type, 23+skilllv*4 +status_get_lv(src) -status_get_lv(bl), skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,type, 23+skill_lv*4 +status_get_lv(src) -status_get_lv(bl), skill_lv,skill_get_time(skill_id,skill_lv)); else { - map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid, skilllv), BL_CHAR, - src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id, skill_lv), BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; @@ -4936,41 +4937,41 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( tsce ) status_change_end(bl,type, INVALID_TIMER); else - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); - clif_skill_nodamage (src, bl, skillid, skilllv, 1); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + clif_skill_nodamage (src, bl, skill_id, skill_lv, 1); break; case SA_ABRACADABRA: { - int abra_skillid = 0, abra_skilllv; + int abra_skill_id = 0, abra_skill_lv; do { i = rnd() % MAX_SKILL_ABRA_DB; - abra_skillid = skill_abra_db[i].skillid; - } while (abra_skillid == 0 || - skill_abra_db[i].req_lv > skilllv || //Required lv for it to appear + abra_skill_id = skill_abra_db[i].skill_id; + } while (abra_skill_id == 0 || + skill_abra_db[i].req_lv > skill_lv || //Required lv for it to appear rnd()%10000 >= skill_abra_db[i].per ); - abra_skilllv = min(skilllv, skill_get_max(abra_skillid)); - clif_skill_nodamage (src, bl, skillid, skilllv, 1); + abra_skill_lv = min(skill_lv, skill_get_max(abra_skill_id)); + clif_skill_nodamage (src, bl, skill_id, skill_lv, 1); if( sd ) {// player-casted sd->state.abra_flag = 1; - sd->skillitem = abra_skillid; - sd->skillitemlv = abra_skilllv; - clif_item_skill(sd, abra_skillid, abra_skilllv); + sd->skillitem = abra_skill_id; + sd->skillitemlv = abra_skill_lv; + clif_item_skill(sd, abra_skill_id, abra_skill_lv); } else {// mob-casted struct unit_data *ud = unit_bl2ud(src); - int inf = skill_get_inf(abra_skillid); + int inf = skill_get_inf(abra_skill_id); int target_id = 0; if (!ud) break; if (inf&INF_SELF_SKILL || inf&INF_SUPPORT_SKILL) { if (src->type == BL_PET) bl = (struct block_list*)((TBL_PET*)src)->msd; if (!bl) bl = src; - unit_skilluse_id(src, bl->id, abra_skillid, abra_skilllv); + unit_skilluse_id(src, bl->id, abra_skill_id, abra_skill_lv); } else { //Assume offensive skills if (ud->target) target_id = ud->target; @@ -4980,23 +4981,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } if (!target_id) break; - if (skill_get_casttype(abra_skillid) == CAST_GROUND) { + if (skill_get_casttype(abra_skill_id) == CAST_GROUND) { bl = map_id2bl(target_id); if (!bl) bl = src; - unit_skilluse_pos(src, bl->x, bl->y, abra_skillid, abra_skilllv); + unit_skilluse_pos(src, bl->x, bl->y, abra_skill_id, abra_skill_lv); } else - unit_skilluse_id(src, target_id, abra_skillid, abra_skilllv); + unit_skilluse_id(src, target_id, abra_skill_id, abra_skill_lv); } } } break; case SA_COMA: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time2(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time2(skill_id,skill_lv))); break; case SA_FULLRECOVERY: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if (status_isimmune(bl)) break; status_percent_heal(bl, 100, 100); @@ -5016,20 +5017,20 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } break; case SA_SUMMONMONSTER: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if (sd) mob_once_spawn(sd, src->m, src->x, src->y," --ja--", -1, 1, "", SZ_SMALL, AI_NONE); break; case SA_LEVELUP: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if (sd && pc_nextbaseexp(sd)) pc_gainexp(sd, NULL, pc_nextbaseexp(sd) * 10 / 100, 0, false); break; case SA_INSTANTDEATH: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); status_set_hp(bl,1,0); break; case SA_QUESTION: case SA_GRAVITY: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case SA_CLASSCHANGE: case SA_MONOCELL: @@ -5038,11 +5039,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int class_; if ( sd && dstmd->status.mode&MD_BOSS ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - class_ = skillid==SA_MONOCELL?1002:mob_get_random_id(4, 1, 0); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + class_ = skill_id==SA_MONOCELL?1002:mob_get_random_id(4, 1, 0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); mob_class_change(dstmd,class_); if( tsc && dstmd->status.mode&MD_BOSS ) { @@ -5057,22 +5058,22 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SA_DEATH: if ( sd && dstmd && dstmd->status.mode&MD_BOSS ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); status_kill(bl); break; case SA_REVERSEORCISH: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid, skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id, skill_lv))); break; case SA_FORTUNE: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if(sd) pc_getzeny(sd,status_get_lv(bl)*100,LOG_TYPE_STEAL,NULL); break; case SA_TAMINGMONSTER: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if (sd && dstmd) { ARR_FIND( 0, MAX_PET_DB, i, dstmd->class_ == pet_db[i].class_ ); if( i < MAX_PET_DB ) @@ -5083,13 +5084,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case CR_PROVIDENCE: if(sd && dstsd){ //Check they are not another crusader [Skotlex] if ((dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 1; } } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; case CG_MARIONETTE: @@ -5098,7 +5099,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( sd && dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && dstsd->status.sex == sd->status.sex ) {// Cannot cast on another bard/dancer-type class of the same gender as caster - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 1; } @@ -5107,9 +5108,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { if( !sc->data[SC_MARIONETTE] && !tsc->data[SC_MARIONETTE2] ) { - sc_start(src,SC_MARIONETTE,100,bl->id,skill_get_time(skillid,skilllv)); - sc_start(bl,SC_MARIONETTE2,100,src->id,skill_get_time(skillid,skilllv)); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + sc_start(src,SC_MARIONETTE,100,bl->id,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_MARIONETTE2,100,src->id,skill_get_time(skill_id,skill_lv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } else if( sc->data[SC_MARIONETTE ] && sc->data[SC_MARIONETTE ]->val1 == bl->id && @@ -5121,7 +5122,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in else { if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 1; @@ -5131,8 +5132,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; case RG_CLOSECONFINE: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start4(bl,type,100,skilllv,src->id,0,0,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start4(bl,type,100,skill_lv,src->id,0,0,skill_get_time(skill_id,skill_lv))); break; case SA_FLAMELAUNCHER: // added failure chance and chance to break weapon if turned on [Valaris] case SA_FROSTWEAPON: @@ -5151,15 +5152,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in dstsd->sc.data[SC_ENCPOISON] )) ) { - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); - clif_skill_nodamage(src,bl,skillid,skilllv,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,0); break; } } // 100% success rate at lv4 & 5, but lasts longer at lv5 - if(!clif_skill_nodamage(src,bl,skillid,skilllv, sc_start(bl,type,(60+skilllv*10),skilllv, skill_get_time(skillid,skilllv)))) { + if(!clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,type,(60+skill_lv*10),skill_lv, skill_get_time(skill_id,skill_lv)))) { if (sd) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); if (skill_break_equip(bl, EQP_WEAPON, 10000, BCT_PARTY) && sd && sd != dstsd) clif_displaymessage(sd->fd, msg_txt(669)); } @@ -5167,21 +5168,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case PR_ASPERSIO: if (sd && dstmd) { - clif_skill_nodamage(src,bl,skillid,skilllv,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,0); break; } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; case ITEM_ENCHANTARMS: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start2(bl,type,100,skilllv, - skill_get_ele(skillid,skilllv), skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start2(bl,type,100,skill_lv, + skill_get_ele(skill_id,skill_lv), skill_get_time(skill_id,skill_lv))); break; case TK_SEVENWIND: - switch(skill_get_ele(skillid,skilllv)) { + switch(skill_get_ele(skill_id,skill_lv)) { case ELE_EARTH : type = SC_EARTHWEAPON; break; case ELE_WIND : type = SC_WINDWEAPON; break; case ELE_WATER : type = SC_WATERWEAPON; break; @@ -5190,31 +5191,31 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case ELE_DARK : type = SC_SHADOWWEAPON; break; case ELE_HOLY : type = SC_ASPERSIO; break; } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); - sc_start(bl,SC_SEVENWIND,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_SEVENWIND,100,skill_lv,skill_get_time(skill_id,skill_lv)); break; case PR_KYRIE: case MER_KYRIE: - clif_skill_nodamage(bl,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(bl,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; //Passive Magnum, should had been casted on yourself. case SM_MAGNUM: case MS_MAGNUM: skill_area_temp[1] = 0; - map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid, skilllv), BL_SKILL|BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); - clif_skill_nodamage (src,src,skillid,skilllv,1); + map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id, skill_lv), BL_SKILL|BL_CHAR, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); + clif_skill_nodamage (src,src,skill_id,skill_lv,1); // Initiate 10% of your damage becomes fire element. - sc_start4(src,SC_WATK_ELEMENT,100,3,20,0,0,skill_get_time2(skillid, skilllv)); + sc_start4(src,SC_WATK_ELEMENT,100,3,20,0,0,skill_get_time2(skill_id, skill_lv)); if( sd ) - skill_blockpc_start(sd, skillid, skill_get_time(skillid, skilllv)); + skill_blockpc_start(sd, skill_id, skill_get_time(skill_id, skill_lv)); else if( bl->type == BL_MER ) - skill_blockmerc_start((TBL_MER*)bl, skillid, skill_get_time(skillid, skilllv)); + skill_blockmerc_start((TBL_MER*)bl, skill_id, skill_get_time(skill_id, skill_lv)); break; case TK_JUMPKICK: @@ -5223,12 +5224,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { if( unit_movepos(src, bl->x, bl->y, 1, 1) ) { - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); clif_slide(src,bl->x,bl->y); } } else - clif_skill_fail(sd,skillid,USESKILL_FAIL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL,0); break; case AL_INCAGI: @@ -5236,7 +5237,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case MER_INCAGI: case MER_BLESSING: if (dstsd != NULL && tsc->data[SC_CHANGEUNDEAD]) { - skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag); + skill_attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); break; } case PR_SLOWPOISON: @@ -5306,33 +5307,33 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SR_GENTLETOUCH_ENERGYGAIN: case GN_CARTBOOST: case KO_MEIKYOUSISUI: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; case SO_STRIKING: if (sd) { - int bonus = 25 + 10 * skilllv; + int bonus = 25 + 10 * skill_lv; bonus += (pc_checkskill(sd, SA_FLAMELAUNCHER)+pc_checkskill(sd, SA_FROSTWEAPON)+pc_checkskill(sd, SA_LIGHTNINGLOADER)+pc_checkskill(sd, SA_SEISMICWEAPON))*5; - clif_skill_nodamage( src, bl, skillid, skilllv, + clif_skill_nodamage( src, bl, skill_id, skill_lv, battle_check_target(src,bl,BCT_PARTY) ? - sc_start2(bl, type, 100, skilllv, bonus, skill_get_time(skillid,skilllv)) : + sc_start2(bl, type, 100, skill_lv, bonus, skill_get_time(skill_id,skill_lv)) : 0 ); } break; case NPC_STOP: - if( clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start2(bl,type,100,skilllv,src->id,skill_get_time(skillid,skilllv)) ) ) - sc_start2(src,type,100,skilllv,bl->id,skill_get_time(skillid,skilllv)); + if( clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start2(bl,type,100,skill_lv,src->id,skill_get_time(skill_id,skill_lv)) ) ) + sc_start2(src,type,100,skill_lv,bl->id,skill_get_time(skill_id,skill_lv)); break; case HP_ASSUMPTIO: if( sd && dstmd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); else - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; case MG_SIGHT: case MER_SIGHT: @@ -5341,39 +5342,39 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_WIDESIGHT: case NPC_STONESKIN: case NPC_ANTIMAGIC: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start2(bl,type,100,skilllv,skillid,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start2(bl,type,100,skill_lv,skill_id,skill_get_time(skill_id,skill_lv))); break; case HLIF_AVOID: case HAMI_DEFENCE: - i = skill_get_time(skillid,skilllv); - clif_skill_nodamage(bl,bl,skillid,skilllv,sc_start(bl,type,100,skilllv,i)); // Master - clif_skill_nodamage(src,src,skillid,skilllv,sc_start(src,type,100,skilllv,i)); // Homunc + i = skill_get_time(skill_id,skill_lv); + clif_skill_nodamage(bl,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,i)); // Master + clif_skill_nodamage(src,src,skill_id,skill_lv,sc_start(src,type,100,skill_lv,i)); // Homunc break; case NJ_BUNSINJYUTSU: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); status_change_end(bl, SC_NEN, INVALID_TIMER); break; /* Was modified to only affect targetted char. [Skotlex] case HP_ASSUMPTIO: if (flag&1) - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); else { map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skillid, skilllv), BL_PC, - src, skillid, skilllv, tick, flag|BCT_ALL|1, + skill_get_splash(skill_id, skill_lv), BL_PC, + src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill_castend_nodamage_id); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; */ case SM_ENDURE: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); if (sd) - skill_blockpc_start (sd, skillid, skill_get_time2(skillid,skilllv)); + skill_blockpc_start (sd, skill_id, skill_get_time2(skill_id,skill_lv)); break; case AS_ENCHANTPOISON: // Prevent spamming [Valaris] @@ -5386,23 +5387,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in dstsd->sc.data[SC_GHOSTWEAPON] // dstsd->sc.data[SC_ENCPOISON] //People say you should be able to recast to lengthen the timer. [Skotlex] ) { - clif_skill_nodamage(src,bl,skillid,skilllv,0); - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; case LK_TENSIONRELAX: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start4(bl,type,100,skilllv,0,0,skill_get_time2(skillid,skilllv), - skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start4(bl,type,100,skill_lv,0,0,skill_get_time2(skill_id,skill_lv), + skill_get_time(skill_id,skill_lv))); break; case MC_CHANGECART: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case TK_MISSION: @@ -5410,28 +5411,28 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int id; if (sd->mission_mobid && (sd->mission_count || rnd()%100)) { //Cannot change target when already have one clif_mission_info(sd, sd->mission_mobid, sd->mission_count); - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } id = mob_get_random_id(0,0xF, sd->status.base_level); if (!id) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } sd->mission_mobid = id; sd->mission_count = 0; pc_setglobalreg(sd,"TK_MISSION_ID", id); clif_mission_info(sd, id, 0); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case AC_CONCENTRATION: { - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); map_foreachinrange( status_change_timer_sub, src, - skill_get_splash(skillid, skilllv), BL_CHAR, + skill_get_splash(skill_id, skill_lv), BL_CHAR, src,NULL,type,tick); } break; @@ -5445,12 +5446,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in return 1; } //TODO: How much does base level affects? Dummy value of 1% per level difference used. [Skotlex] - clif_skill_nodamage(src,bl,skillid == SM_SELFPROVOKE ? SM_PROVOKE : skillid,skilllv, - (i = sc_start(bl,type, skillid == SM_SELFPROVOKE ? 100:( 50 + 3*skilllv + status_get_lv(src) - status_get_lv(bl)), skilllv, skill_get_time(skillid,skilllv)))); + clif_skill_nodamage(src,bl,skill_id == SM_SELFPROVOKE ? SM_PROVOKE : skill_id,skill_lv, + (i = sc_start(bl,type, skill_id == SM_SELFPROVOKE ? 100:( 50 + 3*skill_lv + status_get_lv(src) - status_get_lv(bl)), skill_lv, skill_get_time(skill_id,skill_lv)))); if( !i ) { if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 0; } @@ -5468,7 +5469,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( dstmd ) { dstmd->state.provoke_flag = src->id; - mob_target(dstmd, src, skill_get_range2(src,skillid,skilllv)); + mob_target(dstmd, src, skill_get_range2(src,skill_id,skill_lv)); } break; @@ -5479,7 +5480,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( !dstsd || (!sd && !mer) ) { // Only players can be devoted if( sd ) - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; } @@ -5487,18 +5488,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in lv = -lv; if( lv > battle_config.devotion_level_difference || // Level difference requeriments (dstsd->sc.data[type] && dstsd->sc.data[type]->val1 != src->id) || // Cannot Devote a player devoted from another source - (skillid == ML_DEVOTION && (!mer || mer != dstsd->md)) || // Mercenary only can devote owner + (skill_id == ML_DEVOTION && (!mer || mer != dstsd->md)) || // Mercenary only can devote owner (dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER || // Crusader Cannot be devoted (dstsd->sc.data[SC_HELLPOWER])) // Players affected by SC_HELLPOWERR cannot be devoted. { if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 1; } i = 0; - count = (sd)? min(skilllv,5) : 1; // Mercenary only can Devote owner + count = (sd)? min(skill_lv,5) : 1; // Mercenary only can Devote owner if( sd ) { // Player Devoting Player ARR_FIND(0, count, i, sd->devotion[i] == bl->id ); @@ -5507,7 +5508,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in ARR_FIND(0, count, i, sd->devotion[i] == 0 ); if( i == count ) { // No free slots, skill Fail - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); map_freeblock_unlock(); return 1; } @@ -5518,19 +5519,19 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in else mer->devotion_flag = 1; // Mercenary Devoting Owner - clif_skill_nodamage(src, bl, skillid, skilllv, - sc_start4(bl, type, 100, src->id, i, skill_get_range2(src,skillid,skilllv),0, skill_get_time2(skillid, skilllv))); + clif_skill_nodamage(src, bl, skill_id, skill_lv, + sc_start4(bl, type, 100, src->id, i, skill_get_range2(src,skill_id,skill_lv),0, skill_get_time2(skill_id, skill_lv))); clif_devotion(src, NULL); } break; case MO_CALLSPIRITS: if(sd) { - int limit = skilllv; + int limit = skill_lv; if( sd->sc.data[SC_RAISINGDRAGON] ) limit += sd->sc.data[SC_RAISINGDRAGON]->val1; - clif_skill_nodamage(src,bl,skillid,skilllv,1); - pc_addspiritball(sd,skill_get_time(skillid,skilllv),limit); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + pc_addspiritball(sd,skill_get_time(skill_id,skill_lv),limit); } break; @@ -5539,23 +5540,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int limit = 5; if( sd->sc.data[SC_RAISINGDRAGON] ) limit += sd->sc.data[SC_RAISINGDRAGON]->val1; - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); for (i = 0; i < limit; i++) - pc_addspiritball(sd,skill_get_time(skillid,skilllv),limit); + pc_addspiritball(sd,skill_get_time(skill_id,skill_lv),limit); } break; case MO_KITRANSLATION: if(dstsd && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER) { - pc_addspiritball(dstsd,skill_get_time(skillid,skilllv),5); + pc_addspiritball(dstsd,skill_get_time(skill_id,skill_lv),5); } break; case TK_TURNKICK: case MO_BALKYOUNG: //Passive part of the attack. Splash knock-back+stun. [Skotlex] if (skill_area_temp[1] != bl->id) { - skill_blown(src,bl,skill_get_blewcount(skillid,skilllv),-1,0); - skill_additional_effect(src,bl,skillid,skilllv,BF_MISC,ATK_DEF,tick); //Use Misc rather than weapon to signal passive pushback + skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),-1,0); + skill_additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); //Use Misc rather than weapon to signal passive pushback } break; @@ -5571,40 +5572,40 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in mob_target(dstmd,src,0); } if (i) status_heal(src, 0, i, 3); - clif_skill_nodamage(src,bl,skillid,skilllv,i?1:0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,i?1:0); break; case AC_MAKINGARROW: if(sd) { clif_arrow_create_list(sd); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case AM_PHARMACY: if(sd) { - clif_skill_produce_mix_list(sd,skillid,22); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_produce_mix_list(sd,skill_id,22); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case SA_CREATECON: if(sd) { clif_elementalconverter_list(sd); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case BS_HAMMERFALL: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,SC_STUN,(20 + 10 * skilllv),skilllv,skill_get_time2(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,SC_STUN,(20 + 10 * skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv))); break; case RG_RAID: skill_area_temp[1] = 0; - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skillid, skilllv), splash_target(src), - src,skillid,skilllv,tick, flag|BCT_ENEMY|1, + skill_get_splash(skill_id, skill_lv), splash_target(src), + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); status_change_end(src, SC_HIDING, INVALID_TIMER); break; @@ -5619,21 +5620,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SR_HOWLINGOFLION: case KO_HAPPOKUNAI: skill_area_temp[1] = 0; - clif_skill_nodamage(src,bl,skillid,skilllv,1); - i = map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), - src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); - if( !i && ( skillid == NC_AXETORNADO || skillid == SR_SKYNETBLOW || skillid == KO_HAPPOKUNAI ) ) - clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + i = map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); + if( !i && ( skill_id == NC_AXETORNADO || skill_id == SR_SKYNETBLOW || skill_id == KO_HAPPOKUNAI ) ) + clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; case NC_EMERGENCYCOOL: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); status_change_end(src,SC_OVERHEAT_LIMITPOINT,INVALID_TIMER); status_change_end(src,SC_OVERHEAT,INVALID_TIMER); break; case SR_WINDMILL: case GN_CART_TORNADO: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); case SR_EARTHSHAKER: case NC_INFRAREDSCAN: case NPC_EARTHQUAKE: @@ -5641,32 +5642,32 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_HELLJUDGEMENT: case NPC_PULSESTRIKE: case LG_MOONSLASHER: - skill_castend_damage_id(src, src, skillid, skilllv, tick, flag); + skill_castend_damage_id(src, src, skill_id, skill_lv, tick, flag); break; case KN_BRANDISHSPEAR: case ML_BRANDISH: - skill_brandishspear(src, bl, skillid, skilllv, tick, flag); + skill_brandishspear(src, bl, skill_id, skill_lv, tick, flag); break; case WZ_SIGHTRASHER: //Passive side of the attack. status_change_end(src, SC_SIGHT, INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub,src, - skill_get_splash(skillid, skilllv),BL_CHAR|BL_SKILL, - src,skillid,skilllv,tick, flag|BCT_ENEMY|1, + skill_get_splash(skill_id, skill_lv),BL_CHAR|BL_SKILL, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); break; case NJ_HYOUSYOURAKU: case NJ_RAIGEKISAI: case WZ_FROSTNOVA: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); skill_area_temp[1] = 0; map_foreachinrange(skill_attack_area, src, - skill_get_splash(skillid, skilllv), splash_target(src), - BF_MAGIC, src, src, skillid, skilllv, tick, flag, BCT_ENEMY); + skill_get_splash(skill_id, skill_lv), splash_target(src), + BF_MAGIC, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY); break; case HVAN_EXPLOSION: //[orn] @@ -5675,11 +5676,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in //Except for Summoned Marine spheres on non-versus maps, where it's just enemy. i = ((!md || md->special_state.ai == 2) && !map_flag_vs(src->m))? BCT_ENEMY:BCT_ALL; - clif_skill_nodamage(src, src, skillid, -1, 1); + clif_skill_nodamage(src, src, skill_id, -1, 1); map_delblock(src); //Required to prevent chain-self-destructions hitting back. map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skillid, skilllv), splash_target(src), - src, skillid, skilllv, tick, flag|i, + skill_get_splash(skill_id, skill_lv), splash_target(src), + src, skill_id, skill_lv, tick, flag|i, skill_castend_damage_id); map_addblock(src); status_damage(src, src, sstatus->max_hp,0,0,1); @@ -5693,18 +5694,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case CASH_INCAGI: case CASH_ASSUMPTIO: if( sd == NULL || sd->status.party_id == 0 || (flag & 1) ) - clif_skill_nodamage(bl, bl, skillid, skilllv, sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); break; case MER_MAGNIFICAT: if( mer != NULL ) { - clif_skill_nodamage(bl, bl, skillid, skilllv, sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); if( mer->master && mer->master->status.party_id != 0 && !(flag&1) ) - party_foreachsamemap(skill_area_sub, mer->master, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, mer->master, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); else if( mer->master && !(flag&1) ) - clif_skill_nodamage(src, &mer->master->bl, skillid, skilllv, sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src, &mer->master->bl, skill_id, skill_lv, sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); } break; @@ -5713,12 +5714,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case BS_WEAPONPERFECT: case BS_OVERTHRUST: if (sd == NULL || sd->status.party_id == 0 || (flag & 1)) { - clif_skill_nodamage(bl,bl,skillid,skilllv, - sc_start2(bl,type,100,skilllv,(src == bl)? 1:0,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(bl,bl,skill_id,skill_lv, + sc_start2(bl,type,100,skill_lv,(src == bl)? 1:0,skill_get_time(skill_id,skill_lv))); } else if (sd) { party_foreachsamemap(skill_area_sub, - sd,skill_get_splash(skillid, skilllv), - src,skillid,skilllv,tick, flag|BCT_PARTY|1, + sd,skill_get_splash(skill_id, skill_lv), + src,skill_id,skill_lv,tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); } break; @@ -5739,11 +5740,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case GS_GATLINGFEVER: if( tsce ) { - clif_skill_nodamage(src,bl,skillid,skilllv,status_change_end(bl, type, INVALID_TIMER)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER)); map_freeblock_unlock(); return 0; } - clif_skill_nodamage(src,bl,skillid,skilllv,sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; case SL_KAITE: case SL_KAAHI: @@ -5757,46 +5758,46 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in dstsd->status.char_id == sd->status.partner_id || dstsd->status.char_id == sd->status.child )) { - status_change_start(src,SC_STUN,10000,skilllv,0,0,0,500,8); - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + status_change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,8); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid, skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id, skill_lv))); break; case SM_AUTOBERSERK: case MER_AUTOBERSERK: if( tsce ) i = status_change_end(bl, type, INVALID_TIMER); else - i = sc_start(bl,type,100,skilllv,60000); - clif_skill_nodamage(src,bl,skillid,skilllv,i); + i = sc_start(bl,type,100,skill_lv,60000); + clif_skill_nodamage(src,bl,skill_id,skill_lv,i); break; case TF_HIDING: case ST_CHASEWALK: case KO_YAMIKUMO: if (tsce) { - clif_skill_nodamage(src,bl,skillid,-1,status_change_end(bl, type, INVALID_TIMER)); //Hide skill-scream animation. + clif_skill_nodamage(src,bl,skill_id,-1,status_change_end(bl, type, INVALID_TIMER)); //Hide skill-scream animation. map_freeblock_unlock(); return 0; } else if( tsc && tsc->option&OPTION_MADOGEAR ) { //Mado Gear cannot hide - if( sd ) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if( sd ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 0; } - clif_skill_nodamage(src,bl,skillid,-1,sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,-1,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; case TK_RUN: if (tsce) { - clif_skill_nodamage(src,bl,skillid,skilllv,status_change_end(bl, type, INVALID_TIMER)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER)); map_freeblock_unlock(); return 0; } - clif_skill_nodamage(src,bl,skillid,skilllv,sc_start4(bl,type,100,skilllv,unit_getdir(bl),0,0,0)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start4(bl,type,100,skill_lv,unit_getdir(bl),0,0,0)); if (sd) // If the client receives a skill-use packet inmediately before a walkok packet, it will discard the walk packet! [Skotlex] clif_walkok(sd); // So aegis has to resend the walk ok. break; @@ -5808,69 +5809,69 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (tsce) { i = status_change_end(bl, type, INVALID_TIMER); if( i ) - clif_skill_nodamage(src,bl,skillid,( skillid == LG_FORCEOFVANGUARD ) ? skilllv : -1,i); + clif_skill_nodamage(src,bl,skill_id,( skill_id == LG_FORCEOFVANGUARD ) ? skill_lv : -1,i); else if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 0; } case RA_CAMOUFLAGE: - i = sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + i = sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); if( i ) - clif_skill_nodamage(src,bl,skillid,( skillid == LG_FORCEOFVANGUARD ) ? skilllv : -1,i); + clif_skill_nodamage(src,bl,skill_id,( skill_id == LG_FORCEOFVANGUARD ) ? skill_lv : -1,i); else if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; case BD_ADAPTATION: if(tsc && tsc->data[SC_DANCING]){ - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); status_change_end(bl, SC_DANCING, INVALID_TIMER); } break; case BA_FROSTJOKER: case DC_SCREAM: - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_addtimerskill(src,tick+2000,bl->id,src->x,src->y,skillid,skilllv,0,flag); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + skill_addtimerskill(src,tick+2000,bl->id,src->x,src->y,skill_id,skill_lv,0,flag); if (md) { // 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_db[skillid].desc); + snprintf(temp, sizeof(temp), "%s : %s !!",md->name,skill_db[skill_id].desc); clif_message(&md->bl,temp); } break; case BA_PANGVOICE: - clif_skill_nodamage(src,bl,skillid,skilllv, sc_start(bl,SC_CONFUSION,50,7,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,SC_CONFUSION,50,7,skill_get_time(skill_id,skill_lv))); break; case DC_WINKCHARM: if( dstsd ) - clif_skill_nodamage(src,bl,skillid,skilllv, sc_start(bl,SC_CONFUSION,30,7,skill_get_time2(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,SC_CONFUSION,30,7,skill_get_time2(skill_id,skill_lv))); else if( dstmd ) { if( status_get_lv(src) > status_get_lv(bl) && (tstatus->race == RC_DEMON || tstatus->race == RC_DEMIHUMAN || tstatus->race == RC_ANGEL) && !(tstatus->mode&MD_BOSS) ) - clif_skill_nodamage(src,bl,skillid,skilllv, sc_start2(bl,type,70,skilllv,src->id,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, sc_start2(bl,type,70,skill_lv,src->id,skill_get_time(skill_id,skill_lv))); else { - clif_skill_nodamage(src,bl,skillid,skilllv,0); - if(sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,0); + if(sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } } break; case TF_STEAL: if(sd) { - if(pc_steal_item(sd,bl,skilllv)) - clif_skill_nodamage(src,bl,skillid,skilllv,1); + if(pc_steal_item(sd,bl,skill_lv)) + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); else - clif_skill_fail(sd,skillid,USESKILL_FAIL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL,0); } break; @@ -5879,12 +5880,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if(pc_steal_coin(sd,bl)) { dstmd->state.provoke_flag = src->id; - mob_target(dstmd, src, skill_get_range2(src,skillid,skilllv)); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + mob_target(dstmd, src, skill_get_range2(src,skill_id,skill_lv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } else - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; @@ -5892,7 +5893,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { int brate = 0; if (tstatus->mode&MD_BOSS) { - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } if(status_isimmune(bl) || !tsc) @@ -5903,17 +5904,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (tsc->data[SC_STONE]) { status_change_end(bl, SC_STONE, INVALID_TIMER); - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - if (sc_start4(bl,SC_STONE,(skilllv*4+20)+brate, - skilllv, 0, 0, skill_get_time(skillid, skilllv), - skill_get_time2(skillid,skilllv))) - clif_skill_nodamage(src,bl,skillid,skilllv,1); + if (sc_start4(bl,SC_STONE,(skill_lv*4+20)+brate, + skill_lv, 0, 0, skill_get_time(skill_id, skill_lv), + skill_get_time2(skill_id,skill_lv))) + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); else if(sd) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); // Level 6-10 doesn't consume a red gem if it fails [celest] - if (skilllv > 5) + if (skill_lv > 5) { // not to consume items map_freeblock_unlock(); return 0; @@ -5923,30 +5924,30 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; case NV_FIRSTAID: - clif_skill_nodamage(src,bl,skillid,5,1); + clif_skill_nodamage(src,bl,skill_id,5,1); status_heal(bl,5,0,0); break; case AL_CURE: if(status_isimmune(bl)) { - clif_skill_nodamage(src,bl,skillid,skilllv,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,0); break; } status_change_end(bl, SC_SILENCE, INVALID_TIMER); status_change_end(bl, SC_BLIND, INVALID_TIMER); status_change_end(bl, SC_CONFUSION, INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case TF_DETOXIFY: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); status_change_end(bl, SC_POISON, INVALID_TIMER); status_change_end(bl, SC_DPOISON, INVALID_TIMER); break; case PR_STRECOVERY: if(status_isimmune(bl)) { - clif_skill_nodamage(src,bl,skillid,skilllv,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,0); break; } if (tsc && tsc->opt1) { @@ -5962,9 +5963,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in status_change_start(bl, SC_BLIND, 100*(100-(tstatus->int_/2+tstatus->vit/3+tstatus->luk/10)), 1,0,0,0, - skill_get_time2(skillid, skilllv) * (100-(tstatus->int_+tstatus->vit)/2)/100,0); + skill_get_time2(skill_id, skill_lv) * (100-(tstatus->int_+tstatus->vit)/2)/100,0); } - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if(dstmd) mob_unlocktarget(dstmd,tick); break; @@ -5973,30 +5974,30 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case MER_BENEDICTION: status_change_end(bl, SC_CURSE, INVALID_TIMER); status_change_end(bl, SC_BLIND, INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case MER_COMPRESS: status_change_end(bl, SC_BLEEDING, INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case MER_MENTALCURE: status_change_end(bl, SC_CONFUSION, INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case MER_RECUPERATE: status_change_end(bl, SC_POISON, INVALID_TIMER); status_change_end(bl, SC_SILENCE, INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case MER_REGAIN: status_change_end(bl, SC_SLEEP, INVALID_TIMER); status_change_end(bl, SC_STUN, INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case MER_TENDER: status_change_end(bl, SC_FREEZE, INVALID_TIMER); status_change_end(bl, SC_STONE, INVALID_TIMER); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case MER_SCAPEGOAT: @@ -6016,21 +6017,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; if( dstsd ) { // Fail on Players - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } if( dstmd && dstmd->class_ == MOBID_EMPERIUM ) break; // Cannot be Used on Emperium - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); clif_skill_estimation(sd, bl); - if( skillid == MER_ESTIMATION ) + if( skill_id == MER_ESTIMATION ) sd = NULL; break; case BS_REPAIRWEAPON: if(sd && dstsd) - clif_item_repair_list(sd,dstsd,skilllv); + clif_item_repair_list(sd,dstsd,skill_lv); break; case MC_IDENTIFY: @@ -6048,10 +6049,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if(sd) { //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex] if ( !pc_can_give_items(sd) ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); else { sd->state.prevend = 1; - clif_openvendingreq(sd,2+skilllv); + clif_openvendingreq(sd,2+skill_lv); } } break; @@ -6059,45 +6060,45 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case AL_TELEPORT: if(sd) { - if (map[bl->m].flag.noteleport && skilllv <= 2) { + if (map[bl->m].flag.noteleport && skill_lv <= 2) { clif_skill_teleportmessage(sd,0); break; } - if(!battle_config.duel_allow_teleport && sd->duel_group && skilllv <= 2) { // duel restriction [LuzZza] + if(!battle_config.duel_allow_teleport && sd->duel_group && skill_lv <= 2) { // duel restriction [LuzZza] char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_TELEPORT)); clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel." break; } - if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skilllv == 1 ) || skilllv == 3 ) + if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1 ) || skill_lv == 3 ) { - if( skilllv == 1 ) + if( skill_lv == 1 ) pc_randomwarp(sd,CLR_TELEPORT); else pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); break; } - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if( skilllv == 1 ) - clif_skill_warppoint(sd,skillid,skilllv, (unsigned short)-1,0,0,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + if( skill_lv == 1 ) + clif_skill_warppoint(sd,skill_id,skill_lv, (unsigned short)-1,0,0,0); else - clif_skill_warppoint(sd,skillid,skilllv, (unsigned short)-1,sd->status.save_point.map,0,0); + clif_skill_warppoint(sd,skill_id,skill_lv, (unsigned short)-1,sd->status.save_point.map,0,0); } else unit_warp(bl,-1,-1,-1,CLR_TELEPORT); break; case NPC_EXPULSION: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); unit_warp(bl,-1,-1,-1,CLR_TELEPORT); break; case AL_HOLYWATER: if(sd) { - if (skill_produce_mix(sd, skillid, 523, 0, 0, 0, 1)) - clif_skill_nodamage(src,bl,skillid,skilllv,1); + if (skill_produce_mix(sd, skill_id, 523, 0, 0, 0, 1)) + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); else - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; @@ -6106,7 +6107,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int eflag; struct item item_tmp; struct block_list tbl; - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); memset(&item_tmp,0,sizeof(item_tmp)); memset(&tbl,0,sizeof(tbl)); // [MouseJstr] item_tmp.nameid = ITEMID_STONE; @@ -6122,8 +6123,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; case ASC_CDP: if(sd) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_produce_mix(sd, skillid, 678, 0, 0, 0, 1); //Produce a Deadly Poison Bottle. + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + skill_produce_mix(sd, skill_id, 678, 0, 0, 0, 1); //Produce a Deadly Poison Bottle. } break; @@ -6138,29 +6139,29 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int d = 0; //Rate in percent - if ( skillid == ST_FULLSTRIP ) { - i = 5 + 2*skilllv + (sstatus->dex - tstatus->dex)/5; - } else if( skillid == SC_STRIPACCESSARY ) { - i = 12 + 2 * skilllv + (sstatus->dex - tstatus->dex)/5; + if ( skill_id == ST_FULLSTRIP ) { + i = 5 + 2*skill_lv + (sstatus->dex - tstatus->dex)/5; + } else if( skill_id == SC_STRIPACCESSARY ) { + i = 12 + 2 * skill_lv + (sstatus->dex - tstatus->dex)/5; } else { - i = 5 + 5*skilllv + (sstatus->dex - tstatus->dex)/5; + i = 5 + 5*skill_lv + (sstatus->dex - tstatus->dex)/5; } if (i < 5) i = 5; //Minimum rate 5% //Duration in ms - if( skillid == GC_WEAPONCRUSH){ - d = skill_get_time(skillid,skilllv); + if( skill_id == GC_WEAPONCRUSH){ + d = skill_get_time(skill_id,skill_lv); if(bl->type == BL_PC) - d += skilllv * 15 + (sstatus->dex - tstatus->dex); + d += skill_lv * 15 + (sstatus->dex - tstatus->dex); else - d += skilllv * 30 + (sstatus->dex - tstatus->dex) / 2; + d += skill_lv * 30 + (sstatus->dex - tstatus->dex) / 2; }else - d = skill_get_time(skillid,skilllv) + (sstatus->dex - tstatus->dex)*500; + d = skill_get_time(skill_id,skill_lv) + (sstatus->dex - tstatus->dex)*500; if (d < 0) d = 0; //Minimum duration 0ms - switch (skillid) { + switch (skill_id) { case RG_STRIPWEAPON: case GC_WEAPONCRUSH: location = EQP_WEAPON; @@ -6183,19 +6184,19 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } //Special message when trying to use strip on FCP [Jobbie] - if( sd && skillid == ST_FULLSTRIP && tsc && tsc->data[SC_CP_WEAPON] && tsc->data[SC_CP_HELM] && tsc->data[SC_CP_ARMOR] && tsc->data[SC_CP_SHIELD]) + if( sd && skill_id == ST_FULLSTRIP && tsc && tsc->data[SC_CP_WEAPON] && tsc->data[SC_CP_HELM] && tsc->data[SC_CP_ARMOR] && tsc->data[SC_CP_SHIELD]) { clif_gospel_info(sd, 0x28); break; } //Attempts to strip at rate i and duration d - if( (i = skill_strip_equip(bl, location, i, skilllv, d)) || (skillid != ST_FULLSTRIP && skillid != GC_WEAPONCRUSH ) ) - clif_skill_nodamage(src,bl,skillid,skilllv,i); + if( (i = skill_strip_equip(bl, location, i, skill_lv, d)) || (skill_id != ST_FULLSTRIP && skill_id != GC_WEAPONCRUSH ) ) + clif_skill_nodamage(src,bl,skill_id,skill_lv,i); //Nothing stripped. if( sd && !i ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } @@ -6207,21 +6208,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in return 1; } if( sd ) { - x = skilllv%11 - 1; - i = pc_search_inventory(sd,skill_db[skillid].itemid[x]); - if( i < 0 || skill_db[skillid].itemid[x] <= 0 ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + x = skill_lv%11 - 1; + i = pc_search_inventory(sd,skill_db[skill_id].itemid[x]); + if( i < 0 || skill_db[skill_id].itemid[x] <= 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_db[skillid].amount[x]) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if(sd->inventory_data[i] == NULL || sd->status.inventory[i].amount < skill_db[skill_id].amount[x]) { + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 1; } - if( skillid == AM_BERSERKPITCHER ) { + if( skill_id == AM_BERSERKPITCHER ) { if( dstsd && dstsd->status.base_level < (unsigned int)sd->inventory_data[i]->elv ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 1; } @@ -6260,17 +6261,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in sp += sp * sd->itemgrouphealrate[IG_POTION] / 100; } - if( (i = pc_skillheal_bonus(sd, skillid)) ) { + if( (i = pc_skillheal_bonus(sd, skill_id)) ) { hp += hp * i / 100; sp += sp * i / 100; } } else { - hp = (1 + rnd()%400) * (100 + skilllv*10) / 100; + hp = (1 + rnd()%400) * (100 + skill_lv*10) / 100; hp = hp * (100 + (tstatus->vit<<1)) / 100; if( dstsd ) hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10) / 100; } - if( dstsd && (i = pc_skillheal2_bonus(dstsd, skillid)) ) { + if( dstsd && (i = pc_skillheal2_bonus(dstsd, skill_id)) ) { hp += hp * i / 100; sp += sp * i / 100; } @@ -6288,8 +6289,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in sp += sp / 10; } } - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if( hp > 0 || (skillid == AM_POTIONPITCHER && sp <= 0) ) + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + if( hp > 0 || (skill_id == AM_POTIONPITCHER && sp <= 0) ) clif_skill_nodamage(NULL,bl,AL_HEAL,hp,1); if( sp > 0 ) clif_skill_nodamage(NULL,bl,MG_SRECOVERY,sp,1); @@ -6307,30 +6308,30 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { unsigned int equip[] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP}; - if( sd && ( bl->type != BL_PC || ( dstsd && pc_checkequip(dstsd,equip[skillid - AM_CP_WEAPON]) < 0 ) ) ){ - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if( sd && ( bl->type != BL_PC || ( dstsd && pc_checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ){ + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); // Don't consume item requirements return 0; } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); } break; case AM_TWILIGHT1: if (sd) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); //Prepare 200 White Potions. - if (!skill_produce_mix(sd, skillid, 504, 0, 0, 0, 200)) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (!skill_produce_mix(sd, skill_id, 504, 0, 0, 0, 200)) + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; case AM_TWILIGHT2: if (sd) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); //Prepare 200 Slim White Potions. - if (!skill_produce_mix(sd, skillid, 547, 0, 0, 0, 200)) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (!skill_produce_mix(sd, skill_id, 547, 0, 0, 0, 200)) + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; case AM_TWILIGHT3: @@ -6344,26 +6345,26 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in || !skill_can_produce_mix(sd,7135,-1, 50) //50 Flame Bottle || ebottle < 200 //200 empty bottle are required at total. ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_produce_mix(sd, skillid, 970, 0, 0, 0, 100); - skill_produce_mix(sd, skillid, 7136, 0, 0, 0, 50); - skill_produce_mix(sd, skillid, 7135, 0, 0, 0, 50); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + skill_produce_mix(sd, skill_id, 970, 0, 0, 0, 100); + skill_produce_mix(sd, skill_id, 7136, 0, 0, 0, 50); + skill_produce_mix(sd, skill_id, 7135, 0, 0, 0, 50); } break; case SA_DISPELL: - if (flag&1 || (i = skill_get_splash(skillid, skilllv)) < 1) + if (flag&1 || (i = skill_get_splash(skill_id, skill_lv)) < 1) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) || (tsc && tsc->data[SC_SPIRIT] && tsc->data[SC_SPIRIT]->val2 == SL_ROGUE) //Rogue's spirit defends againt dispel. - || rnd()%100 >= 50+10*skilllv + || rnd()%100 >= 50+10*skill_lv || ( tsc && tsc->option&OPTION_MADOGEAR ) )//Mado Gear is immune to dispell according to bug report 49 [Ind] { if (sd) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } if(status_isimmune(bl) || !tsc || !tsc->count) @@ -6445,13 +6446,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } //Affect all targets on splash area. map_foreachinrange(skill_area_sub, bl, i, BL_CHAR, - src, skillid, skilllv, tick, flag|1, + src, skill_id, skill_lv, tick, flag|1, skill_castend_damage_id); break; case TF_BACKSLIDING: //This is the correct implementation as per packet logging information. [Skotlex] - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_blown(src,bl,skill_get_blewcount(skillid,skilllv),unit_getdir(bl),0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),unit_getdir(bl),0); break; case TK_HIGHJUMP: @@ -6465,11 +6466,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in x = src->x; y = src->y; } else { - x = src->x + dirx[dir]*skilllv*2; - y = src->y + diry[dir]*skilllv*2; + x = src->x + dirx[dir]*skill_lv*2; + y = src->y + diry[dir]*skill_lv*2; } - clif_skill_nodamage(src,bl,TK_HIGHJUMP,skilllv,1); + clif_skill_nodamage(src,bl,TK_HIGHJUMP,skill_lv,1); if(!map_count_oncell(src->m,x,y,BL_PC|BL_NPC|BL_MOB) && map_getcell(src->m,x,y,CELL_CHKREACH)) { clif_slide(src,x,y); unit_movepos(src, x, y, 1, 0); @@ -6479,16 +6480,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SA_CASTCANCEL: case SO_SPELLFIST: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); unit_skillcastcancel(src,1); if(sd) { - int sp = skill_get_sp(sd->skillid_old,sd->skilllv_old); - if( skillid == SO_SPELLFIST ){ - sc_start4(src,type,100,skilllv+1,skilllv,sd->skillid_old,sd->skilllv_old,skill_get_time(skillid,skilllv)); - sd->skillid_old = sd->skilllv_old = 0; + int sp = skill_get_sp(sd->skill_id_old,sd->skill_lv_old); + if( skill_id == SO_SPELLFIST ){ + sc_start4(src,type,100,skill_lv+1,skill_lv,sd->skill_id_old,sd->skill_lv_old,skill_get_time(skill_id,skill_lv)); + sd->skill_id_old = sd->skill_lv_old = 0; break; } - sp = sp * (90 - (skilllv-1)*20) / 100; + sp = sp * (90 - (skill_lv-1)*20) / 100; if(sp < 0) sp = 0; status_zap(src, 0, sp); } @@ -6497,40 +6498,40 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { int sp; if(tsc && tsc->data[SC_MAGICROD]) { - sp = skill_get_sp(skillid,skilllv); + sp = skill_get_sp(skill_id,skill_lv); sp = sp * tsc->data[SC_MAGICROD]->val2 / 100; if(sp < 1) sp = 1; status_heal(bl,0,sp,2); status_percent_damage(bl, src, 0, -20, false); //20% max SP damage. } else { struct unit_data *ud = unit_bl2ud(bl); - int bl_skillid=0,bl_skilllv=0,hp = 0; + int bl_skill_id=0,bl_skill_lv=0,hp = 0; if (!ud || ud->skilltimer == INVALID_TIMER) break; //Nothing to cancel. - bl_skillid = ud->skillid; - bl_skilllv = ud->skilllv; + bl_skill_id = ud->skill_id; + bl_skill_lv = ud->skill_lv; if (tstatus->mode & MD_BOSS) { //Only 10% success chance against bosses. [Skotlex] if (rnd()%100 < 90) { - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } } else if (!dstsd || map_flag_vs(bl->m)) //HP damage only on pvp-maps when against players. hp = tstatus->max_hp/50; //Recover 2% HP [Skotlex] - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); unit_skillcastcancel(bl,0); - sp = skill_get_sp(bl_skillid,bl_skilllv); + sp = skill_get_sp(bl_skill_id,bl_skill_lv); status_zap(bl, hp, sp); - if (hp && skilllv >= 5) + if (hp && skill_lv >= 5) hp>>=1; //Recover half damaged HP at level 5 [Skotlex] else hp = 0; if (sp) //Recover some of the SP used - sp = sp*(25*(skilllv-1))/100; + sp = sp*(25*(skill_lv-1))/100; if(hp || sp) status_heal(src, hp, sp, 2); @@ -6538,51 +6539,51 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } break; case SA_MAGICROD: - clif_skill_nodamage(src,src,SA_MAGICROD,skilllv,1); - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + clif_skill_nodamage(src,src,SA_MAGICROD,skill_lv,1); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); break; case SA_AUTOSPELL: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if(sd) - clif_autospell(sd,skilllv); + clif_autospell(sd,skill_lv); else { int maxlv=1,spellid=0; static const int spellarray[3] = { MG_COLDBOLT,MG_FIREBOLT,MG_LIGHTNINGBOLT }; - if(skilllv >= 10) { + if(skill_lv >= 10) { spellid = MG_FROSTDIVER; // if (tsc && tsc->data[SC_SPIRIT] && tsc->data[SC_SPIRIT]->val2 == SA_SAGE) // maxlv = 10; // else - maxlv = skilllv - 9; + maxlv = skill_lv - 9; } - else if(skilllv >=8) { + else if(skill_lv >=8) { spellid = MG_FIREBALL; - maxlv = skilllv - 7; + maxlv = skill_lv - 7; } - else if(skilllv >=5) { + else if(skill_lv >=5) { spellid = MG_SOULSTRIKE; - maxlv = skilllv - 4; + maxlv = skill_lv - 4; } - else if(skilllv >=2) { + else if(skill_lv >=2) { int i = rnd()%3; spellid = spellarray[i]; - maxlv = skilllv - 1; + maxlv = skill_lv - 1; } - else if(skilllv > 0) { + else if(skill_lv > 0) { spellid = MG_NAPALMBEAT; maxlv = 3; } if(spellid > 0) - sc_start4(src,SC_AUTOSPELL,100,skilllv,spellid,maxlv,0, - skill_get_time(SA_AUTOSPELL,skilllv)); + sc_start4(src,SC_AUTOSPELL,100,skill_lv,spellid,maxlv,0, + skill_get_time(SA_AUTOSPELL,skill_lv)); } break; case BS_GREED: if(sd){ - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_greed,bl, - skill_get_splash(skillid, skilllv),BL_ITEM,bl); + skill_get_splash(skill_id, skill_lv),BL_ITEM,bl); } break; @@ -6603,31 +6604,31 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_CHANGEHOLY: case NPC_CHANGEDARKNESS: case NPC_CHANGETELEKINESIS: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start2(bl, type, 100, skilllv, skill_get_ele(skillid,skilllv), - skill_get_time(skillid, skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start2(bl, type, 100, skill_lv, skill_get_ele(skill_id,skill_lv), + skill_get_time(skill_id, skill_lv))); break; case NPC_CHANGEUNDEAD: //This skill should fail if target is wearing bathory/evil druid card [Brainstorm] //TO-DO This is ugly, fix it if(tstatus->def_ele==ELE_UNDEAD || tstatus->def_ele==ELE_DARK) break; - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start2(bl, type, 100, skilllv, skill_get_ele(skillid,skilllv), - skill_get_time(skillid, skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start2(bl, type, 100, skill_lv, skill_get_ele(skill_id,skill_lv), + skill_get_time(skill_id, skill_lv))); break; case NPC_PROVOCATION: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if (md) mob_unlocktarget(md, tick); break; case NPC_KEEPING: case NPC_BARRIER: { - int skill_time = skill_get_time(skillid,skilllv); + int skill_time = skill_get_time(skill_id,skill_lv); struct unit_data *ud = unit_bl2ud(bl); - if (clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_time)) + if (clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_time)) && ud) { //Disable attacking/acting/moving for skill's duration. ud->attackabletime = ud->canact_tick = @@ -6639,29 +6640,29 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_REBIRTH: if( md && md->state.rebirth ) break; // only works once - sc_start(bl,type,100,skilllv,-1); + sc_start(bl,type,100,skill_lv,-1); break; case NPC_DARKBLESSING: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start2(bl,type,(50+skilllv*5),skilllv,skilllv,skill_get_time2(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start2(bl,type,(50+skill_lv*5),skill_lv,skill_lv,skill_get_time2(skill_id,skill_lv))); break; case NPC_LICK: status_zap(bl, 0, 100); - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,(skilllv*5),skilllv,skill_get_time2(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,(skill_lv*5),skill_lv,skill_get_time2(skill_id,skill_lv))); break; case NPC_SUICIDE: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); status_kill(src); //When suiciding, neither exp nor drops is given. break; case NPC_SUMMONSLAVE: case NPC_SUMMONMONSTER: - if(md && md->skillidx >= 0) - mob_summonslave(md,md->db->skill[md->skillidx].val,skilllv,skillid); + if(md && md->skill_idx >= 0) + mob_summonslave(md,md->db->skill[md->skill_idx].val,skill_lv,skill_id); break; case NPC_CALLSLAVE: @@ -6678,11 +6679,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_SPEEDUP: { // or does it increase casting rate? just a guess xD - int i = SC_ASPDPOTION0 + skilllv - 1; + int i = SC_ASPDPOTION0 + skill_lv - 1; if (i > SC_ASPDPOTION3) i = SC_ASPDPOTION3; - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,(sc_type)i,100,skilllv,skilllv * 60000)); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,(sc_type)i,100,skill_lv,skill_lv * 60000)); } break; @@ -6701,20 +6702,20 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_RUN: { const int mask[8][2] = {{0,-1},{1,-1},{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1}}; - int dir = (bl == src)?unit_getdir(src):map_calc_dir(src,bl->x,bl->y); //If cast on self, run forward, else run away. + uint8 dir = (bl == src)?unit_getdir(src):map_calc_dir(src,bl->x,bl->y); //If cast on self, run forward, else run away. unit_stop_attack(src); //Run skillv tiles overriding the can-move check. - if (unit_walktoxy(src, src->x + skilllv * mask[dir][0], src->y + skilllv * mask[dir][1], 2) && md) + if (unit_walktoxy(src, src->x + skill_lv * mask[dir][0], src->y + skill_lv * mask[dir][1], 2) && md) md->state.skillstate = MSS_WALK; //Otherwise it isn't updated in the ai. } break; case NPC_TRANSFORMATION: case NPC_METAMORPHOSIS: - if(md && md->skillidx >= 0) { - int class_ = mob_random_class (md->db->skill[md->skillidx].val,0); - if (skilllv > 1) //Multiply the rest of mobs. [Skotlex] - mob_summonslave(md,md->db->skill[md->skillidx].val,skilllv-1,skillid); + if(md && md->skill_idx >= 0) { + int class_ = mob_random_class (md->db->skill[md->skill_idx].val,0); + if (skill_lv > 1) //Multiply the rest of mobs. [Skotlex] + mob_summonslave(md,md->db->skill[md->skill_idx].val,skill_lv-1,skill_id); if (class_) mob_class_change(md, class_); } break; @@ -6727,56 +6728,56 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in //val[2] adds to the current mode //val[3] removes from the current mode //val[4] if set, asks to delete the previous mode change. - if(md && md->skillidx >= 0 && tsc) + if(md && md->skill_idx >= 0 && tsc) { - clif_emotion(bl, md->db->skill[md->skillidx].val[0]); - if(md->db->skill[md->skillidx].val[4] && tsce) + clif_emotion(bl, md->db->skill[md->skill_idx].val[0]); + if(md->db->skill[md->skill_idx].val[4] && tsce) status_change_end(bl, type, INVALID_TIMER); - if(md->db->skill[md->skillidx].val[1] || md->db->skill[md->skillidx].val[2]) - sc_start4(src, type, 100, skilllv, - md->db->skill[md->skillidx].val[1], - md->db->skill[md->skillidx].val[2], - md->db->skill[md->skillidx].val[3], - skill_get_time(skillid, skilllv)); + if(md->db->skill[md->skill_idx].val[1] || md->db->skill[md->skill_idx].val[2]) + sc_start4(src, type, 100, skill_lv, + md->db->skill[md->skill_idx].val[1], + md->db->skill[md->skill_idx].val[2], + md->db->skill[md->skill_idx].val[3], + skill_get_time(skill_id, skill_lv)); } break; case NPC_POWERUP: - sc_start(bl,SC_INCATKRATE,100,200,skill_get_time(skillid, skilllv)); - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,100,skill_get_time(skillid, skilllv))); + sc_start(bl,SC_INCATKRATE,100,200,skill_get_time(skill_id, skill_lv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,100,skill_get_time(skill_id, skill_lv))); break; case NPC_AGIUP: - sc_start(bl,SC_SPEEDUP1,100,skilllv,skill_get_time(skillid, skilllv)); - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,100,skill_get_time(skillid, skilllv))); + sc_start(bl,SC_SPEEDUP1,100,skill_lv,skill_get_time(skill_id, skill_lv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,100,skill_get_time(skill_id, skill_lv))); break; case NPC_INVISIBLE: //Have val4 passed as 6 is for "infinite cloak" (do not end on attack/skill use). - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start4(bl,type,100,skilllv,0,0,6,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start4(bl,type,100,skill_lv,0,0,6,skill_get_time(skill_id,skill_lv))); break; case NPC_SIEGEMODE: // not sure what it does - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case WE_MALE: { - int hp_rate=(skilllv <= 0)? 0:skill_db[skillid].hp_rate[skilllv-1]; + int hp_rate=(skill_lv <= 0)? 0:skill_db[skill_id].hp_rate[skill_lv-1]; int gain_hp= tstatus->max_hp*abs(hp_rate)/100; // The earned is the same % of the target HP than it costed the caster. [Skotlex] - clif_skill_nodamage(src,bl,skillid,status_heal(bl, gain_hp, 0, 0),1); + clif_skill_nodamage(src,bl,skill_id,status_heal(bl, gain_hp, 0, 0),1); } break; case WE_FEMALE: { - int sp_rate=(skilllv <= 0)? 0:skill_db[skillid].sp_rate[skilllv-1]; + int sp_rate=(skill_lv <= 0)? 0:skill_db[skill_id].sp_rate[skill_lv-1]; int gain_sp=tstatus->max_sp*abs(sp_rate)/100;// The earned is the same % of the target SP than it costed the caster. [Skotlex] - clif_skill_nodamage(src,bl,skillid,status_heal(bl, 0, gain_sp, 0),1); + clif_skill_nodamage(src,bl,skill_id,status_heal(bl, 0, gain_sp, 0),1); } break; @@ -6787,13 +6788,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in struct map_session_data *m_sd = pc_get_mother(sd); // if neither was found if(!f_sd && !m_sd){ - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 0; } - status_change_start(bl,SC_STUN,10000,skilllv,0,0,0,skill_get_time2(skillid,skilllv),8); - if (f_sd) sc_start(&f_sd->bl,type,100,skilllv,skill_get_time(skillid,skilllv)); - if (m_sd) sc_start(&m_sd->bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + status_change_start(bl,SC_STUN,10000,skill_lv,0,0,0,skill_get_time2(skill_id,skill_lv),8); + if (f_sd) sc_start(&f_sd->bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + if (m_sd) sc_start(&m_sd->bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); } break; @@ -6801,12 +6802,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { int hp, sp; hp = sstatus->max_hp/10; - sp = hp * 10 * skilllv / 100; + sp = hp * 10 * skill_lv / 100; if (!status_charge(src,hp,0)) { - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); status_heal(bl,0,sp,2); } break; @@ -6822,7 +6823,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in // Players can only remove their own traps or traps on Vs maps. if( su && (sg = su->group) && (src->type == BL_MER || sg->src_id == src->id || map_flag_vs(bl->m)) && (skill_get_inf2(sg->skill_id)&INF2_TRAP) ) { - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); if( sd && !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) { // prevent picking up expired traps if( battle_config.skill_removetrap_type ) @@ -6859,12 +6860,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } skill_delunit(su); }else if(sd) - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); } break; case HT_SPRINGTRAP: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); { struct skill_unit *su=NULL; if((bl->type==BL_SKILL) && (su=(struct skill_unit *)bl) && (su->group) ){ @@ -6893,9 +6894,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } break; case BD_ENCORE: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if(sd) - unit_skilluse_id(src,src->id,sd->skillid_dance,sd->skilllv_dance); + unit_skilluse_id(src,src->id,sd->skill_id_dance,sd->skill_lv_dance); break; case AS_SPLASHER: @@ -6907,13 +6908,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in || tstatus-> hp > tstatus->max_hp*3/4 #endif ) { - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 1; } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start4(bl,type,100,skilllv,skillid,src->id,skill_get_time(skillid,skilllv),1000)); - if (sd) skill_blockpc_start (sd, skillid, skill_get_time(skillid, skilllv)+3000); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start4(bl,type,100,skill_lv,skill_id,src->id,skill_get_time(skill_id,skill_lv),1000)); + if (sd) skill_blockpc_start (sd, skill_id, skill_get_time(skill_id, skill_lv)+3000); break; case PF_MINDBREAKER: @@ -6931,11 +6932,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in return 1; } - //Has a 55% + skilllv*5% success chance. - if (!clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,55+5*skilllv,skilllv,skill_get_time(skillid,skilllv)))) + //Has a 55% + skill_lv*5% success chance. + if (!clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,55+5*skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)))) { - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 0; } @@ -6950,7 +6951,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } if(dstmd) - mob_target(dstmd,src,skill_get_range2(src,skillid,skilllv)); + mob_target(dstmd,src,skill_get_range2(src,skill_id,skill_lv)); } break; @@ -6959,13 +6960,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in unsigned int sp1 = 0, sp2 = 0; if (dstmd) { if (dstmd->state.soul_change_flag) { - if(sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if(sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } dstmd->state.soul_change_flag = 1; sp2 = sstatus->max_sp * 3 /100; status_heal(src, 0, sp2, 2); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; } sp1 = sstatus->sp; @@ -6978,7 +6979,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in #endif status_set_sp(src, sp2, 3); status_set_sp(bl, sp1, 3); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -6993,9 +6994,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in sp = sp * (100 + (tstatus->int_<<1))/100; if (dstsd) { if (hp) - hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10 + pc_skillheal2_bonus(dstsd, skillid))/100; + hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10 + pc_skillheal2_bonus(dstsd, skill_id))/100; if (sp) - sp = sp * (100 + pc_checkskill(dstsd,MG_SRECOVERY)*10 + pc_skillheal2_bonus(dstsd, skillid))/100; + sp = sp * (100 + pc_checkskill(dstsd,MG_SRECOVERY)*10 + pc_skillheal2_bonus(dstsd, skill_id))/100; } if( tsc && tsc->count ) { if (tsc->data[SC_CRITICALWOUND]) { @@ -7022,25 +7023,25 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case CR_FULLPROTECTION: { unsigned int equip[] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP}; - int i, s = 0, skilltime = skill_get_time(skillid,skilllv); + int i, s = 0, skilltime = skill_get_time(skill_id,skill_lv); for (i=0 ; i<4; i++) { if( bl->type != BL_PC || ( dstsd && pc_checkequip(dstsd,equip[i]) < 0 ) ) continue; - sc_start(bl,(sc_type)(SC_CP_WEAPON + i),100,skilllv,skilltime); + sc_start(bl,(sc_type)(SC_CP_WEAPON + i),100,skill_lv,skilltime); s++; } if( sd && !s ){ - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); // Don't consume item requirements return 0; } - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case RG_CLEANER: //AppleGirl - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case CG_LONGINGFREEDOM: @@ -7048,8 +7049,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (tsc && !tsce && (tsce=tsc->data[SC_DANCING]) && tsce->val4 && (tsce->val1&0xFFFF) != CG_MOONLIT) //Can't use Longing for Freedom while under Moonlight Petals. [Skotlex] { - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); } } break; @@ -7057,15 +7058,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case CG_TAROTCARD: { int eff, count = -1; - if( rnd() % 100 > skilllv * 8 || (dstmd && ((dstmd->guardian_data && dstmd->class_ == MOBID_EMPERIUM) || mob_is_battleground(dstmd))) ) + if( rnd() % 100 > skill_lv * 8 || (dstmd && ((dstmd->guardian_data && dstmd->class_ == MOBID_EMPERIUM) || mob_is_battleground(dstmd))) ) { if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 0; } - status_zap(src,0,skill_db[skill_get_index(skillid)].sp[skilllv]); // consume sp only if succeeded [Inkfish] + status_zap(src,0,skill_db[skill_get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded [Inkfish] do { eff = rnd() % 14; clif_specialeffect(bl, 523 + eff, AREA); @@ -7075,7 +7076,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in status_percent_damage(src, bl, 0, 100, false); break; case 1: // matk halved - sc_start(bl,SC_INCMATKRATE,100,-50,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_INCMATKRATE,100,-50,skill_get_time2(skill_id,skill_lv)); break; case 2: // all buffs removed status_change_clear_buffs(bl,1); @@ -7090,7 +7091,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } break; case 4: // atk halved - sc_start(bl,SC_INCATKRATE,100,-50,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_INCATKRATE,100,-50,skill_get_time2(skill_id,skill_lv)); break; case 5: // 2000HP heal, random teleported status_heal(src, 2000, 0, 0); @@ -7106,43 +7107,43 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case 7: // stop freeze or stoned { enum sc_type sc[] = { SC_STOP, SC_FREEZE, SC_STONE }; - sc_start(bl,sc[rnd()%3],100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,sc[rnd()%3],100,skill_lv,skill_get_time2(skill_id,skill_lv)); } break; case 8: // curse coma and poison - sc_start(bl,SC_COMA,100,skilllv,skill_get_time2(skillid,skilllv)); - sc_start(bl,SC_CURSE,100,skilllv,skill_get_time2(skillid,skilllv)); - sc_start(bl,SC_POISON,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_COMA,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_CURSE,100,skill_lv,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_POISON,100,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case 9: // confusion - sc_start(bl,SC_CONFUSION,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_CONFUSION,100,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case 10: // 6666 damage, atk matk halved, cursed status_fix_damage(src, bl, 6666, 0); clif_damage(src,bl,tick,0,0,6666,0,0,0); - sc_start(bl,SC_INCATKRATE,100,-50,skill_get_time2(skillid,skilllv)); - sc_start(bl,SC_INCMATKRATE,100,-50,skill_get_time2(skillid,skilllv)); - sc_start(bl,SC_CURSE,skilllv,100,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_INCATKRATE,100,-50,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCMATKRATE,100,-50,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_CURSE,skill_lv,100,skill_get_time2(skill_id,skill_lv)); break; case 11: // 4444 damage status_fix_damage(src, bl, 4444, 0); clif_damage(src,bl,tick,0,0,4444,0,0,0); break; case 12: // stun - sc_start(bl,SC_STUN,100,skilllv,5000); + sc_start(bl,SC_STUN,100,skill_lv,5000); break; case 13: // atk,matk,hit,flee,def reduced - sc_start(bl,SC_INCATKRATE,100,-20,skill_get_time2(skillid,skilllv)); - sc_start(bl,SC_INCMATKRATE,100,-20,skill_get_time2(skillid,skilllv)); - sc_start(bl,SC_INCHITRATE,100,-20,skill_get_time2(skillid,skilllv)); - sc_start(bl,SC_INCFLEERATE,100,-20,skill_get_time2(skillid,skilllv)); - sc_start(bl,SC_INCDEFRATE,100,-20,skill_get_time2(skillid,skilllv)); + sc_start(bl,SC_INCATKRATE,100,-20,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCMATKRATE,100,-20,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCHITRATE,100,-20,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCFLEERATE,100,-20,skill_get_time2(skill_id,skill_lv)); + sc_start(bl,SC_INCDEFRATE,100,-20,skill_get_time2(skill_id,skill_lv)); break; default: break; } } while ((--count) > 0); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -7163,77 +7164,77 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SL_WIZARD: //NOTE: here, 'type' has the value of the associated MAPID, not of the SC_SPIRIT constant. if (sd && !(dstsd && (dstsd->class_&MAPID_UPPERMASK) == type)) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - if (skillid == SL_SUPERNOVICE && dstsd && dstsd->die_counter && !(rnd()%100)) + if (skill_id == SL_SUPERNOVICE && dstsd && dstsd->die_counter && !(rnd()%100)) { //Erase death count 1% of the casts dstsd->die_counter = 0; pc_setglobalreg(dstsd,"PC_DIE_COUNTER", 0); clif_specialeffect(bl, 0x152, AREA); //SC_SPIRIT invokes status_calc_pc for us. } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start4(bl,SC_SPIRIT,100,skilllv,skillid,0,0,skill_get_time(skillid,skilllv))); - sc_start(src,SC_SMA,100,skilllv,skill_get_time(SL_SMA,skilllv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start4(bl,SC_SPIRIT,100,skill_lv,skill_id,0,0,skill_get_time(skill_id,skill_lv))); + sc_start(src,SC_SMA,100,skill_lv,skill_get_time(SL_SMA,skill_lv)); break; case SL_HIGH: if (sd && !(dstsd && (dstsd->class_&JOBL_UPPER) && !(dstsd->class_&JOBL_2) && dstsd->status.base_level < 70)) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start4(bl,type,100,skilllv,skillid,0,0,skill_get_time(skillid,skilllv))); - sc_start(src,SC_SMA,100,skilllv,skill_get_time(SL_SMA,skilllv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start4(bl,type,100,skill_lv,skill_id,0,0,skill_get_time(skill_id,skill_lv))); + sc_start(src,SC_SMA,100,skill_lv,skill_get_time(SL_SMA,skill_lv)); break; case SL_SWOO: if (tsce) { if(sd) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); - status_change_start(src,SC_STUN,10000,skilllv,0,0,0,10000,8); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + status_change_start(src,SC_STUN,10000,skill_lv,0,0,0,10000,8); status_change_end(bl, SC_SWOO, INVALID_TIMER); break; } case SL_SKA: // [marquis007] case SL_SKE: if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); - status_change_start(src,SC_STUN,10000,skilllv,0,0,0,500,10); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + status_change_start(src,SC_STUN,10000,skill_lv,0,0,0,500,10); break; } - clif_skill_nodamage(src,bl,skillid,skilllv,sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); - if (skillid == SL_SKE) - sc_start(src,SC_SMA,100,skilllv,skill_get_time(SL_SMA,skilllv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + if (skill_id == SL_SKE) + sc_start(src,SC_SMA,100,skill_lv,skill_get_time(SL_SMA,skill_lv)); break; // New guild skills [Celest] case GD_BATTLEORDER: if(flag&1) { if (status_get_guild_id(src) == status_get_guild_id(bl)) - sc_start(bl,type,100,skilllv,skill_get_time(skillid, skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id, skill_lv)); } else if (status_get_guild_id(src)) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, src, - skill_get_splash(skillid, skilllv), BL_PC, - src,skillid,skilllv,tick, flag|BCT_GUILD|1, + skill_get_splash(skill_id, skill_lv), BL_PC, + src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, skill_castend_nodamage_id); if (sd) - guild_block_skill(sd,skill_get_time2(skillid,skilllv)); + guild_block_skill(sd,skill_get_time2(skill_id,skill_lv)); } break; case GD_REGENERATION: if(flag&1) { if (status_get_guild_id(src) == status_get_guild_id(bl)) - sc_start(bl,type,100,skilllv,skill_get_time(skillid, skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id, skill_lv)); } else if (status_get_guild_id(src)) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, src, - skill_get_splash(skillid, skilllv), BL_PC, - src,skillid,skilllv,tick, flag|BCT_GUILD|1, + skill_get_splash(skill_id, skill_lv), BL_PC, + src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, skill_castend_nodamage_id); if (sd) - guild_block_skill(sd,skill_get_time2(skillid,skilllv)); + guild_block_skill(sd,skill_get_time2(skill_id,skill_lv)); } break; case GD_RESTORE: @@ -7241,13 +7242,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (status_get_guild_id(src) == status_get_guild_id(bl)) clif_skill_nodamage(src,bl,AL_HEAL,status_percent_heal(bl,90,90),1); } else if (status_get_guild_id(src)) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, src, - skill_get_splash(skillid, skilllv), BL_PC, - src,skillid,skilllv,tick, flag|BCT_GUILD|1, + skill_get_splash(skill_id, skill_lv), BL_PC, + src,skill_id,skill_lv,tick, flag|BCT_GUILD|1, skill_castend_nodamage_id); if (sd) - guild_block_skill(sd,skill_get_time2(skillid,skilllv)); + guild_block_skill(sd,skill_get_time2(skill_id,skill_lv)); } break; case GD_EMERGENCYCALL: @@ -7260,7 +7261,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in g = sd?sd->state.gmaster_flag:guild_search(status_get_guild_id(src)); if (!g) break; - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); for(i = 0; i < g->max_member; i++, j++) { if (j>8) j=0; if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) { @@ -7272,33 +7273,33 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } } if (sd) - guild_block_skill(sd,skill_get_time2(skillid,skilllv)); + guild_block_skill(sd,skill_get_time2(skill_id,skill_lv)); } break; case SG_FEEL: //AuronX reported you CAN memorize the same map as all three. [Skotlex] if (sd) { - if(!sd->feel_map[skilllv-1].index) - clif_feel_req(sd->fd,sd, skilllv); + if(!sd->feel_map[skill_lv-1].index) + clif_feel_req(sd->fd,sd, skill_lv); else - clif_feel_info(sd, skilllv-1, 1); + clif_feel_info(sd, skill_lv-1, 1); } break; case SG_HATE: if (sd) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if (!pc_set_hate_mob(sd, skilllv-1, bl)) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + if (!pc_set_hate_mob(sd, skill_lv-1, bl)) + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; case GS_GLITTERING: if(sd) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(rnd()%100 < (20+10*skilllv)) - pc_addspiritball(sd,skill_get_time(skillid,skilllv),10); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + if(rnd()%100 < (20+10*skill_lv)) + pc_addspiritball(sd,skill_get_time(skill_id,skill_lv),10); else if(sd->spiritball > 0) pc_delspiritball(sd,1,0); } @@ -7310,40 +7311,40 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { i =65 -5*distance_bl(src,bl); //Base rate if (i < 30) i = 30; - clif_skill_nodamage(src,bl,skillid,skilllv,1); - sc_start(bl,SC_STUN, i,skilllv,skill_get_time2(skillid,skilllv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + sc_start(bl,SC_STUN, i,skill_lv,skill_get_time2(skill_id,skill_lv)); } break; case AM_CALLHOMUN: //[orn] if (sd && !merc_call_homunculus(sd)) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; case AM_REST: if (sd) { if (merc_hom_vaporize(sd,1)) - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); else - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; case HAMI_CASTLE: //[orn] - if(rnd()%100 < 20*skilllv && src != bl) + if(rnd()%100 < 20*skill_lv && src != bl) { int x,y; x = src->x; y = src->y; if (hd) - skill_blockhomun_start(hd, skillid, skill_get_time2(skillid,skilllv)); + skill_blockhomun_start(hd, skill_id, skill_get_time2(skill_id,skill_lv)); if (unit_movepos(src,bl->x,bl->y,0,0)) { - clif_skill_nodamage(src,src,skillid,skilllv,1); // Homunc + clif_skill_nodamage(src,src,skill_id,skill_lv,1); // Homunc clif_slide(src,bl->x,bl->y) ; if (unit_movepos(bl,x,y,0,0)) { - clif_skill_nodamage(bl,bl,skillid,skilllv,1); // Master + clif_skill_nodamage(bl,bl,skill_id,skill_lv,1); // Master clif_slide(bl,x,y) ; } @@ -7354,15 +7355,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } // Failed else if (hd && hd->master) - clif_skill_fail(hd->master, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(hd->master, skill_id, USESKILL_FAIL_LEVEL, 0); else if (sd) - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; case HVAN_CHAOTIC: //[orn] { static const int per[5][2]={{20,50},{50,60},{25,75},{60,64},{34,67}}; int r = rnd()%100; - i = (skilllv-1)%5; + i = (skill_lv-1)%5; if(r<per[i][0]) //Self bl = src; else if(r<per[i][1]) //Master @@ -7371,10 +7372,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in bl = map_id2bl(battle_gettarget(src)); if (!bl) bl = src; - i = skill_calc_heal(src, bl, skillid, 1+rnd()%skilllv, true); + i = skill_calc_heal(src, bl, skill_id, 1+rnd()%skill_lv, true); //Eh? why double skill packet? clif_skill_nodamage(src,bl,AL_HEAL,i,1); - clif_skill_nodamage(src,bl,skillid,i,1); + clif_skill_nodamage(src,bl,skill_id,i,1); status_heal(bl, i, 0, 0); } break; @@ -7385,10 +7386,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case HLIF_CHANGE: case MH_ANGRIFFS_MODUS: case MH_GOLDENE_FERSE: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); if (hd) - skill_blockhomun_start(hd, skillid, skill_get_time2(skillid,skilllv)); + skill_blockhomun_start(hd, skill_id, skill_get_time2(skill_id,skill_lv)); break; case NPC_DRAGONFEAR: @@ -7396,7 +7397,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in const enum sc_type sc[] = { SC_STUN, SC_SILENCE, SC_CONFUSION, SC_BLEEDING }; int j; j = i = rnd()%ARRAYLENGTH(sc); - while ( !sc_start(bl,sc[i],100,skilllv,skill_get_time2(skillid,i+1)) ) { + while ( !sc_start(bl,sc[i],100,skill_lv,skill_get_time2(skill_id,i+1)) ) { i++; if ( i == ARRAYLENGTH(sc) ) i = 0; @@ -7416,25 +7417,25 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NPC_SLOWCAST: case NPC_WIDEHELLDIGNITY: if (flag&1) - sc_start(bl,type,100,skilllv,skill_get_time2(skillid,skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time2(skill_id,skill_lv)); else { skill_area_temp[2] = 0; //For SD_PREAMBLE - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skillid, skilllv),BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1, + skill_get_splash(skill_id, skill_lv),BL_CHAR, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1, skill_castend_nodamage_id); } break; case NPC_WIDESOULDRAIN: if (flag&1) - status_percent_damage(src,bl,0,((skilllv-1)%5+1)*20,false); + status_percent_damage(src,bl,0,((skill_lv-1)%5+1)*20,false); else { skill_area_temp[2] = 0; //For SD_PREAMBLE - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, bl, - skill_get_splash(skillid, skilllv),BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1, + skill_get_splash(skill_id, skill_lv),BL_CHAR, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1, skill_castend_nodamage_id); } break; @@ -7443,68 +7444,68 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { if( !sd->status.party_id ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); } else - clif_skill_nodamage(src,bl,skillid,skilllv,sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); break; case NPC_TALK: case ALL_WEWISH: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case ALL_BUYING_STORE: if( sd ) {// players only, skill allows 5 buying slots - clif_skill_nodamage(src, bl, skillid, skilllv, buyingstore_setup(sd, MAX_BUYINGSTORE_SLOTS)); + clif_skill_nodamage(src, bl, skill_id, skill_lv, buyingstore_setup(sd, MAX_BUYINGSTORE_SLOTS)); } break; case RK_ENCHANTBLADE: - clif_skill_nodamage(src,bl,skillid,skilllv,// formula not confirmed - sc_start2(bl,type,100,skilllv,100+20*skilllv/*+sstatus->int_/2+status_get_lv(bl)/10*/,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,// formula not confirmed + sc_start2(bl,type,100,skill_lv,100+20*skill_lv/*+sstatus->int_/2+status_get_lv(bl)/10*/,skill_get_time(skill_id,skill_lv))); break; case RK_DRAGONHOWLING: if( flag&1) - sc_start(bl,type,50 + 6 * skilllv,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,type,50 + 6 * skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)); else { skill_area_temp[2] = 0; - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_foreachinrange(skill_area_sub, src, - skill_get_splash(skillid,skilllv),BL_CHAR, - src,skillid,skilllv,tick,flag|BCT_ENEMY|SD_PREAMBLE|1, + skill_get_splash(skill_id,skill_lv),BL_CHAR, + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|1, skill_castend_nodamage_id); } break; case RK_IGNITIONBREAK: case LG_EARTHDRIVE: - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - i = skill_get_splash(skillid,skilllv); - if( skillid == LG_EARTHDRIVE ) { + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + i = skill_get_splash(skill_id,skill_lv); + if( skill_id == LG_EARTHDRIVE ) { int dummy = 1; map_foreachinarea(skill_cell_overlap, src->m, src->x-i, src->y-i, src->x+i, src->y+i, BL_SKILL, LG_EARTHDRIVE, &dummy, src); } map_foreachinrange(skill_area_sub, bl,i,BL_CHAR, - src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); break; case RK_STONEHARDSKIN: if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 4 ) { int heal = sstatus->hp / 4; // 25% HP if( status_charge(bl,heal,0) ) - clif_skill_nodamage(src,bl,skillid,skilllv,sc_start2(bl,type,100,skilllv,heal,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start2(bl,type,100,skill_lv,heal,skill_get_time(skill_id,skill_lv))); else - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; case RK_REFRESH: if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 8 ) { int heal = status_get_max_hp(bl) * 25 / 100; - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); status_heal(bl,heal,0,1); status_change_clear_buffs(bl,4); } @@ -7514,9 +7515,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 9 ) { short shields = (rnd()%100<50) ? 4 : ((rnd()%100<80) ? 3 : 2); - sc_start4(bl,type,100,skilllv,shields,1000,0,skill_get_time(skillid,skilllv)); + sc_start4(bl,type,100,skill_lv,shields,1000,0,skill_get_time(skill_id,skill_lv)); clif_millenniumshield(sd,shields); - clif_skill_nodamage(src,bl,skillid,1,1); + clif_skill_nodamage(src,bl,skill_id,1,1); } break; @@ -7527,32 +7528,32 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( sd ) { int lv = 1; // RK_GIANTGROWTH - if( skillid == RK_VITALITYACTIVATION ) + if( skill_id == RK_VITALITYACTIVATION ) lv = 2; - else if( skillid == RK_ABUNDANCE ) + else if( skill_id == RK_ABUNDANCE ) lv = 6; - else if( skillid == RK_CRUSHSTRIKE ) + else if( skill_id == RK_CRUSHSTRIKE ) lv = 7; if( pc_checkskill(sd,RK_RUNEMASTERY) >= lv ) - clif_skill_nodamage(src,bl,skillid,skilllv,sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); } break; case RK_FIGHTINGSPIRIT: if( flag&1 ) { if( src == bl ) - sc_start2(bl,type,100,skill_area_temp[5],10*(sd?pc_checkskill(sd,RK_RUNEMASTERY):10),skill_get_time(skillid,skilllv)); + sc_start2(bl,type,100,skill_area_temp[5],10*(sd?pc_checkskill(sd,RK_RUNEMASTERY):10),skill_get_time(skill_id,skill_lv)); else - sc_start(bl,type,100,skill_area_temp[5]/4,skill_get_time(skillid,skilllv)); + sc_start(bl,type,100,skill_area_temp[5]/4,skill_get_time(skill_id,skill_lv)); } else if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 5 ) { if( sd->status.party_id ) { - i = party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skillid,skilllv),src,skillid,skilllv,tick,BCT_PARTY,skill_area_sub_count); + i = party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,BCT_PARTY,skill_area_sub_count); skill_area_temp[5] = 7 * i; // ATK - party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skillid,skilllv),src,skillid,skilllv,tick,flag|BCT_PARTY|1,skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,flag|BCT_PARTY|1,skill_castend_nodamage_id); } else - sc_start2(bl,type,100,7,5,skill_get_time(skillid,skilllv)); + sc_start2(bl,type,100,7,5,skill_get_time(skill_id,skill_lv)); } - clif_skill_nodamage(src,bl,skillid,1,1); + clif_skill_nodamage(src,bl,skill_id,1,1); break; /** * Guilotine Cross @@ -7561,7 +7562,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { short count = 1; skill_area_temp[2] = 0; - map_foreachinrange(skill_area_sub,src,skill_get_splash(skillid,skilllv),BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill_castend_damage_id); if( tsc && tsc->data[SC_ROLLINGCUTTER] ) { // Every time the skill is casted the status change is reseted adding a counter. count += (short)tsc->data[SC_ROLLINGCUTTER]->val1; @@ -7569,8 +7570,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in count = 10; // Max coounter status_change_end(bl, SC_ROLLINGCUTTER, INVALID_TIMER); } - sc_start(bl,SC_ROLLINGCUTTER,100,count,skill_get_time(skillid,skilllv)); - clif_skill_nodamage(src,src,skillid,skilllv,1); + sc_start(bl,SC_ROLLINGCUTTER,100,count,skill_get_time(skill_id,skill_lv)); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); } break; @@ -7578,27 +7579,27 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( tsc && tsc->data[SC_WEAPONBLOCKING] ) status_change_end(bl, SC_WEAPONBLOCKING, INVALID_TIMER); else - sc_start(bl,SC_WEAPONBLOCKING,100,skilllv,skill_get_time(skillid,skilllv)); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + sc_start(bl,SC_WEAPONBLOCKING,100,skill_lv,skill_get_time(skill_id,skill_lv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case GC_CREATENEWPOISON: if( sd ) { - clif_skill_produce_mix_list(sd,skillid,25); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_produce_mix_list(sd,skill_id,25); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; case GC_POISONINGWEAPON: if( sd ) { - clif_poison_list(sd,skilllv); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_poison_list(sd,skill_lv); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case GC_ANTIDOTE: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if( tsc ) { status_change_end(bl, SC_PARALYSE, INVALID_TIMER); @@ -7613,25 +7614,25 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; case GC_PHANTOMMENACE: - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - clif_skill_nodamage(src,bl,skillid,skilllv,1); - map_foreachinrange(skill_area_sub,src,skill_get_splash(skillid,skilllv),BL_CHAR, - src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR, + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); break; case GC_HALLUCINATIONWALK: { int heal = status_get_max_hp(bl) / 10; if( status_get_hp(bl) < heal ) { // if you haven't enough HP skill fails. - if( sd ) clif_skill_fail(sd,skillid,USESKILL_FAIL_HP_INSUFFICIENT,0); + if( sd ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0); break; } if( !status_charge(bl,heal,0) ) { - if( sd ) clif_skill_fail(sd,skillid,USESKILL_FAIL_HP_INSUFFICIENT,0); + if( sd ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_HP_INSUFFICIENT,0); break; } - clif_skill_nodamage(src,bl,skillid,skilllv,sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); } break; /** @@ -7639,8 +7640,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in **/ case AB_ANCILLA: if( sd ) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_produce_mix(sd, skillid, ITEMID_ANCILLA, 0, 0, 0, 1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + skill_produce_mix(sd, skill_id, ITEMID_ANCILLA, 0, 0, 0, 1); } break; @@ -7650,18 +7651,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int bless_lv = pc_checkskill(sd,AL_BLESSING) + (sd->status.job_level / 10); int agi_lv = pc_checkskill(sd,AL_INCAGI) + (sd->status.job_level / 10); if( sd == NULL || sd->status.party_id == 0 || flag&1 ) - clif_skill_nodamage(bl, bl, skillid, skilllv, sc_start(bl,type,100, - (skillid == AB_CLEMENTIA)? bless_lv : (skillid == AB_CANTO)? agi_lv : skilllv, skill_get_time(skillid,skilllv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100, + (skill_id == AB_CLEMENTIA)? bless_lv : (skill_id == AB_CANTO)? agi_lv : skill_lv, skill_get_time(skill_id,skill_lv))); else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); } break; case AB_PRAEFATIO: if( sd == NULL || sd->status.party_id == 0 || flag&1 ) - clif_skill_nodamage(bl, bl, skillid, skilllv, sc_start4(bl, type, 100, skilllv, 0, 0, 1, skill_get_time(skillid, skilllv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start4(bl, type, 100, skill_lv, 0, 0, 1, skill_get_time(skill_id, skill_lv))); else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); break; case AB_CHEAL: @@ -7674,24 +7675,24 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( (dstsd && pc_ismadogear(dstsd)) || status_isimmune(bl)) i = 0; // Should heal by 0 or won't do anything?? in iRO it breaks the healing to members.. [malufett] - clif_skill_nodamage(bl, bl, skillid, i, 1); + clif_skill_nodamage(bl, bl, skill_id, i, 1); if( tsc && tsc->data[SC_AKAITSUKI] && i ) i = ~i + 1; status_heal(bl, i, 0, 0); } } else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); break; case AB_ORATIO: if( flag&1 ) - sc_start(bl, type, 40 + 5 * skilllv, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, type, 40 + 5 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); else { - map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid, skilllv), BL_CHAR, - src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id, skill_lv), BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; @@ -7700,7 +7701,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( tsc && (tsc->data[SC_FREEZE] || tsc->data[SC_STONE] || tsc->data[SC_BLIND] || tsc->data[SC_BURNING] || tsc->data[SC_FREEZING] || tsc->data[SC_CRYSTALIZE])) { // Success Chance: (40 + 10 * Skill Level) % - if( rnd()%100 > 40+10*skilllv ) break; + if( rnd()%100 > 40+10*skill_lv ) break; status_change_end(bl, SC_FREEZE, INVALID_TIMER); status_change_end(bl, SC_STONE, INVALID_TIMER); status_change_end(bl, SC_BLIND, INVALID_TIMER); @@ -7708,38 +7709,38 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in status_change_end(bl, SC_FREEZING, INVALID_TIMER); status_change_end(bl, SC_CRYSTALIZE, INVALID_TIMER); }else //Success rate only applies to the curing effect and not stat bonus. Bonus status only applies to non infected targets - clif_skill_nodamage(bl, bl, skillid, skilllv, - sc_start(bl, type, 100, skilllv, skill_get_time(skillid, skilllv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, + sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv))); } else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), - src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), + src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); break; case AB_LAUDARAMUS: if( flag&1 || sd == NULL ) { if( tsc && (tsc->data[SC_SLEEP] || tsc->data[SC_STUN] || tsc->data[SC_MANDRAGORA] || tsc->data[SC_SILENCE]) ){ // Success Chance: (40 + 10 * Skill Level) % - if( rnd()%100 > 40+10*skilllv ) break; + if( rnd()%100 > 40+10*skill_lv ) break; status_change_end(bl, SC_SLEEP, INVALID_TIMER); status_change_end(bl, SC_STUN, INVALID_TIMER); status_change_end(bl, SC_MANDRAGORA, INVALID_TIMER); status_change_end(bl, SC_SILENCE, INVALID_TIMER); }else // Success rate only applies to the curing effect and not stat bonus. Bonus status only applies to non infected targets - clif_skill_nodamage(bl, bl, skillid, skilllv, - sc_start(bl, type, 100, skilllv, skill_get_time(skillid, skilllv))); + clif_skill_nodamage(bl, bl, skill_id, skill_lv, + sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv))); } else if( sd ) - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), - src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), + src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); break; case AB_CLEARANCE: - if( flag&1 || (i = skill_get_splash(skillid, skilllv)) < 1 ) + if( flag&1 || (i = skill_get_splash(skill_id, skill_lv)) < 1 ) { //As of the behavior in official server Clearance is just a super version of Dispell skill. [Jobbie] - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) || rnd()%100 >= 30 + 10 * skilllv) + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) || rnd()%100 >= 30 + 10 * skill_lv) { if (sd) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } if(status_isimmune(bl) || !tsc || !tsc->count) @@ -7803,25 +7804,25 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } break; } - map_foreachinrange(skill_area_sub, bl, i, BL_CHAR, src, skillid, skilllv, tick, flag|1, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill_castend_damage_id); break; case AB_SILENTIUM: // Should the level of Lex Divina be equivalent to the level of Silentium or should the highest level learned be used? [LimitLine] - map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid, skilllv), BL_CHAR, - src, PR_LEXDIVINA, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id, skill_lv), BL_CHAR, + src, PR_LEXDIVINA, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); break; /** * Warlock **/ case WL_STASIS: if( flag&1 ) - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); else { - map_foreachinrange(skill_area_sub,src,skill_get_splash(skillid, skilllv),BL_CHAR,src,skillid,skilllv,tick,(map_flag_vs(src->m)?BCT_ALL:BCT_ENEMY|BCT_SELF)|flag|1,skill_castend_nodamage_id); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id, skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,(map_flag_vs(src->m)?BCT_ALL:BCT_ENEMY|BCT_SELF)|flag|1,skill_castend_nodamage_id); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; @@ -7831,37 +7832,37 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int rate = ( sd? sd->status.job_level : 50 ) / 4; if(src == bl ) rate = 100; // Success Chance: On self, 100% - else if(bl->type == BL_PC) rate += 20 + 10 * skilllv; // On Players, (20 + 10 * Skill Level) % - else rate += 40 + 10 * skilllv; // On Monsters, (40 + 10 * Skill Level) % + else if(bl->type == BL_PC) rate += 20 + 10 * skill_lv; // On Players, (20 + 10 * Skill Level) % + else rate += 40 + 10 * skill_lv; // On Monsters, (40 + 10 * Skill Level) % if( !(tsc && tsc->data[type]) ){ - i = sc_start2(bl,type,rate,skilllv,src->id,(src == bl)?5000:(bl->type == BL_PC)?skill_get_time(skillid,skilllv):skill_get_time2(skillid, skilllv)); - clif_skill_nodamage(src,bl,skillid,skilllv,i); + i = sc_start2(bl,type,rate,skill_lv,src->id,(src == bl)?5000:(bl->type == BL_PC)?skill_get_time(skill_id,skill_lv):skill_get_time2(skill_id, skill_lv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,i); } if( sd && i ) - skill_blockpc_start(sd,skillid,4000); // Reuse Delay only activated on success + skill_blockpc_start(sd,skill_id,4000); // Reuse Delay only activated on success else if(sd) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); }else if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_TOTARGET,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_TOTARGET,0); break; case WL_FROSTMISTY: - clif_skill_nodamage(src,bl,skillid,skilllv,1); - map_foreachinrange(skill_area_sub,bl,skill_get_splash(skillid,skilllv),BL_CHAR|BL_SKILL,src,skillid,skilllv,tick,flag|BCT_ENEMY,skill_castend_damage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + map_foreachinrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill_castend_damage_id); break; case WL_JACKFROST: - clif_skill_nodamage(src,bl,skillid,skilllv,1); - map_foreachinshootrange(skill_area_sub,bl,skill_get_splash(skillid,skilllv),BL_CHAR|BL_SKILL,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + map_foreachinshootrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); break; case WL_MARSHOFABYSS: // Should marsh of abyss still apply half reduction to players after the 28/10 patch? [LimitLine] - clif_skill_nodamage(src, bl, skillid, skilllv, - sc_start4(bl, type, 100, skilllv, status_get_int(src), sd ? sd->status.job_level : 50, 0, - skill_get_time(skillid, skilllv))); + clif_skill_nodamage(src, bl, skill_id, skill_lv, + sc_start4(bl, type, 100, skill_lv, status_get_int(src), sd ? sd->status.job_level : 50, 0, + skill_get_time(skill_id, skill_lv))); break; case WL_SIENNAEXECRATE: @@ -7875,13 +7876,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( tsc && tsc->data[SC_STONE] ) status_change_end(bl,SC_STONE,INVALID_TIMER); else - status_change_start(bl,SC_STONE,10000,skilllv,0,0,1000,skill_get_time(skillid, skilllv),2); + status_change_start(bl,SC_STONE,10000,skill_lv,0,0,1000,skill_get_time(skill_id, skill_lv),2); } else { - int rate = 40 + 8 * skilllv + ( sd? sd->status.job_level : 50 ) / 4; + int rate = 40 + 8 * skill_lv + ( sd? sd->status.job_level : 50 ) / 4; // IroWiki says Rate should be reduced by target stats, but currently unknown if( rnd()%100 < rate ) { // Success on First Target if( !tsc->data[SC_STONE] ) - rate = status_change_start(bl,SC_STONE,10000,skilllv,0,0,1000,skill_get_time(skillid, skilllv),2); + rate = status_change_start(bl,SC_STONE,10000,skill_lv,0,0,1000,skill_get_time(skill_id, skill_lv),2); else { rate = 1; status_change_end(bl,SC_STONE,INVALID_TIMER); @@ -7889,12 +7890,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( rate ) { skill_area_temp[1] = bl->id; - map_foreachinrange(skill_area_sub,bl,skill_get_splash(skillid,skilllv),BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_nodamage_id); } // Doesn't send failure packet if it fails on defense. } else if( sd ) // Failure on Rate - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } break; @@ -7918,12 +7919,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( !sctype ) { if( sd ) // No free slots to put SC - clif_skill_fail(sd,skillid,USESKILL_FAIL_SUMMON,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON,0); break; } pos++; // Used in val2 for SC. Indicates the order of this ball - switch( skillid ) + switch( skill_id ) { // Set val1. The SC element for this ball case WL_SUMMONFB: element = WLS_FIRE; break; case WL_SUMMONBL: element = WLS_WIND; break; @@ -7931,8 +7932,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case WL_SUMMONSTONE: element = WLS_STONE; break; } - sc_start4(src,sctype,100,element,pos,skilllv,0,skill_get_time(skillid,skilllv)); - clif_skill_nodamage(src,bl,skillid,0,0); + sc_start4(src,sctype,100,element,pos,skill_lv,0,skill_get_time(skill_id,skill_lv)); + clif_skill_nodamage(src,bl,skill_id,0,0); } break; @@ -7948,17 +7949,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; } - sc_start(bl, SC_STOP, 100, skilllv, INVALID_TIMER); //Can't move while selecting a spellbook. + sc_start(bl, SC_STOP, 100, skill_lv, INVALID_TIMER); //Can't move while selecting a spellbook. clif_spellbook_list(sd); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; /** * Ranger **/ case RA_FEARBREEZE: - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - clif_skill_nodamage(src, bl, skillid, skilllv, sc_start(bl, type, 100, skilllv, skill_get_time(skillid, skilllv))); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv))); break; case RA_WUGMASTERY: @@ -7967,7 +7968,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in pc_setoption(sd,sd->sc.option|OPTION_WUG); else pc_setoption(sd,sd->sc.option&~OPTION_WUG); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -7980,26 +7981,26 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in pc_setoption(sd,sd->sc.option&~OPTION_WUGRIDER); pc_setoption(sd,sd->sc.option|OPTION_WUG); } - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case RA_WUGDASH: if( tsce ) { - clif_skill_nodamage(src,bl,skillid,skilllv,status_change_end(bl, type, INVALID_TIMER)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER)); map_freeblock_unlock(); return 0; } if( sd && pc_isridingwug(sd) ) { - clif_skill_nodamage(src,bl,skillid,skilllv,sc_start4(bl,type,100,skilllv,unit_getdir(bl),0,0,1)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start4(bl,type,100,skill_lv,unit_getdir(bl),0,0,1)); clif_walkok(sd); } break; case RA_SENSITIVEKEEN: - clif_skill_nodamage(src,bl,skillid,skilllv,1); - clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - map_foreachinrange(skill_area_sub,src,skill_get_splash(skillid,skilllv),BL_CHAR|BL_SKILL,src,skillid,skilllv,tick,flag|BCT_ENEMY,skill_castend_damage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill_castend_damage_id); break; /** * Mechanic @@ -8007,11 +8008,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NC_F_SIDESLIDE: case NC_B_SIDESLIDE: { - int dir = (skillid == NC_F_SIDESLIDE) ? (unit_getdir(src)+4)%8 : unit_getdir(src); - skill_blown(src,bl,skill_get_blewcount(skillid,skilllv),dir,0x1); + uint8 dir = (skill_id == NC_F_SIDESLIDE) ? (unit_getdir(src)+4)%8 : unit_getdir(src); + skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),dir,0x1); clif_slide(src,src->x,src->y); clif_fixpos(src); //Aegis sent this packet - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -8019,27 +8020,27 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( sd ) { if( pc_ismadogear(sd) ) pc_setmadogear(sd, 0); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); - skill_castend_damage_id(src, src, skillid, skilllv, tick, flag); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); + skill_castend_damage_id(src, src, skill_id, skill_lv, tick, flag); status_set_sp(src, 0, 0); } break; case NC_ANALYZE: - clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - clif_skill_nodamage(src, bl, skillid, skilllv, - sc_start(bl,type, 30 + 12 * skilllv,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + clif_skill_nodamage(src, bl, skill_id, skill_lv, + sc_start(bl,type, 30 + 12 * skill_lv,skill_lv,skill_get_time(skill_id,skill_lv))); if( sd ) pc_overheat(sd,1); break; case NC_MAGNETICFIELD: - if( (i = sc_start2(bl,type,100,skilllv,src->id,skill_get_time(skillid,skilllv))) ) + if( (i = sc_start2(bl,type,100,skill_lv,src->id,skill_get_time(skill_id,skill_lv))) ) { - map_foreachinrange(skill_area_sub,src,skill_get_splash(skillid,skilllv),splash_target(src),src,skillid,skilllv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill_castend_damage_id);; - clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skillid,skilllv,6); + map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill_castend_damage_id);; + clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6); if (sd) pc_overheat(sd,1); } - clif_skill_nodamage(src,src,skillid,skilllv,i); + clif_skill_nodamage(src,src,skill_id,skill_lv,i); break; case NC_REPAIR: @@ -8048,15 +8049,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in int heal; if( dstsd && pc_ismadogear(dstsd) ) { - heal = dstsd->status.max_hp * (3+3*skilllv) / 100; + heal = dstsd->status.max_hp * (3+3*skill_lv) / 100; status_heal(bl,heal,0,2); } else { - heal = sd->status.max_hp * (3+3*skilllv) / 100; + heal = sd->status.max_hp * (3+3*skill_lv) / 100; status_heal(src,heal,0,2); } - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - clif_skill_nodamage(src, bl, skillid, skilllv, heal); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + clif_skill_nodamage(src, bl, skill_id, skill_lv, heal); } break; @@ -8066,28 +8067,28 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in md = map_id2md(bl->id); if( md && md->class_ >= MOBID_SILVERSNIPER && md->class_ <= MOBID_MAGICDECOY_WIND ) status_kill(bl); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } break; case SC_AUTOSHADOWSPELL: if( sd ) { if( sd->status.skill[sd->reproduceskill_id].id || sd->status.skill[sd->cloneskill_id].id ) { - sc_start(src,SC_STOP,100,skilllv,-1);// The skilllv is stored in val1 used in skill_select_menu to determine the used skill lvl [Xazax] + sc_start(src,SC_STOP,100,skill_lv,-1);// The skill_lv is stored in val1 used in skill_select_menu to determine the used skill lvl [Xazax] clif_autoshadowspell_list(sd); - clif_skill_nodamage(src,bl,skillid,1,1); + clif_skill_nodamage(src,bl,skill_id,1,1); } else - clif_skill_fail(sd,skillid,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_IMITATION_SKILL_NONE,0); } break; case SC_SHADOWFORM: if( sd && dstsd && src != bl && !dstsd->shadowform_id ) { - if( clif_skill_nodamage(src,bl,skillid,skilllv,sc_start4(src,type,100,skilllv,bl->id,4+skilllv,0,skill_get_time(skillid, skilllv))) ) + if( clif_skill_nodamage(src,bl,skill_id,skill_lv,sc_start4(src,type,100,skill_lv,bl->id,4+skill_lv,0,skill_get_time(skill_id, skill_lv))) ) dstsd->shadowform_id = src->id; } else if( sd ) - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; case SC_BODYPAINT: @@ -8101,13 +8102,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); status_change_end(bl, SC__INVISIBILITY, INVALID_TIMER); - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); - sc_start(bl,SC_BLIND,53 + 2 * skilllv,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,SC_BLIND,53 + 2 * skill_lv,skill_lv,skill_get_time(skill_id,skill_lv)); } } else { - clif_skill_nodamage(src, bl, skillid, 0, 1); - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), BL_CHAR, - src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src, bl, skill_id, 0, 1); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); } break; @@ -8118,57 +8119,57 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SC_WEAKNESS: if( !(tsc && tsc->data[type]) ) { //((rand(myDEX / 12, myDEX / 4) + myJobLevel + 10 * skLevel) + myLevel / 10) - (targetLevel / 10 + targetLUK / 10 + (targetMaxWeight - targetWeight) / 1000 + rand(targetAGI / 6, targetAGI / 3)) - int rate = rnd_value(sstatus->dex/12,sstatus->dex/4) + 10*skilllv + (sd?sd->status.job_level:0) + status_get_lv(src)/10 + int rate = rnd_value(sstatus->dex/12,sstatus->dex/4) + 10*skill_lv + (sd?sd->status.job_level:0) + status_get_lv(src)/10 - status_get_lv(bl)/10 - tstatus->luk/10 - (dstsd?(dstsd->max_weight-dstsd->weight)/10000:0) - rnd_value(tstatus->agi/6,tstatus->agi/3); - rate = cap_value(rate, skilllv+sstatus->dex/20, 100); - clif_skill_nodamage(src,bl,skillid,0,sc_start(bl,type,rate,skilllv,skill_get_time(skillid,skilllv))); + rate = cap_value(rate, skill_lv+sstatus->dex/20, 100); + clif_skill_nodamage(src,bl,skill_id,0,sc_start(bl,type,rate,skill_lv,skill_get_time(skill_id,skill_lv))); } else if( sd ) - clif_skill_fail(sd,skillid,0,0); + clif_skill_fail(sd,skill_id,0,0); break; case SC_IGNORANCE: if( !(tsc && tsc->data[type]) ) { - int rate = rnd_value(sstatus->dex/12,sstatus->dex/4) + 10*skilllv + (sd?sd->status.job_level:0) + status_get_lv(src)/10 + int rate = rnd_value(sstatus->dex/12,sstatus->dex/4) + 10*skill_lv + (sd?sd->status.job_level:0) + status_get_lv(src)/10 - status_get_lv(bl)/10 - tstatus->luk/10 - (dstsd?(dstsd->max_weight-dstsd->weight)/10000:0) - rnd_value(tstatus->agi/6,tstatus->agi/3); - rate = cap_value(rate, skilllv+sstatus->dex/20, 100); - if (clif_skill_nodamage(src,bl,skillid,0,sc_start(bl,type,rate,skilllv,skill_get_time(skillid,skilllv)))) { - int sp = 200 * skilllv; + rate = cap_value(rate, skill_lv+sstatus->dex/20, 100); + if (clif_skill_nodamage(src,bl,skill_id,0,sc_start(bl,type,rate,skill_lv,skill_get_time(skill_id,skill_lv)))) { + int sp = 200 * skill_lv; if( dstmd ) sp = dstmd->level * 2; if( status_zap(bl,0,sp) ) status_heal(src,0,sp/2,3); } - else if( sd ) clif_skill_fail(sd,skillid,0,0); + else if( sd ) clif_skill_fail(sd,skill_id,0,0); } else if( sd ) - clif_skill_fail(sd,skillid,0,0); + clif_skill_fail(sd,skill_id,0,0); break; case LG_TRAMPLE: - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - map_foreachinrange(skill_destroy_trap,bl,skill_get_splash(skillid,skilllv),BL_SKILL,tick); + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + map_foreachinrange(skill_destroy_trap,bl,skill_get_splash(skill_id,skill_lv),BL_SKILL,tick); break; case LG_REFLECTDAMAGE: if( tsc && tsc->data[type] ) status_change_end(bl,type,INVALID_TIMER); else - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); break; case LG_SHIELDSPELL: if( flag&1 ) { int duration = (sd) ? sd->bonus.shieldmdef * 2000 : 10000; - sc_start(bl,SC_SILENCE,100,skilllv,duration); + sc_start(bl,SC_SILENCE,100,skill_lv,duration); } else if( sd ) { - int opt = skilllv; + int opt = skill_lv; int rate = rnd()%100; int val, brate; - switch( skilllv ) { + switch( skill_lv ) { case 1: { struct item_data *shield_data = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; if( !shield_data || shield_data->type != IT_ARMOR ) { // No shield? - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; } brate = shield_data->def * 10; @@ -8182,9 +8183,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in switch( opt ) { case 1: sc_start(bl,SC_SHIELDSPELL_DEF,100,opt,-1); - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rate < brate ) - map_foreachinrange(skill_area_sub,src,skill_get_splash(skillid,skilllv),BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); status_change_end(bl,SC_SHIELDSPELL_DEF,INVALID_TIMER); break; case 2: @@ -8210,20 +8211,20 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in switch( opt ) { case 1: sc_start(bl,SC_SHIELDSPELL_MDEF,100,opt,-1); - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rate < brate ) - map_foreachinrange(skill_area_sub,src,skill_get_splash(skillid,skilllv),BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|2,skill_castend_damage_id); + map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|2,skill_castend_damage_id); status_change_end(bl,SC_SHIELDSPELL_MDEF,INVALID_TIMER); break; case 2: sc_start(bl,SC_SHIELDSPELL_MDEF,100,opt,-1); - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); if( rate < brate ) - map_foreachinrange(skill_area_sub,src,skill_get_splash(skillid,skilllv),BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub,src,skill_get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_nodamage_id); break; case 3: if( sc_start(bl,SC_SHIELDSPELL_MDEF,brate,opt,sd->bonus.shieldmdef * 30000) ) - clif_skill_nodamage(src,bl,PR_MAGNIFICAT,skilllv, + clif_skill_nodamage(src,bl,PR_MAGNIFICAT,skill_lv, sc_start(bl,SC_MAGNIFICAT,100,1,sd->bonus.shieldmdef * 30000)); break; } @@ -8233,7 +8234,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { struct item *it = &sd->status.inventory[sd->equip_index[EQI_HAND_L]]; if( !it ) { // No shield? - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } brate = it->refine * 5; @@ -8246,7 +8247,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in switch( opt ) { case 1: val = 105 * it->refine / 10; - sc_start2(bl,SC_SHIELDSPELL_REF,brate,opt,val,skill_get_time(skillid,skilllv)); + sc_start2(bl,SC_SHIELDSPELL_REF,brate,opt,val,skill_get_time(skill_id,skill_lv)); break; case 2: case 3: if( rate < brate ) @@ -8262,17 +8263,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } break; } - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case LG_PIETY: if( flag&1 ) - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); else { skill_area_temp[2] = 0; - map_foreachinrange(skill_area_sub,bl,skill_get_splash(skillid,skilllv),BL_PC,src,skillid,skilllv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill_castend_nodamage_id); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + map_foreachinrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill_castend_nodamage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -8283,13 +8284,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_updatestatus(sd,SP_BASEEXP); clif_updatestatus(sd,SP_JOBEXP); } - clif_skill_nodamage(bl,src,skillid,skilllv, - sc_start(bl, type, 100, skilllv, skill_get_time(skillid, skilllv))); + clif_skill_nodamage(bl,src,skill_id,skill_lv, + sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv))); break; case SR_CURSEDCIRCLE: if( flag&1 ) { if( is_boss(bl) ) break; - if( sc_start2(bl, type, 100, skilllv, src->id, skill_get_time(skillid, skilllv))) { + if( sc_start2(bl, type, 100, skill_lv, src->id, skill_get_time(skill_id, skill_lv))) { if( bl->type == BL_MOB ) mob_unlocktarget((TBL_MOB*)bl,gettick()); unit_stop_attack(bl); @@ -8299,22 +8300,22 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } } else { int count = 0; - clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - count = map_forcountinrange(skill_area_sub, src, skill_get_splash(skillid,skilllv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors - BL_CHAR, src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + count = map_forcountinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors + BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); if( sd ) pc_delspiritball(sd, count, 0); - clif_skill_nodamage(src, src, skillid, skilllv, - sc_start2(src, SC_CURSEDCIRCLE_ATKER, 100, skilllv, count, skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src, src, skill_id, skill_lv, + sc_start2(src, SC_CURSEDCIRCLE_ATKER, 100, skill_lv, count, skill_get_time(skill_id,skill_lv))); } break; case SR_RAISINGDRAGON: if( sd ) { - short max = 5 + skilllv; - sc_start(bl, SC_EXPLOSIONSPIRITS, 100, skilllv, skill_get_time(skillid, skilllv)); + short max = 5 + skill_lv; + sc_start(bl, SC_EXPLOSIONSPIRITS, 100, skill_lv, skill_get_time(skill_id, skill_lv)); for( i = 0; i < max; i++ ) // Don't call more than max available spheres. - pc_addspiritball(sd, skill_get_time(skillid, skilllv), max); - clif_skill_nodamage(src, bl, skillid, skilllv, sc_start(bl, type, 100, skilllv,skill_get_time(skillid, skilllv))); + pc_addspiritball(sd, skill_get_time(skill_id, skill_lv), max); + clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv,skill_get_time(skill_id, skill_lv))); } break; @@ -8327,10 +8328,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in pc_delspiritball(dstsd, dstsd->spiritball, 0); } if( i ) status_percent_heal(src, 0, i); - clif_skill_nodamage(src, bl, skillid, skilllv, i ? 1:0); + clif_skill_nodamage(src, bl, skill_id, skill_lv, i ? 1:0); } else { - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|BCT_SELF|SD_SPLASH|1, skill_castend_nodamage_id); + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF|SD_SPLASH|1, skill_castend_nodamage_id); } break; @@ -8343,7 +8344,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in pc_delspiritball(sd, sd->spiritball, 0); } } - clif_skill_nodamage(src, bl, skillid, skilllv, 1); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); break; case SR_GENTLETOUCH_CURE: @@ -8352,14 +8353,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( status_isimmune(bl) ) { - clif_skill_nodamage(src,bl,skillid,skilllv,0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,0); break; } - heal = 120 * skilllv + status_get_max_hp(bl) * (2 + skilllv) / 100; + heal = 120 * skill_lv + status_get_max_hp(bl) * (2 + skill_lv) / 100; status_heal(bl, heal, 0, 0); - if( (tsc && tsc->opt1) && (rnd()%100 < ((skilllv * 5) + (status_get_dex(src) + status_get_lv(src)) / 4) - (1 + (rnd() % 10))) ) + if( (tsc && tsc->opt1) && (rnd()%100 < ((skill_lv * 5) + (status_get_dex(src) + status_get_lv(src)) / 4) - (1 + (rnd() % 10))) ) { status_change_end(bl, SC_STONE, INVALID_TIMER); status_change_end(bl, SC_FREEZE, INVALID_TIMER); @@ -8372,21 +8373,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in status_change_end(bl, SC_FREEZING, INVALID_TIMER); } - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case SR_GENTLETOUCH_CHANGE: case SR_GENTLETOUCH_REVITALIZE: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start2(bl,type,100,skilllv,src->id,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start2(bl,type,100,skill_lv,src->id,skill_get_time(skill_id,skill_lv))); break; case WA_SWING_DANCE: case WA_MOONLIT_SERENADE: if( sd == NULL || sd->status.party_id == 0 || (flag & 1) ) - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); else if( sd ) { // Only shows effects on caster. - clif_skill_nodamage(src,bl,skillid,skilllv,1); - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); } break; @@ -8394,17 +8395,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case MI_RUSH_WINDMILL: case MI_ECHOSONG: if( sd == NULL || sd->status.party_id == 0 || (flag & 1) ) - sc_start4(bl,type,100,skilllv,6*skilllv,(sd?pc_checkskill(sd,WM_LESSON):0),(sd?sd->status.job_level:0),skill_get_time(skillid,skilllv)); + sc_start4(bl,type,100,skill_lv,6*skill_lv,(sd?pc_checkskill(sd,WM_LESSON):0),(sd?sd->status.job_level:0),skill_get_time(skill_id,skill_lv)); else if( sd ) { // Only shows effects on caster. - clif_skill_nodamage(src,bl,skillid,skilllv,1); - party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); } break; case MI_HARMONIZE: if( src != bl ) - clif_skill_nodamage(src, src, skillid, skilllv, sc_start(src, type, 100, skilllv, skill_get_time(skillid,skilllv))); - clif_skill_nodamage(src, bl, skillid, skilllv, sc_start(bl, type, 100, skilllv, skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src, src, skill_id, skill_lv, sc_start(src, type, 100, skill_lv, skill_get_time(skill_id,skill_lv))); + clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id,skill_lv))); break; case WM_DEADHILLHERE: @@ -8412,13 +8413,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( !status_isdead(bl) ) break; - if( rnd()%100 < 88 + 2 * skilllv ) { + if( rnd()%100 < 88 + 2 * skill_lv ) { int heal = tstatus->sp; if( heal <= 0 ) heal = 1; tstatus->hp = heal; - tstatus->sp -= tstatus->sp * ( 120 - 20 * skilllv ) / 100; - clif_skill_nodamage(src,bl,skillid,skilllv,1); + tstatus->sp -= tstatus->sp * ( 120 - 20 * skill_lv ) / 100; + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); pc_revive((TBL_PC*)bl,heal,0); clif_resurrection(bl,1); } @@ -8428,49 +8429,49 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case WM_SIRCLEOFNATURE: flag |= BCT_SELF|BCT_PARTY|BCT_GUILD; case WM_VOICEOFSIREN: - if( skillid != WM_SIRCLEOFNATURE ) + if( skill_id != WM_SIRCLEOFNATURE ) flag &= ~BCT_SELF; if( flag&1 ) { - sc_start2(bl,type,(skillid==WM_VOICEOFSIREN)?20+10*skilllv:100,skilllv,(skillid==WM_VOICEOFSIREN)?src->id:0,skill_get_time(skillid,skilllv)); + sc_start2(bl,type,(skill_id==WM_VOICEOFSIREN)?20+10*skill_lv:100,skill_lv,(skill_id==WM_VOICEOFSIREN)?src->id:0,skill_get_time(skill_id,skill_lv)); } else { - map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid,skilllv),(skillid==WM_VOICEOFSIREN)?BL_CHAR|BL_SKILL:BL_PC, src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),(skill_id==WM_VOICEOFSIREN)?BL_CHAR|BL_SKILL:BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case WM_GLOOMYDAY: - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if( dstsd && ( pc_checkskill(dstsd,KN_BRANDISHSPEAR) || pc_checkskill(dstsd,LK_SPIRALPIERCE) || pc_checkskill(dstsd,CR_SHIELDCHARGE) || pc_checkskill(dstsd,CR_SHIELDBOOMERANG) || pc_checkskill(dstsd,PA_SHIELDCHAIN) || pc_checkskill(dstsd,LG_SHIELDPRESS) ) ) { - sc_start(bl,SC_GLOOMYDAY_SK,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_GLOOMYDAY_SK,100,skill_lv,skill_get_time(skill_id,skill_lv)); break; } - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); break; case WM_SATURDAY_NIGHT_FEVER: if( flag&1 ) { // Affect to all targets arround the caster and caster too. if( !(tsc && tsc->data[type]) ) - sc_start(bl, type, 100, skilllv,skill_get_time(skillid, skilllv)); + sc_start(bl, type, 100, skill_lv,skill_get_time(skill_id, skill_lv)); } else if( flag&2 ) { if( src->id != bl->id && battle_check_target(src,bl,BCT_ENEMY) > 0 ) status_fix_damage(src,bl,9999,clif_damage(src,bl,tick,0,0,9999,0,0,0)); } else if( sd ) { - short chance = sstatus->int_/6 + sd->status.job_level/5 + skilllv*4; + short chance = sstatus->int_/6 + sd->status.job_level/5 + skill_lv*4; if( !sd->status.party_id || (rnd()%100 > chance)) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_NEED_HELPER,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_NEED_HELPER,0); break; } - if( map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid,skilllv), - BL_PC, src, skillid, skilllv, tick, BCT_ENEMY, skill_area_sub_count) > 7 ) + if( map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id,skill_lv), + BL_PC, src, skill_id, skill_lv, tick, BCT_ENEMY, skill_area_sub_count) > 7 ) flag |= 2; else flag |= 1; - map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid,skilllv),BL_PC, src, skillid, skilllv, tick, flag|BCT_ENEMY|BCT_SELF, skill_castend_nodamage_id); - clif_skill_nodamage(src, bl, skillid, skilllv, - sc_start(src,SC_STOP,100,skilllv,skill_get_time2(skillid,skilllv))); + map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF, skill_castend_nodamage_id); + clif_skill_nodamage(src, bl, skill_id, skill_lv, + sc_start(src,SC_STOP,100,skill_lv,skill_get_time2(skill_id,skill_lv))); if( flag&2 ) // Dealed here to prevent conflicts status_fix_damage(src,bl,9999,clif_damage(src,bl,tick,0,0,9999,0,0,0)); } @@ -8482,14 +8483,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( flag&1 ) { // These affect to to all party members near the caster. struct status_change *sc = status_get_sc(src); if( sc && sc->data[type] ) { - sc_start2(bl,type,100,skilllv,sc->data[type]->val2,skill_get_time(skillid,skilllv)); + sc_start2(bl,type,100,skill_lv,sc->data[type]->val2,skill_get_time(skill_id,skill_lv)); } } else if( sd ) { - short lv = (short)skilllv; - int count = skill_check_pc_partner(sd,skillid,&lv,skill_get_splash(skillid,skilllv),1); - if( sc_start2(bl,type,100,skilllv,count,skill_get_time(skillid,skilllv)) ) - party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skillid,skilllv),src,skillid,skilllv,tick,flag|BCT_PARTY|1,skill_castend_nodamage_id); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + short lv = (short)skill_lv; + int count = skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),1); + if( sc_start2(bl,type,100,skill_lv,count,skill_get_time(skill_id,skill_lv)) ) + party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,flag|BCT_PARTY|1,skill_castend_nodamage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -8498,39 +8499,39 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case WM_BEYOND_OF_WARCRY: case WM_UNLIMITED_HUMMING_VOICE: if( flag&1 ) { - sc_start2(bl,type,100,skilllv,skill_area_temp[0],skill_get_time(skillid,skilllv)); + sc_start2(bl,type,100,skill_lv,skill_area_temp[0],skill_get_time(skill_id,skill_lv)); } else { // These affect to all targets arround the caster. - short lv = (short)skilllv; - skill_area_temp[0] = (sd) ? skill_check_pc_partner(sd,skillid,&lv,skill_get_splash(skillid,skilllv),1) : 50; // 50% chance in non BL_PC (clones). - map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid,skilllv),BL_PC, src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + short lv = (short)skill_lv; + skill_area_temp[0] = (sd) ? skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),1) : 50; // 50% chance in non BL_PC (clones). + map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case WM_RANDOMIZESPELL: { - int improv_skillid = 0, improv_skilllv; + int improv_skill_id = 0, improv_skill_lv; do { i = rnd() % MAX_SKILL_IMPROVISE_DB; - improv_skillid = skill_improvise_db[i].skillid; - } while( improv_skillid == 0 || rnd()%10000 >= skill_improvise_db[i].per ); - improv_skilllv = 4 + skilllv; - clif_skill_nodamage (src, bl, skillid, skilllv, 1); + improv_skill_id = skill_improvise_db[i].skill_id; + } while( improv_skill_id == 0 || rnd()%10000 >= skill_improvise_db[i].per ); + improv_skill_lv = 4 + skill_lv; + clif_skill_nodamage (src, bl, skill_id, skill_lv, 1); if( sd ) { sd->state.abra_flag = 2; - sd->skillitem = improv_skillid; - sd->skillitemlv = improv_skilllv; - clif_item_skill(sd, improv_skillid, improv_skilllv); + sd->skillitem = improv_skill_id; + sd->skillitemlv = improv_skill_lv; + clif_item_skill(sd, improv_skill_id, improv_skill_lv); } else { struct unit_data *ud = unit_bl2ud(src); - int inf = skill_get_inf(improv_skillid); + int inf = skill_get_inf(improv_skill_id); int target_id = 0; if (!ud) break; if (inf&INF_SELF_SKILL || inf&INF_SUPPORT_SKILL) { if (src->type == BL_PET) bl = (struct block_list*)((TBL_PET*)src)->msd; if (!bl) bl = src; - unit_skilluse_id(src, bl->id, improv_skillid, improv_skilllv); + unit_skilluse_id(src, bl->id, improv_skill_id, improv_skill_lv); } else { if (ud->target) target_id = ud->target; @@ -8540,12 +8541,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } if (!target_id) break; - if (skill_get_casttype(improv_skillid) == CAST_GROUND) { + if (skill_get_casttype(improv_skill_id) == CAST_GROUND) { bl = map_id2bl(target_id); if (!bl) bl = src; - unit_skilluse_pos(src, bl->x, bl->y, improv_skillid, improv_skilllv); + unit_skilluse_pos(src, bl->x, bl->y, improv_skill_id, improv_skill_lv); } else - unit_skilluse_id(src, target_id, improv_skillid, improv_skilllv); + unit_skilluse_id(src, target_id, improv_skill_id, improv_skill_lv); } } } @@ -8559,7 +8560,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in short x, y; // Destiny position. unsigned short mapindex; - if( skillid == RETURN_TO_ELDICASTES) + if( skill_id == RETURN_TO_ELDICASTES) { x = 198; y = 187; @@ -8574,7 +8575,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if(!mapindex) { //Given map not found? - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 0; } @@ -8589,17 +8590,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in else tsc->opt1 = OPT1_SLEEP; clif_changeoption(bl); - clif_skill_nodamage (src, bl, skillid, skilllv, 1); + clif_skill_nodamage (src, bl, skill_id, skill_lv, 1); } break; case SO_ARRULLO: if( flag&1 ) - sc_start2(bl, type, 88 + 2 * skilllv, skilllv, 1, skill_get_time(skillid, skilllv)); + sc_start2(bl, type, 88 + 2 * skill_lv, skill_lv, 1, skill_get_time(skill_id, skill_lv)); else { - clif_skill_nodamage(src, bl, skillid, 0, 1); - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), BL_CHAR, - src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + clif_skill_nodamage(src, bl, skill_id, 0, 1); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); } break; @@ -8608,18 +8609,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SO_SUMMON_VENTUS: case SO_SUMMON_TERA: if( sd ) { - int elemental_class = skill_get_elemental_type(skillid,skilllv); + int elemental_class = skill_get_elemental_type(skill_id,skill_lv); // Remove previous elemental fisrt. if( sd->ed ) elemental_delete(sd->ed,0); // Summoning the new one. - if( !elemental_create(sd,elemental_class,skill_get_time(skillid,skilllv)) ) { - clif_skill_fail(sd,skillid,0,0); + if( !elemental_create(sd,elemental_class,skill_get_time(skill_id,skill_lv)) ) { + clif_skill_fail(sd,skill_id,0,0); break; } - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -8629,19 +8630,19 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( !sd->ed ) break; - if( skilllv == 4 ) {// At level 4 delete elementals. + if( skill_lv == 4 ) {// At level 4 delete elementals. elemental_delete(sd->ed, 0); break; } - switch( skilllv ) {// Select mode bassed on skill level used. + switch( skill_lv ) {// Select mode bassed on skill level used. case 2: mode = EL_MODE_ASSIST; break; case 3: mode = EL_MODE_AGGRESSIVE; break; } if( !elemental_change_mode(sd->ed,mode) ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; @@ -8649,9 +8650,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( sd ) { int duration = 3000; if( !sd->ed ) break; - sd->skillid_old = skillid; + sd->skill_id_old = skill_id; elemental_action(sd->ed, bl, tick); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); switch(sd->ed->db->class_){ case 2115:case 2124: case 2118:case 2121: @@ -8662,7 +8663,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in duration = 9000; break; } - skill_blockpc_start(sd, skillid, duration); + skill_blockpc_start(sd, skill_id, duration); } break; @@ -8674,21 +8675,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( !ed ) break; if( !status_charge(&sd->bl,s_hp,s_sp) ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } e_hp = ed->battle_status.max_hp * 10 / 100; e_sp = ed->battle_status.max_sp * 10 / 100; status_heal(&ed->bl,e_hp,e_sp,3); - clif_skill_nodamage(src,&ed->bl,skillid,skilllv,1); + clif_skill_nodamage(src,&ed->bl,skill_id,skill_lv,1); } break; case GN_CHANGEMATERIAL: case SO_EL_ANALYSIS: if( sd ) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); - clif_skill_itemlistwindow(sd,skillid,skilllv); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + clif_skill_itemlistwindow(sd,skill_id,skill_lv); } break; @@ -8696,16 +8697,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { struct status_change *sc = status_get_sc(src); - if( sc && sc->bs_counter < skill_get_maxcount( skillid , skilllv) ) { + if( sc && sc->bs_counter < skill_get_maxcount( skill_id , skill_lv) ) { if( tsc && tsc->data[type] ){ (sc->bs_counter)--; status_change_end(src, type, INVALID_TIMER); // the first one cancels and the last one will take effect resetting the timer } - clif_skill_nodamage(src, bl, skillid, skilllv, 1); - sc_start2(bl, type, 100, skilllv, src->id, skill_get_time(skillid,skilllv)); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); + sc_start2(bl, type, 100, skill_lv, src->id, skill_get_time(skill_id,skill_lv)); (sc->bs_counter)++; } else if( sd ) { - clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); + clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; } } @@ -8713,12 +8714,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case GN_MANDRAGORA: if( flag&1 ) { - if ( clif_skill_nodamage(bl, src, skillid, skilllv, - sc_start(bl, type, 25 + 10 * skilllv, skilllv, skill_get_time(skillid, skilllv))) ) - status_zap(bl, 0, status_get_max_sp(bl) * (25 + 5 * skilllv) / 100); + if ( clif_skill_nodamage(bl, src, skill_id, skill_lv, + sc_start(bl, type, 25 + 10 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv))) ) + status_zap(bl, 0, status_get_max_sp(bl) * (25 + 5 * skill_lv) / 100); } else - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), BL_CHAR, - src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); break; case GN_SLINGITEM: @@ -8734,9 +8735,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( itemdb_is_GNbomb(ammo_id) ) { if(battle_check_target(src,bl,BCT_ENEMY) > 0) {// Only attack if the target is an enemy. if( ammo_id == 13263 ) - map_foreachincell(skill_area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + map_foreachincell(skill_area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); else - skill_attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skilllv,tick,flag); + skill_attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag); } else //Otherwise, it fails, shows animation and removes items. clif_skill_fail(sd,GN_SLINGITEM_RANGEMELEEATK,0xa,0); } else if( itemdb_is_GNthrowable(ammo_id) ){ @@ -8749,8 +8750,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in run_script(script,0,src->id,0); } } - clif_skill_nodamage(src,bl,skillid,skilllv,1); - clif_skill_nodamage(src,bl,skillid,skilllv,1);// This packet is received twice actually, I think it is to show the animation. + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1);// This packet is received twice actually, I think it is to show the animation. break; case GN_MIX_COOKING: @@ -8758,12 +8759,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case GN_S_PHARMACY: if( sd ) { int qty = 1; - sd->skillid_old = skillid; - sd->skilllv_old = skilllv; - if( skillid != GN_S_PHARMACY && skilllv > 1 ) + sd->skill_id_old = skill_id; + sd->skill_lv_old = skill_lv; + if( skill_id != GN_S_PHARMACY && skill_lv > 1 ) qty = 10; - clif_cooking_list(sd,(skillid - GN_MIX_COOKING) + 27,skillid,qty,skillid==GN_MAKEBOMB?5:6); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + clif_cooking_list(sd,(skill_id - GN_MIX_COOKING) + 27,skill_id,qty,skill_id==GN_MAKEBOMB?5:6); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); } break; case EL_CIRCLE_OF_FIRE: @@ -8791,14 +8792,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in struct status_change *sc = status_get_sc(&ele->bl); if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { - elemental_clean_single_effect(ele, skillid); + elemental_clean_single_effect(ele, skill_id); } else { - clif_skill_nodamage(src,src,skillid,skilllv,1); - clif_skill_damage(src, ( skillid == EL_GUST || skillid == EL_BLAST || skillid == EL_WILD_STORM )?src:bl, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - if( skillid == EL_WIND_STEP ) // There aren't teleport, just push the master away. - skill_blown(src,bl,(rnd()%skill_get_blewcount(skillid,skilllv))+1,rand()%8,0); - sc_start(src,type2,100,skilllv,skill_get_time(skillid,skilllv)); - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); + clif_skill_damage(src, ( skill_id == EL_GUST || skill_id == EL_BLAST || skill_id == EL_WILD_STORM )?src:bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + if( skill_id == EL_WIND_STEP ) // There aren't teleport, just push the master away. + skill_blown(src,bl,(rnd()%skill_get_blewcount(skill_id,skill_lv))+1,rand()%8,0); + sc_start(src,type2,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); } } } @@ -8808,9 +8809,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case EL_WATER_BARRIER: case EL_ZEPHYR: case EL_POWER_OF_GAIA: - clif_skill_nodamage(src,src,skillid,skilllv,1); - clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - skill_unitsetting(src,skillid,skilllv,bl->x,bl->y,0); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); + clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + skill_unitsetting(src,skill_id,skill_lv,bl->x,bl->y,0); break; case EL_WATER_SCREEN: { @@ -8819,14 +8820,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in struct status_change *sc = status_get_sc(&ele->bl); sc_type type2 = type-1; - clif_skill_nodamage(src,src,skillid,skilllv,1); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { - elemental_clean_single_effect(ele, skillid); + elemental_clean_single_effect(ele, skill_id); } else { // This not heals at the end. - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - sc_start(src,type2,100,skilllv,skill_get_time(skillid,skilllv)); - sc_start(bl,type,100,src->id,skill_get_time(skillid,skilllv)); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + sc_start(src,type2,100,skill_lv,skill_get_time(skill_id,skill_lv)); + sc_start(bl,type,100,src->id,skill_get_time(skill_id,skill_lv)); } } } @@ -8837,9 +8838,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case KO_KAZEHU_SEIRAN: case KO_DOHU_KOUKAI: if(sd) { - int ttype = skill_get_ele(skillid, skilllv); - clif_skill_nodamage(src, bl, skillid, skilllv, 1); - pc_add_talisman(sd, skill_get_time(skillid, skilllv), 10, ttype); + int ttype = skill_get_ele(skill_id, skill_lv); + clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); + pc_add_talisman(sd, skill_get_time(skill_id, skill_lv), 10, ttype); } break; @@ -8854,55 +8855,55 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in md->special_state.ai = AI_ZANZOU; if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer (gettick() + skill_get_time(skillid, skilllv), mob_timer_delete, md->bl.id, 0); + md->deletetimer = add_timer (gettick() + skill_get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); mob_spawn( md ); pc_setinvincibletimer(sd,500);// unlock target lock - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_blown(src,bl,skill_get_blewcount(skillid,skilllv),unit_getdir(bl),0); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); + skill_blown(src,bl,skill_get_blewcount(skill_id,skill_lv),unit_getdir(bl),0); } } break; case KO_KYOUGAKU: if( dstsd && tsc && !tsc->data[type] && rand()%100 < tstatus->int_/2 ){ - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); }else if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; case KO_JYUSATSU: if( dstsd && tsc && !tsc->data[type] && - rand()%100 < ((45+5*skilllv) + skilllv*5 - status_get_int(bl)/2) ){//[(Base chance of success) + (Skill Level x 5) - (int / 2)]%. - clif_skill_nodamage(src,bl,skillid,skilllv, - status_change_start(bl,type,10000,skilllv,0,0,0,skill_get_time(skillid,skilllv),1)); - status_zap(bl, tstatus->max_hp*skilllv*5/100 , 0); + rand()%100 < ((45+5*skill_lv) + skill_lv*5 - status_get_int(bl)/2) ){//[(Base chance of success) + (Skill Level x 5) - (int / 2)]%. + clif_skill_nodamage(src,bl,skill_id,skill_lv, + status_change_start(bl,type,10000,skill_lv,0,0,0,skill_get_time(skill_id,skill_lv),1)); + status_zap(bl, tstatus->max_hp*skill_lv*5/100 , 0); if( status_get_lv(bl) <= status_get_lv(src) ) - status_change_start(bl,SC_COMA,10,skilllv,0,src->id,0,0,0); + status_change_start(bl,SC_COMA,10,skill_lv,0,src->id,0,0,0); }else if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; case KO_GENWAKU: if ( !map_flag_gvg(src->m) && ( dstsd || dstmd ) && battle_check_target(src,bl,BCT_ENEMY) > 0 ) { int x = src->x, y = src->y; - if( sd && rnd()%100 > ((45+5*skilllv) - status_get_int(bl)/10) ){//[(Base chance of success) - (Intelligence Objectives / 10)]%. - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if( sd && rnd()%100 > ((45+5*skill_lv) - status_get_int(bl)/10) ){//[(Base chance of success) - (Intelligence Objectives / 10)]%. + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } if (unit_movepos(src,bl->x,bl->y,0,0)) { - clif_skill_nodamage(src,src,skillid,skilllv,1); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); clif_slide(src,bl->x,bl->y) ; - sc_start(src,SC_CONFUSION,80,skilllv,skill_get_time(skillid,skilllv)); + sc_start(src,SC_CONFUSION,80,skill_lv,skill_get_time(skill_id,skill_lv)); if (unit_movepos(bl,x,y,0,0)) { - clif_skill_damage(bl,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, -1, 6); + clif_skill_damage(bl,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, -1, 6); if( bl->type == BL_PC && pc_issit((TBL_PC*)bl)) clif_sitting(bl); //Avoid sitting sync problem clif_slide(bl,x,y) ; - sc_start(bl,SC_CONFUSION,80,skilllv,skill_get_time(skillid,skilllv)); + sc_start(bl,SC_CONFUSION,80,skill_lv,skill_get_time(skill_id,skill_lv)); } } } @@ -8910,18 +8911,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case OB_AKAITSUKI: case OB_OBOROGENSOU: - if( sd && ( (skillid == OB_OBOROGENSOU && bl->type == BL_MOB) // This skill does not work on monsters. + if( sd && ( (skill_id == OB_OBOROGENSOU && bl->type == BL_MOB) // This skill does not work on monsters. || is_boss(bl) ) ){ // Does not work on Boss monsters. - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } case KO_IZAYOI: case OB_ZANGETSU: case KG_KYOMU: case KG_KAGEMUSYA: - clif_skill_nodamage(src,bl,skillid,skilllv, - sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); - clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); + clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; case KG_KAGEHUMI: @@ -8929,8 +8930,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if(tsc && ( tsc->option&(OPTION_CLOAK|OPTION_HIDE) || tsc->data[SC_CAMOUFLAGE] || tsc->data[SC__SHADOWFORM] || tsc->data[SC_MARIONETTE] || tsc->data[SC_HARMONIZE])){ - sc_start(src, type, 100, skilllv, skill_get_time(skillid, skilllv)); - sc_start(bl, type, 100, skilllv, skill_get_time(skillid, skilllv)); + sc_start(src, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); status_change_end(bl, SC_HIDING, INVALID_TIMER); status_change_end(bl, SC_CLOAKING, INVALID_TIMER); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); @@ -8940,12 +8941,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in status_change_end(bl, SC_HARMONIZE, INVALID_TIMER); } if( skill_area_temp[2] == 1 ){ - clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); - sc_start(src, SC_STOP, 100, skilllv, skill_get_time(skillid, skilllv)); + clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); + sc_start(src, SC_STOP, 100, skill_lv, skill_get_time(skill_id, skill_lv)); } }else{ skill_area_temp[2] = 0; - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_nodamage_id); } break; @@ -8961,21 +8962,21 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (tsc->data[scs[i]]) status_change_end(bl, scs[i], INVALID_TIMER); } if (!tsc->data[SC_SILENCE]) //put inavoidable silence on target - status_change_start(bl, SC_SILENCE, 100, skilllv, 0,0,0, skill_get_time(skillid, skilllv),1|2|8); + status_change_start(bl, SC_SILENCE, 100, skill_lv, 0,0,0, skill_get_time(skill_id, skill_lv),1|2|8); } heal = status_get_matk_min(src)*4; status_heal(bl, heal, 0, 7); //now inflict silence on everyone if(ssc && !ssc->data[SC_SILENCE]) //put inavoidable silence on homun - status_change_start(src, SC_SILENCE, 100, skilllv, 0,0,0, skill_get_time(skillid, skilllv),1|2|8); + status_change_start(src, SC_SILENCE, 100, skill_lv, 0,0,0, skill_get_time(skill_id, skill_lv),1|2|8); if(m_bl){ struct status_change *msc = status_get_sc(m_bl); if(msc && !msc->data[SC_SILENCE]) //put inavoidable silence on master - status_change_start(m_bl, SC_SILENCE, 100, skilllv, 0,0,0, skill_get_time(skillid, skilllv),1|2|8); + status_change_start(m_bl, SC_SILENCE, 100, skill_lv, 0,0,0, skill_get_time(skill_id, skill_lv),1|2|8); } if (hd) - skill_blockhomun_start(hd, skillid, skill_get_cooldown(skillid, skilllv)); + skill_blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); } break; case MH_OVERED_BOOST: @@ -8988,18 +8989,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if(s_bl && s_bl->type==BL_PC){ status_set_sp(s_bl,status_get_max_sp(s_bl)/2,0); //master drain 50% sp clif_send_homdata(((TBL_PC *)s_bl), SP_HUNGRY, hd->homunculus.hunger); //refresh hunger info - sc_start(s_bl, type, 100, skilllv, skill_get_time(skillid, skilllv)); //gene bonus + sc_start(s_bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); //gene bonus } - sc_start(bl, type, 100, skilllv, skill_get_time(skillid, skilllv)); - skill_blockhomun_start(hd, skillid, skill_get_cooldown(skillid, skilllv)); + sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); + skill_blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); } break; case MH_GRANITIC_ARMOR: case MH_PYROCLASTIC: { struct block_list *s_bl = battle_get_master(src); - if(s_bl) sc_start2(s_bl, type, 100, skilllv, hd->homunculus.level, skill_get_time(skillid, skilllv)); //start on master - sc_start2(bl, type, 100, skilllv, hd->homunculus.level, skill_get_time(skillid, skilllv)); - if (hd) skill_blockhomun_start(hd, skillid, skill_get_cooldown(skillid, skilllv)); + if(s_bl) sc_start2(s_bl, type, 100, skill_lv, hd->homunculus.level, skill_get_time(skill_id, skill_lv)); //start on master + sc_start2(bl, type, 100, skill_lv, hd->homunculus.level, skill_get_time(skill_id, skill_lv)); + if (hd) skill_blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); } break; @@ -9012,9 +9013,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case MH_STYLE_CHANGE: case MH_MAGMA_FLOW: case MH_PAIN_KILLER: - sc_start(bl, type, 100, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); if (hd) - skill_blockhomun_start(hd, skillid, skill_get_cooldown(skillid, skilllv)); + skill_blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); break; case MH_SUMMON_LEGION: { @@ -9023,29 +9024,29 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in struct mob_data *md; int i; - for(i=0; i<qty[skilllv - 1]; i++){ //easy way - md = mob_once_spawn_sub(src, src->m, src->x, src->y, status_get_name(src), summons[skilllv - 1], "", SZ_SMALL, AI_ATTACK); + for(i=0; i<qty[skill_lv - 1]; i++){ //easy way + md = mob_once_spawn_sub(src, src->m, src->x, src->y, status_get_name(src), summons[skill_lv - 1], "", SZ_SMALL, AI_ATTACK); if (md) { md->master_id = src->id; if (md->deletetimer != INVALID_TIMER) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer(gettick() + skill_get_time(skillid, skilllv), mob_timer_delete, md->bl.id, 0); + md->deletetimer = add_timer(gettick() + skill_get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); mob_spawn(md); //Now it is ready for spawning. sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_ASSIST, 0, 60000); } } if (hd) - skill_blockhomun_start(hd, skillid, skill_get_cooldown(skillid, skilllv)); + skill_blockhomun_start(hd, skill_id, skill_get_cooldown(skill_id, skill_lv)); } break; default: - ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n",skillid); - clif_skill_nodamage(src,bl,skillid,skilllv,1); + ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n",skill_id); + clif_skill_nodamage(src,bl,skill_id,skill_lv,1); map_freeblock_unlock(); return 1; } - if(skillid != SR_CURSEDCIRCLE){ + if(skill_id != SR_CURSEDCIRCLE){ struct status_change *sc = status_get_sc(src); if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] )//Should only remove after the skill had been casted. status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER); @@ -9053,7 +9054,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (dstmd) { //Mob skill event for no damage skills (damage ones are handled in battle_calc_damage) [Skotlex] mob_log_damage(dstmd, src, 0); //Log interaction (counts as 'attacker' for the exp bonus) - mobskill_event(dstmd, src, tick, MSC_SKILLUSED|(skillid<<16)); + mobskill_event(dstmd, src, tick, MSC_SKILLUSED|(skill_id<<16)); } if( sd && !(flag&1) ) @@ -9062,11 +9063,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( sd->state.arrow_atk ) {// consume arrow on last invocation to this skill. - battle_consume_ammo(sd, skillid, skilllv); + battle_consume_ammo(sd, skill_id, skill_lv); } - skill_onskillusage(sd, bl, skillid, tick); + skill_onskillusage(sd, bl, skill_id, tick); // perform skill requirement consumption - skill_consume_requirement(sd,skillid,skilllv,2); + skill_consume_requirement(sd,skill_id,skill_lv,2); } map_freeblock_unlock(); @@ -9107,14 +9108,14 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) return 0; } - if(ud->skillid != SA_CASTCANCEL && ud->skillid != SO_SPELLFIST) {// otherwise handled in unit_skillcastcancel() + if(ud->skill_id != SA_CASTCANCEL && ud->skill_id != SO_SPELLFIST) {// otherwise handled in unit_skillcastcancel() if( ud->skilltimer != tid ) { ShowError("skill_castend_id: Timer mismatch %d!=%d!\n", ud->skilltimer, tid); ud->skilltimer = INVALID_TIMER; return 0; } - if( sd && ud->skilltimer != INVALID_TIMER && (pc_checkskill(sd,SA_FREECAST) > 0 || ud->skillid == LG_EXEEDBREAK) ) + if( sd && ud->skilltimer != INVALID_TIMER && (pc_checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) ) {// restore original walk speed ud->skilltimer = INVALID_TIMER; status_calc_bl(&sd->bl, SCB_SPEED); @@ -9134,7 +9135,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) if(src->m != target->m || status_isdead(src)) break; - switch (ud->skillid) { + switch (ud->skill_id) { //These should become skill_castend_pos case WE_CALLPARTNER: if(sd) clif_callpartner(sd); @@ -9143,7 +9144,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) case AM_RESURRECTHOMUN: case PF_SPIDERWEB: //Find a random spot to place the skill. [Skotlex] - inf2 = skill_get_splash(ud->skillid, ud->skilllv); + inf2 = skill_get_splash(ud->skill_id, ud->skill_lv); ud->skillx = target->x + inf2; ud->skilly = target->y + inf2; if (inf2 && !map_random_dir(target, &ud->skillx, &ud->skilly)) { @@ -9159,38 +9160,38 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) return skill_castend_pos(tid,tick,id,data); } - if(ud->skillid == RG_BACKSTAP) { - int dir = map_calc_dir(src,target->x,target->y),t_dir = unit_getdir(target); + if(ud->skill_id == RG_BACKSTAP) { + uint8 dir = map_calc_dir(src,target->x,target->y),t_dir = unit_getdir(target); if(check_distance_bl(src, target, 0) || map_check_dir(dir,t_dir)) { break; } } - if( ud->skillid == PR_TURNUNDEAD ) + if( ud->skill_id == PR_TURNUNDEAD ) { struct status_data *tstatus = status_get_status_data(target); if( !battle_check_undead(tstatus->race, tstatus->def_ele) ) break; } - if( ud->skillid == RA_WUGSTRIKE ){ + if( ud->skill_id == RA_WUGSTRIKE ){ if( !path_search(NULL,src->m,src->x,src->y,target->x,target->y,1,CELL_CHKNOREACH)) break; } - if( ud->skillid == PR_LEXDIVINA || ud->skillid == MER_LEXDIVINA ) + if( ud->skill_id == PR_LEXDIVINA || ud->skill_id == MER_LEXDIVINA ) { sc = status_get_sc(target); if( battle_check_target(src,target, BCT_ENEMY) <= 0 && (!sc || !sc->data[SC_SILENCE]) ) { //If it's not an enemy, and not silenced, you can't use the skill on them. [Skotlex] - clif_skill_nodamage (src, target, ud->skillid, ud->skilllv, 0); + clif_skill_nodamage (src, target, ud->skill_id, ud->skill_lv, 0); break; } } else { // Check target validity. - inf = skill_get_inf(ud->skillid); - inf2 = skill_get_inf2(ud->skillid); + inf = skill_get_inf(ud->skill_id); + inf2 = skill_get_inf2(ud->skill_id); if(inf&INF_ATTACK_SKILL || (inf&INF_SELF_SKILL && inf2&INF2_NO_TARGET_SELF) //Combo skills @@ -9210,151 +9211,151 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) inf &= ~BCT_NEUTRAL; } - if( ud->skillid >= SL_SKE && ud->skillid <= SL_SKA && target->type == BL_MOB ) + if( ud->skill_id >= SL_SKE && ud->skill_id <= SL_SKA && target->type == BL_MOB ) { if( ((TBL_MOB*)target)->class_ == MOBID_EMPERIUM ) break; } else if (inf && battle_check_target(src, target, inf) <= 0){ - if (sd) clif_skill_fail(sd,ud->skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); break; } if(inf&BCT_ENEMY && (sc = status_get_sc(target)) && sc->data[SC_FOGWALL] && rnd() % 100 < 75) { //Fogwall makes all offensive-type targetted skills fail at 75% - if (sd) clif_skill_fail(sd, ud->skillid, USESKILL_FAIL_LEVEL, 0); + if (sd) clif_skill_fail(sd, ud->skill_id, USESKILL_FAIL_LEVEL, 0); break; } } //Avoid doing double checks for instant-cast skills. - if (tid != INVALID_TIMER && !status_check_skilluse(src, target, ud->skillid, 1)) + if (tid != INVALID_TIMER && !status_check_skilluse(src, target, ud->skill_id, 1)) break; if(md) { md->last_thinktime=tick +MIN_MOBTHINKTIME; - if(md->skillidx >= 0 && md->db->skill[md->skillidx].emotion >= 0) - clif_emotion(src, md->db->skill[md->skillidx].emotion); + if(md->skill_idx >= 0 && md->db->skill[md->skill_idx].emotion >= 0) + clif_emotion(src, md->db->skill[md->skill_idx].emotion); } if(src != target && battle_config.skill_add_range && - !check_distance_bl(src, target, skill_get_range2(src,ud->skillid,ud->skilllv)+battle_config.skill_add_range)) + !check_distance_bl(src, target, skill_get_range2(src,ud->skill_id,ud->skill_lv)+battle_config.skill_add_range)) { if (sd) { - clif_skill_fail(sd,ud->skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); if(battle_config.skill_out_range_consume) //Consume items anyway. [Skotlex] - skill_consume_requirement(sd,ud->skillid,ud->skilllv,3); + skill_consume_requirement(sd,ud->skill_id,ud->skill_lv,3); } break; } if( sd ) { - if( !skill_check_condition_castend(sd, ud->skillid, ud->skilllv) ) + if( !skill_check_condition_castend(sd, ud->skill_id, ud->skill_lv) ) break; else - skill_consume_requirement(sd,ud->skillid,ud->skilllv,1); + skill_consume_requirement(sd,ud->skill_id,ud->skill_lv,1); } #ifdef OFFICIAL_WALKPATH if( !path_search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) ) break; #endif - if( (src->type == BL_MER || src->type == BL_HOM) && !skill_check_condition_mercenary(src, ud->skillid, ud->skilllv, 1) ) + if( (src->type == BL_MER || src->type == BL_HOM) && !skill_check_condition_mercenary(src, ud->skill_id, ud->skill_lv, 1) ) break; - if (ud->state.running && ud->skillid == TK_JUMPKICK) + if (ud->state.running && ud->skill_id == TK_JUMPKICK) { ud->state.running = 0; status_change_end(src, SC_RUN, INVALID_TIMER); flag = 1; } - if (ud->walktimer != INVALID_TIMER && ud->skillid != TK_RUN && ud->skillid != RA_WUGDASH) + if (ud->walktimer != INVALID_TIMER && ud->skill_id != TK_RUN && ud->skill_id != RA_WUGDASH) unit_stop_walking(src,1); - if( !sd || sd->skillitem != ud->skillid || skill_get_delay(ud->skillid,ud->skilllv) ) - ud->canact_tick = tick + skill_delayfix(src, ud->skillid, ud->skilllv); //Tests show wings don't overwrite the delay but skill scrolls do. [Inkfish] + if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) ) + ud->canact_tick = tick + skill_delayfix(src, ud->skill_id, ud->skill_lv); //Tests show wings don't overwrite the delay but skill scrolls do. [Inkfish] if (sd) { //Cooldown application - int i, cooldown = skill_get_cooldown(ud->skillid, ud->skilllv); + int i, cooldown = skill_get_cooldown(ud->skill_id, ud->skill_lv); for (i = 0; i < ARRAYLENGTH(sd->skillcooldown) && sd->skillcooldown[i].id; i++) { // Increases/Decreases cooldown of a skill by item/card bonuses. - if (sd->skillcooldown[i].id == ud->skillid){ + if (sd->skillcooldown[i].id == ud->skill_id){ cooldown += sd->skillcooldown[i].val; break; } } if(cooldown) - skill_blockpc_start(sd, ud->skillid, cooldown); + skill_blockpc_start(sd, ud->skill_id, cooldown); } if( battle_config.display_status_timers && sd ) - clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, ud->skillid, ud->skilllv), 0, 0, 0); + clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); if( sd ) { - switch( ud->skillid ) + switch( ud->skill_id ) { case GS_DESPERADO: - sd->canequip_tick = tick + skill_get_time(ud->skillid, ud->skilllv); + sd->canequip_tick = tick + skill_get_time(ud->skill_id, ud->skill_lv); break; case CR_GRANDCROSS: case NPC_GRANDDARKNESS: if( (sc = status_get_sc(src)) && sc->data[SC_STRIPSHIELD] ) { const struct TimerData *timer = get_timer(sc->data[SC_STRIPSHIELD]->timer); - if( timer && timer->func == status_change_timer && DIFF_TICK(timer->tick,gettick()+skill_get_time(ud->skillid, ud->skilllv)) > 0 ) + if( timer && timer->func == status_change_timer && DIFF_TICK(timer->tick,gettick()+skill_get_time(ud->skill_id, ud->skill_lv)) > 0 ) break; } - sc_start2(src, SC_STRIPSHIELD, 100, 0, 1, skill_get_time(ud->skillid, ud->skilllv)); + sc_start2(src, SC_STRIPSHIELD, 100, 0, 1, skill_get_time(ud->skill_id, ud->skill_lv)); break; } } - if (skill_get_state(ud->skillid) != ST_MOVE_ENABLE) - unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill_get_walkdelay(ud->skillid, ud->skilllv), 1); + if (skill_get_state(ud->skill_id) != ST_MOVE_ENABLE) + unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill_get_walkdelay(ud->skill_id, ud->skill_lv), 1); if(battle_config.skill_log && battle_config.skill_log&src->type) ShowInfo("Type %d, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n", - src->type, src->id, ud->skillid, ud->skilllv, target->id); + src->type, src->id, ud->skill_id, ud->skill_lv, target->id); map_freeblock_lock(); // SC_MAGICPOWER needs to switch states before any damage is actually dealt - skill_toggle_magicpower(src, ud->skillid); - if( ud->skillid != RA_CAMOUFLAGE ) // only normal attack and auto cast skills benefit from its bonuses + skill_toggle_magicpower(src, ud->skill_id); + if( ud->skill_id != RA_CAMOUFLAGE ) // only normal attack and auto cast skills benefit from its bonuses status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER); - if (skill_get_casttype(ud->skillid) == CAST_NODAMAGE) - skill_castend_nodamage_id(src,target,ud->skillid,ud->skilllv,tick,flag); + if (skill_get_casttype(ud->skill_id) == CAST_NODAMAGE) + skill_castend_nodamage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); else - skill_castend_damage_id(src,target,ud->skillid,ud->skilllv,tick,flag); + skill_castend_damage_id(src,target,ud->skill_id,ud->skill_lv,tick,flag); sc = status_get_sc(src); if(sc && sc->count) { if(sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_WIZARD && - sc->data[SC_SPIRIT]->val3 == ud->skillid && - ud->skillid != WZ_WATERBALL) + sc->data[SC_SPIRIT]->val3 == ud->skill_id && + ud->skill_id != WZ_WATERBALL) sc->data[SC_SPIRIT]->val3 = 0; //Clear bounced spell check. - if( sc->data[SC_DANCING] && skill_get_inf2(ud->skillid)&INF2_SONG_DANCE && sd ) + if( sc->data[SC_DANCING] && skill_get_inf2(ud->skill_id)&INF2_SONG_DANCE && sd ) skill_blockpc_start(sd,BD_ADAPTATION,3000); } - if( sd && ud->skillid != SA_ABRACADABRA && ud->skillid != WM_RANDOMIZESPELL ) // they just set the data so leave it as it is.[Inkfish] + if( sd && ud->skill_id != SA_ABRACADABRA && ud->skill_id != WM_RANDOMIZESPELL ) // they just set the data so leave it as it is.[Inkfish] sd->skillitem = sd->skillitemlv = 0; if (ud->skilltimer == INVALID_TIMER) { - if(md) md->skillidx = -1; - else ud->skillid = 0; //mobs can't clear this one as it is used for skill condition 'afterskill' - ud->skilllv = ud->skilltarget = 0; + if(md) md->skill_idx = -1; + else ud->skill_id = 0; //mobs can't clear this one as it is used for skill condition 'afterskill' + ud->skill_lv = ud->skilltarget = 0; } map_freeblock_unlock(); return 1; } while(0); //Skill failed. - if (ud->skillid == MO_EXTREMITYFIST && sd && !(sc && sc->data[SC_FOGWALL])) + if (ud->skill_id == MO_EXTREMITYFIST && sd && !(sc && sc->data[SC_FOGWALL])) { //When Asura fails... (except when it fails from Fog of Wall) //Consume SP/spheres - skill_consume_requirement(sd,ud->skillid, ud->skilllv,1); + skill_consume_requirement(sd,ud->skill_id, ud->skill_lv,1); status_set_sp(src, 0, 0); sc = &sd->sc; if (sc->count) @@ -9362,7 +9363,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); #ifdef RENEWAL - sc_start(src, SC_EXTREMITYFIST2, 100, ud->skilllv, skill_get_time(ud->skillid, ud->skilllv)); + sc_start(src, SC_EXTREMITYFIST2, 100, ud->skill_lv, skill_get_time(ud->skill_id, ud->skill_lv)); #endif } if (target && target->m == src->m) @@ -9378,14 +9379,14 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) if (unit_movepos(src, src->x+dx, src->y+dy, 1, 1)) { //Display movement + animation. clif_slide(src,src->x,src->y); - clif_skill_damage(src,target,tick,sd->battle_status.amotion,0,0,1,ud->skillid, ud->skilllv, 5); + clif_skill_damage(src,target,tick,sd->battle_status.amotion,0,0,1,ud->skill_id, ud->skill_lv, 5); } - clif_skill_fail(sd,ud->skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); } } - ud->skillid = ud->skilllv = ud->skilltarget = 0; - if( !sd || sd->skillitem != ud->skillid || skill_get_delay(ud->skillid,ud->skilllv) ) + ud->skill_id = ud->skill_lv = ud->skilltarget = 0; + if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) ) ud->canact_tick = tick; //You can't place a skill failed packet here because it would be //sent in ALL cases, even cases where skill_check_condition fails @@ -9393,7 +9394,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) if(sd) sd->skillitem = sd->skillitemlv = 0; else if(md) - md->skillidx = -1; + md->skill_idx = -1; return 0; } @@ -9425,7 +9426,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) return 0; } - if( sd && ud->skilltimer != INVALID_TIMER && ( pc_checkskill(sd,SA_FREECAST) > 0 || ud->skillid == LG_EXEEDBREAK ) ) + if( sd && ud->skilltimer != INVALID_TIMER && ( pc_checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) ) {// restore original walk speed ud->skilltimer = INVALID_TIMER; status_calc_bl(&sd->bl, SCB_SPEED); @@ -9437,121 +9438,121 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) break; if( !(src->type&battle_config.skill_reiteration) && - skill_get_unit_flag(ud->skillid)&UF_NOREITERATION && - skill_check_unit_range(src,ud->skillx,ud->skilly,ud->skillid,ud->skilllv) + skill_get_unit_flag(ud->skill_id)&UF_NOREITERATION && + skill_check_unit_range(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv) ) { - if (sd) clif_skill_fail(sd,ud->skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); break; } if( src->type&battle_config.skill_nofootset && - skill_get_unit_flag(ud->skillid)&UF_NOFOOTSET && - skill_check_unit_range2(src,ud->skillx,ud->skilly,ud->skillid,ud->skilllv) + skill_get_unit_flag(ud->skill_id)&UF_NOFOOTSET && + skill_check_unit_range2(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv) ) { - if (sd) clif_skill_fail(sd,ud->skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); break; } if( src->type&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(ud->skillid, ud->skilllv)) > 0 + (maxcount = skill_get_maxcount(ud->skill_id, ud->skill_lv)) > 0 ) { int i; for(i=0;i<MAX_SKILLUNITGROUP && ud->skillunit[i] && maxcount;i++) { - if(ud->skillunit[i]->skill_id == ud->skillid) + if(ud->skillunit[i]->skill_id == ud->skill_id) maxcount--; } if( maxcount == 0 ) { - if (sd) clif_skill_fail(sd,ud->skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0); break; } } if(tid != INVALID_TIMER) { //Avoid double checks on instant cast skills. [Skotlex] - if (!status_check_skilluse(src, NULL, ud->skillid, 1)) + if (!status_check_skilluse(src, NULL, ud->skill_id, 1)) break; if(battle_config.skill_add_range && - !check_distance_blxy(src, ud->skillx, ud->skilly, skill_get_range2(src,ud->skillid,ud->skilllv)+battle_config.skill_add_range)) { + !check_distance_blxy(src, ud->skillx, ud->skilly, skill_get_range2(src,ud->skill_id,ud->skill_lv)+battle_config.skill_add_range)) { if (sd && battle_config.skill_out_range_consume) //Consume items anyway. - skill_consume_requirement(sd,ud->skillid,ud->skilllv,3); + skill_consume_requirement(sd,ud->skill_id,ud->skill_lv,3); break; } } if( sd ) { - if( !skill_check_condition_castend(sd, ud->skillid, ud->skilllv) ) + if( !skill_check_condition_castend(sd, ud->skill_id, ud->skill_lv) ) break; else - skill_consume_requirement(sd,ud->skillid,ud->skilllv,1); + skill_consume_requirement(sd,ud->skill_id,ud->skill_lv,1); } - if( (src->type == BL_MER || src->type == BL_HOM) && !skill_check_condition_mercenary(src, ud->skillid, ud->skilllv, 1) ) + if( (src->type == BL_MER || src->type == BL_HOM) && !skill_check_condition_mercenary(src, ud->skill_id, ud->skill_lv, 1) ) break; if(md) { md->last_thinktime=tick +MIN_MOBTHINKTIME; - if(md->skillidx >= 0 && md->db->skill[md->skillidx].emotion >= 0) - clif_emotion(src, md->db->skill[md->skillidx].emotion); + if(md->skill_idx >= 0 && md->db->skill[md->skill_idx].emotion >= 0) + clif_emotion(src, md->db->skill[md->skill_idx].emotion); } if(battle_config.skill_log && battle_config.skill_log&src->type) ShowInfo("Type %d, ID %d skill castend pos [id =%d, lv=%d, (%d,%d)]\n", - src->type, src->id, ud->skillid, ud->skilllv, ud->skillx, ud->skilly); + src->type, src->id, ud->skill_id, ud->skill_lv, ud->skillx, ud->skilly); if (ud->walktimer != INVALID_TIMER) unit_stop_walking(src,1); - if( !sd || sd->skillitem != ud->skillid || skill_get_delay(ud->skillid,ud->skilllv) ) - ud->canact_tick = tick + skill_delayfix(src, ud->skillid, ud->skilllv); + if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) ) + ud->canact_tick = tick + skill_delayfix(src, ud->skill_id, ud->skill_lv); if (sd) { //Cooldown application - int i, cooldown = skill_get_cooldown(ud->skillid, ud->skilllv); + int i, cooldown = skill_get_cooldown(ud->skill_id, ud->skill_lv); for (i = 0; i < ARRAYLENGTH(sd->skillcooldown) && sd->skillcooldown[i].id; i++) { // Increases/Decreases cooldown of a skill by item/card bonuses. - if (sd->skillcooldown[i].id == ud->skillid){ + if (sd->skillcooldown[i].id == ud->skill_id){ cooldown += sd->skillcooldown[i].val; break; } } if(cooldown) - skill_blockpc_start(sd, ud->skillid, cooldown); + skill_blockpc_start(sd, ud->skill_id, cooldown); } if( battle_config.display_status_timers && sd ) - clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, ud->skillid, ud->skilllv), 0, 0, 0); + clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); // if( sd ) // { -// switch( ud->skillid ) +// switch( ud->skill_id ) // { // case ????: // sd->canequip_tick = tick + ????; // break; // } // } - unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill_get_walkdelay(ud->skillid, ud->skilllv), 1); + unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill_get_walkdelay(ud->skill_id, ud->skill_lv), 1); status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER);// only normal attack and auto cast skills benefit from its bonuses map_freeblock_lock(); - skill_castend_pos2(src,ud->skillx,ud->skilly,ud->skillid,ud->skilllv,tick,0); + skill_castend_pos2(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv,tick,0); if( sd && sd->skillitem != AL_WARP ) // Warp-Portal thru items will clear data in skill_castend_map. [Inkfish] sd->skillitem = sd->skillitemlv = 0; if (ud->skilltimer == INVALID_TIMER) { - if (md) md->skillidx = -1; - else ud->skillid = 0; //Non mobs can't clear this one as it is used for skill condition 'afterskill' - ud->skilllv = ud->skillx = ud->skilly = 0; + if (md) md->skill_idx = -1; + else ud->skill_id = 0; //Non mobs can't clear this one as it is used for skill condition 'afterskill' + ud->skill_lv = ud->skillx = ud->skilly = 0; } map_freeblock_unlock(); return 1; } while(0); - if( !sd || sd->skillitem != ud->skillid || skill_get_delay(ud->skillid,ud->skilllv) ) + if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) ) ud->canact_tick = tick; - ud->skillid = ud->skilllv = 0; + ud->skill_id = ud->skill_lv = 0; if(sd) sd->skillitem = sd->skillitemlv = 0; else if(md) - md->skillidx = -1; + md->skill_idx = -1; return 0; } @@ -9559,7 +9560,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) /*========================================== * *------------------------------------------*/ -int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int skilllv, unsigned int tick, int flag) +int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { struct map_session_data* sd; struct status_change* sc; @@ -9568,8 +9569,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk enum sc_type type; int i; - //if(skilllv <= 0) return 0; - if(skillid > 0 && skilllv <= 0) return 0; // celest + //if(skill_lv <= 0) return 0; + if(skill_id > 0 && skill_lv <= 0) return 0; // celest nullpo_ret(src); @@ -9579,10 +9580,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk sd = BL_CAST(BL_PC, src); sc = status_get_sc(src); - type = status_skill2sc(skillid); + type = status_skill2sc(skill_id); sce = (sc && type != -1)?sc->data[type]:NULL; - switch (skillid) { //Skill effect. + switch (skill_id) { //Skill effect. case WZ_METEOR: case MO_BODYRELOCATION: case CR_CULTIVATION: @@ -9590,40 +9591,40 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case LG_EARTHDRIVE: break; //Effect is displayed on respective switch case. default: - if(skill_get_inf(skillid)&INF_SELF_SKILL) - clif_skill_nodamage(src,src,skillid,skilllv,1); + if(skill_get_inf(skill_id)&INF_SELF_SKILL) + clif_skill_nodamage(src,src,skill_id,skill_lv,1); else - clif_skill_poseffect(src,skillid,skilllv,x,y,tick); + clif_skill_poseffect(src,skill_id,skill_lv,x,y,tick); } // SC_MAGICPOWER needs to switch states before any damage is actually dealt - skill_toggle_magicpower(src, skillid); + skill_toggle_magicpower(src, skill_id); - switch(skillid) + switch(skill_id) { case PR_BENEDICTIO: skill_area_temp[1] = src->id; - i = skill_get_splash(skillid, skilllv); + i = skill_get_splash(skill_id, skill_lv); map_foreachinarea(skill_area_sub, src->m, x-i, y-i, x+i, y+i, BL_PC, - src, skillid, skilllv, tick, flag|BCT_ALL|1, + src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill_castend_nodamage_id); map_foreachinarea(skill_area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR, - src, skillid, skilllv, tick, flag|BCT_ENEMY|1, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); break; case BS_HAMMERFALL: - i = skill_get_splash(skillid, skilllv); + i = 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, skillid, skilllv, tick, flag|BCT_ENEMY|2, + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|2, skill_castend_nodamage_id); break; case HT_DETECTING: - i = skill_get_splash(skillid, skilllv); + i = skill_get_splash(skill_id, skill_lv); map_foreachinarea( status_change_timer_sub, src->m, x-i, y-i, x+i,y+i,BL_CHAR, src,NULL,SC_SIGHT,tick); @@ -9633,9 +9634,9 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk break; case SR_RIDEINLIGHTNING: - i = skill_get_splash(skillid, skilllv); + i = 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, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); + src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); break; case SA_VOLCANO: @@ -9647,13 +9648,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk { if (sg->limit - DIFF_TICK(gettick(), sg->tick) > 0) { - skill_unitsetting(src,skillid,skilllv,x,y,0); + skill_unitsetting(src,skill_id,skill_lv,x,y,0); return 0; // not to consume items } else sg->limit = 0; //Disable it. } - skill_unitsetting(src,skillid,skilllv,x,y,0); + skill_unitsetting(src,skill_id,skill_lv,x,y,0); break; } case MG_SAFETYWALL: @@ -9763,11 +9764,11 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case MH_XENO_SLASHER: flag|=1;//Set flag to 1 to prevent deleting ammo (it will be deleted on group-delete). case GS_GROUNDDRIFT: //Ammo should be deleted right away. - skill_unitsetting(src,skillid,skilllv,x,y,0); + skill_unitsetting(src,skill_id,skill_lv,x,y,0); break; case RG_GRAFFITI: /* Graffiti [Valaris] */ skill_clear_unitgroup(src); - skill_unitsetting(src,skillid,skilllv,x,y,0); + skill_unitsetting(src,skill_id,skill_lv,x,y,0); flag|=1; break; case HP_BASILICA: @@ -9776,59 +9777,59 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk else { // Create Basilica. Start SC on caster. Unit timer start SC on others. skill_clear_unitgroup(src); - if( skill_unitsetting(src,skillid,skilllv,x,y,0) ) - sc_start4(src,type,100,skilllv,0,0,src->id,skill_get_time(skillid,skilllv)); + if( skill_unitsetting(src,skill_id,skill_lv,x,y,0) ) + sc_start4(src,type,100,skill_lv,0,0,src->id,skill_get_time(skill_id,skill_lv)); flag|=1; } break; case CG_HERMODE: skill_clear_unitgroup(src); - if ((sg = skill_unitsetting(src,skillid,skilllv,x,y,0))) + if ((sg = skill_unitsetting(src,skill_id,skill_lv,x,y,0))) sc_start4(src,SC_DANCING,100, - skillid,0,skilllv,sg->group_id,skill_get_time(skillid,skilllv)); + skill_id,0,skill_lv,sg->group_id,skill_get_time(skill_id,skill_lv)); flag|=1; break; case RG_CLEANER: // [Valaris] - i = skill_get_splash(skillid, skilllv); + i = skill_get_splash(skill_id, skill_lv); map_foreachinarea(skill_graffitiremover,src->m,x-i,y-i,x+i,y+i,BL_SKILL); break; case SO_WARMER: flag|= 8; case SO_CLOUD_KILL: - skill_unitsetting(src,skillid,skilllv,x,y,0); + skill_unitsetting(src,skill_id,skill_lv,x,y,0); break; case WZ_METEOR: { - int area = skill_get_splash(skillid, skilllv); + int area = skill_get_splash(skill_id, skill_lv); short tmpx = 0, tmpy = 0, x1 = 0, y1 = 0; - for( i = 0; i < 2 + (skilllv>>1); i++ ) { + for( i = 0; i < 2 + (skill_lv>>1); i++ ) { // Creates a random Cell in the Splash Area tmpx = x - area + rnd()%(area * 2 + 1); tmpy = y - area + rnd()%(area * 2 + 1); if( i == 0 && path_search_long(NULL, src->m, src->x, src->y, tmpx, tmpy, CELL_CHKWALL) ) - clif_skill_poseffect(src,skillid,skilllv,tmpx,tmpy,tick); + clif_skill_poseffect(src,skill_id,skill_lv,tmpx,tmpy,tick); if( i > 0 ) - skill_addtimerskill(src,tick+i*1000,0,tmpx,tmpy,skillid,skilllv,(x1<<16)|y1,0); + skill_addtimerskill(src,tick+i*1000,0,tmpx,tmpy,skill_id,skill_lv,(x1<<16)|y1,0); x1 = tmpx; y1 = tmpy; } - skill_addtimerskill(src,tick+i*1000,0,tmpx,tmpy,skillid,skilllv,-1,0); + skill_addtimerskill(src,tick+i*1000,0,tmpx,tmpy,skill_id,skill_lv,-1,0); } break; case AL_WARP: if(sd) { - clif_skill_warppoint(sd, skillid, skilllv, sd->status.save_point.map, - (skilllv >= 2) ? sd->status.memo_point[0].map : 0, - (skilllv >= 3) ? sd->status.memo_point[1].map : 0, - (skilllv >= 4) ? sd->status.memo_point[2].map : 0 + clif_skill_warppoint(sd, skill_id, skill_lv, sd->status.save_point.map, + (skill_lv >= 2) ? sd->status.memo_point[0].map : 0, + (skill_lv >= 3) ? sd->status.memo_point[1].map : 0, + (skill_lv >= 4) ? sd->status.memo_point[2].map : 0 ); } return 0; // not to consume item. @@ -9838,7 +9839,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk #if PACKETVER >= 20111005 clif_snap(src, src->x, src->y); #else - clif_skill_poseffect(src,skillid,skilllv,src->x,src->y,tick); + clif_skill_poseffect(src,skill_id,skill_lv,src->x,src->y,tick); #endif if (sd) skill_blockpc_start (sd, MO_EXTREMITYFIST, 2000); @@ -9856,17 +9857,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk { int summons[5] = { 1589, 1579, 1575, 1555, 1590 }; //int summons[5] = { 1020, 1068, 1118, 1500, 1368 }; - int class_ = skillid==AM_SPHEREMINE?1142:summons[skilllv-1]; + int class_ = skill_id==AM_SPHEREMINE?1142:summons[skill_lv-1]; struct mob_data *md; // Correct info, don't change any of this! [celest] md = mob_once_spawn_sub(src, src->m, x, y, status_get_name(src), class_, "", SZ_SMALL, AI_NONE); if (md) { md->master_id = src->id; - md->special_state.ai = (skillid == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA; + md->special_state.ai = (skill_id == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA; if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer (gettick() + skill_get_time(skillid,skilllv), mob_timer_delete, md->bl.id, 0); + md->deletetimer = add_timer (gettick() + skill_get_time(skill_id,skill_lv), mob_timer_delete, md->bl.id, 0); mob_spawn (md); //Now it is ready for spawning. } } @@ -9875,11 +9876,11 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk // Slim Pitcher [Celest] case CR_SLIMPITCHER: if (sd) { - int i = skilllv%11 - 1; - int j = pc_search_inventory(sd,skill_db[skillid].itemid[i]); - if( j < 0 || skill_db[skillid].itemid[i] <= 0 || sd->inventory_data[j] == NULL || sd->status.inventory[j].amount < skill_db[skillid].amount[i] ) + int i = skill_lv%11 - 1; + int j = pc_search_inventory(sd,skill_db[skill_id].itemid[i]); + if( j < 0 || skill_db[skill_id].itemid[i] <= 0 || sd->inventory_data[j] == NULL || sd->status.inventory[j].amount < skill_db[skill_id].amount[i] ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } potion_flag = 1; @@ -9891,22 +9892,22 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk i = pc_checkskill(sd,CR_SLIMPITCHER)*10 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5 - + pc_skillheal_bonus(sd, skillid); + + pc_skillheal_bonus(sd, skill_id); potion_hp = potion_hp * (100+i)/100; potion_sp = potion_sp * (100+i)/100; if(potion_hp > 0 || potion_sp > 0) { - i = skill_get_splash(skillid, skilllv); + i = 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,skillid,skilllv,tick,flag|BCT_PARTY|BCT_GUILD|1, + src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1, skill_castend_nodamage_id); } } else { - int i = skilllv%11 - 1; + int i = skill_lv%11 - 1; struct item_data *item; - i = skill_db[skillid].itemid[i]; + i = skill_db[skill_id].itemid[i]; item = itemdb_search(i); potion_flag = 1; potion_hp = 0; @@ -9919,10 +9920,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk potion_sp = potion_sp * (100+i)/100; if(potion_hp > 0 || potion_sp > 0) { - i = skill_get_splash(skillid, skilllv); + i = 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,skillid,skilllv,tick,flag|BCT_PARTY|BCT_GUILD|1, + src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1, skill_castend_nodamage_id); } } @@ -9931,18 +9932,18 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case HW_GANBANTEIN: if (rnd()%100 < 80) { int dummy = 1; - clif_skill_poseffect(src,skillid,skilllv,x,y,tick); - i = skill_get_splash(skillid, skilllv); + clif_skill_poseffect(src,skill_id,skill_lv,x,y,tick); + i = skill_get_splash(skill_id, skill_lv); map_foreachinarea(skill_cell_overlap, src->m, x-i, y-i, x+i, y+i, BL_SKILL, HW_GANBANTEIN, &dummy, src); } else { - if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } break; case HW_GRAVITATION: - if ((sg = skill_unitsetting(src,skillid,skilllv,x,y,0))) - sc_start4(src,type,100,skilllv,0,BCT_SELF,sg->group_id,skill_get_time(skillid,skilllv)); + if ((sg = skill_unitsetting(src,skill_id,skill_lv,x,y,0))) + sc_start4(src,type,100,skill_lv,0,BCT_SELF,sg->group_id,skill_get_time(skill_id,skill_lv)); flag|=1; break; @@ -9951,17 +9952,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk if (sd) { if( map_count_oncell(src->m,x,y,BL_CHAR) > 0 ) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } - clif_skill_poseffect(src,skillid,skilllv,x,y,tick); + clif_skill_poseffect(src,skill_id,skill_lv,x,y,tick); if (rnd()%100 < 50) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); } else { - TBL_MOB* md = mob_once_spawn_sub(src, src->m, x, y, "--ja--",(skilllv < 2 ? 1084+rnd()%2 : 1078+rnd()%6),"", SZ_SMALL, AI_NONE); + TBL_MOB* md = mob_once_spawn_sub(src, src->m, x, y, "--ja--",(skill_lv < 2 ? 1084+rnd()%2 : 1078+rnd()%6),"", SZ_SMALL, AI_NONE); int i; if (!md) break; - if ((i = skill_get_time(skillid, skilllv)) > 0) + if ((i = skill_get_time(skill_id, skill_lv)) > 0) { if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); @@ -9976,8 +9977,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case SG_MOON_WARM: case SG_STAR_WARM: skill_clear_unitgroup(src); - if ((sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0))) - sc_start4(src,type,100,skilllv,0,0,sg->group_id,skill_get_time(skillid,skilllv)); + if ((sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0))) + sc_start4(src,type,100,skill_lv,0,0,sg->group_id,skill_get_time(skill_id,skill_lv)); flag|=1; break; @@ -9989,39 +9990,39 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk } else { - sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0); + sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0); if (!sg) break; if (sce) status_change_end(src, type, INVALID_TIMER); //Was under someone else's Gospel. [Skotlex] - sc_start4(src,type,100,skilllv,0,sg->group_id,BCT_SELF,skill_get_time(skillid,skilllv)); - clif_skill_poseffect(src, skillid, skilllv, 0, 0, tick); // PA_GOSPEL music packet + sc_start4(src,type,100,skill_lv,0,sg->group_id,BCT_SELF,skill_get_time(skill_id,skill_lv)); + clif_skill_poseffect(src, skill_id, skill_lv, 0, 0, tick); // PA_GOSPEL music packet } break; case NJ_TATAMIGAESHI: - if (skill_unitsetting(src,skillid,skilllv,src->x,src->y,0)) - sc_start(src,type,100,skilllv,skill_get_time2(skillid,skilllv)); + if (skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) + sc_start(src,type,100,skill_lv,skill_get_time2(skill_id,skill_lv)); break; case AM_RESURRECTHOMUN: //[orn] if (sd) { - if (!merc_resurrect_homunculus(sd, 20*skilllv, x, y)) + if (!merc_resurrect_homunculus(sd, 20*skill_lv, x, y)) { - clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } } break; - + case RK_WINDCUTTER: - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); case NC_COLDSLOWER: case NC_ARMSCANNON: case RK_DRAGONBREATH: case WM_LULLABY_DEEPSLEEP: - i = skill_get_splash(skillid,skilllv); + i = skill_get_splash(skill_id,skill_lv); map_foreachinarea(skill_area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), - src,skillid,skilllv,tick,flag|(skillid==WM_LULLABY_DEEPSLEEP?BCT_ALL:BCT_ENEMY)|1,skill_castend_damage_id); + src,skill_id,skill_lv,tick,flag|(skill_id==WM_LULLABY_DEEPSLEEP?BCT_ALL:BCT_ENEMY)|1,skill_castend_damage_id); break; /** * Guilotine Cross @@ -10029,18 +10030,18 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case GC_POISONSMOKE: if( !(sc && sc->data[SC_POISONINGWEAPON]) ) { if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL_GC_POISONINGWEAPON,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_GC_POISONINGWEAPON,0); return 0; } - clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skillid,skilllv,6); - skill_unitsetting(src, skillid, skilllv, x, y, flag); + clif_skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6); + skill_unitsetting(src, skill_id, skill_lv, x, y, flag); //status_change_end(src,SC_POISONINGWEAPON,INVALID_TIMER); // 08/31/2011 - When using poison smoke, you no longer lose the poisoning weapon effect. break; /** * Arch Bishop **/ case AB_EPICLESIS: - if( (sg = skill_unitsetting(src, skillid, skilllv, x, y, 0)) ) { + if( (sg = skill_unitsetting(src, skill_id, skill_lv, x, y, 0)) ) { i = sg->unit->range; map_foreachinarea(skill_area_sub, src->m, x - i, y - i, x + i, y + i, BL_CHAR, src, ALL_RESURRECTION, 1, tick, flag|BCT_NOENEMY|1,skill_castend_nodamage_id); } @@ -10053,13 +10054,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk sc->comet_x = x; sc->comet_y = y; } - i = skill_get_splash(skillid,skilllv); - map_foreachinarea(skill_area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + i = skill_get_splash(skill_id,skill_lv); + map_foreachinarea(skill_area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); break; case WL_EARTHSTRAIN: { - int i, wave = skilllv + 4, dir = map_calc_dir(src,x,y); + int i, wave = skill_lv + 4, dir = map_calc_dir(src,x,y); int sx = x = src->x, sy = y = src->y; // Store first caster's location to avoid glitch on unit setting for( i = 1; i <= wave; i++ ) @@ -10070,7 +10071,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case 2: sx = x - i; break; case 6: sx = x + i; break; } - skill_addtimerskill(src,gettick() + (150 * i),0,sx,sy,skillid,skilllv,dir,flag&2); + skill_addtimerskill(src,gettick() + (150 * i),0,sx,sy,skill_id,skill_lv,dir,flag&2); } } break; @@ -10078,9 +10079,9 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk * Ranger **/ case RA_DETONATOR: - i = skill_get_splash(skillid, skilllv); + i = skill_get_splash(skill_id, skill_lv); map_foreachinarea(skill_detonator, src->m, x-i, y-i, x+i, y+i, BL_SKILL, src); - clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); + clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; /** * Mechanic @@ -10088,8 +10089,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case NC_NEUTRALBARRIER: case NC_STEALTHFIELD: skill_clear_unitgroup(src); // To remove previous skills - cannot used combined - if( (sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0)) != NULL ) { - sc_start2(src,skillid == NC_NEUTRALBARRIER ? SC_NEUTRALBARRIER_MASTER : SC_STEALTHFIELD_MASTER,100,skilllv,sg->group_id,skill_get_time(skillid,skilllv)); + if( (sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) { + sc_start2(src,skill_id == NC_NEUTRALBARRIER ? SC_NEUTRALBARRIER_MASTER : SC_STEALTHFIELD_MASTER,100,skill_lv,sg->group_id,skill_get_time(skill_id,skill_lv)); if( sd ) pc_overheat(sd,1); } break; @@ -10106,19 +10107,19 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk md->special_state.ai = AI_FLORA; if( md->deletetimer != INVALID_TIMER ) delete_timer(md->deletetimer, mob_timer_delete); - md->deletetimer = add_timer (gettick() + skill_get_time(skillid, skilllv), mob_timer_delete, md->bl.id, 0); + md->deletetimer = add_timer (gettick() + skill_get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0); mob_spawn( md ); } } break; case NC_MAGICDECOY: - if( sd ) clif_magicdecoy_list(sd,skilllv,x,y); + if( sd ) clif_magicdecoy_list(sd,skill_lv,x,y); break; case SC_FEINTBOMB: - clif_skill_nodamage(src,src,skillid,skilllv,1); - skill_unitsetting(src,skillid,skilllv,x,y,0); // Set bomb on current Position + clif_skill_nodamage(src,src,skill_id,skill_lv,1); + skill_unitsetting(src,skill_id,skill_lv,x,y,0); // Set bomb on current Position if( skill_blown(src,src,6,unit_getdir(src),0) ) skill_castend_nodamage_id(src,src,TF_HIDING,1,tick,0); break; @@ -10128,50 +10129,50 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk int width;//according to data from irowiki it actually is a square for( width = 0; width < 7; width++ ) for( i = 0; i < 7; i++ ) - map_foreachincell(skill_area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, LG_OVERBRAND_BRANDISH, skilllv, tick, flag|BCT_ENEMY,skill_castend_damage_id); + map_foreachincell(skill_area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, LG_OVERBRAND_BRANDISH, skill_lv, tick, flag|BCT_ENEMY,skill_castend_damage_id); for( width = 0; width < 7; width++ ) for( i = 0; i < 7; i++ ) - map_foreachincell(skill_area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY,skill_castend_damage_id); + map_foreachincell(skill_area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY,skill_castend_damage_id); } break; case LG_BANDING: if( sc && sc->data[SC_BANDING] ) status_change_end(src,SC_BANDING,INVALID_TIMER); - else if( (sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0)) != NULL ) { - sc_start4(src,SC_BANDING,100,skilllv,0,0,sg->group_id,skill_get_time(skillid,skilllv)); - if( sd ) pc_banding(sd,skilllv); + else if( (sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) { + sc_start4(src,SC_BANDING,100,skill_lv,0,0,sg->group_id,skill_get_time(skill_id,skill_lv)); + if( sd ) pc_banding(sd,skill_lv); } - clif_skill_nodamage(src,src,skillid,skilllv,1); + clif_skill_nodamage(src,src,skill_id,skill_lv,1); break; case LG_RAYOFGENESIS: - if( status_charge(src,status_get_max_hp(src)*3*skilllv / 100,0) ) { - i = skill_get_splash(skillid,skilllv); + if( status_charge(src,status_get_max_hp(src)*3*skill_lv / 100,0) ) { + i = skill_get_splash(skill_id,skill_lv); map_foreachinarea(skill_area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src), - src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); + src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); } else if( sd ) - clif_skill_fail(sd,skillid,USESKILL_FAIL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL,0); break; case WM_DOMINION_IMPULSE: - i = skill_get_splash(skillid, skilllv); + i = skill_get_splash(skill_id, skill_lv); map_foreachinarea( skill_ative_reverberation, src->m, x-i, y-i, x+i,y+i,BL_SKILL); break; case WM_GREAT_ECHO: flag|=1; // Should counsume 1 item per skill usage. - map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid,skilllv),splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY, skill_castend_damage_id); + map_foreachinrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill_castend_damage_id); break; case GN_CRAZYWEED: { - int area = skill_get_splash(GN_CRAZYWEED_ATK, skilllv); + int area = skill_get_splash(GN_CRAZYWEED_ATK, skill_lv); short x1 = 0, y1 = 0; - for( i = 0; i < 3 + (skilllv/2); i++ ) { + for( i = 0; i < 3 + (skill_lv/2); i++ ) { x1 = x - area + rnd()%(area * 2 + 1); y1 = y - area + rnd()%(area * 2 + 1); - skill_addtimerskill(src,tick+i*150,0,x1,y1,GN_CRAZYWEED_ATK,skilllv,-1,0); + skill_addtimerskill(src,tick+i*150,0,x1,y1,GN_CRAZYWEED_ATK,skill_lv,-1,0); } } break; @@ -10184,7 +10185,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk for( i = 0; i < MAX_SKILLUNITGROUP && ud->skillunit[i]; i ++ ) { if( ud->skillunit[i]->skill_id == GN_DEMONIC_FIRE && distance_xy(x, y, ud->skillunit[i]->unit->bl.x, ud->skillunit[i]->unit->bl.y) < 4 ) { - switch( skilllv ) { + switch( skill_lv ) { case 3: ud->skillunit[i]->unit_id = UNT_FIRE_EXPANSION_SMOKE_POWDER; clif_changetraplook(&ud->skillunit[i]->unit->bl, UNT_FIRE_EXPANSION_SMOKE_POWDER); @@ -10197,12 +10198,12 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk map_foreachinarea(skill_area_sub, src->m, ud->skillunit[i]->unit->bl.x - 3, ud->skillunit[i]->unit->bl.y - 3, ud->skillunit[i]->unit->bl.x + 3, ud->skillunit[i]->unit->bl.y + 3, BL_CHAR, - src, CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : skilllv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill_castend_damage_id); + src, CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill_castend_damage_id); skill_delunit(ud->skillunit[i]->unit); break; default: - ud->skillunit[i]->unit->val2 = skilllv; - ud->skillunit[i]->unit->group->val2 = skilllv; + ud->skillunit[i]->unit->val2 = skill_lv; + ud->skillunit[i]->unit->group->val2 = skill_lv; break; } } @@ -10214,25 +10215,25 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case SO_ELECTRICWALK: if( sc && sc->data[type] ) status_change_end(src,type,INVALID_TIMER); - clif_skill_nodamage(src, src ,skillid, skilllv, - sc_start2(src, type, 100, skillid, skilllv, skill_get_time(skillid, skilllv))); + clif_skill_nodamage(src, src ,skill_id, skill_lv, + sc_start2(src, type, 100, skill_id, skill_lv, skill_get_time(skill_id, skill_lv))); break; case SC_BLOODYLUST: //set in another group so instance will move if recasted flag |= 33; - skill_unitsetting(src, skillid, skilllv, x, y, 0); + skill_unitsetting(src, skill_id, skill_lv, x, y, 0); break; case KO_MAKIBISHI: - for( i = 0; i < (skilllv+2); i++ ) { + for( i = 0; i < (skill_lv+2); i++ ) { x = src->x - 1 + rnd()%3; y = src->y - 1 + rnd()%3; - skill_unitsetting(src,skillid,skilllv,x,y,0); + skill_unitsetting(src,skill_id,skill_lv,x,y,0); } break; default: - ShowWarning("skill_castend_pos2: Unknown skill used:%d\n",skillid); + ShowWarning("skill_castend_pos2: Unknown skill used:%d\n",skill_id); return 1; } @@ -10245,11 +10246,11 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk if( sd->state.arrow_atk && !(flag&1) ) {// consume arrow if this is a ground skill - battle_consume_ammo(sd, skillid, skilllv); + battle_consume_ammo(sd, skill_id, skill_lv); } // perform skill requirement consumption - skill_consume_requirement(sd,skillid,skilllv,2); + skill_consume_requirement(sd,skill_id,skill_lv,2); } return 0; @@ -10258,13 +10259,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk /*========================================== * *------------------------------------------*/ -int skill_castend_map (struct map_session_data *sd, short skill_num, const char *map) +int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char *map) { nullpo_ret(sd); //Simplify skill_failed code. #define skill_failed(sd) { sd->menuskill_id = sd->menuskill_val = 0; } - if(skill_num != sd->menuskill_id) + if(skill_id != sd->menuskill_id) return 0; if( sd->bl.prev == NULL || pc_isdead(sd) ) { @@ -10281,13 +10282,13 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char sd->sc.data[SC_ROKISWEIL] || sd->sc.data[SC_AUTOCOUNTER] || sd->sc.data[SC_STEELBODY] || - (sd->sc.data[SC_DANCING] && skill_num < RK_ENCHANTBLADE && !pc_checkskill(sd, WM_LESSON)) || + (sd->sc.data[SC_DANCING] && skill_id < RK_ENCHANTBLADE && !pc_checkskill(sd, WM_LESSON)) || sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || sd->sc.data[SC_BASILICA] || sd->sc.data[SC_MARIONETTE] || sd->sc.data[SC_WHITEIMPRISON] || - (sd->sc.data[SC_STASIS] && skill_block_check(&sd->bl, SC_STASIS, skill_num)) || - (sd->sc.data[SC_KAGEHUMI] && skill_block_check(&sd->bl, SC_KAGEHUMI, skill_num)) || + (sd->sc.data[SC_STASIS] && skill_block_check(&sd->bl, SC_STASIS, skill_id)) || + (sd->sc.data[SC_KAGEHUMI] && skill_block_check(&sd->bl, SC_KAGEHUMI, skill_id)) || sd->sc.data[SC_OBLIVIONCURSE] || sd->sc.data[SC__MANHOLE] || (sd->sc.data[SC_ASH] && rnd()%2) //50% fail chance under ASH @@ -10300,14 +10301,14 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char pc_stop_walking(sd,0); if(battle_config.skill_log && battle_config.skill_log&BL_PC) - ShowInfo("PC %d skill castend skill =%d map=%s\n",sd->bl.id,skill_num,map); + ShowInfo("PC %d skill castend skill =%d map=%s\n",sd->bl.id,skill_id,map); if(strcmp(map,"cancel")==0) { skill_failed(sd); return 0; } - switch(skill_num) + switch(skill_id) { case AL_TELEPORT: if(strcmp(map,"Random")==0) @@ -10327,7 +10328,7 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char mapindex = mapindex_name2id((char*)map); if(!mapindex) { //Given map not found? - clif_skill_fail(sd,skill_num,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); skill_failed(sd); return 0; } @@ -10336,19 +10337,19 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char p[2] = &sd->status.memo_point[1]; p[3] = &sd->status.memo_point[2]; - if((maxcount = skill_get_maxcount(skill_num, sd->menuskill_val)) > 0) { + if((maxcount = skill_get_maxcount(skill_id, sd->menuskill_val)) > 0) { for(i=0;i<MAX_SKILLUNITGROUP && sd->ud.skillunit[i] && maxcount;i++) { - if(sd->ud.skillunit[i]->skill_id == skill_num) + if(sd->ud.skillunit[i]->skill_id == skill_id) maxcount--; } if(!maxcount) { - clif_skill_fail(sd,skill_num,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); skill_failed(sd); return 0; } } - lv = sd->skillitem==skill_num?sd->skillitemlv:pc_checkskill(sd,skill_num); + lv = sd->skillitem==skill_id?sd->skillitemlv:pc_checkskill(sd,skill_id); wx = sd->menuskill_val>>16; wy = sd->menuskill_val&0xffff; @@ -10366,7 +10367,7 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char } if(!skill_check_condition_castend(sd, sd->menuskill_id, lv)) - { // This checks versus skillid/skilllv... + { // This checks versus skill_id/skill_lv... skill_failed(sd); return 0; } @@ -10374,7 +10375,7 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char skill_consume_requirement(sd,sd->menuskill_id,lv,2); sd->skillitem = sd->skillitemlv = 0; // Clear data that's skipped in 'skill_castend_pos' [Inkfish] - if((group=skill_unitsetting(&sd->bl,skill_num,lv,wx,wy,0))==NULL) { + if((group=skill_unitsetting(&sd->bl,skill_id,lv,wx,wy,0))==NULL) { skill_failed(sd); return 0; } @@ -10460,7 +10461,7 @@ static bool skill_dance_switch(struct skill_unit* unit, int flag) if( !flag ) { //Transform - int skillid = unit->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE; + uint16 skill_id = unit->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE; // backup backup.skill_id = group->skill_id; @@ -10471,12 +10472,12 @@ static bool skill_dance_switch(struct skill_unit* unit, int flag) backup.interval = group->interval; // replace - group->skill_id = skillid; + group->skill_id = skill_id; group->skill_lv = 1; - group->unit_id = skill_get_unit_id(skillid,0); - group->target_flag = skill_get_unit_target(skillid); - group->bl_flag = skill_get_unit_bl_target(skillid); - group->interval = skill_get_unit_interval(skillid); + group->unit_id = skill_get_unit_id(skill_id,0); + group->target_flag = skill_get_unit_target(skill_id); + group->bl_flag = skill_get_unit_bl_target(skill_id); + group->interval = skill_get_unit_interval(skill_id); } else { //Restore @@ -10516,7 +10517,7 @@ static int skill_icewall_block(struct block_list *bl,va_list ap) { * Initializes and sets a ground skill. * flag&1 is used to determine when the skill 'morphs' (Warp portal becomes active, or Fire Pillar becomes active) *------------------------------------------*/ -struct skill_unit_group* skill_unitsetting (struct block_list *src, short skillid, short skilllv, short x, short y, int flag) +struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag) { struct skill_unit_group *group; int i,limit,val1=0,val2=0,val3=0; @@ -10530,20 +10531,20 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli nullpo_retr(NULL, src); - limit = skill_get_time(skillid,skilllv); - range = skill_get_unit_range(skillid,skilllv); - interval = skill_get_unit_interval(skillid); - target = skill_get_unit_target(skillid); - unit_flag = skill_get_unit_flag(skillid); - layout = skill_get_unit_layout(skillid,skilllv,src,x,y); + limit = skill_get_time(skill_id,skill_lv); + range = skill_get_unit_range(skill_id,skill_lv); + interval = skill_get_unit_interval(skill_id); + target = skill_get_unit_target(skill_id); + unit_flag = skill_get_unit_flag(skill_id); + layout = skill_get_unit_layout(skill_id,skill_lv,src,x,y); sd = BL_CAST(BL_PC, src); status = status_get_status_data(src); sc = status_get_sc(src); // for traps, firewall and fogwall - celest - switch( skillid ) { + switch( skill_id ) { case MH_STEINWAND: - val2 = 4 + skilllv; //nb of attack blocked + val2 = 4 + skill_lv; //nb of attack blocked break; case MG_SAFETYWALL: #ifdef RENEWAL @@ -10552,17 +10553,17 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli **/ val2 = status_get_max_hp(src) * 3; #else - val2 = skilllv+1; + val2 = skill_lv+1; #endif break; case MG_FIREWALL: if(sc && sc->data[SC_VIOLENTGALE]) limit = limit*3/2; - val2=4+skilllv; + val2=4+skill_lv; break; case AL_WARP: - val1=skilllv+6; + val1=skill_lv+6; if(!(flag&1)) limit=2000; else // previous implementation (not used anymore) @@ -10581,13 +10582,13 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli case PR_SANCTUARY: case NPC_EVILLAND: - val1=(skilllv+3)*2; + val1=(skill_lv+3)*2; break; case WZ_FIREPILLAR: if((flag&1)!=0) limit=1000; - val1=skilllv+2; + val1=skill_lv+2; break; case WZ_QUAGMIRE: //The target changes to "all" if used in a gvg map. [Skotlex] case AM_DEMONSTRATION: @@ -10597,7 +10598,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli target = BCT_ALL; break; case HT_SHOCKWAVE: - val1=skilllv*15+10; + val1=skill_lv*15+10; case HT_SANDMAN: case MA_SANDMAN: case HT_CLAYMORETRAP: @@ -10622,7 +10623,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: { - struct skill_condition req = skill_get_requirement(sd,skillid,skilllv); + struct skill_condition req = skill_get_requirement(sd,skill_id,skill_lv); ARR_FIND(0, MAX_SKILL_ITEM_REQUIRE, i, req.itemid[i] && (req.itemid[i] == ITEMID_TRAP || req.itemid[i] == ITEMID_TRAP_ALLOY)); if( req.itemid[i] ) req_item = req.itemid[i]; @@ -10650,7 +10651,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli { //Use the previous limit (minus the elapsed time) [Skotlex] limit = old_sg->limit - DIFF_TICK(gettick(), old_sg->tick); if (limit < 0) //This can happen... - limit = skill_get_time(skillid,skilllv); + limit = skill_get_time(skill_id,skill_lv); } skill_clear_group(src,1); } @@ -10662,15 +10663,15 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli val1 = 10; //FIXME: This value is not used anywhere, what is it for? [Skotlex] break; case BA_WHISTLE: - val1 = skilllv +status->agi/10; // Flee increase - val2 = ((skilllv+1)/2)+status->luk/10; // Perfect dodge increase + val1 = skill_lv +status->agi/10; // Flee increase + val2 = ((skill_lv+1)/2)+status->luk/10; // Perfect dodge increase if(sd){ val1 += pc_checkskill(sd,BA_MUSICALLESSON); val2 += pc_checkskill(sd,BA_MUSICALLESSON); } break; case DC_HUMMING: - val1 = 2*skilllv+status->dex/10; // Hit increase + val1 = 2*skill_lv+status->dex/10; // Hit increase #ifdef RENEWAL val1 *= 2; #endif @@ -10678,64 +10679,64 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli val1 += pc_checkskill(sd,DC_DANCINGLESSON); break; case BA_POEMBRAGI: - val1 = 3*skilllv+status->dex/10; // Casting time reduction + val1 = 3*skill_lv+status->dex/10; // Casting time reduction //For some reason at level 10 the base delay reduction is 50%. - val2 = (skilllv<10?3*skilllv:50)+status->int_/5; // After-cast delay reduction + val2 = (skill_lv<10?3*skill_lv:50)+status->int_/5; // After-cast delay reduction if(sd){ val1 += 2*pc_checkskill(sd,BA_MUSICALLESSON); val2 += 2*pc_checkskill(sd,BA_MUSICALLESSON); } break; case DC_DONTFORGETME: - val1 = status->dex/10 + 3*skilllv + 5; // ASPD decrease - val2 = status->agi/10 + 3*skilllv + 5; // Movement speed adjustment. + val1 = status->dex/10 + 3*skill_lv + 5; // ASPD decrease + val2 = status->agi/10 + 3*skill_lv + 5; // Movement speed adjustment. if(sd){ val1 += pc_checkskill(sd,DC_DANCINGLESSON); val2 += pc_checkskill(sd,DC_DANCINGLESSON); } break; case BA_APPLEIDUN: - val1 = 5+2*skilllv+status->vit/10; // MaxHP percent increase + val1 = 5+2*skill_lv+status->vit/10; // MaxHP percent increase if(sd) val1 += pc_checkskill(sd,BA_MUSICALLESSON); break; case DC_SERVICEFORYOU: - val1 = 15+skilllv+(status->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed - val2 = 20+3*skilllv+(status->int_/10); // SP cost reduction + val1 = 15+skill_lv+(status->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed + val2 = 20+3*skill_lv+(status->int_/10); // SP cost reduction if(sd){ val1 += pc_checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed val2 += pc_checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value } break; case BA_ASSASSINCROSS: - val1 = 100+(10*skilllv)+(status->agi/10); // ASPD increase + val1 = 100+(10*skill_lv)+(status->agi/10); // ASPD increase if(sd) val1 += 5*pc_checkskill(sd,BA_MUSICALLESSON); break; case DC_FORTUNEKISS: - val1 = 10+skilllv+(status->luk/10); // Critical increase + val1 = 10+skill_lv+(status->luk/10); // Critical increase if(sd) val1 += pc_checkskill(sd,DC_DANCINGLESSON); val1*=10; //Because every 10 crit is an actual cri point. break; case BD_DRUMBATTLEFIELD: #ifdef RENEWAL - val1 = (skilllv+5)*25; //Watk increase - val2 = skilllv*10; //Def increase + val1 = (skill_lv+5)*25; //Watk increase + val2 = skill_lv*10; //Def increase #else - val1 = (skilllv+1)*25; //Watk increase - val2 = (skilllv+1)*2; //Def increase + val1 = (skill_lv+1)*25; //Watk increase + val2 = (skill_lv+1)*2; //Def increase #endif break; case BD_RINGNIBELUNGEN: - val1 = (skilllv+2)*25; //Watk increase + val1 = (skill_lv+2)*25; //Watk increase break; case BD_RICHMANKIM: - val1 = 25 + 11*skilllv; //Exp increase bonus. + val1 = 25 + 11*skill_lv; //Exp increase bonus. break; case BD_SIEGFRIED: - val1 = 55 + skilllv*5; //Elemental Resistance - val2 = skilllv*10; //Status ailment resistance + val1 = 55 + skill_lv*5; //Elemental Resistance + val2 = skill_lv*10; //Status ailment resistance break; case WE_CALLPARTNER: if (sd) val1 = sd->status.partner_id; @@ -10751,7 +10752,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli break; case NJ_KAENSIN: skill_clear_group(src, 1); //Delete previous Kaensins/Suitons - val2 = (skilllv+1)/2 + 4; + val2 = (skill_lv+1)/2 + 4; break; case NJ_SUITON: skill_clear_group(src, 1); @@ -10789,7 +10790,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli return NULL; val2 = sc->data[SC_POISONINGWEAPON]->val2; // Type of Poison val3 = sc->data[SC_POISONINGWEAPON]->val1; - limit = 4000 + 2000 * skilllv; + limit = 4000 + 2000 * skill_lv; break; case GD_LEADERSHIP: case GD_GLORYWOUNDS: @@ -10839,21 +10840,21 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli break; } - nullpo_retr(NULL, group=skill_initunitgroup(src,layout->count,skillid,skilllv,skill_get_unit_id(skillid,flag&1)+subunt, limit, interval)); + nullpo_retr(NULL, group=skill_initunitgroup(src,layout->count,skill_id,skill_lv,skill_get_unit_id(skill_id,flag&1)+subunt, limit, interval)); group->val1=val1; group->val2=val2; group->val3=val3; group->target_flag=target; - group->bl_flag= skill_get_unit_bl_target(skillid); - group->state.ammo_consume = (sd && sd->state.arrow_atk && skillid != GS_GROUNDDRIFT); //Store if this skill needs to consume ammo. + group->bl_flag= skill_get_unit_bl_target(skill_id); + group->state.ammo_consume = (sd && sd->state.arrow_atk && skill_id != GS_GROUNDDRIFT); //Store if this skill needs to consume ammo. group->state.song_dance = (unit_flag&(UF_DANCE|UF_SONG)?1:0)|(unit_flag&UF_ENSEMBLE?2:0); //Signals if this is a song/dance/duet - group->state.guildaura = ( skillid >= GD_LEADERSHIP && skillid <= GD_HAWKEYES )?1:0; + group->state.guildaura = ( skill_id >= GD_LEADERSHIP && skill_id <= GD_HAWKEYES )?1:0; group->item_id = req_item; //if tick is greater than current, do not invoke onplace function just yet. [Skotlex] if (DIFF_TICK(group->tick, gettick()) > SKILLUNITTIMER_INTERVAL) active_flag = 0; - if(skillid==HT_TALKIEBOX || skillid==RG_GRAFFITI){ + if(skill_id==HT_TALKIEBOX || skill_id==RG_GRAFFITI){ group->valstr=(char *) aMalloc(MESSAGE_SIZE*sizeof(char)); if (sd) safestrncpy(group->valstr, sd->message, MESSAGE_SIZE); @@ -10863,15 +10864,15 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli if (group->state.song_dance) { if(sd){ - sd->skillid_dance = skillid; - sd->skilllv_dance = skilllv; + sd->skill_id_dance = skill_id; + sd->skill_lv_dance = skill_lv; } if ( - sc_start4(src, SC_DANCING, 100, skillid, group->group_id, skilllv, + sc_start4(src, SC_DANCING, 100, skill_id, group->group_id, skill_lv, (group->state.song_dance&2?BCT_SELF:0), limit+1000) && - sd && group->state.song_dance&2 && skillid != CG_HERMODE //Hermod is a encore with a warp! + sd && group->state.song_dance&2 && skill_id != CG_HERMODE //Hermod is a encore with a warp! ) - skill_check_pc_partner(sd, skillid, &skilllv, 1, 1); + skill_check_pc_partner(sd, skill_id, &skill_lv, 1, 1); } limit = group->limit; @@ -10880,23 +10881,23 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli struct skill_unit *unit; int ux = x + layout->dx[i]; int uy = y + layout->dy[i]; - int val1 = skilllv; + int val1 = skill_lv; int val2 = 0; int alive = 1; if( !group->state.song_dance && !map_getcell(src->m,ux,uy,CELL_CHKREACH) ) continue; // don't place skill units on walls (except for songs/dances/encores) - if( battle_config.skill_wall_check && skill_get_unit_flag(skillid)&UF_PATHCHECK && !path_search_long(NULL,src->m,ux,uy,x,y,CELL_CHKWALL) ) + if( battle_config.skill_wall_check && skill_get_unit_flag(skill_id)&UF_PATHCHECK && !path_search_long(NULL,src->m,ux,uy,x,y,CELL_CHKWALL) ) continue; // no path between cell and center of casting. - switch( skillid ) + switch( skill_id ) { case MG_FIREWALL: case NJ_KAENSIN: val2=group->val2; break; case WZ_ICEWALL: - val1 = (skilllv <= 1) ? 500 : 200 + 200*skilllv; + val1 = (skill_lv <= 1) ? 500 : 200 + 200*skill_lv; val2 = map_getcell(src->m, ux, uy, CELL_GETTYPE); break; case HT_LANDMINE: @@ -10939,21 +10940,21 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli val2 = 0; break; case WM_REVERBERATION: - val1 = 1 + skilllv; + val1 = 1 + skill_lv; break; case GN_WALLOFTHORN: - val1 = 1000 * skilllv; // Need official value. [LimitLine] + val1 = 1000 * skill_lv; // Need official value. [LimitLine] break; default: if (group->state.song_dance&0x1) val2 = unit_flag&(UF_DANCE|UF_SONG); //Store whether this is a song/dance break; } - if (skill_get_unit_flag(skillid) & UF_RANGEDSINGLEUNIT && i == (layout->count / 2)) + if (skill_get_unit_flag(skill_id) & UF_RANGEDSINGLEUNIT && i == (layout->count / 2)) val2 |= UF_RANGEDSINGLEUNIT; // center. if( range <= 0 ) - map_foreachincell(skill_cell_overlap,src->m,ux,uy,BL_SKILL,skillid, &alive, src); + map_foreachincell(skill_cell_overlap,src->m,ux,uy,BL_SKILL,skill_id, &alive, src); if( !alive ) continue; @@ -10961,7 +10962,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli unit->limit=limit; unit->range=range; - if (skillid == PF_FOGWALL && alive == 2) + if (skill_id == PF_FOGWALL && alive == 2) { //Double duration of cells on top of Deluge/Suiton unit->limit *= 2; group->limit = unit->limit; @@ -10979,7 +10980,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli } //success, unit created. - switch( skillid ) { + switch( skill_id ) { case WZ_ICEWALL: map_foreachinrange(skill_icewall_block, src, AREA_SIZE, BL_MOB); break; @@ -11002,7 +11003,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un struct status_change *sc; struct status_change_entry *sce; enum sc_type type; - int skillid; + uint16 skill_id; nullpo_ret(src); nullpo_ret(bl); @@ -11023,7 +11024,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un type = status_skill2sc(sg->skill_id); sce = (sc && type != -1)?sc->data[type]:NULL; - skillid = sg->skill_id; //In case the group is deleted, we need to return the correct skill id, still. + skill_id = sg->skill_id; //In case the group is deleted, we need to return the correct skill id, still. switch (sg->unit_id) { case UNT_SPIDERWEB: @@ -11100,7 +11101,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un pc_setpos(sd,m,x,y,CLR_TELEPORT); } } else if(bl->type == BL_MOB && battle_config.mob_warp&2) { - int m = map_mapindex2mapid(sg->val3); + int16 m = map_mapindex2mapid(sg->val3); if (m < 0) break; //Map not available on this map-server. unit_warp(bl,m,sg->val2>>16,sg->val2&0xffff,CLR_TELEPORT); } @@ -11138,7 +11139,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un case UNT_SIEGFRIED: //Needed to check when a dancer/bard leaves their ensemble area. if (sg->src_id==bl->id && !(sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_BARDDANCER)) - return skillid; + return skill_id; if (!sce) sc_start4(bl,type,100,sg->skill_lv,sg->val1,sg->val2,0,sg->limit); break; @@ -11214,7 +11215,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un sc_start4(bl,type,100,sg->skill_lv,0,0,0,1000); break; } - return skillid; + return skill_id; } /*========================================== @@ -11229,7 +11230,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns struct status_change *tsc; struct skill_unit_group_tickset *ts; enum sc_type type; - int skillid; + uint16 skill_id; int diff=0; nullpo_ret(src); @@ -11248,7 +11249,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns tstatus = status_get_status_data(bl); type = status_skill2sc(sg->skill_id); - skillid = sg->skill_id; + skill_id = sg->skill_id; if (sg->interval == -1) { switch (sg->unit_id) { @@ -11270,7 +11271,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns return 0; ts->tick = tick+sg->interval; - if ((skillid==CR_GRANDCROSS || skillid==NPC_GRANDDARKNESS) && !battle_config.gx_allhit) + if ((skill_id==CR_GRANDCROSS || skill_id==NPC_GRANDDARKNESS) && !battle_config.gx_allhit) ts->tick += sg->interval*(map_count_oncell(bl->m,bl->x,bl->y,BL_CHAR)-1); } @@ -11931,9 +11932,9 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns } if (bl->type == BL_MOB && ss != bl) - mobskill_event((TBL_MOB*)bl, ss, tick, MSC_SKILLUSED|(skillid<<16)); + mobskill_event((TBL_MOB*)bl, ss, tick, MSC_SKILLUSED|(skill_id<<16)); - return skillid; + return skill_id; } /*========================================== * Triggered when a char steps out of a skill cell @@ -11993,7 +11994,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in /*========================================== * Triggered when a char steps out of a skill group (entirely) [Skotlex] *------------------------------------------*/ -static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int tick) +static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned int tick) { struct status_change *sc; struct status_change_entry *sce; @@ -12115,7 +12116,7 @@ static int skill_unit_effect (struct block_list* bl, va_list ap) struct skill_unit_group* group = unit->group; unsigned int tick = va_arg(ap,unsigned int); unsigned int flag = va_arg(ap,unsigned int); - int skill_id; + uint16 skill_id; bool dissonance; if( (!unit->alive && !(flag&4)) || bl->prev == NULL ) @@ -12184,7 +12185,7 @@ int skill_unit_ondamaged (struct skill_unit *src, struct block_list *bl, int dam *------------------------------------------*/ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) { - int *c, skillid; + int *c, skill_id; struct block_list *src; struct map_session_data *sd; struct map_session_data *tsd; @@ -12197,9 +12198,9 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) c=va_arg(ap,int *); p_sd = va_arg(ap, int *); - skillid = va_arg(ap,int); + skill_id = va_arg(ap,int); - if ( ((skillid != PR_BENEDICTIO && *c >=1) || *c >=2) && !(skill_get_inf2(skillid)&INF2_CHORUS_SKILL) ) + if ( ((skill_id != PR_BENEDICTIO && *c >=1) || *c >=2) && !(skill_get_inf2(skill_id)&INF2_CHORUS_SKILL) ) return 0; //Partner found for ensembles, or the two companions for Benedictio. [Skotlex] if (bl == src) @@ -12211,15 +12212,15 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) if (tsd->sc.data[SC_SILENCE] || ( tsd->sc.opt1 && tsd->sc.opt1 != OPT1_BURNING )) return 0; - if( skill_get_inf2(skillid)&INF2_CHORUS_SKILL ) { + if( skill_get_inf2(skill_id)&INF2_CHORUS_SKILL ) { if( tsd->status.party_id == sd->status.party_id && (tsd->class_&MAPID_THIRDMASK) == MAPID_MINSTRELWANDERER ) p_sd[(*c)++] = tsd->bl.id; return 1; } else { - switch(skillid) { + switch(skill_id) { case PR_BENEDICTIO: { - int dir = map_calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y); + uint8 dir = map_calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y); dir = (unit_getdir(&sd->bl) + dir)%8; //This adjusts dir to account for the direction the sd is facing. if ((tsd->class_&MAPID_BASEMASK) == MAPID_ACOLYTE && (dir == 2 || dir == 6) //Must be standing to the left/right of Priest. && sd->status.sp >= 10) @@ -12243,19 +12244,19 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) return 1; default: //Warning: Assuming Ensemble Dance/Songs for code speed. [Skotlex] { - int skilllv; + uint16 skill_lv; if(pc_issit(tsd) || !unit_can_move(&tsd->bl)) return 0; if (sd->status.sex != tsd->status.sex && (tsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && - (skilllv = pc_checkskill(tsd, skillid)) > 0 && + (skill_lv = pc_checkskill(tsd, skill_id)) > 0 && (tsd->weapontype1==W_MUSICAL || tsd->weapontype1==W_WHIP) && sd->status.party_id && tsd->status.party_id && sd->status.party_id == tsd->status.party_id && !tsd->sc.data[SC_DANCING]) { p_sd[(*c)++]=tsd->bl.id; - return skilllv; + return skill_lv; } else { return 0; } @@ -12270,7 +12271,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) /*========================================== * Checks and stores partners for ensemble skills [Skotlex] *------------------------------------------*/ -int skill_check_pc_partner (struct map_session_data *sd, short skill_id, short* skill_lv, int range, int cast_flag) +int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short* skill_lv, int range, int cast_flag) { static int c=0; static int p_sd[2] = { 0, 0 }; @@ -12308,8 +12309,8 @@ int skill_check_pc_partner (struct map_session_data *sd, short skill_id, short* sd->sc.data[SC_DANCING]->val4 = tsd->bl.id; sc_start4(&tsd->bl,SC_DANCING,100,skill_id,sd->sc.data[SC_DANCING]->val2,*skill_lv,sd->bl.id,skill_get_time(skill_id,*skill_lv)+1000); clif_skill_nodamage(&tsd->bl, &sd->bl, skill_id, *skill_lv, 1); - tsd->skillid_dance = skill_id; - tsd->skilllv_dance = *skill_lv; + tsd->skill_id_dance = skill_id; + tsd->skill_lv_dance = *skill_lv; } return c; } @@ -12495,7 +12496,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh // perform skill-specific checks (and actions) switch( skill ) { case SO_SPELLFIST: - if(sd->skillid_old != MG_FIREBOLT && sd->skillid_old != MG_COLDBOLT && sd->skillid_old != MG_LIGHTNINGBOLT){ + if(sd->skill_id_old != MG_FIREBOLT && sd->skill_id_old != MG_COLDBOLT && sd->skill_id_old != MG_LIGHTNINGBOLT){ clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; } @@ -13434,7 +13435,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short struct skill_condition req; struct status_data *status; struct status_change *sc; - int i,j,hp_rate,sp_rate, sp_skill_rate_bonus = 100; + int i,hp_rate,sp_rate, sp_skill_rate_bonus = 100; + uint16 idx; memset(&req,0,sizeof(req)); @@ -13458,25 +13460,25 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short return req; } - j = skill_get_index(skill); - if( j == 0 ) // invalid skill id + idx = skill_get_index(skill); + if( idx == 0 ) // invalid skill id return req; if( lv < 1 || lv > MAX_SKILL_LEVEL ) return req; status = &sd->battle_status; - req.hp = skill_db[j].hp[lv-1]; - hp_rate = skill_db[j].hp_rate[lv-1]; + req.hp = skill_db[idx].hp[lv-1]; + hp_rate = skill_db[idx].hp_rate[lv-1]; if(hp_rate > 0) req.hp += (status->hp * hp_rate)/100; else req.hp += (status->max_hp * (-hp_rate))/100; - req.sp = skill_db[j].sp[lv-1]; - if((sd->skillid_old == BD_ENCORE) && skill == sd->skillid_dance) + req.sp = skill_db[idx].sp[lv-1]; + if((sd->skill_id_old == BD_ENCORE) && skill == sd->skill_id_dance) req.sp /= 2; - sp_rate = skill_db[j].sp_rate[lv-1]; + sp_rate = skill_db[idx].sp_rate[lv-1]; if(sp_rate > 0) req.sp += (status->sp * sp_rate)/100; else @@ -13502,22 +13504,22 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short req.sp += req.sp / 4; } - req.zeny = skill_db[j].zeny[lv-1]; + req.zeny = skill_db[idx].zeny[lv-1]; if( sc && sc->data[SC__UNLUCKY] ) req.zeny += sc->data[SC__UNLUCKY]->val1 * 500; - req.spiritball = skill_db[j].spiritball[lv-1]; + req.spiritball = skill_db[idx].spiritball[lv-1]; - req.state = skill_db[j].state; + req.state = skill_db[idx].state; - req.mhp = skill_db[j].mhp[lv-1]; + req.mhp = skill_db[idx].mhp[lv-1]; - req.weapon = skill_db[j].weapon; + req.weapon = skill_db[idx].weapon; - req.ammo_qty = skill_db[j].ammo_qty[lv-1]; + req.ammo_qty = skill_db[idx].ammo_qty[lv-1]; if (req.ammo_qty) - req.ammo = skill_db[j].ammo; + req.ammo = skill_db[idx].ammo; if (!req.ammo && skill && skill_isammotype(sd, skill)) { //Assume this skill is using the weapon, therefore it requires arrows. @@ -13543,11 +13545,11 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short continue; break; case AB_ADORAMUS: - if( itemid_isgemstone(skill_db[j].itemid[i]) && skill_check_pc_partner(sd,skill,&lv, 1, 2) ) + if( itemid_isgemstone(skill_db[idx].itemid[i]) && skill_check_pc_partner(sd,skill,&lv, 1, 2) ) continue; break; case WL_COMET: - if( itemid_isgemstone(skill_db[j].itemid[i]) && skill_check_pc_partner(sd,skill,&lv, 1, 0) ) + if( itemid_isgemstone(skill_db[idx].itemid[i]) && skill_check_pc_partner(sd,skill,&lv, 1, 0) ) continue; break; case GN_FIRE_EXPANSION: @@ -13567,8 +13569,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short break; } - req.itemid[i] = skill_db[j].itemid[i]; - req.amount[i] = skill_db[j].amount[i]; + req.itemid[i] = skill_db[idx].itemid[i]; + req.amount[i] = skill_db[idx].amount[i]; if( itemid_isgemstone(req.itemid[i]) && skill != HW_GANBANTEIN ) { @@ -13586,7 +13588,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short } } if( skill >= HT_SKIDTRAP && skill <= HT_TALKIEBOX && pc_checkskill(sd, RA_RESEARCHTRAP) > 0){ - if( (j=pc_search_inventory(sd,req.itemid[i])) < 0 || ( j >= 0 && sd->status.inventory[j].amount < req.amount[i] ) ){ + if( (idx=pc_search_inventory(sd,req.itemid[i])) < 0 || ( idx >= 0 && sd->status.inventory[idx].amount < req.amount[i] ) ){ req.itemid[i] = ITEMID_TRAP_ALLOY; req.amount[i] = 1; } @@ -13606,8 +13608,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short case SO_FIRE_INSIGNIA: case SO_WIND_INSIGNIA: case SO_EARTH_INSIGNIA: - req.itemid[lv-1] = skill_db[j].itemid[lv-1]; - req.amount[lv-1] = skill_db[j].amount[lv-1]; + req.itemid[lv-1] = skill_db[idx].itemid[lv-1]; + req.amount[lv-1] = skill_db[idx].amount[lv-1]; break; } @@ -13697,7 +13699,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short /*========================================== * Does cast-time reductions based on dex, item bonuses and config setting *------------------------------------------*/ -int skill_castfix (struct block_list *bl, int skill_id, int skill_lv) { +int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { int time = skill_get_cast(skill_id, skill_lv); nullpo_ret(bl); @@ -13779,7 +13781,7 @@ int skill_castfix_sc (struct block_list *bl, int time) return time; } #ifdef RENEWAL_CAST -int skill_vfcastfix (struct block_list *bl, double time, int skill_id, int skill_lv) +int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv) { struct status_change *sc = status_get_sc(bl); struct map_session_data *sd = BL_CAST(BL_PC,bl); @@ -13871,7 +13873,7 @@ int skill_vfcastfix (struct block_list *bl, double time, int skill_id, int skill /*========================================== * Does delay reductions based on dex/agi, sc data, item bonuses, ... *------------------------------------------*/ -int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv) +int skill_delayfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { int delaynodex = skill_get_delaynodex(skill_id, skill_lv); int time = skill_get_delay(skill_id, skill_lv); @@ -13971,7 +13973,7 @@ struct square { int val2[5]; }; -static void skill_brandishspear_first (struct square *tc, int dir, int x, int y) +static void skill_brandishspear_first (struct square *tc, uint8 dir, int16 x, int16 y) { nullpo_retv(tc); @@ -14074,7 +14076,7 @@ static void skill_brandishspear_first (struct square *tc, int dir, int x, int y) } -static void skill_brandishspear_dir (struct square* tc, int dir, int are) +static void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) { int c; nullpo_retv(tc); @@ -14095,25 +14097,25 @@ static void skill_brandishspear_dir (struct square* tc, int dir, int are) } } -void skill_brandishspear(struct block_list* src, struct block_list* bl, int skillid, int skilllv, unsigned int tick, int flag) +void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) { int c,n=4; - int dir = map_calc_dir(src,bl->x,bl->y); + uint8 dir = map_calc_dir(src,bl->x,bl->y); struct square tc; int x=bl->x,y=bl->y; skill_brandishspear_first(&tc,dir,x,y); skill_brandishspear_dir(&tc,dir,4); skill_area_temp[1] = bl->id; - if(skilllv > 9){ + if(skill_lv > 9){ for(c=1;c<4;c++){ map_foreachincell(skill_area_sub, bl->m,tc.val1[c],tc.val2[c],BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|n, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n, skill_castend_damage_id); } } - if(skilllv > 6){ + if(skill_lv > 6){ skill_brandishspear_dir(&tc,dir,-1); n--; }else{ @@ -14121,13 +14123,13 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, int skil n-=2; } - if(skilllv > 3){ + if(skill_lv > 3){ for(c=0;c<5;c++){ map_foreachincell(skill_area_sub, bl->m,tc.val1[c],tc.val2[c],BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|n, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n, skill_castend_damage_id); - if(skilllv > 6 && n==3 && c==4){ + if(skill_lv > 6 && n==3 && c==4){ skill_brandishspear_dir(&tc,dir,-1); n--;c=-1; } @@ -14137,7 +14139,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, int skil if(c==0||c==5) skill_brandishspear_dir(&tc,dir,-1); map_foreachincell(skill_area_sub, bl->m,tc.val1[c%5],tc.val2[c%5],BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|1, + src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); } } @@ -14287,43 +14289,43 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) /*========================================== * *------------------------------------------*/ -int skill_autospell (struct map_session_data *sd, int skillid) +int skill_autospell (struct map_session_data *sd, uint16 skill_id) { - int skilllv; + uint16 skill_lv; int maxlv=1,lv; nullpo_ret(sd); - skilllv = sd->menuskill_val; - lv=pc_checkskill(sd,skillid); + skill_lv = sd->menuskill_val; + lv=pc_checkskill(sd,skill_id); - if(skilllv <= 0 || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance] + if(skill_lv <= 0 || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance] - if(skillid==MG_NAPALMBEAT) maxlv=3; - else if(skillid==MG_COLDBOLT || skillid==MG_FIREBOLT || skillid==MG_LIGHTNINGBOLT){ + if(skill_id==MG_NAPALMBEAT) maxlv=3; + else if(skill_id==MG_COLDBOLT || skill_id==MG_FIREBOLT || skill_id==MG_LIGHTNINGBOLT){ if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SAGE) maxlv =10; //Soul Linker bonus. [Skotlex] - else if(skilllv==2) maxlv=1; - else if(skilllv==3) maxlv=2; - else if(skilllv>=4) maxlv=3; + else if(skill_lv==2) maxlv=1; + else if(skill_lv==3) maxlv=2; + else if(skill_lv>=4) maxlv=3; } - else if(skillid==MG_SOULSTRIKE){ - if(skilllv==5) maxlv=1; - else if(skilllv==6) maxlv=2; - else if(skilllv>=7) maxlv=3; + else if(skill_id==MG_SOULSTRIKE){ + if(skill_lv==5) maxlv=1; + else if(skill_lv==6) maxlv=2; + else if(skill_lv>=7) maxlv=3; } - else if(skillid==MG_FIREBALL){ - if(skilllv==8) maxlv=1; - else if(skilllv>=9) maxlv=2; + else if(skill_id==MG_FIREBALL){ + if(skill_lv==8) maxlv=1; + else if(skill_lv>=9) maxlv=2; } - else if(skillid==MG_FROSTDIVER) maxlv=1; + else if(skill_id==MG_FROSTDIVER) maxlv=1; else return 0; if(maxlv > lv) maxlv = lv; - sc_start4(&sd->bl,SC_AUTOSPELL,100,skilllv,skillid,maxlv,0, - skill_get_time(SA_AUTOSPELL,skilllv)); + sc_start4(&sd->bl,SC_AUTOSPELL,100,skill_lv,skill_id,maxlv,0, + skill_get_time(SA_AUTOSPELL,skill_lv)); return 0; } @@ -14430,15 +14432,15 @@ int skill_sit (struct map_session_data *sd, int type) int skill_frostjoke_scream (struct block_list *bl, va_list ap) { struct block_list *src; - int skillnum,skilllv; + uint16 skill_id,skill_lv; unsigned int tick; nullpo_ret(bl); nullpo_ret(src=va_arg(ap,struct block_list*)); - skillnum=va_arg(ap,int); - skilllv=va_arg(ap,int); - if(skilllv <= 0) return 0; + skill_id=va_arg(ap,int); + skill_lv=va_arg(ap,int); + if(skill_lv <= 0) return 0; tick=va_arg(ap,unsigned int); if (src == bl || status_isdead(bl)) @@ -14450,9 +14452,9 @@ int skill_frostjoke_scream (struct block_list *bl, va_list ap) } //It has been reported that Scream/Joke works the same regardless of woe-setting. [Skotlex] if(battle_check_target(src,bl,BCT_ENEMY) > 0) - skill_additional_effect(src,bl,skillnum,skilllv,BF_MISC,ATK_DEF,tick); + skill_additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); else if(battle_check_target(src,bl,BCT_PARTY) > 0 && rnd()%100 < 10) - skill_additional_effect(src,bl,skillnum,skilllv,BF_MISC,ATK_DEF,tick); + skill_additional_effect(src,bl,skill_id,skill_lv,BF_MISC,ATK_DEF,tick); return 0; } @@ -14460,9 +14462,9 @@ int skill_frostjoke_scream (struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -static void skill_unitsetmapcell (struct skill_unit *src, int skill_num, int skill_lv, cell_t cell, bool flag) +static void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill_lv, cell_t cell, bool flag) { - int range = skill_get_unit_range(skill_num,skill_lv); + int range = skill_get_unit_range(skill_id,skill_lv); int x,y; for( y = src->bl.y - range; y <= src->bl.y + range; ++y ) @@ -14476,7 +14478,7 @@ static void skill_unitsetmapcell (struct skill_unit *src, int skill_num, int ski int skill_attack_area (struct block_list *bl, va_list ap) { struct block_list *src,*dsrc; - int atk_type,skillid,skilllv,flag,type; + int atk_type,skill_id,skill_lv,flag,type; unsigned int tick; if(status_isdead(bl)) @@ -14485,32 +14487,32 @@ int skill_attack_area (struct block_list *bl, va_list ap) atk_type = va_arg(ap,int); src=va_arg(ap,struct block_list*); dsrc=va_arg(ap,struct block_list*); - skillid=va_arg(ap,int); - skilllv=va_arg(ap,int); + skill_id=va_arg(ap,int); + skill_lv=va_arg(ap,int); tick=va_arg(ap,unsigned int); flag=va_arg(ap,int); type=va_arg(ap,int); if (skill_area_temp[1] == bl->id) //This is the target of the skill, do a full attack and skip target checks. - return skill_attack(atk_type,src,dsrc,bl,skillid,skilllv,tick,flag); + return skill_attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag); if(battle_check_target(dsrc,bl,type) <= 0 || - !status_check_skilluse(NULL, bl, skillid, 2)) + !status_check_skilluse(NULL, bl, skill_id, 2)) return 0; - switch (skillid) { + switch (skill_id) { case WZ_FROSTNOVA: //Skills that don't require the animation to be removed case NPC_ACIDBREATH: case NPC_DARKNESSBREATH: case NPC_FIREBREATH: case NPC_ICEBREATH: case NPC_THUNDERBREATH: - return skill_attack(atk_type,src,dsrc,bl,skillid,skilllv,tick,flag); + return skill_attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag); default: //Area-splash, disable skill animation. - return skill_attack(atk_type,src,dsrc,bl,skillid,skilllv,tick,flag|SD_ANIMATION); + return skill_attack(atk_type,src,dsrc,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); } } /*========================================== @@ -14662,18 +14664,18 @@ int skill_detonator(struct block_list *bl, va_list ap) *------------------------------------------*/ static int skill_cell_overlap(struct block_list *bl, va_list ap) { - int skillid; + uint16 skill_id; int *alive; struct skill_unit *unit; - skillid = va_arg(ap,int); + skill_id = va_arg(ap,int); alive = va_arg(ap,int *); unit = (struct skill_unit *)bl; if (unit == NULL || unit->group == NULL || (*alive) == 0) return 0; - switch (skillid) { + switch (skill_id) { case SA_LANDPROTECTOR: if( unit->group->skill_id == SA_LANDPROTECTOR ) {//Check for offensive Land Protector to delete both. [Skotlex] (*alive) = 0; @@ -14754,7 +14756,7 @@ static int skill_cell_overlap(struct block_list *bl, va_list ap) break; } - if (unit->group->skill_id == SA_LANDPROTECTOR && !(skill_get_inf2(skillid)&(INF2_SONG_DANCE|INF2_TRAP))) { //It deletes everything except songs/dances/traps + if (unit->group->skill_id == SA_LANDPROTECTOR && !(skill_get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_TRAP))) { //It deletes everything except songs/dances/traps (*alive) = 0; return 1; } @@ -15112,13 +15114,13 @@ static int skill_get_new_group_id(void) } } -struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, short skillid, short skilllv, int unit_id, int limit, int interval) +struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval) { struct unit_data* ud = unit_bl2ud( src ); struct skill_unit_group* group; int i; - if(skillid <= 0 || skilllv <= 0) return 0; + if(skill_id <= 0 || skill_lv <= 0) return 0; nullpo_retr(NULL, src); nullpo_retr(NULL, ud); @@ -15152,8 +15154,8 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, group->val1 = 0; group->val2 = 0; group->val3 = 0; - group->skill_id = skillid; - group->skill_lv = skilllv; + group->skill_id = skill_id; + group->skill_lv = skill_lv; group->unit_id = unit_id; group->map = src->m; group->limit = limit; @@ -15163,7 +15165,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, ud->skillunit[i] = group; - if (skillid == PR_SANCTUARY) //Sanctuary starts healing +1500ms after casted. [Skotlex] + if (skill_id == PR_SANCTUARY) //Sanctuary starts healing +1500ms after casted. [Skotlex] group->tick += 1500; idb_put(group_db, group->group_id, group); @@ -15640,7 +15642,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) int flag = va_arg(ap,int); bool dissonance; - int skill_id; + uint16 skill_id; int i; nullpo_ret(group); @@ -15770,7 +15772,7 @@ int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) /*========================================== * *------------------------------------------*/ -int skill_unit_move_unit_group (struct skill_unit_group *group, int m, int dx, int dy) +int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 dx, int16 dy) { int i,j; unsigned int tick = gettick(); @@ -15925,10 +15927,10 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, /*========================================== * *------------------------------------------*/ -int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, int slot1, int slot2, int slot3, int qty) +int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty) { int slot[3]; - int i,sc,ele,idx,equip,wlv,make_per = 0,flag = 0,skilllv = 0; + int i,sc,ele,idx,equip,wlv,make_per = 0,flag = 0,skill_lv = 0; int num = -1; // exclude the recipe struct status_data *status; struct item_data* data; @@ -15936,8 +15938,8 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in nullpo_ret(sd); status = status_get_status_data(&sd->bl); - if( sd->skillid_old == skill_id ) - skilllv = sd->skilllv_old; + if( sd->skill_id_old == skill_id ) + skill_lv = sd->skill_lv_old; if( !(idx=skill_can_produce_mix(sd,nameid,-1, qty)) ) return 0; @@ -16157,7 +16159,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in { int difficulty = 0; - difficulty = (620 - 20 * skilllv);// (620 - 20 * Skill Level) + difficulty = (620 - 20 * skill_lv);// (620 - 20 * Skill Level) make_per = status->int_ + status->dex/2 + status->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) + (sd->status.base_level-100) + pc_checkskill(sd, AM_LEARNINGPOTION) + pc_checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10) @@ -16232,12 +16234,12 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in else if( make_per >= 30 && make_per < difficulty) qty = 5; - if( qty < 0 || (skilllv == 1 && make_per < difficulty)){ + if( qty < 0 || (skill_lv == 1 && make_per < difficulty)){ qty = ~qty + 1; make_per = 0; }else make_per = 10000; - qty = (skilllv > 1 ? qty : 1); + qty = (skill_lv > 1 ? qty : 1); } break; default: @@ -16578,12 +16580,12 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) { return 0; } -static void skill_toggle_magicpower(struct block_list *bl, short skillid) +static void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) { struct status_change *sc = status_get_sc(bl); // non-offensive and non-magic skills do not affect the status - if (skill_get_nk(skillid)&NK_NO_DAMAGE || !(skill_get_type(skillid)&BF_MAGIC)) + if (skill_get_nk(skill_id)&NK_NO_DAMAGE || !(skill_get_type(skill_id)&BF_MAGIC)) return; if (sc && sc->count && sc->data[SC_MAGICPOWER]) @@ -16663,7 +16665,7 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { ARR_FIND(0,MAX_SKILL_SPELLBOOK_DB,i,skill_spellbook_db[i].nameid == nameid); // Search for information of this item if( i == MAX_SKILL_SPELLBOOK_DB ) return 0; - if( !pc_checkskill(sd, (skill_id = skill_spellbook_db[i].skillid)) ) + if( !pc_checkskill(sd, (skill_id = skill_spellbook_db[i].skill_id)) ) { // User don't know the skill sc_start(&sd->bl, SC_SLEEP, 100, 1, skill_get_time(WL_READING_SB, pc_checkskill(sd,WL_READING_SB))); clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_DIFFICULT_SLEEP, 0); @@ -16693,7 +16695,7 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { return 1; } -int skill_select_menu(struct map_session_data *sd,int skill_id) { +int skill_select_menu(struct map_session_data *sd,uint16 skill_id) { int id, lv, prob, aslvl = 0; nullpo_ret(sd); @@ -16714,7 +16716,7 @@ int skill_select_menu(struct map_session_data *sd,int skill_id) { sc_start4(&sd->bl,SC__AUTOSHADOWSPELL,100,id,lv,prob,0,skill_get_time(SC_AUTOSHADOWSPELL,aslvl)); return 0; } -int skill_elementalanalysis(struct map_session_data* sd, int n, int skill_lv, unsigned short* item_list) { +int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv, unsigned short* item_list) { int i; nullpo_ret(sd); @@ -16903,29 +16905,29 @@ int skill_blockpc_end(int tid, unsigned int tick, int id, intptr_t data) /** * flags a singular skill as being blocked from persistent usage. * @param sd the player the skill delay affects - * @param skillid the skill which should be delayed + * @param skill_id the skill which should be delayed * @param tick the length of time the delay should last * @param load whether this assignment is being loaded upon player login * @return 0 if successful, -1 otherwise */ -int skill_blockpc_start_(struct map_session_data *sd, int skillid, int tick, bool load) +int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick, bool load) { - int oskillid = skillid; + int oskill_id = skill_id; struct skill_cd* cd = NULL; nullpo_retr (-1, sd); - skillid = skill_get_index(skillid); - if (skillid == 0) + uint16 idx = skill_get_index(skill_id); + if (idx == 0) return -1; if (tick < 1) { - sd->blockskill[skillid] = 0; + sd->blockskill[idx] = 0; return -1; } if( battle_config.display_status_timers ) - clif_skill_cooldown(sd, skillid, tick); + clif_skill_cooldown(sd, idx, tick); if( !load ) {// not being loaded initially so ensure the skill delay is recorded @@ -16937,12 +16939,12 @@ int skill_blockpc_start_(struct map_session_data *sd, int skillid, int tick, boo // record the skill duration in the database map cd->duration[cd->cursor] = tick; - cd->skidx[cd->cursor] = skillid; - cd->nameid[cd->cursor] = oskillid; + cd->skidx[cd->cursor] = idx; + cd->nameid[cd->cursor] = oskill_id; cd->cursor++; } - sd->blockskill[skillid] = 0x1|(0xFE&add_timer(gettick()+tick,skill_blockpc_end,sd->bl.id,skillid)); + sd->blockskill[idx] = 0x1|(0xFE&add_timer(gettick()+tick,skill_blockpc_end,sd->bl.id,idx)); return 0; } @@ -16956,20 +16958,20 @@ int skill_blockhomun_end(int tid, unsigned int tick, int id, intptr_t data) //[o return 1; } -int skill_blockhomun_start(struct homun_data *hd, int skillid, int tick) //[orn] +int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) //[orn] { nullpo_retr (-1, hd); - skillid = skill_get_index(skillid); - if (skillid == 0) + uint16 idx = skill_get_index(skill_id); + if (idx == 0) return -1; if (tick < 1) { - hd->blockskill[skillid] = 0; + hd->blockskill[idx] = 0; return -1; } - hd->blockskill[skillid] = 1; - return add_timer(gettick() + tick, skill_blockhomun_end, hd->bl.id, skillid); + hd->blockskill[idx] = 1; + return add_timer(gettick() + tick, skill_blockhomun_end, hd->bl.id, idx); } int skill_blockmerc_end(int tid, unsigned int tick, int id, intptr_t data) //[orn] @@ -16982,24 +16984,25 @@ int skill_blockmerc_end(int tid, unsigned int tick, int id, intptr_t data) //[or return 1; } -int skill_blockmerc_start(struct mercenary_data *md, int skillid, int tick) +int skill_blockmerc_start(struct mercenary_data *md, uint16 skill_id, int tick) { nullpo_retr (-1, md); - if( (skillid = skill_get_index(skillid)) == 0 ) + uint16 idx = skill_get_index(skill_id); + if (idx == 0) return -1; if( tick < 1 ) { - md->blockskill[skillid] = 0; + md->blockskill[idx] = 0; return -1; } - md->blockskill[skillid] = 1; - return add_timer(gettick() + tick, skill_blockmerc_end, md->bl.id, skillid); + md->blockskill[idx] = 1; + return add_timer(gettick() + tick, skill_blockmerc_end, md->bl.id, idx); } /** * Adds a new skill unit entry for this player to recast after map load **/ -void skill_usave_add(struct map_session_data * sd, int skill_num, int skill_lv) { +void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill_lv) { struct skill_usave * sus = NULL; if( idb_exists(skillusave_db,sd->status.char_id) ) { @@ -17009,7 +17012,7 @@ void skill_usave_add(struct map_session_data * sd, int skill_num, int skill_lv) CREATE( sus, struct skill_usave, 1 ); idb_put( skillusave_db, sd->status.char_id, sus ); - sus->skill_num = skill_num; + sus->skill_id = skill_id; sus->skill_lv = skill_lv; return; @@ -17021,7 +17024,7 @@ void skill_usave_trigger(struct map_session_data *sd) { return; } - skill_unitsetting(&sd->bl,sus->skill_num,sus->skill_lv,sd->bl.x,sd->bl.y,0); + skill_unitsetting(&sd->bl,sus->skill_id,sus->skill_lv,sd->bl.x,sd->bl.y,0); idb_remove(skillusave_db,sd->status.char_id); @@ -17371,19 +17374,19 @@ void skill_init_unit_layout (void) } -int skill_block_check(struct block_list *bl, sc_type type , int skillid) { +int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) { int inf = 0; struct status_change *sc = status_get_sc(bl); - if( !sc || !bl || skillid < 1 ) + if( !sc || !bl || skill_id < 1 ) return 0; // Can do it switch(type){ case SC_STASIS: - inf = skill_get_inf2(skillid); - if( inf == INF2_SONG_DANCE || /*skill_get_inf2(skillid) == INF2_CHORUS_SKILL ||*/ inf == INF2_SPIRIT_SKILL ) + inf = skill_get_inf2(skill_id); + if( inf == INF2_SONG_DANCE || /*skill_get_inf2(skill_id) == INF2_CHORUS_SKILL ||*/ inf == INF2_SPIRIT_SKILL ) return 1; // Can't do it. - switch( skillid ) + switch( skill_id ) { case NV_FIRSTAID: case TF_HIDING: case AS_CLOAKING: case WZ_SIGHTRASHER: case RG_STRIPWEAPON: case RG_STRIPSHIELD: case RG_STRIPARMOR: case WZ_METEOR: @@ -17419,7 +17422,7 @@ int skill_block_check(struct block_list *bl, sc_type type , int skillid) { } break; case SC_KAGEHUMI: - switch(skillid){ + switch(skill_id){ case TF_HIDING: case AS_CLOAKING: case GC_CLOAKINGEXCEED: case SC_SHADOWFORM: case MI_HARMONIZE: case CG_MARIONETTE: case AL_TELEPORT: case TF_BACKSLIDING: case RA_CAMOUFLAGE: case ST_CHASEWALK: case GD_EMERGENCYCALL: @@ -17431,7 +17434,7 @@ int skill_block_check(struct block_list *bl, sc_type type , int skillid) { return 0; } -int skill_get_elemental_type( int skill_id , int skill_lv ) { +int skill_get_elemental_type( uint16 skill_id , uint16 skill_lv ) { int type = 0; switch( skill_id ) { @@ -17478,68 +17481,68 @@ void skill_cooldown_load(struct map_session_data * sd) static bool skill_parse_row_skilldb(char* split[], int columns, int current) {// id,range,hit,inf,element,nk,splash,max,list_num,castcancel,cast_defence_rate,inf2,maxcount,skill_type,blow_count,name,description - int id = atoi(split[0]); - int i; - if( (id >= GD_SKILLRANGEMIN && id <= GD_SKILLRANGEMAX) - || (id >= HM_SKILLRANGEMIN && id <= HM_SKILLRANGEMAX) - || (id >= MC_SKILLRANGEMIN && id <= MC_SKILLRANGEMAX) - || (id >= EL_SKILLRANGEMIN && id <= EL_SKILLRANGEMAX) ) { - ShowWarning("skill_parse_row_skilldb: Skill id %d is forbidden (interferes with guild/homun/mercenary skill mapping)!\n", id); + uint16 skill_id = atoi(split[0]); + uint16 idx; + if( (skill_id >= GD_SKILLRANGEMIN && skill_id <= GD_SKILLRANGEMAX) + || (skill_id >= HM_SKILLRANGEMIN && skill_id <= HM_SKILLRANGEMAX) + || (skill_id >= MC_SKILLRANGEMIN && skill_id <= MC_SKILLRANGEMAX) + || (skill_id >= EL_SKILLRANGEMIN && skill_id <= EL_SKILLRANGEMAX) ) { + ShowWarning("skill_parse_row_skilldb: Skill id %d is forbidden (interferes with guild/homun/mercenary skill mapping)!\n", skill_id); return false; } - i = skill_get_index(id); - if( !i ) // invalid skill id + idx = skill_get_index(skill_id); + if( !idx ) // invalid skill id return false; - skill_split_atoi(split[1],skill_db[i].range); - skill_db[i].hit = atoi(split[2]); - skill_db[i].inf = atoi(split[3]); - skill_split_atoi(split[4],skill_db[i].element); - skill_db[i].nk = (int)strtol(split[5], NULL, 0); - skill_split_atoi(split[6],skill_db[i].splash); - skill_db[i].max = atoi(split[7]); - skill_split_atoi(split[8],skill_db[i].num); + skill_split_atoi(split[1],skill_db[idx].range); + skill_db[idx].hit = atoi(split[2]); + skill_db[idx].inf = atoi(split[3]); + skill_split_atoi(split[4],skill_db[idx].element); + skill_db[idx].nk = (int)strtol(split[5], NULL, 0); + skill_split_atoi(split[6],skill_db[idx].splash); + skill_db[idx].max = atoi(split[7]); + skill_split_atoi(split[8],skill_db[idx].num); if( strcmpi(split[9],"yes") == 0 ) - skill_db[i].castcancel = 1; + skill_db[idx].castcancel = 1; else - skill_db[i].castcancel = 0; - skill_db[i].cast_def_rate = atoi(split[10]); - skill_db[i].inf2 = (int)strtol(split[11], NULL, 0); - skill_split_atoi(split[12],skill_db[i].maxcount); + skill_db[idx].castcancel = 0; + skill_db[idx].cast_def_rate = atoi(split[10]); + skill_db[idx].inf2 = (int)strtol(split[11], NULL, 0); + skill_split_atoi(split[12],skill_db[idx].maxcount); if( strcmpi(split[13],"weapon") == 0 ) - skill_db[i].skill_type = BF_WEAPON; + skill_db[idx].skill_type = BF_WEAPON; else if( strcmpi(split[13],"magic") == 0 ) - skill_db[i].skill_type = BF_MAGIC; + skill_db[idx].skill_type = BF_MAGIC; else if( strcmpi(split[13],"misc") == 0 ) - skill_db[i].skill_type = BF_MISC; + skill_db[idx].skill_type = BF_MISC; else - skill_db[i].skill_type = 0; - skill_split_atoi(split[14],skill_db[i].blewcount); - safestrncpy(skill_db[i].name, trim(split[15]), sizeof(skill_db[i].name)); - safestrncpy(skill_db[i].desc, trim(split[16]), sizeof(skill_db[i].desc)); - strdb_iput(skilldb_name2id, skill_db[i].name, id); + skill_db[idx].skill_type = 0; + skill_split_atoi(split[14],skill_db[idx].blewcount); + safestrncpy(skill_db[idx].name, trim(split[15]), sizeof(skill_db[idx].name)); + safestrncpy(skill_db[idx].desc, trim(split[16]), sizeof(skill_db[idx].desc)); + strdb_iput(skilldb_name2id, skill_db[idx].name, skill_id); return true; } static bool skill_parse_row_requiredb(char* split[], int columns, int current) -{// SkillID,HPCost,MaxHPTrigger,SPCost,HPRateCost,SPRateCost,ZenyCost,RequiredWeapons,RequiredAmmoTypes,RequiredAmmoAmount,RequiredState,SpiritSphereCost,RequiredItemID1,RequiredItemAmount1,RequiredItemID2,RequiredItemAmount2,RequiredItemID3,RequiredItemAmount3,RequiredItemID4,RequiredItemAmount4,RequiredItemID5,RequiredItemAmount5,RequiredItemID6,RequiredItemAmount6,RequiredItemID7,RequiredItemAmount7,RequiredItemID8,RequiredItemAmount8,RequiredItemID9,RequiredItemAmount9,RequiredItemID10,RequiredItemAmount10 +{// skill_id,HPCost,MaxHPTrigger,SPCost,HPRateCost,SPRateCost,ZenyCost,RequiredWeapons,RequiredAmmoTypes,RequiredAmmoAmount,RequiredState,SpiritSphereCost,RequiredItemID1,RequiredItemAmount1,RequiredItemID2,RequiredItemAmount2,RequiredItemID3,RequiredItemAmount3,RequiredItemID4,RequiredItemAmount4,RequiredItemID5,RequiredItemAmount5,RequiredItemID6,RequiredItemAmount6,RequiredItemID7,RequiredItemAmount7,RequiredItemID8,RequiredItemAmount8,RequiredItemID9,RequiredItemAmount9,RequiredItemID10,RequiredItemAmount10 char* p; int j; - int i = atoi(split[0]); - i = skill_get_index(i); - if( !i ) // invalid skill id + uint16 skill_id = atoi(split[0]); + uint16 idx = skill_get_index(skill_id); + if( !idx ) // invalid skill id return false; - skill_split_atoi(split[1],skill_db[i].hp); - skill_split_atoi(split[2],skill_db[i].mhp); - skill_split_atoi(split[3],skill_db[i].sp); - skill_split_atoi(split[4],skill_db[i].hp_rate); - skill_split_atoi(split[5],skill_db[i].sp_rate); - skill_split_atoi(split[6],skill_db[i].zeny); + skill_split_atoi(split[1],skill_db[idx].hp); + skill_split_atoi(split[2],skill_db[idx].mhp); + skill_split_atoi(split[3],skill_db[idx].sp); + skill_split_atoi(split[4],skill_db[idx].hp_rate); + skill_split_atoi(split[5],skill_db[idx].sp_rate); + skill_split_atoi(split[6],skill_db[idx].zeny); //Wich weapon type are required, see doc/item_db for types p = split[7]; @@ -17548,11 +17551,11 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current) int l = atoi(p); if( l == 99 ) // Any weapon { - skill_db[i].weapon = 0; + skill_db[idx].weapon = 0; break; } else - skill_db[i].weapon |= 1<<l; + skill_db[idx].weapon |= 1<<l; p = strchr(p,':'); if(!p) break; @@ -17566,146 +17569,146 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current) int l = atoi(p); if( l == 99 ) // Any ammo type { - skill_db[i].ammo = 0xFFFFFFFF; + skill_db[idx].ammo = 0xFFFFFFFF; break; } else if( l ) // 0 stands for no requirement - skill_db[i].ammo |= 1<<l; + skill_db[idx].ammo |= 1<<l; p = strchr(p,':'); if( !p ) break; p++; } - skill_split_atoi(split[9],skill_db[i].ammo_qty); - - if( strcmpi(split[10],"hiding")==0 ) skill_db[i].state = ST_HIDING; - else if( strcmpi(split[10],"cloaking")==0 ) skill_db[i].state = ST_CLOAKING; - else if( strcmpi(split[10],"hidden")==0 ) skill_db[i].state = ST_HIDDEN; - else if( strcmpi(split[10],"riding")==0 ) skill_db[i].state = ST_RIDING; - else if( strcmpi(split[10],"falcon")==0 ) skill_db[i].state = ST_FALCON; - else if( strcmpi(split[10],"cart")==0 ) skill_db[i].state = ST_CART; - else if( strcmpi(split[10],"shield")==0 ) skill_db[i].state = ST_SHIELD; - else if( strcmpi(split[10],"sight")==0 ) skill_db[i].state = ST_SIGHT; - else if( strcmpi(split[10],"explosionspirits")==0 ) skill_db[i].state = ST_EXPLOSIONSPIRITS; - else if( strcmpi(split[10],"cartboost")==0 ) skill_db[i].state = ST_CARTBOOST; - else if( strcmpi(split[10],"recover_weight_rate")==0 ) skill_db[i].state = ST_RECOV_WEIGHT_RATE; - else if( strcmpi(split[10],"move_enable")==0 ) skill_db[i].state = ST_MOVE_ENABLE; - else if( strcmpi(split[10],"water")==0 ) skill_db[i].state = ST_WATER; + skill_split_atoi(split[9],skill_db[idx].ammo_qty); + + if( strcmpi(split[10],"hiding")==0 ) skill_db[idx].state = ST_HIDING; + else if( strcmpi(split[10],"cloaking")==0 ) skill_db[idx].state = ST_CLOAKING; + else if( strcmpi(split[10],"hidden")==0 ) skill_db[idx].state = ST_HIDDEN; + else if( strcmpi(split[10],"riding")==0 ) skill_db[idx].state = ST_RIDING; + else if( strcmpi(split[10],"falcon")==0 ) skill_db[idx].state = ST_FALCON; + else if( strcmpi(split[10],"cart")==0 ) skill_db[idx].state = ST_CART; + else if( strcmpi(split[10],"shield")==0 ) skill_db[idx].state = ST_SHIELD; + else if( strcmpi(split[10],"sight")==0 ) skill_db[idx].state = ST_SIGHT; + else if( strcmpi(split[10],"explosionspirits")==0 ) skill_db[idx].state = ST_EXPLOSIONSPIRITS; + else if( strcmpi(split[10],"cartboost")==0 ) skill_db[idx].state = ST_CARTBOOST; + else if( strcmpi(split[10],"recover_weight_rate")==0 ) skill_db[idx].state = ST_RECOV_WEIGHT_RATE; + else if( strcmpi(split[10],"move_enable")==0 ) skill_db[idx].state = ST_MOVE_ENABLE; + else if( strcmpi(split[10],"water")==0 ) skill_db[idx].state = ST_WATER; /** * New States **/ - else if( strcmpi(split[10],"dragon")==0 ) skill_db[i].state = ST_RIDINGDRAGON; - else if( strcmpi(split[10],"warg")==0 ) skill_db[i].state = ST_WUG; - else if( strcmpi(split[10],"ridingwarg")==0 ) skill_db[i].state = ST_RIDINGWUG; - else if( strcmpi(split[10],"mado")==0 ) skill_db[i].state = ST_MADO; - else if( strcmpi(split[10],"elementalspirit")==0 ) skill_db[i].state = ST_ELEMENTALSPIRIT; - else if (strcmpi(split[10], "poisonweapon") == 0) skill_db[i].state = ST_POISONINGWEAPON; - else if (strcmpi(split[10], "rollingcutter") == 0) skill_db[i].state = ST_ROLLINGCUTTER; - else if (strcmpi(split[10], "mh_fighting") == 0) skill_db[i].state = ST_MH_FIGHTING; - else if (strcmpi(split[10], "mh_grappling") == 0) skill_db[i].state = ST_MH_GRAPPLING; + else if( strcmpi(split[10],"dragon")==0 ) skill_db[idx].state = ST_RIDINGDRAGON; + else if( strcmpi(split[10],"warg")==0 ) skill_db[idx].state = ST_WUG; + else if( strcmpi(split[10],"ridingwarg")==0 ) skill_db[idx].state = ST_RIDINGWUG; + else if( strcmpi(split[10],"mado")==0 ) skill_db[idx].state = ST_MADO; + else if( strcmpi(split[10],"elementalspirit")==0 ) skill_db[idx].state = ST_ELEMENTALSPIRIT; + else if (strcmpi(split[10], "poisonweapon") == 0) skill_db[idx].state = ST_POISONINGWEAPON; + else if (strcmpi(split[10], "rollingcutter") == 0) skill_db[idx].state = ST_ROLLINGCUTTER; + else if (strcmpi(split[10], "mh_fighting") == 0) skill_db[idx].state = ST_MH_FIGHTING; + else if (strcmpi(split[10], "mh_grappling") == 0) skill_db[idx].state = ST_MH_GRAPPLING; /** * Unknown or no state **/ - else skill_db[i].state = ST_NONE; + else skill_db[idx].state = ST_NONE; - skill_split_atoi(split[11],skill_db[i].spiritball); + skill_split_atoi(split[11],skill_db[idx].spiritball); for( j = 0; j < MAX_SKILL_ITEM_REQUIRE; j++ ) { - skill_db[i].itemid[j] = atoi(split[12+ 2*j]); - skill_db[i].amount[j] = atoi(split[13+ 2*j]); + skill_db[idx].itemid[j] = atoi(split[12+ 2*j]); + skill_db[idx].amount[j] = atoi(split[13+ 2*j]); } return true; } static bool skill_parse_row_castdb(char* split[], int columns, int current) -{// SkillID,CastingTime,AfterCastActDelay,AfterCastWalkDelay,Duration1,Duration2 - int i = atoi(split[0]); - i = skill_get_index(i); - if( !i ) // invalid skill id +{// skill_id,CastingTime,AfterCastActDelay,AfterCastWalkDelay,Duration1,Duration2 + uint16 skill_id = atoi(split[0]); + uint16 idx = skill_get_index(skill_id); + if( !idx ) // invalid skill id return false; - skill_split_atoi(split[1],skill_db[i].cast); - skill_split_atoi(split[2],skill_db[i].delay); - skill_split_atoi(split[3],skill_db[i].walkdelay); - skill_split_atoi(split[4],skill_db[i].upkeep_time); - skill_split_atoi(split[5],skill_db[i].upkeep_time2); - skill_split_atoi(split[6],skill_db[i].cooldown); + skill_split_atoi(split[1],skill_db[idx].cast); + skill_split_atoi(split[2],skill_db[idx].delay); + skill_split_atoi(split[3],skill_db[idx].walkdelay); + skill_split_atoi(split[4],skill_db[idx].upkeep_time); + skill_split_atoi(split[5],skill_db[idx].upkeep_time2); + skill_split_atoi(split[6],skill_db[idx].cooldown); #ifdef RENEWAL_CAST - skill_split_atoi(split[7],skill_db[i].fixed_cast); + skill_split_atoi(split[7],skill_db[idx].fixed_cast); #endif return true; } static bool skill_parse_row_castnodexdb(char* split[], int columns, int current) {// Skill id,Cast,Delay (optional) - int i = atoi(split[0]); - i = skill_get_index(i); - if( !i ) // invalid skill id + uint16 skill_id = atoi(split[0]); + uint16 idx = skill_get_index(skill_id); + if( !idx ) // invalid skill id return false; - skill_split_atoi(split[1],skill_db[i].castnodex); + skill_split_atoi(split[1],skill_db[idx].castnodex); if( split[2] ) // optional column - skill_split_atoi(split[2],skill_db[i].delaynodex); + skill_split_atoi(split[2],skill_db[idx].delaynodex); return true; } static bool skill_parse_row_nocastdb(char* split[], int columns, int current) -{// SkillID,Flag - int i = atoi(split[0]); - i = skill_get_index(i); - if( !i ) // invalid skill id +{// skill_id,Flag + uint16 skill_id = atoi(split[0]); + uint16 idx = skill_get_index(skill_id); + if( !idx ) // invalid skill id return false; - skill_db[i].nocast |= atoi(split[1]); + skill_db[idx].nocast |= atoi(split[1]); return true; } static bool skill_parse_row_unitdb(char* split[], int columns, int current) {// ID,unit ID,unit ID 2,layout,range,interval,target,flag - int i = atoi(split[0]); - i = skill_get_index(i); - if( !i ) // invalid skill id + uint16 skill_id = atoi(split[0]); + uint16 idx = skill_get_index(skill_id); + if( !idx ) // invalid skill id return false; - skill_db[i].unit_id[0] = strtol(split[1],NULL,16); - skill_db[i].unit_id[1] = strtol(split[2],NULL,16); - skill_split_atoi(split[3],skill_db[i].unit_layout_type); - skill_split_atoi(split[4],skill_db[i].unit_range); - skill_db[i].unit_interval = atoi(split[5]); + skill_db[idx].unit_id[0] = strtol(split[1],NULL,16); + skill_db[idx].unit_id[1] = strtol(split[2],NULL,16); + skill_split_atoi(split[3],skill_db[idx].unit_layout_type); + skill_split_atoi(split[4],skill_db[idx].unit_range); + skill_db[idx].unit_interval = atoi(split[5]); - if( strcmpi(split[6],"noenemy")==0 ) skill_db[i].unit_target = BCT_NOENEMY; - else if( strcmpi(split[6],"friend")==0 ) skill_db[i].unit_target = BCT_NOENEMY; - else if( strcmpi(split[6],"party")==0 ) skill_db[i].unit_target = BCT_PARTY; - else if( strcmpi(split[6],"ally")==0 ) skill_db[i].unit_target = BCT_PARTY|BCT_GUILD; - else if( strcmpi(split[6],"guild")==0 ) skill_db[i].unit_target = BCT_GUILD; - else if( strcmpi(split[6],"all")==0 ) skill_db[i].unit_target = BCT_ALL; - else if( strcmpi(split[6],"enemy")==0 ) skill_db[i].unit_target = BCT_ENEMY; - else if( strcmpi(split[6],"self")==0 ) skill_db[i].unit_target = BCT_SELF; - else if( strcmpi(split[6],"noone")==0 ) skill_db[i].unit_target = BCT_NOONE; - else skill_db[i].unit_target = strtol(split[6],NULL,16); + if( strcmpi(split[6],"noenemy")==0 ) skill_db[idx].unit_target = BCT_NOENEMY; + else if( strcmpi(split[6],"friend")==0 ) skill_db[idx].unit_target = BCT_NOENEMY; + else if( strcmpi(split[6],"party")==0 ) skill_db[idx].unit_target = BCT_PARTY; + else if( strcmpi(split[6],"ally")==0 ) skill_db[idx].unit_target = BCT_PARTY|BCT_GUILD; + else if( strcmpi(split[6],"guild")==0 ) skill_db[idx].unit_target = BCT_GUILD; + else if( strcmpi(split[6],"all")==0 ) skill_db[idx].unit_target = BCT_ALL; + else if( strcmpi(split[6],"enemy")==0 ) skill_db[idx].unit_target = BCT_ENEMY; + else if( strcmpi(split[6],"self")==0 ) skill_db[idx].unit_target = BCT_SELF; + else if( strcmpi(split[6],"noone")==0 ) skill_db[idx].unit_target = BCT_NOONE; + else skill_db[idx].unit_target = strtol(split[6],NULL,16); - skill_db[i].unit_flag = strtol(split[7],NULL,16); + skill_db[idx].unit_flag = strtol(split[7],NULL,16); - if (skill_db[i].unit_flag&UF_DEFNOTENEMY && battle_config.defnotenemy) - skill_db[i].unit_target = BCT_NOENEMY; + if (skill_db[idx].unit_flag&UF_DEFNOTENEMY && battle_config.defnotenemy) + skill_db[idx].unit_target = BCT_NOENEMY; //By default, target just characters. - skill_db[i].unit_target |= BL_CHAR; - if (skill_db[i].unit_flag&UF_NOPC) - skill_db[i].unit_target &= ~BL_PC; - if (skill_db[i].unit_flag&UF_NOMOB) - skill_db[i].unit_target &= ~BL_MOB; - if (skill_db[i].unit_flag&UF_SKILL) - skill_db[i].unit_target |= BL_SKILL; + skill_db[idx].unit_target |= BL_CHAR; + if (skill_db[idx].unit_flag&UF_NOPC) + skill_db[idx].unit_target &= ~BL_PC; + if (skill_db[idx].unit_flag&UF_NOMOB) + skill_db[idx].unit_target &= ~BL_MOB; + if (skill_db[idx].unit_flag&UF_SKILL) + skill_db[idx].unit_target |= BL_SKILL; return true; } static bool skill_parse_row_producedb(char* split[], int columns, int current) -{// ProduceItemID,ItemLV,RequireSkill,RequireSkillLv,MaterialID1,MaterialAmount1,...... +{// ProduceItemID,ItemLV,RequireSkill,Requireskill_lv,MaterialID1,MaterialAmount1,...... int x,y; int i = atoi(split[0]); @@ -17745,21 +17748,21 @@ static bool skill_parse_row_createarrowdb(char* split[], int columns, int curren return true; } static bool skill_parse_row_spellbookdb(char* split[], int columns, int current) -{// SkillID,PreservePoints +{// skill_id,PreservePoints - int skillid = atoi(split[0]), - points = atoi(split[1]), - nameid = atoi(split[2]); + uint16 skill_id = atoi(split[0]); + int points = atoi(split[1]); + int nameid = atoi(split[2]); - if( !skill_get_index(skillid) || !skill_get_max(skillid) ) - ShowError("spellbook_db: Invalid skill ID %d\n", skillid); - if ( !skill_get_inf(skillid) ) - ShowError("spellbook_db: Passive skills cannot be memorized (%d/%s)\n", skillid, skill_get_name(skillid)); + if( !skill_get_index(skill_id) || !skill_get_max(skill_id) ) + ShowError("spellbook_db: Invalid skill ID %d\n", skill_id); + if ( !skill_get_inf(skill_id) ) + ShowError("spellbook_db: Passive skills cannot be memorized (%d/%s)\n", skill_id, skill_get_name(skill_id)); if( points < 1 ) - ShowError("spellbook_db: PreservePoints have to be 1 or above! (%d/%s)\n", skillid, skill_get_name(skillid)); + ShowError("spellbook_db: PreservePoints have to be 1 or above! (%d/%s)\n", skill_id, skill_get_name(skill_id)); else { - skill_spellbook_db[current].skillid = skillid; + skill_spellbook_db[current].skill_id = skill_id; skill_spellbook_db[current].point = points; skill_spellbook_db[current].nameid = nameid; @@ -17769,78 +17772,77 @@ static bool skill_parse_row_spellbookdb(char* split[], int columns, int current) return false; } static bool skill_parse_row_improvisedb(char* split[], int columns, int current) -{// SkillID - int i = atoi(split[0]); +{// SkillID,Rate + uint16 skill_id = atoi(split[0]); short j = atoi(split[1]); - if( !skill_get_index(i) || !skill_get_max(i) ) { - ShowError("skill_improvise_db: Invalid skill ID %d\n", i); + if( !skill_get_index(skill_id) || !skill_get_max(skill_id) ) { + ShowError("skill_improvise_db: Invalid skill ID %d\n", skill_id); return false; } - if ( !skill_get_inf(i) ) { - ShowError("skill_improvise_db: Passive skills cannot be casted (%d/%s)\n", i, skill_get_name(i)); + if ( !skill_get_inf(skill_id) ) { + ShowError("skill_improvise_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill_get_name(skill_id)); return false; } if( j < 1 ) { - ShowError("skill_improvise_db: Chances have to be 1 or above! (%d/%s)\n", i, skill_get_name(i)); + ShowError("skill_improvise_db: Chances have to be 1 or above! (%d/%s)\n", skill_id, skill_get_name(skill_id)); return false; } if( current >= MAX_SKILL_IMPROVISE_DB ) { ShowError("skill_improvise_db: Maximum amount of entries reached (%d), increase MAX_SKILL_IMPROVISE_DB\n",MAX_SKILL_IMPROVISE_DB); } - skill_improvise_db[current].skillid = i; + skill_improvise_db[current].skill_id = skill_id; skill_improvise_db[current].per = j; // Still need confirm it. return true; } static bool skill_parse_row_magicmushroomdb(char* split[], int column, int current) -{ - int i = atoi(split[0]); +{// SkillID + uint16 skill_id = atoi(split[0]); - if( !skill_get_index(i) || !skill_get_max(i) ) + if( !skill_get_index(skill_id) || !skill_get_max(skill_id) ) { - ShowError("magicmushroom_db: Invalid skill ID %d\n", i); + ShowError("magicmushroom_db: Invalid skill ID %d\n", skill_id); return false; } - if ( !skill_get_inf(i) ) + if ( !skill_get_inf(skill_id) ) { - ShowError("magicmushroom_db: Passive skills cannot be casted (%d/%s)\n", i, skill_get_name(i)); + ShowError("magicmushroom_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill_get_name(skill_id)); return false; } - skill_magicmushroom_db[current].skillid = i; + skill_magicmushroom_db[current].skill_id = skill_id; return true; } static bool skill_parse_row_reproducedb(char* split[], int column, int current) { - int skillid = atoi(split[0]); - - skillid = skill_get_index(skillid); - if( !skillid ) + uint16 skill_id = atoi(split[0]); + uint16 idx = skill_get_index(skill_id); + if( !idx ) return false; - skill_reproduce_db[skillid] = true; + skill_reproduce_db[idx] = true; return true; } static bool skill_parse_row_abradb(char* split[], int columns, int current) -{// SkillID,DummyName,RequiredHocusPocusLevel,Rate - int i = atoi(split[0]); - if( !skill_get_index(i) || !skill_get_max(i) ) +{// skill_id,DummyName,RequiredHocusPocusLevel,Rate + uint16 skill_id = atoi(split[0]); + if( !skill_get_index(skill_id) || !skill_get_max(skill_id) ) { - ShowError("abra_db: Invalid skill ID %d\n", i); + ShowError("abra_db: Invalid skill ID %d\n", skill_id); return false; } - if ( !skill_get_inf(i) ) + if ( !skill_get_inf(skill_id) ) { - ShowError("abra_db: Passive skills cannot be casted (%d/%s)\n", i, skill_get_name(i)); + ShowError("abra_db: Passive skills cannot be casted (%d/%s)\n", skill_id, skill_get_name(skill_id)); return false; } - skill_abra_db[current].skillid = i; + skill_abra_db[current].skill_id = skill_id; skill_abra_db[current].req_lv = atoi(split[2]); skill_abra_db[current].per = atoi(split[3]); @@ -17848,19 +17850,19 @@ static bool skill_parse_row_abradb(char* split[], int columns, int current) } static bool skill_parse_row_changematerialdb(char* split[], int columns, int current) -{// SkillID - int i = atoi(split[0]); +{// ProductID,BaseRate,MakeAmount1,MakeAmountRate1...,MakeAmount5,MakeAmountRate5 + uint16 skill_id = atoi(split[0]); short j = atoi(split[1]); int x,y; for(x=0; x<MAX_SKILL_PRODUCE_DB; x++){ - if( skill_produce_db[x].nameid == i ) + if( skill_produce_db[x].nameid == skill_id ) if( skill_produce_db[x].req_skill == GN_CHANGEMATERIAL ) break; } if( x >= MAX_SKILL_PRODUCE_DB ){ - ShowError("changematerial_db: Not supported item ID(%d) for Change Material. \n", i); + ShowError("changematerial_db: Not supported item ID(%d) for Change Material. \n", skill_id); return false; } @@ -17868,7 +17870,7 @@ static bool skill_parse_row_changematerialdb(char* split[], int columns, int cur ShowError("skill_changematerial_db: Maximum amount of entries reached (%d), increase MAX_SKILL_PRODUCE_DB\n",MAX_SKILL_PRODUCE_DB); } - skill_changematerial_db[current].itemid = i; + skill_changematerial_db[current].itemid = skill_id; skill_changematerial_db[current].rate = j; for( x = 2, y = 0; x+1 < columns && split[x] && split[x+1] && y < 5; x += 2, y++ ) diff --git a/src/map/skill.h b/src/map/skill.h index 7d7e2956e..afef8b5a2 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -132,7 +132,7 @@ struct skill_timerskill { int target_id; int map; short x,y; - short skill_id,skill_lv; + uint16 skill_id,skill_lv; int type; // a BF_ type (NOTE: some places use this as general-purpose storage...) int flag; }; @@ -149,7 +149,7 @@ struct skill_unit_group { unsigned int tick; int limit,interval; - short skill_id,skill_lv; + uint16 skill_id,skill_lv; int val1,val2,val3; char *valstr; int unit_id; @@ -217,7 +217,7 @@ extern struct s_skill_arrow_db skill_arrow_db[MAX_SKILL_ARROW_DB]; // Abracadabra database struct s_skill_abra_db { - int skillid; + uint16 skill_id; int req_lv; int per; }; @@ -231,70 +231,70 @@ int do_final_skill(void); //Returns the cast type of the skill: ground cast, castend damage, castend no damage enum { CAST_GROUND, CAST_DAMAGE, CAST_NODAMAGE }; -int skill_get_casttype(int id); //[Skotlex] +int skill_get_casttype(uint16 skill_id); //[Skotlex] // Accessor to the skills database // -int skill_get_index( int id ); -int skill_get_type( int id ); -int skill_get_hit( int id ); -int skill_get_inf( int id ); -int skill_get_ele( int id , int lv ); -int skill_get_nk( int id ); -int skill_get_max( int id ); -int skill_get_range( int id , int lv ); -int skill_get_range2(struct block_list *bl, int id, int lv); -int skill_get_splash( int id , int lv ); -int skill_get_hp( int id ,int lv ); -int skill_get_mhp( int id ,int lv ); -int skill_get_sp( int id ,int lv ); -int skill_get_state(int id); -int skill_get_zeny( int id ,int lv ); -int skill_get_num( int id ,int lv ); -int skill_get_cast( int id ,int lv ); -int skill_get_delay( int id ,int lv ); -int skill_get_walkdelay( int id ,int lv ); -int skill_get_time( int id ,int lv ); -int skill_get_time2( int id ,int lv ); -int skill_get_castnodex( int id ,int lv ); -int skill_get_castdef( int id ); -int skill_get_weapontype( int id ); -int skill_get_ammotype( int id ); -int skill_get_ammo_qty( int id, int lv ); -int skill_get_nocast( int id ); -int skill_get_unit_id(int id,int flag); -int skill_get_inf2( int id ); -int skill_get_castcancel( int id ); -int skill_get_maxcount( int id ,int lv ); -int skill_get_blewcount( int id ,int lv ); -int skill_get_unit_flag( int id ); -int skill_get_unit_target( int id ); -int skill_tree_get_max( int id, int b_class ); // Celest -const char* skill_get_name( int id ); // [Skotlex] -const char* skill_get_desc( int id ); // [Skotlex] +int skill_get_index( uint16 skill_id ); +int skill_get_type( uint16 skill_id ); +int skill_get_hit( uint16 skill_id ); +int skill_get_inf( uint16 skill_id ); +int skill_get_ele( uint16 skill_id , uint16 skill_lv ); +int skill_get_nk( uint16 skill_id ); +int skill_get_max( uint16 skill_id ); +int skill_get_range( uint16 skill_id , uint16 skill_lv ); +int skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv); +int skill_get_splash( uint16 skill_id , uint16 skill_lv ); +int skill_get_hp( uint16 skill_id ,uint16 skill_lv ); +int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ); +int skill_get_sp( uint16 skill_id ,uint16 skill_lv ); +int skill_get_state(uint16 skill_id); +int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ); +int skill_get_num( uint16 skill_id ,uint16 skill_lv ); +int skill_get_cast( uint16 skill_id ,uint16 skill_lv ); +int skill_get_delay( uint16 skill_id ,uint16 skill_lv ); +int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ); +int skill_get_time( uint16 skill_id ,uint16 skill_lv ); +int skill_get_time2( uint16 skill_id ,uint16 skill_lv ); +int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ); +int skill_get_castdef( uint16 skill_id ); +int skill_get_weapontype( uint16 skill_id ); +int skill_get_ammotype( uint16 skill_id ); +int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ); +int skill_get_nocast( uint16 skill_id ); +int skill_get_unit_id(uint16 skill_id,int flag); +int skill_get_inf2( uint16 skill_id ); +int skill_get_castcancel( uint16 skill_id ); +int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ); +int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ); +int skill_get_unit_flag( uint16 skill_id ); +int skill_get_unit_target( uint16 skill_id ); +int skill_tree_get_max( uint16 skill_id, int b_class ); // Celest +const char* skill_get_name( uint16 skill_id ); // [Skotlex] +const char* skill_get_desc( uint16 skill_id ); // [Skotlex] int skill_name2id(const char* name); int skill_isammotype(struct map_session_data *sd, int skill); int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data); int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data); -int skill_castend_map( struct map_session_data *sd,short skill_num, const char *map); +int skill_castend_map( struct map_session_data *sd,uint16 skill_id, const char *map); int skill_cleartimerskill(struct block_list *src); -int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int x,int y,int skill_id,int skill_lv,int type,int flag); +int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int x,int y,uint16 skill_id,uint16 skill_lv,int type,int flag); // Results? Added -int skill_additional_effect( struct block_list* src, struct block_list *bl,int skillid,int skilllv,int attack_type,int dmg_lv,unsigned int tick); -int skill_counter_additional_effect( struct block_list* src, struct block_list *bl,int skillid,int skilllv,int attack_type,unsigned int tick); -int skill_blown(struct block_list* src, struct block_list* target, int count, int direction, int flag); +int skill_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,int dmg_lv,unsigned int tick); +int skill_counter_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,unsigned int tick); +int skill_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag); int skill_break_equip(struct block_list *bl, unsigned short where, int rate, int flag); int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time); // Skills unit struct skill_unit_group* skill_id2group(int group_id); -struct skill_unit_group *skill_unitsetting(struct block_list* src, short skillid, short skilllv, short x, short y, int flag); +struct skill_unit_group *skill_unitsetting(struct block_list* src, uint16 skill_id, uint16 skill_lv, short x, short y, int flag); struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2); int skill_delunit(struct skill_unit *unit); -struct skill_unit_group *skill_initunitgroup(struct block_list* src, int count, short skillid, short skilllv, int unit_id, int limit, int interval); +struct skill_unit_group *skill_initunitgroup(struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval); int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int line, const char* func); #define skill_delunitgroup(group) skill_delunitgroup_(group,__FILE__,__LINE__,__func__) int skill_clear_unitgroup(struct block_list *src); @@ -303,12 +303,12 @@ void ext_skill_unit_onplace(struct skill_unit *src, struct block_list *bl, unsig int skill_unit_ondamaged(struct skill_unit *src,struct block_list *bl,int damage,unsigned int tick); -int skill_castfix( struct block_list *bl, int skill_id, int skill_lv); +int skill_castfix( struct block_list *bl, uint16 skill_id, uint16 skill_lv); int skill_castfix_sc( struct block_list *bl, int time); #ifdef RENEWAL_CAST -int skill_vfcastfix( struct block_list *bl, double time, int skill_id, int skill_lv); +int skill_vfcastfix( struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv); #endif -int skill_delayfix( struct block_list *bl, int skill_id, int skill_lv); +int skill_delayfix( struct block_list *bl, uint16 skill_id, uint16 skill_lv); // Skill conditions check and remove [Inkfish] int skill_check_condition_castbegin(struct map_session_data *sd, short skill, short lv); @@ -316,12 +316,12 @@ int skill_check_condition_castend(struct map_session_data *sd, short skill, shor int skill_consume_requirement(struct map_session_data *sd, short skill, short lv, short type); struct skill_condition skill_get_requirement(struct map_session_data *sd, short skill, short lv); -int skill_check_pc_partner(struct map_session_data *sd, short skill_id, short* skill_lv, int range, int cast_flag); +int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, short* skill_lv, int range, int cast_flag); // -- moonsoul (added skill_check_unit_cell) -int skill_check_unit_cell(int skillid,int m,int x,int y,int unit_id); +int skill_check_unit_cell(uint16 skill_id,int16 m,int16 x,int16 y,int unit_id); int skill_unit_out_all( struct block_list *bl,unsigned int tick,int range); int skill_unit_move(struct block_list *bl,unsigned int tick,int flag); -int skill_unit_move_unit_group( struct skill_unit_group *group, int m,int dx,int dy); +int skill_unit_move_unit_group( struct skill_unit_group *group, int16 m,int16 dx,int16 dy); struct skill_unit_group *skill_check_dancing( struct block_list *src ); @@ -332,40 +332,40 @@ int skill_guildaura_sub (struct map_session_data* sd, int id, int strvit, int ag int skill_castcancel(struct block_list *bl,int type); int skill_sit (struct map_session_data *sd, int type); -void skill_brandishspear(struct block_list* src, struct block_list* bl, int skillid, int skilllv, unsigned int tick, int flag); +void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag); void skill_repairweapon(struct map_session_data *sd, int idx); void skill_identify(struct map_session_data *sd,int idx); void skill_weaponrefine(struct map_session_data *sd,int idx); // [Celest] -int skill_autospell(struct map_session_data *md,int skillid); +int skill_autospell(struct map_session_data *md,uint16 skill_id); -int skill_calc_heal(struct block_list *src, struct block_list *target, int skill_id, int skill_lv, bool heal); +int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal); bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce); // Abnormal status int skill_enchant_elemental_end(struct block_list *bl, int type); -int skillnotok(int skillid, struct map_session_data *sd); -int skillnotok_hom(int skillid, struct homun_data *hd); -int skillnotok_mercenary(int skillid, struct mercenary_data *md); +int skillnotok(uint16 skill_id, struct map_session_data *sd); +int skillnotok_hom(uint16 skill_id, struct homun_data *hd); +int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md); int skill_chastle_mob_changetarget(struct block_list *bl,va_list ap); // Item creation int skill_can_produce_mix( struct map_session_data *sd, int nameid, int trigger, int qty); -int skill_produce_mix( struct map_session_data *sd, int skill_id, int nameid, int slot1, int slot2, int slot3, int qty ); +int skill_produce_mix( struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty ); int skill_arrow_create( struct map_session_data *sd,int nameid); // skills for the mob -int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag ); -int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag ); -int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skilllv,unsigned int tick,int flag); +int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag ); +int skill_castend_damage_id( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag ); +int skill_castend_pos2( struct block_list *src, int x,int y,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag); -int skill_blockpc_start_(struct map_session_data*, int, int, bool); -int skill_blockhomun_start (struct homun_data*,int,int); -int skill_blockmerc_start (struct mercenary_data*,int,int); +int skill_blockpc_start_(struct map_session_data*, uint16 skill_id, int, bool); +int skill_blockhomun_start (struct homun_data*,uint16 skill_id,int); +int skill_blockmerc_start (struct mercenary_data*,uint16 skill_id,int); -#define skill_blockpc_start(sd, skillid, tick) skill_blockpc_start_( sd, skillid, tick, false ) +#define skill_blockpc_start(sd, skill_id, tick) skill_blockpc_start_( sd, skill_id, tick, false ) // (Epoque:) To-do: replace this macro with some sort of skill tree check (rather than hard-coded skill names) #define skill_ischangesex(id) ( \ @@ -373,7 +373,7 @@ int skill_blockmerc_start (struct mercenary_data*,int,int); ((id) >= CG_LONGINGFREEDOM && (id) <= CG_TAROTCARD) || ((id) >= WA_SWING_DANCE && (id) <= WM_UNLIMITED_HUMMING_VOICE)) // Skill action, (return dmg,heal) -int skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag ); +int skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag ); void skill_reload(void); @@ -1802,7 +1802,7 @@ enum { /** * Skill Unit Save **/ -void skill_usave_add(struct map_session_data * sd, int skill_num, int skill_lv); +void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill_lv); void skill_usave_trigger(struct map_session_data *sd); /** * Skill Cool Downs - load from pc.c when the character logs in @@ -1819,13 +1819,13 @@ enum wl_spheres { WLS_STONE, }; int skill_spellbook (struct map_session_data *sd, int nameid); -int skill_block_check(struct block_list *bl, enum sc_type type, int skillid); +int skill_block_check(struct block_list *bl, enum sc_type type, uint16 skill_id); /** * Guilottine Cross **/ #define MAX_SKILL_MAGICMUSHROOM_DB 23 struct s_skill_magicmushroom_db { - int skillid; + uint16 skill_id; }; extern struct s_skill_magicmushroom_db skill_magicmushroom_db[MAX_SKILL_MAGICMUSHROOM_DB]; /** @@ -1854,10 +1854,10 @@ enum gx_poison { /** * Auto Shadow Spell (Shadow Chaser) **/ -int skill_select_menu(struct map_session_data *sd,int skill_id); +int skill_select_menu(struct map_session_data *sd,uint16 skill_id); -int skill_elementalanalysis(struct map_session_data *sd, int n, int type, unsigned short *item_list); // Sorcerer Four Elemental Analisys. +int skill_elementalanalysis(struct map_session_data *sd, int n, uint16 skill_lv, unsigned short *item_list); // Sorcerer Four Elemental Analisys. int skill_changematerial(struct map_session_data *sd, int n, unsigned short *item_list); // Genetic Change Material. -int skill_get_elemental_type(int skill_id, int skill_lv); +int skill_get_elemental_type(uint16 skill_id, uint16 skill_lv); #endif /* _SKILL_H_ */ diff --git a/src/map/status.c b/src/map/status.c index adad3f98e..ee5dbb7aa 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -92,12 +92,12 @@ static unsigned int StatusChangeStateTable[SC_MAX]; // status -> flags **/ sc_type status_skill2sc(int skill) { - int sk = skill_get_index(skill); - if( sk == 0 ) { + int idx = skill_get_index(skill); + if( idx == 0 ) { ShowError("status_skill2sc: Unsupported skill id %d\n", skill); return SC_NONE; } - return SkillStatusChangeTable[sk]; + return SkillStatusChangeTable[idx]; } /** @@ -150,11 +150,11 @@ int status_type2relevant_bl_types(int type) // indicates that the status displays a visual effect for the affected unit, and should be sent to the client for all supported units #define set_sc_with_vfx(skill, sc, icon, flag) set_sc((skill), (sc), (icon), (flag)); if((icon) < SI_MAX) StatusRelevantBLTypes[(icon)] |= BL_SCEFFECT -static void set_sc(int skill, sc_type sc, int icon, unsigned int flag) +static void set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag) { - int sk = skill_get_index(skill); - if( sk == 0 ) { - ShowError("set_sc: Unsupported skill id %d\n", skill); + uint16 idx = skill_get_index(skill_id); + if( idx == 0 ) { + ShowError("set_sc: Unsupported skill id %d\n", skill_id); return; } if( sc < 0 || sc >= SC_MAX ) { @@ -163,13 +163,13 @@ static void set_sc(int skill, sc_type sc, int icon, unsigned int flag) } if( StatusSkillChangeTable[sc] == 0 ) - StatusSkillChangeTable[sc] = skill; + StatusSkillChangeTable[sc] = skill_id; if( StatusIconChangeTable[sc] == SI_BLANK ) StatusIconChangeTable[sc] = icon; StatusChangeFlagTable[sc] |= flag; - if( SkillStatusChangeTable[sk] == SC_NONE ) - SkillStatusChangeTable[sk] = sc; + if( SkillStatusChangeTable[idx] == SC_NONE ) + SkillStatusChangeTable[idx] = sc; } void initChangeTables(void) { @@ -1533,7 +1533,7 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per * target MAY Be null, in which case the checks are only to see * whether the source can cast or not the skill on the ground. *------------------------------------------*/ -int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag) +int status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag) { struct status_data *status; struct status_change *sc=NULL, *tsc; @@ -1544,7 +1544,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if (src && src->type != BL_PC && status_isdead(src)) return 0; - if (!skill_num) { //Normal attack checks. + if (!skill_id) { //Normal attack checks. if (!(status->mode&MD_CANATTACK)) return 0; //This mode is only needed for melee attacking. //Dead state is not checked for skills as some skills can be used @@ -1555,7 +1555,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int return 0; } - switch( skill_num ) { + switch( skill_id ) { case PA_PRESSURE: if( flag && target ) { //Gloria Avoids pretty much everything.... @@ -1572,7 +1572,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int //Should fail when used on top of Land Protector [Skotlex] if (src && map_getcell(src->m, src->x, src->y, CELL_CHKLANDPROTECTOR) && !(status->mode&MD_BOSS) - && (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_num)) + && (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_id)) return 0; break; default: @@ -1583,17 +1583,17 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if( sc && sc->count ) { - if (skill_num != RK_REFRESH && sc->opt1 >0 && (sc->opt1 != OPT1_CRYSTALIZE && src->type != BL_MOB) && sc->opt1 != OPT1_BURNING && skill_num != SR_GENTLETOUCH_CURE) { //Stuned/Frozen/etc + if (skill_id != RK_REFRESH && sc->opt1 >0 && (sc->opt1 != OPT1_CRYSTALIZE && src->type != BL_MOB) && sc->opt1 != OPT1_BURNING && skill_id != SR_GENTLETOUCH_CURE) { //Stuned/Frozen/etc if (flag != 1) //Can't cast, casted stuff can't damage. return 0; - if (!(skill_get_inf(skill_num)&INF_GROUND_SKILL)) + if (!(skill_get_inf(skill_id)&INF_GROUND_SKILL)) return 0; //Targetted spells can't come off. } if ( - (sc->data[SC_TRICKDEAD] && skill_num != NV_TRICKDEAD) + (sc->data[SC_TRICKDEAD] && skill_id != NV_TRICKDEAD) || (sc->data[SC_AUTOCOUNTER] && !flag) - || (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF && skill_num != PA_GOSPEL) + || (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF && skill_id != PA_GOSPEL) || (sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 == BCT_SELF && flag != 2) ) return 0; @@ -1608,26 +1608,26 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if (sc->data[SC_BLADESTOP]) { switch (sc->data[SC_BLADESTOP]->val1) { - case 5: if (skill_num == MO_EXTREMITYFIST) break; - case 4: if (skill_num == MO_CHAINCOMBO) break; - case 3: if (skill_num == MO_INVESTIGATE) break; - case 2: if (skill_num == MO_FINGEROFFENSIVE) break; + case 5: if (skill_id == MO_EXTREMITYFIST) break; + case 4: if (skill_id == MO_CHAINCOMBO) break; + case 3: if (skill_id == MO_INVESTIGATE) break; + case 2: if (skill_id == MO_FINGEROFFENSIVE) break; default: return 0; } } if (sc->data[SC_DANCING] && flag!=2) { - if( src->type == BL_PC && skill_num >= WA_SWING_DANCE && skill_num <= WM_UNLIMITED_HUMMING_VOICE ) + if( src->type == BL_PC && skill_id >= WA_SWING_DANCE && skill_id <= WM_UNLIMITED_HUMMING_VOICE ) { // Lvl 5 Lesson or higher allow you use 3rd job skills while dancing.v if( pc_checkskill((TBL_PC*)src,WM_LESSON) < 5 ) return 0; } else if(sc->data[SC_LONGING]) { //Allow everything except dancing/re-dancing. [Skotlex] - if (skill_num == BD_ENCORE || - skill_get_inf2(skill_num)&(INF2_SONG_DANCE|INF2_ENSEMBLE_SKILL) + if (skill_id == BD_ENCORE || + skill_get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_ENSEMBLE_SKILL) ) return 0; } else { - switch (skill_num) { + switch (skill_id) { case BD_ADAPTATION: case CG_LONGINGFREEDOM: case BA_MUSICALSTRIKE: @@ -1637,33 +1637,33 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int return 0; } } - if ((sc->data[SC_DANCING]->val1&0xFFFF) == CG_HERMODE && skill_num == BD_ADAPTATION) + if ((sc->data[SC_DANCING]->val1&0xFFFF) == CG_HERMODE && skill_id == BD_ADAPTATION) return 0; //Can't amp out of Wand of Hermode :/ [Skotlex] } - if (skill_num && //Do not block item-casted skills. - (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_num) + if (skill_id && //Do not block item-casted skills. + (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_id) ) { //Skills blocked through status changes... if (!flag && ( //Blocked only from using the skill (stuff like autospell may still go through sc->cant.cast || - (sc->data[SC_MARIONETTE] && skill_num != CG_MARIONETTE) || //Only skill you can use is marionette again to cancel it - (sc->data[SC_MARIONETTE2] && skill_num == CG_MARIONETTE) || //Cannot use marionette if you are being buffed by another - (sc->data[SC_STASIS] && skill_block_check(src, SC_STASIS, skill_num)) || - (sc->data[SC_KAGEHUMI] && skill_block_check(src, SC_KAGEHUMI, skill_num)) + (sc->data[SC_MARIONETTE] && skill_id != CG_MARIONETTE) || //Only skill you can use is marionette again to cancel it + (sc->data[SC_MARIONETTE2] && skill_id == CG_MARIONETTE) || //Cannot use marionette if you are being buffed by another + (sc->data[SC_STASIS] && skill_block_check(src, SC_STASIS, skill_id)) || + (sc->data[SC_KAGEHUMI] && skill_block_check(src, SC_KAGEHUMI, skill_id)) )) return 0; //Skill blocking. if ( - (sc->data[SC_VOLCANO] && skill_num == WZ_ICEWALL) || - (sc->data[SC_ROKISWEIL] && skill_num != BD_ADAPTATION) || - (sc->data[SC_HERMODE] && skill_get_inf(skill_num) & INF_SUPPORT_SKILL) || + (sc->data[SC_VOLCANO] && skill_id == WZ_ICEWALL) || + (sc->data[SC_ROKISWEIL] && skill_id != BD_ADAPTATION) || + (sc->data[SC_HERMODE] && skill_get_inf(skill_id) & INF_SUPPORT_SKILL) || (sc->data[SC_NOCHAT] && sc->data[SC_NOCHAT]->val1&MANNER_NOSKILL) ) return 0; if( sc->data[SC__MANHOLE] || ((tsc = status_get_sc(target)) && tsc->data[SC__MANHOLE]) ) { - switch(skill_num) {//##TODO## make this a flag in skill_db? + switch(skill_id) {//##TODO## make this a flag in skill_db? // Skills that can be used even under Man Hole effects. case SC_SHADOWFORM: case SC_STRIPACCESSARY: @@ -1679,7 +1679,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if (sc && sc->option) { if (sc->option&OPTION_HIDE) - switch (skill_num) { //Usable skills while hiding. + switch (skill_id) { //Usable skills while hiding. case TF_HIDING: case AS_GRIMTOOTH: case RG_BACKSTAP: @@ -1690,10 +1690,10 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int break; default: //Non players can use all skills while hidden. - if (!skill_num || src->type == BL_PC) + if (!skill_id || src->type == BL_PC) return 0; } - if (sc->option&OPTION_CHASEWALK && skill_num != ST_CHASEWALK) + if (sc->option&OPTION_CHASEWALK && skill_id != ST_CHASEWALK) return 0; if(sc->option&OPTION_MOUNTING) return 0;//New mounts can't attack nor use skills in the client; this check makes it cheat-safe [Ind] @@ -1706,14 +1706,14 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if(tsc && tsc->count) { /* attacks in invincible are capped to 1 damage and handled in batte.c; allow spell break and eske for sealed shrine GDB when in INVINCIBLE state. */ - if( tsc->data[SC_INVINCIBLE] && !tsc->data[SC_INVINCIBLEOFF] && skill_num && !(skill_num&(SA_SPELLBREAKER|SL_SKE)) ) + if( tsc->data[SC_INVINCIBLE] && !tsc->data[SC_INVINCIBLEOFF] && skill_id && !(skill_id&(SA_SPELLBREAKER|SL_SKE)) ) return 0; - if(!skill_num && tsc->data[SC_TRICKDEAD]) + if(!skill_id && tsc->data[SC_TRICKDEAD]) return 0; - if((skill_num == WZ_STORMGUST || skill_num == WZ_FROSTNOVA || skill_num == NJ_HYOUSYOURAKU) + if((skill_id == WZ_STORMGUST || skill_id == WZ_FROSTNOVA || skill_id == NJ_HYOUSYOURAKU) && tsc->data[SC_FREEZE]) return 0; - if(skill_num == PR_LEXAETERNA && (tsc->data[SC_FREEZE] || (tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE))) + if(skill_id == PR_LEXAETERNA && (tsc->data[SC_FREEZE] || (tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE))) return 0; } @@ -1721,7 +1721,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int hide_flag = flag?OPTION_HIDE:(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK); //You cannot hide from ground skills. - if( skill_get_ele(skill_num,1) == ELE_EARTH ) //TODO: Need Skill Lv here :/ + if( skill_get_ele(skill_id,1) == ELE_EARTH ) //TODO: Need Skill Lv here :/ hide_flag &= ~OPTION_HIDE; switch( target->type ) { @@ -1735,7 +1735,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int ((sd->special_state.perfect_hiding || !is_detect) || (tsc->data[SC_CLOAKINGEXCEED] && is_detect))) return 0; - if( tsc->data[SC_CAMOUFLAGE] && !(is_boss || is_detect) && !skill_num ) + if( tsc->data[SC_CAMOUFLAGE] && !(is_boss || is_detect) && !skill_id ) return 0; if( tsc->data[SC_STEALTHFIELD] && !is_boss ) return 0; @@ -1749,11 +1749,11 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int case BL_HOM: case BL_MER: case BL_ELEM: - if( target->type == BL_HOM && skill_num && battle_config.hom_setting&0x1 && skill_get_inf(skill_num)&INF_SUPPORT_SKILL && battle_get_master(target) != src ) + if( target->type == BL_HOM && skill_id && battle_config.hom_setting&0x1 && skill_get_inf(skill_id)&INF_SUPPORT_SKILL && battle_get_master(target) != src ) return 0; // Can't use support skills on Homunculus (only Master/Self) - if( target->type == BL_MER && (skill_num == PR_ASPERSIO || (skill_num >= SA_FLAMELAUNCHER && skill_num <= SA_SEISMICWEAPON)) && battle_get_master(target) != src ) + if( target->type == BL_MER && (skill_id == PR_ASPERSIO || (skill_id >= SA_FLAMELAUNCHER && skill_id <= SA_SEISMICWEAPON)) && battle_get_master(target) != src ) return 0; // Can't use Weapon endow skills on Mercenary (only Master) - if( skill_num == AM_POTIONPITCHER && ( target->type == BL_MER || target->type == BL_ELEM) ) + if( skill_id == AM_POTIONPITCHER && ( target->type == BL_MER || target->type == BL_ELEM) ) return 0; // Can't use Potion Pitcher on Mercenaries default: //Check for chase-walk/hiding/cloaking opponents. @@ -2038,12 +2038,12 @@ int status_calc_mob_(struct mob_data* md, bool first) md->special_state.ai = 0; if (ud) { // different levels of HP according to skill level - if (ud->skillid == AM_SPHEREMINE) { - status->max_hp = 2000 + 400*ud->skilllv; - } else if(ud->skillid == KO_ZANZOU){ - status->max_hp = 3000 + 3000 * ud->skilllv; + if (ud->skill_id == AM_SPHEREMINE) { + status->max_hp = 2000 + 400*ud->skill_lv; + } else if(ud->skill_id == KO_ZANZOU){ + status->max_hp = 3000 + 3000 * ud->skill_lv; } else { //AM_CANNIBALIZE - status->max_hp = 1500 + 200*ud->skilllv + 10*status_get_lv(mbl); + status->max_hp = 1500 + 200*ud->skill_lv + 10*status_get_lv(mbl); status->mode|= MD_CANATTACK|MD_AGGRESSIVE; } status->hp = status->max_hp; @@ -3229,16 +3229,16 @@ int status_calc_elemental_(struct elemental_data *ed, bool first) { int status_calc_npc_(struct npc_data *nd, bool first) { struct status_data *status = &nd->status; - + if (!nd) return 0; - + if (first) { status->hp = 1; status->sp = 1; status->max_hp = 1; status->max_sp = 1; - + status->def_ele = ELE_NEUTRAL; status->ele_lv = 1; status->race = RC_DEMIHUMAN; @@ -3254,7 +3254,7 @@ int status_calc_npc_(struct npc_data *nd, bool first) { status->int_= nd->stat_point; status->dex = nd->stat_point; status->luk = nd->stat_point; - + status_calc_misc(&nd->bl, status, nd->level); status_cpy(&nd->status, status); @@ -3309,8 +3309,8 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct if( sd && sd->hprecov_rate != 100 ) val = val*sd->hprecov_rate/100; - reg_flag = bl->type == BL_PC ? 0 : 1; - + reg_flag = bl->type == BL_PC ? 0 : 1; + regen->hp = cap_value(val, reg_flag, SHRT_MAX); val = 1 + (status->int_/6) + (status->max_sp/100); @@ -3567,7 +3567,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) flag|=SCB_FLEE #ifdef RENEWAL |SCB_DEF2 -#endif +#endif ; if( bl->type&(BL_PC|BL_HOM) ) flag |= SCB_ASPD|SCB_DSPD; @@ -3696,7 +3696,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) ) status->def2 = status_calc_def2(bl, sc, b_status->def2); else - status->def2 = status_calc_def2(bl, sc, b_status->def2 + status->def2 = status_calc_def2(bl, sc, b_status->def2 #ifdef RENEWAL + (int)( ((float)status->vit/2 + (float)b_status->vit/2) + ((float)status->agi/5 + (float)b_status->agi/5) ) #else @@ -3721,7 +3721,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) ) status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2); else - status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2 +(status->int_ - b_status->int_) + status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2 +(status->int_ - b_status->int_) #ifdef RENEWAL + (int)( ((float)status->dex/5 - (float)b_status->dex/5) + ((float)status->vit/5 + (float)b_status->vit/5) ) #else @@ -4352,7 +4352,7 @@ static unsigned short status_calc_int(struct block_list *bl, struct status_chang int_ -= sc->data[SC_STOMACHACHE]->val1; if(sc->data[SC_KYOUGAKU]) int_ -= sc->data[SC_KYOUGAKU]->val2; - + if(sc->data[SC_STRIPHELM]) int_ -= int_ * sc->data[SC_STRIPHELM]->val2/100; if(sc->data[SC__STRIPACCESSORY]) @@ -4806,7 +4806,7 @@ static signed short status_calc_flee(struct block_list *bl, struct status_change if( sc->data[SC_SPEARQUICKEN] ) flee += 2 * sc->data[SC_SPEARQUICKEN]->val1; #endif - + if(sc->data[SC_INCFLEERATE]) flee += flee * sc->data[SC_INCFLEERATE]->val1/100; if(sc->data[SC_SPIDERWEB] && sc->data[SC_SPIDERWEB]->val1) @@ -5090,10 +5090,10 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha if( sc == NULL ) return cap_value(speed,10,USHRT_MAX); - if( sd && sd->ud.skilltimer != INVALID_TIMER && (pc_checkskill(sd,SA_FREECAST) > 0 || sd->ud.skillid == LG_EXEEDBREAK) ) + if( sd && sd->ud.skilltimer != INVALID_TIMER && (pc_checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) ) { - if( sd->ud.skillid == LG_EXEEDBREAK ) - speed_rate = 100 + 60 - (sd->ud.skilllv * 10); + if( sd->ud.skill_id == LG_EXEEDBREAK ) + speed_rate = 100 + 60 - (sd->ud.skill_lv * 10); else speed_rate = 175 - 5 * pc_checkskill(sd,SA_FREECAST); } @@ -5834,7 +5834,7 @@ defType status_get_def(struct block_list *bl) { int def = status?status->def:0; ud = unit_bl2ud(bl); if (ud && ud->skilltimer != INVALID_TIMER) - def -= def * skill_get_castdef(ud->skillid)/100; + def -= def * skill_get_castdef(ud->skill_id)/100; return cap_value(def, DEFTYPE_MIN, DEFTYPE_MAX); } @@ -7366,7 +7366,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_DANCING: //val1 : Skill ID + LV //val2 : Skill Group of the Dance. - //val3 : Brings the skilllv (merged into val1 here) + //val3 : Brings the skill_lv (merged into val1 here) //val4 : Partner if (val1 == CG_MOONLIT) clif_status_change(bl,SI_MOONLIT,1,tick,0, 0, 0); @@ -7734,7 +7734,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val } break; case SC_KAITE: - val2 = 1+val1/5; //Number of bounces: 1 + skilllv/5 + val2 = 1+val1/5; //Number of bounces: 1 + skill_lv/5 break; case SC_KAUPE: switch (val1) { @@ -7769,7 +7769,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val } break; case SC_EARTHSCROLL: - val2 = 11-val1; //Chance to consume: 11-skilllv% + val2 = 11-val1; //Chance to consume: 11-skill_lv% break; case SC_RUN: val4 = gettick(); //Store time at which you started running. @@ -8435,7 +8435,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val3 = MG_FIREBOLT; break; case SC_AQUAPLAY_OPTION: - val2 = 40; + val2 = 40; val_flag |= 1|2|4; break; case SC_COOLER_OPTION: @@ -8598,7 +8598,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_STYLE_CHANGE: //[Lighta] need real info tick = -1; if(val2 == MH_MD_FIGHTING) val2 = MH_MD_GRAPPLING; - else val2 = MH_MD_FIGHTING; + else val2 = MH_MD_FIGHTING; break; default: if( calc_flag == SCB_NONE && StatusSkillChangeTable[type] == 0 && StatusIconChangeTable[type] == 0 ) @@ -9476,7 +9476,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const sc_start(bl,SC_HALLUCINATIONWALK_POSTDELAY,100,sce->val1,skill_get_time2(GC_HALLUCINATIONWALK,sce->val1)); break; case SC_WHITEIMPRISON: - { + { struct block_list* src = map_id2bl(sce->val2); if( tid == -1 || !src) break; // Terminated by Damage @@ -10188,24 +10188,24 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) if( !flag ) { // Random Skill Cast if (sd && !pc_issit(sd)) { //can't cast if sit - int mushroom_skillid = 0, i; + int mushroom_skill_id = 0, i; unit_stop_attack(bl); unit_skillcastcancel(bl,1); do { i = rnd() % MAX_SKILL_MAGICMUSHROOM_DB; - mushroom_skillid = skill_magicmushroom_db[i].skillid; + mushroom_skill_id = skill_magicmushroom_db[i].skill_id; } - while( mushroom_skillid == 0 ); + while( mushroom_skill_id == 0 ); - switch( skill_get_casttype(mushroom_skillid) ) { // Magic Mushroom skills are buffs or area damage + switch( skill_get_casttype(mushroom_skill_id) ) { // Magic Mushroom skills are buffs or area damage case CAST_GROUND: - skill_castend_pos2(bl,bl->x,bl->y,mushroom_skillid,1,tick,0); + skill_castend_pos2(bl,bl->x,bl->y,mushroom_skill_id,1,tick,0); break; case CAST_NODAMAGE: - skill_castend_nodamage_id(bl,bl,mushroom_skillid,1,tick,0); + skill_castend_nodamage_id(bl,bl,mushroom_skill_id,1,tick,0); break; case CAST_DAMAGE: - skill_castend_damage_id(bl,bl,mushroom_skillid,1,tick,0); + skill_castend_damage_id(bl,bl,mushroom_skill_id,1,tick,0); break; } } @@ -10356,7 +10356,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) case SC__INVISIBILITY: if( --(sce->val4) >= 0 ) { - if( !status_charge(bl, 0, (status->sp * 6 - sce->val1) / 100) )// 6% - skilllv. + if( !status_charge(bl, 0, (status->sp * 6 - sce->val1) / 100) )// 6% - skill_lv. break; sc_timer_next(1000 + tick, status_change_timer, bl->id, data); return 0; diff --git a/src/map/status.h b/src/map/status.h index 9e162faeb..c1975805d 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1800,7 +1800,7 @@ void status_calc_misc(struct block_list *bl, struct status_data *status, int lev void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen); void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, struct status_change *sc); -int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag); // [Skotlex] +int status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag); // [Skotlex] int status_check_visibility(struct block_list *src, struct block_list *target); //[Skotlex] int status_change_spread( struct block_list *src, struct block_list *bl ); diff --git a/src/map/unit.c b/src/map/unit.c index 1e24f1b7e..f8e887dc6 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -77,7 +77,7 @@ int unit_walktoxy_sub(struct block_list *bl) if (ud->target_to && ud->chaserange>1) { //Generally speaking, the walk path is already to an adjacent tile //so we only need to shorten the path if the range is greater than 1. - int dir; + uint8 dir; //Trim the last part of the path to account for range, //but always move at least one cell when requested to move. for (i = ud->chaserange*10; i > 0 && ud->walkpath.path_len>1;) { @@ -212,7 +212,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data !(ud->walk_count%WALK_SKILL_INTERVAL) && mobskill_use(md, tick, -1)) { - if (!(ud->skillid == NPC_SELFDESTRUCTION && ud->skilltimer != INVALID_TIMER)) + if (!(ud->skill_id == NPC_SELFDESTRUCTION && ud->skilltimer != INVALID_TIMER)) { //Skill used, abort walking clif_fixpos(bl); //Fix position as walk has been cancelled. return 0; @@ -585,7 +585,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) { //Makes bl attempt to run dist cells away from target. Uses hard-paths. int unit_escape(struct block_list *bl, struct block_list *target, short dist) { - int dir = map_calc_dir(target, bl->x, bl->y); + uint8 dir = map_calc_dir(target, bl->x, bl->y); while( dist > 0 && map_getcell(bl->m, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], CELL_CHKNOREACH) ) dist--; return ( dist > 0 && unit_walktoxy(bl, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], 0) ); @@ -864,14 +864,14 @@ int unit_stop_walking(struct block_list *bl,int type) return 1; } -int unit_skilluse_id(struct block_list *src, int target_id, short skill_num, short skill_lv) +int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv) { - if(skill_num < 0) return 0; + if(skill_id < 0) return 0; return unit_skilluse_id2( - src, target_id, skill_num, skill_lv, - skill_castfix(src, skill_num, skill_lv), - skill_get_castcancel(skill_num) + src, target_id, skill_id, skill_lv, + skill_castfix(src, skill_id, skill_lv), + skill_get_castcancel(skill_id) ); } @@ -900,7 +900,7 @@ int unit_can_move(struct block_list *bl) if (!ud) return 0; - if (ud->skilltimer != INVALID_TIMER && ud->skillid != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skillid)&INF2_GUILD_SKILL)) + if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skill_id)&INF2_GUILD_SKILL)) return 0; // prevent moving while casting if (DIFF_TICK(ud->canmove_tick, gettick()) > 0) @@ -949,11 +949,11 @@ int unit_resume_running(int tid, unsigned int tick, int id, intptr_t data) TBL_PC * sd = map_id2sd(id); if(sd && pc_isridingwug(sd)) - clif_skill_nodamage(ud->bl,ud->bl,RA_WUGDASH,ud->skilllv, - sc_start4(ud->bl,status_skill2sc(RA_WUGDASH),100,ud->skilllv,unit_getdir(ud->bl),0,0,1)); + clif_skill_nodamage(ud->bl,ud->bl,RA_WUGDASH,ud->skill_lv, + sc_start4(ud->bl,status_skill2sc(RA_WUGDASH),100,ud->skill_lv,unit_getdir(ud->bl),0,0,1)); else - clif_skill_nodamage(ud->bl,ud->bl,TK_RUN,ud->skilllv, - sc_start4(ud->bl,status_skill2sc(TK_RUN),100,ud->skilllv,unit_getdir(ud->bl),0,0,0)); + clif_skill_nodamage(ud->bl,ud->bl,TK_RUN,ud->skill_lv, + sc_start4(ud->bl,status_skill2sc(TK_RUN),100,ud->skill_lv,unit_getdir(ud->bl),0,0,0)); if (sd) clif_walkok(sd); @@ -1009,7 +1009,7 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int return 1; } -int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, short skill_lv, int casttime, int castcancel) +int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) { struct unit_data *ud; struct status_data *tstatus; @@ -1032,20 +1032,20 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh sc = NULL; //Unneeded //temp: used to signal combo-skills right now. - if (sc && sc->data[SC_COMBO] && (sc->data[SC_COMBO]->val1 == skill_num || - (sd?skill_check_condition_castbegin(sd,skill_num,skill_lv):0) )) { + if (sc && sc->data[SC_COMBO] && (sc->data[SC_COMBO]->val1 == skill_id || + (sd?skill_check_condition_castbegin(sd,skill_id,skill_lv):0) )) { if (sc->data[SC_COMBO]->val2) target_id = sc->data[SC_COMBO]->val2; else target_id = ud->target; - if( skill_get_inf(skill_num)&INF_SELF_SKILL && skill_get_nk(skill_num)&NK_NO_DAMAGE )// exploit fix + if( skill_get_inf(skill_id)&INF_SELF_SKILL && skill_get_nk(skill_id)&NK_NO_DAMAGE )// exploit fix target_id = src->id; temp = 1; } else if ( target_id == src->id && - skill_get_inf(skill_num)&INF_SELF_SKILL && - skill_get_inf2(skill_num)&INF2_NO_TARGET_SELF ) + skill_get_inf(skill_id)&INF_SELF_SKILL && + skill_get_inf2(skill_id)&INF2_NO_TARGET_SELF ) { target_id = ud->target; //Auto-select target. [Skotlex] temp = 1; @@ -1053,10 +1053,10 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh if (sd) { //Target_id checking. - if(skillnotok(skill_num, sd)) // [MouseJstr] + if(skillnotok(skill_id, sd)) // [MouseJstr] return 0; - switch(skill_num) + switch(skill_id) { //Check for skills that auto-select target case MO_CHAINCOMBO: if (sc && sc->data[SC_BLADESTOP]){ @@ -1070,7 +1070,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh return 0; target = (struct block_list*)map_charid2sd(sd->status.partner_id); if (!target) { - clif_skill_fail(sd,skill_num,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } break; @@ -1079,7 +1079,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh target_id = target->id; } if (src->type==BL_HOM) - switch(skill_num) + switch(skill_id) { //Homun-auto-target skills. case HLIF_HEAL: case HLIF_AVOID: @@ -1100,32 +1100,32 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh return 0; //Normally not needed because clif.c checks for it, but the at/char/script commands don't! [Skotlex] - if(ud->skilltimer != INVALID_TIMER && skill_num != SA_CASTCANCEL && skill_num != SO_SPELLFIST) + if(ud->skilltimer != INVALID_TIMER && skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return 0; - if(skill_get_inf2(skill_num)&INF2_NO_TARGET_SELF && src->id == target_id) + if(skill_get_inf2(skill_id)&INF2_NO_TARGET_SELF && src->id == target_id) return 0; - if(!status_check_skilluse(src, target, skill_num, 0)) + if(!status_check_skilluse(src, target, skill_id, 0)) return 0; tstatus = status_get_status_data(target); // Record the status of the previous skill) if(sd) { - switch(skill_num){ + switch(skill_id){ case SA_CASTCANCEL: - if(ud->skillid != skill_num){ - sd->skillid_old = ud->skillid; - sd->skilllv_old = ud->skilllv; + if(ud->skill_id != skill_id){ + sd->skill_id_old = ud->skill_id; + sd->skill_lv_old = ud->skill_lv; } break; case BD_ENCORE: //Prevent using the dance skill if you no longer have the skill in your tree. - if(!sd->skillid_dance || pc_checkskill(sd,sd->skillid_dance)<=0){ - clif_skill_fail(sd,skill_num,USESKILL_FAIL_LEVEL,0); + if(!sd->skill_id_dance || pc_checkskill(sd,sd->skill_id_dance)<=0){ + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } - sd->skillid_old = skill_num; + sd->skill_id_old = skill_id; break; case BD_LULLABY: case BD_RICHMANKIM: @@ -1136,31 +1136,31 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh case BD_INTOABYSS: case BD_SIEGFRIED: case CG_MOONLIT: - if (skill_check_pc_partner(sd, skill_num, &skill_lv, 1, 0) < 1) + if (skill_check_pc_partner(sd, skill_id, &skill_lv, 1, 0) < 1) { - clif_skill_fail(sd,skill_num,USESKILL_FAIL_LEVEL,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } break; case WL_WHITEIMPRISON: if( battle_check_target(src,target,BCT_SELF|BCT_ENEMY) < 0 ) { - clif_skill_fail(sd,skill_num,USESKILL_FAIL_TOTARGET,0); + clif_skill_fail(sd,skill_id,USESKILL_FAIL_TOTARGET,0); return 0; } break; case MG_FIREBOLT: case MG_LIGHTNINGBOLT: case MG_COLDBOLT: - sd->skillid_old = skill_num; - sd->skilllv_old = skill_lv; + sd->skill_id_old = skill_id; + sd->skill_lv_old = skill_lv; break; } - if (!skill_check_condition_castbegin(sd, skill_num, skill_lv)) + if (!skill_check_condition_castbegin(sd, skill_id, skill_lv)) return 0; } if( src->type == BL_MOB ) - switch( skill_num ) + switch( skill_id ) { case NPC_SUMMONSLAVE: case NPC_SUMMONMONSTER: @@ -1172,13 +1172,13 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh //Check range when not using skill on yourself or is a combo-skill during attack //(these are supposed to always have the same range as your attack) if( src->id != target_id && (!temp || ud->attacktimer == INVALID_TIMER) ) { - if( skill_get_state(ud->skillid) == ST_MOVE_ENABLE ) { - if( !unit_can_reach_bl(src, target, skill_get_range2(src, skill_num,skill_lv) + 1, 1, NULL, NULL) ) + if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) { + if( !unit_can_reach_bl(src, target, skill_get_range2(src, skill_id,skill_lv) + 1, 1, NULL, NULL) ) return 0; // Walk-path check failed. - } else if( src->type == BL_MER && skill_num == MA_REMOVETRAP ) { - if( !battle_check_range(battle_get_master(src), target, skill_get_range2(src, skill_num, skill_lv) + 1) ) + } else if( src->type == BL_MER && skill_id == MA_REMOVETRAP ) { + if( !battle_check_range(battle_get_master(src), target, skill_get_range2(src, skill_id, skill_lv) + 1) ) return 0; // Aegis calc remove trap based on Master position, ignoring mercenary O.O - } else if( !battle_check_range(src, target, skill_get_range2(src, skill_num,skill_lv) + (skill_num == RG_CLOSECONFINE?0:2)) ) { + } else if( !battle_check_range(src, target, skill_get_range2(src, skill_id,skill_lv) + (skill_id == RG_CLOSECONFINE?0:2)) ) { return 0; // Arrow-path check failed. } } @@ -1193,7 +1193,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh //temp: Used to signal force cast now. temp = 0; - switch(skill_num){ + switch(skill_id){ case ALL_RESURRECTION: if(battle_check_undead(tstatus->race,tstatus->def_ele)) { temp = 1; @@ -1260,9 +1260,9 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh case EL_TIDAL_WEAPON: if( src->type == BL_ELEM ){ sd = BL_CAST(BL_PC, battle_get_master(src)); - if( sd && sd->skillid_old == SO_EL_ACTION ){ + if( sd && sd->skill_id_old == SO_EL_ACTION ){ casttime = -1; - sd->skillid_old = 0; + sd->skill_id_old = 0; } } break; @@ -1270,10 +1270,10 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh // moved here to prevent Suffragium from ending if skill fails #ifndef RENEWAL_CAST - if (!(skill_get_castnodex(skill_num, skill_lv)&2)) + if (!(skill_get_castnodex(skill_id, skill_lv)&2)) casttime = skill_castfix_sc(src, casttime); #else - casttime = skill_vfcastfix(src, casttime, skill_num, skill_lv); + casttime = skill_vfcastfix(src, casttime, skill_id, skill_lv); #endif if (src->type == BL_NPC) { // NPC-objects do not have cast time @@ -1283,7 +1283,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh if(!ud->state.running) //need TK_RUN or WUGDASH handler to be done before that, see bugreport:6026 unit_stop_walking(src,1);// eventhough this is not how official works but this will do the trick. bugreport:6829 // in official this is triggered even if no cast time. - clif_skillcasting(src, src->id, target_id, 0,0, skill_num, skill_get_ele(skill_num, skill_lv), casttime); + clif_skillcasting(src, src->id, target_id, 0,0, skill_id, skill_get_ele(skill_id, skill_lv), casttime); if( casttime > 0 || temp ) { if (sd && target->type == BL_MOB) @@ -1318,11 +1318,11 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh if( casttime <= 0 ) ud->state.skillcastcancel = 0; - if( !sd || sd->skillitem != skill_num || skill_get_cast(skill_num,skill_lv) ) + if( !sd || sd->skillitem != skill_id || skill_get_cast(skill_id,skill_lv) ) ud->canact_tick = tick + casttime + 100; if( sd ) { - switch( skill_num ) + switch( skill_id ) { case CG_ARROWVULCAN: sd->canequip_tick = tick + casttime; @@ -1332,17 +1332,17 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh ud->skilltarget = target_id; ud->skillx = 0; ud->skilly = 0; - ud->skillid = skill_num; - ud->skilllv = skill_lv; + ud->skill_id = skill_id; + ud->skill_lv = skill_lv; if( sc ) { /** * why the if else chain: these 3 status do not stack, so its efficient that way. **/ - if( sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&4) && skill_num != AS_CLOAKING ) { + if( sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&4) && skill_id != AS_CLOAKING ) { status_change_end(src, SC_CLOAKING, INVALID_TIMER); if (!src->prev) return 0; //Warped away! - } else if( sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4&4) && skill_num != GC_CLOAKINGEXCEED ) { + } else if( sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4&4) && skill_id != GC_CLOAKINGEXCEED ) { status_change_end(src,SC_CLOAKINGEXCEED, INVALID_TIMER); if (!src->prev) return 0; } @@ -1352,7 +1352,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh if( casttime > 0 ) { ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 ); - if( sd && (pc_checkskill(sd,SA_FREECAST) > 0 || skill_num == LG_EXEEDBREAK) ) + if( sd && (pc_checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) ) status_calc_bl(&sd->bl, SCB_SPEED); } else @@ -1361,18 +1361,18 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh return 1; } -int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv) +int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv) { - if(skill_num < 0) + if(skill_id < 0) return 0; return unit_skilluse_pos2( - src, skill_x, skill_y, skill_num, skill_lv, - skill_castfix(src, skill_num, skill_lv), - skill_get_castcancel(skill_num) + src, skill_x, skill_y, skill_id, skill_lv, + skill_castfix(src, skill_id, skill_lv), + skill_get_castcancel(skill_id) ); } -int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv, int casttime, int castcancel) +int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) { struct map_session_data *sd = NULL; struct unit_data *ud = NULL; @@ -1398,24 +1398,24 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh if( sd ) { - if( skillnotok(skill_num, sd) || !skill_check_condition_castbegin(sd, skill_num, skill_lv) ) + if( skillnotok(skill_id, sd) || !skill_check_condition_castbegin(sd, skill_id, skill_lv) ) return 0; /** * "WHY IS IT HEREE": pneuma cannot be cancelled past this point, the client displays the animation even, * if we cancel it from nodamage_id, so it has to be here for it to not display the animation. **/ - if( skill_num == AL_PNEUMA && map_getcell(src->m, skill_x, skill_y, CELL_CHKLANDPROTECTOR) ) { - clif_skill_fail(sd,skill_num,USESKILL_FAIL_LEVEL,0); + if( skill_id == AL_PNEUMA && map_getcell(src->m, skill_x, skill_y, CELL_CHKLANDPROTECTOR) ) { + clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } } - if (!status_check_skilluse(src, NULL, skill_num, 0)) + if (!status_check_skilluse(src, NULL, skill_id, 0)) return 0; if( map_getcell(src->m, skill_x, skill_y, CELL_CHKWALL) ) {// can't cast ground targeted spells on wall cells - if (sd) clif_skill_fail(sd,skill_num,USESKILL_FAIL_LEVEL,0); + if (sd) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -1425,22 +1425,22 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh bl.x = skill_x; bl.y = skill_y; - if( skill_get_state(ud->skillid) == ST_MOVE_ENABLE ) + if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) { - if( !unit_can_reach_bl(src, &bl, skill_get_range2(src, skill_num,skill_lv) + 1, 1, NULL, NULL) ) + if( !unit_can_reach_bl(src, &bl, skill_get_range2(src, skill_id,skill_lv) + 1, 1, NULL, NULL) ) return 0; //Walk-path check failed. } - else if( !battle_check_range(src, &bl, skill_get_range2(src, skill_num,skill_lv) + 1) ) + else if( !battle_check_range(src, &bl, skill_get_range2(src, skill_id,skill_lv) + 1) ) return 0; //Arrow-path check failed. unit_stop_attack(src); // moved here to prevent Suffragium from ending if skill fails #ifndef RENEWAL_CAST - if (!(skill_get_castnodex(skill_num, skill_lv)&2)) + if (!(skill_get_castnodex(skill_id, skill_lv)&2)) casttime = skill_castfix_sc(src, casttime); #else - casttime = skill_vfcastfix(src, casttime, skill_num, skill_lv ); + casttime = skill_vfcastfix(src, casttime, skill_id, skill_lv ); #endif if (src->type == BL_NPC) { // NPC-objects do not have cast time @@ -1448,18 +1448,18 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh } ud->state.skillcastcancel = castcancel&&casttime>0?1:0; - if( !sd || sd->skillitem != skill_num || skill_get_cast(skill_num,skill_lv) ) + if( !sd || sd->skillitem != skill_id || skill_get_cast(skill_id,skill_lv) ) ud->canact_tick = tick + casttime + 100; // if( sd ) // { -// switch( skill_num ) +// switch( skill_id ) // { // case ????: // sd->canequip_tick = tick + casttime; // } // } - ud->skillid = skill_num; - ud->skilllv = skill_lv; + ud->skill_id = skill_id; + ud->skill_lv = skill_lv; ud->skillx = skill_x; ud->skilly = skill_y; ud->skilltarget = 0; @@ -1479,11 +1479,11 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh unit_stop_walking(src,1); // in official this is triggered even if no cast time. - clif_skillcasting(src, src->id, 0, skill_x, skill_y, skill_num, skill_get_ele(skill_num, skill_lv), casttime); + clif_skillcasting(src, src->id, 0, skill_x, skill_y, skill_id, skill_get_ele(skill_id, skill_lv), casttime); if( casttime > 0 ) { ud->skilltimer = add_timer( tick+casttime, skill_castend_pos, src->id, 0 ); - if( (sd && pc_checkskill(sd,SA_FREECAST) > 0) || skill_num == LG_EXEEDBREAK) + if( (sd && pc_checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK) status_calc_bl(&sd->bl, SCB_SPEED); } else @@ -1674,7 +1674,7 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, /*========================================== * Calculates position of Pet/Mercenary/Homunculus/Elemental *------------------------------------------*/ -int unit_calc_pos(struct block_list *bl, int tx, int ty, int dir) +int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir) { int dx, dy, x, y, i, k; struct unit_data *ud = unit_bl2ud(bl); @@ -1900,16 +1900,16 @@ int unit_skillcastcancel(struct block_list *bl,int type) ud->canact_tick = tick; if(type&1 && sd) - skill = sd->skillid_old; + skill = sd->skill_id_old; else - skill = ud->skillid; + skill = ud->skill_id; if (skill_get_inf(skill) & INF_GROUND_SKILL) ret=delete_timer( ud->skilltimer, skill_castend_pos ); else ret=delete_timer( ud->skilltimer, skill_castend_id ); if(ret<0) - ShowError("delete timer error : skillid : %d\n",ret); + ShowError("delete timer error : skill_id : %d\n",ret); ud->skilltimer = INVALID_TIMER; @@ -1926,7 +1926,7 @@ int unit_skillcastcancel(struct block_list *bl,int type) } } - if(bl->type==BL_MOB) ((TBL_MOB*)bl)->skillidx = -1; + if(bl->type==BL_MOB) ((TBL_MOB*)bl)->skill_idx = -1; clif_skillcastcancel(bl); return 1; diff --git a/src/map/unit.h b/src/map/unit.h index 11f5fba0e..9d1c02a31 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -23,7 +23,7 @@ struct unit_data { short attacktarget_lv; short to_x,to_y; short skillx,skilly; - short skillid,skilllv; + uint16 skill_id,skill_lv; int skilltarget; int skilltimer; int target; @@ -75,10 +75,10 @@ struct view_data { int unit_walktoxy( struct block_list *bl, short x, short y, int easy); int unit_walktobl( struct block_list *bl, struct block_list *target, int range, int easy); int unit_run(struct block_list *bl); -int unit_calc_pos(struct block_list *bl, int tx, int ty, int dir); +int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir); // 歩行停止 -// typeは以下の組み合わせ : +// typeは以下の組み合わせ : // 1: 位置情報の送信( この関数の後に位置情報を送信する場合は不要 ) // 2: ダメージディレイ有り // 4: 不明(MOBのみ?) @@ -105,12 +105,12 @@ int unit_attack(struct block_list *src,int target_id,int continuous); int unit_cancel_combo(struct block_list *bl); // スキル使用 -int unit_skilluse_id(struct block_list *src, int target_id, short skill_num, short skill_lv); -int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv); +int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv); +int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv); // スキル使用( 補正済みキャスト時間、キャンセル不可設定付き ) -int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, short skill_lv, int casttime, int castcancel); -int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv, int casttime, int castcancel); +int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel); +int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel); // 詠唱キャンセル int unit_skillcastcancel(struct block_list *bl,int type); |