Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Scripts/MinEvents/MinEventActionSetProgression.cs
Nathaniel Cosford 062dfab2cd Patched
2025-05-30 01:04:40 +09:30

77 lines
2.4 KiB
C#

using System.Collections.Generic;
using System.Xml.Linq;
public class MinEventActionSetProgression : MinEventActionTargetedBase
{
public override void Execute(MinEventParams _params)
{
if (_params.Self.isEntityRemote && !_params.IsLocal)
{
//Log.Out("MinEventActionSetProgression-Execute 1");
return;
}
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[progressionName];
bool processAttribute = false;
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
bool gotResult = false;
foreach (var craftingLevel in craftingLevelsList)
{
if (craftingLevel.craftingLevel == progressionValue)
{
//Log.Out("MinEventActionSetProgression-Execute 2");
if (RebirthVariables.localVariables["$varFuriousRamsaySalvageToolsPercUnit"] < craftingLevel.categoryLevel)
{
//Log.Out("MinEventActionSetProgression-Execute 3");
RebirthVariables.localVariables["$varFuriousRamsaySalvageToolsPercUnit"] = craftingLevel.categoryLevel;
processAttribute = true;
}
gotResult = true;
break;
}
}
if (gotResult)
{
break;
}
}
if (processAttribute)
{
//Log.Out("MinEventActionSetProgression-Execute 4");
RebirthUtilities.ProcessAttribute(this.targets[0], "$varFuriousRamsay" + progressionName + "PercUnit");
}
}
public override bool ParseXmlAttribute(XAttribute _attribute)
{
bool flag = base.ParseXmlAttribute(_attribute);
if (!flag)
{
string localName = _attribute.Name.LocalName;
if (localName == "progressionName")
{
this.progressionName = _attribute.Value;
return true;
}
if (localName == "progressionValue")
{
this.progressionValue = int.Parse(_attribute.Value);
return true;
}
}
return flag;
}
private int progressionValue = 0;
private string progressionName = "";
}