4.0mod要修改保险箱大小要怎么写?有大佬指点一下吗?
public Task OnLoad()
{
_itemsDb = databaseServer.GetTables().Templates.Items;
var targetItemId = “544a11ac4bdc2d470e8b456a”;
if(_itemsDb.TryGetValue(targetItemId,out var bbx))
{
bbx.Properties.Grids =
}
这是我写的 写到这里就不会了 直接写会报错











一点都不懂代码。。。我直接偷@等雨停 大佬改背包大小的源代码改的保险箱大小,你看下大佬的源代码有没有思路
var Items = databaseService.GetTables().Templates.Items;
foreach (var item in Items)
{
var idList = new HashSet<MongoId>();
var itemId = item.Key;
var itemData = item.Value;
var itemProperties = itemData.Properties;
if (itemProperties?.Grids != null)
{
var itemGrids = itemProperties?.Grids.ToList();
#region 所有安全箱
if (itemData.Parent == "5448bf274bdc2dfc2f8b456a")
{
itemProperties!.Weight = -500; //负重
var cellsH = (int?)(itemGrids[0].Properties.CellsH * 2);
var cellsV = (int?)(itemGrids[0].Properties.CellsV * 3);
itemGrids![0].Properties!.CellsH = cellsH > 6 ? 6 : cellsH;
itemGrids![0].Properties!.CellsV = cellsV > 13 ? 13 : cellsV;
itemGrids![0].Properties!.Filters = [new() { Filter = [new("54009119af1c881c07000029")], ExcludedFilter = [] }]; //去除安全箱内物品存放限制
}
#endregion
}