<p align="center">

<img src="https://noobtrap.eu/images/crystallights/travelinghaldorheader.png">

<img src="https://noobtrap.eu/images/crystallights/travelinghaldor.png">

</p>

# Traveling Haldor Mod

Welcome to the **Traveling Haldor Mod**! This mod brings a dynamic and immersive trading experience to your Valheim adventure by introducing a roaming trader, Haldor, who appears in different biomes and regions with customizable behavior and inventory.

## Features

- **Supports EpicLoot Bounties**
  - Pick up your EpicLoot Bounties from Traveling Haldor. 

- **Supports Trader Quest by Rusty**
  - Pick up your Trader Quest Bounties, Gamble, and more from Traveling Haldor. 

- **Traveling Haldor Token**
  - Traveling Trader Token that can be used to spawn Traveling Haldor. Coin is purchased from "Haldor" or "Traveling Haldor" after defeating Bonemass.
  - Settings for Token within "Trader Items" and "Traveling Trader Token"

- **Traveling Despawn Settings**
  - Traveling Haldor can be set not to despawn if trapped by player builds.
  
- **Dynamic Trader Spawning**
  - Haldor spawns at random intervals and locations within specified biomes and regions.
  - Customize the spawn distance from the player.
  - Set the "Custom Map Pin" to `true` for a map pin to display when Traveling Haldor is spawned. This is set to `false` by default.

- **Customizable Trader Behavior**
  - Set custom greetings, goodbyes, and trade dialogues to personalize Haldor's interactions.
  - Configurable event interval, chance, and duration for Haldor's appearances.

- **Biome and Region Specific Spawning**
  - Control where Haldor can spawn using combined biome and region settings.
  - **Default spawn regions:** Meadows, BlackForest
  - **Possible additional locations:** Swamp, Mountain, Plains, AshLands, DeepNorth, Ocean, Mistlands, All, None

- **Global Key Requirement for Events**
  - Add a global key requirement to trigger the trader event, ensuring Haldor only appears after specific milestones are met.
  - **Default Value:** `defeated_gdking`
  - **Acceptable Values:**
    - defeated_bonemass
    - defeated_gdking
    - defeated_goblinking
    - defeated_dragon
    - defeated_eikthyr
    - defeated_queen
    - defeated_fader
    - defeated_serpent
    - KilledTroll
    - killed_surtling
    - KilledBat

- **Day/Night Specific Spawning**
  - Control when Haldor can spawn using day/night settings.
  - **Acceptable Values:** `Always, Day, Night`

- **Trader Inventory Customization**
  - Define the items Haldor sells, including amount, cost, and required global keys.

- **New Console Command: Clear All Haldors**
  - If multiple Haldors are in the world, you can remove them using the console command:
    `
    clear_traveling_haldors
    `
  - This will **remove all active Traveling Haldors** and display a confirmation message.

---

## Configuration Options

### **Event Settings**
- `Event Interval (Days)`: How often (in in-game days) Traveling Haldor appears.
- `Event Chance`: Chance (0-1) of the event occurring when the interval is reached.
- `Event Duration (Seconds)`: How long Haldor stays in one place.
- `Global Key Requirement`: Global key required to trigger the event. Default value is `defeated_gdking`. Acceptable values: `defeated_bonemass`, `defeated_gdking`, `defeated_goblinking`, `defeated_dragon`, `defeated_eikthyr`, `defeated_queen`, `defeated_fader`, `defeated_serpent`, `KilledTroll`, `killed_surtling`, `KilledBat`.
- `Specific Spawn Time`: Specify when Haldor can spawn. Acceptable values: `Always, Day, Night`.
- `Spawn Distance (Meters)`: Distance from the player at which the trader spawns.
- `Max Haldor Count`: Sets the **maximum number of Traveling Haldors** that can exist at one time.
- `Force Despawn`: If `true` Haldor will despawn when trapped by player builds.
- `Trader Icon`: If `true` an icon will be displayed on the map.

### **Trader Settings**
- `TradeItems`: List of items Haldor sells. Format: `PrefabName,Amount,Cost,RequiredGlobalKey`.

### **Custom Dialogues**
- `Greetings`: Custom greetings for the trader. Separate multiple greetings with `;`.
- `Goodbyes`: Custom goodbyes for the trader. Separate multiple goodbyes with `;`.
- `TradeDialogues`: Custom trade dialogues for the trader. Separate multiple dialogues with `;`.

### **Location Settings**
- `Enable Location Variability`: Enable or disable trader location variability.
- `Spawn Regions`: Possible spawn regions for the trader. Separate multiple regions with `;`.

---

## Installation

1. Download the Traveling Haldor Mod from the provided link.
2. Extract the contents to your Valheim `BepInEx\plugins` folder.
3. Customize the configuration file located in `BepInEx\config\org.bepinex.plugins.travelinghaldor.cfg` to suit your preferences.
4. Enjoy the dynamic and immersive trading experience with Traveling Haldor!

---
<p align="center">Use with Trader Quest by Rusty for gambling, bounties, and more!!</p>
 
<p align="center">
<a href="https://thunderstore.io/c/valheim/p/RustyMods/TraderQuest/">
<img src="https://noobtrap.eu/images/crystallights/traderq2.png">


<p align="center"><h2>For Questions or Comments, find Gravebear in the Odin Plus Team on Discord:</h2></p>

<p align="center">
<a href="https://discord.gg/mbkPcvu9ax">
<img src="https://i.imgur.com/Ji3u63C.png">
</a>
</p>

<p align="center">Visit my BuyMeACoffee for a free Admin craft Shark Hat and Tuna Sword!</p>
 
<p align="center">
<a href="https://www.buymeacoffee.com/Gravebear">
<img src="https://noobtrap.eu/images/crystallights/GBSupporter.png">
</a>
</p>

<p align="center">Special Thanks to Rusty and Blaxxun for all her help with code and managers</p>
