RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.skill.impl.firemaking.Firemaking Class Reference

The firemaking skill. More...

Inheritance diagram for com.runehive.content.skill.impl.firemaking.Firemaking:
Collaboration diagram for com.runehive.content.skill.impl.firemaking.Firemaking:

Public Member Functions

 Firemaking (int level, double experience)
Public Member Functions inherited from com.runehive.game.world.entity.skill.Skill
double addExperience (double amount)
 Adds experiences to this skill by the given amount.
void addLevel (int amount)
 Adds levels to this skill by the given amount.
void divideExperience (double amount)
 Divides the current experience of this skill by a given amount.
void divideLevel (double amount)
 Divides the current level of this skill by a given amount.
double getExperience ()
 Gets the skill experience.
int getLevel ()
 Gets the current skill level.
int getMaxLevel ()
 Gets the maximum skill level.
int getRoundedExperience ()
 Gets the floor experience.
int getSkill ()
 Gets the skill id.
boolean isDoingSkill ()
double modifyExperience (Function< Double, Double > function)
 Modifies the current experience with a given function.
double modifyExperience (Function< Double, Double > function, int lowerBounds, int upperBounds)
 Modifies the current experience with a given function.
void modifyLevel (Function< Integer, Integer > function)
 Modifies the current level with a given function.
void modifyLevel (Function< Integer, Integer > function, int lowerBounds, int upperBounds)
 Modifies the current level with a given function.
void multiplyExperience (double amount)
 Multiplies the current experience of this skill by a given amount.
void multiplyLevel (double amount)
 Multiplies the current level of this skill by a given amount.
boolean onEvent (Player player, InteractionEvent interactionEvent)
void removeExperience (double amount)
 Removes experiences from this skill by the given amount.
void removeLevel (int amount)
 Removes levels from this skill by the given amount.
boolean reqLevel (int level)
 Determines if your level is greater than or equal to level.
void setDoingSkill (boolean doingSkill)
void setExperience (double experience)
 Sets the experience for this skill.
void setLevel (int level)
 Sets the level for this skill.
void setMaxLevel (int maxLevel)
 Sets the maximum level for this skill.
 Skill (int skill, int level, double experience)
 Constructs a new Skill.
String toString ()

Static Public Member Functions

static double getBonus (Player player)
Static Public Member Functions inherited from com.runehive.game.world.entity.skill.Skill
static Function< Integer, Integer > add (int amount)
 Creates a function that adds a number by an amount.
static Function< Integer, Integer > divide (double amount)
 Creates a function that divides a number by an amount.
static final int getExperienceForLevel (int level)
 Gets the experience for a given level.
static final byte getLevelForExperience (double experience)
 Gets the level for a given experience amount.
static String getName (int skill)
 Gets the name for a skill id.
static Function< Integer, Integer > multiply (double amount)
 Creates a function that multiplies a number by an amount.
static Function< Integer, Integer > subtract (int amount)
 Creates a function that subtracts a number by an amount.

Protected Member Functions

boolean clickObject (Player player, ObjectInteractionEvent event)
boolean useItem (Player player, ItemOnItemInteractionEvent event)
Protected Member Functions inherited from com.runehive.game.world.entity.skill.Skill
boolean clickButton (Player player, ClickButtonInteractionEvent event)
boolean clickItem (Player player, ItemInteractionEvent event)
boolean clickNpc (Player player, NpcInteractionEvent event)
boolean itemContainerAction (Player player, ItemContainerInteractionEvent event)
double modifier ()
boolean useItem (Player player, ItemOnObjectInteractionEvent event)

Private Member Functions

Action< PlayerbonfireAction (Player player, GameObject object, FiremakingData firemaking, int toBurn)

Additional Inherited Members

Public Attributes inherited from com.runehive.game.world.entity.skill.Skill
transient final Stopwatch stopwatch = Stopwatch.start()
Static Public Attributes inherited from com.runehive.game.world.entity.skill.Skill
static final int AGILITY = 16
 The agility skill id.
static final int ATTACK = 0
 The attack skill id.
static final int CONSTRUCTION = 21
 The construction skill id.
static final int COOKING = 7
 The cooking skill id.
static final int CRAFTING = 12
 The crafting skill id.
static final int DEFENCE = 1
 The defence skill id.
static final int FARMING = 19
 The farming skill id.
static final int FIREMAKING = 11
 The firemaking skill id.
static final int FISHING = 10
 The fishing skill id.
static final int FLETCHING = 9
 The fletching skill id.
static final int HERBLORE = 15
 The herblore skill id.
static final int HITPOINTS = 3
 The hitpoints skill id.
static final int HUNTER = 22
 The hunter skill id.
static final int[][] INTERFACE_DATA
 Skill tab string data.
static final int MAGIC = 6
 The magic skill id.
