62 lines
1.6 KiB
C#
62 lines
1.6 KiB
C#
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;
|
|
}
|
|
}
|
|
} |