Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Auto-detect and use character specific hotkeys via key file #905

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
07d1eb4
Add wip
Ezro Jun 18, 2022
400f193
Add wip code
Ezro Jun 18, 2022
bc74cac
Refactor the code and add more wip code
Ezro Jun 18, 2022
2da5dca
Add assassin and druid skill templates
Ezro Jun 18, 2022
27c6185
Add druid skills and fix typo
Ezro Jun 18, 2022
7690138
Fix bug and remove debug line
Ezro Jun 18, 2022
2cf4031
Remove debug file
Ezro Jun 18, 2022
bb078a4
Add missing key_file param
Ezro Jun 18, 2022
afca71d
Uncomment template_finder inverse mask and shift dependency to avoid …
Ezro Jun 18, 2022
f0b6c01
Update more keyboard.sends to use hotkeys
Ezro Jun 20, 2022
76b1fe9
Remove param hotkeys and update more refs from _skill_hotkeys to hotkeys
Ezro Jun 20, 2022
c8ecc57
Fix rebase
Ezro Jun 20, 2022
684c1d6
Fix bugs in hotkey detection logic
Ezro Jun 20, 2022
2dc8e4b
Fix more bugs
Ezro Jun 20, 2022
3e39691
Switch log to info from debug
Ezro Jun 20, 2022
d12bce2
Fix key parsing bug
Ezro Jun 20, 2022
16c7ace
Fix copy / paste typos
Ezro Jun 20, 2022
12dc9cd
Add back logic from master and remove debug line
Ezro Jun 20, 2022
858b207
Fix more do_release to do_press
Ezro Jun 20, 2022
20de9d8
Abstract hotkey deduction to a helper fn and add a comment for discov…
Ezro Jun 21, 2022
8bda872
Add comment for SkillName
Ezro Jun 21, 2022
276f63e
Add comments for hotkeys.py variables
Ezro Jun 21, 2022
0ef8c64
Rename _deduce_hotkey to _deduce_hotkeys
Ezro Jun 21, 2022
f6e4ede
Add docstring for HotkeyName
Ezro Jun 21, 2022
dca4497
Remove stored_templates_by_dir(), add dir lookup to stored_templates,…
Ezro Jun 21, 2022
1955cf3
Add first_match flag to search_all and remove search_all_templates
Ezro Jun 21, 2022
169862d
Remove key_name from 'Detecting Hotkeys' print and update select_tp t…
Ezro Jun 21, 2022
94d8418
Uncomment debug code to reduce delta
Ezro Jun 21, 2022
2e58a69
first_match to best_match and update search_all docstring
Ezro Jun 23, 2022
68504f0
Fix typo
Ezro Jun 23, 2022
a65a87b
Add Zon skill templates and SkillName mapping
Ezro Jun 23, 2022
a7816bb
Add handling for tilde hotkey
Ezro Jun 23, 2022
8e8b2dd
Add comments for key_file
Ezro Jun 23, 2022
3e47fcd
Update README to include hotkey auto-detection
Ezro Jun 23, 2022
7af599e
Add capslock mapping
Ezro Jun 23, 2022
ebd3d29
Fix fn key mapping and slow down _find_keymapping
Ezro Jun 23, 2022
73ac248
Update battle_command template
Ezro Jun 23, 2022
3c28fb4
Fix KeyError when not using teleport on start_from_town
Ezro Jun 24, 2022
6d57f85
Add more None handling
Ezro Jun 24, 2022
c1d0ddf
Update basic_ranged
Ezro Jun 24, 2022
6d6fc7d
Add seams for auto-starting d2r
Ezro Jun 25, 2022
b0036e5
Find saved games folder when not provided
Ezro Jun 25, 2022
4a40fb4
Remove validation from find_d2r_folder()
Ezro Jun 25, 2022
e3e59a0
Fix selecting online chars
Ezro Jun 26, 2022
8124b01
Fix bug in _find_keymapping and switch back to old select_online_tab …
Ezro Jun 26, 2022
cb01179
Revert back to origin select_char logic
Ezro Jun 26, 2022
c57c8ce
Update TownPortal ScreenObject ref
Ezro Jun 26, 2022
4b1fa52
Check if OnlineStatus before select_online_tab
Ezro Jun 26, 2022
50b3e92
Switch pather and i_char move back to original logic
Ezro Jun 27, 2022
7f3ec49
Fix issue #951 (prevent sorc from using telekinesis when entering A5_…
Ezro Jun 27, 2022
4e18c84
Move discovered flag into hotkeys
Ezro Jun 27, 2022
b3d72db
Add missing bot.py update for previous commit
Ezro Jun 27, 2022
30f3f52
Revert sorc select_by_template TK logic back to master
Ezro Jun 27, 2022
39c47db
add search_all(best_match=True) test
aliig Jun 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ All settings will automatically be set when you execute `main.exe` and press the