static final int MINING = 14
 The mining skill id.
static final int PRAYER = 5
 The prayer skill id.
static final int RANGED = 4
 The ranged skill id.
static final int RUNECRAFTING = 20
 The runecrafting skill id.
static final int SKILL_COUNT = 23
 The amount of available skills.
static final int SLAYER = 18
 The slayer skill id.
static final int SMITHING = 13
 The smithing skill id.
static final int STRENGTH = 2
 The strength skill id.
static final int THIEVING = 17
 The thieving skill id.
static final int TOTAL_SKILL_LEVEL = 99 * SKILL_COUNT
 The total skill amount.
static final int WOODCUTTING = 8
 The woodcutting skill id.

Detailed Description

The firemaking skill.

Author
Daniel

Definition at line 26 of file Firemaking.java.

Constructor & Destructor Documentation

◆ Firemaking()

com.runehive.content.skill.impl.firemaking.Firemaking.Firemaking ( int level,
double experience )

Definition at line 28 of file Firemaking.java.

28 {
29 super(Skill.FIREMAKING, level, experience);
30 }

References com.runehive.game.world.entity.skill.Skill.experience, com.runehive.game.world.entity.skill.Skill.level, and com.runehive.game.world.entity.skill.Skill.Skill().

Here is the call graph for this function:

Member Function Documentation

◆ bonfireAction()

Action< Player > com.runehive.content.skill.impl.firemaking.Firemaking.bonfireAction ( Player player,
GameObject object,
FiremakingData firemaking,
int toBurn )
private

Definition at line 103 of file Firemaking.java.

103 {
104 return new Action<Player>(player, 3) {
105 int amount = toBurn;
106
107 @Override
108 public WalkablePolicy getWalkablePolicy() {
109 return WalkablePolicy.NON_WALKABLE;
110 }
111
112 @Override
113 public String getName() {
114 return "Bonfire action";
115 }
116
117 @Override
118 protected void execute() {
119 if (amount <= 0) {
120 cancel();
121 return;
122 }
123 if (!object.active()) {
124 cancel();
125 return;
126 }
127 if (!player.inventory.contains(firemaking.getLog())) {
128 player.message("You have no more logs!");
129 cancel();
130 return;
131 }
132 final boolean saveLog = SkillCape.isEquipped(player, SkillCape.FIREMAKING) && Utility.random(1, 3) == 1;
133 if (!saveLog) {
134 player.inventory.remove(firemaking.getLog(), 1);
135 }
136 player.animate(733);
137 player.skills.addExperience(Skill.FIREMAKING, firemaking.getExperience() * Config.FIREMAKING_MODIFICATION);
138 RandomEventHandler.trigger(player);
139 player.playerAssistant.activateSkilling(1);
140 Pets.onReward(getMob(), PetData.PHOENIX.getItem(), 8562);
141
142 if (firemaking == FiremakingData.WILLOW_LOG) {
143 player.forClan(channel -> channel.activateTask(ClanTaskKey.BURN_WILLOW_LOG, getMob().getName()));
144 }
145
146 if (player.prestige.hasPerk(PrestigePerk.FLAME_ON) && RandomUtils.success(.25)) {
147 player.inventory.remove(firemaking.getLog(), 1);
148 player.skills.addExperience(Skill.FIREMAKING, firemaking.getExperience() * Config.FIREMAKING_MODIFICATION);
149 }
150
151 if (!saveLog) {
152 amount--;
153 }
154 }
155
156 @Override
157 protected void onCancel(boolean logout) {
158// player.resetAnimation();
159 }
160 };
161 }

