Add patches for shop checkout and lifecycle day updates
- Implemented ShopPatch to emit a checkout event when the checkout button is pressed. - Created TimePatch to track and emit events when a game day ends, including both canonical and legacy event emissions.
This commit is contained in:
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.0.0.35-pre] - 2026-04-21
|
||||
### Fixed
|
||||
- **Unity 6 Compatibility**: Fixed `UpdateCoin` Harmony patch parameter name mismatch (`_amount` -> `_coinChhangeAmount`).
|
||||
- **Stability**: Switched `GregDevConsole` and UI windows to `GUI.Window` to avoid `LayoutedWindow` constructor errors in Unity 6.
|
||||
- **HexViewer**: Major refactor to use stable IMGUI and current SDK namespaces.
|
||||
|
||||
## [0.1.0] - 2026-04-18
|
||||
### Added
|
||||
- NuGet packaging baseline for `gregCore` with symbol package output (`.snupkg`).
|
||||
|
||||
Binary file not shown.
+21
-83
@@ -1,7 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- ── Build ──────────────────────────────────────────────────── -->
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
@@ -9,19 +8,8 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<AssemblyName>gregCore</AssemblyName>
|
||||
<NoWarn>CS1701;CS1702;MSB3243;MSB3245</NoWarn>
|
||||
|
||||
<!-- ── NuGet Identity ────────────────────────────────────────── -->
|
||||
<PackageId>gregCore</PackageId>
|
||||
<Version>1.1.0</Version>
|
||||
<Authors>TeamGreg</Authors>
|
||||
<Company>TeamGreg</Company>
|
||||
<Product>gregCore</Product>
|
||||
|
||||
<!-- ── Assembly Generation ────────────────────────────────────── -->
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
|
||||
|
||||
<!-- ── Item Inclusions ───────────────────────────────────────── -->
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
|
||||
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
|
||||
@@ -33,77 +21,22 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Core Dependencies (Direct references to avoid conflicts) -->
|
||||
<Reference Include="MelonLoader">
|
||||
<HintPath>lib\references\MelonLoader\net6\MelonLoader.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>lib\references\MelonLoader\net6\0Harmony.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Il2CppInterop.Runtime">
|
||||
<HintPath>lib\references\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
|
||||
<!-- IL2CPP Base Libraries -->
|
||||
<Reference Include="Il2Cppmscorlib">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Il2CppSystem">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\Il2CppSystem.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Il2CppSystem.Core">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\Il2CppSystem.Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
|
||||
<!-- Game Assemblies -->
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
|
||||
<!-- UnityEngine Core & Modules -->
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputLegacyModule">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.PhysicsModule">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Unity.InputSystem">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\Unity.InputSystem.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Il2CppTMPro">
|
||||
<HintPath>lib\references\MelonLoader\Il2CppAssemblies\Il2CppTMPro.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="MelonLoader"><HintPath>lib\references\MelonLoader\net6\MelonLoader.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="0Harmony"><HintPath>lib\references\MelonLoader\net6\0Harmony.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="Il2CppInterop.Runtime"><HintPath>lib\references\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="Il2Cppmscorlib"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="Il2CppSystem"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\Il2CppSystem.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="Il2CppSystem.Core"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\Il2CppSystem.Core.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="Assembly-CSharp"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="UnityEngine.CoreModule"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="UnityEngine"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="UnityEngine.UI"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.IMGUIModule.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="UnityEngine.InputLegacyModule"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="UnityEngine.PhysicsModule"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.PhysicsModule.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\UnityEngine.TextRenderingModule.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="Unity.InputSystem"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\Unity.InputSystem.dll</HintPath><Private>false</Private></Reference>
|
||||
<Reference Include="Il2CppTMPro"><HintPath>lib\references\MelonLoader\Il2CppAssemblies\Il2CppTMPro.dll</HintPath><Private>false</Private></Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -115,6 +48,11 @@
|
||||
<PackageReference Include="pythonnet" Version="3.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Automatic ILRepack disabled due to IL2CPP reference conflicts. Use deploy/unify-core.ps1 instead. -->
|
||||
<Target Name="CleanupAfterBuild" AfterTargets="Build">
|
||||
<Delete Files="$(OutputPath)Acornima.dll;$(OutputPath)Python.Runtime.dll" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="tests\**" />
|
||||
<Compile Remove="plugins\**" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v6.0": {
|
||||
"gregCore/1.0.0.33-pre": {
|
||||
"gregCore/1.0.0": {
|
||||
"dependencies": {
|
||||
"Jint": "4.8.0",
|
||||
"LiteDB": "5.0.21",
|
||||
@@ -93,7 +93,7 @@
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"gregCore/1.0.0.33-pre": {
|
||||
"gregCore/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,151 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v6.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v6.0": {
|
||||
"gregCore/1.0.0": {
|
||||
"dependencies": {
|
||||
"Jint": "4.8.0",
|
||||
"LiteDB": "5.0.21",
|
||||
"Mono.Cecil": "0.11.6",
|
||||
"MoonSharp": "2.0.0",
|
||||
"Newtonsoft.Json": "13.0.3",
|
||||
"pythonnet": "3.0.5"
|
||||
},
|
||||
"runtime": {
|
||||
"gregCore.dll": {}
|
||||
}
|
||||
},
|
||||
"Acornima/1.4.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/Acornima.dll": {
|
||||
"assemblyVersion": "1.4.0.0",
|
||||
"fileVersion": "1.4.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Jint/4.8.0": {
|
||||
"dependencies": {
|
||||
"Acornima": "1.4.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/Jint.dll": {
|
||||
"assemblyVersion": "4.8.0.0",
|
||||
"fileVersion": "4.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"LiteDB/5.0.21": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/LiteDB.dll": {
|
||||
"assemblyVersion": "5.0.21.0",
|
||||
"fileVersion": "5.0.21.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mono.Cecil/0.11.6": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Mono.Cecil.Mdb.dll": {
|
||||
"assemblyVersion": "0.11.6.0",
|
||||
"fileVersion": "0.11.6.0"
|
||||
},
|
||||
"lib/netstandard2.0/Mono.Cecil.Pdb.dll": {
|
||||
"assemblyVersion": "0.11.6.0",
|
||||
"fileVersion": "0.11.6.0"
|
||||
},
|
||||
"lib/netstandard2.0/Mono.Cecil.Rocks.dll": {
|
||||
"assemblyVersion": "0.11.6.0",
|
||||
"fileVersion": "0.11.6.0"
|
||||
},
|
||||
"lib/netstandard2.0/Mono.Cecil.dll": {
|
||||
"assemblyVersion": "0.11.6.0",
|
||||
"fileVersion": "0.11.6.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"MoonSharp/2.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard1.6/MoonSharp.Interpreter.dll": {
|
||||
"assemblyVersion": "2.0.0.0",
|
||||
"fileVersion": "2.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.3": {
|
||||
"runtime": {
|
||||
"lib/net6.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.3.27908"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pythonnet/3.0.5": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Python.Runtime.dll": {
|
||||
"assemblyVersion": "3.0.5.0",
|
||||
"fileVersion": "3.0.5.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"gregCore/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Acornima/1.4.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-3M7NpnhKL//pf7HkSfLJaGQ37uksibdqfa9YuUov1VOX0QXapZeYCUpURZ9an4VMt9wJ70MU/PeAsjhw8DwtJw==",
|
||||
"path": "acornima/1.4.0",
|
||||
"hashPath": "acornima.1.4.0.nupkg.sha512"
|
||||
},
|
||||
"Jint/4.8.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-JlXh13WDivP2izPgS9jeUlzyP//hsHUGhGb33EQHLuRiLhdwJ0ajaYjVETnqnkIQay/qP6NHglxx/40bL0/ihQ==",
|
||||
"path": "jint/4.8.0",
|
||||
"hashPath": "jint.4.8.0.nupkg.sha512"
|
||||
},
|
||||
"LiteDB/5.0.21": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ykJ7ffFl7P9YQKR/PLci6zupiLrsSCNkOTiw6OtzntH7d2kCYp5L1+3a/pksKgTEHcJBoPXFtg7VZSGVBseN9w==",
|
||||
"path": "litedb/5.0.21",
|
||||
"hashPath": "litedb.5.0.21.nupkg.sha512"
|
||||
},
|
||||
"Mono.Cecil/0.11.6": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==",
|
||||
"path": "mono.cecil/0.11.6",
|
||||
"hashPath": "mono.cecil.0.11.6.nupkg.sha512"
|
||||
},
|
||||
"MoonSharp/2.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-uiAcRh7d+53k3xW9pFDJfAFVw4RnjHVCJG05M3oPAVEVwPtFavhg1H/IpC6So4X1j9kJlzuLlA3OghhPcIvc5A==",
|
||||
"path": "moonsharp/2.0.0",
|
||||
"hashPath": "moonsharp.2.0.0.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
|
||||
"path": "newtonsoft.json/13.0.3",
|
||||
"hashPath": "newtonsoft.json.13.0.3.nupkg.sha512"
|
||||
},
|
||||
"pythonnet/3.0.5": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-20UVeB1uDpvCHZi8yNv7VCSUKVRRaxPZWFYhkO+BjfBB9GgOh2vEeucy3U7zTY8xEVCHf2XHpRNfAU/3quxXZw==",
|
||||
"path": "pythonnet/3.0.5",
|
||||
"hashPath": "pythonnet.3.0.5.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+7
-4
@@ -168,7 +168,7 @@ public static class GregAPI
|
||||
// --- Events ---
|
||||
public static void FireEvent(GregEventId eventId, ulong data = 0)
|
||||
{
|
||||
if (gregCore.PublicApi.greg.IsInitialized && _eventIdToHook.TryGetValue(eventId, out string hookName))
|
||||
if (gregCore.PublicApi.greg.IsInitialized && _eventIdToHook.TryGetValue(eventId, out string? hookName) && hookName != null)
|
||||
{
|
||||
var ctx = gregCore.PublicApi.greg._context;
|
||||
ctx?.EventBus.Publish(hookName, new EventPayload
|
||||
@@ -195,13 +195,16 @@ public static class GregAPI
|
||||
|
||||
_subscriptions[eventId].Add(handler);
|
||||
|
||||
if (gregCore.PublicApi.greg.IsInitialized && _eventIdToHook.TryGetValue(eventId, out string hookName))
|
||||
if (gregCore.PublicApi.greg.IsInitialized && _eventIdToHook.TryGetValue(eventId, out string? hookName) && hookName != null)
|
||||
{
|
||||
var ctx = gregCore.PublicApi.greg._context;
|
||||
ctx?.EventBus.Subscribe(hookName, payload => {
|
||||
ulong data = 0;
|
||||
if (payload.Data.TryGetValue("raw_data", out var d)) data = Convert.ToUInt64(d);
|
||||
else if (payload.Data.TryGetValue("NewValue", out var nv)) data = Convert.ToUInt64(nv);
|
||||
if (payload.Data != null)
|
||||
{
|
||||
if (payload.Data.TryGetValue("raw_data", out var d)) data = Convert.ToUInt64(d);
|
||||
else if (payload.Data.TryGetValue("NewValue", out var nv)) data = Convert.ToUInt64(nv);
|
||||
}
|
||||
handler(data);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -199,7 +199,12 @@ public class GregPythonApi
|
||||
var dict = new PyDict(dataDict);
|
||||
foreach (var key in dict.Keys())
|
||||
{
|
||||
payload.Data[key.ToString()] = dict.GetItem(key).AsManagedObject(typeof(object));
|
||||
var k = key.ToString();
|
||||
var v = dict.GetItem(key)?.AsManagedObject(typeof(object));
|
||||
if (k != null && v != null)
|
||||
{
|
||||
payload.Data[k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
GregAPI.Hooks.Fire(hookName, payload);
|
||||
|
||||
@@ -5,7 +5,7 @@ using gregCore.GameLayer.Bootstrap;
|
||||
using gregCore.Infrastructure.Logging;
|
||||
using gregCore.Sdk.Language;
|
||||
|
||||
[assembly: MelonInfo(typeof(gregCore.Core.GregCoreMod), "gregCore", "1.1.0", "TeamGreg")]
|
||||
[assembly: MelonInfo(typeof(gregCore.Core.GregCoreMod), "gregCore", "1.0.0.35-pre", "TeamGreg")]
|
||||
[assembly: MelonGame("", "Data Center")]
|
||||
[assembly: MelonOptionalDependencies("Python.Runtime", "RustBridge", "JS.Runtime.Binding")]
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace gregCore.Core;
|
||||
/// </summary>
|
||||
public sealed class GregCoreMod : MelonMod
|
||||
{
|
||||
public static GregCoreMod Instance { get; private set; }
|
||||
public static GregCoreMod Instance { get; private set; } = null!;
|
||||
|
||||
private GregServiceContainer? _container;
|
||||
private IGregLogger? _logger;
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
/// Maintainer: Einzige Stelle wo Implementierungen an Interfaces gebunden werden. Validiert den Startup.
|
||||
/// </file-summary>
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using gregCore.Infrastructure.Logging;
|
||||
using gregCore.Infrastructure.Config;
|
||||
using gregCore.Infrastructure.Ffi;
|
||||
@@ -21,6 +24,20 @@ internal static class GregBootstrapper
|
||||
{
|
||||
public static GregServiceContainer Build(global::MelonLoader.MelonLogger.Instance melonLogger)
|
||||
{
|
||||
// Initialize Assembly Resolver for subfolder dependencies
|
||||
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {
|
||||
try {
|
||||
var name = new AssemblyName(args.Name).Name;
|
||||
var depDir = Path.Combine(global::MelonLoader.Utils.MelonEnvironment.ModsDirectory, "gregDependencies");
|
||||
var targetPath = Path.Combine(depDir, name + ".dll");
|
||||
|
||||
if (File.Exists(targetPath)) {
|
||||
return Assembly.LoadFrom(targetPath);
|
||||
}
|
||||
} catch { }
|
||||
return null;
|
||||
};
|
||||
|
||||
var container = new GregServiceContainer();
|
||||
|
||||
// Initialize static Logger
|
||||
|
||||
@@ -26,9 +26,9 @@ public sealed class GregNativeEventHooks : SafePatch
|
||||
// --- Domäne: Economy ---
|
||||
[HarmonyPatch(typeof(global::Il2Cpp.Player), nameof(global::Il2Cpp.Player.UpdateCoin))]
|
||||
[HarmonyPostfix]
|
||||
public static void Postfix_PlayerCoinChanged(global::Il2Cpp.Player __instance, float _amount)
|
||||
public static void Postfix_PlayerCoinChanged(global::Il2Cpp.Player __instance, float _coinChhangeAmount)
|
||||
{
|
||||
TriggerHook("greg.PLAYER.CoinChanged", "Amount", _amount, "Total", _amount);
|
||||
TriggerHook("greg.PLAYER.CoinChanged", "Amount", _coinChhangeAmount, "Total", _coinChhangeAmount);
|
||||
}
|
||||
|
||||
// --- Domäne: Persistence ---
|
||||
|
||||
@@ -26,6 +26,9 @@ internal static class HookIntegration
|
||||
SafePatch(harmony, typeof(Il2Cpp.Player), nameof(Il2Cpp.Player.UpdateCoin), typeof(gregCore.GameLayer.Patches.Economy.PlayerPatch), nameof(gregCore.GameLayer.Patches.Economy.PlayerPatch.OnCoinUpdated));
|
||||
SafePatch(harmony, typeof(Il2Cpp.Player), nameof(Il2Cpp.Player.UpdateXP), typeof(gregCore.GameLayer.Patches.Economy.PlayerPatch), nameof(gregCore.GameLayer.Patches.Economy.PlayerPatch.OnXpUpdated));
|
||||
SafePatch(harmony, typeof(Il2Cpp.Player), nameof(Il2Cpp.Player.UpdateReputation), typeof(gregCore.GameLayer.Patches.Economy.PlayerPatch), nameof(gregCore.GameLayer.Patches.Economy.PlayerPatch.OnReputationUpdated));
|
||||
|
||||
SafePatch(harmony, typeof(Il2Cpp.ComputerShop), nameof(Il2Cpp.ComputerShop.ButtonCheckOut), typeof(gregCore.GameLayer.Patches.Economy.ShopPatch), nameof(gregCore.GameLayer.Patches.Economy.ShopPatch.OnCheckOut));
|
||||
SafePatch(harmony, typeof(Il2Cpp.TimeController), "Update", typeof(gregCore.GameLayer.Patches.Lifecycle.TimePatch), nameof(gregCore.GameLayer.Patches.Lifecycle.TimePatch.OnUpdate));
|
||||
}
|
||||
|
||||
internal static void Emit(HookName hook, EventPayload payload)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using gregCore.GameLayer.Hooks;
|
||||
|
||||
namespace gregCore.GameLayer.Patches.Economy;
|
||||
|
||||
internal static class ShopPatch
|
||||
{
|
||||
internal static void OnCheckOut(object __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
var payload = EventPayloadBuilder.ForGeneric("greg.SYSTEM.ButtonCheckOut", new Dictionary<string, object>
|
||||
{
|
||||
{ "Timestamp", DateTime.UtcNow }
|
||||
});
|
||||
HookIntegration.Emit(HookName.Create("system", "ButtonCheckOut"), payload);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HookIntegration.LogPatchError(nameof(OnCheckOut), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using gregCore.GameLayer.Hooks;
|
||||
|
||||
namespace gregCore.GameLayer.Patches.Lifecycle;
|
||||
|
||||
internal static class TimePatch
|
||||
{
|
||||
private static int _lastDay = -1;
|
||||
|
||||
internal static void OnUpdate(global::Il2Cpp.TimeController __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
int currentDay = __instance.day;
|
||||
if (_lastDay >= 0 && currentDay != _lastDay)
|
||||
{
|
||||
var payload = EventPayloadBuilder.ForGeneric("greg.lifecycle.DayEnded", new Dictionary<string, object>
|
||||
{
|
||||
{ "Day", currentDay },
|
||||
{ "PreviousDay", _lastDay }
|
||||
});
|
||||
|
||||
// Emit for both canonical and legacy
|
||||
HookIntegration.Emit(HookName.Create("lifecycle", "DayEnded"), payload);
|
||||
HookIntegration.Emit(HookName.Create("system", "GameDayAdvanced"), payload);
|
||||
}
|
||||
_lastDay = currentDay;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HookIntegration.LogPatchError(nameof(OnUpdate), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,11 @@ internal static class SettingsUiBridgePatch
|
||||
private static bool _tabInjected = false;
|
||||
private static GregSettingsUiBridge _uiBridge = null!;
|
||||
|
||||
private static GregSettingsUiBridge GetBridge()
|
||||
private static GregSettingsUiBridge? GetBridge()
|
||||
{
|
||||
if (_uiBridge == null)
|
||||
{
|
||||
_uiBridge = GregServiceContainer.Get<GregSettingsUiBridge>();
|
||||
_uiBridge = GregServiceContainer.Get<GregSettingsUiBridge>()!;
|
||||
}
|
||||
return _uiBridge;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ public class GregInputBindingService
|
||||
{
|
||||
private readonly IGregLogger _logger;
|
||||
private readonly GregKeybindRegistry _keybindRegistry;
|
||||
private GregSettingsPersistenceService _persistence;
|
||||
private GregSettingsPersistenceService _persistence = null!;
|
||||
|
||||
public GregInputBindingService(IGregLogger logger, GregKeybindRegistry keybindRegistry)
|
||||
{
|
||||
|
||||
@@ -30,11 +30,12 @@ public sealed class GregDevConsole
|
||||
public void OnGUI()
|
||||
{
|
||||
if (!_isOpen) return;
|
||||
_windowRect = GUILayout.Window(1337, _windowRect, (Action<int>)DrawWindow, "gregCore DevConsole");
|
||||
_windowRect = GUI.Window(1337, _windowRect, (UnityEngine.GUI.WindowFunction)DrawWindow, "gregCore DevConsole");
|
||||
}
|
||||
|
||||
private void DrawWindow(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
_scrollPosition = GUILayout.BeginScrollView(_scrollPosition);
|
||||
foreach (var log in _logs)
|
||||
{
|
||||
@@ -53,6 +54,7 @@ public sealed class GregDevConsole
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
+5
-5
@@ -59,7 +59,7 @@ public sealed class GregAPI : IGregAPI
|
||||
}
|
||||
|
||||
var sdkPayload = new GregPayload(payload.HookName ?? hookName, trigger) {
|
||||
Data = payload.Data?.ToDictionary(kv => kv.Key, kv => kv.Value) ?? new Dictionary<string, object>()
|
||||
Data = payload.Data?.ToDictionary(kv => kv.Key, kv => kv.Value!) ?? new Dictionary<string, object>()
|
||||
};
|
||||
handler(sdkPayload);
|
||||
});
|
||||
@@ -67,7 +67,7 @@ public sealed class GregAPI : IGregAPI
|
||||
|
||||
public void Fire(string hookName, GregPayload payload)
|
||||
{
|
||||
var data = new Dictionary<string, object>(payload.Data)
|
||||
var data = new Dictionary<string, object>(payload.Data ?? new Dictionary<string, object>())
|
||||
{
|
||||
["Trigger"] = payload.Trigger
|
||||
};
|
||||
@@ -88,7 +88,7 @@ public sealed class GregAPI : IGregAPI
|
||||
if (!_validationService.ValidateModId(modId)) return;
|
||||
|
||||
_pluginRegistry.RegisterMod(new ModMetadata {
|
||||
ModId = modId, Name = name, Version = version, ApiObject = apiObject
|
||||
ModId = modId, Name = name, Version = version, ApiObject = apiObject!
|
||||
});
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public sealed class GregAPI : IGregAPI
|
||||
public void RegisterToggle(string modId, string settingId, string displayName, bool defaultValue, Action<bool>? onChanged = null, string category = "General", string description = "")
|
||||
{
|
||||
var entry = new Infrastructure.Settings.Models.SettingEntry<bool> {
|
||||
ModId = modId, SettingId = settingId, DisplayName = displayName, DefaultValue = defaultValue, OnValueChanged = onChanged, Category = category, Description = description
|
||||
ModId = modId, SettingId = settingId, DisplayName = displayName, DefaultValue = defaultValue, OnValueChanged = onChanged!, Category = category, Description = description
|
||||
};
|
||||
_settingsService.Register(entry);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public sealed class GregAPI : IGregAPI
|
||||
public void RegisterSlider(string modId, string settingId, string displayName, float defaultValue, Action<float>? onChanged = null, string category = "General", string description = "")
|
||||
{
|
||||
var entry = new Infrastructure.Settings.Models.SettingEntry<float> {
|
||||
ModId = modId, SettingId = settingId, DisplayName = displayName, DefaultValue = defaultValue, OnValueChanged = onChanged, Category = category, Description = description
|
||||
ModId = modId, SettingId = settingId, DisplayName = displayName, DefaultValue = defaultValue, OnValueChanged = onChanged!, Category = category, Description = description
|
||||
};
|
||||
_settingsService.Register(entry);
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace greg.WallRack.Integration
|
||||
{
|
||||
if (!frameworkSdk.GregFeatureGuard.IsEnabled("WallRack")) return;
|
||||
|
||||
string? wallId = GregPayload.Get<string>(payload, "wallId", null);
|
||||
string? wallPosStr = GregPayload.Get<string>(payload, "wallPos", null);
|
||||
string? wallNormStr = GregPayload.Get<string>(payload, "wallNormal", null);
|
||||
string? wallId = GregPayload.Get<string?>(payload, "wallId", null);
|
||||
string? wallPosStr = GregPayload.Get<string?>(payload, "wallPos", null);
|
||||
string? wallNormStr = GregPayload.Get<string?>(payload, "wallNormal", null);
|
||||
|
||||
if (string.IsNullOrEmpty(wallId))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user