mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 20:53:28 +08:00
UXAssist and CheatEnabler new release
This commit is contained in:
@@ -81,6 +81,7 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
FactoryPatch.Init();
|
||||
ResourcePatch.Init();
|
||||
PlanetPatch.Init();
|
||||
PlayerFunctions.Init();
|
||||
PlayerPatch.Init();
|
||||
DysonSpherePatch.Init();
|
||||
CombatPatch.Init();
|
||||
@@ -104,5 +105,4 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
if (VFInput.inputing) return;
|
||||
FactoryPatch.OnUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CheatEnabler</Description>
|
||||
<Version>2.3.18</Version>
|
||||
<Version>2.3.19</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>CheatEnabler</PackageId>
|
||||
|
||||
@@ -1,10 +1,36 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UXAssist.Common;
|
||||
|
||||
namespace CheatEnabler;
|
||||
|
||||
public static class PlayerFunctions
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
I18N.Add("ClearAllMetadataConsumptionDetails",
|
||||
"""
|
||||
Metadata consumption records of all gamesaves are about to be cleared.
|
||||
You will gain following metadata back:
|
||||
""",
|
||||
"""
|
||||
所有存档的元数据消耗记录即将被清除,
|
||||
此操作将返还以下元数据:
|
||||
""");
|
||||
I18N.Add("ClearCurrentMetadataConsumptionDetails",
|
||||
"""
|
||||
Metadata consumption records of current gamesave are about to be cleared.
|
||||
You will gain following metadata back:
|
||||
""",
|
||||
"""
|
||||
当前存档的元数据消耗记录即将被清除,
|
||||
此操作将返还以下元数据:
|
||||
""");
|
||||
I18N.Add("NoMetadataConsumptionRecord",
|
||||
"No metadata consumption records found.",
|
||||
"未找到元数据消耗记录。");
|
||||
}
|
||||
|
||||
public static void TeleportToOuterSpace()
|
||||
{
|
||||
var maxSqrDistance = 0.0;
|
||||
@@ -69,19 +95,31 @@ public static class PlayerFunctions
|
||||
|
||||
public static void RemoveAllMetadataConsumptions()
|
||||
{
|
||||
var propertySysten = DSPGame.propertySystem;
|
||||
if (propertySysten == null) return;
|
||||
PurgePropertySystem(propertySysten);
|
||||
var propertySystem = DSPGame.propertySystem;
|
||||
if (propertySystem == null) return;
|
||||
PurgePropertySystem(propertySystem);
|
||||
var itemCnt = new int[6];
|
||||
foreach (var cons in propertySysten.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006)))
|
||||
foreach (var cons in propertySystem.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006)))
|
||||
{
|
||||
itemCnt[cons.id - 6001] += cons.count;
|
||||
}
|
||||
|
||||
if (itemCnt.All(cnt => cnt == 0)) return;
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), "".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
if (itemCnt.All(cnt => cnt == 0))
|
||||
{
|
||||
foreach (var data in propertySysten.propertyDatas)
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
|
||||
return;
|
||||
}
|
||||
var msg = "ClearAllMetadataConsumptionDetails".Translate();
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
if (itemCnt[i] > 0)
|
||||
{
|
||||
msg += $"\n {LDB.items.Select(i + 6001).propertyName} x{itemCnt[i]}";
|
||||
}
|
||||
}
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
{
|
||||
foreach (var data in propertySystem.propertyDatas)
|
||||
{
|
||||
for (var i = 0; i < data.totalConsumption.Count; i++)
|
||||
{
|
||||
@@ -90,11 +128,57 @@ public static class PlayerFunctions
|
||||
data.totalConsumption[i] = new IDCNT(id, 0);
|
||||
}
|
||||
}
|
||||
PurgePropertySystem(propertySystem);
|
||||
propertySystem.SaveToFile();
|
||||
});
|
||||
}
|
||||
|
||||
public static void RemoveCurrentMetadataConsumptions()
|
||||
{
|
||||
|
||||
var propertySystem = DSPGame.propertySystem;
|
||||
if (propertySystem == null) return;
|
||||
PurgePropertySystem(propertySystem);
|
||||
var itemCnt = new int[6];
|
||||
var seedKey = DSPGame.GameDesc.seedKey64;
|
||||
var clusterPropertyData = propertySystem.propertyDatas.FirstOrDefault(cpd => cpd.seedKey == seedKey);
|
||||
if (clusterPropertyData == null)
|
||||
{
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
|
||||
return;
|
||||
}
|
||||
foreach (var cons in clusterPropertyData.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006))
|
||||
{
|
||||
itemCnt[cons.id - 6001] += cons.count;
|
||||
}
|
||||
|
||||
if (itemCnt.All(cnt => cnt == 0))
|
||||
{
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
|
||||
return;
|
||||
}
|
||||
var msg = "ClearCurrentMetadataConsumptionDetails".Translate();
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
if (itemCnt[i] > 0)
|
||||
{
|
||||
msg += $"\n {LDB.items.Select(i + 6001).propertyName} x{itemCnt[i]}";
|
||||
}
|
||||
}
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
{
|
||||
for (var i = 0; i < clusterPropertyData.totalConsumption.Count; i++)
|
||||
{
|
||||
if (clusterPropertyData.totalConsumption[i].count == 0) continue;
|
||||
var id = clusterPropertyData.totalConsumption[i].id;
|
||||
clusterPropertyData.totalConsumption[i] = new IDCNT(id, 0);
|
||||
}
|
||||
PurgePropertySystem(propertySystem);
|
||||
propertySystem.SaveToFile();
|
||||
});
|
||||
}
|
||||
|
||||
public static void ClearMetadataBanAchievements()
|
||||
{
|
||||
GameMain.history.hasUsedPropertyBanAchievement = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
#### 添加一些作弊功能,同时屏蔽异常检测
|
||||
|
||||
## Changlog
|
||||
* 2.3.19
|
||||
+ New features:
|
||||
+ `Remove all metadata consumption records`
|
||||
+ `Remove metadata consumption record in current game`
|
||||
+ `Clear metadata flag which bans achievements`
|
||||
* 2.3.18
|
||||
+ New features:
|
||||
+ `Teleport to outer space`, this will teleport you to the outer space which is 50 LYs far from the farthest star.
|
||||
@@ -121,6 +126,9 @@
|
||||
+ Enable Dev Shortcuts (check config panel for usage)
|
||||
+ Disable Abnormal Checks
|
||||
+ Unlock techs with key-modifiers (Ctrl/Alt/Shift)
|
||||
+ Remove all metadata consumption records
|
||||
+ Remove metadata consumption record in current game
|
||||
+ Clear metadata flag which bans achievements
|
||||
+ Assign gamesave to currrnet account
|
||||
+ Factory:
|
||||
+ Finish build immediately
|
||||
@@ -165,6 +173,11 @@
|
||||
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
|
||||
|
||||
## 更新日志
|
||||
* 2.3.19
|
||||
+ 新功能:
|
||||
+ `移除所有元数据消耗记录`
|
||||
+ `移除当前存档的元数据消耗记录`
|
||||
+ `解除当前存档因使用元数据导致的成就限制`
|
||||
* 2.3.18
|
||||
+ 新功能:
|
||||
+ `传送到外太空`,这会将你传送到距离最远星球50光年的外太空
|
||||
@@ -282,6 +295,9 @@
|
||||
+ 启用开发模式快捷键(使用说明见设置面板)
|
||||
+ 屏蔽异常检测
|
||||
+ 使用组合键解锁科技(Ctrl/Alt/Shift)
|
||||
+ 移除所有元数据消耗记录
|
||||
+ 移除当前存档的元数据消耗记录
|
||||
+ 解除当前存档因使用元数据导致的成就限制
|
||||
+ 将游戏存档绑定给当前账号
|
||||
+ 工厂:
|
||||
+ 建造秒完成
|
||||
|
||||
@@ -9,6 +9,7 @@ public static class UIConfigWindow
|
||||
private static RectTransform _windowTrans;
|
||||
|
||||
private static UIButton _resignGameBtn;
|
||||
private static UIButton _clearBanBtn;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
@@ -26,9 +27,10 @@ public static class UIConfigWindow
|
||||
I18N.Add("Unlock Tech with Key-Modifiers Tips",
|
||||
"Click tech on tree while holding:\n Shift: Tech level + 1\n Ctrl: Tech level + 10\n Ctrl + Shift: Tech level + 100\n Alt: Tech level to MAX\n\nNote: all direct prerequisites will be unlocked as well.",
|
||||
"按住以下组合键点击科技树:\n Shift:科技等级+1\n Ctrl:科技等级+10\n Ctrl+Shift:科技等级+100\n Alt:科技等级升到最大\n\n注意:所有直接前置科技也会被解锁");
|
||||
I18N.Add("Assign gamesave to current account", "Assign gamesave to current account", "将游戏存档绑定给当前账号");
|
||||
I18N.Add("Remove all metadata consumption records", "Remove all metadata consumption records", "移除所有元数据消耗记录");
|
||||
I18N.Add("Remove metadata consumption record in current game", "Remove metadata consumption record in current game", "移除当前游戏的元数据消耗记录");
|
||||
I18N.Add("Remove metadata consumption record in current game", "Remove metadata consumption record in current game", "移除当前存档的元数据消耗记录");
|
||||
I18N.Add("Clear metadata flag which bans achievements", "Clear metadata flag which bans achievements in current game", "解除当前存档因使用元数据导致的成就限制");
|
||||
I18N.Add("Assign gamesave to current account", "Assign gamesave to current account", "将游戏存档绑定给当前账号");
|
||||
I18N.Add("Finish build immediately", "Finish build immediately", "建造秒完成");
|
||||
I18N.Add("Architect mode", "Architect mode", "建筑师模式");
|
||||
I18N.Add("Build without condition", "Build without condition check", "无条件建造");
|
||||
@@ -89,13 +91,16 @@ public static class UIConfigWindow
|
||||
x += 52f;
|
||||
y += 72f;
|
||||
MyWindow.AddTipsButton(x, y, tab1, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips");
|
||||
x = 0f;
|
||||
y = 10f + 36f + 36f + 36f + 36f;
|
||||
wnd.AddButton(x, y, 400f, tab1, "Remove all metadata consumption records", 16, "button-remove-all-metadata-consumption", PlayerFunctions.RemoveAllMetadataConsumptions);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 400f, tab1, "Remove metadata consumption record in current game", 16, "button-remove-current-metadata-consumption", PlayerFunctions.RemoveCurrentMetadataConsumptions);
|
||||
y += 36f;
|
||||
_clearBanBtn = wnd.AddButton(x, y, 400f, tab1, "Clear metadata flag which bans achievements", 16, "button-clear-ban-list", PlayerFunctions.ClearMetadataBanAchievements);
|
||||
x = 300f;
|
||||
y = 10f;
|
||||
_resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; });
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab1, "Remove all metadata consumption records", 16, "button-remove-all-metadata-consumption", PlayerFunctions.RemoveAllMetadataConsumptions);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab1, "Remove metadata consumption record in current game", 16, "button-remove-current-metadata-consumption", PlayerFunctions.RemoveCurrentMetadataConsumptions);
|
||||
|
||||
var tab2 = wnd.AddTab(_windowTrans, "Factory");
|
||||
x = 0f;
|
||||
@@ -222,13 +227,21 @@ public static class UIConfigWindow
|
||||
|
||||
private static void UpdateUI()
|
||||
{
|
||||
UpdateResignButton();
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
private static void UpdateResignButton()
|
||||
private static void UpdateButtons()
|
||||
{
|
||||
var resignEnabled = GameMain.data.account != AccountData.me;
|
||||
if (_resignGameBtn.gameObject.activeSelf == resignEnabled) return;
|
||||
_resignGameBtn.gameObject.SetActive(resignEnabled);
|
||||
if (_resignGameBtn.gameObject.activeSelf != resignEnabled)
|
||||
{
|
||||
_resignGameBtn.gameObject.SetActive(resignEnabled);
|
||||
}
|
||||
|
||||
var banEnabled = GameMain.history.hasUsedPropertyBanAchievement;
|
||||
if (_clearBanBtn.gameObject.activeSelf != banEnabled)
|
||||
{
|
||||
_clearBanBtn.gameObject.SetActive(banEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "CheatEnabler",
|
||||
"version_number": "2.3.18",
|
||||
"version_number": "2.3.19",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||
"dependencies": [
|
||||
|
||||
@@ -380,8 +380,8 @@ public static class GamePatch
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.Start().MatchForward(false,
|
||||
new CodeMatch(instr => (instr.opcode == OpCodes.Ldc_I4 || instr.opcode == OpCodes.Ldc_I4_S) && instr.OperandIs(0x1B)),
|
||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(PerformanceMonitor), nameof(PerformanceMonitor.EndData)))
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.mecha))),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.Method(typeof(Mecha), nameof(Mecha.CheckCombatModuleDataIsValidPatch)))
|
||||
);
|
||||
matcher.Advance(2).Opcode = OpCodes.Brfalse;
|
||||
matcher.Insert(
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#### 一些提升用户体验的功能和补丁
|
||||
|
||||
## Changlog
|
||||
* 1.1.3
|
||||
+ UI texts are updated following game settings now
|
||||
+ Fix hover area for checkboxes in config panel
|
||||
+ Fix an issue which makes `Convert Peace-Mode saves to Combat-Mode on loading` not working
|
||||
* 1.1.2
|
||||
+ `Belt signals for buy out dark fog items automatically`: Always add belt signals to the panel to fix missing belt icons when disabled.
|
||||
* 1.1.1
|
||||
@@ -227,6 +231,10 @@
|
||||
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `Auto navigation on sailings` and `Auto-cruise` implementations
|
||||
|
||||
## 更新日志
|
||||
* 1.1.3
|
||||
+ 界面文本现在完全跟随游戏语言设置改变
|
||||
+ 修复了配置面板中勾选框的鼠标悬停区域
|
||||
+ 修复了`加载和平模式存档时将其转换为战斗模式`不起作用的问题
|
||||
* 1.1.2
|
||||
+ `用于自动购买黑雾物品的传送带信号`: 总是将传送带信号添加到面板,以修复禁用时传送带图标丢失的问题。
|
||||
* 1.1.1
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using BepInEx.Configuration;
|
||||
using UITools;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -57,6 +58,8 @@ public class MyCheckBox : MonoBehaviour
|
||||
cb.labelText = child.GetComponent<Text>();
|
||||
cb.labelText.fontSize = fontSize;
|
||||
cb.SetLabelText(label);
|
||||
var width = cb.labelText.preferredWidth;
|
||||
cb.labelText.rectTransform.sizeDelta = new Vector2(width, rect.sizeDelta.y);
|
||||
}
|
||||
|
||||
//value
|
||||
|
||||
@@ -14,6 +14,11 @@ public class MyConfigWindow : MyWindowWithTabs
|
||||
{
|
||||
return MyWindowManager.CreateWindow<MyConfigWindow>("UXAConfigWindow", "UXAssist Config");
|
||||
}
|
||||
|
||||
public static void DestroyInstance(MyConfigWindow win)
|
||||
{
|
||||
MyWindowManager.DestroyWindow(win);
|
||||
}
|
||||
|
||||
public override void _OnCreate()
|
||||
{
|
||||
@@ -27,6 +32,7 @@ public class MyConfigWindow : MyWindowWithTabs
|
||||
|
||||
public override void _OnDestroy()
|
||||
{
|
||||
_windowTrans = null;
|
||||
}
|
||||
|
||||
public override bool _OnInit()
|
||||
|
||||
@@ -388,6 +388,14 @@ public static class MyWindowManager
|
||||
Windows.Add(win);
|
||||
return (T)win;
|
||||
}
|
||||
|
||||
public static void DestroyWindow(ManualBehaviour win)
|
||||
{
|
||||
if (win == null) return;
|
||||
Windows.Remove(win);
|
||||
win._Free();
|
||||
win._Destroy();
|
||||
}
|
||||
|
||||
/*
|
||||
public static void SetRect(ManualBehaviour win, RectTransform rect)
|
||||
@@ -409,7 +417,7 @@ public static class MyWindowManager
|
||||
}
|
||||
*/
|
||||
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnDestroy")]
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnDestroy))]
|
||||
public static void UIRoot__OnDestroy_Postfix()
|
||||
{
|
||||
foreach (var win in Windows)
|
||||
@@ -420,7 +428,7 @@ public static class MyWindowManager
|
||||
Windows.Clear();
|
||||
}
|
||||
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnOpen")]
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnOpen))]
|
||||
public static void UIRoot__OnOpen_Postfix()
|
||||
{
|
||||
if (_initialized) return;
|
||||
@@ -442,7 +450,7 @@ public static class MyWindowManager
|
||||
}
|
||||
*/
|
||||
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnUpdate")]
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnUpdate))]
|
||||
public static void UIRoot__OnUpdate_Postfix()
|
||||
{
|
||||
if (GameMain.isPaused || !GameMain.isRunning)
|
||||
@@ -455,7 +463,7 @@ public static class MyWindowManager
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), "ShutAllFunctionWindow")]
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame.ShutAllFunctionWindow))]
|
||||
public static void UIGame_ShutAllFunctionWindow_Postfix()
|
||||
{
|
||||
foreach (var win in Windows)
|
||||
|
||||
@@ -145,6 +145,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
DysonSpherePatch.Init();
|
||||
|
||||
I18N.Apply();
|
||||
I18N.OnInitialized += RecreateConfigWindow;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
@@ -200,6 +201,16 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
}
|
||||
}
|
||||
|
||||
private static void RecreateConfigWindow()
|
||||
{
|
||||
if (!_configWinInitialized) return;
|
||||
var wasActive = _configWin.active;
|
||||
if (wasActive) _configWin._Close();
|
||||
MyConfigWindow.DestroyInstance(_configWin);
|
||||
_configWinInitialized = false;
|
||||
if (wasActive) ToggleConfigWindow();
|
||||
}
|
||||
|
||||
// Add config button to main menu
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot.OpenMainMenuUI))]
|
||||
public static void UIRoot_OpenMainMenuUI_Postfix()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UXAssist</Description>
|
||||
<Version>1.1.2</Version>
|
||||
<Version>1.1.3</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>UXAssist</PackageId>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "UXAssist",
|
||||
"version_number": "1.1.2",
|
||||
"version_number": "1.1.3",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||
"dependencies": [
|
||||
|
||||
Reference in New Issue
Block a user