RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
HighAlchemy.java
1package com.osroyale.content.skill.impl.magic.spell.impl;
2
3import com.osroyale.Config;
4import com.osroyale.content.achievement.AchievementHandler;
5import com.osroyale.content.achievement.AchievementKey;
6import com.osroyale.content.activity.randomevent.RandomEventHandler;
7import com.osroyale.content.skill.impl.magic.Magic;
8import com.osroyale.content.skill.impl.magic.Spellbook;
9import com.osroyale.content.skill.impl.magic.spell.Spell;
10import com.osroyale.game.Animation;
11import com.osroyale.game.Graphic;
12import com.osroyale.game.world.entity.mob.player.Player;
13import com.osroyale.game.world.entity.skill.Skill;
14import com.osroyale.game.world.items.Item;
15import com.osroyale.net.packet.out.SendForceTab;
16import com.osroyale.net.packet.out.SendMessage;
17
18import java.util.Arrays;
19
48
49public class HighAlchemy implements Spell {
50
51 @Override
52 public String getName() {
53 return "High alchemy";
54 }
55
56 @Override
57 public int getLevel() {
58 return 55;
59 }
60
61 @Override
62 public Item[] getRunes() {
63 return new Item[] { new Item(554, 5), new Item(561, 1) };
64 }
65
66 @Override
67 public void execute(Player player, Item item) {
68 if (player.spellbook != Spellbook.MODERN)
69 return;
70
71 if (!player.spellCasting.castingDelay.elapsed(500)) {
72 return;
73 }
74
75 if (Arrays.stream(Magic.UNALCHEABLES).anyMatch($it -> item.getId() == $it.getId())) {
76 player.send(new SendMessage("You can not alch this item!"));
77 return;
78 }
79
80 int value = item.getHighAlch();
81
82 player.animate(new Animation(713));
83 player.graphic(new Graphic(113, true));
84 player.inventory.remove(item.getId(), 1);
85 player.inventory.removeAll(getRunes());
86 player.inventory.add(Config.CURRENCY, value == 0 ? 1 : value);
87 player.inventory.refresh();
88 player.send(new SendForceTab(6));
89 player.skills.addExperience(Skill.MAGIC, 65 * (Config.MAGIC_MODIFICATION + 5));
91 player.spellCasting.castingDelay.reset();
92 player.action.clearNonWalkableActions();
93 RandomEventHandler.trigger(player);
94 }
95}
static final double MAGIC_MODIFICATION
Definition Config.java:310
static final int CURRENCY
Definition Config.java:213
static void activate(Player player, AchievementKey achievement)
void addExperience(int id, double experience)
boolean removeAll(Collection<? extends Item > items)