Skip to content

Commit

Permalink
1.0.83.950
Browse files Browse the repository at this point in the history
  • Loading branch information
SphereII committed Sep 16, 2024
1 parent 9971933 commit e80ca5e
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 37 deletions.
1 change: 1 addition & 0 deletions Mods/0-SCore/0-SCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
<Compile Include="Features\ParticleAttractor\Scripts\Particles\particleAttractorLinear.cs" />
<Compile Include="Features\ParticlesOnBlocks\Harmony\Blocks.cs" />
<Compile Include="Features\PlayerMetrics\KillTracking\Scripts\SCoreKillTracker.cs" />
<Compile Include="Features\PlayerMetrics\SCoreMetrics.cs" />
<Compile Include="Features\RemoteCrafting\Harmony\DropBoxToContainers.cs" />
<Compile Include="Features\RemoteCrafting\Harmony\IngredientsFromContainers.cs" />
<Compile Include="Features\RemoteCrafting\Harmony\ItemActionRepairPatches.cs" />
Expand Down
32 changes: 11 additions & 21 deletions Mods/0-SCore/Config/XUi/windows.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<configs>

<append xpath="/windows/window[@name='ingameMenu']/grid">
<grid name="buttons" pos="0, -0" cols="1" width="250" cell_width="250" cell_height="56" arrangement="vertical"
repeat_content="false" controller="SCoreInGameMenu, SCore">
<simplebutton name="btnSCoreOptions" depth="3" width="250" height="46" caption_key="xuiSCoreUtilities"
font_size="40"/>
<simplebutton name="btnNPCView" depth="3" width="250" height="46" caption_key="xuiSCoreNPCSettings"
font_size="40"/>
</grid>

</append>
<append xpath="/windows">
<window name="ingameMenuSCore" anchor="RightTop" pos="-620,-80" width="300" height="200" controller="SCoreInGameMenu, SCore" cursor_area="true">
<grid name="buttons" pos="0, -0" cols="1" width="250" cell_width="250" cell_height="56" arrangement="vertical" repeat_content="false" >
<simplebutton name="btnSCoreOptions" depth="3" width="250" height="46" caption_key="xuiSCoreUtilities"
font_size="40"/>
<simplebutton name="btnNPCView" depth="3" width="250" height="46" caption_key="xuiSCoreNPCSettings"
font_size="40"/>
</grid>
</window>

<window name="windowLockPicking" width="1000" height="500" anchor="CenterCenter" panel="Center"
controller="PickLocking, SCore" cursor_area="true">
Expand Down Expand Up @@ -56,15 +54,11 @@

<panel name="content" pos="0,-350" width="400" height="600" depth="3" pivot="center"
createuipanel="true" disableautobackground="true">
<sprite depth="9" type="sliced" color="7,7,7,255" sprite="menu_empty" pivot="center" height="700"/>

<sprite depth="9" pos="-160,300" width="320" height="500" type="sliced" color="7,7,7,255"/>

<label depth="16" name="header.name" pos="0,330" width="350" pivot="center" justify="center"
style="label_outline" text_key="xuiSCoreUtilities" font_size="24" overflow="ShrinkContent"
upper_case="true"/>

<grid name="toggles" depth="10" pos="-145,300" cols="1" width="320" cell_width="290"
<grid name="toggle01" depth="10" pos="-145,300" cols="1" width="320" cell_width="290"
cell_height="34" arrangement="vertical" repeat_content="false">

<conditional evaluator="client">
Expand Down Expand Up @@ -142,15 +136,11 @@
depth="3" font_size="24" crispness="OnDesktop" effect="Outline8"
effect_distance="1,1" effect_color="20,20,20,230"/>


<simplebutton name="SCorebtnSubmit" depth="3" pos="0,-80" width="290" height="32"
font_size="24" caption_key="xuiSave" upper_case="true"/>
</grid>
</panel>

<panel name="buttons" pos="0,-560" height="32" depth="6" borderthickness="3" createuipanel="true"
disableautobackground="true">
<simplebutton name="SCorebtnSubmit" depth="3" pos="0,-80" pivot="center" width="200" height="36"
font_size="24" caption_key="xuiSave" upper_case="true"/>
</panel>
</panel>
</window>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Xml.Linq;
using HarmonyLib;
using Challenges;
using SCore.Features.PlayerMetrics;
using UnityEngine;

namespace Challenges {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Xml.Linq;
using HarmonyLib;
using Challenges;
using SCore.Features.PlayerMetrics;
using UnityEngine;

namespace Challenges {
Expand All @@ -11,22 +12,39 @@ namespace Challenges {
* To pass this challenge, you must do consecutive stealth kills until you've reached the desired count.
*
* <!-- Kill two entities in a row with a stealth kill -->
* <objective type="StealthStreak, SCore" count="2"/>
* <objective type="StealthStreak, SCore" count="2" cvar="longestStreakCVar" />
*/
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
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static bool IsHoldingItemName(string itemName) {
return false;
}


public static string GetWithString() {
return Localization.Get("challengeObjectiveWith");
}
Expand Down
12 changes: 12 additions & 0 deletions Mods/0-SCore/Features/PlayerMetrics/SCoreMetrics.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
2 changes: 1 addition & 1 deletion Mods/0-SCore/ModInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<Description value="SCore Mod" />
<DisplayName value="0-SCore" />
<Website value="" />
<Version value="1.0.82.935" />
<Version value="1.0.83.950" />
</xml>
4 changes: 2 additions & 2 deletions Mods/0-SCore/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
23 changes: 17 additions & 6 deletions Mods/0-SCore/ReadMe.md
Original file line number Diff line number Diff line change
@@ -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 |
| ----------- | ----------- |
Expand All @@ -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 ```<className>, 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
Expand All @@ -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.
<objective type="StealthStreak, SCore" count="2" cvar="longestStreakCVar" />

[ 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 ]
Expand Down
Binary file modified Mods/0-SCore/SCore.dll
Binary file not shown.
Binary file modified Mods/0-SCore/SCore.pdb
Binary file not shown.
10 changes: 10 additions & 0 deletions Mods/0-SCore/Scripts/Events/EventOnClientKill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit e80ca5e

Please sign in to comment.