Kaynağa Gözat

Revert countitem2 back to original check method - Fixes bugreport:7695
Update unit_teleport_timer to enforce tid check (lighta) - Attempted fix for bugreport:7696
Fixed small bugs in Mora Enchants script. (follow-up r17344, credits: Lemongrass)

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

akinari1087 12 yıl önce
ebeveyn
işleme
acac72005f
3 değiştirilmiş dosya ile 29 ekleme ve 21 silme
  1. 5 2
      npc/re/merchants/enchan_mora.txt
  2. 19 16
      src/map/script.c
  3. 5 3
      src/map/unit.c

+ 5 - 2
npc/re/merchants/enchan_mora.txt

@@ -3,7 +3,7 @@
 //===== By: ================================================== 
 //= Euphy
 //===== Current Version: ===================================== 
-//= 1.1
+//= 1.1a
 //===== Compatible With: ===================================== 
 //= rAthena SVN
 //===== Description: ========================================= 
@@ -13,6 +13,7 @@
 //===== Additional Comments: ================================= 
 //= 1.0 First Version. [Euphy]
 //= 1.1 Optimized. [Euphy]
+//= 1.1a Bug fixes. [Lemongrass]
 //============================================================ 
 
 // Arch Bishop Enchants :: coin_arc
@@ -1478,7 +1479,7 @@ function	script	F_Mora_Enchant	{
 	delitem 6380,5; //Mora_Coin
 	delitem getarg(0),1;
 	set .@i, rand(1,4568);
-	if (.@i <= 3181) {
+	if (.@i <= 3168) {
 		// Basic combinations
 		// (raw: .@i increments by 11)
 		setarray .@enchant_slot1[0],4766,4767,4764,4765,4762,4763,4760,4761; //Atk2,Atk3,Critical5,Critical7,Evasion6,Evasion12,Matk1,Matk2
@@ -1489,6 +1490,8 @@ function	script	F_Mora_Enchant	{
 			.@enchant_slot2[rand(getarraysize(.@enchant_slot2))],
 			.@enchant_slot3[rand(getarraysize(.@enchant_slot3))];
 	}
+	else if (.@i <= 3179) setarray .@enchants[1],4761,4720,4700; //Matk2 Dexterity1 Strength1
+	else if (.@i <= 3181) setarray .@enchants[1],4761,4712,4712; //Matk2 Inteligence3 Inteligence3
 	else if (.@i <= 3183) setarray .@enchants[1],4765,4732,4732; //Critical7 Agility3 Agility3
 	else if (.@i <= 3185) setarray .@enchants[1],4763,4752,4753; //Evasion12 Luck3 Luck4
 	else if (.@i <= 3187) setarray .@enchants[1],4763,4742,4742; //Evasion12 Vitality3 Vitality3

+ 19 - 16
src/map/script.c

@@ -6088,22 +6088,25 @@ BUILDIN_FUNC(countitem)
 			if(sd->status.inventory[i].nameid == nameid)
 				count += sd->status.inventory[i].amount;
 	} else { // For countitem2() function
-		struct item tmp_it;
-		tmp_it.nameid = id->nameid;
-		tmp_it.identify = script_getnum(st, 3);
-		tmp_it.refine = script_getnum(st, 4);
-		tmp_it.attribute = script_getnum(st, 5);
-		tmp_it.card[0] = (short) script_getnum(st, 6);
-		tmp_it.card[1] = (short) script_getnum(st, 7);
-		tmp_it.card[2] = (short) script_getnum(st, 8);
-		tmp_it.card[3] = (short) script_getnum(st, 9);
-
-		for (i = 0; i < MAX_INVENTORY; i++)
-			if ((&sd->status.inventory[i] != NULL)
-				&& sd->status.inventory[i].amount > 0
-				&& compare_item(&sd->status.inventory[i], &tmp_it)
-			)
-			count += sd->status.inventory[i].amount;
+		int nameid, iden, ref, attr, c1, c2, c3, c4;
+
+		nameid = id->nameid; 
+		iden = script_getnum(st,3); 
+		ref  = script_getnum(st,4); 
+		attr = script_getnum(st,5); 
+		c1 = (short)script_getnum(st,6); 
+		c2 = (short)script_getnum(st,7); 
+		c3 = (short)script_getnum(st,8); 
+		c4 = (short)script_getnum(st,9);
+
+		for(i = 0; i < MAX_INVENTORY; i++)
+			if (sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] != NULL && 
+				sd->status.inventory[i].amount > 0 && sd->status.inventory[i].nameid == nameid && 
+				sd->status.inventory[i].identify == iden && sd->status.inventory[i].refine == ref && 
+				sd->status.inventory[i].attribute == attr && sd->status.inventory[i].card[0] == c1 && 
+				sd->status.inventory[i].card[1] == c2 && sd->status.inventory[i].card[2] == c3 && 
+				sd->status.inventory[i].card[3] == c4 ) 
+	 	                        count += sd->status.inventory[i].amount;
 	}
 
 	script_pushint(st,count);

+ 5 - 3
src/map/unit.c

@@ -137,13 +137,15 @@ int* unit_get_masterteleport_timer(struct block_list *bl){
 }
 
 int unit_teleport_timer(int tid, unsigned int tick, int id, intptr_t data){
+	struct block_list *bl = map_id2bl(id);
+	int *mast_tid = unit_get_masterteleport_timer(bl);
+
 	if(tid == INVALID_TIMER)
 		return 0;
+	else if(*mast_tid && *mast_tid != tid)
+		return 0;
 	else {
-		struct block_list *bl = map_id2bl(id);
-		int *mast_tid = unit_get_masterteleport_timer(bl);
 		TBL_PC *msd = unit_get_master(bl);
-
 		switch(data){
 		case BL_HOM:
 		case BL_ELEM: