mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 02:53:29 +08:00
WIP
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace CheatEnabler;
|
||||
|
||||
@@ -49,4 +50,51 @@ public static class PlayerFunctions
|
||||
}
|
||||
GameMain.mainPlayer.controller.actionSail.StartFastTravelToUPosition(targetUPos);
|
||||
}
|
||||
|
||||
private static void PurgePropertySystem(PropertySystem propertySystem)
|
||||
{
|
||||
var propertyDatas = propertySystem.propertyDatas;
|
||||
for (var i = 0; i < propertyDatas.Count;)
|
||||
{
|
||||
if (propertyDatas[i].totalProduction.Any(idcnt => idcnt.count > 0) || propertyDatas[i].totalConsumption.Any(idcnt => idcnt.count > 0))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
propertyDatas.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveAllMetadataConsumptions()
|
||||
{
|
||||
var propertySysten = DSPGame.propertySystem;
|
||||
if (propertySysten == null) return;
|
||||
PurgePropertySystem(propertySysten);
|
||||
var itemCnt = new int[6];
|
||||
foreach (var cons in propertySysten.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, () =>
|
||||
{
|
||||
foreach (var data in propertySysten.propertyDatas)
|
||||
{
|
||||
for (var i = 0; i < data.totalConsumption.Count; i++)
|
||||
{
|
||||
if (data.totalConsumption[i].count == 0) continue;
|
||||
var id = data.totalConsumption[i].id;
|
||||
data.totalConsumption[i] = new IDCNT(id, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void RemoveCurrentMetadataConsumptions()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user