using System; using System.Diagnostics; using LavishScriptAPI; using MRBot.IsxEq2.CharacterActor; using MRBot.IsxEq2.Helpers; namespace MRBot.IsxEq2.AbilityEffect { /// /// This DataType includes all of the data available to ISXEQ2 that is related to /// maintained buffs or debuffs attributed to the current player character. /// public class Maintained : LavishScriptObject { #region Constructor /// /// Constructor /// /// LS Object public Maintained(LavishScriptObject copy) : base(copy) { } #endregion #region Members /// /// Cache of ConcentrationCost /// private int? _concentrationCost; /// /// Maintained effect concentration cost /// public int ConcentrationCost { get { Trace.WriteLine(String.Format("Maintained:ConcentrationCost")); if(!_concentrationCost.HasValue) _concentrationCost = this.GetIntFromLSO("ConcentrationCost"); return _concentrationCost.Value; } } /// /// Returns the total number of increments of the maintained effect /// public int CurrentIncrements { get { Trace.WriteLine(String.Format("Maintained:CurrentIncrements")); return this.GetIntFromLSO("CurrentIncrements"); } } /// /// This is the current duration of the buff/debuff in seconds. /// Buffs/Debuffs that do not have a duration (ie, last forever) will return -1. /// public float Duration { get { Trace.WriteLine(String.Format("Maintained:Duration")); return this.GetFloatFromLSO("Duration"); } } /// /// Cache of IsBeneficial /// private bool? _isBeneficial; /// /// Returns TRUE if teh maintained effect is beneficial (buff) /// public bool IsBeneficial { get { Trace.WriteLine(String.Format("Maintained:IsBeneficial")); if (!_isBeneficial.HasValue) _isBeneficial = this.GetBoolFromLSO("IsBeneficial"); return _isBeneficial.Value; } } /// /// Cache of MaxDuration /// private float? _maxDuration; /// /// This is the current duration of the buff/debuff in seconds. /// Buffs/Debuffs that do not have a duration (ie, last forever) will return -1. /// public float MaxDuration { get { Trace.WriteLine(String.Format("Maintained:MaxDuration")); if(!_maxDuration.HasValue) _maxDuration = this.GetFloatFromLSO("MaxDuration"); return _maxDuration.Value; } } /// /// Cache of Name /// private string _name; /// /// Maintained effect name /// public string Name { get { Trace.WriteLine(String.Format("Maintained:Name")); return _name ?? (_name = this.GetStringFromLSO("Name")); } } /// /// Returns the targget of the maintained buff. /// This only works for maintained buffs/debuffs that are of the "Type": 'single target'. /// If the Target is no longer alive or present in the game, it will return NULL. /// /// maintained effect target as actor public Actor Target { get { Trace.WriteLine(String.Format("Maintained:Target")); return new Actor(this.GetMember("Target")); } } /// /// Cache of Type /// private string _type; /// /// This member returns one of the following strings: self only,pet only,group, or single target /// public string Type { get { Trace.WriteLine(String.Format("Maintained:Type")); return _type ?? (_type = this.GetStringFromLSO("Type")); } } #endregion #region Methods /// /// Cancels the maintained effect, if possible /// /// call success public bool Cancel() { Trace.WriteLine(String.Format("Maintained:Cancel()")); return this.ExecuteMethod("Cancel"); } /// /// Examines the maintained effect /// /// public bool Examine() { Trace.WriteLine(String.Format("Maintained:Examine()")); return this.ExecuteMethod("Examine"); } #endregion } }