Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:13:32 +09:30
commit 7345f42201
470 changed files with 51966 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
public class RoundsInInventory : RequirementBase
{
private static Dictionary<string, ItemValue> cached = new Dictionary<string, ItemValue>();
public static bool TryGetValue(string ammoName, out ItemValue ammoValue)
{
if (!cached.TryGetValue(ammoName, out ammoValue))
{
ammoValue = ItemClass.GetItem(ammoName, false);
if (ammoValue == null)
return false;
cached.Add(ammoName, ammoValue);
}
return true;
}
public override bool IsValid(MinEventParams _params)
{
if (!this.ParamsValid(_params))
return invert;
ItemValue itemValue = _params.ItemValue;
if (itemValue.IsEmpty() || !(_params.ItemActionData is ItemActionRanged.ItemActionDataRanged _rangedData))
return invert;
string ammoName = ((ItemActionRanged)itemValue.ItemClass.Actions[_rangedData.indexInEntityOfAction]).MagazineItemNames[itemValue.SelectedAmmoTypeIndex];
if (TryGetValue(ammoName, out var ammoValue))
return compareValues(_params.Self.GetItemCount(ammoValue), this.operation, this.value) ^ invert;
return invert;
}
}