# Smart AutoLoot Remaster

## Description
Smart AutoLoot Remaster is an automated looting mod designed specifically for the latest The Witcher 3 Remastered (Patch 5.00+ / September 2026 update).
It allows you to automatically gather loot from nearby herbs, fallen monsters, chests, and containers without having to manually open each loot window.

IMPORTANT REQUIREMENT:
This mod is built for The Witcher 3 Remastered (Patch 5.00+ / build 25575366+).
It is NOT compatible with older game versions (such as patch 4.04 or 1.32). Installing on 4.04 will cause script compilation errors (e.g. unexpected '<' in playerWitcher.ws). Please ensure your game is fully updated to the latest version on Steam or GOG before installing.

AI Development Disclosure:
This mod was coded and developed with the assistance of AI.

NOTE: This mod was created and tested during regular gameplay, but it has NOT been tested across the entire game. Because The Witcher 3 is a massive RPG with hundreds of unique quests, scripts, and edge cases, bugs or unforeseen interactions may occur. If you run into any issues, please report them so they can be addressed.

## Looting Modes Explained
In Options -> Mods -> AutoLoot, you can select between 4 distinct operation modes:
- Mode 0: Area Radius + On Interaction (Both / Full): Passive background area looting plus an instant AoE sweep when interacting.
- Mode 1: Passive Area Radius Only: Continuous background vacuuming without pressing any buttons.
- Mode 2: Single Target on Interaction (Instant Loot): Passive background vacuum is OFF. Interacting with an object loots ONLY that specific target instantly without opening the loot window.
- Mode 3: Area (AoE) on Interaction (On Demand): Passive background vacuum is OFF. Interacting with ANY container, herb, or corpse instantly sweeps and loots EVERYTHING in your entire configured radius (up to 50m). Perfect for full tactical control.

*TIP: You can enable the "Passive Herb Harvesting" toggle alongside Mode 2 or Mode 3! This allows you to automatically gather all herbs in radius as you explore while keeping chests and corpses strictly manual.*

## Main features
- Independent Category Radii: Customize distinct looting ranges for Herbs (1-50m), Corpses/Monsters (1-40m), and Chests/Containers (1-25m), or use the master slider (3-50m).
- Dedicated Passive Herb Toggle: Continuous background herb harvesting that works across all modes (including Single Target and On Demand AoE).
- Mod Manager Auto-Healing: Built-in self-seeding configuration script. If TW3MM or Vortex skips deploying `autoloot.ini`, default settings are automatically injected into `user.settings` on first launch.
- Map Pin Completion & "Tough Luck" Bug Fix: Fixed a vanilla CDPR bug where completing "Tough Luck" reverted completed map pins back into white question marks. Empty chests now immediately trigger map pin discovery and completion. Includes `FixMapPin` console command.
- Configurable Area Radius: Set looting distance anywhere from 3 to 50 meters (default 12m).
- Configurable Scan Interval: Choose scan frequency (0.3s, 0.5s, 1.0s, 1.5s, 2.0s).
- Guard & Witness Avoidance (Theft Protection): Checks Line of Sight (raycasting) and 100° FOV on nearby guards and civilians. Skips looting stolen containers if a guard is looking or if an alerted civilian can call guards. 4 configurable theft modes (Smart Safe, Never Steal, Strict, Always Steal).
- Exploration Caches & Points of Interest (PoI): Dedicated toggle for Guarded Treasures, Bandit Camps, Hidden Treasures, and Smuggler Caches. Allows auto-looting open-world caches without risking quest progression, and automatically completes map POI markers upon looting.
- Quest & Story Protection: Automatically skips quest containers, investigative clues (red Witcher Senses clues), and story-scripted containers to avoid disrupting quest progression. Interacting manually still opens the normal story loot window.
- Dropped Item Protection: Player-dropped bags ('lootbag') are never auto-looted.
- Auto-Read Letters & Notes: Treasure hunt notes and quest papers are marked as read on pickup so quests advance seamlessly.
- Graphical HUD Item Feed: Displays animated cards showing item icons, names, and quantities. Selectable position: Bottom-Right Corner (above control prompts) or Bottom-Left Corner (above potions).
- In-Game Options Menu (Options -> Mods -> AutoLoot): Full live customization for source filters, category filters, and safety conditions.
- Multi-language Support: Automatically adapts to your game's language (English, Polish, German, Russian, French, Brazilian Portuguese, Simplified Chinese, Traditional Chinese).

