RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.bot.PlayerBot Class Reference

The player bot entity. More...

Inheritance diagram for com.runehive.content.bot.PlayerBot:
Collaboration diagram for com.runehive.content.bot.PlayerBot:

Public Member Functions

void endFight ()
void loop (int ticks, Runnable action)
void pause (int ticks)
 PlayerBot ()
 PlayerBot (String name)
void postDeath ()
void pot (Mob opponent, ItemClickEvent event, PotionData potion)
void register ()
 Registers an entity to the World.
void retaliate (Player defender)
void schedule (int ticks, Runnable action)
void sequence ()
void stopLoop ()
void unregister ()
 Unregisters an entity from the World.
Public Member Functions inherited from com.runehive.game.world.entity.mob.player.Player
void addToRegion (Region region)
 Adds this entity to the specified region.
void appendDeath ()
 Handles the mob death.
void chat (ChatMessage chatMessage)
boolean equals (Object obj)
void forClan (Consumer< ClanChannel > action)
Optional< AntifireDetailsgetAntifireDetails ()
Appearance getAppearance ()
Optional< ChatMessagegetChatMessage ()
CollectionLog getCollectionLog ()
Combat< PlayergetCombat ()
 The combat of the mob.
CombatSpecial getCombatSpecial ()
Events getEvents ()
GambleManager getGambling ()
long getLastModification ()
int getMemberId ()
String getName ()
 Gets the name of this entity.
String getPassword ()
final MutableNumber getPoisonImmunity ()
int getSceneBaseChunkX ()
int getSceneBaseChunkY ()
Optional< GameSessiongetSession ()
MutableNumber getSpecialPercentage ()
CombatStrategy< PlayergetStrategy ()
 The combat strategy of the mob.
EntityType getType ()
 Gets the EntityType.
String getUsername ()
final MutableNumber getVenomImmunity ()
WeaponInterface getWeapon ()
int hashCode ()
boolean isAutocast ()
boolean isAutoRetaliate ()
 State of the mob's auto retaliate.
boolean isGambleLocked ()
boolean isSingleCast ()
boolean isSpecialActivated ()
boolean isTeleblocked ()
boolean isValid ()
 Validates this npc based on its current region and registered state.
void loadRegion ()
final void logout ()
final void logout (boolean force)
void message (boolean filtered, String... messages)
void message (String message)
void message (String... messages)
void onStep ()
void pickup (Item item, Position position)
 Player (String username)
 Player (String username, Position position)
void removeFromRegion (Region region)
 Removes this entity from the specified region.
void send (OutgoingPacket encoder)
void setAntifireDetail (AntifireDetails antifireDetails)
void setAutocast (CombatSpell autocast)
void setCollectionLog (CollectionLog collectionLog)
void setCombatSpecial (CombatSpecial special)
void setGambleLock (boolean gambleLocked)
void setLastModification (long lastModification)
void setMemberId (int memberId)
void setPassword (String password)
void setSceneBaseChunks (int chunkX, int chunkY)
void setSession (GameSession session)
void setSingleCast (CombatSpell singleCast)
void setSpecialActivated (boolean activated)
void setUsername (String username)
void setWeapon (WeaponInterface weapon)
void teleblock (int time)
int toSceneLocalX (int worldX)
int toSceneLocalX (Position pos)
int toSceneLocalY (int worldY)
int toSceneLocalY (Position pos)
String toString ()
Public Member Functions inherited from com.runehive.game.world.entity.mob.Mob
void animate (Animation animation)
 Plays an animation.
void animate (Animation animation, final boolean override)
 Plays an animation.
void animate (int animation)
void animate (int animation, boolean override)
void appendBonus (int index, int amount)
void attack (Mob target)
void clearTeleportTarget ()
 Resets the teleport target.
void damage (Hit... hits)
Hit decrementHealth (Hit hit)
void face (Direction direction)
 Sets the client update flag to face a certain direction.
void face (GameObject object)
 Sets the client update flag to face a certain direction.
void face (Mob mob)
void face (Position position)
 Sets the client update flag to face a certain direction.
