Selaa lähdekoodia

Applied lordalfa patch - you can now forbid usage of certain cards on PVP/GVG/WoE defined in item_noequip.txt

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5103 54d463be-8e91-2dee-dedb-b68131a5f0ec
Komurka 19 vuotta sitten
vanhempi
commit
af20255b53
3 muutettua tiedostoa jossa 31 lisäystä ja 10 poistoa
  1. 4 0
      Changelog-Trunk.txt
  2. 2 1
      db/item_noequip.txt
  3. 25 9
      src/map/pc.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ 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.  EVERYTHING ELSE
 GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
 
+2006/01/30
+	* Applied lordalfa patch - you can now forbid usage of certain cards on PVP/GVG/WoE
+	  defined in item_noequip.txt [Komurka]
+
 2006/01/29
 	* Added support for more account states like "Unavailable due to hacking/bug
 	  investigation" etc, thanks to NeoSaro [DracoRPG]

+ 2 - 1
db/item_noequip.txt

@@ -1,7 +1,8 @@
-// The equipment/items restriction file 
+// The equipment/items/cards restriction file 
 // here you define which items may not be used at PvP / GvG 
 // format: <item id>,<mode>
 // mode = 1- restricted in PVP, 2- restricted in GVG, 3- restricted in both PvP and GvG
 
 //1201,1 you can't use KNIFE(ID 1201) on PvP and GvG
 //608,3 you can't use Yggdrasil Seed(ID 608) on both PvP & GvG & WoE Castles
+//4174,3 Forbid Deviling Card in every PVP or GVG map, and during woes.

+ 25 - 9
src/map/pc.c

@@ -554,6 +554,20 @@ int pc_setequipindex(struct map_session_data *sd)
 	return 0;
 }
 
+int pc_isAllowedCardOn(struct map_session_data *sd,int s,int eqindex,int flag)  {
+	int i;
+	struct item_data *data;
+	if (s>0)     {
+			for (i=0;i<s;i++)       {    
+				if ((data = itemdb_search(sd->status.inventory[eqindex].card[i])))    {
+					if (data->flag.no_equip&flag)
+					return 0;
+					}
+			}  
+		}
+	return 1;              
+}
+
 int pc_isequip(struct map_session_data *sd,int n)
 {
 	struct item_data *item;
@@ -572,10 +586,10 @@ int pc_isequip(struct map_session_data *sd,int n)
 		return 0;
 	if(item->sex != 2 && sd->status.sex != item->sex)
 		return 0;
-	if(map[sd->bl.m].flag.pvp && (item->flag.no_equip&1)) //optimized by Lupus
-		return 0;
-	if(map_flag_gvg(sd->bl.m) && (item->flag.no_equip>1)) //optimized by Lupus
+	if(map[sd->bl.m].flag.pvp && (item->flag.no_equip&1 || !pc_isAllowedCardOn(sd,item->slot,n,1))) //optimized by Lupus
 		return 0;
+	if(map_flag_gvg(sd->bl.m) && (item->flag.no_equip&2 || !pc_isAllowedCardOn(sd,item->slot,n,2))) //optimized by Lupus
+		return 0; 
 	if((item->equip & 0x0002 || item->equip & 0x0020) && item->type == 4 && sd->sc_data[SC_STRIPWEAPON].timer != -1) // Also works with left-hand weapons [DracoRPG]
 		return 0;
 	if(item->equip & 0x0020 && item->type == 5 && sd->sc_data[SC_STRIPSHIELD].timer != -1) // Also works with left-hand weapons [DracoRPG]
@@ -7174,12 +7188,14 @@ int pc_checkitem(struct map_session_data *sd)
 			calc_flag = 1;
 		}
 		//?”õ�§ŒÀƒ`ƒFƒbƒN
-		if(sd->status.inventory[i].equip && (map[sd->bl.m].flag.pvp||map[sd->bl.m].flag.gvg) && (it->flag.no_equip&1)){//PVP check for forbiden items. optimized by [Lupus]
-			sd->status.inventory[i].equip=0;
-			calc_flag = 1;
-		}else if(sd->status.inventory[i].equip && map_flag_gvg(sd->bl.m) && (it->flag.no_equip>1)){//GvG optimized by [Lupus]
-			sd->status.inventory[i].equip=0;
-			calc_flag = 1;
+		if(sd->status.inventory[i].equip && (map[sd->bl.m].flag.pvp||map[sd->bl.m].flag.gvg) &&
+                 	(it->flag.no_equip&1  || !pc_isAllowedCardOn(sd,it->slot,i,1))){//PVP check for forbiden items. optimized by [Lup$
+				sd->status.inventory[i].equip=0;
+				calc_flag = 1;
+			}else if(sd->status.inventory[i].equip && map_flag_gvg(sd->bl.m) &&
+                       (it->flag.no_equip&2   || !pc_isAllowedCardOn(sd,it->slot,i,2))){//GvG optimized by [Lupus]
+				sd->status.inventory[i].equip=0;
+				calc_flag = 1;
 		}
 	}