### 2) Supported builds

Check the documentation for **params.ini** further down. Different Sorc builds, Hammerdin, Barb, Trapsin are already implemented to different extents. It is quite straightforward to implement new classes. Give it a go if you like!
Botty will auto-detect hotkeys for the character using **params.ini** saved_games_folder and key_file and use the **params.ini** type to "pilot" the character.

The logic for "piloting", as well as supported **params.ini** types can be found in the [char folder](https://github.com/bottytools/botty/tree/master/src/char).

### 3) Start Location

Expand Down Expand Up @@ -82,6 +84,7 @@ order=run_pindle, run_eldritch
| name | Name used in terminal and discord messages. |
| randomize_runs | Randomize the order of `[routes]` specified in `params.ini`. |
| saved_games_folder | [Optional] Defaults to `~\Saved Games\Diablo II Resurrected`. Used to store configuration settings for `f9` / auto settings. |
| key_file | Key(o) file for the character (found in the Saved Games folder). 'key' is offline characters, 'keyo' is online characters. Some online characters may have a hash added to them: Paladin53672482.keyo. |
| custom_loot_message_hook | Add your message hook here (such as Discord channel) to get info about loot |
| custom_message_hook | Add your message hook here (such as Discord channel) to get info about botty status updates, discord webhook is default. |
| discord_log_chicken | Set to `1` to enable messages about bot chickens, `0` to disable. |
Expand Down
Binary file added assets/templates/ui/skills/amplify_damage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/arctic_blast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/armageddon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/attack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/attract.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/bash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/battle_command.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/battle_cry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/battle_orders.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/templates/ui/skills/bc.png
Binary file not shown.
Binary file added assets/templates/ui/skills/berserk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blade_fury.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blade_sentinel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blade_shield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blades_of_ice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blaze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blessed_aim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blessed_hammer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blizzard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/blood_golem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/templates/ui/skills/bo.png
Binary file not shown.
Binary file added assets/templates/ui/skills/bone_armor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/bone_prison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/bone_spear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/bone_spirit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/templates/ui/skills/bone_wall.png
Binary file added assets/templates/ui/skills/burst_of_speed.png
Binary file added assets/templates/ui/skills/carrion_vine.png
Binary file added assets/templates/ui/skills/chain_lightning.png
Binary file added assets/templates/ui/skills/charge.png
Binary file added assets/templates/ui/skills/charged_bolt.png
Binary file added assets/templates/ui/skills/charged_strike.png
Binary file added assets/templates/ui/skills/chilling_armor.png
Binary file added assets/templates/ui/skills/claw_of_thunder.png
Binary file added assets/templates/ui/skills/clay_golem.png
Binary file added assets/templates/ui/skills/cleansing.png
Binary file added assets/templates/ui/skills/cloak_of_shadows.png
Binary file added assets/templates/ui/skills/cobra_strike.png
Binary file added assets/templates/ui/skills/cold_arrow.png
Binary file added assets/templates/ui/skills/concentrate.png
Binary file added assets/templates/ui/skills/concentration.png
Binary file added assets/templates/ui/skills/confuse.png
Binary file added assets/templates/ui/skills/conversion.png
Binary file added assets/templates/ui/skills/conviction.png
Binary file added assets/templates/ui/skills/corpse_explosion.png
Binary file added assets/templates/ui/skills/cyclone_armor.png
Binary file added assets/templates/ui/skills/death_sentry.png
Binary file added assets/templates/ui/skills/decoy.png
Binary file added assets/templates/ui/skills/decrepify.png
Binary file added assets/templates/ui/skills/defiance.png
Binary file added assets/templates/ui/skills/dim_vision.png
Binary file added assets/templates/ui/skills/double_swing.png
Binary file added assets/templates/ui/skills/double_throw.png
Binary file added assets/templates/ui/skills/dragon_claw.png
Binary file added assets/templates/ui/skills/dragon_flight.png
Binary file added assets/templates/ui/skills/dragon_tail.png
Binary file added assets/templates/ui/skills/dragon_talon.png
Binary file added assets/templates/ui/skills/enchant.png
Binary file added assets/templates/ui/skills/energy_shield.png
Binary file added assets/templates/ui/skills/exploding_arrow.png
Binary file added assets/templates/ui/skills/fade.png
Binary file added assets/templates/ui/skills/fanaticism.png
Binary file added assets/templates/ui/skills/fend.png
Binary file added assets/templates/ui/skills/feral_rage.png
Binary file added assets/templates/ui/skills/find_item.png
Binary file added assets/templates/ui/skills/find_potion.png
Binary file added assets/templates/ui/skills/fire_arrow.png
Binary file added assets/templates/ui/skills/fire_blast.png
Binary file added assets/templates/ui/skills/fire_bolt.png
Binary file added assets/templates/ui/skills/fire_claws.png
Binary file added assets/templates/ui/skills/fire_golem.png
Binary file added assets/templates/ui/skills/fireball.png
Binary file added assets/templates/ui/skills/firestorm.png
Binary file added assets/templates/ui/skills/firewall.png
Binary file added assets/templates/ui/skills/fissure.png
Binary file added assets/templates/ui/skills/fists_of_fire.png
Binary file added assets/templates/ui/skills/freezing_arrow.png
Binary file added assets/templates/ui/skills/frenzy.png
Binary file added assets/templates/ui/skills/frost_nova.png
Binary file added assets/templates/ui/skills/frozen_armor.png
Binary file added assets/templates/ui/skills/frozen_orb.png
Binary file added assets/templates/ui/skills/fury.png
Binary file added assets/templates/ui/skills/glacial_spike.png
Binary file added assets/templates/ui/skills/grim_ward.png
Binary file added assets/templates/ui/skills/guided_arrow.png
Binary file added assets/templates/ui/skills/heart_of_wolverine.png
Binary file added assets/templates/ui/skills/holy_bolt.png
Binary file added assets/templates/ui/skills/holy_fire.png
Binary file added assets/templates/ui/skills/holy_freeze.png
Binary file added assets/templates/ui/skills/holy_shield.png
Binary file added assets/templates/ui/skills/holy_shock.png
Binary file added assets/templates/ui/skills/howl.png
Binary file added assets/templates/ui/skills/hunger.png
Binary file added assets/templates/ui/skills/hurricane.png
Binary file added assets/templates/ui/skills/hydra.png
Binary file added assets/templates/ui/skills/ice_arrow.png
Binary file added assets/templates/ui/skills/ice_blast.png
Binary file added assets/templates/ui/skills/ice_bolt.png
Binary file added assets/templates/ui/skills/impale.png
Binary file added assets/templates/ui/skills/inferno.png
Binary file added assets/templates/ui/skills/inner_sight.png
Binary file added assets/templates/ui/skills/iron_golem.png
Binary file added assets/templates/ui/skills/iron_maiden.png
Binary file added assets/templates/ui/skills/jab.png
Binary file modified assets/templates/ui/skills/leap.png
Binary file added assets/templates/ui/skills/leap_attack.png
Binary file added assets/templates/ui/skills/left_hand_throw.png
Binary file added assets/templates/ui/skills/life_tap.png
Binary file added assets/templates/ui/skills/lightning.png
Binary file added assets/templates/ui/skills/lightning_bolt.png
Binary file added assets/templates/ui/skills/lightning_fury.png
Binary file added assets/templates/ui/skills/lightning_sentry.png
Binary file added assets/templates/ui/skills/lightning_strike.png
Binary file added assets/templates/ui/skills/lower_resist.png
Binary file added assets/templates/ui/skills/magic_arrow.png
Binary file added assets/templates/ui/skills/maul.png
Binary file added assets/templates/ui/skills/meditation.png
Binary file added assets/templates/ui/skills/meteor.png
Binary file added assets/templates/ui/skills/might.png
Binary file added assets/templates/ui/skills/mind_blast.png
Binary file added assets/templates/ui/skills/molten_boulder.png
Binary file added assets/templates/ui/skills/multiple_shot.png
Binary file added assets/templates/ui/skills/nova.png
Binary file added assets/templates/ui/skills/oak_sage.png
Binary file added assets/templates/ui/skills/phoenix_strike.png
Binary file added assets/templates/ui/skills/plague_javelin.png
Binary file added assets/templates/ui/skills/poison_creeper.png
Binary file added assets/templates/ui/skills/poison_dagger.png
Binary file added assets/templates/ui/skills/poison_explosion.png
Binary file added assets/templates/ui/skills/poison_javelin.png
Binary file added assets/templates/ui/skills/poison_nova.png
Binary file added assets/templates/ui/skills/power_strike.png
Binary file added assets/templates/ui/skills/prayer.png
Binary file added assets/templates/ui/skills/psychic_hammer.png
Binary file added assets/templates/ui/skills/rabies.png
Binary file added assets/templates/ui/skills/raise_skeleton.png
Binary file added assets/templates/ui/skills/raven.png
Binary file added assets/templates/ui/skills/redemption.png
Binary file added assets/templates/ui/skills/resist_cold.png
Binary file added assets/templates/ui/skills/resist_fire.png
Binary file added assets/templates/ui/skills/resist_lightning.png
Binary file added assets/templates/ui/skills/revive.png
Binary file added assets/templates/ui/skills/sacrifice.png
Binary file added assets/templates/ui/skills/salvation.png
Binary file added assets/templates/ui/skills/sanctuary.png
Binary file added assets/templates/ui/skills/shadow_master.png
Binary file added assets/templates/ui/skills/shadow_warrior.png
Binary file added assets/templates/ui/skills/shiver_armor.png
Binary file added assets/templates/ui/skills/shock_wave.png
Binary file added assets/templates/ui/skills/shock_web.png
Binary file added assets/templates/ui/skills/shout.png
Binary file added assets/templates/ui/skills/slow_missiles.png
Binary file added assets/templates/ui/skills/smite.png
Binary file added assets/templates/ui/skills/solar_creeper.png
Binary file added assets/templates/ui/skills/spirit_of_barbs.png
Binary file added assets/templates/ui/skills/static_field.png
Binary file added assets/templates/ui/skills/strafe.png
Binary file added assets/templates/ui/skills/stun.png
Binary file added assets/templates/ui/skills/summon_dire_wolf.png
Binary file added assets/templates/ui/skills/summon_grizzly.png
Binary file added assets/templates/ui/skills/summon_spirit_wolf.png
Binary file added assets/templates/ui/skills/taunt.png
Binary file added assets/templates/ui/skills/teeth.png
Binary file removed assets/templates/ui/skills/tele_active.png
Diff not rendered.
Binary file removed assets/templates/ui/skills/tele_inactive.png
Diff not rendered.
Binary file added assets/templates/ui/skills/telekinesis.png
Binary file added assets/templates/ui/skills/teleport.png
Binary file added assets/templates/ui/skills/terror.png
Binary file added assets/templates/ui/skills/thorns.png
Binary file added assets/templates/ui/skills/throw.png
Binary file added assets/templates/ui/skills/thunder_storm.png
Binary file added assets/templates/ui/skills/tiger_strike.png
Binary file added assets/templates/ui/skills/tornado.png
Binary file removed assets/templates/ui/skills/tp_inactive.png
Diff not rendered.
Binary file added assets/templates/ui/skills/twister.png
Binary file added assets/templates/ui/skills/unsummon.png
Binary file added assets/templates/ui/skills/valkyrie.png
Binary file added assets/templates/ui/skills/vengeance.png
Binary file added assets/templates/ui/skills/venom.png
Binary file modified assets/templates/ui/skills/vigor.png
Binary file added assets/templates/ui/skills/volcano.png
Binary file added assets/templates/ui/skills/wake_of_fire.png
Binary file added assets/templates/ui/skills/wake_of_inferno.png
Binary file added assets/templates/ui/skills/war_cry.png
Binary file added assets/templates/ui/skills/weaken.png
Binary file added assets/templates/ui/skills/werebear.png
Binary file added assets/templates/ui/skills/werewolf.png
Binary file added assets/templates/ui/skills/whirlwind.png
Binary file added assets/templates/ui/skills/zeal.png
4 changes: 2 additions & 2 deletions config/game.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ tp_search=353,120,547,400
repair_btn=318,473,90,80
left_inventory=35,92,378,378
right_inventory=866,348,379,152
skill_right=664,673,41,41
skill_right=664,673,45,45
skill_right_expanded=655,375,385,255
skill_left=574,673,41,41
skill_left=574,673,45,45
main_menu_top_left=0,0,100,100
gamebar_anchor=600,650,90,90
gamebar_belt_expandable=792,659,28,28
Expand Down
91 changes: 2 additions & 89 deletions config/params.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ difficulty=hell
name=Botty
randomize_runs=0
saved_games_folder=
; key_file should be the key(o) file for the character (found in the Saved Games folder). 'key' is offline characters, 'keyo' is online characters. Some online characters may have a hash added to them: Paladin53672482.keyo.
key_file=

; messaging
custom_loot_message_hook=
Expand Down Expand Up @@ -55,26 +57,6 @@ safer_routines=0
; Store charms, etc. to the right of the inventory.
num_loot_columns=5

; game hotkeys:
force_move=e
inventory_screen=i
potion1=1
potion2=2
potion3=3
potion4=4
; show_belt is different from the default hotkey as "~" is for many keyboards not reachable without also pressing altgr
show_belt=k
show_items=alt
; stand_still cannot be the default "shift" as it would interfere with merc healing
stand_still=capslock
; teleport: leave empty if you can't use
teleport=
town_portal=f9
; call to arms settings:
weapon_switch=x
battle_orders=f7
battle_command=f8

; ==========================
; ==== Optional configs ====
; ==========================
Expand Down Expand Up @@ -140,69 +122,32 @@ transmute_every_x_game=20
; ==== Builds: Sorceress ====
; ===========================
[sorceress]
energy_shield=
frozen_armor=
static_field=
telekinesis=
thunder_storm=

[light_sorc]
; chain_lightning must be bound to left skill (hotkey optional as it shouldnt change)
chain_lightning=
; lightning must be right skill, hotkey required
lightning=
; frozen orb must be right skill, hotkey recommended to increase safty for you and merc at trav!
frozen_orb=

[blizz_sorc]
; blizzard must be right skill, hotkey required
blizzard=
; ice_blast must be left skill (hotkey optional as it shouldnt change)
ice_blast=

[nova_sorc]
; nova must be right skill, hotkey required
nova=

[hydra_sorc]
; only supports Pindle and Eldritch currently
; alt_attack is any alternate attacking right skill. Fireball,Lightning,Frozen Orb, hotkey required
alt_attack=
; hydra must be right skill, hotkey required
hydra=

; =========================
; ==== Builds: Paladin ====
; =========================
[paladin]
cleansing=
holy_shield=
redemption=
vigor=

[fohdin]
; foh must be left skill, hotkey required
blessed_hammer=
concentration=
conviction=
foh=
holy_bolt=

[hammerdin]
blessed_hammer=
concentration=


; ==========================
; ==== Builds: Assassin ====
; ==========================
; Currently no Trav implementaiton!
[trapsin]
burst_of_speed=
death_sentry=
fade=
lightning_sentry=
shadow_warrior=
skill_left=


Expand All @@ -214,10 +159,6 @@ skill_left=
; Ensure Battle Order/Command hotkeys are set above in the [char] section
[barbarian]
cry_frequency=0.7
find_item=
leap=
shout=
war_cry=


; ==========================
Expand All @@ -231,40 +172,12 @@ war_cry=
;recomended to set skeleton mage to same as revive hot hey
;skeleton mages cause pathing issues not ideal to use yet
[necro]
amp_dmg=
bone_armor=
clay_golem=
clear_pindle_pack=
corpse_explosion=
heart_of_wolverine=
raise_mage=
raise_revive=
raise_skeleton=
skill_left=

[poison_necro]
bone_armor=
# Can use any golem
clay_golem=
clear_pindle_pack=
corpse_explosion=
heart_of_wolverine=
# Can Use any curse
lower_res=
poison_nova=
raise_mage=
raise_revive=
raise_skeleton=
# Not Required
skill_left=

[bone_necro]
bone_armor=
bone_spear=
bone_spirit=
bone_wall=
clay_golem=
teeth=
; Damage scaling. One setting to adjust kill speed to account for better/worse gear.
; ex: 2 will cast all attack skills twice a long, .5 half as long. Currently only used by bone necro
damage_scaling=1
Expand Down
29 changes: 20 additions & 9 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from health_manager import set_pause_state
from transmute import Transmute
from utils import hotkeys
from utils.misc import wait, hms
from utils.restart import safe_exit, restart_game
from game_stats import GameStats
Expand All @@ -34,6 +35,7 @@
from char.basic_ranged import Basic_Ranged
from ui_manager import wait_until_hidden, wait_until_visible, ScreenObjects, is_visible, detect_screen_object
from ui import meters, skills, view, character_select, main_menu
from ui.skills import SkillName
from inventory import personal, vendor, belt, common

from run import Pindle, ShenkEld, Trav, Nihlathak, Arcane, Diablo
Expand Down Expand Up @@ -218,7 +220,8 @@ def _rebuild_as_asset_to_trigger(trigger_to_assets: dict):

def on_init(self):
self._game_stats.log_start_game()
keyboard.release(Config().char["stand_still"])
if hotkeys.HotkeyName.StandStill in hotkeys.d2r_keymap:
keyboard.release(hotkeys.d2r_keymap[hotkeys.HotkeyName.StandStill])
transition_to_screens = Bot._rebuild_as_asset_to_trigger({
"select_character": main_menu.MAIN_MENU_MARKERS,
"start_from_town": town_manager.TOWN_MARKERS,
Expand Down Expand Up @@ -248,7 +251,7 @@ def on_create_game(self):
# Start a game from hero selection
if (m := wait_until_visible(ScreenObjects.MainMenu)).valid:
if "DARK" in m.name:
keyboard.send("esc")
keyboard.send(hotkeys.d2r_keymap[hotkeys.HotkeyName.OpenMenu])
main_menu.start_game()
view.move_to_corpse()
else:
Expand All @@ -257,19 +260,27 @@ def on_create_game(self):

def on_start_from_town(self):
self._curr_loc = self._town_manager.wait_for_town_spawn()

# Handle picking up corpse in case of death
if (corpse_present := is_visible(ScreenObjects.Corpse)):
self._previous_run_failed = True
view.pickup_corpse()
wait_until_hidden(ScreenObjects.Corpse)
belt.fill_up_belt_from_inventory(Config().char["num_loot_columns"])
if not hotkeys.discovered:
saved_games_folder = Config().general["saved_games_folder"]
key_file = Config().general["key_file"]
hotkeys.discover_hotkey_mappings(saved_games_folder, key_file)
self._char.discover_capabilities()
if corpse_present and self._char.capabilities.can_teleport_with_charges and not self._char.select_tp():
keybind = Config().char["teleport"]
teleport_selected = skills.select_tp(hotkeys.right_skill_key_map[SkillName.Teleport]) if SkillName.Teleport in hotkeys.right_skill_key_map else None
if corpse_present and self._char.capabilities.can_teleport_with_charges and not teleport_selected:
keybind = hotkeys.right_skill_key_map[SkillName.Teleport]
Logger.info(f"Teleport keybind is lost upon death. Rebinding teleport to '{keybind}'")
self._char.remap_right_skill_hotkey("TELE_ACTIVE", Config().char["teleport"])

hotkeys.remap_skill_hotkey(
SkillName.Teleport.value,
keybind,
Config().ui_roi["skill_right"],
Config().ui_roi["skill_right_expanded"]
)
# Run /nopickup command to avoid picking up stuff on accident
if Config().char["enable_no_pickup"] and (not self._ran_no_pickup and not self._game_stats._nopickup_active):
self._ran_no_pickup = True
Expand All @@ -286,7 +297,6 @@ def on_start_from_town(self):
def on_maintenance(self):
# Pause health manager if not already paused
set_pause_state(True)

# Dismiss skill/quest/help/stats icon if they are on screen
if not view.dismiss_skills_icon():
view.return_to_play()
Expand Down Expand Up @@ -368,7 +378,8 @@ def on_maintenance(self):
# Check if we are out of tps or need repairing
need_repair = is_visible(ScreenObjects.NeedRepair)
need_routine_repair = False if not Config().char["runs_per_repair"] else self._game_stats._run_counter % Config().char["runs_per_repair"] == 0
need_refill_teleport = self._char.capabilities.can_teleport_with_charges and (not self._char.select_tp() or self._char.is_low_on_teleport_charges())
teleport_selected = skills.select_tp(hotkeys.right_skill_key_map[SkillName.Teleport]) if SkillName.Teleport in hotkeys.right_skill_key_map else None
need_refill_teleport = self._char.capabilities.can_teleport_with_charges and (not teleport_selected or self._char.is_low_on_teleport_charges())
if need_repair or need_routine_repair or need_refill_teleport or sell_items:
if need_repair:
Logger.info("Repair needed. Gear is about to break")
Expand Down
28 changes: 14 additions & 14 deletions src/char/barbarian.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import keyboard
from ui import skills
from ui.skills import SkillName, is_left_skill_selected, is_right_skill_active
from utils import hotkeys
from utils.custom_mouse import mouse
from char import IChar, CharacterCapabilities
import template_finder
from pather import Pather
from logger import Logger
from screen import convert_abs_to_monitor
Expand All @@ -24,10 +24,10 @@ def _cast_war_cry(self, time_in_s: float):
# keyboard.send(self._skill_hotkeys["concentration"])
# wait(0.05, 0.1)
cry_frequency = min(0.2, self._skill_hotkeys["cry_frequency"])
keyboard.send(Config().char["stand_still"], do_release=False)
keyboard.send(hotkeys.d2r_keymap[hotkeys.HotkeyName.StandStill], do_release=False)
wait(0.05, 0.1)
if self._skill_hotkeys["war_cry"]:
keyboard.send(self._skill_hotkeys["war_cry"])
if SkillName.WarCry in hotkeys.right_skill_key_map:
keyboard.send(hotkeys.right_skill_key_map[SkillName.WarCry])
wait(0.05, 0.1)
start = time.time()
while (time.time() - start) < time_in_s:
Expand All @@ -36,16 +36,16 @@ def _cast_war_cry(self, time_in_s: float):
wait(cry_frequency, cry_frequency + 0.2)
mouse.click(button="right")
wait(0.01, 0.05)
keyboard.send(Config().char["stand_still"], do_press=False)
keyboard.send(hotkeys.d2r_keymap[hotkeys.HotkeyName.StandStill], do_press=False)

def on_capabilities_discovered(self, capabilities: CharacterCapabilities):
if capabilities.can_teleport_natively:
self._pather.offset_node(149, [120, 70])

def _do_hork(self, hork_time: int):
wait(0.5)
if self._skill_hotkeys["find_item"]:
keyboard.send(self._skill_hotkeys["find_item"])
if SkillName.FindItem in hotkeys.right_skill_key_map:
keyboard.send(hotkeys.right_skill_key_map[SkillName.FindItem])
wait(0.5, 0.15)
pos_m = convert_abs_to_monitor((0, -20))
mouse.move(*pos_m)
Expand All @@ -56,15 +56,15 @@ def _do_hork(self, hork_time: int):
wait(1)

def pre_buff(self):
keyboard.send(Config().char["battle_command"])
keyboard.send(hotkeys.right_skill_key_map[SkillName.BattleCommand])
wait(0.08, 0.19)
mouse.click(button="right")
wait(self._cast_duration + 0.08, self._cast_duration + 0.1)
keyboard.send(Config().char["battle_orders"])
keyboard.send(hotkeys.right_skill_key_map[SkillName.BattleOrders])
wait(0.08, 0.19)
mouse.click(button="right")
wait(self._cast_duration + 0.08, self._cast_duration + 0.1)
keyboard.send(self._skill_hotkeys["shout"])
keyboard.send(hotkeys.right_skill_key_map[SkillName.Shout])
wait(0.08, 0.19)
mouse.click(button="right")
wait(self._cast_duration + 0.08, self._cast_duration + 0.1)
Expand All @@ -73,10 +73,10 @@ def pre_move(self):
# select teleport if available
super().pre_move()
# in case teleport hotkey is not set or teleport can not be used, use leap if set
should_cast_leap = self._skill_hotkeys["leap"] and not skills.is_left_skill_selected(["LEAP"])
can_teleport = self.capabilities.can_teleport_natively and skills.is_right_skill_active()
should_cast_leap = SkillName.Leap in hotkeys.right_skill_key_map and not is_left_skill_selected(SkillName.Leap.value)
can_teleport = self.capabilities.can_teleport_natively and is_right_skill_active()
if should_cast_leap and not can_teleport:
keyboard.send(self._skill_hotkeys["leap"])
keyboard.send(hotkeys.right_skill_key_map[SkillName.Leap])
wait(0.15, 0.25)

def _move_and_attack(self, abs_move: tuple[int, int], atk_len: float):
Expand Down
5 changes: 3 additions & 2 deletions src/char/basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import keyboard
from ui import skills
from utils import hotkeys
from utils.custom_mouse import mouse
from char import IChar,CharacterCapabilities
import template_finder
Expand All @@ -25,7 +26,7 @@ def on_capabilities_discovered(self, capabilities: CharacterCapabilities):
self._pather.offset_node(149, [120, 70])

def _cast_attack_pattern(self, time_in_s: float):
keyboard.send(Config().char["stand_still"], do_release=False)
keyboard.send(hotkeys.d2r_keymap[hotkeys.HotkeyName.StandStill], do_release=False)
wait(0.05, 0.1)
keyboard.send(self._skill_hotkeys["left_attack"])
wait(0.05, 0.1)
Expand All @@ -40,7 +41,7 @@ def _cast_attack_pattern(self, time_in_s: float):
wait(0.05, 0.1)
mouse.click(button="left")
wait(0.01, 0.05)
keyboard.send(Config().char["stand_still"], do_press=False)
keyboard.send(hotkeys.d2r_keymap[hotkeys.HotkeyName.StandStill], do_press=False)

def pre_buff(self):
if Config().char["cta_available"]:
Expand Down
Loading