void follow (Mob target)
void forceMove (int animation, int x, int y)
void forceMove (int delay, int animation, int startSpeed, int endSpeed, Position offset, Direction direction)
void forceMove (int delay, int delay2, int animation, int animationDelay, int startSpeed, int endSpeed, Position offset, Direction direction)
 Creates a force movement action for an entity.
void forceMove (int delay, int delay2, int animation, int startSpeed, int endSpeed, Position offset, Direction direction)
Optional< AnimationgetAnimation ()
int getBonus (int index)
int[] getBonuses ()
int getCurrentHealth ()
ForceMovement getForceMovement ()
Optional< GraphicgetGraphic ()
int getId ()
int getListIndex ()
int getMaximumHealth ()
final Npc getNpc ()
final Player getPlayer ()
final MutableNumber getPoisonDamage ()
PoisonType getPoisonType ()
int getPriorityIndex ()
int getTransformId ()
MutableNumber getVenomDamage ()
void graphic (Graphic graphic)
 Plays a graphic.
void graphic (Graphic graphic, boolean override)
 Plays a graphic.
void graphic (int graphic)
boolean hasPriorityIndex (Mob other)
void heal (int amount)
boolean inActivity ()
boolean inActivity (ActivityType type)
void interact (Mob mob)
 Sets the mob interacting with another mob.
boolean isDead ()
boolean isFixingInside ()
final boolean isNpc ()
 Check if an entity is an npc.
final boolean isNpc (BooleanInterface< Npc > condition)
 Check if an entity is an npc.
final boolean isPlayer ()
 Check if an entity is a player.
final boolean isPlayer (Function< Player, Boolean > condition)
 Check if an entity is a player.
final boolean isPoisoned ()
boolean isUpdateRequired ()
 Checks if mob requires an update.
final boolean isVenomed ()
 Mob (Position position)
 Constructs a new Mob.
 Mob (Position position, boolean visible)
void move (Position position)
 Moves the mob to a set position.
void poison (PoisonType type)
 Applies poison with an intensity of type to the entity.
final void reset ()
 Resets the mob after an update.
void resetAnimation ()
void resetFace ()
 Resets the mob's face location.
void resetGraphic ()
final void resetWaypoint ()
 Resets the waypoint.
void runTo (Position destination)
void setActivity (Activity activity)
void setBonus (int equipSlot, int bonus)
void setBonuses (int[] bonuses)
void setDead (boolean dead)
void setFixingInside (boolean fixingInside)
void setForceMovement (ForceMovement forceMovement)
void setListIndex (int listIndex)
void speak (String forceChat)
 Sets the mob's forced chat.
void takeStep ()
void transform (int transformId)
void transform (int transformId, boolean reload)
 Transforms the mob.
void unpoison ()
void unvenom ()
void venom ()
 Applies venom to the entity.
void walk (Position destination, boolean ignoreClip)
void walk (Position position)
void walkExactlyTo (Position position)
void walkExactlyTo (Position position, Runnable onDestination)
void walkTo (Interactable target, boolean clearAction, Runnable onDestination)
void walkTo (Interactable target, Runnable onDestination)
void walkTo (Position position)
void walkTo (Position position, Runnable onDestination)
void writeDamage (Hit hit)
void writeFakeDamage (Hit hit)
Public Member Functions inherited from com.runehive.game.world.entity.Entity
 Entity (Position position)
 Entity (Position position, boolean visible)
Position getCenterPosition ()
int getHeight ()
int getIndex ()
Position getPosition ()
Region getRegion ()
int getX ()
int getY ()
boolean is (EntityType type)
final boolean isCustomObject ()
 Check if an entity is an object.
final boolean isRegistered ()
final boolean isStaticObject ()
 Check if an entity is an object.
boolean isVisible ()
int length ()
void setIndex (int index)
void setLength (int length)
void setPosition (Position position)
void setVisible (boolean visible)
void setWidth (int width)
void setX (int x)
void setY (int y)
void setZ (int z)
int width ()

Public Attributes

