public virtual void OnDeath(EntityDeathEventArgs e) { }
public void HandleDeath(EntityBase killedBy = null) { var killedByPlayer = killedBy as Player; //Event EntityDeathEventArgs e = new EntityDeathEventArgs(this, killedByPlayer); Server.PluginManager.CallEvent(Plugins.Events.Event.ENTITY_DEATH, e); if (e.EventCanceled) return; killedByPlayer = e.KilledBy; //End Event // TODO: Stats/achievements handled in each mob class??? (within DoDeath) //if (hitBy != null) //{ // // TODO: Stats/Achievement hook or something //} World.Server.SendPacketToNearbyPlayers(World, new AbsWorldCoords(Position.X, Position.Y, Position.Z), new EntityStatusPacket // Death Action { EntityId = EntityId, EntityStatus = 3 }); // Spawn goodies / perform achievements etc.. DoDeath(killedBy); System.Timers.Timer removeTimer = new System.Timers.Timer(1000); removeTimer.Elapsed += delegate { removeTimer.Stop(); World.Server.RemoveEntity(this); removeTimer.Dispose(); }; removeTimer.Start(); }
public void HandleDeath(Client hitBy = null) { //Event EntityDeathEventArgs e = new EntityDeathEventArgs(this, hitBy); Server.PluginManager.CallEvent(Plugins.Events.Event.ENTITY_DEATH, e); if (e.EventCanceled) return; hitBy = e.KilledBy; //End Event if (hitBy != null) { // TODO: Stats/Achievement hook or something } foreach (Client c in World.Server.GetNearbyPlayers(World, Position.X, Position.Y, Position.Z)) { c.PacketHandler.SendPacket(new EntityStatusPacket // Death Action { EntityId = this.EntityId, EntityStatus = 3 }); } // TODO: Spawn goodies System.Timers.Timer removeTimer = new System.Timers.Timer(1000); removeTimer.Elapsed += delegate { removeTimer.Stop(); World.Server.RemoveEntity(this); removeTimer.Dispose(); }; removeTimer.Start(); }
public virtual void HandleDeath(EntityBase killedBy = null, string deathBy = "") { //Event EntityDeathEventArgs e = new EntityDeathEventArgs(this, killedBy); Server.PluginManager.CallEvent(Event.EntityDeath, e); if (e.EventCanceled) return; killedBy = e.KilledBy; //End Event // TODO: Stats/achievements handled in each mob class??? (within DoDeath) //if (hitBy != null) //{ // // TODO: Stats/Achievement hook or something //} SendUpdateOnDeath(); // Spawn goodies / perform achievements etc.. DoDeath(killedBy); }
private void OnDeath(EntityDeathEventArgs e) { foreach (EventListener el in Plugins) { if (el.Event == Event.ENTITY_DEATH) { EntityListener l = el.Listener as EntityListener; l.OnDeath(e); } } }