|
@@ -33,8 +33,8 @@ import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
|
|
|
public final class Action extends L2GameClientPacket
|
|
|
{
|
|
|
private static final String ACTION__C__04 = "[C] 04 Action";
|
|
|
- private static Logger _log = Logger.getLogger(Action.class.getName());
|
|
|
-
|
|
|
+ private static final Logger _log = Logger.getLogger(Action.class.getName());
|
|
|
+
|
|
|
// cddddc
|
|
|
private int _objectId;
|
|
|
@SuppressWarnings("unused")
|
|
@@ -44,7 +44,11 @@ public final class Action extends L2GameClientPacket
|
|
|
@SuppressWarnings("unused")
|
|
|
private int _originZ;
|
|
|
private int _actionId;
|
|
|
-
|
|
|
+
|
|
|
+ // player can select object as a target but can't interact,
|
|
|
+ // or spawn protection will be removed
|
|
|
+ private boolean _removeSpawnProtection = false;
|
|
|
+
|
|
|
@Override
|
|
|
protected void readImpl()
|
|
|
{
|
|
@@ -54,7 +58,7 @@ public final class Action extends L2GameClientPacket
|
|
|
_originZ = readD();
|
|
|
_actionId = readC(); // Action identifier : 0-Simple click, 1-Shift click
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
protected void runImpl()
|
|
|
{
|
|
@@ -62,13 +66,13 @@ public final class Action extends L2GameClientPacket
|
|
|
_log.fine("Action:" + _actionId);
|
|
|
if (Config.DEBUG)
|
|
|
_log.fine("oid:" + _objectId);
|
|
|
-
|
|
|
+
|
|
|
// Get the current L2PcInstance of the player
|
|
|
- L2PcInstance activeChar = getClient().getActiveChar();
|
|
|
-
|
|
|
+ final L2PcInstance activeChar = getClient().getActiveChar();
|
|
|
+
|
|
|
if (activeChar == null)
|
|
|
return;
|
|
|
-
|
|
|
+
|
|
|
if (activeChar.inObserverMode())
|
|
|
{
|
|
|
SystemMessage sm = new SystemMessage(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE);
|
|
@@ -76,14 +80,17 @@ public final class Action extends L2GameClientPacket
|
|
|
getClient().sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- L2Object obj;
|
|
|
-
|
|
|
+
|
|
|
+ final L2Object obj;
|
|
|
+
|
|
|
if (activeChar.getTargetId() == _objectId)
|
|
|
+ {
|
|
|
obj = activeChar.getTarget();
|
|
|
+ _removeSpawnProtection = true;
|
|
|
+ }
|
|
|
else
|
|
|
obj = L2World.getInstance().findObject(_objectId);
|
|
|
-
|
|
|
+
|
|
|
// If object requested does not exist, add warn msg into logs
|
|
|
if (obj == null)
|
|
|
{
|
|
@@ -92,7 +99,7 @@ public final class Action extends L2GameClientPacket
|
|
|
getClient().sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Check if the target is valid, if the player haven't a shop or isn't the requester of a transaction (ex : FriendInvite, JoinAlly, JoinParty...)
|
|
|
if (activeChar.getActiveRequester() == null)
|
|
|
{
|
|
@@ -118,7 +125,13 @@ public final class Action extends L2GameClientPacket
|
|
|
// Actions prohibited when in trade
|
|
|
getClient().sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected boolean triggersOnActionRequest()
|
|
|
+ {
|
|
|
+ return _removeSpawnProtection;
|
|
|
+ }
|
|
|
+
|
|
|
/* (non-Javadoc)
|
|
|
* @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
|
|
|
*/
|