瀏覽代碼

More cleanup (Dp update req!).
ChanceSkillTrigger handling rework.
Remove QuestStateManager - unused, buggy code.

JIV 15 年之前
父節點
當前提交
8567e4df83

+ 7 - 7
L2_GameServer/java/com/l2jserver/gameserver/SevenSigns.java

@@ -1461,7 +1461,7 @@ public class SevenSigns
 					// Perform initial Seal Validation set up.
 					// Perform initial Seal Validation set up.
 					initializeSeals();
 					initializeSeals();
 					//Buff/Debuff members of the event when Seal of Strife captured. 
 					//Buff/Debuff members of the event when Seal of Strife captured. 
-					GiveCPMult(getSealOwner(SEAL_STRIFE));
+					giveCPMult(getSealOwner(SEAL_STRIFE));
 					// Send message that Seal Validation has begun.
 					// Send message that Seal Validation has begun.
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_BEGUN);
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_BEGUN);
 					
 					
@@ -1480,7 +1480,7 @@ public class SevenSigns
 					// Send message that Seal Validation has ended.
 					// Send message that Seal Validation has ended.
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_ENDED);
 					sendMessageToAll(SystemMessageId.SEAL_VALIDATION_PERIOD_ENDED);
 					//Clear Seal of Strife influence.
 					//Clear Seal of Strife influence.
-					RemoveCPMult();
+					removeCPMult();
 					// Reset all data
 					// Reset all data
 					resetPlayerData();
 					resetPlayerData();
 					resetSeals();
 					resetSeals();
@@ -1524,7 +1524,7 @@ public class SevenSigns
 		}
 		}
 	}
 	}
 	
 	
-	public boolean CheckIsDawnPostingTicket(int itemId)
+	public boolean checkIsDawnPostingTicket(int itemId)
 	{
 	{
 		//TODO I think it should be some kind of a list in the datapack for compare;
 		//TODO I think it should be some kind of a list in the datapack for compare;
 		if (itemId > 6114 && itemId < 6175)
 		if (itemId > 6114 && itemId < 6175)
@@ -1546,7 +1546,7 @@ public class SevenSigns
 		return false;
 		return false;
 	}
 	}
 	
 	
-	public boolean CheckIsRookiePostingTicket(int itemId)
+	public boolean checkIsRookiePostingTicket(int itemId)
 	{
 	{
 		//TODO I think it should be some kind of a list in the datapack for compare;
 		//TODO I think it should be some kind of a list in the datapack for compare;
 		if (itemId > 6174 && itemId < 6295)
 		if (itemId > 6174 && itemId < 6295)
@@ -1560,7 +1560,7 @@ public class SevenSigns
 		return false;
 		return false;
 	}
 	}
 	
 	
-	public void GiveCPMult(int StrifeOwner)
+	public void giveCPMult(int StrifeOwner)
 	{
 	{
 		//Gives "Victor of War" passive skill to all online characters with Cabal, which controls Seal of Strife 
 		//Gives "Victor of War" passive skill to all online characters with Cabal, which controls Seal of Strife 
 		for (L2PcInstance character : L2World.getInstance().getAllPlayers().values())
 		for (L2PcInstance character : L2World.getInstance().getAllPlayers().values())
@@ -1574,7 +1574,7 @@ public class SevenSigns
 		}
 		}
 	}
 	}
 	
 	
-	public void RemoveCPMult()
+	public void removeCPMult()
 	{
 	{
 		for (L2PcInstance character : L2World.getInstance().getAllPlayers().values())
 		for (L2PcInstance character : L2World.getInstance().getAllPlayers().values())
 		{
 		{
@@ -1584,7 +1584,7 @@ public class SevenSigns
 		}
 		}
 	}
 	}
 	
 	
-	public boolean CheckSummonConditions(L2PcInstance activeChar)
+	public boolean checkSummonConditions(L2PcInstance activeChar)
 	{
 	{
 		if (activeChar == null)
 		if (activeChar == null)
 			return true;
 			return true;

+ 3 - 1
L2_GameServer/java/com/l2jserver/gameserver/instancemanager/TerritoryWarManager.java

@@ -955,9 +955,11 @@ public class TerritoryWarManager
 				}
 				}
 		}
 		}
 		if (_territoryWards != null)
 		if (_territoryWards != null)