BotClass botClass
int consumableDelay
int foodRemaining
Player opponent
int statBoostersRemaining
Public Attributes inherited from com.runehive.game.world.entity.mob.player.Player
int[] achievedSkills = new int[7]
final ActivityLogger activityLogger = new ActivityLogger(this)
Stopwatch aggressionTimer = Stopwatch.start()
int agsCharges = 750
int answeredTrivias
Appearance appearance = Config.DEFAULT_APPEARANCE
CombatSpell autocast
final Bank bank = new Bank(this)
final BankPin bankPin = new BankPin(this)
final BankVault bankVault = new BankVault(this)
boolean[] barrowKills = new boolean[BrotherData.values().length]
int barrowsKillCount
List< PlayerBirdHouseDatabirdHouseData = new ArrayList<>()
Item blowpipeDarts
float blowpipeScales
Stopwatch buttonDelay = Stopwatch.start()
int celestialRingCharges
ChatBoxItemDialogue chatBoxItemDialogue
String clan = ""
ClanChannel clanChannel
String clanTag = ""
String clanTagColor = ""
final ClanViewer clanViewer = new ClanViewer(this)
CoalBag coalBag = new CoalBag()
CollectionLogPage collectionLogPageOpen = null
CollectionLogData collectionLogView = null
boolean completedMageArena
final Set< PlayerOptioncontextMenus = new HashSet<>()
int cooldown = 7 * 60 * 1000
int crawsBowCharges
String created = Utility.getDate()
DailyEffect dailySlayerTaskSkip = new DailySlayerTaskSkip()
DailyEffect dailySlayerTaskTeleport = new DailySlayerTaskTeleport()
DailyEffect dailySpellBookSwap = new DailySpellBookSwap()
Stopwatch databaseRequest = Stopwatch.start()
int death
boolean debug
Optional< Dialoguedialogue = Optional.empty()
transient int dialogueCamDelayTicks = 0
 Delay ticks before camera activates (prevents coordinate misalignment at dialogue start).
transient com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.Mode dialogueCamMode = com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.Mode.OFF
 Dialogue camera system.
transient com.runehive.game.world.entity.mob.npc.Npc dialogueCamNpc = null
transient int dialogueCamSwapBoostTicks = 0
 While >0, camera turns use slightly faster "swap" speeds for a smoother P↔NPC flip.
DialogueFactory dialogueFactory = new DialogueFactory(this)
Stopwatch diceDelay = Stopwatch.start()
final Donation donation = new Donation(this)
final DonatorDeposit donatorDeposit = new DonatorDeposit(this)
int dragonfireCharges
long dragonfireUsed
List< EmoteUnlockableemoteUnlockable = new LinkedList<>()
int energyRate
Optional< Consumer< String > > enterInputListener = Optional.empty()
final Equipment equipment = new Equipment(this)
final Equipment equipment_copy = new Equipment(this)
final ExchangeSessionManager exchangeSession = new ExchangeSessionManager(this)
double experienceRate = Config.COMBAT_MODIFICATION
final Farming farming = new Farming(this)
Stopwatch fastFoodDelay = Stopwatch.start()
List< TeleportfavoriteTeleport = new ArrayList<>()
HashMap< WeaponInterface, FightTypefightStyles = new HashMap<>()
Stopwatch foodDelay = Stopwatch.start()
final PlayerRecord gameRecord = new PlayerRecord(this)
GemBag gemBag = new GemBag()
int giantPouch
int glovesTier
Stopwatch godwarsDelay = Stopwatch.start()
boolean hasPvPTimer
int headIcon
BrotherData hiddenBrother
final Set< String > hostList = new HashSet<>()
final House house = new House(this)
boolean idle
final InterfaceManager interfaceManager = new InterfaceManager(this)
final Inventory inventory = new Inventory(this)
final Inventory inventory_copy = new Inventory(this)
boolean isBot
Stopwatch itemDelay = Stopwatch.start()
int kill
final Killstreak killstreak = new Killstreak(this)
int largePouch
String lastClan = ""
int lastFogSent
 LMS Variables.