## Installation instructions
Automated (Vortex / The Witcher 3 Mod Manager):
1. Install and enable the mod archive in your mod manager.
2. Run Script Merger if you have other script mods installed.
*(Note: v1.1.0 includes automatic config healing, so even if your mod manager omits `bin/config/base/autoloot.ini`, all menu options and sliders will initialize automatically on first launch!)*

Manual Installation:
1. Extract the downloaded archive into your main Witcher 3 directory:
   The Witcher 3/
   ├── Mods/modAutoLoot/
   ├── bin/config/r4game/user_config_matrix/pc/modAutoLoot.xml
   └── bin/config/base/autoloot.ini
2. If you use other script mods, run Script Merger to resolve any script conflicts.
3. Launch the game and adjust your settings in Options -> Mods -> AutoLoot.

Troubleshooting & Common Questions:
- Missing "Mods" menu tab? Ensure `<The Witcher 3>/bin/config/r4game/user_config_matrix/pc/modAutoLoot.xml` exists. Mod managers often skip the "bin" folder.
- Settings not saving or reverting? Check that `Documents/The Witcher 3/user.settings` (or `dx12user.settings`) is NOT set to Read-Only.
- Seeing "AHDAL_MODNAME" in your menu? This is an unlocalized placeholder from an older AutoLoot mod (AeroHD AutoLoot). Delete any leftover `AHDAutoLootConfig.xml` in `<The Witcher 3>/bin/config/r4game/user_config_matrix/pc/`.

Uninstallation:
1. If using a mod manager, disable and uninstall the mod.
2. If installed manually, delete:
   - <The Witcher 3>/Mods/modAutoLoot/
   - <The Witcher 3>/bin/config/r4game/user_config_matrix/pc/modAutoLoot.xml
   - <The Witcher 3>/bin/config/base/autoloot.ini
3. (Optional) Open Documents/The Witcher 3/user.settings in a text editor and remove the [AutoLoot] section.
4. Re-run Script Merger if you had merged scripts.

## Changelog
### v1.1.1
- Enemy Corpse Currency Looting Fix: Fixed an issue where Novigrad Crowns were left behind inside defeated enemy corpses and containers when they were the sole drop. Solved an engine quirk where CDPR's internal NoDrop tag caused container IsEmpty checks to treat remains as empty. Crowns are now reliably looted in every scenario with proper coin icon and notification display.
- Sleek Dark HUD Background Panel (Style 4): Added a clean, dark rounded background box with an elegant border behind the loot feed on the right edge of the screen (styled after the popular Seamless AutoLoot layout). Re-anchored position to sit comfortably below tracked quest objectives without overlapping.
- Exploration PoI & Bandit Camp Clears: Fixed open-world exploration chests ensuring notes and completion facts trigger immediately so bandit camps and guarded treasures grey out on the map.
- Dark Notification Box HUD Layout (Style 5): Added a dedicated high-contrast notification layout option displaying collected items inside the game's native dark-slate parchment banner box (ShowNotification) with gold borders and bullet points. Perfect for players who want maximum legibility against bright backgrounds like snow and sun.
- Traditional Chinese (ZT) Font & Detection Fix: Fixed language detection to accurately distinguish Traditional Chinese from Simplified Chinese. Replaced fullwidth punctuation and degree symbols that rendered as missing square glyphs in the game's font.
- HUD Opacity Tick Optimization: Synchronized opacity calculation with the game's native UI opacity to prevent redundant per-frame recalculations in the HUD loot feed.

### v1.1.0
- Critical Currency Safety Fix: Fixed an issue where player Crowns (money), Orens, and Florens were removed on game load due to internal engine tags. Removed all automated inventory purging on initialization and added strict protection for all player currencies and items.
- HUD Text Rendering & Clarity Fix: Resolved an issue where raw markup tags were displayed literally in item names. The feed now uses native engine font rendering with crisp text, high-contrast drop shadows, and full multi-language support.
- Right-Edge HUD Display Style (Style 4): Added a dedicated right-side HUD layout option positioned neatly under the minimap/quest log.
- HUD Scale & Opacity Controls: Added customization sliders in Options -> Mods -> AutoLoot for HUD Scale (70% - 150%) and Opacity (50% - 100%).
- Clean Script Decoupling: Completely cleaned all leftover external dependencies in `igmOptions.ws` ensuring zero script conflicts or compilation errors.

