RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
PlayerKilling.java
1package com.osroyale.game.world.entity.mob.player;
2
3import com.osroyale.content.EmblemData;
4import com.osroyale.content.clanchannel.content.ClanAchievement;
5import com.osroyale.content.pet.PetData;
6import com.osroyale.content.pet.Pets;
7import com.osroyale.content.writer.InterfaceWriter;
8import com.osroyale.content.writer.impl.InformationWriter;
9import com.osroyale.game.world.items.Item;
10import com.osroyale.util.Utility;
11import static com.osroyale.content.clanchannel.content.ClanTaskKey.PLAYER_KILLING;
12
36
37public class PlayerKilling {
38
39 public static void handle(Player killer, Player victim) {
40 if (killer.isBot) {
41 return;
42 }
43
44 if (killer.lastHost.equalsIgnoreCase(victim.lastHost)) {
45 killer.message("<col=FF0019>You were not rewarded since you killed someone with your same IP.");
46 return;
47 }
48
49 if (killer.clanChannel != null && victim.clanChannel != null && killer.clanChannel.getName().equalsIgnoreCase(victim.clanChannel.getName())) {
50 if (!killer.clanChannel.getName().equals("tarnish")) {
51 killer.message("<col=FF0019>You were not rewarded since you killed someone from your clan.");
52 return;
53 }
54 }
55
56 int reward = PlayerRight.getBloodMoney(killer);
57
58 killer.inventory.addOrDrop(new Item(13307, reward));
59 killer.message("<col=295EFF>You were rewarded with " + reward + " blood money for that kill.");
60 killer.killstreak.add();
61
62 for (Item item : killer.inventory) {
63 if (item == null)
64 continue;
65 EmblemData emblem = EmblemData.forId(item.getId());
66 if (emblem == null)
67 continue;
68 if (emblem.getNext() == -1)
69 continue;
70 killer.inventory.replace(item.getId(), emblem.getNext(), true);
71 break;
72 }
73
74 killer.forClan(channel -> {
75 channel.activateTask(PLAYER_KILLING, killer.getName());
76 channel.activateAchievement(ClanAchievement.PLAYER_KILLER_I);
77 channel.activateAchievement(ClanAchievement.PLAYER_KILLER_II);
78 channel.activateAchievement(ClanAchievement.PLAYER_KILLER_III);
79 });
80
81 Pets.onReward(killer, PetData.BABY_DARTH);
82 InterfaceWriter.write(new InformationWriter(killer));
83 add(killer, victim.lastHost);
84 }
85
86 public static void add(Player player, String host) {
87 if (host == null || host.isEmpty()) {
88 return;
89 }
90 if (player.lastKilled.contains(host)) {
91 return;
92 }
93 if (player.lastKilled.size() >= 2) {
94 player.lastKilled.removeFirst();
95 }
96 player.lastKilled.add(host);
97 }
98
99 public static boolean remove(Player player, String host) {
100 return player.lastKilled.remove(host);
101 }
102
103 public static boolean contains(Player player, String host) {
104 return player.lastKilled != null && player.lastKilled.contains(host);
105 }
106}
static void onReward(Player player, int item, int chance)
Definition Pets.java:70
final boolean replace(int oldId, int newId, int index, boolean refresh)