فهرست منبع

BETA: New condition "transformationId":
* The new condition "transformationId" allows to determinate if a player is transformed using a certain transformation Id, -1 as Id means all transformations.
* Allow equipping Wedding Bouquet with Formal Wear.
* Updated logger for SkillTreesData and fixed logger for SkillsEngine, probably stopped working after [4184].

Zoey76 13 سال پیش
والد
کامیت
7a0d99b758

+ 1 - 1
L2J_Server_BETA/dist/cfgs/log.cfg

@@ -148,7 +148,7 @@ com.l2jserver.loginserver.level = CONFIG
 com.l2jserver.gameserver.network.serverpackets.level = FINER
 com.l2jserver.gameserver.network.serverpackets.level = FINER
 com.l2jserver.gameserver.network.clientpackets.level = FINER
 com.l2jserver.gameserver.network.clientpackets.level = FINER
 com.l2jserver.gameserver.model.actor.L2Character.level = FINER
 com.l2jserver.gameserver.model.actor.L2Character.level = FINER
-com.l2jserver.gameserver.skills.SkillsEngine.level = WARNING
+com.l2jserver.gameserver.skills.SkillsEngine.level = INFO
 
 
 # Alt Privileges Administration
 # Alt Privileges Administration
 AltPrivilegesAdmin.pattern = log/admin-commands.log
 AltPrivilegesAdmin.pattern = log/admin-commands.log

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SkillTreesData.java