### v1.0.9
- Independent Category Radii Configuration:
  - Added "Independent Category Radii" toggle and 3 dedicated sliders in Options -> Mods -> AutoLoot:
    - Herbs & Plants Radius (1-50m, default 15m)
    - Corpses & Monster Remains Radius (1-40m, default 8m)
    - Chests & Containers Radius (1-25m, default 3m)
  - Allows full immersion: vacuum plants from far away while riding Roach, loot corpses near combat, and keep chest looting tightly localized.
- Mod Manager Auto-Healing & Self-Seeding Configuration:
  - Added an in-engine self-healing mechanism in `modAutoLootConfig.ws`. If TW3MM or Vortex skips deploying `bin/config/base/autoloot.ini`, the script automatically detects missing config entries and initializes all default settings into `user.settings`. Menu sliders work out of the box regardless of installation method.
- Dedicated Passive Herb Harvesting Toggle:
  - Added an independent "Passive Herb Harvesting" toggle in Options -> Mods -> AutoLoot. When enabled, herbs in your radius are harvested continuously in the background even if you choose Mode 2 (Single Interact) or Mode 3 (Interact AoE).
- Map Pin Completion & "Tough Luck" Bug Fix:
  - Fixed a vanilla CDPR bug where completing "Tough Luck" / treasure hunts reverted completed map pins back into white question marks. Empty chests now immediately trigger map pin discovery and completion. Added `FixMapPin` console command.
- Dropped Item Protection (Loot Bag Fix):
  - Fixed an issue where items dropped by the player from inventory were immediately vacuumed back into Geralt's inventory. AutoLoot now strictly ignores player-dropped bags ('lootbag').
- Auto-Read Quest Notes and Treasure Letters:
  - When picking up quest notes or letters starting treasure hunts (such as "Tough Luck" / sq204), they are automatically registered as read, allowing quest objectives to advance cleanly without requiring players to search through their inventory.
- Script Conflict & Compilation Fix:
  - Restored vanilla 2-parameter signature for `CreateGFXElement` in `hudModuleLootFeed.ws`, eliminating compilation conflicts when merging with UI mods or running Script Merger.
- Smoother HUD Loot Feed Grouping:
  - Extended the grouping buffer window (from 0.25s to 0.6s) so multiple herb bushes harvested in quick succession merge into a single combined card notification.
- New HUD Feed Display Style (Right-Center / Loot Window Area):
  - Added a new display layout option in Options -> Mods -> AutoLoot placing the loot notification feed on the right side of the screen in open space, styled like the native loot window list.
- HUD Item Scale & Opacity Customization Sliders:
  - Added two dedicated sliders: "HUD Feed: Item Scale (%)" (70% to 150%) and "HUD Feed: Opacity (%)" (50% to 100%) for maximum clarity, readability, and compatibility with non-Latin fonts (requested by DIMOOLIN).
- Clean Mod Decoupling & Script Compilation Hotfix:
  - Completely removed leftover references to external mod scripts in `igmOptions.ws` and hardened `container.ws` to use direct player manager calls, resolving compilation errors on standalone installs without other mods (reported by raven1840 and LowEstate).
- Extended In-Game Radius Slider:
  - Increased the maximum slider radius in the in-game options menu from 40m to 50m.

### v1.0.8
- Key-Locked Container & Quest Progression Fix:
  - Containers locked by a key (such as the chest in "Tough Luck" / sq204) can NEVER be unlocked or vacuumed passively from a distance. Geralt must physically interact with the container so the key is consumed, the unlock sound plays, and quest stages advance in proper order.
- Bandit Camps & PoI Map Pin Clearing:
  - Fixed an issue where Bandit Camps and Points of Interest remained uncompleted/unlooted on the world map after enemies were defeated and loot was collected.
  - Differentiated open-world exploration caches from story quests and added automatic map pin completion (`CR4MapPinEntity`, `W3TreasureHuntMappinEntity`) when clearing camps.
- Herb Gathering Animation Toggle:
  - Added an option in Options -> Mods -> AutoLoot to enable/disable the herb picking animation ("Herb Gathering Animation", default: disabled), allowing seamless on-the-move herb gathering.
