Skip to content

Restructuring#65

Draft
theBGuy wants to merge 383 commits into
mainfrom
restructuring
Draft

Restructuring#65
theBGuy wants to merge 383 commits into
mainfrom
restructuring

Conversation

@theBGuy
Copy link
Copy Markdown
Collaborator

@theBGuy theBGuy commented Jun 19, 2023

theBGuy added 30 commits June 5, 2023 14:37
- fix charged teleport casting
- changed clearToExit to accept setting overrides
- changed moveToExit to accept setting overrides
- made changeAct work going either direction with acts
- removed some debugging statements and cleaned up some of the logging
- fix barb getting stuck at lvl 8
- hopefully fixed tele charge repair check
- cleaned up the charge skill related checks. I had a whole lot of duplicated code
- put some points into mana during leveling build, it was struggling real bad directly after respec due this
- keep bone armor active, todo is test using worker to check if we need to precast
- fix typo, smartCurse no longer exists
- change deploy to getIntoPosition, still need better control over how bots move during this action
- every time we revive the merc check against our stored data to ensure it's accuracy
- still replacing arrow functions when I see them
- add teleported pathaction, mostly this is for using charged tele but handle both
- fix logging to item viewer
- better checking for merc during init
- general updates with the change to areadata's structure
- add `me.haveWaypoint`
- should also fix bug where bot fails to get equipped item so it tries to equip something lower tier
- formatting mostly
- working to control the attack recursion that happens when walking characters try to reposition to attack
- formatting
- add use of ShrineData module, and new areadata module. Working to improve shrine hunting
- better collision checking
- get cata2 wp during boneash if we don't have it. During normal we usually hit level 12 which is what we want for andy while getting the wp
- move to cata 4 and then check if we have reached level 12 yet. If we didn't hit it while getting the wp, this usually does it and speeds up the 1-12 push by not having us make a new game
- add creepingfeature script, hit it before getting the amulet
- check were we are while attempting to move to the amulet chest, sometimes repositioning to attack gets us there
- last fix for equipping lower tier'd items broke ability to equip quest items as they have no tier value. Use equip prototype instead
- small bit of formatting
- formatting mostly
- for soloplay and manualplay modes, directly kill the default thread. Hopefully fixes rare bug where default doesn't actually stop when we return from it
- added paypal donate link as I've been asked about it a couple times
- update one of the pictures since D2BotSoloCleaner no longer exists
- better positioning for necro so he can use bone prison.
- preattack with dimvision
- kill endugu when we get the brain
- kill coldworm
- scenic route for better early survivability
theBGuy and others added 30 commits March 7, 2026 01:07
- Fix poison damage conversion and add class-specific mana leech weighting. Poison damage is now converted using (value*25)/256 to reflect per-second damage at 25 FPS instead of the previous 125/256 factor.
- ManaLeech weight is now 1 for barbarians and 2 for other classes, applying a class-specific scaling to mana leech contribution.
* Add files via upload

* Add files via upload

* Add files via upload

* Update Necromancer.js

Socket G Face

* Update Necromancer.js

Dodgehp

* Formatting + add griefmancer to impossible classic/ladder list

---------

Co-authored-by: theBGuy <60308670+theBGuy@users.noreply.github.com>
- Move socketing/imbue related functions out of Core/MiscOverrides.js into a new Modules/ItemUtils.js to modularize item utilities.
- Update Core/Quest.js to require and use the exported helpers (checkItemsForImbueing, checkItemsForSocketing, checkSocketables). Remove the corresponding global type declarations from globals.d.ts and tighten the openChestsInArea signature. MiscOverrides.js has the large socketing/imbue implementations removed; Module/ItemUtils.js contains the same logic exported as functions.
- Refactor item utility functions by removing Core/ItemUtilities.js and relocating its logic into Modules/ItemUtils.js. Update callers to require the new module and use destructured helpers (betterThanStashed, betterBaseThanWearing) instead of Item.* methods. Files updated: Core/CubingOverrides.js, Core/NPCAction.js and Core/RunewordsOverrides.js to import and use the moved functions. This centralizes item-related helpers and removes the legacy Core/ItemUtilities implementation.
- Rework Loader.run and Loader.runScript to centralize script lifecycle and improve robustness. Introduces Loader.currentScript, per-run ctx, and support for Runnable lifecycle hooks (setup, preAction, postAction, cleanup). Adds next-script preloading and skip logic for already-killed bosses, switches to Loader.scriptIndex usage, and consolidates execution via Loader._runCurrent. Improves performance/logging by tracking experience gain, duration and exp/min, fixes global script cleanup/deletion logic, and ensures proper restoration of Loader.currentScript after runs.
Improve town chore behavior and NPC interactions:

- Add scroll-count checks (Tome of Town Portal and Identify) and treat low scrolls as a reason to prioritize visiting the Shop; when scrolls are needed, only the Shop is chosen as the NPC.
- Retry Town.initNPC("Shop", ...) up to 3 times during clearInventory to reduce failed interactions.
- After selling, if chores are active and the shop UI is open, automatically buy TP/ID scrolls, purchase needed potions, and repair if applicable (uses Town.fillTome, Town.buyPotions, Town.repair).
- Preserve ScriptError behavior by rethrowing ScriptError instances in clearInventory catch blocks; log other errors.
- Include needKeys in the Lysander selection logic when buying potions/keys.
- Add Town.choresActive flag (set true/false in doChores) and use it in Cubing.doCubing to call Town.stash() if chores are running while the stash UI is open.

