Upload from upload_mods.ps1
This commit is contained in:
62
Scripts/MinEvents/MinEventActionIncreasePerkRebirth.cs
Normal file
62
Scripts/MinEvents/MinEventActionIncreasePerkRebirth.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionIncreasePerkRebirth : MinEventActionRemoveBuff
|
||||
{
|
||||
private string perkName = "";
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
if (GameManager.IsDedicatedServer)
|
||||
{
|
||||
//Log.Out("MinEventActionIncreasePerkRebirth-Execute IS SERVER");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("MinEventActionIncreasePerkRebirth-Execute IS CLIENT");
|
||||
|
||||
EntityPlayerLocal player = _params.Self as EntityPlayerLocal;
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
//Log.Out("MinEventActionIncreasePerkRebirth-Execute NO Player");
|
||||
return;
|
||||
}
|
||||
|
||||
ProgressionValue perkProgressionValue = player.Progression.GetProgressionValue(perkName);
|
||||
|
||||
if (perkProgressionValue == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int maxLevel = perkProgressionValue.ProgressionClass.MaxLevel;
|
||||
|
||||
if (perkProgressionValue.Level < maxLevel)
|
||||
{
|
||||
perkProgressionValue.Level = perkProgressionValue.Level + 1;
|
||||
player.Progression.bProgressionStatsChanged = true;
|
||||
player.bPlayerStatsChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (flag) return true;
|
||||
var name = _attribute.Name;
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
else if (name == "perkName")
|
||||
{
|
||||
perkName = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user