@@ -46,7 +46,7 @@ import com.l2jserver.util.file.filter.XMLFilter;
  */
  */
 public final class SkillTreesData
 public final class SkillTreesData
 {
 {
-	private static Logger _log = Logger.getLogger(SkillTreesData.class.getSimpleName());
+	private static final Logger _log = Logger.getLogger(SkillTreesData.class.getName());
 	
 	
 	//ClassId, FastMap of Skill Hash Code, L2LearkSkill
 	//ClassId, FastMap of Skill Hash Code, L2LearkSkill
 	private FastMap<ClassId, FastMap<Integer, L2SkillLearn>> _classSkillTrees;
 	private FastMap<ClassId, FastMap<Integer, L2SkillLearn>> _classSkillTrees;

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java

@@ -1272,9 +1272,9 @@ public abstract class Inventory extends ItemContainer
 		
 		
 		int targetSlot = item.getItem().getBodyPart();
 		int targetSlot = item.getItem().getBodyPart();
 		
 		
-		//check if player wear formal
+		// Check if player is using Formal Wear and item isn't Wedding Bouquet.
 		L2ItemInstance formal = getPaperdollItem(PAPERDOLL_CHEST);
 		L2ItemInstance formal = getPaperdollItem(PAPERDOLL_CHEST);
-		if (formal != null && formal.getItem().getBodyPart() == L2Item.SLOT_ALLDRESS)
+		if ((item.getItemId() != 21163) && (formal != null) && (formal.getItem().getBodyPart() == L2Item.SLOT_ALLDRESS))
 		{
 		{
 			switch (targetSlot)
 			switch (targetSlot)
 			{
 			{

+ 6 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/skills/DocumentBase.java

@@ -81,6 +81,7 @@ import com.l2jserver.gameserver.skills.conditions.ConditionPlayerSiegeSide;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerSouls;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerSouls;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerState;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerState;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerSubclass;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerSubclass;
+import com.l2jserver.gameserver.skills.conditions.ConditionPlayerTransformationId;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerTvTEvent;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerTvTEvent;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerWeight;
 import com.l2jserver.gameserver.skills.conditions.ConditionPlayerWeight;
 import com.l2jserver.gameserver.skills.conditions.ConditionSiegeZone;
 import com.l2jserver.gameserver.skills.conditions.ConditionSiegeZone;
@@ -535,6 +536,11 @@ abstract class DocumentBase
 				boolean val = Boolean.valueOf(a.getNodeValue());
 				boolean val = Boolean.valueOf(a.getNodeValue());
 				cond = joinAnd(cond, new ConditionPlayerIsHero(val));
 				cond = joinAnd(cond, new ConditionPlayerIsHero(val));
 			}
 			}
+			else if ("transformationId".equalsIgnoreCase(a.getNodeName()))
+			{
+				int id = Integer.parseInt(a.getNodeValue());
+				cond = joinAnd(cond, new ConditionPlayerTransformationId(id));
+			}
 			else if ("hp".equalsIgnoreCase(a.getNodeName()))
 			else if ("hp".equalsIgnoreCase(a.getNodeName()))
 			{
 			{
 				int hp = Integer.decode(getValue(a.getNodeValue(), null));
 				int hp = Integer.decode(getValue(a.getNodeValue(), null));

+ 8 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/skills/SkillsEngine.java

@@ -33,11 +33,10 @@ import com.l2jserver.util.file.filter.XMLFilter;
  */
  */
 public class SkillsEngine
 public class SkillsEngine
 {
 {
+	private static final Logger _log = Logger.getLogger(SkillsEngine.class.getName());
 	
 	
-	protected static final Logger _log = Logger.getLogger(SkillsEngine.class.getName());
-	
-	private List<File> _itemFiles = new FastList<File>();
-	private List<File> _skillFiles = new FastList<File>();
+	private final List<File> _itemFiles = new FastList<>();
+	private final List<File> _skillFiles = new FastList<>();
 	
 	
 	public static SkillsEngine getInstance()
 	public static SkillsEngine getInstance()
 	{
 	{
@@ -62,7 +61,9 @@ public class SkillsEngine
 		}
 		}
 		File[] files = dir.listFiles(new XMLFilter());
 		File[] files = dir.listFiles(new XMLFilter());
 		for (File f : files)
 		for (File f : files)
+		{
 			hash.add(f);
 			hash.add(f);
+		}
 	}
 	}
 	
 	
 	public List<L2Skill> loadSkills(File file)
 	public List<L2Skill> loadSkills(File file)
@@ -84,14 +85,16 @@ public class SkillsEngine
 		{
 		{
 			List<L2Skill> s = loadSkills(file);
 			List<L2Skill> s = loadSkills(file);
 			if (s == null)
 			if (s == null)
+			{
 				continue;
 				continue;
+			}
 			for (L2Skill skill : s)
 			for (L2Skill skill : s)
 			{
 			{
 				allSkills.put(SkillTable.getSkillHashCode(skill), skill);
 				allSkills.put(SkillTable.getSkillHashCode(skill), skill);
 				count++;
 				count++;
 			}
 			}
 		}
 		}
-		_log.info("SkillsEngine: Loaded " + count + " Skill templates from XML files.");
+		_log.info(getClass().getSimpleName() + ": Loaded " + count + " Skill templates from XML files.");
 	}
 	}
 	
 	
 	/**
 	/**

+ 53 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/skills/conditions/ConditionPlayerTransformationId.java

@@ -0,0 +1,53 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.skills.conditions;
+
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.skills.Env;
+
+/**
+ * This condition becomes true whether the player is transformed
+ * and the transformation Id match the parameter or the parameter is -1
+ * which returns true if player is transformed regardless the transformation Id.
+ * @author Zoey76
+ */
+public class ConditionPlayerTransformationId extends Condition
+{
+	private final int _id;
+	
+	/**
+	 * Instantiates a new condition player is transformed.
+	 * @param id the transformation Id.
+	 */
+	public ConditionPlayerTransformationId(int id)
+	{
+		_id = id;
+	}
+	
+	@Override
+	public boolean testImpl(Env env)
+	{
+		if (!(env.player instanceof L2PcInstance))
+		{
+			return false;
+		}
+		final L2PcInstance player = env.player.getActingPlayer();
+		if (_id == -1)
+		{
+			return player.isTransformed();
+		}
+		return player.getTransformationId() == _id;
+	}
+}