diff --git a/Mods/0-SCore/0-SCore.csproj b/Mods/0-SCore/0-SCore.csproj index 607d2ee3..68e99ac3 100644 --- a/Mods/0-SCore/0-SCore.csproj +++ b/Mods/0-SCore/0-SCore.csproj @@ -117,6 +117,7 @@ + diff --git a/Mods/0-SCore/Config/XUi/windows.xml b/Mods/0-SCore/Config/XUi/windows.xml index 257c3ecb..b372687a 100644 --- a/Mods/0-SCore/Config/XUi/windows.xml +++ b/Mods/0-SCore/Config/XUi/windows.xml @@ -1,16 +1,14 @@  - - - - - - - + + + + + + @@ -56,15 +54,11 @@ - - - - - - - diff --git a/Mods/0-SCore/Features/Challenges/Scripts/ChallengeObjectiveCompleteQuestStealth.cs b/Mods/0-SCore/Features/Challenges/Scripts/ChallengeObjectiveCompleteQuestStealth.cs index 62bf4e9b..3567bd71 100644 --- a/Mods/0-SCore/Features/Challenges/Scripts/ChallengeObjectiveCompleteQuestStealth.cs +++ b/Mods/0-SCore/Features/Challenges/Scripts/ChallengeObjectiveCompleteQuestStealth.cs @@ -3,6 +3,7 @@ using System.Xml.Linq; using HarmonyLib; using Challenges; +using SCore.Features.PlayerMetrics; using UnityEngine; namespace Challenges { diff --git a/Mods/0-SCore/Features/Challenges/Scripts/ChallengeObjectiveStealthKillStreak.cs b/Mods/0-SCore/Features/Challenges/Scripts/ChallengeObjectiveStealthKillStreak.cs index a3ad7308..b7b1120a 100644 --- a/Mods/0-SCore/Features/Challenges/Scripts/ChallengeObjectiveStealthKillStreak.cs +++ b/Mods/0-SCore/Features/Challenges/Scripts/ChallengeObjectiveStealthKillStreak.cs @@ -3,6 +3,7 @@ using System.Xml.Linq; using HarmonyLib; using Challenges; +using SCore.Features.PlayerMetrics; using UnityEngine; namespace Challenges { @@ -11,22 +12,39 @@ namespace Challenges { * To pass this challenge, you must do consecutive stealth kills until you've reached the desired count. * * - * + * */ public class ChallengeObjectiveStealthKillStreak : ChallengeObjectiveKillWithItem { public override ChallengeObjectiveType ObjectiveType => (ChallengeObjectiveType)ChallengeObjectiveTypeSCore.ChallengeObjectiveStealthKillStreak; + public string cvarName; public new string LocalizationKey = "challengeObjectiveStealthKillStreak"; // If we pass the pre-requisite, call the base class of the KillWithTags to do the heavy lifting for us. protected override bool Check_EntityKill(DamageResponse dmgResponse, EntityAlive entityDamaged) { - if (dmgResponse.Source.BonusDamageType != EnumDamageBonusType.Sneak) - { - ResetComplete(); - return false; - } - return base.Check_EntityKill(dmgResponse, entityDamaged); + if (dmgResponse.Source.BonusDamageType != EnumDamageBonusType.Sneak) + { + SCoreMetrics.UpdateCVar(cvarName, Current); + ResetComplete(); + return false; + } + + return base.Check_EntityKill(dmgResponse, entityDamaged); + } + + public override void ParseElement(XElement e) { + base.ParseElement(e); + if (e.HasAttribute("cvar")) + { + cvarName = e.GetAttribute("cvar"); + } + } + + public override BaseChallengeObjective Clone() { + return new ChallengeObjectiveStealthKillStreak { + cvarName = cvarName + }; } } } \ No newline at end of file diff --git a/Mods/0-SCore/Features/Challenges/Scripts/SCoreChallengeUtils.cs b/Mods/0-SCore/Features/Challenges/Scripts/SCoreChallengeUtils.cs index dfe37acf..404e0990 100644 --- a/Mods/0-SCore/Features/Challenges/Scripts/SCoreChallengeUtils.cs +++ b/Mods/0-SCore/Features/Challenges/Scripts/SCoreChallengeUtils.cs @@ -20,6 +20,7 @@ public static bool IsHoldingItemName(string itemName) { return false; } + public static string GetWithString() { return Localization.Get("challengeObjectiveWith"); } diff --git a/Mods/0-SCore/Features/PlayerMetrics/SCoreMetrics.cs b/Mods/0-SCore/Features/PlayerMetrics/SCoreMetrics.cs new file mode 100644 index 00000000..38b38858 --- /dev/null +++ b/Mods/0-SCore/Features/PlayerMetrics/SCoreMetrics.cs @@ -0,0 +1,12 @@ +namespace SCore.Features.PlayerMetrics { + public class SCoreMetrics { + public static void UpdateCVar(string cvarName, int newValue) { + if (string.IsNullOrEmpty(cvarName)) return; + var player = GameManager.Instance.World.GetPrimaryPlayer(); + if (player == null) return; + var currentValue = player.Buffs.GetCustomVar(cvarName); + if (currentValue > newValue) return; + player.Buffs.SetCustomVar(cvarName, newValue); + } + } +} \ No newline at end of file diff --git a/Mods/0-SCore/ModInfo.xml b/Mods/0-SCore/ModInfo.xml index 3aaac254..5ee6dfe8 100644 --- a/Mods/0-SCore/ModInfo.xml +++ b/Mods/0-SCore/ModInfo.xml @@ -5,5 +5,5 @@ - + \ No newline at end of file diff --git a/Mods/0-SCore/Properties/AssemblyInfo.cs b/Mods/0-SCore/Properties/AssemblyInfo.cs index bed215d2..7f24f7d0 100644 --- a/Mods/0-SCore/Properties/AssemblyInfo.cs +++ b/Mods/0-SCore/Properties/AssemblyInfo.cs @@ -38,5 +38,5 @@ // [assembly: AssemblyVersion("1.0.*")] //[assembly: AssemblyVersion("20.0.*")] -[assembly: AssemblyVersion("1.0.82.0935")] -[assembly: AssemblyFileVersion("1.0.82.0935")] +[assembly: AssemblyVersion("1.0.83.0950")] +[assembly: AssemblyFileVersion("1.0.83.0950")] diff --git a/Mods/0-SCore/ReadMe.md b/Mods/0-SCore/ReadMe.md index 9d49ec8f..1c67094a 100644 --- a/Mods/0-SCore/ReadMe.md +++ b/Mods/0-SCore/ReadMe.md @@ -1,6 +1,7 @@ #0-SCore -The 0-SCore is the key component to enable extra functionality for 7 Days To Die. Using a mixture of Harmony, SDX Patch Scripts, and Scripts, new features are enabled for modders and players to use. +The 0-SCore is the key component to enable extra functionality for 7 Days To Die. Using a mixture of Harmony, SDX Patch Scripts, and Scripts, +new features are enabled for modders and players to use. | Folder | Description | | ----------- | ----------- | @@ -9,12 +10,8 @@ The 0-SCore is the key component to enable extra functionality for 7 Days To Die | Scripts | Many Scripts which include new classes. References to these scripts would be ```, SCore``` | |Features | Features will contain all the code necessary for a particular feature, grouping the code so it can be easily found and extracted. | -Note: An auto-mirror is available on gitlab that allows you to download individual mods: https://gitlab.com/sphereii/SphereII-Mods - ### Direct Downloads -Direct Download to the 0-SCore.zip available on gitlab mirror: - -[ 0 - SCore ( Latest ) ]: https://gitlab.com/sphereii/SphereII-Mods/-/archive/master/SphereII-Mods-master.zip?path=0-SCore +Direct Download to the 0-SCore.zip available on gitlab mirror: https://github.com/SphereII/SphereII.Mods/releases/latest ### TODO - Fix random sounds from NPC, like stamina exhaustion @@ -23,6 +20,20 @@ Direct Download to the 0-SCore.zip available on gitlab mirror: ### Change Logs [ Change Log ] +Version: 1.0.83.950 + [ Events ] + - Fixed a null reference with the OnClientKill when the game would trigger the event after the game killed. + + [ Challenges ] + - Added an optional cvar attribute for StealthKillStreak. + - This cvar will hold the longest recorded kill streak. + + + [ SCore Utilities ] + - Created a window group for the SCore Utilities button + - Added it to the xui.xml, rather than the existing in game-menu + - Removed the background and cleaned up the SCore Utilities creen. + Version: 1.0.82.935 [ Fire Mod ] diff --git a/Mods/0-SCore/SCore.dll b/Mods/0-SCore/SCore.dll index 59aa4d38..a814e532 100644 Binary files a/Mods/0-SCore/SCore.dll and b/Mods/0-SCore/SCore.dll differ diff --git a/Mods/0-SCore/SCore.pdb b/Mods/0-SCore/SCore.pdb index 880d4c8d..86fb1b07 100644 Binary files a/Mods/0-SCore/SCore.pdb and b/Mods/0-SCore/SCore.pdb differ diff --git a/Mods/0-SCore/Scripts/Events/EventOnClientKill.cs b/Mods/0-SCore/Scripts/Events/EventOnClientKill.cs index 456b79b3..4820c27a 100644 --- a/Mods/0-SCore/Scripts/Events/EventOnClientKill.cs +++ b/Mods/0-SCore/Scripts/Events/EventOnClientKill.cs @@ -9,6 +9,16 @@ public static class EventOnClientKill { [HarmonyPatch("ClientKill")] public class EntityAliveProcessDamageResponseLocal { private static void Postfix(DamageResponse _dmResponse, EntityAlive __instance) { + // Let's go through some pre-checks, since we do not want the game kills to trigger this event. + + // from killall + if (_dmResponse.Strength == 99999) return; + + // From blood moon party kill, time of day + if (_dmResponse.Source == null) return; + + // Also from kill all, but also a good idea. + if (_dmResponse.Source.GetDamageType() == EnumDamageTypes.Suicide) return; OnClientKillEvent?.Invoke(_dmResponse, __instance); } }