diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 87b1431ad3..f4741cd352 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -51,70 +51,72 @@ public class PlayerInstanceAction implements IActionHandler
*
*
Client packet : Action, AttackRequest
*
- * @param activeChar The player that start an action on target PlayerInstance
+ * @param player The player that start an action on target PlayerInstance
*/
@Override
- public boolean action(PlayerInstance activeChar, WorldObject target, boolean interact)
+ public boolean action(PlayerInstance player, WorldObject target, boolean interact)
{
// See description in TvTEvent.java
- if (!TvTEvent.onAction(activeChar, target.getObjectId()))
+ if (!TvTEvent.onAction(player, target.getObjectId()))
{
return false;
}
// Check if the PlayerInstance is confused
- if (activeChar.isOutOfControl())
+ if (player.isOutOfControl())
{
return false;
}
// Aggression target lock effect
- if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target))
+ if (player.isLockedTarget() && (player.getLockedTarget() != target))
{
- activeChar.sendPacket(SystemMessageId.FAILED_TO_CHANGE_ATTACK_TARGET);
+ player.sendPacket(SystemMessageId.FAILED_TO_CHANGE_ATTACK_TARGET);
return false;
}
- // Check if the activeChar already target this PlayerInstance
- if (activeChar.getTarget() != target)
+ // Check if the player already target this PlayerInstance
+ if (player.getTarget() != target)
{
- // Set the target of the activeChar
- activeChar.setTarget(target);
+ // Set the target of the player
+ player.setTarget(target);
}
else if (interact)
{
- final PlayerInstance player = target.getActingPlayer();
// Check if this PlayerInstance has a Private Store
- if (player.getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
- activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, player);
+ player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
else
{
// Check if this PlayerInstance is autoAttackable
- if (player.isAutoAttackable(activeChar))
+ if (target.isAutoAttackable(player))
{
- if ((player.isCursedWeaponEquipped() && (activeChar.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
- || (activeChar.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
+ // Player with lvl < 21 can't attack a cursed weapon holder
+ // And a cursed weapon holder can't attack players with lvl < 21
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+ player.sendPacket(ActionFailed.STATIC_PACKET);
}
else
{
- if (GeoEngine.getInstance().canSeeTarget(activeChar, player))
+ if (GeoEngine.getInstance().canSeeTarget(player, target))
{
- activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
- activeChar.onActionRequest();
+ player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
+ player.onActionRequest();
}
}
}
else
{
- // This Action Failed packet avoids activeChar getting stuck when clicking three or more times
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- if (GeoEngine.getInstance().canSeeTarget(activeChar, player))
+ // This Action Failed packet avoids player getting stuck when clicking three or more times
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ if (GeoEngine.getInstance().canSeeTarget(player, target))
{
- activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
+ player.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
}
}
}
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 87b1431ad3..f4741cd352 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -51,70 +51,72 @@ public class PlayerInstanceAction implements IActionHandler
*
* Client packet : Action, AttackRequest
*
- * @param activeChar The player that start an action on target PlayerInstance
+ * @param player The player that start an action on target PlayerInstance
*/
@Override
- public boolean action(PlayerInstance activeChar, WorldObject target, boolean interact)
+ public boolean action(PlayerInstance player, WorldObject target, boolean interact)
{
// See description in TvTEvent.java
- if (!TvTEvent.onAction(activeChar, target.getObjectId()))
+ if (!TvTEvent.onAction(player, target.getObjectId()))
{
return false;
}
// Check if the PlayerInstance is confused
- if (activeChar.isOutOfControl())
+ if (player.isOutOfControl())
{
return false;
}
// Aggression target lock effect
- if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target))
+ if (player.isLockedTarget() && (player.getLockedTarget() != target))
{
- activeChar.sendPacket(SystemMessageId.FAILED_TO_CHANGE_ATTACK_TARGET);
+ player.sendPacket(SystemMessageId.FAILED_TO_CHANGE_ATTACK_TARGET);
return false;
}
- // Check if the activeChar already target this PlayerInstance
- if (activeChar.getTarget() != target)
+ // Check if the player already target this PlayerInstance
+ if (player.getTarget() != target)
{
- // Set the target of the activeChar
- activeChar.setTarget(target);
+ // Set the target of the player
+ player.setTarget(target);
}
else if (interact)
{
- final PlayerInstance player = target.getActingPlayer();
// Check if this PlayerInstance has a Private Store
- if (player.getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
- activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, player);
+ player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
else
{
// Check if this PlayerInstance is autoAttackable
- if (player.isAutoAttackable(activeChar))
+ if (target.isAutoAttackable(player))
{
- if ((player.isCursedWeaponEquipped() && (activeChar.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
- || (activeChar.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
+ // Player with lvl < 21 can't attack a cursed weapon holder
+ // And a cursed weapon holder can't attack players with lvl < 21
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+ player.sendPacket(ActionFailed.STATIC_PACKET);
}
else
{
- if (GeoEngine.getInstance().canSeeTarget(activeChar, player))
+ if (GeoEngine.getInstance().canSeeTarget(player, target))
{
- activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
- activeChar.onActionRequest();
+ player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
+ player.onActionRequest();
}
}
}
else
{
- // This Action Failed packet avoids activeChar getting stuck when clicking three or more times
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- if (GeoEngine.getInstance().canSeeTarget(activeChar, player))
+ // This Action Failed packet avoids player getting stuck when clicking three or more times
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ if (GeoEngine.getInstance().canSeeTarget(player, target))
{
- activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
+ player.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
}
}
}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
index 694975e991..b5f20b4660 100644
--- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
+++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/actionhandlers/PlayerInstanceAction.java
@@ -22,13 +22,14 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.IActionHandler;
import org.l2jmobius.gameserver.model.WorldObject;
-import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
public class PlayerInstanceAction implements IActionHandler
{
+ private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21;
+
/**
* Manage actions when a player click on this PlayerInstance.
*
@@ -76,7 +77,8 @@ public class PlayerInstanceAction implements IActionHandler
else if (interact)
{
// Check if this PlayerInstance has a Private Store
- if (((PlayerInstance) target).getPrivateStoreType() != PrivateStoreType.NONE)
+ final PlayerInstance targetPlayer = target.getActingPlayer();
+ if (targetPlayer.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
@@ -85,9 +87,10 @@ public class PlayerInstanceAction implements IActionHandler
// Check if this PlayerInstance is autoAttackable
if (target.isAutoAttackable(player))
{
- // player with lvl < 21 can't attack a cursed weapon holder
+ // Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
- if ((((PlayerInstance) target).isCursedWeaponEquipped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquipped() && (((Creature) target).getLevel() < 21)))
+ if ((targetPlayer.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) //
+ || (player.isCursedWeaponEquipped() && (targetPlayer.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}