using System.Collections.Generic; using System.Xml.Linq; public class PlayerLevelRebirth : TargetedCompareRequirementBase { public override bool IsValid(MinEventParams _params) { if (!base.IsValid(_params)) { return false; } if (this.target.Progression == null) { return false; } int level = this.target.Progression.GetLevel(); if (this.useCVar && this.refCvarName.EndsWith("_Cst")) { this.value = RebirthVariables.localConstants[this.refCvarName]; //Log.Out("PlayerLevelRebirth-IsValid this.value: " + this.value); } bool flag = RequirementBase.compareValues((float)level, this.operation, this.value); if (this.invert) { return !flag; } if (!flag) { EntityPlayer primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer(); switch (keyName) { case null: return flag; case "GTLevel15": GameManager.ShowTooltip(primaryPlayer as EntityPlayerLocal, Localization.Get("ttGTLevel15"), string.Empty, "ui_denied", null); return flag; case "GTLevel30": GameManager.ShowTooltip(primaryPlayer as EntityPlayerLocal, Localization.Get("ttGTLevel30"), string.Empty, "ui_denied", null); return flag; case "GTLevel45": GameManager.ShowTooltip(primaryPlayer as EntityPlayerLocal, Localization.Get("ttGTLevel45"), string.Empty, "ui_denied", null); return flag; case "GTLevel60": GameManager.ShowTooltip(primaryPlayer as EntityPlayerLocal, Localization.Get("ttGTLevel60"), string.Empty, "ui_denied", null); return flag; case "GTLevel75": GameManager.ShowTooltip(primaryPlayer as EntityPlayerLocal, Localization.Get("ttGTLevel75"), string.Empty, "ui_denied", null); return flag; default: return flag; } } return flag; } public override void GetInfoStrings(ref List list) { list.Add(string.Format("Player level {0} {1} {2}", this.invert ? "NOT" : "", this.operation.ToStringCached(), this.value.ToCultureInvariantString())); } public override bool ParseXAttribute(XAttribute _attribute) { var flag = base.ParseXAttribute(_attribute); if (flag) return true; var name = _attribute.Name; if (name == null) { return flag; } else if (name == "target") { this.targetType = EnumUtils.Parse(_attribute.Value, true); return true; } else if (name == "key") { keyName = _attribute.Value; return true; } else { return false; } } protected string keyName; }