浏览代码

- Follow up r17322 fix bugreport:7663
-- fix favorite display
-- fix typos
- Add script provenance for sc_start, (item or npc) requested for sc_def.

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

glighta 12 年之前
父节点
当前提交
553fe59fb1
共有 3 个文件被更改,包括 18 次插入15 次删除
  1. 9 9
      src/map/clif.c
  2. 8 5
      src/map/script.c
  3. 1 1
      src/map/status.c

+ 9 - 9
src/map/clif.c

@@ -2250,8 +2250,8 @@ void clif_item_sub_v5(unsigned char *buf, int n, int idx, struct item *i, struct
 	WBUFB(buf,n+4)=itemtype(id->type);
 
 	if(!normal){ //equip 31B
-		WBUFL(buf,n+5)= i->equip; //location
-		WBUFL(buf,n+9)=equip; //wear state
+		WBUFL(buf,n+5)= equip; //location
+		WBUFL(buf,n+9)= i->equip; //wear state
 		WBUFB(buf,n+13)= i->refine; //refine lvl
 		clif_addcards(WBUFP(buf, n+14), i); //EQUIPSLOTINFO 8B
 		WBUFL(buf,n+22) = i->expire_time;
@@ -2260,16 +2260,16 @@ void clif_item_sub_v5(unsigned char *buf, int n, int idx, struct item *i, struct
 		//V5_ITEM_flag
 		WBUFB(buf,n+30)=i->identify; //0x1 IsIdentified
 		WBUFB(buf,n+30)|=(i->attribute)?0x2:0; //0x2 IsDamaged
-		WBUFB(buf,n+30)|= (id->equip&EQP_VISIBLE)?0:0x4; //0x4 PlaceETCTab
+		WBUFB(buf,n+30)|= (i->favorite)?0x4:0; //0x4 PlaceETCTab
 	}
 	else { //normal 24B
 		WBUFW(buf,n+5)=i->amount;
-		WBUFL(buf,n+7)=equip; //wear state
+		WBUFL(buf,n+7)= i->equip; //wear state
 		clif_addcards(WBUFP(buf, n+11), i); //EQUIPSLOTINFO 8B
 		WBUFL(buf,n+19) = i->expire_time;
 		//V5_ITEM_flag
 		WBUFB(buf,n+23)=i->identify; //0x1 IsIdentified
-		WBUFB(buf,n+23)|= (id->equip&EQP_VISIBLE)?0:0x2; //0x4,0x2 PlaceETCTab
+		WBUFB(buf,n+23)|= (i->favorite)?0x2:0; //0x4,0x2 PlaceETCTab
 	}
 }
 
@@ -2384,7 +2384,7 @@ void clif_inventorylist(struct map_session_data *sd) {
 		WBUFW(bufe,2)=4+ne*se;
 		clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
 	}
-#if PACKETVER >= 20111122
+#if PACKETVER >= 20111122 && PACKETVER < 20120925
 	for( i = 0; i < MAX_INVENTORY; i++ ) {
 		if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL )
 			continue;
@@ -2501,7 +2501,7 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
 #elif PACKETVER < 20120925
 		WBUFW(bufe,0)=0x2d1;
 #else
-		WBUFW(buf,0)=0x996;
+		WBUFW(bufe,0)=0x996;
 #endif
 		WBUFW(bufe,2)=4+ne*cmd;
 		clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
@@ -2572,9 +2572,9 @@ void clif_cartlist(struct map_session_data *sd)
 #if PACKETVER < 20071002
 	WBUFW(bufe,0)=0x122;
 #elif PACKETVER < 20120925
-	WBUFW(buf,0)=0x2d2;
+	WBUFW(bufe,0)=0x2d2;
 #else
-	WBUFW(buf,0)=0x994;
+	WBUFW(bufe,0)=0x994;
 #endif
 		WBUFW(bufe,2)=4+ne*cmd;
 		clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);

+ 8 - 5
src/map/script.c

@@ -9893,9 +9893,10 @@ BUILDIN_FUNC(hideonnpc)
 /// sc_start <effect_id>,<duration>,<val1>{,<unit_id>};
 BUILDIN_FUNC(sc_start)
 {
+	TBL_NPC * nd = map_id2nd(st->oid);
 	struct block_list* bl;
 	enum sc_type type;
-	int tick;
+	int tick,isitem;
 	int val1;
 	int val4 = 0;
 
@@ -9919,8 +9920,10 @@ BUILDIN_FUNC(sc_start)
 		val4 = 1;// Mark that this was a thrown sc_effect
 	}
 
+	//solving if script from npc or item
+	isitem = (nd && nd->bl.id == fake_nd->bl.id)?true:false;
 	if( bl )
-		status_change_start(NULL, bl, type, 10000, val1, 0, 0, val4, tick, 2);
+		status_change_start(isitem?bl:NULL, bl, type, 10000, val1, 0, 0, val4, tick, 2);
 
 	return 0;
 }
@@ -12820,7 +12823,7 @@ int recovery_sub(struct map_session_data* sd, int revive)
 }
 
 /*=========================================================================
- * Fully Recover a Character's HP/SP - [Capuche] & [Akinari] 
+ * Fully Recover a Character's HP/SP - [Capuche] & [Akinari]
  * recovery <target>,{<id | map>,<revive_flag>,{<map>}};
  * <target> :
  *	0 - Character
@@ -12832,7 +12835,7 @@ int recovery_sub(struct map_session_data* sd, int revive)
  *	<target> : 0   => Character's Account ID
  *	<target> : 1-2 => Character's Party/Guild ID
  *	<target> : 3   => Map Name (player attached map's name by default)
- * <revive_flag> : 
+ * <revive_flag> :
  *		 : 1 => Revive and Recover (Default)
  *		 : 2 => Only Full Heal
  *		 : 4 => Only Revive
@@ -15494,7 +15497,7 @@ BUILDIN_FUNC(unitwalk)
 	else if( script_hasdata(st,4) ) {
 		int x = script_getnum(st,3);
 		int y = script_getnum(st,4);
-		if( script_pushint(st, unit_can_reach_pos(bl,x,y,0)) ) 
+		if( script_pushint(st, unit_can_reach_pos(bl,x,y,0)) )
 			add_timer(gettick()+50, unit_delay_walktoxy_timer, bl->id, (x<<16)|(y&0xFFFF)); // Need timer to avoid mismatches
 	} else {
 		struct block_list* tbl = map_id2bl(script_getnum(st,3));

+ 1 - 1
src/map/status.c

@@ -9306,7 +9306,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
 			case SC_STUN:
 			case SC_SLEEP:
 			if (sce->val1) {
-			  	//Removing the 'level' shouldn't affect anything in the code
+				//Removing the 'level' shouldn't affect anything in the code
 				//since these SC are not affected by it, and it lets us know
 				//if we have already delayed this attack or not.
 				sce->val1 = 0;