Selaa lähdekoodia

BETA: Core-part for [DP10320].
Reviewed by: Nos, St3eT, !UnAfraid, Zoey76

Adry_85 11 vuotta sitten
vanhempi
sitoutus
610052f40c

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentBase.java

@@ -802,7 +802,7 @@ public abstract class DocumentBase
 				}
 				case "cloakstatus":
 				{
-					int val = Integer.parseInt(a.getNodeValue());
+					boolean val = Boolean.parseBoolean(a.getNodeValue());
 					cond = joinAnd(cond, new ConditionPlayerCloakStatus(val));
 					break;
 				}

+ 11 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/stat/PcStat.java

@@ -54,6 +54,7 @@ public class PcStat extends PlayableStat
 	private long _startingXp;
 	/** Player's maximum cubic count. */
 	private int _maxCubicCount = 1;
+	private boolean _cloakSlot = false;
 	
 	public static final int VITALITY_LEVELS[] =
 	{
@@ -416,6 +417,16 @@ public class PcStat extends PlayableStat
 		_maxCubicCount = cubicCount;
 	}
 	
+	public boolean canEquipCloak()
+	{
+		return _cloakSlot;
+	}
+	
+	public void setCloakSlotStatus(boolean cloakSlot)
+	{
+		_cloakSlot = cloakSlot;
+	}
+	
 	@Override
 	public final byte getLevel()
 	{

+ 3 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCloakStatus.java

@@ -25,13 +25,13 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public class ConditionPlayerCloakStatus extends Condition
 {
-	private final int _val;
+	private final boolean _val;
 	
 	/**
 	 * Instantiates a new condition player cloak status.
 	 * @param val the val
 	 */
-	public ConditionPlayerCloakStatus(int val)
+	public ConditionPlayerCloakStatus(boolean val)
 	{
 		_val = val;
 	}
@@ -39,6 +39,6 @@ public class ConditionPlayerCloakStatus extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return (env.getPlayer() != null) && (env.getPlayer().getInventory().getCloakStatus() >= _val);
+		return (env.getPlayer() != null) && (env.getPlayer().getInventory().canEquipCloak() == _val);
 	}
 }

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

@@ -1739,9 +1739,9 @@ public abstract class Inventory extends ItemContainer
 		setPaperdollItem(PAPERDOLL_DECO1, item);
 	}
 	
-	public int getCloakStatus()
+	public boolean canEquipCloak()
 	{
-		return (int) getOwner().getStat().calcStat(Stats.CLOAK_SLOT, 0, null, null);
+		return getOwner().getActingPlayer().getStat().canEquipCloak();
 	}
 	
 	/**

+ 0 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Stats.java

@@ -172,7 +172,6 @@ public enum Stats
 	
 	// T1 stats
 	TALISMAN_SLOTS("talisman"),
-	CLOAK_SLOT("cloak"),
 	
 	// Shield Stats
 	SHIELD_DEFENCE_ANGLE("shieldDefAngle"),

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/CharInfo.java

@@ -221,7 +221,7 @@ public class CharInfo extends L2GameServerPacket
 			}
 			
 			writeD(_activeChar.getInventory().getMaxTalismanCount());
-			writeD(_activeChar.getInventory().getCloakStatus());
+			writeD(_activeChar.getInventory().canEquipCloak() ? 1 : 0);
 			
 			writeD(_activeChar.getPvpFlag());
 			writeD(_activeChar.getKarma());

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/GMViewCharacterInfo.java

@@ -93,7 +93,7 @@ public class GMViewCharacterInfo extends L2GameServerPacket
 		}
 		
 		writeD(_activeChar.getInventory().getMaxTalismanCount()); // CT2.3
-		writeD(_activeChar.getInventory().getCloakStatus()); // CT2.3
+		writeD(_activeChar.getInventory().canEquipCloak() ? 1 : 0); // CT2.3
 		writeD(_activeChar.getPAtk(null));
 		writeD(_activeChar.getPAtkSpd());
 		writeD(_activeChar.getPDef(null));

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/UserInfo.java

@@ -136,7 +136,7 @@ public final class UserInfo extends L2GameServerPacket
 		}
 		
 		writeD(_activeChar.getInventory().getMaxTalismanCount());
-		writeD(_activeChar.getInventory().getCloakStatus());
+		writeD(_activeChar.getInventory().canEquipCloak() ? 1 : 0);
 		writeD(_activeChar.getPAtk(null));
 		writeD(_activeChar.getPAtkSpd());
 		writeD(_activeChar.getPDef(null));