Browse Source

- Added player not attached crash prevention to countitem/countitem2
- Probably corrected delitem not deleting pet eggs at all.
- Possibly nullpo fix on npcskilleffect
- Corrected a warning when using #fakename
- Hopefully fixed hidenpc/disablenpc not working on Guild flag sprites.
- Mob skill state "anytarget" no longer triggers when the mob has an item-target (looting).


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9991 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 18 năm trước cách đây
mục cha
commit
29cb0abe60
7 tập tin đã thay đổi với 27 bổ sung10 xóa
  1. 5 0
      Changelog-Trunk.txt
  2. 1 1
      src/map/charcommand.c
  3. 1 1
      src/map/clif.c
  4. 2 2
      src/map/mob.c
  5. 2 2
      src/map/npc.c
  6. 1 0
      src/map/npc.h
  7. 15 4
      src/map/script.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.
 
 2007/03/12
+	* Added player not attached crash prevention to countitem/countitem2.
+	* Probably corrected delitem not deleting pet eggs at all.
+	* Hopefully fixed hidenpc/disablenpc not working on Guild flag sprites.
+	* Mob skill state "anytarget" no longer triggers when the mob has an
+	  item-target (looting).
 	* @storage/@gstorage will no longer work if you have a trade or a storage
 	  opened already.
 	* Corrected script command movenpc so it properly moves the ontouch npc

+ 1 - 1
src/map/charcommand.c

@@ -1255,7 +1255,7 @@ int charcommand_fakename(
 		return -1;
 	}
 
-	if(strlen(name) < 1 || !name) {
+	if(!name[0]) {
 		if(strlen(pl_sd->fakename) > 1) {
 			pl_sd->fakename[0]='\0';
 			clif_charnameack(0, &pl_sd->bl);

+ 1 - 1
src/map/clif.c

@@ -942,7 +942,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
 	WBUFW(buf,14)=vd->class_;
 	WBUFW(buf,16)=vd->hair_style;  //Required for pets.
 	WBUFW(buf,20)=vd->head_bottom;	//Pet armor
-	if (bl->type == BL_NPC && vd->class_ == 722)
+	if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS)
 	{	//The hell, why flags work like this?
 		WBUFL(buf,22)=emblem_id;
 		WBUFL(buf,26)=guild_id;

+ 2 - 2
src/map/mob.c

@@ -2699,8 +2699,8 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
 		c2 = ms[i].cond2;
 		
 		if (ms[i].state != md->state.skillstate) {
-			if (md->state.skillstate != MSS_DEAD && (
-				ms[i].state == MSS_ANY || (ms[i].state == MSS_ANYTARGET && md->target_id)
+			if (md->state.skillstate != MSS_DEAD && (ms[i].state == MSS_ANY ||
+				(ms[i].state == MSS_ANYTARGET && md->target_id && md->state.skillstate != MSS_LOOT)
 			)) //ANYTARGET works with any state as long as there's a target. [Skotlex]
 				;
 			else

+ 2 - 2
src/map/npc.c

@@ -130,8 +130,8 @@ int npc_enable(const char *name,int flag)
 	else	//Can't change the view_data to invisible class because the view_data for all npcs is shared! [Skotlex]
 		nd->sc.option|= OPTION_INVISIBLE;
 
-	if (nd->class_ == WARP_CLASS)
-	{	//Client won't display option changes for warp portals [Toms]
+	if (nd->class_ == WARP_CLASS || nd->class_ == FLAG_CLASS)
+	{	//Client won't display option changes for these classes [Toms]
 		if (nd->sc.option&(OPTION_HIDE|OPTION_INVISIBLE))
 			clif_clearchar(&nd->bl, 0);
 		else

+ 1 - 0
src/map/npc.h

@@ -8,6 +8,7 @@
 
 #define WARP_CLASS 45
 #define WARP_DEBUG_CLASS 722
+#define FLAG_CLASS 722
 #define INVISIBLE_CLASS 32767
 
 #define MAX_NPC_CLASS 1000

+ 15 - 4
src/map/script.c

@@ -5263,6 +5263,11 @@ BUILDIN_FUNC(countitem)
 
 	sd = script_rid2sd(st);
 
+	if (!sd) {
+		push_val(st->stack,C_INT,0);
+		return 0;
+	}
+
 	data=&(st->stack->stack_data[st->start+2]);
 	get_val(st,data);
 	if( data->type==C_STR || data->type==C_CONSTSTR ){
@@ -5303,6 +5308,11 @@ BUILDIN_FUNC(countitem2)
 
 	sd = script_rid2sd(st);
 
+	if (!sd) {
+		push_val(st->stack,C_INT,0);
+		return 0;
+	}
+
 	data=&(st->stack->stack_data[st->start+2]);
 	get_val(st,data);
 	if( data->type==C_STR || data->type==C_CONSTSTR ){
@@ -5737,9 +5747,9 @@ BUILDIN_FUNC(delitem)
 		if(sd->inventory_data[i]->type==IT_PETEGG &&
 			sd->status.inventory[i].card[0] == CARD0_PET)
 		{
-			if (intif_delete_petdata(MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])))
+			if (!intif_delete_petdata(MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])))
 				continue; //pet couldn't be sent for deletion.
-		}
+		} else
 		//is this item important? does it have cards? or Player's name? or Refined/Upgraded
 		if(itemdb_isspecial(sd->status.inventory[i].card[0]) ||
 			sd->status.inventory[i].card[0] ||
@@ -10468,14 +10478,15 @@ BUILDIN_FUNC(skilleffect)
  */
 BUILDIN_FUNC(npcskilleffect)
 {
-	struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
+	struct block_list *bl= map_id2bl(st->oid);
 
 	int skillid=conv_num(st,& (st->stack->stack_data[st->start+2]));
 	int skilllv=conv_num(st,& (st->stack->stack_data[st->start+3]));
 	int x=conv_num(st,& (st->stack->stack_data[st->start+4]));
 	int y=conv_num(st,& (st->stack->stack_data[st->start+5]));
 
-	clif_skill_poseffect(&nd->bl,skillid,skilllv,x,y,gettick());
+	if (bl)
+		clif_skill_poseffect(bl,skillid,skilllv,x,y,gettick());
 
 	return 0;
 }