1package com.runehive.game.world.entity.mob.player;
3import com.runehive.Config;
4import com.runehive.content.achievement.AchievementHandler;
5import com.runehive.content.achievement.AchievementKey;
6import com.runehive.content.activity.Activity;
7import com.runehive.content.activity.ActivityDeathType;
8import com.runehive.content.bot.BotUtility;
9import com.runehive.content.bot.PlayerBot;
10import com.runehive.content.event.EventDispatcher;
11import com.runehive.content.event.impl.OnKillEvent;
12import com.runehive.content.itemaction.impl.CrawsBow;
13import com.runehive.content.itemaction.impl.ThammaronsSceptre;
14import com.runehive.content.itemaction.impl.ViggorasChainmace;
15import com.runehive.content.lms.LMSGame;
16import com.runehive.content.pet.Pets;
17import com.runehive.content.writer.InterfaceWriter;
18import com.runehive.content.writer.impl.InformationWriter;
19import com.runehive.game.Animation;
20import com.runehive.game.Graphic;
21import com.runehive.game.UpdatePriority;
22import com.runehive.game.world.World;
23import com.runehive.game.world.entity.combat.weapon.WeaponInterface;
24import com.runehive.game.world.entity.mob.Direction;
25import com.runehive.game.world.entity.mob.Mob;
26import com.runehive.game.world.entity.mob.MobDeath;
27import com.runehive.game.world.entity.mob.UpdateFlag;
28import com.runehive.game.world.entity.mob.prayer.Prayer;
29import com.runehive.game.world.items.Item;
30import com.runehive.game.world.items.ground.GroundItem;
31import com.runehive.game.world.position.Area;
32import com.runehive.game.world.position.Position;
33import com.runehive.net.packet.out.SendCameraReset;
34import com.runehive.net.packet.out.SendMessage;
35import com.runehive.util.Utility;
36import plugin.click.item.ImbuedHeartPlugin;
37import plugin.itemon.item.LootingBagPlugin;
39import java.util.Arrays;
40import java.util.LinkedList;
49 private boolean safe =
false;
53 "You have defeated $VICTIM.",
54 "With a crushing blow, you defeat $VICTIM.",
55 "It's a humiliating defeat for $VICTIM.",
56 "$VICTIM didn't stand a chance against you.",
57 "You have defeated $VICTIM.",
58 "It's all over for $VICTIM.",
59 "$VICTIM regrets the day they met you in combat.",
60 "$VICTIM falls before your might.",
61 "Can anyone defeat you? Certainly not $VICTIM.",
62 "You were clearly a better fighter than $VICTIM."
80 Mob killer =
mob.getCombat().getDamageCache().calculateProperKiller().orElse(
null);
82 if (
mob.inActivity()) {
97 mob.message(
"You have lost your items. Speak to Lord Marshal Brogan at home to claim them!");
101 if(
mob.playTime < 6000) {
102 System.out.println(
"Safe death");
104 mob.message(
"Your death is safe because you have less than 1 hour of playtime.");
128 if (killer ==
null || !killer.
isPlayer())
134 playerKiller.
message(
"<col=295EFF>You were rewarded with 100 blood money for that bot kill.");
147 playerKiller.
message(
"<col=FF0019>You have recently killed " +
mob.getName() +
" and were not rewarded. You must kill 2 other players to reset this!");
161 mob.playerAssistant.restore();
168 if (
mob.inActivity()) {
173 ImbuedHeartPlugin.resetCooldown(
mob);
175 mob.hasPvPTimer =
false;
180 mob.equipment.updateAnimation();
181 mob.equipment.refresh();
189 if (killer !=
null && killer.
isPlayer() && !
mob.equals(killer)) {
195 mob.send(
new SendMessage(
"You have lost your hardcore iron man status since you died!"));
196 World.
sendMessage(
"<icon=1> <col=FF0000>osroyale: <col=" +
mob.right.getColor() +
">" +
mob.getName() +
"</col>'s hardcore iron man account was lost!");
200 if (
mob.presetManager.deathOpen) {
204 if (!
mob.lostItems.isEmpty()) {
205 mob.dialogueFactory.sendStatement(
"There are lost items waiting for you!",
"Speak to Lord Marshal Brogan at home to claim them!").execute();
214 List<Item>
items =
new LinkedList<>();
221 items.forEach(item -> {
222 if (!item.isTradeable()) {
233 LinkedList<Item> toDrop =
new LinkedList<>();
234 List<Item> keep =
new LinkedList<>();
235 List<Item>
items =
new LinkedList<>();
239 if (!LootingBagPlugin.isLootingBag(item)) {
246 if (lootingBag !=
null) {
247 items.addAll(Arrays.asList(lootingBag));
251 toDrop.addAll(
items);
253 toDrop.sort((first, second) -> second.getValue() - first.getValue());
256 keep.add(toDrop.pollFirst());
257 keep.add(toDrop.pollFirst());
258 keep.add(toDrop.pollFirst());
262 keep.add(toDrop.pollFirst());
265 keep.forEach(item -> {
271 if (item.isStackable() && item.getAmount() > 1) {
272 toDrop.add(item.createAndDecrement(1));
276 if (theKiller.
isBot) {
277 toDrop.forEach(item -> {
284 if (!item.isTradeable()) {
291 if (theKiller.
isBot && item.getValue() >= 50_000) {
300 drop.canIronMenPickThisItemUp =
false;
305 toDrop.forEach(item -> {
317 if (!item.isTradeable()) {
324 if (theKiller.
isBot && item.getValue() >= 50_000) {
328 switch(item.getId()) {
333 drop.canIronMenPickThisItemUp =
false;
335 character.crawsBowCharges = 0;
341 drop.canIronMenPickThisItemUp =
false;
343 character.viggorasChainmaceCharges = 0;
349 drop.canIronMenPickThisItemUp =
false;
351 character.thammoranSceptreCharges = 0;
357 drop.canIronMenPickThisItemUp =
false;
363 drop.canIronMenPickThisItemUp =
false;
The class that contains setting-related constants for the server.
static final Position DEFAULT_POSITION
The default, i.e.
Handles the achievements.
static void activate(Player player, AchievementKey achievement)
Activates the achievement for the individual player.
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
static void forActivity(Mob mob, Consumer< Activity > consumer)
Holds all the constants used by bot.
static void logLoot(Item item)
static boolean execute(Player player, InteractionEvent event)
static final short CRAWS_CHARGED_ID
static final short ETHER_ID
static final short CRAWS_UNCHARGED_ID
static final short THAMMARONS_SCEPTRE_CHARGED_ID
static final short VIGGORAS_CHAINMACE_UNCHARGED_ID
static final short VIGGORAS_CHAINMACE_CHARGED_ID
static boolean isActivePlayer(Player player)
Checks if a player is a active player within the LMS game.
static boolean inGameArea(Player player)
Handles checking if the player is in the LMS game area.
static void onDeath(Player player, boolean forceRemove)
Handles when a player within the LMS game dies.
static void onKill(Player killer)
Handles the killers stuff.
Handles spawning, rewarding and picking up of pets.
static void onDeath(Player player)
Handles what happens to a pet when a player dies.
boolean death(Item item)
Handles player dying with a rune pouch.
Handles writing on an itemcontainer.
static void write(InterfaceWriter writer)
Class handles writing on the quest tab itemcontainer.
Class that models a single animation used by an entity.
static final Animation RESET
Represents a single graphic that can be used by entities.
static final Graphic RESET
Represents the game world.
static void schedule(Task task)
Submits a new event.
static void sendMessage(String... messages)
Sends a global message.
MobDeath(T mob, int delay)
Creates a new MobDeath.
final boolean isNpc()
Check if an entity is an npc.
final boolean isPlayer()
Check if an entity is a player.
void calculateDropItems(Player character, Mob killer, boolean purchase)
Calculates and drops all of the items from character for killer.
void postDeath(Mob killer)
The last part of the death process where the character is reset.
static final String[] DEATH_MESSAGES
Array of all death messages.
void preDeath(Mob killer)
The part of the death process where the character is prepared for the rest of the death tick.
PlayerDeath(Player mob)
Creates a new MobDeath.
void death()
The main part of the death process where the killer is found for the character.
This class represents a character controlled by a player.
final Inventory inventory
final LostUntradeables lostUntradeables
void message(String message)
final Equipment equipment
int viggorasChainmaceCharges
boolean equals(Object obj)
int thammoranSceptreCharges
void send(OutgoingPacket encoder)
final RunePouch runePouch
final LootingBag lootingBag
final RunecraftPouch runecraftPouch
LinkedList< Item > lostItems
static boolean contains(Player player, String host)
static void handle(Player killer, Player victim)
boolean isActive(Prayer... prayers)
Checks if all given prayers are active.
The container class that represents an item that can be interacted with.
final void forEach(Consumer<? super Item > action)
Iterates through all of the Items within this container and performs action on them,...
boolean add(Item item)
Attempts to deposit item into this container.
void clear()
Removes all of the items from this container.
void clear()
Removes all of the items from this container.
boolean deposit(Item item)
void addOrDrop(List< Item > items)
Attempts to deposit an item to the players inventory, if there is no space it'll bank the item instea...
Represents a single Ground item on the world map.
static GroundItem create(Player player, Item item)
Creates a new GroundItem object for a player and an item.
Handles checking if mobs are in a certain area.
static boolean inZulrah(Interactable entity)
Represents a single tile on the game world.
The OutgoingPacket resets the camera position for Player.
The OutgoingPacket that sends a message to a Players chatbox in the client.
Handles miscellaneous methods.
static< T > T randomElement(Collection< T > collection)
Picks a random element out of any array type.
Created by Daniel on 2018-01-28.
Represents different priorities for updating.
VERY_HIGH
A very high priority.
The enumerated type whose elements represent the weapon interfaces.
static void execute(Player player, Item item)
The method executed when weapon item is equipped or unequipped that assigns a weapon interface to pla...
Represents the enumerated directions an entity can walk or face.
Holds all the player right data.
static boolean isIronman(Player player)
Checks if the player is an ironman.
static boolean isAdministrator(Player player)
Checks if the player is a privileged member.