# LevelRewards
This mod sends you random rewards when you level up and can be used with fresh or existing profiles. Items and amount of items are randomly picked based on the Trader and/or options you configure. 

- For SPT 3.9.0 : No support will be provided on previous versions.
- If you are updating, remove all old versions of this mod first. Backup as needed.

## Disclaimer
This mod makes a small modification to your profile(s) to track your level vs. last level. It does this by adding LevelRewards.LastLevel to your profile. While I have had zero issues while testing, it is always best to backup your profile if you have concerns. Alternatively, you can use the `DontTouchMyProfile` config option to write to a separate file (src/lastlevel/PROFILEID_NAME.json). If you use `DontTouchMyProfile` and later update SPT or LevelRewards, it would be up to you to also backup the file mentioned so you dont get flooded with rewards when migrating your profile to the new version. Just wanted to give everyone options.

This mod also runs on a the route of items/moving to check you level and give rewards. Moving items in your stash or buying something will trigger the route and the mod, thus giving your rewards. This is typically only an "issue" when skipping levels as you wont see the messages come through until you move/buy something.

## Install
- Extract/UnZip to folder in your SPT Directory
- Configure the mod via Config (Default Config is: `ENABLED` and is for a relaxed/fun (less hardcore) setup)
- Launch SPT

## Support
- For issues, errors or installation problems, please use the support thread. If the comments section is used for these, I will ignore it.

## Latest Version
- 1.3.1
    - Fixed an issue with DontTouchMyProfile saving to an incorrect filepath.
    - 
    

## Config
- src/config/main.json
    - Mod is ENABLED by default. Recommended options are set by default.
    - Some options have changed, please review to ensure it fits your play style.

**Option** | **Values** | **Description**
-------- | ------ | -----------------------------------------------------------
LevelRewardsEnabled  | `true`  `false` | Enables/Disables mod
EnableGiftItems    | `true`  `false` | Enables/Disables gift sets.
GiftItemChancePercentage | `number` | The percentage chance you will receive Gifts. Default is 10% of the time.
EnableSkipLevelRewards  | `true`  `false`   | Enables/Disables rewards for any skipped levels. Mainly for migrating a profile that you never used with this mod and want the rewards from all previously gained levels. Also good for profile editor leveling on fresh profiles (Level 1) to gain rewards for each level skipped starting from level 1. ie. Level 1 manually edited to Level 20 profile will give 19 rewards. I recommend caution when using this depending on how high your level is as it will flood your messages and could cause issues or delays.
LevelBasedRewards   | `true`    `false` | (WIP) Utilizes your level to determine what items are available to you. Does not work when `LimitRewardsToTrader` is enabled. This is a WIP and really just testing right now to see how it balances out. Weighting has been added to assist in the types of items you get, but still WIP.
RandomTrader  | `true`  `false` | Enables/Disables Rewards sent from a random trader. System is default if set to `false`. Locked traders (Jaeger etc.) will be excluded until unlocked. If you have any custom traders the Enum must match base._id to work properly. This is dependent on the trader creator.
CustomTrader | `true`  `false` | Enables CustomTraderId to be used if you have a specifc Custom Trader that you want to give the rewards. Enum must match base._id to work properly. This is dependent on the trader creator.
CustomTraderId | `string` | Enter the Id of the Custom Trader to be used. Only works when `CustomTrader` is `true`. Enum must match base._id to work properly. This is dependent on the trader creator.
LimitRewardsToTrader | `true` `false` | If `RandomTrader` is `true`, and this option is also `true` it will limit the items you receive to the items that the selected Trader offers for sale at your current Loyalty level. Fence will be excluded from the trader list for `RandomTrader` if this is enabled.
RewardsFoundInRaid  | `true` `false` | Enables/Disables reward items being marked as `Found In Raid`.
RewardTimeOutInDays | `number` | Sets the timeout in days for you receive the rewards from the trader once they have been sent. Default is `3`. Only affects new messages and any current messages with rewards not claimed will have the original timeout if this is changed.
DontTouchMyProfile | `true`  `false` | If enabled, it will not modify your profile to track your last level reward and instead write to a new file (src/lastlevel/PROFILEID_NAME.json). Enable this if you have any concerns about the mod touching your profile(s). If you used this mod Pre 1.0.2 it will also remove the original modifications to your profile from this mod. Toggling this on and off will revert the changes made for each option. See disclaimer above for more info.
RewardBlackList | `itemId[]` | If there are specifc items that you never want to be rewarded, enter the item ID in the list. Quest items, Golden Zibbo for example, are already excluded from rewards. `EnableGiftItems` is excluded from this option. Use the item finder to assist with finding the IDs of what you want to blacklist. https://db.sp-tarkov.com/search
LevelRewardsDebug | `true`  `false` | Displays log messages in the server window for various functions.


- src/config/rewards.json

**Option** | **Description**
-------- | -----------------------------------------------------------------
Base  | `Do Not Change This!`
Dialogue    | You can edit/make your own dialogue messages here if you want. I may decide to localize the messages for each language but is not a priority right now. If you want to contribute to this, let me know.
Chance  | These are the gift sets I worked with ShadowXtrex (Lone_Simon's - Welcome Gifts) on. Also includes BSG Promo code rewards. You can add your own if you want but no support will be provided if modified. These are only used when `EnableGiftItems` is `true`


## Mod Compatibility
- Custom Traders will need to have their `ENUM` and `base.id` match to be part of the `RandomTrader` or `CustomTrader` features. This is dependent on the Custom Trader creator, not LevelRewards. A good/correct example is `Food&Drink trader by Revingly`.
- No known issues with other mods. If you experience any issues specifc to another mod, please let me know so I can address it.


## Credits
- ShadowXtrex for the collaboration on the Lone_Simon's - Welcome Gifts re-release.
- Everyone in the modding community who has helped me learn everything
- SPT dev team for this amazing creation
- Flaticon.com