1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 15:33:31 +08:00

UXAssist and CheatEnabler new release

This commit is contained in:
2024-08-22 17:16:55 +08:00
parent fec947e71a
commit 7430f20181
14 changed files with 178 additions and 29 deletions

View File

@@ -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();
}
}

View File

@@ -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>

View File

@@ -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;
}
}

View File

@@ -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
+ 移除所有元数据消耗记录
+ 移除当前存档的元数据消耗记录
+ 解除当前存档因使用元数据导致的成就限制
+ 将游戏存档绑定给当前账号
+ 工厂:
+ 建造秒完成

View File

@@ -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);
}
}
}

View File

@@ -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": [