public DeathEvent(Entity entity) : base(entity is Player ? 6000 : (((Npc)entity).getDeathTime())) { this.entity = entity; this.firstNpcStage = false; this.entity.setEntityFocus(65535); this.entity.setLastAnimation(new Animation(entity.getDeathAnimation(), 50)); this.lastAttacker = entity.getAttacker() == null ? null : entity.getAttacker(); entity.setPoisonAmount(0); if (entity.getFollow() != null) { entity.getFollow().setFollowing(null); } if (entity.getTarget() != null) { if (entity.getTarget().getAttacker() == null || entity.getTarget().getAttacker().Equals(entity)) Combat.resetCombat(entity.getTarget(), 1); } if (entity.getAttacker() != null) { if (entity.getAttacker().getTarget() == null || entity.getAttacker().getTarget().Equals(entity)) Combat.resetCombat(entity.getAttacker(), 1); } entity.setTarget(null); entity.setAttacker(null); if (entity.getKiller() != null) { if (entity is Npc) { if (((Npc)this.entity).getId() >= 2025 && ((Npc)this.entity).getId() <= 2030) { Barrows.killBrother((Player)entity.getKiller(), ((Npc)this.entity).getId()); } if (entity.getKiller() is Player) { Slayer.checkSlayerKill((Player)entity.getKiller(), (Npc)entity); } } } if (entity is Player) { if (((Player)entity).getPrayers().getHeadIcon() == PrayerData.RETRIBUTION) { doRedemption((Player)entity); } ((Player)entity).setDistanceEvent(null); ((Player)entity).getWalkingQueue().resetWalkingQueue(); ((Player)entity).getPackets().clearMapFlag(); ((Player)entity).removeTemporaryAttribute("autoCasting"); if (((Player)entity).getDuel() == null) { if (!Location.inFightPits(entity.getLocation()) && !Location.inFightCave(entity.getLocation())) { ((Player)entity).getPackets().sendMessage("Oh dear, you are dead!"); } else { ((Player)entity).getPackets().sendMessage("You have been defeated!"); } } ((Player)entity).setTemporaryAttribute("unmovable", true); if (((Player)entity).getDuel() != null) { ((Player)entity).getDuel().getPlayer2().setTemporaryAttribute("unmovable", true); } SkillHandler.resetAllSkills((Player)entity); if ((entity.getKiller() is Player)) { Player killer = (Player)entity.getKiller(); if (killer.getDuel() == null) { int id = Misc.random(DEATH_MESSAGES.Length - 1); string deathMessage = DEATH_MESSAGES[id]; if (id <= 4) { killer.getPackets().sendMessage(deathMessage + " " + ((Player)entity).getLoginDetails().getUsername() + "."); } else { killer.getPackets().sendMessage(((Player)entity).getLoginDetails().getUsername() + " " + deathMessage + "."); } } else { killer.setPoisonAmount(0); } } } }