String lastHost
Deque< String > lastKilled = new ArrayDeque<>(3)
long lastLMSRopeCross
Teleport lastTeleport = null
long lastUsed = 0
int lmsDeaths
transient long lmsImmunity
int lmsKills
int lmsPoints
int lmsTotalDeaths
int lmsTotalKills
int lmsWins
HashMap< ActivityLog, Integer > loggedActivities
final LootingBag lootingBag = new LootingBag(this)
LinkedList< ItemlostItems = new LinkedList<>()
Set< PetDatalostPets = new HashSet<>()
final LostUntradeables lostUntradeables = new LostUntradeables(this)
int mageArenaPoints
int magmaHelmCharges
Optional< Playermanaging
int mediumPouch
int menuOpened
final MysteryBoxManager mysteryBox = new MysteryBoxManager(this)
boolean needsStarter
boolean newPlayer
Optional< OptionDialogueoptionDialogue = Optional.empty()
int optionOpened = -1
final Overrides overrides = new Overrides(this)
int pestPoints
Npc pet
Set< PetDatapetInsurance = new HashSet<>()
HashMap< AchievementKey, Integer > playerAchievements
final PlayerAssistant playerAssistant = new PlayerAssistant(this)
PlayerTitle playerTitle = PlayerTitle.empty()
int playTime
Stopwatch potionDelay = Stopwatch.start()
final PresetManager presetManager = new PresetManager(this)
final Prestige prestige = new Prestige(this)
final PriceChecker priceChecker = new PriceChecker(this)
final PlayerPunishment punishment = new PlayerPunishment(this)
final PuzzleDisplay puzzle = new PuzzleDisplay(this)
boolean pvpInstance
Stopwatch pvpTimer = Stopwatch.start()
PrayerBook quickPrayers = new PrayerBook()
RangedAmmunition rangedAmmo
RangedWeaponDefinition rangedDefinition
final PlayerRelation relations = new PlayerRelation(this)
final RequestManager requestManager = new RequestManager(this)
boolean resting
Stopwatch restoreDelay = Stopwatch.start()
Stopwatch revstele = Stopwatch.start()
PlayerRight right = PlayerRight.PLAYER
int ringOfRecoil = 40
int royalty
int royaltyLevel = 1
final RunecraftPouch runecraftPouch = new RunecraftPouch(this)
int runEnergy
final RunePouch runePouch = new RunePouch(this)
final RunePouch runePouch_copy = new RunePouch(this)
final AtomicBoolean saved = new AtomicBoolean(false)
int serpentineHelmCharges
final Settings settings = new Settings(this)
int shop
CombatSpell singleCast
int skillingPoints
Skulling skulling = new Skulling(this)
Slayer slayer = new Slayer(this)
int smallPouch
Spellbook spellbook = Spellbook.MODERN
Spellbook spellbook_copy = Spellbook.MODERN
SpellCasting spellCasting = new SpellCasting(this)
Stopwatch staffOfDeadSpecial = Stopwatch.start().reset(200)
int tanzaniteHelmCharges
final AtomicInteger teleblockTimer = new AtomicInteger(0)
int thammoranSceptreCharges
int totalVotes
final TradingPost tradingPost = new TradingPost(this)
int trapsLaid
int tridentSeasCharges
int tridentSwampCharges
List< Integer > unlockedLMSItems = new ArrayList<>()
HashSet< PrayerunlockedPrayers = new HashSet<>()
long usernameLong
String uuid
int valueIcon = -1
boolean venged
final Map< Integer, PersonalStoreviewing_shops = new HashMap<>()
final Viewport viewport = new Viewport(this)
int viggorasChainmaceCharges
int votePoints
boolean warriorGuidTask
Map< String, Positionwaypoints = new HashMap<>()
int whipCharges = 2500
int wilderness
int wintertodtPoints
Stopwatch yellDelay = Stopwatch.start()
Public Attributes inherited from com.runehive.game.world.entity.mob.Mob
ActionManager action = new ActionManager()
Activity activity
final GenericAttributes attributes = new GenericAttributes()
boolean blockFace
boolean blockInteract
Stopwatch damageImmunity = Stopwatch.start()
Position facePosition
Hit firstHit
List< Mobfollowers = new LinkedList<>()
String forceChat
ForceMovement forceMovement
boolean forceWalking
final Stopwatch freezeImmunity = Stopwatch.start()
int id = -1
boolean inTeleport
Mob interactingWith
Position lastPosition
final Locking locking = new Locking(this)
MobAnimation mobAnimation = new MobAnimation(updateFlags)
final Movement movement = new Movement(this)
transient long nextAnimation
boolean pathfinderProjectiles = false
boolean positionChange
PrayerBook prayer = new PrayerBook()
boolean regionChange
Hit secondHit
final SkillManager skills = new SkillManager(this)
final SkillManager skills_copy = new SkillManager(this)
boolean teleporting
boolean teleportRegion
Position teleportTarget
final EnumSet< UpdateFlagupdateFlags = EnumSet.noneOf(UpdateFlag.class)
Public Attributes inherited from com.runehive.game.world.entity.Entity
int instance = DEFAULT_INSTANCE