References com.runehive.game.world.entity.mob.player.PlayerAssistant.activateSkilling(), com.runehive.game.world.entity.skill.SkillManager.addExperience(), com.runehive.game.world.entity.mob.Mob.animate(), com.runehive.content.clanchannel.content.ClanTaskKey.BURN_WILLOW_LOG, com.runehive.game.world.items.containers.ItemContainer.contains(), com.runehive.content.skillcape.SkillCape.FIREMAKING, com.runehive.Config.FIREMAKING_MODIFICATION, com.runehive.content.prestige.PrestigePerk.FLAME_ON, com.runehive.game.world.entity.mob.player.Player.forClan(), com.runehive.game.world.entity.skill.Skill.getName(), com.runehive.content.prestige.Prestige.hasPerk(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.content.skillcape.SkillCape.isEquipped(), com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.game.action.policy.WalkablePolicy.NON_WALKABLE, com.runehive.content.pet.Pets.onReward(), com.runehive.content.pet.PetData.PHOENIX, com.runehive.game.world.entity.mob.player.Player.playerAssistant, com.runehive.game.world.entity.mob.player.Player.prestige, com.runehive.util.Utility.random(), com.runehive.game.world.items.containers.ItemContainer.remove(), com.runehive.game.world.entity.skill.Skill.Skill(), com.runehive.game.world.entity.mob.Mob.skills, com.runehive.util.RandomUtils.success(), com.runehive.content.activity.randomevent.RandomEventHandler.trigger(), and com.runehive.content.skill.impl.firemaking.FiremakingData.WILLOW_LOG.

Referenced by clickObject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clickObject()

boolean com.runehive.content.skill.impl.firemaking.Firemaking.clickObject ( Player player,
ObjectInteractionEvent event )
protected

Reimplemented from com.runehive.game.world.entity.skill.Skill.

Definition at line 69 of file Firemaking.java.

69 {
70 if (event.getOpcode() != 0 || event.getObject().getId() != 5249) {
71 return false;
72 }
73
74 if (player.getPosition().equals(event.getObject().getPosition())) {
75 player.message("Please step out of the fire!");
76 return true;
77 }
78
79 FiremakingData firemaking = null;
80
81 for (Item item : player.inventory) {
82 if (item != null && FiremakingData.forId(item.getId()).isPresent()) {
83 firemaking = FiremakingData.forId(item.getId()).get();
84 break;
85 }
86 }
87
88 if (firemaking == null) {
89 player.dialogueFactory.sendStatement("You have no logs in your inventory to add to this fire!").execute();
90 return true;
91 }
92
93 if (player.skills.getMaxLevel(Skill.FIREMAKING) < firemaking.getLevel()) {
94 player.message("You need a firemaking level of " + firemaking.getLevel() + " to light this log!");
95 return true;
96 }
97
98 player.action.execute(bonfireAction(player, event.getObject(), firemaking, player.inventory.computeAmountForId(firemaking.getLog())));
99 return true;
100 }

References com.runehive.game.world.entity.mob.Mob.action, bonfireAction(), com.runehive.game.world.items.containers.ItemContainer.computeAmountForId(), com.runehive.game.world.entity.mob.player.Player.dialogueFactory, com.runehive.game.world.position.Position.equals(), com.runehive.content.dialogue.DialogueFactory.execute(), com.runehive.game.action.ActionManager.execute(), com.runehive.content.skill.impl.firemaking.FiremakingData.forId(), com.runehive.game.world.items.Item.getId(), com.runehive.game.world.entity.skill.SkillManager.getMaxLevel(), com.runehive.game.world.entity.Entity.getPosition(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.content.dialogue.DialogueFactory.sendStatement(), com.runehive.game.world.entity.skill.Skill.Skill(), and com.runehive.game.world.entity.mob.Mob.skills.

Here is the call graph for this function:

◆ getBonus()

double com.runehive.content.skill.impl.firemaking.Firemaking.getBonus ( Player player)
static

Definition at line 52 of file Firemaking.java.

52 {
53 double bonus = 0;
54 if(player.equipment.getId(0) == 20708)
55 bonus += 0.4;
56 if(player.equipment.getId(4) == 20704)
57 bonus += 0.8;
58 if(player.equipment.getId(7) == 20706)
59 bonus += 0.6;
60 if(player.equipment.getId(10) == 20710)
61 bonus += 0.2;
62
63 if(player.equipment.containsAll(20708, 20704, 20706, 20710))
64 bonus = 2.5;
65
66 return bonus;
67 }

References com.runehive.game.world.items.containers.ItemContainer.containsAll(), com.runehive.game.world.entity.mob.player.Player.equipment, and com.runehive.game.world.items.containers.ItemContainer.getId().

Referenced by com.runehive.game.world.entity.skill.SkillManager.addExperience().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ useItem()

boolean com.runehive.content.skill.impl.firemaking.Firemaking.useItem ( Player player,
ItemOnItemInteractionEvent event )
protected

Reimplemented from com.runehive.game.world.entity.skill.Skill.

Definition at line 33 of file Firemaking.java.

33 {
34 Item first = event.getFirst();
35 Item second = event.getSecond();
36 FiremakingData firemaking = null;
37 Item item = null;
38 if (!FiremakingData.forId(second.getId()).isPresent() && !FiremakingData.forId(first.getId()).isPresent())
39 return false;
40 if (first.getId() == 590) {
41 firemaking = FiremakingData.forId(second.getId()).get();
42 item = second;
43 } else if (second.getId() == 590) {
44 firemaking = FiremakingData.forId(first.getId()).get();
45 item = first;
46 }
47 if (firemaking == null)
48 return false;
49 player.action.execute(new FiremakingAction(player, item, firemaking), true);
50 return true;
51 }

References com.runehive.game.world.entity.mob.Mob.action, com.runehive.game.action.ActionManager.execute(), com.runehive.content.skill.impl.firemaking.FiremakingData.forId(), and com.runehive.game.world.items.Item.getId().

Here is the call graph for this function:

The documentation for this class was generated from the following file: