RuneHive-Game
Loading...
Searching...
No Matches
RestockObjective.java
Go to the documentation of this file.
1package com.runehive.content.bot.objective.impl;
2
3import com.runehive.content.bot.BotUtility;
4import com.runehive.content.bot.PlayerBot;
5import com.runehive.content.bot.botclass.BotClass;
6import com.runehive.content.bot.botclass.impl.*;
7import com.runehive.content.bot.objective.BotObjective;
8import com.runehive.content.bot.objective.BotObjectiveListener;
9import com.runehive.content.consume.FoodData;
10import com.runehive.content.consume.PotionData;
11import com.runehive.game.world.entity.combat.strategy.player.special.CombatSpecial;
12import com.runehive.game.world.items.Item;
13import com.runehive.util.RandomUtils;
14import com.runehive.util.Utility;
15
16import java.util.Optional;
17
18public class RestockObjective implements BotObjectiveListener {
19
20 /** The positions of all the bank locations for the bot to access. */
21 private static final BotClass[] TYPES = {
22 new WelfareRuneMelee(),
23 new AGSRuneMelee(),
24 new PureMelee(),
25 new PureRangeMelee(),
26 new ZerkerMelee()
27 };
28
29 @Override
30 public void init(PlayerBot bot) {
31 if (bot.botClass == null)
32 bot.botClass = RandomUtils.random(TYPES);
33
34 Item[] inventory = bot.botClass.inventory();
35 bot.inventory.set(inventory);
36 bot.equipment.manualWearAll(bot.botClass.equipment());
37
38 for (Item item : inventory) {
39 if (item == null) continue;
40 if (FoodData.forId(item.getId()).isPresent()) {
41 bot.foodRemaining++;
42 }
43 Optional<PotionData> potion = PotionData.forId(item.getId());
44 if (!potion.isPresent() || potion.get() == PotionData.SUPER_RESTORE_POTIONS || potion.get() == PotionData.SARADOMIN_BREW) {
45 continue;
46 }
47 bot.statBoostersRemaining++;
48 }
49
50 int[] skills = bot.botClass.skills();
51 for (int skill = 0; skill < skills.length; skill++) {
52 bot.skills.setMaxLevel(skill, skills[skill]);
53 }
54 bot.skills.setCombatLevel();
55
57 bot.schedule(2, () -> finish(bot));
58 }
59
60 @Override
65
66}
Holds all the constants used by bot.
static final String[] GEAR_UP_MESSAGES
Array of all the possible fight start message.
static final BotClass[] TYPES
The positions of all the bank locations for the bot to access.
The container class that represents an item that can be interacted with.
Definition Item.java:21
A static-util class that provides additional functionality for generating pseudo-random numbers.
static< T > T random(T[] array)
Pseudo-randomly retrieves a element from array.
Handles miscellaneous methods.
Definition Utility.java:27
static< T > T randomElement(Collection< T > collection)
Picks a random element out of any array type.
Definition Utility.java:248
static Optional< FoodData > forId(int id)
Gets the food data based on the item identification.
The enumerated type managing consumable potion types.
static Optional< PotionData > forId(int id)
Retrieves the potion consumable element for id.
The enumerated type whose elements represent the combat special attacks.
static void restore(Player player, int amount)
Restores the special bar for player.