Static Public Attributes

static final AtomicInteger BOT_COUNT = new AtomicInteger(0)
Static Public Attributes inherited from com.runehive.game.world.entity.Entity
static final int DEFAULT_INSTANCE = 0

Private Member Functions

void loopCombat ()

Private Attributes

Runnable action
boolean loop
int ticks

Additional Inherited Members

Static Public Member Functions inherited from com.runehive.game.world.entity.mob.Mob
static boolean pathfinderProjectiles (Mob source)
Static Public Member Functions inherited from com.runehive.game.world.Interactable
static Interactable create (Position position)
 Creates a new instance of an Interactable.
static Interactable create (Position position, int width, int length)
 Creates a new instance of an Interactable.
Protected Member Functions inherited from com.runehive.game.world.entity.mob.Mob
void setWaypoint (Waypoint waypoint)
Protected Member Functions inherited from com.runehive.game.world.entity.Entity
Entity destroy ()
 Destroys this entity.
void setRegistered (boolean registered)
Protected Attributes inherited from com.runehive.game.world.entity.mob.Mob
Waypoint cachedWaypoint
Package Functions inherited from com.runehive.game.world.entity.mob.player.Player
CombatSpell getAutocastSpell ()
CombatSpell getSingleCastSpell ()

Detailed Description

The player bot entity.

Author
Daniel.

Definition at line 29 of file PlayerBot.java.

Constructor & Destructor Documentation

◆ PlayerBot() [1/2]

com.runehive.content.bot.PlayerBot.PlayerBot ( )

Definition at line 42 of file PlayerBot.java.

42 {
43 this(BotUtility.nameGenerator());
44 }

References com.runehive.content.bot.BotUtility.nameGenerator().

Here is the call graph for this function:

◆ PlayerBot() [2/2]

com.runehive.content.bot.PlayerBot.PlayerBot ( String name)

Definition at line 46 of file PlayerBot.java.

46 {
47 super(name);
48 setVisible(true);
49 isBot = true;
50 headIcon = -1;
51 clanTag = "";
52 clanTagColor = "";
53 newPlayer = false;
54 regionChange = true;
55 positionChange = true;
56 settings.acceptAid = false;
57 settings.autoRetaliate = true;
58 playerTitle = BotUtility.TITLE;
59 appearance = BotUtility.APPEARANCE;
60 spellbook = Spellbook.LUNAR;
61 prayer.reset();
62 mobAnimation.reset();
63 playerAssistant.setPrayer();
64 movement.setRunningToggled(true);
65 skills.setCombatLevel();
66 settings.lockExperience = true;
67 CombatSpecial.restore(this, 100);
68 }

References com.runehive.content.bot.BotUtility.APPEARANCE, com.runehive.game.world.entity.mob.player.Player.appearance, com.runehive.game.world.entity.mob.player.Player.clanTag, com.runehive.game.world.entity.mob.player.Player.clanTagColor, com.runehive.game.world.entity.mob.player.Player.headIcon, com.runehive.game.world.entity.mob.player.Player.isBot, com.runehive.content.skill.impl.magic.Spellbook.LUNAR, com.runehive.game.world.entity.mob.Mob.mobAnimation, com.runehive.game.world.entity.mob.Mob.movement, com.runehive.game.world.entity.mob.player.Player.newPlayer, com.runehive.game.world.entity.mob.player.Player.playerAssistant, com.runehive.game.world.entity.mob.player.Player.playerTitle, com.runehive.game.world.entity.mob.Mob.positionChange, com.runehive.game.world.entity.mob.Mob.prayer, com.runehive.game.world.entity.mob.Mob.regionChange, com.runehive.game.world.entity.combat.strategy.player.special.CombatSpecial.restore(), com.runehive.game.world.entity.Entity.setVisible(), com.runehive.game.world.entity.mob.Mob.skills, com.runehive.game.world.entity.mob.player.Player.spellbook, and com.runehive.content.bot.BotUtility.TITLE.

