From 487d113432efe52d1ee73f27a6825bba34d35e26 Mon Sep 17 00:00:00 2001 From: Gleed Date: Thu, 16 Jun 2022 13:29:10 -0400 Subject: [PATCH] init (#877) --- README.md | 1 + config/params.ini | 2 ++ src/char/i_char.py | 1 + src/char/paladin/fohdin.py | 19 ++++++++++--------- src/char/paladin/paladin.py | 2 +- src/config.py | 1 + 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f8ecccb..851551c 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ order=run_pindle, run_eldritch | belt_rows | Integer value of how many rows the char's belt has | | casting_frames | Depending on your char and fcr you will have a specific casting frame count. Check it here: https://diablo2.diablowiki.net/Breakpoints and fill in the right number. Determines how much delay there is after each teleport for example. If your system has some delay e.g. on vms, you might have to increase this value above the suggest value in the table! | | cta_available | 0: no cta available, 1: cta is available and should be used during prebuff | +| safer_routines | Set to 1 to enable optional defensive maneuvers/etc during combat/runs at the cost of increased runtime (ex. hardcore players) | num_loot_columns | Number of columns in inventory used for loot (from left!). Remaining space can be used for charms | | force_move | Hotkey for "force move" | | inventory_screen | Hotkey to open inventory | diff --git a/config/params.ini b/config/params.ini index 4053b16..1da04c7 100644 --- a/config/params.ini +++ b/config/params.ini @@ -48,6 +48,8 @@ type=light_sorc belt_rows=4 casting_frames=10 cta_available=0 +; safer_routines: enable for optional defensive maneuvers/etc during combat/runs at the cost of increased runtime (ex. hardcore players) +safer_routines=0 ; num_loot_columns: Number of empty columns from left to right of inventory to be used for looting. ; Store charms, etc. to the right of the inventory. diff --git a/src/char/i_char.py b/src/char/i_char.py index 09f56d4..49314ba 100644 --- a/src/char/i_char.py +++ b/src/char/i_char.py @@ -31,6 +31,7 @@ class IChar: "left": "", "right": "" } + self._use_safer_routines = Config().char["safer_routines"] def _set_active_skill(self, mouse_click_type: str = "left", skill: str =""): self._active_skill[mouse_click_type] = skill diff --git a/src/char/paladin/fohdin.py b/src/char/paladin/fohdin.py index 56aad55..c5c9a97 100644 --- a/src/char/paladin/fohdin.py +++ b/src/char/paladin/fohdin.py @@ -60,17 +60,18 @@ class FoHdin(Paladin): spray = 5 cast_pos_abs = targets[0].center_abs - # TODO: add delay between FOH casts--doesn't properly cast each FOH in sequence - - # cast foh to holy bolt with preset ratio (e.g. 3 foh followed by 1 holy bolt if foh_to_holy_bolt_ratio = 3) - if foh_to_holy_bolt_ratio > 0 and not target_check_count % (foh_to_holy_bolt_ratio + 1): - self._cast_holy_bolt(cast_pos_abs, spray=spray, aura=holy_bolt_aura) - else: - self._cast_foh(cast_pos_abs, spray=spray, aura=foh_aura) - # if time > minimum and either targets aren't set or targets don't exist, exit loop if elapsed > min_duration and (not target_detect or not targets): break + else: + + # TODO: add delay between FOH casts--doesn't properly cast each FOH in sequence + # cast foh to holy bolt with preset ratio (e.g. 3 foh followed by 1 holy bolt if foh_to_holy_bolt_ratio = 3) + if foh_to_holy_bolt_ratio > 0 and not target_check_count % (foh_to_holy_bolt_ratio + 1): + self._cast_holy_bolt(cast_pos_abs, spray=spray, aura=holy_bolt_aura) + else: + self._cast_foh(cast_pos_abs, spray=spray, aura=foh_aura) + target_check_count += 1 return True @@ -95,7 +96,7 @@ class FoHdin(Paladin): atk_len_dur = float(Config().char["atk_len_pindle"]) pindle_pos_abs = convert_screen_to_abs(Config().path["pindle_end"][0]) - if self.capabilities.can_teleport_natively or self.capabilities.can_teleport_with_charges: + if (self.capabilities.can_teleport_natively or self.capabilities.can_teleport_with_charges) and self._use_safer_routines: # Slightly retreating, so the Merc gets charged if not self._pather.traverse_nodes([102], self, timeout=1.0, do_pre_move=False, force_move=True,force_tp=False, use_tp_charge=False): return False diff --git a/src/char/paladin/paladin.py b/src/char/paladin/paladin.py index 8235b76..283cc9b 100644 --- a/src/char/paladin/paladin.py +++ b/src/char/paladin/paladin.py @@ -77,7 +77,7 @@ class Paladin(IChar): # set left hand skill self._select_skill(skill_name, mouse_click_type = "left") - wait(0.05, 0.1) + wait(0.04) # cast left hand skill start = time.time() diff --git a/src/config.py b/src/config.py index 26269bf..81f57b9 100644 --- a/src/config.py +++ b/src/config.py @@ -210,6 +210,7 @@ class Config: "gamble_items": False if not self._select_val("char", "gamble_items") else self._select_val("char", "gamble_items").replace(" ","").split(","), "sell_junk": bool(int(self._select_val("char", "sell_junk"))), "enable_no_pickup": bool(int(self._select_val("char", "enable_no_pickup"))), + "safer_routines": bool(int(self._select_val("char", "safer_routines"))), } # Sorc base config sorc_base_cfg = dict(self.configs["config"]["parser"]["sorceress"])