1package com.runehive.content.wintertodt;
3import com.runehive.Config;
4import com.runehive.content.collectionlog.CollectionLog;
5import com.runehive.content.collectionlog.CollectionLogData;
6import com.runehive.content.skill.impl.woodcutting.AxeData;
7import com.runehive.content.wintertodt.actions.*;
8import com.runehive.game.task.Task;
9import com.runehive.game.world.World;
10import com.runehive.game.world.entity.combat.hit.Hit;
11import com.runehive.game.world.entity.mob.Direction;
12import com.runehive.game.world.entity.mob.UpdateFlag;
13import com.runehive.game.world.entity.mob.npc.Npc;
14import com.runehive.game.world.entity.mob.player.Player;
15import com.runehive.game.world.entity.skill.Skill;
16import com.runehive.game.world.items.Item;
17import com.runehive.game.world.object.CustomGameObject;
18import com.runehive.game.world.object.GameObject;
19import com.runehive.game.world.position.Position;
20import com.runehive.game.world.region.Region;
21import com.runehive.net.packet.out.SendConfig;
22import com.runehive.net.packet.out.SendRemoveObject;
23import com.runehive.net.packet.out.SendString;
24import com.runehive.util.Utility;
26import java.util.ArrayList;
27import java.util.Arrays;
29import java.util.stream.Collectors;
44 public static final int MAX_HP = 3500;
65 private static final String[]
PYROMANCER_DEAD_TEXT = {
"My flame burns low.",
"Mummy!",
"I think I'm dying.",
"We are doomed.",
"Ugh, help me!"};
69 private static final int FLAME = 7373;
93 1050, 12887, 12888, 12889, 12890, 12891, 12892, 12893, 12894, 12895, 12896, 13343, 13344,
95 23448, 13663, 13664, 13665, 13182,
97 19689, 19691, 19693, 19695, 19697,
117 20708, 20706, 20704, 20710,
119 11021, 11020, 11022, 11019,
121 20439, 20436, 20442, 20434,
135 6857, 6859, 6861, 6863, 9470, 21314,
145 13280, 13329, 21284, 21285, 13337, 20760, 21898, 24855, 21776, 21780, 21778, 13331, 13333, 13335,
151 1387, 1393, 3053, 11787, 11998, 1401, 3054, 11789, 12000, 13241, 13242, 13243, 13244, 21031, 21033, 12773, 20056, 20720,
161 new Brazier(
World.
getRegions().
getRegion(
new Position(1620, 3997, 0)).getGameObject(29312,
new Position(1620, 3997, 0)),
new Npc(7371,
new Position(1619, 3996, 0), 0,
Direction.
NORTH_EAST), 2, 2,
Direction.
NORTH_EAST),
162 new Brazier(
World.
getRegions().
getRegion(
new Position(1620, 4015, 0)).getGameObject(29312,
new Position(1620, 4015, 0)),
new Npc(7371,
new Position(1619, 4018, 0), 0,
Direction.
SOUTH_EAST), 2, 0,
Direction.
SOUTH_EAST),
163 new Brazier(
World.
getRegions().
getRegion(
new Position(1638, 4015, 0)).getGameObject(29312,
new Position(1638, 4015, 0)),
new Npc(7371,
new Position(1641, 4018, 0), 0,
Direction.
SOUTH_WEST), 0, 0,
Direction.
SOUTH_WEST),
164 new Brazier(
World.
getRegions().
getRegion(
new Position(1638, 3997, 0)).getGameObject(29312,
new Position(1638, 3997, 0)),
new Npc(7371,
new Position(1641, 3996, 0), 0,
Direction.
NORTH_WEST), 0, 2,
Direction.
NORTH_WEST)
180 brazier.getPyromancer().register();
184 protected void execute() {
196 protected void execute() {
215 brazier.getObject().unregister();
217 brazier.getObject().register();
218 if (!brazier.isPyromancerAlive())
219 brazier.getPyromancer().transform(
PYROMANCER);
252 region.getPlayers(0).forEach(player -> {
253 if(player.getPosition().getY() <= 3987 ||
Utility.
random(25) != 0)
return;
256 player.message(
"The cold of the Wintertodt seeps into your bones.");
259 player.action.getCurrentAction().cancel();
270 if(brazier.hasSnowStorm())
continue;
277 brazier.getObject().unregister();
279 brazier.getObject().register();
291 List<GameObject> objects = Arrays.asList(
300 gameObject.register();
306 public void execute() {
309 gameObject.unregister();
310 region.getPlayers(0).forEach(players -> {
323 region.getPlayers(0).forEach(player -> {
325 player.message(
"The brazier is broken and shrapnel damages you.");
353 List<GameObject> snowAttacks =
new ArrayList<>();
356 if(
region.getObjects(
new Position(baseX + 1, baseY + 1, 0)).size() == 0)
358 if(
region.getObjects(
new Position(baseX + 1, baseY - 1, 0)).size() == 0)
360 if(
region.getObjects(
new Position(baseX - 1, baseY + 1, 0)).size() == 0)
362 if(
region.getObjects(
new Position(baseX - 1, baseY - 1, 0)).size() == 0)
366 gameObject.register();
371 public void execute() {
373 gameObject.transform(index == 0 ? 29325 : 29324);
377 region.getPlayers(0).forEach(players -> {
379 players.message(
"The freezing cold attack of the Wintertodt's magic hits you.");
389 public void execute() {
391 gameObject.unregister();
392 region.getPlayers(0).forEach(players -> {
413 if (!pyros.isEmpty() &&
Utility.
random(pyros.size() * 30) == pyros.size()) {
418 System.out.println(
"already a snow attack going for this pyro...");
422 pyro.pyroSnowAttack =
true;
428 public void execute() {
432 pyro.pyroHealth -= damage;
438 pyro.pyroSnowAttack =
false;
439 region.getPlayers(0).forEach(players -> {
456 if (!brazier.isPyromancerAlive())
459 brazier.getPyromancer().speak(
"Light this brazier!");
461 brazier.getPyromancer().speak(
"Fix this brazier!");
463 brazier.getPyromancer().speak(
"Yemalo shi cardito!");
466 brazier.getPyromancer().animate(4432);
477 if (brazier.isPyromancerAlive() && brazier.getObject().getId() ==
BURNING_BRAZIER_ID) {
513 brazier.getPyromancer().speak(
"We can rest for a time.");
514 brazier.getPyromancer().transform(
PYROMANCER);
515 brazier.getPyromancer().pyroSnowAttack =
false;
516 brazier.getPyromancer().pyroHealth = 24;
517 brazier.getPyromancer().animate(65535);
519 brazier.getObject().unregister();
521 brazier.getObject().register();
536 int crates = player.wintertodtPoints / 500;
538 player.
message(
"You have gained " + crates +
" supply crates!");
540 player.
message(
"You have gained a supply crate!");
543 }
else player.
message(
"You did not earn enough points to be worthy of a gift from the citizens of Kourend this time.");
545 player.wintertodtPoints = 0;
554 if (item !=
null &&
GAME_ITEMS.contains(item.getId())) {
573 int warmClothing = 0;
576 if(warmClothing >= 4)
break;
589 return Math.min(count, 3);
597 player.
message(
"There's no need to do that at this time.");
603 if(axeData ==
null) {
604 player.
message(
"You do not have an axe which you have the woodcutting level to use.");
609 player.
message(
"You have no space for that.");
621 player.
message(
"There's no need to do that at this time.");
628 if(b.getObject().getId() == gameObject.
getId() && b.getObject().getPosition() == gameObject.
getPosition()) {
634 if(brazier ==
null) {
635 System.out.println(
"Brazier has not been found...");
648 player.
message(
"There's no need to do that at this time.");
655 if(b.getObject().getId() == gameObject.
getId() && b.getObject().getPosition() == gameObject.
getPosition()) {
661 if(brazier ==
null) {
662 System.out.println(
"Brazier has not been found...");
667 player.
message(
"Heal the Pyromancer before fixing the brazier.");
672 player.
message(
"You need a hammer to fix this brazier.");
685 player.
message(
"There's no need to do that at this time.");
700 player.
message(
"There's no need to do that at this time.");
707 if(b.getObject().getId() == gameObject.
getId() && b.getObject().getPosition() == gameObject.
getPosition()) {
713 if(brazier ==
null) {
714 System.out.println(
"Brazier has not been found...");
719 player.
message(
"Heal the Pyromancer before lighting the brazier.");
724 player.
message(
"You need a tinderbox or Bruma Torch to light that brazier.");
737 player.
message(
"There's no need to do that at this time.");
756 player.
message(
"There's no need to do that at this time.");
761 player.
message(
"You have no space for that.");
774 player.
message(
"There's no need to do that at this time.");
781 if(b.getPyromancer().getPosition() == npc.
getPosition() && b.getPyromancer().id == npc.
id) {
787 if(brazier ==
null) {
788 System.out.println(
"Brazier has not been found...");
795 System.out.println(
"not a rejuv potion");
816 player.wintertodtPoints += amount;
817 if (old < 500 && player.wintertodtPoints >= 500) {
818 player.
message(
"You have helped enough to earn a supply crate. Further work will go towards better rewards.");
The class that contains setting-related constants for the server.
static final double FIREMAKING_MODIFICATION
The experience modification for firemaking.
static void increaseCounter(Player player, CollectionLogData data)
void setSnowStorm(boolean snowStorm)
boolean isPyromancerAlive()
void setObject(int objectId)
static final List< Integer > GAME_ITEMS
List of all minigame items.
static void applyColdDamage()
static int getBraziersLit()
How many braziers are currently lit.
static void shootFlame(Brazier brazier)
Handles spawning the flame that goes to the middle.
static final int INCAPACITATED_PYROMANCER
static void healPyromancer(Player player, Npc npc, int slot)
Handles healing the pyromancer.
static final String[] PYROMANCER_DEAD_TEXT
Npc ids.
static int getColdDamage(Player player)
The amount of damagae the player gets from cold.
static final int ACTIVE_STORM_ID
static void doMagicAttack()
Handles doing the magic attack by the bnoss.
static void attackPyromancers()
Handles attacking the pyromancers.
static void fixBrazier(Player player, GameObject gameObject)
Handles fixing the brazier.
static int getWarmItemsWorn(Player player)
How much warm clothing the player is wearing.
static final int BRUMA_HERB
static void mixHerb(Player player)
Handles mixing the potion.
static final int REJUV_POT_3
static void pyromancerText()
Handles the pyromancer speech.
static void award(Player player)
Handles awarding players with crates.
static final int REJUV_POT_4
static void death()
Handles the death of the boss.
static void fletch(Player player)
Handles fetching the kindling.
static boolean started
Game data.
static final int DEFAULT_DELAY
static final int REJUV_POT_UNF
static final int REJUV_POT_2
static final int BRUMA_ROOT
Item ids.
static void removeGameItems(Player player)
Handles removes the items within the wintertodt game.
static final int BRUMA_KINDLING
static void extinguishBraziers()
Handles extinguishing the braziers.
static final int REGION_ID
Region of the wintertodt game.
static final int REJUV_POT_1
static void addPoints(Player player, int amount)
Handles adding wintertodt points to a player.
static void takeHerb(Player player)
Handles taking a bruma herb.
static final int INACTIVE_STORM_ID
static final int BROKEN_BRAZIER_ID
static final int EMPTY_BRAZIER_ID
static final int SNOW_EFFECT_ID
Game object ids.
static void feedBrazier(Player player, GameObject gameObject)
Handles feeding the brazier.
static void lightBrazier(Player player, GameObject gameObject)
Handles lighting a brazier.
static void chopRoot(Player player)
Handles chopping the root.
static int pyroSpeechDelay
static final int PYROMANCER
static boolean isActive()
static int getBrazierAttackDamage(Player player)
How much damage the brazier does to a player when it breaks.
static final Brazier[] BRAZIERS
Brazier data.
static void send(Player player)
static int getAreaAttackDamage(Player player)
Handles the formula on how much the area attack can do.
static CustomGameObject WINTERTODT
static final List< Integer > WARM_CLOTHING
List of all warm clothing.
static final int BURNING_BRAZIER_ID
static void breakBrazier(Brazier brazier)
Handles breaking the brazier.
static void dealDamage()
Handles dealing damage to the boss.
public< A extends Action<?> > void execute(A action)
A game representing a cyclic unit of work.
Represents the game world.
static void schedule(Task task)
Submits a new event.
static RegionManager getRegions()
A Hit object holds the damage amount and hitsplat data.
final SkillManager skills
void transform(int transformId)
void animate(int animation)
void writeFakeDamage(Hit hit)
boolean simplePath(Position destination)
Finds a smart path to the target.
Represents a non-player character in the in-game world.
int pyroHealth
Pyromancer data.
void register()
Registers an entity to the World.
int getWalkable()
Gets the walkable interface.
void openWalkable(int identification)
Opens a walkable-itemcontainer for the player.
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
final Equipment equipment
final InterfaceManager interfaceManager
void send(OutgoingPacket encoder)
Represents a trainable and usable skill.
static final byte getLevelForExperience(double experience)
Gets the level for a given experience amount.
double getExperience()
Gets the skill experience.
static final int FIREMAKING
The firemaking skill id.
static final int HITPOINTS
The hitpoints skill id.
void addExperience(int id, double experience)
Adds experience to a given skill.
Skill get(int id)
Gets the skill for an id.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
final int computeAmountForId(int id)
Computes the total quantity of the Items in this container with id.
final Item get(int index)
Gets the Item located on index.
boolean add(Item item)
Attempts to deposit item into this container.
final int getId(int index)
Gets the item id located on index.
boolean contains(int id)
Determines if this container contains id.
final void set(Item[] toSet)
boolean contains(int[] bowsWithNoArrowsRequired)
void refresh()
Refreshes the players inventory.
Represents a static game object loaded from the map fs.
Represents a single tile on the game world.
int getHeight()
Gets the height coordinate, or height.
int getY()
Gets the absolute y coordinate.
int getX()
Gets the absolute x coordinate.
Represents a single region.
Region getRegion(Position position)
Gets a region by position.
The OutgoingPacket responsible for changing settings on a client.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
Handles miscellaneous methods.
static int random(int bound)
static final boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance)
static int min(int... values)
Represents types of axes.
static Optional< AxeData > getDefinition(Player player)
Gets the definition for this hatchet.
Represents the enumerated directions an entity can walk or face.
Represents a game object.
void register()
Registers the game object.
Position getPosition()
Gets the regional location.
void unregister()
Unregisters the game object.
default int getId()
Gets the object id.