Here is the call graph for this function:

Member Function Documentation

◆ endFight()

void com.runehive.content.bot.PlayerBot.endFight ( )

Definition at line 229 of file PlayerBot.java.

229 {
230 unpoison();
231 unvenom();
232 opponent = null;
233 botClass.endFight(this);
234 getCombat().reset();
235 damageImmunity.reset(3_000);
236 if (!isDead() && getCurrentHealth() > 0) {
237 Teleportation.teleport(this, Config.DEFAULT_POSITION, 20, TeleportationData.MODERN, () -> BotObjective.WALK_TO_BANK.init(this));
238 }
239 }

References botClass, com.runehive.game.world.entity.mob.Mob.damageImmunity, com.runehive.Config.DEFAULT_POSITION, com.runehive.game.world.entity.mob.player.Player.getCombat(), com.runehive.game.world.entity.mob.Mob.getCurrentHealth(), com.runehive.game.world.entity.mob.Mob.isDead(), com.runehive.content.skill.impl.magic.teleport.TeleportationData.MODERN, opponent, com.runehive.content.skill.impl.magic.teleport.Teleportation.teleport(), com.runehive.game.world.entity.mob.Mob.unpoison(), com.runehive.game.world.entity.mob.Mob.unvenom(), and com.runehive.content.bot.objective.BotObjective.WALK_TO_BANK.

Referenced by loopCombat(), and retaliate().

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

◆ loop()

void com.runehive.content.bot.PlayerBot.loop ( int ticks,
Runnable action )

Definition at line 120 of file PlayerBot.java.

120 {
121 this.ticks = ticks;
122 this.action = action;
123 loop = true;
124 }

References action, loop, and ticks.

◆ loopCombat()

void com.runehive.content.bot.PlayerBot.loopCombat ( )
private

Definition at line 190 of file PlayerBot.java.

190 {
191 if (opponent.isDead()) {
192 schedule(4, this::endFight);
193 return;
194 }
195
196 if (foodRemaining == 0 || skills.getLevel(Skill.PRAYER) == 0) {
197 endFight();
198 return;
199 }
200
201 if (isDead() || getCurrentHealth() <= 0) {
202 speak(Utility.randomElement(BotUtility.DEATH_MESSAGES));
203 schedule(7, () -> BotObjective.WALK_TO_BANK.init(this));
204 opponent = null;
205 getCombat().reset();
206 return;
207 }
208
209 if (!getCombat().inCombat()
210 || (opponent.getCombat().isUnderAttack() && !opponent.getCombat().isUnderAttackBy(this))) {
211 endFight();
212 return;
213 }
214
215 getCombat().attack(opponent);
216
217 if (consumableDelay > 0) {
218 consumableDelay--;
219 }
220
221 if (consumableDelay == 0) {
222 botClass.pot(opponent, this);
223 botClass.eat(opponent, this);
224 }
225
226 botClass.handleCombat(opponent, this);
227 }
inline fun schedule(delay:Int=1, crossinline execute:() -> Unit)
Definition WorldTask.kt:11

References botClass, consumableDelay, com.runehive.content.bot.BotUtility.DEATH_MESSAGES, endFight(), foodRemaining, com.runehive.game.world.entity.mob.player.Player.getCombat(), com.runehive.game.world.entity.mob.Mob.getCurrentHealth(), com.runehive.game.world.entity.mob.Mob.isDead(), opponent, com.runehive.game.world.entity.skill.Skill.PRAYER, com.runehive.util.Utility.randomElement(), schedule(), com.runehive.game.world.entity.mob.Mob.skills, com.runehive.game.world.entity.mob.Mob.speak(), and com.runehive.content.bot.objective.BotObjective.WALK_TO_BANK.

Referenced by sequence().

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

◆ pause()

void com.runehive.content.bot.PlayerBot.pause ( int ticks)

