fix/bot-rotation-and-pk-idle #216
No reviewers
Labels
No labels
bug
ci-cd
client
epic:security-hardening
feature
optimization
priority:high
priority:low
priority:medium
server
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
BlackLobster/Server!216
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bot-rotation-and-pk-idle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Three field reports (bots idling at fishing spots in full battle gear, PKers trash-talking in the wild without ever fighting, staff-wielding bots piling up at the river by Barbarian Village), four root causes: - The PKer chain's earn leg was a bare `{FishAndBank, %{target: 2}}`: no `:relocate`/`:equipment`, so the transition hook never fired — no teleport, no gear swap, PK inventory kept. The bot then walked to the nearest spot with any catchable fish because `find_fishable_spot` ignored `tool_id` — from Edgeville that's the Barbarian Village fly spot, where the net-carrying bot's "Lure" is refused on every cast. The `:fishing` stall counter could never trip either: `find_npc` zeroes `ticks` on each interact, so the fishing→find_npc retry bounce pinned it at <=1 and the bot froze at the waterline forever (the river pile-up from the screenshots, reproduced at the exact tile). New `Rotation.earn_task/0` builds the earn leg from a net fisher spread entry (level-1 fishing works for any rolled Fishing level) with relocate/outfit/target, filtered to gate-free bank->spot legs — the transition banks the whole pack, so a broke retiree wedges at the Al Kharid toll gate if routed through it. `entry_casts` deposits the backpack on teleporting transitions; the PK config gains `:relocate` so the loop restart teleports back to its restock bank. FishAndBank gains the tool gate and a `start_attempts` counter that survives the find_npc bounce, so a spot that refuses to start rotates instead of freezing. - `killed_target?` counted any cleared combat target as a kill while the victim stood alive in the MovementAuthority — every dropped fight (flee, single-combat lock) fired kill trash-talk and credited phantom `kill_reward` coins, so `coins_earned` outran spend and `budget_exhausted?` never rotated the bot out. Kills now confirm via the shared `CombatBrain.confirmed_kill?/1` (MA dead-or-gone only); ScavengeAndRush had the same bug. - An aggressive wilderness NPC poking a PKer holds `last_attacker` at the NPC, so every player engage was dropped by the attacker-busy single-combat gate — an endless engage/fake-kill chatter loop over a fight that could never start. Roaming now holds while NPC-engaged (server retaliation clears the skeleton) and fighting bails out instead of running the player-fight brain against an NPC. - The `head_to_bank` legs in PkAndRestock and LootAndAlch re-issue walks forever with no give-up; a bot at an unreachable pocket stood for good. Eight fully-stationary goal ticks on a bank leg now recover to the nearest hub. Also swept up while in there: - `{:bot_deposit_equipment_slot, ...}` had no handle_cast clause — RunecraftAndBank's tiara return crashed the bot outright. Added the handler + `BotHandlers.deposit_equipment_slot/3` (economy deposit, slot/id-matched, no-op otherwise). Its tiara equip also used `bot_equip_set`, which replaces the whole loadout — the runecrafter ended up wearing nothing but a tiara; now `bot_equip_batch`. - `Locations.match_route` accepted tolerance-matched slices that end no closer to the destination than the bot already stands — a 15-tile Draynor bank->spot hop matched a passing Draynor->Barbarian long-haul route and marched the bot 100 tiles north first. A slice must now improve on the current distance. Verified live: a budget-exhausted mager retires at the bank, teleports to a net hub, swaps into casual clothes, banks its kit leftovers, and net-fishes; two equal-level PKers still fight to a finish.191dcc308548e56e555e