فهرست منبع

Fix from Gnacik:
updatePlayerSiegeStateFlags() must be called before clearSiegeClan().
Fix for summon AOE skills and summon's in duel.

JIV 15 سال پیش
والد
کامیت
ee4255f8db

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/L2Skill.java

@@ -2167,7 +2167,7 @@ public abstract class L2Skill implements IChanceSkillTrigger
     				if (player.getClanId() != 0 && player.getClanId() == targetPlayer.getClanId())
     					return false;
 
-    				if (!player.checkPvpSkill(targetPlayer, skill))
+    				if (!player.checkPvpSkill(targetPlayer, skill, (caster instanceof L2Summon)))
     					return false;
     			}
     		}

+ 4 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Summon.java

@@ -649,6 +649,9 @@ public abstract class L2Summon extends L2Playable
             return;
 		}
 
+        // Set current pet skill
+        getOwner().setCurrentPetSkill(skill, forceUse, dontMove);
+        
         //************************************* Check Target *******************************************
 
 		// Get the target for the skill
@@ -765,7 +768,6 @@ public abstract class L2Summon extends L2Playable
 				}
 			}
 		}
-        getOwner().setCurrentPetSkill(skill, forceUse, dontMove);
 		// Notify the AI with AI_INTENTION_CAST and target
 		getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, skill, target);
 	}
@@ -852,7 +854,7 @@ public abstract class L2Summon extends L2Playable
 	{
         final L2PcInstance actingPlayer = getActingPlayer();
 
-        if (!actingPlayer.checkPvpSkill(getTarget(), skill)
+        if (!actingPlayer.checkPvpSkill(getTarget(), skill, true)
         		&& !actingPlayer.getAccessLevel().allowPeaceAttack())
         {
             // Send a System Message to the L2PcInstance

+ 44 - 18
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -8571,15 +8571,18 @@ public final class L2PcInstance extends L2Playable
 		if (getKarma() > 0 || getPvpFlag() > 0)
 			return true;
 
-		// Check if the attacker is a L2PcInstance
-		if (attacker instanceof L2PcInstance)
+		// Check if the attacker is a L2Playable
+		if (attacker instanceof L2Playable)
 		{
+			// Get L2PcInstance
+			L2PcInstance cha = attacker.getActingPlayer();
+			
 			// is AutoAttackable if both players are in the same duel and the duel is still going on
 			if ( getDuelState() == Duel.DUELSTATE_DUELLING
-					&& getDuelId() == ((L2PcInstance)attacker).getDuelId() )
+					&& getDuelId() == cha.getDuelId())
 				return true;
 			// Check if the L2PcInstance is in an arena or a siege area
-			if (isInsideZone(ZONE_PVP) && ((L2PcInstance)attacker).isInsideZone(ZONE_PVP))
+			if (isInsideZone(ZONE_PVP) && cha.isInsideZone(ZONE_PVP))
 				return true;
 
 			if (getClan() != null)
@@ -8588,23 +8591,23 @@ public final class L2PcInstance extends L2Playable
 				if (siege != null)
 				{
 					// Check if a siege is in progress and if attacker and the L2PcInstance aren't in the Defender clan
-					if (siege.checkIsDefender(((L2PcInstance)attacker).getClan()) &&
+					if (siege.checkIsDefender(cha.getClan()) &&
 							siege.checkIsDefender(getClan()))
 						return false;
 
 					// Check if a siege is in progress and if attacker and the L2PcInstance aren't in the Attacker clan
-					if (siege.checkIsAttacker(((L2PcInstance)attacker).getClan()) &&
+					if (siege.checkIsAttacker(cha.getClan()) &&
 							siege.checkIsAttacker(getClan()))
 						return false;
 				}
 
 				// Check if clan is at war
-				if (getClan() != null && ((L2PcInstance)attacker).getClan() != null
-				                           && (getClan().isAtWarWith(((L2PcInstance)attacker).getClanId())
-				                           && ((L2PcInstance)attacker).getClan().isAtWarWith(getClanId())
+				if (getClan() != null && cha.getClan() != null
+				                           && getClan().isAtWarWith(cha.getClanId())
+				                           && cha.getClan().isAtWarWith(getClanId())
 				                           && getWantsPeace() == 0
-				                           && ((L2PcInstance)attacker).getWantsPeace() == 0
-				                           && !isAcademyMember()))
+				                           && cha.getWantsPeace() == 0
+				                           && !isAcademyMember())
 				return true;
 			}
 		}
@@ -8845,13 +8848,19 @@ public final class L2PcInstance extends L2Playable
 
         // Are the target and the player in the same duel?
         if (isInDuel())
-        {
-        	if (!(target instanceof L2PcInstance && ((L2PcInstance)target).getDuelId() == getDuelId()))
-        	{
-        		sendMessage("You cannot do this while duelling.");
-        		sendPacket(ActionFailed.STATIC_PACKET);
-        		return false;
-        	}
+        {        	
+        	// Get L2PcInstance
+    		if (target instanceof L2Playable)
+    		{
+    			// Get L2PcInstance
+    			L2PcInstance cha = target.getActingPlayer();
+    			if (cha.getDuelId() != getDuelId())
+    			{
+            		sendMessage("You cannot do this while duelling.");
+            		sendPacket(ActionFailed.STATIC_PACKET);
+            		return false;    				
+    			}
+    		}
         }
 
         //************************************* Check skill availability *******************************************
@@ -9355,6 +9364,8 @@ public final class L2PcInstance extends L2Playable
 	public boolean checkPvpSkill(L2Object target, L2Skill skill, boolean srcIsSummon)
 	{
 		// check for PC->PC Pvp status
+		if(target instanceof L2Summon)
+			target = target.getActingPlayer();
 		if (
 				target != null &&                                           			// target not null and
 				target != this &&                                           			// target is not self and
@@ -9770,6 +9781,21 @@ public final class L2PcInstance extends L2Playable
 			
 		}
 	}
+	
+	public boolean disableAutoShot(int itemId)
+	{
+		if (getAutoSoulShot().containsKey(itemId))
+		{
+			removeAutoSoulShot(itemId);
+			sendPacket(new ExAutoSoulShot(itemId, 0));
+			
+			SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
+			sm.addString(ItemTable.getInstance().getTemplate(itemId).getName());
+			sendPacket(sm);
+			return true;
+		}
+		else return false;
+	}
 
 	private ScheduledFuture<?> _taskWarnUserTakeBreak;
 

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/entity/FortSiege.java

@@ -268,6 +268,8 @@ public class FortSiege
 			removeFlags(); // Removes all flags. Note: Remove flag before teleporting players
 			unSpawnFlags();
 
+			updatePlayerSiegeStateFlags(true);
+
 			getFort().getZone().banishForeigners(getFort().getOwnerClan());
 			_isInProgress = false; // Flag so that siege instance can be started
 			getFort().getZone().setIsActive(false);
@@ -281,8 +283,6 @@ public class FortSiege
 			getSiegeGuardManager().unspawnSiegeGuard(); // Remove all spawned siege guard from this fort
 			getFort().resetDoors(); // Respawn door to fort
 
-			updatePlayerSiegeStateFlags(true);
-
 			ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleSuspiciousMerchantSpawn(getFort()), FortSiegeManager.getInstance().getSuspiciousMerchantRespawnDelay()*60*1000); // Prepare 3hr task for suspicious merchant respawn
 			if (_siegeEnd != null)
 				_siegeEnd.cancel(true);