Definition at line 126 of file PlayerBot.java.

126 {
127 this.ticks += ticks;
128 }

References ticks.

◆ postDeath()

void com.runehive.content.bot.PlayerBot.postDeath ( )

Definition at line 154 of file PlayerBot.java.

154 {
155 move(Config.DEFAULT_POSITION);
156 skills.restoreAll();
157 equipment.login();
158 playerAssistant.reset();
159 setSpecialActivated(false);
160 getCombat().getDamageCache().clear();
161 CombatSpecial.restore(this, 100);
162 movement.reset();
163 teleblockTimer.set(0);
164 schedule(2, () -> BotObjective.WALK_TO_BANK.init(this));
165 }

References com.runehive.Config.DEFAULT_POSITION, com.runehive.game.world.entity.mob.player.Player.equipment, com.runehive.game.world.entity.mob.player.Player.getCombat(), com.runehive.game.world.entity.mob.Mob.move(), com.runehive.game.world.entity.mob.Mob.movement, com.runehive.game.world.entity.mob.player.Player.playerAssistant, com.runehive.game.world.entity.combat.strategy.player.special.CombatSpecial.restore(), schedule(), com.runehive.game.world.entity.mob.player.Player.setSpecialActivated(), com.runehive.game.world.entity.mob.Mob.skills, com.runehive.game.world.entity.mob.player.Player.teleblockTimer, and com.runehive.content.bot.objective.BotObjective.WALK_TO_BANK.

Here is the call graph for this function:

◆ pot()

void com.runehive.content.bot.PlayerBot.pot ( Mob opponent,
ItemClickEvent event,
PotionData potion )

Definition at line 134 of file PlayerBot.java.

134 {
135 if (!potion.canDrink(this)) {
136 return;
137 }
138
139 animate(new Animation(829, UpdatePriority.LOW));
140 potionDelay.reset();
141
142 Item replace = PotionData.getReplacementItem(event.getItem());
143
144 if (replace.getId() == 229) {
145 inventory.remove(event.getItem());
146 } else {
147 inventory.replace(event.getItem().getId(), replace.getId(), event.getSlot(), true);
148 }
149
150 potion.onEffect(this);
151 getCombat().attack(opponent);
152 }