+		{
 			for(TerritoryWard twWard : _territoryWards)
 			for(TerritoryWard twWard : _territoryWards)
 				twWard.unSpawnMe();
 				twWard.unSpawnMe();
-		_territoryWards.clear();
+			_territoryWards.clear();
+		}
 		for(L2SiegeFlagInstance flag : _clanFlags.values())
 		for(L2SiegeFlagInstance flag : _clanFlags.values())
 			flag.deleteMe();
 			flag.deleteMe();
 		_clanFlags.clear();
 		_clanFlags.clear();

+ 1 - 6
L2_GameServer/java/com/l2jserver/gameserver/model/ChanceSkillList.java

@@ -35,7 +35,7 @@ public class ChanceSkillList extends FastMap<IChanceSkillTrigger, ChanceConditio
 {
 {
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
-	private L2Character _owner;
+	private final L2Character _owner;
 
 
 	public ChanceSkillList(L2Character owner)
 	public ChanceSkillList(L2Character owner)
 	{
 	{
@@ -49,11 +49,6 @@ public class ChanceSkillList extends FastMap<IChanceSkillTrigger, ChanceConditio
 		return _owner;
 		return _owner;
 	}
 	}
 
 
-	public void setOwner(L2Character owner)
-	{
-		_owner = owner;
-	}
-
 	public void onHit(L2Character target, boolean ownerWasHit, boolean wasCrit)
 	public void onHit(L2Character target, boolean ownerWasHit, boolean wasCrit)
 	{
 	{
 		int event;
 		int event;

+ 0 - 5
L2_GameServer/java/com/l2jserver/gameserver/model/L2Skill.java

@@ -882,11 +882,6 @@ public abstract class L2Skill implements IChanceSkillTrigger
         return _chanceCondition != null && isPassive();
         return _chanceCondition != null && isPassive();
     }
     }
 
 
-    public ChanceCondition getChanceCondition()
-    {
-        return _chanceCondition;
-    }
-
     public final boolean isDance()
     public final boolean isDance()
     {
     {
         return _isDance;
         return _isDance;

+ 21 - 32
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -189,7 +189,7 @@ public abstract class L2Character extends L2Object
 	/** FastMap(Integer, L2Skill) containing all skills of the L2Character */
 	/** FastMap(Integer, L2Skill) containing all skills of the L2Character */
 	private final Map<Integer, L2Skill> _skills;
 	private final Map<Integer, L2Skill> _skills;
 	/** FastMap containing the active chance skills on this character */
 	/** FastMap containing the active chance skills on this character */
-	protected ChanceSkillList _chanceSkills;
+	private ChanceSkillList _chanceSkills;
 
 
 	/** Current force buff this caster is casting to a target */
 	/** Current force buff this caster is casting to a target */
 	protected FusionSkill _fusionSkill;
 	protected FusionSkill _fusionSkill;
@@ -5654,7 +5654,7 @@ public abstract class L2Character extends L2Object
 			}
 			}
 			if (newSkill.isChance())
 			if (newSkill.isChance())
 			{
 			{
-				addChanceSkill(newSkill);
+				addChanceTrigger(newSkill);
 			}
 			}
 			
 			
 			/*if (!newSkill.isChance() && newSkill.triggerAnotherSkill() )
 			/*if (!newSkill.isChance() && newSkill.triggerAnotherSkill() )
@@ -5776,48 +5776,38 @@ public abstract class L2Character extends L2Object
 		return oldSkill;
 		return oldSkill;
 	}
 	}
 
 
-	public synchronized void addChanceSkill(L2Skill skill)
-	{
-		if (_chanceSkills == null)
-				_chanceSkills = new ChanceSkillList(this);
-			
-		_chanceSkills.put(skill, skill.getChanceCondition());
-	}
-
-	public synchronized void removeChanceSkill(int id)
+	public void removeChanceSkill(int id)
 	{
 	{
 		if (_chanceSkills == null) return;
 		if (_chanceSkills == null) return;
-		for (IChanceSkillTrigger trigger : _chanceSkills.keySet())
+		synchronized (_chanceSkills)
 		{
 		{
-			if (!(trigger instanceof L2Skill))
-				continue;
-			
-			L2Skill skill = (L2Skill)trigger;
-			
-			if (skill.getId() == id)
-				_chanceSkills.remove(skill);
+			for (IChanceSkillTrigger trigger : _chanceSkills.keySet())
+			{
+				if (!(trigger instanceof L2Skill))
+					continue;
+				if (((L2Skill) trigger).getId() == id)
+					_chanceSkills.remove(trigger);
+			}
 		}
 		}
-		
-		if (_chanceSkills.isEmpty())
-				_chanceSkills = null;
 	}
 	}
 	
 	
-	public synchronized void addChanceEffect(EffectChanceSkillTrigger effect)
+	public void addChanceTrigger(IChanceSkillTrigger trigger)
 	{
 	{
 		if (_chanceSkills == null)
 		if (_chanceSkills == null)
-			_chanceSkills = new ChanceSkillList(this);
-		
-		_chanceSkills.put(effect, effect.getTriggeredChanceCondition());
+		{
+			synchronized(this)
+			{
+				if (_chanceSkills == null)
+					_chanceSkills = new ChanceSkillList(this);
+			}
+		}
+		_chanceSkills.put(trigger, trigger.getTriggeredChanceCondition());
 	}
 	}
 
 
-	public synchronized void removeChanceEffect(EffectChanceSkillTrigger effect)
+	public void removeChanceEffect(EffectChanceSkillTrigger effect)
 	{
 	{
 		if (_chanceSkills == null) return;
 		if (_chanceSkills == null) return;
-
 		_chanceSkills.remove(effect);
 		_chanceSkills.remove(effect);
-
-		if (_chanceSkills.isEmpty())
-			_chanceSkills = null;
 	}
 	}
 
 
 	public void onStartChanceEffect(byte element)
 	public void onStartChanceEffect(byte element)
@@ -6534,7 +6524,6 @@ public abstract class L2Character extends L2Object
 									&& !(skill.getSkillType() == L2SkillType.BEAST_FEED) 
 									&& !(skill.getSkillType() == L2SkillType.BEAST_FEED) 
 									&& !(skill.getSkillType() == L2SkillType.UNLOCK)
 									&& !(skill.getSkillType() == L2SkillType.UNLOCK)
 									&& !(skill.getSkillType() == L2SkillType.DELUXE_KEY_UNLOCK)
 									&& !(skill.getSkillType() == L2SkillType.DELUXE_KEY_UNLOCK)
-									&& (!(target instanceof L2Summon) || player.getPet() != target)
 							)
 							)
 								player.updatePvPStatus();
 								player.updatePvPStatus();
 						}
 						}

+ 3 - 3
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CubicInstance.java

@@ -543,7 +543,7 @@ public class L2CubicInstance
 						if (skill.getId() == SKILL_CUBIC_HEAL)
 						if (skill.getId() == SKILL_CUBIC_HEAL)
 						{
 						{
 							// friendly skill, so we look a target in owner's party
 							// friendly skill, so we look a target in owner's party
-							CubicTargetForHeal();
+							cubicTargetForHeal();
 						}
 						}
 						else
 						else
 						{
 						{
@@ -874,7 +874,7 @@ public class L2CubicInstance
 	}
 	}
 	
 	
 	/** this sets the friendly target for a cubic */
 	/** this sets the friendly target for a cubic */
-	public void CubicTargetForHeal()
+	public void cubicTargetForHeal()
 	{
 	{
 		L2Character target = null;
 		L2Character target = null;
 		double percentleft = 100.0;
 		double percentleft = 100.0;
@@ -989,7 +989,7 @@ public class L2CubicInstance
 				
 				
 				if (skill != null)
 				if (skill != null)
 				{
 				{
-					CubicTargetForHeal();
+					cubicTargetForHeal();
 					L2Character target = _target;
 					L2Character target = _target;
 					if (target != null && !target.isDead())
 					if (target != null && !target.isDead())
 					{
 					{

+ 3 - 9
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -5295,7 +5295,7 @@ public final class L2PcInstance extends L2Playable
         _coupleId = coupleId;
         _coupleId = coupleId;
     }
     }
 
 
-    public void EngageAnswer(int answer)
+    public void engageAnswer(int answer)
     {
     {
         if(_engagerequest==false)
         if(_engagerequest==false)
             return;
             return;
@@ -8784,7 +8784,7 @@ public final class L2PcInstance extends L2Playable
         // siege golem (13), Wild Hog Cannon (299), Swoop Cannon (448)
         // siege golem (13), Wild Hog Cannon (299), Swoop Cannon (448)
         if ((skill.getId() == 13 || skill.getId() == 299 || skill.getId() == 448)
         if ((skill.getId() == 13 || skill.getId() == 299 || skill.getId() == 448)
         		&& ((!SiegeManager.getInstance().checkIfOkToSummon(this, false) 
         		&& ((!SiegeManager.getInstance().checkIfOkToSummon(this, false) 
-                && !FortSiegeManager.getInstance().checkIfOkToSummon(this, false))||(SevenSigns.getInstance().CheckSummonConditions(this))))
+                && !FortSiegeManager.getInstance().checkIfOkToSummon(this, false))||(SevenSigns.getInstance().checkSummonConditions(this))))
 			return false;
 			return false;
         
         
         // Check if this skill is enabled (ex : reuse time)
         // Check if this skill is enabled (ex : reuse time)
@@ -11867,12 +11867,6 @@ public final class L2PcInstance extends L2Playable
 		for (L2PcInstance player : _snoopListener)
 		for (L2PcInstance player : _snoopListener)
 			player.removeSnooped(this);
 			player.removeSnooped(this);
 		
 		
-		if (_chanceSkills != null)
-		{
-			_chanceSkills.setOwner(null);
-			_chanceSkills = null;
-		}
-		
 		// Remove L2Object object from _allObjects of L2World
 		// Remove L2Object object from _allObjects of L2World
 		L2World.getInstance().removeObject(this);
 		L2World.getInstance().removeObject(this);
 		L2World.getInstance().removeFromAllPlayers(this); // force remove in case of crash during teleport
 		L2World.getInstance().removeFromAllPlayers(this); // force remove in case of crash during teleport
@@ -14079,7 +14073,7 @@ public final class L2PcInstance extends L2Playable
     		return true;
     		return true;
     }
     }
     
     
-    public void TeleportBookmarkAdd(int x,int y,int z,int icon, String tag, String name)
+    public void teleportBookmarkAdd(int x,int y,int z,int icon, String tag, String name)
     {
     {
     	if(this == null)
     	if(this == null)
     		return;
     		return;

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/entity/Castle.java

@@ -283,7 +283,7 @@ public class Castle
 		return null;
 		return null;
 	}
 	}
 	
 	
-	public synchronized void Engrave(L2Clan clan, L2Object target)
+	public synchronized void engrave(L2Clan clan, L2Object target)
 	{
 	{
 		if (!_artefacts.contains(target))
 		if (!_artefacts.contains(target))
 			return;
 			return;

+ 3 - 3
L2_GameServer/java/com/l2jserver/gameserver/model/entity/Fort.java

@@ -309,12 +309,12 @@ public class Fort
 	// =========================================================
 	// =========================================================
 	// Method - Public
 	// Method - Public
 	
 	
-	public void EndOfSiege(L2Clan clan)
+	public void endOfSiege(L2Clan clan)
 	{
 	{
 		ThreadPoolManager.getInstance().scheduleGeneral(new endFortressSiege(this, clan), 1000);
 		ThreadPoolManager.getInstance().scheduleGeneral(new endFortressSiege(this, clan), 1000);
 	}
 	}
 	
 	
-	public void Engrave(L2Clan clan)
+	public void engrave(L2Clan clan)
 	{
 	{
 		setOwner(clan, true);
 		setOwner(clan, true);
 	}
 	}
@@ -1078,7 +1078,7 @@ public class Fort
 		{
 		{
 			try
 			try
 			{
 			{
-				_f.Engrave(_clan);
+				_f.engrave(_clan);
 			}
 			}
 			catch (Exception e)
 			catch (Exception e)
 			{
 			{

+ 0 - 132
L2_GameServer/java/com/l2jserver/gameserver/model/quest/QuestStateManager.java

@@ -1,132 +0,0 @@
-/*
- * 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.model.quest;
-
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.l2jserver.gameserver.ThreadPoolManager;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-
-import javolution.util.FastList;
-
-public class QuestStateManager
-{
-	protected static final Logger _log = Logger.getLogger(QuestStateManager.class.getName());
-	
-	// =========================================================
-	// Schedule Task
-	public class ScheduleTimerTask implements Runnable
-	{
-		public void run()
-		{
-			try
-			{
-				cleanUp();
-				ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleTimerTask(), 60000);
-			}
-			catch (Exception e)
-			{
-				_log.log(Level.SEVERE, "", e);
-			}
-		}
-	}
-	
-	// =========================================================
-	// Data Field
-	private List<QuestState> _questStates = new FastList<QuestState>();
-	
-	// =========================================================
-	// Constructor
-	private QuestStateManager()
-	{
-		ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleTimerTask(), 60000);
-	}
-	
-	// =========================================================
-	// Method - Public
-	/**
-	 * Add QuestState for the specified player instance
-	 */
-	public void addQuestState(Quest quest, L2PcInstance player, byte state)
-	{
-		QuestState qs = getQuestState(player);
-		if (qs == null)
-			qs = new QuestState(quest, player, state);
-	}
-	
-	/**
-	 * Remove all QuestState for all player instance that does not exist
-	 */
-	public void cleanUp()
-	{
-		for (int i = getQuestStates().size() - 1; i >= 0; i--)
-		{
-			if (getQuestStates().get(i).getPlayer() == null)
-			{
-				removeQuestState(getQuestStates().get(i));
-				getQuestStates().remove(i);
-			}
-		}
-	}
-	
-	// =========================================================
-	// Method - Private
-	/**
-	 * Remove QuestState instance
-	 */
-	private void removeQuestState(QuestState qs)
-	{
-		qs = null;
-	}
-	
-	// =========================================================
-	// Property - Public
-	public static final QuestStateManager getInstance()
-	{
-		return SingletonHolder._instance;
-	}
-	
-	/**
-	 * Return QuestState for specified player instance
-	 */
-	public QuestState getQuestState(L2PcInstance player)
-	{
-		for (QuestState q : getQuestStates())
-		{
-			if (q.getPlayer() != null && q.getPlayer().getObjectId() == player.getObjectId())
-				return q;
-		}
-		
-		return null;
-	}
-	
-	/**
-	 * Return all QuestState
-	 */
-	public List<QuestState> getQuestStates()
-	{
-		if (_questStates == null)
-			_questStates = new FastList<QuestState>();
-		return _questStates;
-	}
-	
-	@SuppressWarnings("synthetic-access")
-	private static class SingletonHolder
-	{
-		protected static final QuestStateManager _instance = new QuestStateManager();
-	}
-}

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/DlgAnswer.java

@@ -57,7 +57,7 @@ public final class DlgAnswer extends L2GameClientPacket
 		else if (_messageId==SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
 		else if (_messageId==SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
 			activeChar.teleportAnswer(_answer, _requesterId);
 			activeChar.teleportAnswer(_answer, _requesterId);
 		else if (_messageId == SystemMessageId.S1.getId() && Config.L2JMOD_ALLOW_WEDDING)
 		else if (_messageId == SystemMessageId.S1.getId() && Config.L2JMOD_ALLOW_WEDDING)
-			activeChar.EngageAnswer(_answer);
+			activeChar.engageAnswer(_answer);
 		else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_OPEN_THE_GATE.getId())
 		else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_OPEN_THE_GATE.getId())
 			activeChar.gatesAnswer(_answer, 1);
 			activeChar.gatesAnswer(_answer, 1);
 		else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_CLOSE_THE_GATE.getId())
 		else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_CLOSE_THE_GATE.getId())

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java

@@ -42,7 +42,7 @@ public final class RequestSaveBookMarkSlot extends L2GameClientPacket
 		L2PcInstance activeChar = getClient().getActiveChar();
 		L2PcInstance activeChar = getClient().getActiveChar();
 		if (activeChar == null)
 		if (activeChar == null)
 			return;
 			return;
-		activeChar.TeleportBookmarkAdd(activeChar.getX(), activeChar.getY(), activeChar.getZ(), icon, tag, name);
+		activeChar.teleportBookmarkAdd(activeChar.getX(), activeChar.getY(), activeChar.getZ(), icon, tag, name);
 	}
 	}
 
 
 
 

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/skills/effects/EffectChanceSkillTrigger.java

@@ -45,7 +45,7 @@ public class EffectChanceSkillTrigger extends L2Effect implements IChanceSkillTr
 	@Override
 	@Override
 	public boolean onStart()
 	public boolean onStart()
 	{
 	{
-		getEffected().addChanceEffect(this);
+		getEffected().addChanceTrigger(this);
 		getEffected().onStartChanceEffect(getSkill().getElement());
 		getEffected().onStartChanceEffect(getSkill().getElement());
 		return super.onStart();
 		return super.onStart();
 	}
 	}

+ 0 - 10
L2_GameServer/java/com/l2jserver/util/lib/Log.java

@@ -69,14 +69,4 @@ public class Log
 			}
 			}
 		}
 		}
 	}
 	}
-	
-
-	public static final void Assert(boolean exp, String cmt)
-	{
-		if (exp)
-			return;
-		
-		_log.warning("Assertion error [" + cmt + "]");
-		Thread.dumpStack();
-	}
 }
 }