From 760aa6462ceccee7d9424c3b945a059c8d8ea816 Mon Sep 17 00:00:00 2001 From: mfoltz Date: Sat, 31 Aug 2024 01:21:07 -0500 Subject: [PATCH] - changed UI updates to work via coroutine, more reliable and less prone to error so far - fixed bug where wrong BloodType enum was sent to client when frailed - no restedXP message if at max level when logging in while in coffin and restedXP is enabled - added max level for player, legacy, and expertise to config data sent to client when registering to properly make bars full at max levels --- Bloodcraft.csproj | 2 +- CHANGELOG.md | 6 ++++++ Patches/FamiliarPatches.cs | 1 - Patches/ServerBootstrapSystemPatch.cs | 5 +++-- Services/EclipseService.cs | 10 +++++++++- thunderstore.toml | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Bloodcraft.csproj b/Bloodcraft.csproj index 219a903..9de2c99 100644 --- a/Bloodcraft.csproj +++ b/Bloodcraft.csproj @@ -4,7 +4,7 @@ net6.0 enable Bloodcraft - 1.3.0 + 1.3.1 True https://api.nuget.org/v3/index.json; diff --git a/CHANGELOG.md b/CHANGELOG.md index a66af41..9ed4726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +`1.3.1` +- changed UI updates to work via coroutine, more reliable and less prone to error so far +- fixed bug where wrong BloodType enum was sent to client when frailed +- no restedXP message if at max level when logging in while in coffin and restedXP is enabled +- added max level for player, legacy, and expertise to config data sent to client when registering to properly make bars full at max levels + `1.3.0` - added config option for potion stacking - added configurable item cost for choosing familiar visual if already shiny via '.fam v [SpellSchool]', will override current visual (freebie still works as before, cost will take precedence if familiar already has a visual unlocked) diff --git a/Patches/FamiliarPatches.cs b/Patches/FamiliarPatches.cs index 18162d1..66e12c9 100644 --- a/Patches/FamiliarPatches.cs +++ b/Patches/FamiliarPatches.cs @@ -224,7 +224,6 @@ static void OnUpdatePrefix(SpawnTransformSystem_OnSpawn __instance) LocalizationService.HandleServerReply(EntityManager, user, $"Failed to bind familiar..."); } } - } if (summon) continue; diff --git a/Patches/ServerBootstrapSystemPatch.cs b/Patches/ServerBootstrapSystemPatch.cs index 43a5c0e..4ad78b0 100644 --- a/Patches/ServerBootstrapSystemPatch.cs +++ b/Patches/ServerBootstrapSystemPatch.cs @@ -308,20 +308,21 @@ static void OnUserConnectedPostfix(ServerBootstrapSystem __instance, NetConnecti DateTime lastLogout = restedData.Key; TimeSpan timeOffline = DateTime.UtcNow - lastLogout; - if (timeOffline.TotalMinutes >= ConfigService.RestedXPTickRate && restedMultiplier != 0) + if (timeOffline.TotalMinutes >= ConfigService.RestedXPTickRate && restedMultiplier != 0 && experience.Key < ConfigService.MaxLevel) { float currentRestedXP = restedData.Value; int currentLevel = experience.Key; int maxRestedLevel = Math.Min(ConfigService.RestedXPMax + currentLevel, ConfigService.MaxLevel); float restedCap = LevelingSystem.ConvertLevelToXp(maxRestedLevel) - LevelingSystem.ConvertLevelToXp(currentLevel); - + float earnedPerTick = ConfigService.RestedXPRate * restedCap; float earnedRestedXP = (float)timeOffline.TotalMinutes / ConfigService.RestedXPTickRate * earnedPerTick * restedMultiplier; currentRestedXP = Math.Min(currentRestedXP + earnedRestedXP, restedCap); int roundedXP = (int)(Math.Round(currentRestedXP / 100.0) * 100); + //Core.Log.LogInfo($"Rested XP: {currentRestedXP} | Earned: {earnedRestedXP} | Rounded: {roundedXP} | Rested Cap: {restedCap} | Max Rested Level: {maxRestedLevel}"); steamId.SetPlayerRestedXP(new KeyValuePair(DateTime.UtcNow, currentRestedXP)); string message = $"+{roundedXP} rested experience earned from being logged out in your coffin!"; LocalizationService.HandleServerReply(EntityManager, user, message); diff --git a/Services/EclipseService.cs b/Services/EclipseService.cs index 6701526..07e0c91 100644 --- a/Services/EclipseService.cs +++ b/Services/EclipseService.cs @@ -141,6 +141,10 @@ public static void SendClientProgress(Entity character, ulong SteamID) if (stats.Count != 0) bonusStats = int.Parse(string.Join("", stats.Select(stat => ((int)stat + 1).ToString("D2")))); } } + else if (bloodType.Equals(BloodType.None)) + { + legacyEnum = (int)bloodType; + } } return (legacyPercent, legacyLevel, legacyPrestige, legacyEnum, bonusStats); @@ -223,9 +227,13 @@ static string BuildConfigMessage() float prestigeStatMultiplier = ConfigService.PrestigeStatMultiplier; float statSynergyMultiplier = ConfigService.StatSynergyMultiplier; + int maxPlayerLevel = ConfigService.MaxLevel; + int maxLegacyLevel = ConfigService.MaxBloodLevel; + int maxExpertiseLevel = ConfigService.MaxExpertiseLevel; + var sb = new StringBuilder(); sb.AppendFormat("[{0}]:", (int)NetworkEventSubType.ConfigsToClient) - .AppendFormat("{0:F2},{1:F2},", prestigeStatMultiplier, statSynergyMultiplier); // Add multipliers to the message + .AppendFormat("{0:F2},{1:F2},{2},{3},{4},", prestigeStatMultiplier, statSynergyMultiplier, maxPlayerLevel, maxLegacyLevel, maxExpertiseLevel); // Add multipliers to the message sb.Append(string.Join(",", weaponStatValues.Select(val => val.ToString("F2")))) .Append(','); diff --git a/thunderstore.toml b/thunderstore.toml index 5849403..9e5a506 100644 --- a/thunderstore.toml +++ b/thunderstore.toml @@ -12,7 +12,7 @@ v-rising = ["1-0-update", "mods", "server"] [package] namespace = "zfolmt" name = "Bloodcraft" -versionNumber = "1.3.0" +versionNumber = "1.3.1" description = "Leveling, expertise, legacies, professions, familiars, classes, quests!" websiteUrl = "https://github.com/mfoltz/Bloodcraft" containsNsfwContent = false