RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
RestockObjective.java
1package com.osroyale.content.bot.objective.impl;
2
3import com.osroyale.content.bot.BotUtility;
4import com.osroyale.content.bot.PlayerBot;
5import com.osroyale.content.bot.botclass.BotClass;
6import com.osroyale.content.bot.botclass.impl.*;
7import com.osroyale.content.bot.objective.BotObjective;
8import com.osroyale.content.bot.objective.BotObjectiveListener;
9import com.osroyale.content.consume.FoodData;
10import com.osroyale.content.consume.PotionData;
11import com.osroyale.game.world.entity.combat.strategy.player.special.CombatSpecial;
12import com.osroyale.game.world.items.Item;
13import com.osroyale.util.RandomUtils;
14import com.osroyale.util.Utility;
15
16import java.util.Optional;
17
40
41public class RestockObjective implements BotObjectiveListener {
42
44 private static final BotClass[] TYPES = {
45 new WelfareRuneMelee(),
46 new AGSRuneMelee(),
47 new PureMelee(),
48 new PureRangeMelee(),
49 new ZerkerMelee()
50 };
51
52 @Override
53 public void init(PlayerBot bot) {
54 if (bot.botClass == null)
55 bot.botClass = RandomUtils.random(TYPES);
56
57 Item[] inventory = bot.botClass.inventory();
58 bot.inventory.set(inventory);
59 bot.equipment.manualWearAll(bot.botClass.equipment());
60
61 for (Item item : inventory) {
62 if (item == null) continue;
63 if (FoodData.forId(item.getId()).isPresent()) {
64 bot.foodRemaining++;
65 }
66 Optional<PotionData> potion = PotionData.forId(item.getId());
67 if (!potion.isPresent() || potion.get() == PotionData.SUPER_RESTORE_POTIONS || potion.get() == PotionData.SARADOMIN_BREW) {
68 continue;
69 }
70 bot.statBoostersRemaining++;
71 }
72
73 int[] skills = bot.botClass.skills();
74 for (int skill = 0; skill < skills.length; skill++) {
75 bot.skills.setMaxLevel(skill, skills[skill]);
76 }
77 bot.skills.setCombatLevel();
78
79 CombatSpecial.restore(bot, 100);
80 bot.schedule(2, () -> finish(bot));
81 }
82
83 @Override
84 public void finish(PlayerBot bot) {
86 BotObjective.WALK_TO_DITCH.init(bot);
87 }
88
89}
static final String[] GEAR_UP_MESSAGES
static< T > T randomElement(Collection< T > collection)
Definition Utility.java:285
static Optional< FoodData > forId(int id)
static Optional< PotionData > forId(int id)