Improvements for player notify death in instance.
This commit is contained in:
@ -883,12 +883,12 @@ public final class Instance implements IIdentifiable, INamable
|
||||
// Listeners
|
||||
// ---------------------------------------------
|
||||
/**
|
||||
* This method is called when player dead inside instance.
|
||||
* This method is called when player dies inside instance.
|
||||
* @param player
|
||||
*/
|
||||
public void onDeath(L2PcInstance player)
|
||||
{
|
||||
if (!player.isOnCustomEvent())
|
||||
if (!player.isOnCustomEvent() && (_template.getEjectTime() > 0))
|
||||
{
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTE_S_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
|
||||
|
@ -883,12 +883,12 @@ public final class Instance implements IIdentifiable, INamable
|
||||
// Listeners
|
||||
// ---------------------------------------------
|
||||
/**
|
||||
* This method is called when player dead inside instance.
|
||||
* This method is called when player dies inside instance.
|
||||
* @param player
|
||||
*/
|
||||
public void onDeath(L2PcInstance player)
|
||||
{
|
||||
if (!player.isOnCustomEvent())
|
||||
if (!player.isOnCustomEvent() && (_template.getEjectTime() > 0))
|
||||
{
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTE_S_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
|
||||
|
@ -883,12 +883,12 @@ public final class Instance implements IIdentifiable, INamable
|
||||
// Listeners
|
||||
// ---------------------------------------------
|
||||
/**
|
||||
* This method is called when player dead inside instance.
|
||||
* This method is called when player dies inside instance.
|
||||
* @param player
|
||||
*/
|
||||
public void onDeath(L2PcInstance player)
|
||||
{
|
||||
if (!player.isOnCustomEvent())
|
||||
if (!player.isOnCustomEvent() && (_template.getEjectTime() > 0))
|
||||
{
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTE_S_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
|
||||
|
@ -883,12 +883,12 @@ public final class Instance implements IIdentifiable, INamable
|
||||
// Listeners
|
||||
// ---------------------------------------------
|
||||
/**
|
||||
* This method is called when player dead inside instance.
|
||||
* This method is called when player dies inside instance.
|
||||
* @param player
|
||||
*/
|
||||
public void onDeath(L2PcInstance player)
|
||||
{
|
||||
if (!player.isOnCustomEvent())
|
||||
if (!player.isOnCustomEvent() && (_template.getEjectTime() > 0))
|
||||
{
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTE_S_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
|
||||
|
@ -169,12 +169,12 @@ public abstract class L2Playable extends L2Character
|
||||
}
|
||||
}
|
||||
// Notify instance
|
||||
if (getInstanceId() > 0)
|
||||
if ((getInstanceId() > 0) && isPlayer())
|
||||
{
|
||||
final Instance instance = InstanceManager.getInstance().getInstance(getInstanceId());
|
||||
if (instance != null)
|
||||
{
|
||||
instance.notifyDeath(killer, this);
|
||||
instance.notifyDeath(actingPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@ import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.TeleportWhereType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -872,10 +871,20 @@ public final class Instance
|
||||
}
|
||||
}
|
||||
|
||||
public void addEjectDeadTask(L2PcInstance player)
|
||||
/**
|
||||
* This method is called when player dies inside instance.
|
||||
* @param player
|
||||
*/
|
||||
public void notifyDeath(L2PcInstance player)
|
||||
{
|
||||
if (player != null)
|
||||
if (!player.isOnEvent() && (_ejectTime > 0))
|
||||
{
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTES_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
|
||||
sm.addInt(_ejectTime / 60 / 1000);
|
||||
player.sendPacket(sm);
|
||||
|
||||
// Start eject task
|
||||
_ejectDeadTasks.put(player.getObjectId(), ThreadPool.schedule(() ->
|
||||
{
|
||||
if (player.isDead() && (player.getInstanceId() == getId()))
|
||||
@ -894,19 +903,6 @@ public final class Instance
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param killer the character that killed the {@code victim}
|
||||
* @param victim the character that was killed by the {@code killer}
|
||||
*/
|
||||
public final void notifyDeath(L2Character killer, L2Character victim)
|
||||
{
|
||||
final InstanceWorld instance = InstanceManager.getInstance().getPlayerWorld(victim.getActingPlayer());
|
||||
if (instance != null)
|
||||
{
|
||||
instance.onDeath(killer, victim);
|
||||
}
|
||||
}
|
||||
|
||||
public class CheckTimeUp implements Runnable
|
||||
{
|
||||
private final int _remaining;
|
||||
|
@ -25,8 +25,6 @@ import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Basic instance zone data transfer object.
|
||||
@ -150,22 +148,6 @@ public class InstanceWorld
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param killer
|
||||
* @param victim
|
||||
*/
|
||||
public void onDeath(L2Character killer, L2Character victim)
|
||||
{
|
||||
if ((victim == null) || !victim.isPlayer() || (_instance == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTES_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
|
||||
sm.addInt(_instance.getEjectTime() / 60 / 1000);
|
||||
victim.getActingPlayer().sendPacket(sm);
|
||||
_instance.addEjectDeadTask(victim.getActingPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get spawned NPCs from instance.
|
||||
* @return set of NPCs from instance
|
||||
|
@ -883,12 +883,12 @@ public final class Instance implements IIdentifiable, INamable
|
||||
// Listeners
|
||||
// ---------------------------------------------
|
||||
/**
|
||||
* This method is called when player dead inside instance.
|
||||
* This method is called when player dies inside instance.
|
||||
* @param player
|
||||
*/
|
||||
public void onDeath(L2PcInstance player)
|
||||
{
|
||||
if (!player.isOnCustomEvent())
|
||||
if (!player.isOnCustomEvent() && (_template.getEjectTime() > 0))
|
||||
{
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTE_S_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
|
||||
|
@ -883,12 +883,12 @@ public final class Instance implements IIdentifiable, INamable
|
||||
// Listeners
|
||||
// ---------------------------------------------
|
||||
/**
|
||||
* This method is called when player dead inside instance.
|
||||
* This method is called when player dies inside instance.
|
||||
* @param player
|
||||
*/
|
||||
public void onDeath(L2PcInstance player)
|
||||
{
|
||||
if (!player.isOnCustomEvent())
|
||||
if (!player.isOnCustomEvent() && (_template.getEjectTime() > 0))
|
||||
{
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTE_S_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
|
||||
|
Reference in New Issue
Block a user