Browse Source

- 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://svn.code.sf.net/p/rathena/svn/trunk@7751 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 years ago
parent
commit
046e959e52
6 changed files with 67 additions and 17 deletions
  1. 5 0
      Changelog-Trunk.txt
  2. 12 0
      src/map/pc.c
  3. 17 16
      src/map/skill.c
  4. 29 1
      src/map/status.c
  5. 1 0
      src/map/status.h
  6. 3 0
      src/map/storage.c

+ 5 - 0
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.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2006/07/19
 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.
 	* Fixed parse_names on irc.c crashing when receiving a null argument.
 	  [Skotlex]
 	  [Skotlex]
 	* Modified the parsing of the names line, since some servers will send @
 	* Modified the parsing of the names line, since some servers will send @

+ 12 - 0
src/map/pc.c

@@ -2522,6 +2522,9 @@ int pc_payzeny(struct map_session_data *sd,int zeny)
 
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
 
 
+	if(sd->state.finalsave)
+		return 1;
+
 	z = (double)sd->status.zeny;
 	z = (double)sd->status.zeny;
 	if(sd->status.zeny<zeny || z - (double)zeny > MAX_ZENY)
 	if(sd->status.zeny<zeny || z - (double)zeny > MAX_ZENY)
 		return 1;
 		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, sd);
 	nullpo_retr(1, item_data);
 	nullpo_retr(1, item_data);
 
 
+	if(sd->state.finalsave)
+		return 1;
+
 	if(item_data->nameid <= 0 || amount <= 0)
 	if(item_data->nameid <= 0 || amount <= 0)
 		return 1;
 		return 1;
 	if(amount > MAX_AMOUNT)
 	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, sd);
 	nullpo_retr(1, item_data);
 	nullpo_retr(1, item_data);
 
 
+	if(sd->state.finalsave)
+		return 1;
+
 	if(item_data->nameid <= 0 || amount <= 0)
 	if(item_data->nameid <= 0 || amount <= 0)
 		return 1;
 		return 1;
 	data = itemdb_search(item_data->nameid);
 	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);
 	nullpo_retr(1, sd);
 
 
+	if(sd->state.finalsave)
+		return 1;
+
 	if(sd->status.cart[n].nameid==0 ||
 	if(sd->status.cart[n].nameid==0 ||
 	   sd->status.cart[n].amount<amount)
 	   sd->status.cart[n].amount<amount)
 		return 1;
 		return 1;

+ 17 - 16
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 mob_data* md = NULL;
 	struct unit_data* ud = unit_bl2ud(src);
 	struct unit_data* ud = unit_bl2ud(src);
 	struct status_change *sc;
 	struct status_change *sc;
-	int inf2;
+	int inf,inf2;
 
 
 	nullpo_retr(0, ud);
 	nullpo_retr(0, ud);
 
 
@@ -5808,11 +5808,23 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
 				break;
 				break;
 			}
 			}
 		} else {
 		} 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;
 				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 &&
 		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->skillid,ud->skilllv)+battle_config.skill_add_range))
 		{
 		{

+ 29 - 1
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_ASPDPOTION3:
 			case SC_ATKPOTION:
 			case SC_ATKPOTION:
 			case SC_MATKPOTION:
 			case SC_MATKPOTION:
+			case SC_JAILED:
 				break;
 				break;
 			case SC_GOSPEL:
 			case SC_GOSPEL:
 				 //Must not override a casting gospel char.
 				 //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...
 			val3 = rand()%100; //Def changes randomly every second...
 			tick = 1000;
 			tick = 1000;
 			break;
 			break;
+		case SC_JAILED:
+			tick = val1>0?1000:250;
+			break;
 		default:
 		default:
 			if (calc_flag == SCB_NONE && StatusSkillChangeTable[type]==0)
 			if (calc_flag == SCB_NONE && StatusSkillChangeTable[type]==0)
 			{	//Status change with no calc, and no skill associated...? unknown?
 			{	//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)
 	if(sd && sd->pd)
 		pet_sc_check(sd, type); //Skotlex: Pet Status Effect Healing
 		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) {
 	if (type==SC_BERSERK) {
 		sc->data[type].val2 = 5*status->max_hp/100;
 		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.
 		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_EDP || i == SC_MELTDOWN || i == SC_XMAS || i == SC_NOCHAT ||
 				i == SC_FUSION || i == SC_TKREST || i == SC_READYSTORM ||
 				i == SC_FUSION || i == SC_TKREST || i == SC_READYSTORM ||
 			  	i == SC_READYDOWN || i == SC_READYCOUNTER || i == SC_READYTURN ||
 			  	i == SC_READYDOWN || i == SC_READYCOUNTER || i == SC_READYTURN ||
-				i == SC_DODGE
+				i == SC_DODGE || i == SC_JAILED
 			)))
 			)))
 			continue;
 			continue;
 
 
@@ -5889,6 +5898,16 @@ int status_change_end( struct block_list* bl , int type,int tid )
 				sc->data[type].val4=-1;
 				sc->data[type].val4=-1;
 			}
 			}
 			break;
 			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) 
 	if (sd) 
@@ -6406,6 +6425,14 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
 			}
 			}
 		}
 		}
 		break;
 		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
 	// 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_GUILDAURA:
 			case SC_SAFETYWALL:
 			case SC_SAFETYWALL:
 			case SC_NOCHAT:
 			case SC_NOCHAT:
+			case SC_JAILED:
 			case SC_ANKLE:
 			case SC_ANKLE:
 			case SC_BLADESTOP:
 			case SC_BLADESTOP:
 			case SC_CP_WEAPON:
 			case SC_CP_WEAPON:

+ 1 - 0
src/map/status.h

@@ -257,6 +257,7 @@ enum {
 	SC_DEFENCE,	//[orn]
 	SC_DEFENCE,	//[orn]
 	SC_INCAGIRATE,
 	SC_INCAGIRATE,
 	SC_INCDEXRATE,
 	SC_INCDEXRATE,
+	SC_JAILED,
 	SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex]
 	SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex]
 };
 };
 int SkillStatusChangeTable(int skill);
 int SkillStatusChangeTable(int skill);

+ 3 - 0
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;
 	struct item_data *data;
 	int i;
 	int i;
 
 
+	if (sd->state.finalsave)
+		return 1;
+
 	if(item_data->nameid <= 0 || amount <= 0)
 	if(item_data->nameid <= 0 || amount <= 0)
 		return 1;
 		return 1;