summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/pc.c12
-rw-r--r--src/map/skill.c33
-rw-r--r--src/map/status.c30
-rw-r--r--src/map/status.h1
-rw-r--r--src/map/storage.c3
5 files changed, 62 insertions, 17 deletions
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<zeny || z - (double)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].amount<amount)
return 1;
diff --git a/src/map/skill.c b/src/map/skill.c
index 18715653e..837c5e6a3 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5741,7 +5741,7 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
struct mob_data* md = NULL;
struct unit_data* ud = unit_bl2ud(src);
struct status_change *sc;
- int inf2;
+ int inf,inf2;
nullpo_retr(0, ud);
@@ -5808,11 +5808,23 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
break;
}
} else {
- inf2 = skill_get_inf(ud->skillid);
- 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;