RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Skulling.java
1package com.osroyale.content.combat;
2
3import com.osroyale.Config;
4import com.osroyale.content.lms.LMSGame;
5import com.osroyale.game.task.impl.SkullRemoveTask;
6import com.osroyale.game.world.World;
7import com.osroyale.game.world.entity.mob.UpdateFlag;
8import com.osroyale.game.world.entity.mob.player.Player;
9
10import java.util.LinkedList;
11import java.util.List;
12
54
55public class Skulling {
56
58 private final List<String> attacked = new LinkedList<>();
59
61 private Player player;
62
64 private SkullHeadIconType icon = SkullHeadIconType.NO_SKULL;
65
66 private SkullRemoveTask skullRemoveTask;
67
73 public Skulling(Player player) {
74 this.player = player;
75 this.skullRemoveTask = new SkullRemoveTask(player);
76 }
77
83 public void checkForSkulling(Player opponent) {
84 /* if (Area.inEventArena(opponent)) {
85 return;
86 }*/
87 if (!attacked.contains(opponent.getName()) && !opponent.skulling.attacked.contains(player.getName())) {
88 skull(opponent, SkullHeadIconType.WHITE_SKULL);
89 }
90 }
91
92 public void skull() {
93 skull(player, SkullHeadIconType.WHITE_SKULL);
94 }
95
96 public void skull(SkullHeadIconType icon) {
97 skull(player, icon);
98 }
99
105 public void skull(Player attacking, SkullHeadIconType icon) {
106 if (attacking.inActivity()) {
107 return;
108 }
109
110 if(LMSGame.inGameArea(attacking)) return;
111
112 if (attacking != player) {
113 attacked.add(attacking.getName());
114 }
115
116 this.icon = icon;
117 player.updateFlags.add(UpdateFlag.APPEARANCE);
118
119 if (!skullRemoveTask.isRunning()) {
120 skullRemoveTask.setSkullTime(skullRemoveTask.getSkullTime() <= 0 ? Config.SKULL_TIME : skullRemoveTask.getSkullTime());
121 World.schedule(skullRemoveTask);
122 }
123 }
124
125 public boolean isSkulled() {
126 return skullRemoveTask.isRunning();
127 }
128
132 public void unskull() {
133 if (!isSkulled()) {
134 return;
135 }
136
137 skullRemoveTask.setSkullTime(0);
138 attacked.clear();
139 icon = SkullHeadIconType.NO_SKULL;
140 player.updateFlags.add(UpdateFlag.APPEARANCE);
141 }
142
143 public SkullRemoveTask getSkullRemoveTask() {
144 return skullRemoveTask;
145 }
146
153 return icon;
154 }
155
156}
static final int SKULL_TIME
Definition Config.java:229
SkullHeadIconType getHeadIconType()
void checkForSkulling(Player opponent)
Definition Skulling.java:83
void skull(Player attacking, SkullHeadIconType icon)
static boolean inGameArea(Player player)
Definition LMSGame.java:179
static void schedule(Task task)
Definition World.java:284