RuneHive-Game
Loading...
Searching...
No Matches
BonesToPeaches.java
Go to the documentation of this file.
1package com.runehive.content.skill.impl.magic.spell.impl;
2
3import com.runehive.Config;
4import com.runehive.content.skill.impl.magic.Magic;
5import com.runehive.content.skill.impl.magic.Spellbook;
6import com.runehive.content.skill.impl.magic.spell.Spell;
7import com.runehive.game.Animation;
8import com.runehive.game.Graphic;
9import com.runehive.game.world.entity.mob.player.Player;
10import com.runehive.game.world.entity.skill.Skill;
11import com.runehive.game.world.items.Item;
12import com.runehive.net.packet.out.SendMessage;
13
14public class BonesToPeaches implements Spell {
15
16 @Override
17 public String getName() {
18 return "Bones to peaches";
19 }
20
21 @Override
22 public Item[] getRunes() {
23 return new Item[]{new Item(557, 4), new Item(555, 4), new Item(561, 2)};
24 }
25
26 @Override
27 public int getLevel() {
28 return 60;
29 }
30
31 @Override
32 public void execute(Player player, Item item) {
33 if (player.spellbook != Spellbook.MODERN)
34 return;
35 int bone = 0;
36 for (final int bones : Magic.BONES) {
37 if (player.inventory.contains(bones)) {
38 bone = bones;
39 break;
40 }
41
42 }
43 if (bone == 0) {
44 player.send(new SendMessage("You have no bones to do this!"));
45 return;
46 }
47 final int amount = player.inventory.computeAmountForId(bone);
48 player.inventory.remove(bone, amount);
49 player.inventory.add(new Item(6883, amount), -1, true);
51 player.animate(new Animation(722));
52 player.graphic(new Graphic(141, true));
54 player.send(new SendMessage("You have converted " + amount + " bones to peaches."));
55 }
56}
The class that contains setting-related constants for the server.
Definition Config.java:24
static final double MAGIC_MODIFICATION
The experience modification for magic.
Definition Config.java:268
int getLevel()
Gets the level required to cast spell.
Item[] getRunes()
Gets the runes required to cast the spell.
void execute(Player player, Item item)
Executes the magic spell.
Class that models a single animation used by an entity.
Represents a single graphic that can be used by entities.
Definition Graphic.java:10
Optional< Graphic > graphic
Definition Mob.java:91
This class represents a character controlled by a player.
Definition Player.java:125
Represents a trainable and usable skill.
Definition Skill.java:18
static final int MAGIC
The magic skill id.
Definition Skill.java:39
void addExperience(int id, double experience)
Adds experience to a given skill.
The container class that represents an item that can be interacted with.
Definition Item.java:21
final int computeAmountForId(int id)
Computes the total quantity of the Items in this container with id.
boolean remove(Item item)
Attempts to withdraw item from this container.
boolean add(Item item)
Attempts to deposit item into this container.
boolean contains(int id)
Determines if this container contains id.
boolean removeAll(Collection<? extends Item > items)
Attempts to withdraw items in bulk from this container.
The OutgoingPacket that sends a message to a Players chatbox in the client.
The in-game spellbooks for players.
Definition Spellbook.java:8
The itemcontainer for casting a spell.
Definition Spell.java:11