From f94dfb98a2c53334779afd6bb6df4e157fca668b Mon Sep 17 00:00:00 2001 From: Anthony Mosca Date: Wed, 4 Jun 2025 00:17:52 +0930 Subject: [PATCH 1/5] Add support for mastery gain quadratic --- XPRising/Configuration/GlobalMasteryConfig.cs | 3 +++ XPRising/Systems/GlobalMasterySystem.cs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/XPRising/Configuration/GlobalMasteryConfig.cs b/XPRising/Configuration/GlobalMasteryConfig.cs index fc23422..1691f81 100644 --- a/XPRising/Configuration/GlobalMasteryConfig.cs +++ b/XPRising/Configuration/GlobalMasteryConfig.cs @@ -26,6 +26,9 @@ public static void Initialize() GlobalMasterySystem.DecaySubSystemEnabled = _configFile.Bind("Global Mastery", "Enable Decay Subsystem", false, "Enables the Decay Mastery subsystem. This will decay mastery over time. Decay rate is set via 'globalMasteryConfig.json'").Value; GlobalMasterySystem.MasteryThreshold = _configFile.Bind("Global Mastery", "Mastery Threshold", 0.0, "Threshold level the mastery must reach before the mastery can be reset.").Value; GlobalMasterySystem.DecayInterval = _configFile.Bind("Global Mastery", "Decay Tick Interval", 60, "Amount of seconds per decay tick.").Value; + var gainReduction = _configFile.Bind("Global Mastery", "Mastery Gain Reduction", 0f, "Used to change the mastery gain from linear to quadratic. This will reduce the mastery gain as mastery approaches 100%.\n" + + "Value is clamped from 0 to 100. Set to 0 to have a linear mastery gain. Set to 100 to reduce mastery gain to 0 as mastery approaches 100%.").Value; + GlobalMasterySystem.MasteryGainReductionMultiplier = Math.Clamp(gainReduction, 0, 100)*0.000001; // Weapon mastery specific config WeaponMasterySystem.MasteryGainMultiplier = _configFile.Bind("Mastery - Weapon", "Mastery Gain Multiplier", 1.0, "Multiply the gained mastery value by this amount.").Value; diff --git a/XPRising/Systems/GlobalMasterySystem.cs b/XPRising/Systems/GlobalMasterySystem.cs index 6769c74..d82dba0 100644 --- a/XPRising/Systems/GlobalMasterySystem.cs +++ b/XPRising/Systems/GlobalMasterySystem.cs @@ -26,6 +26,7 @@ public static class GlobalMasterySystem public static bool DecaySubSystemEnabled = false; public static bool SpellMasteryRequiresUnarmed = false; public static int DecayInterval = 60; + public static double MasteryGainReductionMultiplier = 0f; public static readonly string CustomPreset = "custom"; public const string NonePreset = "none"; @@ -410,7 +411,9 @@ private static double ModMastery(ulong steamID, LazyDictionary Date: Wed, 4 Jun 2025 00:18:13 +0930 Subject: [PATCH 2/5] Remove minion on ambush units so they give XP --- XPRising/Hooks/UnitSpawnerHook.cs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/XPRising/Hooks/UnitSpawnerHook.cs b/XPRising/Hooks/UnitSpawnerHook.cs index 207d5c1..d5a0830 100644 --- a/XPRising/Hooks/UnitSpawnerHook.cs +++ b/XPRising/Hooks/UnitSpawnerHook.cs @@ -10,6 +10,7 @@ using XPRising.Systems; using XPRising.Utils; using XPRising.Utils.Prefabs; +using XPShared; using Faction = ProjectM.Faction; using Prefabs = XPRising.Utils.Prefabs; @@ -65,28 +66,34 @@ public static void Postfix(Dictionary __s var em = Plugin.Server.EntityManager; foreach (var data in __state) { - if (data.Value.Item2 == SpawnUnit.SpawnFaction.VampireHunters && - em.TryGetComponentData(data.Key, out var factionReference)) + var entity = data.Key; + var intendedLevel = data.Value.Item1; + var faction = data.Value.Item2; + if (faction == SpawnUnit.SpawnFaction.VampireHunters) { Plugin.Log(Plugin.LogSystem.SquadSpawn, LogLevel.Info, "Attempting to set faction vampire hunters"); - factionReference.FactionGuid._Value = new PrefabGUID((int)Prefabs.Faction.VampireHunters); - em.SetComponentData(data.Key, factionReference); + entity.With((ref FactionReference factionReference) => + { + factionReference.FactionGuid._Value = new PrefabGUID((int)Prefabs.Faction.VampireHunters); + }); } - if (em.TryGetComponentData(data.Key, out var unitLevel)) + Plugin.Log(Plugin.LogSystem.SquadSpawn, LogLevel.Info, "Attempting to set level"); + entity.With((ref UnitLevel unitLevel) => { - Plugin.Log(Plugin.LogSystem.SquadSpawn, LogLevel.Info, "Attempting to set level"); - unitLevel.Level._Value = data.Value.Item1; - em.SetComponentData(data.Key, unitLevel); - } + unitLevel.Level._Value = intendedLevel; + }); // If they get disabled (ie, the user runs far away), just mark them to be destroyed. - em.AddComponent(data.Key); + entity.Add(); + // Remove "Minion" component as none of these should be acting as minions and this will better allow these + // units to be valid for full XP in Bloodcraft. + entity.TryRemoveComponent(); - if (data.Value.Item2 is SpawnUnit.SpawnFaction.WantedUnit or SpawnUnit.SpawnFaction.VampireHunters) + if (faction is SpawnUnit.SpawnFaction.WantedUnit or SpawnUnit.SpawnFaction.VampireHunters) { // Add the entity to our list of spawned entities so we can match them as reducing heat when killed - WantedSystem.AddAmbushingEntity(data.Key, currentTime); + WantedSystem.AddAmbushingEntity(entity, currentTime); } } } From f314d792ad92842f7f635d6adb39131ca67d80b0 Mon Sep 17 00:00:00 2001 From: Anthony Mosca Date: Wed, 4 Jun 2025 00:18:27 +0930 Subject: [PATCH 3/5] Drop all XP when multiplier is 0 --- XPRising/Systems/ExperienceSystem.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/XPRising/Systems/ExperienceSystem.cs b/XPRising/Systems/ExperienceSystem.cs index 0a1091f..3eb7e6f 100644 --- a/XPRising/Systems/ExperienceSystem.cs +++ b/XPRising/Systems/ExperienceSystem.cs @@ -95,6 +95,8 @@ public static bool IsPlayerLoggingExperience(ulong steamId) public static void ExpMonitor(List closeAllies, PrefabGUID victimPrefab, int victimLevel, bool isVBlood) { var multiplier = ExpValueMultiplier(victimPrefab, isVBlood); + // Early exit to entirely stop XP calculations when the multiplier is 0. + if (multiplier == 0) return; var sumGroupLevel = closeAllies.Sum(x => x.playerLevel); var avgGroupLevel = (int)Math.Floor(closeAllies.Average(x => x.playerLevel)); From b0d1f85c6caddb974f4e8fd708b4e71adef3a56d Mon Sep 17 00:00:00 2001 From: Anthony Mosca Date: Wed, 4 Jun 2025 00:18:37 +0930 Subject: [PATCH 4/5] Fix release permissions --- .github/workflows/release.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e6596d..a9f1414 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,16 @@ jobs: - name: Publish XPRising.ClientUI to Thunderstore run: tcli publish --config-path ./ClientUI/thunderstore.toml --token ${{ secrets.THUNDERSTORE_KEY }} --file ./dist/XPRising-ClientUI-${RELEASE_TAG:1}.zip - + + update_latest_release: + # required to allow release to be updated + permissions: + contents: write + env: + RELEASE_TAG: ${{ github.event.inputs.tag_name || github.event.release.tag_name }} + runs-on: ubuntu-latest + + steps: - name: Set release as latest run: gh release edit ${{ env.RELEASE_TAG }} --draft=false --latest env: From 80374ab981ff77ab24f303cdf9bdeb05409c903c Mon Sep 17 00:00:00 2001 From: Anthony Mosca Date: Wed, 4 Jun 2025 00:27:36 +0930 Subject: [PATCH 5/5] Updated CHANGELOG.md --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9794844..34bd41a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [0.4.10] - 2025-06-04 + +### Added + +- Added support for allowing all mastery gain to reduce as mastery increase (separate from prestige mechanics). The `Mastery Gain Reduction` configuration option in `GlobalMasteryConfig.cfg` can be used to allow a linear mastery gain (across 0-100%) to having the mastery gain reduced to 0 as the mastery reaches 100%. + +### Fixed + +- Fixed XP gain on mobs that should get 0 XP +- Updated support for ambush mobs so that Bloodcraft will treat them as normal mobs and give an appropriate amount of XP + ## [0.4.9] - 2025-05-30 ### Changed