Parcourir la source

BETA: Core-part for ​​​​​[DP9733].
Reviewed by: Zoey76

Adry_85 il y a 12 ans
Parent
commit
8200303ce0

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

@@ -51,6 +51,7 @@ import com.l2jserver.gameserver.model.conditions.ConditionMinDistance;
 import com.l2jserver.gameserver.model.conditions.ConditionPlayerActiveEffectId;
 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.ConditionPlayerCanSweep;
 import com.l2jserver.gameserver.model.conditions.ConditionPlayerCharges;
@@ -749,6 +750,10 @@ public abstract class DocumentBase
 					cond = joinAnd(cond, new ConditionPlayerRangeFromNpc(npcIds, radius, val));
 				}
 			}
+			else if ("callPc".equalsIgnoreCase(a.getNodeName()))
+			{
+				cond = joinAnd(cond, new ConditionPlayerCallPc(Boolean.parseBoolean(a.getNodeValue())));
+			}
 			else if ("canEscape".equalsIgnoreCase(a.getNodeName()))
 			{
 				cond = joinAnd(cond, new ConditionPlayerCanEscape(Boolean.parseBoolean(a.getNodeValue())));

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

@@ -9441,7 +9441,7 @@ public final class L2PcInstance extends L2Playable
 		}
 		
 		// TODO: Unhardcode skillId 844 which is the outpost construct skill
-		if (((sklTargetType == L2TargetType.HOLY) && !checkIfOkToCastSealOfRule(CastleManager.getInstance().getCastle(this), false, skill, target)) || ((sklTargetType == L2TargetType.FLAGPOLE) && !checkIfOkToCastFlagDisplay(FortManager.getInstance().getFort(this), false, skill, target)) || ((sklType == L2SkillType.SIEGEFLAG) && !L2SkillSiegeFlag.checkIfOkToPlaceFlag(this, false, skill.getId() == 844)) || ((sklType == L2SkillType.SUMMON_FRIEND) && !(checkSummonerStatus(this) && checkSummonTargetStatus(target, this))))
+		if (((sklTargetType == L2TargetType.HOLY) && !checkIfOkToCastSealOfRule(CastleManager.getInstance().getCastle(this), false, skill, target)) || ((sklTargetType == L2TargetType.FLAGPOLE) && !checkIfOkToCastFlagDisplay(FortManager.getInstance().getFort(this), false, skill, target)) || ((sklType == L2SkillType.SIEGEFLAG) && !L2SkillSiegeFlag.checkIfOkToPlaceFlag(this, false, skill.getId() == 844)))
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			abortCast();
@@ -13566,183 +13566,6 @@ public final class L2PcInstance extends L2Playable
 		getStat().updateVitalityPoints(points, useRates, quiet);
 	}
 	
-	public static void teleToTarget(L2PcInstance targetChar, L2PcInstance summonerChar, L2Skill summonSkill)
-	{
-		if ((targetChar == null) || (summonerChar == null) || (summonSkill == null))
-		{
-			return;
-		}
-		
-		if (!checkSummonerStatus(summonerChar))
-		{
-			return;
-		}
-		if (!checkSummonTargetStatus(targetChar, summonerChar))
-		{
-			return;
-		}
-		
-		int itemConsumeId = summonSkill.getTargetConsumeId();
-		int itemConsumeCount = summonSkill.getTargetConsume();
-		if ((itemConsumeId != 0) && (itemConsumeCount != 0))
-		{
-			if (targetChar.getInventory().getInventoryItemCount(itemConsumeId, 0) < itemConsumeCount)
-			{
-				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_REQUIRED_FOR_SUMMONING);
-				sm.addItemName(summonSkill.getTargetConsumeId());
-				targetChar.sendPacket(sm);
-				return;
-			}
-			targetChar.getInventory().destroyItemByItemId("Consume", itemConsumeId, itemConsumeCount, summonerChar, targetChar);
-			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
-			sm.addItemName(summonSkill.getTargetConsumeId());
-			targetChar.sendPacket(sm);
-		}
-		targetChar.teleToLocation(summonerChar.getX(), summonerChar.getY(), summonerChar.getZ(), true);
-	}
-	
-	public static boolean checkSummonerStatus(L2PcInstance summonerChar)
-	{
-		if (summonerChar == null)
-		{
-			return false;
-		}
-		
-		if (summonerChar.isInOlympiadMode())
-		{
-			summonerChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
-			return false;
-		}
-		
-		if (summonerChar.inObserverMode())
-		{
-			return false;
-		}
-		
-		if (!TvTEvent.onEscapeUse(summonerChar.getObjectId()))
-		{
-			summonerChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
-			return false;
-		}
-		
-		if (summonerChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || summonerChar.isFlyingMounted())
-		{
-			summonerChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
-			return false;
-		}
-		return true;
-	}
-	
-	public static boolean checkSummonTargetStatus(L2Object target, L2PcInstance summonerChar)
-	{
-		if ((target == null) || !(target instanceof L2PcInstance))
-		{
-			return false;
-		}
-		
-		L2PcInstance targetChar = (L2PcInstance) target;
-		
-		if (targetChar.isAlikeDead())
-		{
-			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED);
-			sm.addPcName(targetChar);
-			summonerChar.sendPacket(sm);
-			return false;
-		}
-		
-		if (targetChar.isInStoreMode())
-		{
-			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_CURRENTLY_TRADING_OR_OPERATING_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED);
-			sm.addPcName(targetChar);
-			summonerChar.sendPacket(sm);
-			return false;
-		}
-		
-		if (targetChar.isRooted() || targetChar.isInCombat())
-		{
-			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED);
-			sm.addPcName(targetChar);
-			summonerChar.sendPacket(sm);
-			return false;
-		}
-		
-		if (targetChar.isInOlympiadMode())
-		{
-			summonerChar.sendPacket(SystemMessageId.YOU_CANNOT_SUMMON_PLAYERS_WHO_ARE_IN_OLYMPIAD);
-			return false;
-		}
-		
-		if (targetChar.isFestivalParticipant() || targetChar.isFlyingMounted())
-		{
-			summonerChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
-			return false;
-		}
-		
-		if (targetChar.inObserverMode())
-		{
-			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_STATE_FORBIDS_SUMMONING);
-			sm.addCharName(targetChar);
-			summonerChar.sendPacket(sm);
-			return false;
-		}
-		
-		if (targetChar.isCombatFlagEquipped())
-		{
-			summonerChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
-			return false;
-		}
-		
-		if (!TvTEvent.onEscapeUse(targetChar.getObjectId()))
-		{
-			summonerChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
-			return false;
-		}
-		
-		if (targetChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
-		{
-			SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IN_SUMMON_BLOCKING_AREA);
-			sm.addString(targetChar.getName());
-			summonerChar.sendPacket(sm);
-			return false;
-		}
-		
-		if (summonerChar.getInstanceId() > 0)
-		{
-			Instance summonerInstance = InstanceManager.getInstance().getInstance(summonerChar.getInstanceId());
-			if (!Config.ALLOW_SUMMON_TO_INSTANCE || !summonerInstance.isSummonAllowed())
-			{
-				summonerChar.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
-				return false;
-			}
-		}
-		
-		// on retail character can enter 7s dungeon with summon friend,
-		// but will be teleported away by mobs
-		// because currently this is not working in L2J we do not allowing summoning
-		if (summonerChar.isIn7sDungeon())
-		{
-			int targetCabal = SevenSigns.getInstance().getPlayerCabal(targetChar.getObjectId());
-			if (SevenSigns.getInstance().isSealValidationPeriod())
-			{
-				if (targetCabal != SevenSigns.getInstance().getCabalHighestScore())
-				{
-					summonerChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
-					return false;
-				}
-			}
-			else
-			{
-				if (targetCabal == SevenSigns.CABAL_NULL)
-				{
-					summonerChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
-					return false;
-				}
-			}
-		}
-		
-		return true;
-	}
-	
 	public void checkItemRestriction()
 	{
 		for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)