- HUD Loot Feed Item Grouping:
  - Added option to group identical items swept in the same cycle into a single notification with total count (e.g. "Celandine x5" instead of repetitive spam).
  - Includes smart flush buffering to batch items picked up during radius pulses and riding sweeps.
- Corvo Bianco Stand & Display Protection:
  - Added complete protection for all weapon stands, armor stands, and display mounts in Corvo Bianco (W3HouseDecorationBase and W3DisplayMount).
  - Geralt will never accidentally vacuum displayed gear off the walls or stands in his home.
- Chest vs Container Separation:
  - Added dedicated toggle for "Loot Chests and Coffers" separately from "Loot Sacks, Barrels & Crates".
  - Allows players to keep chests manual while automatically vacuuming common clutter and containers.
- Witcher Gear Diagram Protection:
  - Scavenger Hunt diagram chests are strictly treated as quest containers and protected from passive vacuuming through cave ceilings and walls.


### v1.0.7
- Quest Chest Protection Fix:
  - Fixed an issue where quest-completion chests (such as the chest in "Tough Luck" and certain hidden-treasure chests) were passively looted from a distance, breaking quest progression.
  - Chests with `factOnContainerOpened` that lack dedicated open-world PoI tags are now strictly recognized as quest-related and protected from passive vacuuming, requiring manual player interaction to fire the quest unlock sequence.
- HUD Loot Feed Filters:
  - Added dedicated toggle options in the in-game menu for each loot category in the HUD notification feed: Herbs, Weapons & Armor, Alchemy & Crafting, Books, Junk, and Money.
  - Allows players to hide herb/junk notification spam while keeping valuable weapons, armor, and quest items visible in the HUD feed.
- Menu Category Integration:
  - Standardized the in-game menu prefix to uppercase `Mods.mod_autoloot_group` so AutoLoot seamlessly merges into the existing "Mods" menu tab without creating a duplicate entry.
- Localization Updates:
  - Added full Traditional Chinese (ZH-TW / ZT) localization with proper font rendering support.
  - Added unified case-insensitive fallback for menu category titles across all languages.
- Major Quest & Contract Protection Overhaul:
  - Fixed an issue where Witcher contracts / bounty monster corpses were vacuumed from a distance, breaking quest progression and trophy cutscenes.
  - Bounty monster remains with trophies now always trigger normal manual interaction so dismemberment and quest objectives advance properly.
  - Fixed quest containers (e.g. Scavenger Hunt: Viper School Gear in White Orchard) getting erroneously classified as open-world caches.
  - Containers with active Quest Items (`container.HasQuestItem()`) are now strictly protected and will never be looted via passive radius sweep.
  - Added specific category filtering for monster trophies (`'trophy'`).
- Added Simplified Chinese (ZH-CN) localization.

### v1.0.5
- Added dedicated menu toggle: "Loot Exploration Caches & PoIs" in Options -> Mods -> AutoLoot.
- Decoupled AoE sweep on interaction from Instant Loot: opening a container manually now cleanly opens its loot window while still vacuuming surrounding valid loot.
- Added Brazilian Portuguese (pt-BR) localization.
- Completed full French (FR) localization.
- Added troubleshooting guides for "AHDAL_MODNAME" and mod manager installation.

### v1.0.4
- Separated exploration caches (Guarded Treasures, Bandit Camps, Smuggler Caches, Hidden Treasures) from quest protection.
- Added automatic fact registration (`factOnContainerOpened`) so map markers complete and turn grey immediately upon looting.
- Guaranteed key looting (keys are always collected).
- Witcher gear schematics now respect Alchemy/Crafting filter instead of being blocked as quest items.

### v1.0.2 - v1.0.3
- Added Mode 3: Area (AoE) on Interaction Only (On Demand).
- In-game dynamic localization for English, Polish, German, Russian, and French.

## Requirements
- The Witcher 3: Wild Hunt Remastered (Patch 5.00+ / September 2026 update).
- Script Merger (recommended if using multiple script mods).

## Shout outs
- CD Projekt Red for The Witcher 3 and REDkit.
- The Witcher 3 modding community for tools, tutorials, and ongoing support.
- Special thanks to Divergent444 for extensive playtesting, bug reports, and invaluable feedback!
- Developed with AI assistance.
