소스 검색

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

Adry_85 11 년 전
부모
커밋
cf1371a582

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

@@ -18,6 +18,8 @@
  */
 package com.l2jserver.gameserver.model.actor.stat;
 
+import java.util.concurrent.atomic.AtomicInteger;
+
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.datatables.ExperienceTable;
 import com.l2jserver.gameserver.datatables.PetDataTable;
@@ -54,6 +56,8 @@ public class PcStat extends PlayableStat
 	private long _startingXp;
 	/** Player's maximum cubic count. */
 	private int _maxCubicCount = 1;
+	/** Player's maximum talisman count. */
+	private final AtomicInteger _talismanSlots = new AtomicInteger();
 	private boolean _cloakSlot = false;
 	
 	public static final int VITALITY_LEVELS[] =
@@ -417,6 +421,20 @@ public class PcStat extends PlayableStat
 		_maxCubicCount = cubicCount;
 	}
 	
+	/**
+	 * Gets the maximum talisman count.
+	 * @return the maximum talisman count
+	 */
+	public int getTalismanSlots()
+	{
+		return _talismanSlots.get();
+	}
+	
+	public void addTalismanSlots(int count)
+	{
+		_talismanSlots.addAndGet(count);
+	}
+	
 	public boolean canEquipCloak()
 	{
 		return _cloakSlot;

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

@@ -44,7 +44,6 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.items.type.EtcItemType;
 import com.l2jserver.gameserver.model.items.type.WeaponType;
 import com.l2jserver.gameserver.model.skills.Skill;
-import com.l2jserver.gameserver.model.stats.Stats;
 import com.l2jserver.gameserver.network.serverpackets.SkillCoolTime;
 import com.l2jserver.util.StringUtil;
 
@@ -1699,20 +1698,20 @@ public abstract class Inventory extends ItemContainer
 		}
 	}
 	
-	public int getMaxTalismanCount()
+	public int getTalismanSlots()
 	{
-		return (int) getOwner().getStat().calcStat(Stats.TALISMAN_SLOTS, 0, null, null);
+		return getOwner().getActingPlayer().getStat().getTalismanSlots();
 	}
 	
 	private void equipTalisman(L2ItemInstance item)
 	{
-		if (getMaxTalismanCount() == 0)
+		if (getTalismanSlots() == 0)
 		{
 			return;
 		}
 		
 		// find same (or incompatible) talisman type
-		for (int i = PAPERDOLL_DECO1; i < (PAPERDOLL_DECO1 + getMaxTalismanCount()); i++)
+		for (int i = PAPERDOLL_DECO1; i < (PAPERDOLL_DECO1 + getTalismanSlots()); i++)
 		{
 			if (_paperdoll[i] != null)
 			{
@@ -1726,7 +1725,7 @@ public abstract class Inventory extends ItemContainer
 		}
 		
 		// no free slot found - put on first free
-		for (int i = PAPERDOLL_DECO1; i < (PAPERDOLL_DECO1 + getMaxTalismanCount()); i++)
+		for (int i = PAPERDOLL_DECO1; i < (PAPERDOLL_DECO1 + getTalismanSlots()); i++)
 		{
 			if (_paperdoll[i] == null)
 			{

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

@@ -170,9 +170,6 @@ public enum Stats
 	BOW_MP_CONSUME_RATE("BowMpConsumeRate"),
 	MP_CONSUME("MpConsume"),
 	
-	// T1 stats
-	TALISMAN_SLOTS("talisman"),
-	
 	// Shield Stats
 	SHIELD_DEFENCE_ANGLE("shieldDefAngle"),
 	

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/UseItem.java

@@ -305,7 +305,7 @@ public final class UseItem extends L2GameClientPacket
 				}
 				case L2Item.SLOT_DECO:
 				{
-					if (!item.isEquipped() && (activeChar.getInventory().getMaxTalismanCount() == 0))
+					if (!item.isEquipped() && (activeChar.getInventory().getTalismanSlots() == 0))
 					{
 						activeChar.sendPacket(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION);
 						return;

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

@@ -220,7 +220,7 @@ public class CharInfo extends L2GameServerPacket
 				writeD(_activeChar.getInventory().getPaperdollAugmentationId(slot));
 			}
 			
-			writeD(_activeChar.getInventory().getMaxTalismanCount());
+			writeD(_activeChar.getInventory().getTalismanSlots());
 			writeD(_activeChar.getInventory().canEquipCloak() ? 1 : 0);
 			
 			writeD(_activeChar.getPvpFlag());

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

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

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

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