+ 70 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCallPc.java

@@ -0,0 +1,70 @@
+/*
+ * 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.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.TvTEvent;
+import com.l2jserver.gameserver.model.stats.Env;
+import com.l2jserver.gameserver.model.zone.ZoneId;
+import com.l2jserver.gameserver.network.SystemMessageId;
+
+/**
+ * Player Call Pc condition implementation.
+ * @author Adry_85
+ */
+public class ConditionPlayerCallPc extends Condition
+{
+	private final boolean _val;
+	
+	public ConditionPlayerCallPc(boolean val)
+	{
+		_val = val;
+	}
+	
+	@Override
+	public boolean testImpl(Env env)
+	{
+		boolean canCallPlayer = true;
+		final L2PcInstance player = env.getPlayer();
+		if (player == null)
+		{
+			canCallPlayer = false;
+		}
+		else if (player.isInOlympiadMode())
+		{
+			player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
+			canCallPlayer = false;
+		}
+		else if (player.inObserverMode())
+		{
+			canCallPlayer = false;
+		}
+		else if (!TvTEvent.onEscapeUse(player.getObjectId()))
+		{
+			player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
+			canCallPlayer = false;
+		}
+		else if (player.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || player.isInsideZone(ZoneId.JAIL) || player.isFlyingMounted())
+		{
+			player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
+			canCallPlayer = false;
+		}
+		return (_val == canCallPlayer);
+	}
+}

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

@@ -77,7 +77,6 @@ public enum L2SkillType
 	FUSION,
 	
 	RESURRECT,
-	SUMMON_FRIEND,
 	BEAST_FEED,
 	BEAST_RELEASE,
 	BEAST_RELEASE_ALL,

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

@@ -100,7 +100,7 @@ public final class DlgAnswer extends L2GameClientPacket
 			final SummonRequestHolder holder = activeChar.getScript(SummonRequestHolder.class);
 			if ((_answer == 1) && (holder != null) && (holder.getTarget().getObjectId() == _requesterId))
 			{
-				L2PcInstance.teleToTarget(activeChar, holder.getTarget(), holder.getSkill());
+				activeChar.teleToLocation(holder.getTarget().getX(), holder.getTarget().getY(), holder.getTarget().getZ(), true);
 			}
 			activeChar.removeScript(SummonRequestHolder.class);
 		}

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/ConfirmDlg.java

@@ -88,15 +88,15 @@ public class ConfirmDlg extends L2GameServerPacket
 	
 	public ConfirmDlg addCharName(L2Character cha)
 	{
-		if (cha instanceof L2Npc)
+		if (cha.isNpc())
 		{
 			return addNpcName((L2Npc) cha);
 		}
-		if (cha instanceof L2PcInstance)
+		if (cha.isPlayer())
 		{
-			return addPcName((L2PcInstance) cha);
+			return addPcName(cha.getActingPlayer());
 		}
-		if (cha instanceof L2Summon)
+		if (cha.isSummon())
 		{
 			return addNpcName((L2Summon) cha);
 		}