Sync with L2jServer HighFive May 19th 2015.

This commit is contained in:
MobiusDev
2015-05-19 14:57:13 +00:00
parent 0337dd64a2
commit 6b9ed81821
17 changed files with 146 additions and 124 deletions

View File

@ -19,18 +19,18 @@
package handlers.actionhandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.handler.IActionHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.L2Event;
import com.l2jserver.gameserver.model.events.EventDispatcher;
import com.l2jserver.gameserver.model.events.EventType;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcFirstTalk;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.MoveToPawn;
import com.l2jserver.util.Rnd;
@ -79,23 +79,27 @@ public class L2NpcAction implements IActionHandler
else if (interact)
{
// Check if the activeChar is attackable (without a forced attack) and isn't dead
if (target.isAutoAttackable(activeChar) && !((L2Character) target).isAlikeDead())
if (target.isAutoAttackable(activeChar) && !((L2Npc) target).isAlikeDead())
{
// Check the height difference
if (Math.abs(activeChar.getZ() - target.getZ()) < 400) // this max heigth difference might need some tweaking
if (GeoData.getInstance().canSeeTarget(activeChar, target))
{
// Set the L2PcInstance Intention to AI_INTENTION_ATTACK
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
// activeChar.startAttack(this);
}
else
{
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
final Location destination = GeoData.getInstance().moveCheck(activeChar, target);
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
}
}
else if (!target.isAutoAttackable(activeChar))
{
if (GeoData.getInstance().canSeeTarget(activeChar, target))
{
final Location destination = GeoData.getInstance().moveCheck(activeChar, target);
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
return true;
}
// Calculate the distance between the L2PcInstance and the L2Npc
if (!((L2Npc) target).canInteract(activeChar))
{