소스 검색

BETA: Core part for [DP9794].
Reviewed by: Zoey76

Adry_85 12 년 전
부모
커밋
eb6549cd45

+ 5 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentBase.java

@@ -53,6 +53,7 @@ import com.l2jserver.gameserver.model.conditions.ConditionPlayerActiveSkillId;
 import com.l2jserver.gameserver.model.conditions.ConditionPlayerAgathionId;
 import com.l2jserver.gameserver.model.conditions.ConditionPlayerCallPc;
 import com.l2jserver.gameserver.model.conditions.ConditionPlayerCanEscape;
+import com.l2jserver.gameserver.model.conditions.ConditionPlayerCanRefuelAirship;
 import com.l2jserver.gameserver.model.conditions.ConditionPlayerCanSweep;
 import com.l2jserver.gameserver.model.conditions.ConditionPlayerCanTransform;
 import com.l2jserver.gameserver.model.conditions.ConditionPlayerCanUntransform;
@@ -761,6 +762,10 @@ public abstract class DocumentBase
 			{
 				cond = joinAnd(cond, new ConditionPlayerCanEscape(Boolean.parseBoolean(a.getNodeValue())));
 			}
+			else if ("canRefuelAirship".equalsIgnoreCase(a.getNodeName()))
+			{
+				cond = joinAnd(cond, new ConditionPlayerCanRefuelAirship(Integer.parseInt(a.getNodeValue())));
+			}
 			else if ("canSweep".equalsIgnoreCase(a.getNodeName()))
 			{
 				cond = joinAnd(cond, new ConditionPlayerCanSweep(Boolean.parseBoolean(a.getNodeValue())));

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -4390,7 +4390,7 @@ public final class L2PcInstance extends L2Playable
 		}
 		
 		// Check if the spell using charges or not in AirShip
-		if (((getCharges() < skill.getChargeConsume())) || (isInAirShip() && (skill.getSkillType() != L2SkillType.REFUEL)))
+		if (((getCharges() < skill.getChargeConsume())) || (isInAirShip() && !skill.hasEffectType(L2EffectType.REFUEL_AIRSHIP)))
 		{
 			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
 			sm.addSkillName(skill);

+ 49 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCanRefuelAirship.java

@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server 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.
+ *
+ * L2J Server 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.conditions;
+
+import com.l2jserver.gameserver.model.actor.instance.L2ControllableAirShipInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.stats.Env;
+
+/**
+ * Player Can Refuel Airship condition implementation.
+ * @author Adry_85
+ */
+public class ConditionPlayerCanRefuelAirship extends Condition
+{
+	private final int _val;
+	
+	public ConditionPlayerCanRefuelAirship(int val)
+	{
+		_val = val;
+	}
+	
+	@Override
+	public boolean testImpl(Env env)
+	{
+		boolean canRefuelAirship = true;
+		final L2PcInstance player = env.getPlayer();
+		if ((player == null) || (player.getAirShip() == null) || !(player.getAirShip() instanceof L2ControllableAirShipInstance) || ((player.getAirShip().getFuel() + _val) > player.getAirShip().getMaxFuel()))
+		{
+			canRefuelAirship = false;
+		}
+		return canRefuelAirship;
+	}
+}

+ 1 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/L2EffectType.java

@@ -73,6 +73,7 @@ public enum L2EffectType
 	PHYSICAL_MUTE,
 	PROTECTION_BLESSING,
 	REBALANCE_HP,
+	REFUEL_AIRSHIP,
 	RELAXING,
 	ROOT,
 	SIGNET_EFFECT,

+ 0 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/L2SkillType.java

@@ -80,8 +80,6 @@ public enum L2SkillType
 	
 	// Skill is done within the core.
 	COREDONE,
-	// Refuel airship
-	REFUEL,
 	// Nornil's Power (Nornil's Garden instance)
 	NORNILS_POWER,
 	// unimplemented