Skip to content

Commit

Permalink
- changed UI updates to work via coroutine, more reliable and less pr…
Browse files Browse the repository at this point in the history
…one 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
  • Loading branch information
mfoltz committed Aug 31, 2024
1 parent 016ab26 commit 760aa64
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Bloodcraft.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>Bloodcraft</AssemblyName>
<Version>1.3.0</Version>
<Version>1.3.1</Version>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<RestoreSources>
https://api.nuget.org/v3/index.json;
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 0 additions & 1 deletion Patches/FamiliarPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ static void OnUpdatePrefix(SpawnTransformSystem_OnSpawn __instance)
LocalizationService.HandleServerReply(EntityManager, user, $"Failed to bind familiar...");
}
}

}

if (summon) continue;
Expand Down
5 changes: 3 additions & 2 deletions Patches/ServerBootstrapSystemPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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, float>(DateTime.UtcNow, currentRestedXP));
string message = $"+<color=#FFD700>{roundedXP}</color> <color=green>rested</color> <color=#FFC0CB>experience</color> earned from being logged out in your coffin!";
LocalizationService.HandleServerReply(EntityManager, user, message);
Expand Down
10 changes: 9 additions & 1 deletion Services/EclipseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(',');
Expand Down
2 changes: 1 addition & 1 deletion thunderstore.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 760aa64

Please sign in to comment.