Explorar o código

BETA: Transformation fixes.
* Fixing transform admin command not removing current transformation.
* Fixing `DispelBySlot` and `DispelBySlotProbability` effects not removing GM transformations.

Reported by: pandragon

Zoey76 %!s(int64=11) %!d(string=hai) anos
pai
achega
ce3a66667f

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/SummonMinions.java

@@ -84,11 +84,11 @@ public class SummonMinions extends AbstractNpcAI
 		// Pythia
 		MINIONS.put(22266, Arrays.asList(18366, 18366));
 		// Invader Soldier of Nightmare
-		MINIONS.put(22715, Arrays.asList(22716,22716,22716,22716,22716,22716,22716,22716,22716));
+		MINIONS.put(22715, Arrays.asList(22716, 22716, 22716, 22716, 22716, 22716, 22716, 22716, 22716));
 		// Nihil Invader Soldier
-		MINIONS.put(22726, Arrays.asList(22727,22727,22727,22727,22727,22727,22727,22727,22727));
+		MINIONS.put(22726, Arrays.asList(22727, 22727, 22727, 22727, 22727, 22727, 22727, 22727, 22727));
 		// Mutant Soldier
-		MINIONS.put(22737, Arrays.asList(22738,22738,22738,22738,22738,22738,22738,22738,22738)); 
+		MINIONS.put(22737, Arrays.asList(22738, 22738, 22738, 22738, 22738, 22738, 22738, 22738, 22738));
 		// Tanta Lizardman Summoner
 		MINIONS.put(22774, Arrays.asList(22768, 22768));
 	}

+ 10 - 11
L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminPolymorph.java

@@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
 import com.l2jserver.gameserver.util.Util;
 
 /**
- * This class handles following admin commands: polymorph
- * @version $Revision: 1.2.2.1.2.4 $ $Date: 2007/07/31 10:05:56 $
+ * Polymorph admin command implementation.
  */
 public class AdminPolymorph implements IAdminCommandHandler
 {
@@ -76,19 +75,24 @@ public class AdminPolymorph implements IAdminCommandHandler
 					return false;
 				}
 				
-				else if (cha.isTransformed() || cha.isInStance())
+				if (cha.isTransformed() || cha.isInStance())
 				{
+					if (!command.contains(" "))
+					{
+						cha.untransform();
+						return true;
+					}
 					activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
 					return false;
 				}
 				
-				else if (cha.isInWater())
+				if (cha.isInWater())
 				{
 					activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
 					return false;
 				}
 				
-				else if (cha.isFlyingMounted() || cha.isMounted())
+				if (cha.isFlyingMounted() || cha.isMounted())
 				{
 					activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_WHILE_RIDING_A_PET);
 					return false;
@@ -110,10 +114,6 @@ public class AdminPolymorph implements IAdminCommandHandler
 						activeChar.sendMessage("Usage: //transform <id>");
 					}
 				}
-				else if (parts.length == 1)
-				{
-					cha.untransform();
-				}
 				else
 				{
 					activeChar.sendMessage("Usage: //transform <id>");
@@ -134,8 +134,7 @@ public class AdminPolymorph implements IAdminCommandHandler
 				String p1 = st.nextToken();
 				if (st.hasMoreTokens())
 				{
-					String p2 = st.nextToken();
-					doPolymorph(activeChar, target, p2, p1);
+					doPolymorph(activeChar, target, st.nextToken(), p1);
 				}
 				else
 				{

+ 7 - 8
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/DispelBySlot.java

@@ -51,8 +51,7 @@ public final class DispelBySlot extends AbstractEffect
 			for (String ngtStack : _dispel.split(";"))
 			{
 				String[] ngt = ngtStack.split(",");
-				final AbnormalType type = AbnormalType.getAbnormalType(ngt[0]);
-				_dispelAbnormals.put(type, Short.parseShort(ngt[1]));
+				_dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.parseShort(ngt[1]));
 			}
 		}
 		else
@@ -88,12 +87,6 @@ public final class DispelBySlot extends AbstractEffect
 		// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
 		for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
 		{
-			final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
-			if (toDispel == null)
-			{
-				continue;
-			}
-			
 			// Dispel transformations (buff and by GM)
 			if ((entry.getKey() == AbnormalType.TRANSFORM))
 			{
@@ -104,6 +97,12 @@ public final class DispelBySlot extends AbstractEffect
 				}
 			}
 			
+			final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
+			if (toDispel == null)
+			{
+				continue;
+			}
+			
 			if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
 			{
 				effectList.stopSkillEffects(true, entry.getKey());

+ 7 - 8
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/DispelBySlotProbability.java

@@ -54,8 +54,7 @@ public final class DispelBySlotProbability extends AbstractEffect
 			for (String ngtStack : _dispel.split(";"))
 			{
 				String[] ngt = ngtStack.split(",");
-				final AbnormalType type = AbnormalType.getAbnormalType(ngt[0]);
-				_dispelAbnormals.put(type, Short.MAX_VALUE);
+				_dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.MAX_VALUE);
 			}
 		}
 		else
@@ -91,12 +90,6 @@ public final class DispelBySlotProbability extends AbstractEffect
 		// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
 		for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
 		{
-			final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
-			if (toDispel == null)
-			{
-				continue;
-			}
-			
 			if ((Rnd.get(100) < _rate))
 			{
 				// Dispel transformations (buff and by GM)
@@ -108,6 +101,12 @@ public final class DispelBySlotProbability extends AbstractEffect
 					}
 				}
 				
+				final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
+				if (toDispel == null)
+				{
+					continue;
+				}
+				
 				if ((toDispel.getSkill().getAbnormalType() == entry.getKey()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
 				{
 					effectList.stopSkillEffects(true, entry.getKey());

+ 6 - 5
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Passive.java

@@ -42,14 +42,15 @@ public final class Passive extends AbstractEffect
 		info.getEffected().setIsImmobilized(false);
 	}
 	
+	@Override
+	public boolean canStart(BuffInfo info)
+	{
+		return info.getEffected().isL2Attackable();
+	}
+	
 	@Override
 	public void onStart(BuffInfo info)
 	{
-		if (!info.getEffected().isL2Attackable())
-		{
-			return;
-		}
-		
 		L2Attackable target = (L2Attackable) info.getEffected();
 		target.abortAttack();
 		target.abortCast();