Skip to content

Commit

Permalink
feat/run-qol (aeon0#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeon0 authored Apr 17, 2022
1 parent 5dd0d92 commit 51ba572
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions config/params.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ restart_d2r_when_stuck=0


[routes]
run_trav=0
run_pindle=1
run_eldritch=1
run_shenk=0
run_nihlathak=0
run_arcane=0
run_diablo=0
; Note: You can not split up or change order of eldritch and shenk as botty treats it as a single run
order=run_pindle, run_eldritch, run_shenk, run_nihlathak, run_trav, run_arcane, run_diablo
; Add these possible routes to "order" to run them:
; run_trav
; run_pindle
; run_eldritch
; run_eldritch_shenk
; run_nihlathak
; run_arcane
; run_diablo
order=run_pindle, run_eldritch_shenk

[char]
; ==========================
Expand Down
17 changes: 7 additions & 10 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,13 @@ def __init__(self, game_stats: GameStats):
self._town_manager = TownManager(a1, a2, a3, a4, a5)

# Create runs
if Config().routes["run_shenk"] and not Config().routes["run_eldritch"]:
Logger.error("Running shenk without eldtritch is not supported. Either run none or both")
os._exit(1)
self._do_runs = {
"run_trav": Config().routes["run_trav"],
"run_pindle": Config().routes["run_pindle"],
"run_shenk": Config().routes["run_shenk"] or Config().routes["run_eldritch"],
"run_nihlathak": Config().routes["run_nihlathak"],
"run_arcane": Config().routes["run_arcane"],
"run_diablo": Config().routes["run_diablo"],
"run_trav": Config().routes.get("run_trav"),
"run_pindle": Config().routes.get("run_pindle"),
"run_shenk": Config().routes.get("run_eldritch") or Config().routes.get("run_eldritch_shenk"),
"run_nihlathak": Config().routes.get("run_nihlathak"),
"run_arcane": Config().routes.get("run_arcane"),
"run_diablo": Config().routes.get("run_diablo"),
}
# Adapt order to the config
self._do_runs = OrderedDict((k, self._do_runs[k]) for k in Config().routes_order if k in self._do_runs and self._do_runs[k])
Expand Down Expand Up @@ -485,7 +482,7 @@ def on_run_shenk(self):
self._curr_loc = self._shenk.approach(self._curr_loc)
if self._curr_loc:
set_pause_state(False)
res = self._shenk.battle(Config().routes["run_shenk"], not self._pre_buffed, self._game_stats)
res = self._shenk.battle(Config().routes.get("run_eldritch_shenk"), not self._pre_buffed, self._game_stats)
self._ending_run_helper(res)

def on_run_trav(self):
Expand Down
11 changes: 7 additions & 4 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def turn_on_goldpickup(self):
self.items["misc_gold"].pickit_type = 1

def load_data(self):
Logger.debug("Loading config")
self.configs = {
"config": {"parser": configparser.ConfigParser(), "vars": {}},
"game": {"parser": configparser.ConfigParser(), "vars": {}},
Expand Down Expand Up @@ -232,11 +233,13 @@ def load_data(self):
}

self.routes = {}
order_str = self._select_val("routes", "order").replace("run_eldritch", "run_shenk")
order_str = self._select_val("routes", "order")
self.routes_order = [x.strip() for x in order_str.split(",")]
del self.configs["config"]["parser"]["routes"]["order"]
for key in self.configs["config"]["parser"]["routes"]:
self.routes[key] = bool(int(self._select_val("routes", key)))
for key in self.routes_order:
self.routes[key] = True
# Botty only knows "run_shenk" but in orders we split run_eldritch and run_eldritch_shenk
self.routes_order = ["run_shenk" if x in ["run_eldritch", "run_eldritch_shenk"] else x for x in self.routes_order]

self.char = {
"type": self._select_val("char", "type"),
Expand Down Expand Up @@ -413,7 +416,7 @@ def load_data(self):

if __name__ == "__main__":
from copy import deepcopy
config = self()
config = Config()

# Check if any added items miss templates
for k in config.items:
Expand Down

0 comments on commit 51ba572

Please sign in to comment.