These changes make automated town chores more robust and ensure the bot restocks scrolls/potions and performs repairs when appropriate.
- Update NPC auto-equip logic to require a larger tier improvement before buying/equipping an item: change the comment and replace the broken percent calculation with Math.percentDifference(mainTier, equippedTier) > 10.
- Also add a TypeScript declaration for Item.bodyLocation(): number[] in globals.d.ts so the call site is properly typed.
…s.Sapphire in cubing gem list

- Fix incorrect gem reference in Core/CubingOverrides.js: replaced sdk.items.gems.Flawed.Sapphire with sdk.items.gems.Flawless.Sapphire so the cube list uses flawless gems consistently and avoids including a flawed sapphire alongside other flawless gems.
- Extract centralized helpers and sets for curse/state and monster-class checks (helpfulCurses, nonWarcryableBosses, rangedMobsClassIDs, dangerousAndSummoners) and add checkHasNoHelpfulCurse to avoid repeating state checks.
- Replace many inline arrays/.includes usages with Sets and .has for clarity and performance, and add RoF/ChaosSanctuary monsters to ranged set.
- Adjust taunt and Battle Cry/Howl logic to use the new helper, tighten conditions so helpful curses aren't overwritten, and fix fallback logic when choosing one-hand skills (special-case War Cry availability).
- Misc formatting and comment updates to improve readability.
- Refactor ItemStats to use instance properties and a prototype accessor for useTk (backed by _useTk) and add area tracking. The useTk getter centralizes telekinesis eligibility checks (distance, collision via CollMap, mp percent, and cursor-pick exclusion) while the setter allows forcing the flag. Replace an inline UIFlag callback with a named checkFlag helper and mark a TODO comment. Implement Pickit.fastPick: collect nearby eligible items from gidList (respecting town ignore and potion/essential rules), remove processed gids, sort candidates, validate and attempt fast picks via existing Pickit.checkItem/canPick/pickItem flow. Overall improves clarity, correctness of TK checks, and adds a faster item pickup path.
- Introduce a Map (itemTierMap) to memoize NTIP.GetTier results inside the sorting comparator for NPC shop items. The comparator now looks up cached tiers for each item (by gid), computes and stores them if missing, and uses those cached values for comparisons. This reduces repeated calls to NTIP.GetTier and improves sorting performance without changing sorting logic.
- Add a conditional Config.FastPick check in main(), log a "Fast pickit active." message, and attach Pickit.itemEvent as a listener for "itemaction" events so the pickit handles item actions when enabled.
Three small changes:
  1) Core/MiscOverrides.js: remove an unused require for ShrineData to clean up imports.
  2) Core/PatherOverrides.js: replace arrow callbacks with function expressions in skill element mapping (improves compatibility with older JS runtimes).
  3) Core/Quest.js: make equipping quest items safer when dual-wielding by checking the offhand item, attempting to make room via Pickit and Town.clearInventory (and stash/cube checks), logging if no space is available, then removing the offhand. These changes reduce runtime errors and improve robustness when auto-equipping quest items.
- Refactor NTIP item filter strings in Runewords (ChainsOfHonor, Enigma, Smoke, Treachery): replace verbose OR expressions with '[name] in (...)' syntax, convert single-line strings to multi-line calls, add '// nip' annotations, add explicit '[maxdurability] == 0' checks, and use the '[mq]' shorthand for max quantity. These changes improve readability and standardize filter semantics across runeword build files.
- Refactor attack pathing and deployment: cache node distances in a WeakMap for stable sorting, build Line objects keyed by node, fix force-distance checks, cache mob counts, conditionally compute near-mob counts for casters, attempt short-range teleport before Pather.move, and make pathing timers conditional. Improve path settings shape (allowPicking and clearSettings).

Improve item handling: convert weapon/shield/helm type arrays to Sets and update checks to use .has(), cache can-equip and tier values in a WeakMap to reduce repeated NTIP calls, only re-sort when equip state changes, and propagate runSort when items are equipped/unequipped. Update prototype bodyLocation to use Sets. Also broadcast kept-item events via scriptBroadcast.

Misc: add JSDoc to Pather.teleportTo and minor cleanups/formatting. These changes aim to improve performance, correctness and clarity in pathing and item equip flows.
- Introduce NTIP._evaluateRuleMatch to centralize type/stat matching logic and simplify hasStats, getInvoQuantity, and getMaxQuantity. Replace for..of loops with indexed loops and consolidate repeated matching checks to use the new helper. In NTIP.CheckItem add a per-call quantity cache and fn id WeakMap (getOwnedQuantity) to avoid repeated CheckQuantityOwned scans, account for own-item-in-storage when evaluating MaxQuantity, and improve error handling/guarding when reporting item info. Miscellaneous small cleanup: compact listOfLists, safer stringArr access, and minor performance/readability improvements.
- In OOGOverrides, add clickedExpansion/clickedLadder/clickedHardcore flags, reset them when opening the character creation dialog, and guard checkbox clicks so each toggle is only performed once per creation attempt to prevent accidental double-toggles of expansion/ladder/hardcore options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants