From d41f7e18f02012ef61df70ee6cc0f3bf1ce14c23 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 19 Jul 2006 18:49:42 +0000 Subject: - Modified the targetted skill logic to enable offensive skills to be targetted at party/guild members if the appropiate inf2 value is set. - Added the SC_JAIL code for timed jailing, but the related @ commands ain't in yet. - Added checks to make adding items to inventory/cart fail when a char is in finalsave state. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7751 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 5 +++++ src/map/pc.c | 12 ++++++++++++ src/map/skill.c | 33 +++++++++++++++++---------------- src/map/status.c | 30 +++++++++++++++++++++++++++++- src/map/status.h | 1 + src/map/storage.c | 3 +++ 6 files changed, 67 insertions(+), 17 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index a476db186..935288701 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/07/19 + * Modified the targetted skill logic to enable offensive skills to be + targetted at party/guild members if the appropiate inf2 value is set. + [Skotlex] + * Added checks to make adding items to inventory/cart fail when a char is + in finalsave state. [Skotlex] * Fixed parse_names on irc.c crashing when receiving a null argument. [Skotlex] * Modified the parsing of the names line, since some servers will send @ diff --git a/src/map/pc.c b/src/map/pc.c index 55be33f6c..15d0d7941 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2522,6 +2522,9 @@ int pc_payzeny(struct map_session_data *sd,int zeny) nullpo_retr(0, sd); + if(sd->state.finalsave) + return 1; + z = (double)sd->status.zeny; if(sd->status.zeny MAX_ZENY) return 1; @@ -2589,6 +2592,9 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount) nullpo_retr(1, sd); nullpo_retr(1, item_data); + if(sd->state.finalsave) + return 1; + if(item_data->nameid <= 0 || amount <= 0) return 1; if(amount > MAX_AMOUNT) @@ -2927,6 +2933,9 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun nullpo_retr(1, sd); nullpo_retr(1, item_data); + if(sd->state.finalsave) + return 1; + if(item_data->nameid <= 0 || amount <= 0) return 1; data = itemdb_search(item_data->nameid); @@ -2981,6 +2990,9 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type) { nullpo_retr(1, sd); + if(sd->state.finalsave) + return 1; + if(sd->status.cart[n].nameid==0 || sd->status.cart[n].amountskillid); - if((inf2&INF_ATTACK_SKILL || - (inf2&INF_SELF_SKILL && skill_get_inf2(ud->skillid)&INF2_NO_TARGET_SELF)) //Combo skills - && battle_check_target(src, target, BCT_ENEMY)<=0 + //Check target validity. + inf = skill_get_inf(ud->skillid); + inf2 = skill_get_inf2(ud->skillid); + + if((inf&INF_ATTACK_SKILL || + (inf&INF_SELF_SKILL && inf2&INF2_NO_TARGET_SELF)) //Combo skills ) + inf = INF_ATTACK_SKILL; //Offensive skill. + else + inf = 0; + + if(inf2 & (INF2_PARTY_ONLY|INF2_GUILD_ONLY) && src != target) + inf |= + (inf2&INF2_PARTY_ONLY?BCT_PARTY:0)| + (inf2&INF2_GUILD_ONLY?BCT_GUILD:0)| + (inf2&INF2_ALLOW_ENEMY?BCT_ENEMY:0); + if (inf && battle_check_target(src, target, inf) <= 0) break; } @@ -5831,17 +5843,6 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data) } } - inf2 = skill_get_inf2(ud->skillid); - if(inf2 & (INF2_PARTY_ONLY|INF2_GUILD_ONLY) && src != target) { - inf2 = - (inf2&INF2_PARTY_ONLY?BCT_PARTY:0)| - (inf2&INF2_GUILD_ONLY?BCT_GUILD:0)| - (inf2&INF2_ALLOW_ENEMY?BCT_ENEMY:0); - - if(battle_check_target(src, target, inf2) <= 0) - break; - } - 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)) { diff --git a/src/map/status.c b/src/map/status.c index fe3f1c05e..808e8d5d4 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4613,6 +4613,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val case SC_ASPDPOTION3: case SC_ATKPOTION: case SC_MATKPOTION: + case SC_JAILED: break; case SC_GOSPEL: //Must not override a casting gospel char. @@ -5376,6 +5377,9 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val val3 = rand()%100; //Def changes randomly every second... tick = 1000; break; + case SC_JAILED: + tick = val1>0?1000:250; + break; default: if (calc_flag == SCB_NONE && StatusSkillChangeTable[type]==0) { //Status change with no calc, and no skill associated...? unknown? @@ -5566,6 +5570,11 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val if(sd && sd->pd) pet_sc_check(sd, type); //Skotlex: Pet Status Effect Healing + if (type==SC_JAILED && sd && sd->mapindex != val2) { + if (pc_setpos(sd,(unsigned short)val2,0, 0, 3) == 0) + pc_setsavepoint(sd, (unsigned short)val2, 0, 0); + } + if (type==SC_BERSERK) { sc->data[type].val2 = 5*status->max_hp/100; status_heal(bl, status->max_hp, 0, 1); //Do not use percent_heal as this healing must override BERSERK's block. @@ -5603,7 +5612,7 @@ int status_change_clear(struct block_list *bl,int type) i == SC_EDP || i == SC_MELTDOWN || i == SC_XMAS || i == SC_NOCHAT || i == SC_FUSION || i == SC_TKREST || i == SC_READYSTORM || i == SC_READYDOWN || i == SC_READYCOUNTER || i == SC_READYTURN || - i == SC_DODGE + i == SC_DODGE || i == SC_JAILED ))) continue; @@ -5889,6 +5898,16 @@ int status_change_end( struct block_list* bl , int type,int tid ) sc->data[type].val4=-1; } break; + case SC_JAILED: + if(tid == -1) + break; + //natural expiration. + if(sd && sd->mapindex == sc->data[type].val2) + { + if (pc_setpos(sd,(unsigned short)sc->data[type].val3,0, 0, 3) == 0) + pc_setsavepoint(sd, (unsigned short)sc->data[type].val3, 0, 0); + } + break; //guess hes not in jail :P } if (sd) @@ -6406,6 +6425,14 @@ int status_change_timer(int tid, unsigned int tick, int id, int data) } } break; + case SC_JAILED: + if(--sc->data[type].val1 > 0) + { + sc->data[type].timer=add_timer( + 60000+tick, status_change_timer, bl->id,data); + return 0; + } + break; } // default for all non-handled control paths @@ -6517,6 +6544,7 @@ int status_change_clear_buffs (struct block_list *bl, int type) case SC_GUILDAURA: case SC_SAFETYWALL: case SC_NOCHAT: + case SC_JAILED: case SC_ANKLE: case SC_BLADESTOP: case SC_CP_WEAPON: diff --git a/src/map/status.h b/src/map/status.h index 65e512ec5..c11a00fde 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -257,6 +257,7 @@ enum { SC_DEFENCE, //[orn] SC_INCAGIRATE, SC_INCDEXRATE, + SC_JAILED, SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex] }; int SkillStatusChangeTable(int skill); diff --git a/src/map/storage.c b/src/map/storage.c index 4b2dff0ed..bf018dc90 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -166,6 +166,9 @@ static int storage_additem(struct map_session_data *sd,struct storage *stor,stru struct item_data *data; int i; + if (sd->state.finalsave) + return 1; + if(item_data->nameid <= 0 || amount <= 0) return 1; -- cgit v1.2.3-70-g09d2