瀏覽代碼

BETA: Some Quest related improvements.
* Patch by jurchiks

Rumen Nikiforov 12 年之前
父節點
當前提交
121652ab29

+ 6 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2Item.java

@@ -49,7 +49,12 @@ import com.l2jserver.util.StringUtil;
 
 /**
  * This class contains all informations concerning the item (weapon, armor, etc).<BR>
- * Mother class of : <LI>L2Armor</LI> <LI>L2EtcItem</LI> <LI>L2Weapon</LI>
+ * Mother class of :
+ * <ul>
+ * <li>L2Armor</li>
+ * <li>L2EtcItem</li>
+ * <li>L2Weapon</li>
+ * </ul>
  * @version $Revision: 1.7.2.2.2.5 $ $Date: 2005/04/06 18:25:18 $
  */
 public abstract class L2Item

+ 8 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2WarehouseItem.java

@@ -19,7 +19,12 @@ import com.l2jserver.gameserver.model.items.type.L2ItemType;
 
 /**
  * This class contains L2ItemInstance<BR>
- * Use to sort L2ItemInstance of : <LI>L2Armor</LI> <LI>L2EtcItem</LI> <LI>L2Weapon</LI>
+ * Use to sort L2ItemInstance of :
+ * <ul>
+ * <li>L2Armor</li>
+ * <li>L2EtcItem</li>
+ * <li>L2Weapon</li>
+ * </ul>
  * @version $Revision: 1.7.2.2.2.5 $ $Date: 2005/04/06 18:25:18 $
  */
 public class L2WarehouseItem
@@ -39,6 +44,7 @@ public class L2WarehouseItem
 	
 	private int _elemAtkType = -2;
 	private int _elemAtkPower = 0;
+	
 	private final int[] _elemDefAttr =
 	{
 		0,
@@ -48,6 +54,7 @@ public class L2WarehouseItem
 		0,
 		0
 	};
+	
 	private final int _time;
 	
 	public L2WarehouseItem(L2ItemInstance item)
@@ -227,9 +234,7 @@ public class L2WarehouseItem
 	
 	/**
 	 * @return the name of the item
-	 * @deprecated beware to use getItemName() instead because getName() is final in L2Object and could not be overridden! Allover L2Object.getName() may return null!
 	 */
-	@Deprecated
 	public String getName()
 	{
 		return _item.getName();

+ 6 - 13
L2J_Server_BETA/java/com/l2jserver/gameserver/model/quest/Quest.java

@@ -1168,11 +1168,7 @@ public class Quest extends ManagedScript
 	 */
 	public String onDeath(L2Character killer, L2Character victim, QuestState qs)
 	{
-		if (killer instanceof L2Npc)
-		{
-			return onAdvEvent("", (L2Npc) killer, qs.getPlayer());
-		}
-		return onAdvEvent("", null, qs.getPlayer());
+		return onAdvEvent("", ((killer instanceof L2Npc) ? ((L2Npc) killer) : null), qs.getPlayer());
 	}
 	
 	/**
@@ -1807,8 +1803,7 @@ public class Quest extends ManagedScript
 	 */
 	public static void updateQuestInDb(QuestState qs)
 	{
-		String val = State.getStateName(qs.getState());
-		updateQuestVarInDb(qs, "<state>", val);
+		updateQuestVarInDb(qs, "<state>", State.getStateName(qs.getState()));
 	}
 	
 	/**
@@ -1822,7 +1817,6 @@ public class Quest extends ManagedScript
 		{
 			return result;
 		}
-		
 		return DEFAULT_NO_QUEST_MSG;
 	}
 	
@@ -1837,7 +1831,6 @@ public class Quest extends ManagedScript
 		{
 			return result;
 		}
-		
 		return DEFAULT_ALREADY_COMPLETED_MSG;
 	}
 	
@@ -2521,7 +2514,7 @@ public class Quest extends ManagedScript
 	 */
 	public L2Npc addSpawn(int npcId, L2Character cha)
 	{
-		return addSpawn(npcId, cha.getX(), cha.getY(), cha.getZ(), cha.getHeading(), false, 0, false);
+		return addSpawn(npcId, cha.getX(), cha.getY(), cha.getZ(), cha.getHeading(), false, 0, false, 0);
 	}
 	
 	/**
@@ -2533,7 +2526,7 @@ public class Quest extends ManagedScript
 	 */
 	public L2Npc addSpawn(int npcId, L2Character cha, boolean isSummonSpawn)
 	{
-		return addSpawn(npcId, cha.getX(), cha.getY(), cha.getZ(), cha.getHeading(), false, 0, isSummonSpawn);
+		return addSpawn(npcId, cha.getX(), cha.getY(), cha.getZ(), cha.getHeading(), false, 0, isSummonSpawn, 0);
 	}
 	
 	/**
@@ -2548,7 +2541,7 @@ public class Quest extends ManagedScript
 	 */
 	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
 	{
-		return addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay, false);
+		return addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay, false, 0);
 	}
 	
 	/**
@@ -2560,7 +2553,7 @@ public class Quest extends ManagedScript
 	 */
 	public L2Npc addSpawn(int npcId, Location loc, boolean randomOffSet, long despawnDelay)
 	{
-		return addSpawn(npcId, loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), randomOffSet, despawnDelay, false);
+		return addSpawn(npcId, loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), randomOffSet, despawnDelay, false, 0);
 	}
 	
 	/**

+ 4 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/quest/QuestState.java

@@ -528,6 +528,7 @@ public final class QuestState
 	 * @param value the new value of the quest state progress
 	 * @return this {@link QuestState} object
 	 * @see #set(String var, String val)
+	 * @see #setCond(int, boolean)
 	 */
 	public QuestState setCond(int value)
 	{
@@ -568,9 +569,8 @@ public final class QuestState
 	 * @param value the new value of the quest state progress
 	 * @param playQuestMiddle if {@code true}, plays "ItemSound.quest_middle"
 	 * @return this {@link QuestState} object
-	 * @see #set(String var, String val)
-	 * @see #setCond(int, boolean)
 	 * @see #setCond(int value)
+	 * @see #set(String var, String val)
 	 */
 	public QuestState setCond(int value, boolean playQuestMiddle)
 	{
@@ -593,7 +593,7 @@ public final class QuestState
 	 */
 	public void addNotifyOfDeath(L2Character character)
 	{
-		if ((character == null) || !(character instanceof L2PcInstance))
+		if (!(character instanceof L2PcInstance))
 		{
 			return;
 		}
@@ -1072,8 +1072,6 @@ public final class QuestState
 			return this;
 		}
 		
-		setState(State.COMPLETED);
-		
 		// Clean registered quest items
 		int[] itemIdList = getQuest().getRegisteredItemIds();
 		if (itemIdList != null)
@@ -1091,7 +1089,7 @@ public final class QuestState
 		}
 		else
 		{
-			Quest.updateQuestInDb(this);
+			setState(State.COMPLETED);
 		}
 		_vars = null;
 		return this;