References com.runehive.game.world.entity.mob.Mob.animate(), com.runehive.content.consume.PotionData.canDrink(), com.runehive.game.world.entity.mob.player.Player.getCombat(), com.runehive.game.world.items.Item.getId(), com.runehive.content.consume.PotionData.getReplacementItem(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.UpdatePriority.LOW, com.runehive.content.consume.PotionData.onEffect(), opponent, and com.runehive.game.world.entity.mob.player.Player.potionDelay.

Here is the call graph for this function:

◆ register()

void com.runehive.content.bot.PlayerBot.register ( )

Registers an entity to the World.

Reimplemented from com.runehive.game.world.entity.mob.player.Player.

Definition at line 71 of file PlayerBot.java.

71 {
72 if (!isRegistered() && !World.getPlayers().contains(this)) {
73 setRegistered(World.getPlayers().add(this));
74 setPosition(getPosition());
75 BOT_COUNT.incrementAndGet();
76 }
77 }

References BOT_COUNT, com.runehive.game.world.World.getPlayers(), com.runehive.game.world.entity.Entity.getPosition(), com.runehive.game.world.entity.Entity.isRegistered(), com.runehive.game.world.entity.Entity.setPosition(), and com.runehive.game.world.entity.Entity.setRegistered().

Referenced by com.runehive.game.task.impl.BotStartupEvent.tick().

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

◆ retaliate()

void com.runehive.content.bot.PlayerBot.retaliate ( Player defender)

Definition at line 167 of file PlayerBot.java.

167 {
168 if (getCombat().isAttacking() && !getCombat().isAttacking(defender)) {
169 endFight();
170 return;
171 }
172
173 if (defender.getCombat().isUnderAttack() && !defender.getCombat().isUnderAttackBy(this)) {
174 endFight();
175 return;
176 }
177
178 if (opponent != null && opponent.equals(defender)) {
179 return;
180 }
181
182 if (opponent != null && !opponent.equals(defender)) {
183 endFight();
184 return;
185 }
186
187 BotObjective.COMBAT.init(this);
188 }

References com.runehive.content.bot.objective.BotObjective.COMBAT, endFight(), com.runehive.game.world.entity.mob.player.Player.getCombat(), opponent, and com.runehive.game.world.entity.mob.player.Player.Player().

Here is the call graph for this function:

◆ schedule()

void com.runehive.content.bot.PlayerBot.schedule ( int ticks,
Runnable action )

Definition at line 114 of file PlayerBot.java.

114 {
115 this.ticks = ticks;
116 this.action = action;
117 loop = false;
118 }

References action, loop, and ticks.

Referenced by loopCombat(), and postDeath().

Here is the caller graph for this function:

◆ sequence()

void com.runehive.content.bot.PlayerBot.sequence ( )

Reimplemented from com.runehive.game.world.entity.mob.player.Player.

Definition at line 95 of file PlayerBot.java.

95 {
96 super.sequence();
97
98 if (ticks > 0) {
99 ticks--;
100 }
101
102 if (ticks == 0 && action != null) {
103 Runnable tmp = action;
104 action.run();
105 if (!loop && action == tmp)
106 action = null;
107 }
108
109 if (opponent != null) {
110 loopCombat();
111 }
112 }

References action, loop, loopCombat(), opponent, and ticks.

Here is the call graph for this function:

◆ stopLoop()

void com.runehive.content.bot.PlayerBot.stopLoop ( )

Definition at line 130 of file PlayerBot.java.

130 {
131 loop = false;
132 }

References loop.

◆ unregister()

void com.runehive.content.bot.PlayerBot.unregister ( )

Unregisters an entity from the World.

Reimplemented from com.runehive.game.world.entity.mob.player.Player.

Definition at line 80 of file PlayerBot.java.

80 {
81 if (!isRegistered()) {
82 return;
83 }
84
85 if (!World.getPlayers().contains(this)) {
86 return;
87 }
88
89 World.cancelTask(this, true);
90 World.getPlayers().remove((Player) destroy());
91 BOT_COUNT.decrementAndGet();
92 }

References BOT_COUNT, com.runehive.game.world.World.cancelTask(), com.runehive.game.world.entity.Entity.destroy(), com.runehive.game.world.World.getPlayers(), com.runehive.game.world.entity.Entity.isRegistered(), and com.runehive.game.world.entity.mob.player.Player.Player().

Here is the call graph for this function:

Member Data Documentation

◆ action

Runnable com.runehive.content.bot.PlayerBot.action
private

Definition at line 33 of file PlayerBot.java.

Referenced by loop(), schedule(), and sequence().

◆ BOT_COUNT

final AtomicInteger com.runehive.content.bot.PlayerBot.BOT_COUNT = new AtomicInteger(0)
static

Definition at line 30 of file PlayerBot.java.

Referenced by com.runehive.game.world.World.getBotCount(), register(), and unregister().

◆ botClass

BotClass com.runehive.content.bot.PlayerBot.botClass

Definition at line 37 of file PlayerBot.java.

Referenced by endFight(), and loopCombat().

◆ consumableDelay

int com.runehive.content.bot.PlayerBot.consumableDelay

Definition at line 40 of file PlayerBot.java.

Referenced by loopCombat().

◆ foodRemaining

int com.runehive.content.bot.PlayerBot.foodRemaining

Definition at line 35 of file PlayerBot.java.

Referenced by loopCombat().

◆ loop

boolean com.runehive.content.bot.PlayerBot.loop
private

Definition at line 34 of file PlayerBot.java.

Referenced by loop(), schedule(), sequence(), and stopLoop().

◆ opponent

Player com.runehive.content.bot.PlayerBot.opponent

Definition at line 38 of file PlayerBot.java.

Referenced by endFight(), loopCombat(), pot(), retaliate(), and sequence().

◆ statBoostersRemaining

int com.runehive.content.bot.PlayerBot.statBoostersRemaining

Definition at line 36 of file PlayerBot.java.

◆ ticks

int com.runehive.content.bot.PlayerBot.ticks
private

Definition at line 32 of file PlayerBot.java.

Referenced by loop(), pause(), schedule(), and sequence().


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