/// <summary>
        /// </summary>
        /// <param name="parseControl"> </param>
        public StatMonitor(ParseControl parseControl) : base("StatMonitor", parseControl)
        {
            this.IncludeSelf = false;
            this.Filter      = EventParser.TypeMask | EventParser.Self | EventParser.Engaged | EventParser.UnEngaged;
            if (Settings.Default.ParseYou)
            {
                this.Filter = FilterHelper.Enable(this.Filter, EventParser.You);
                this.Filter = FilterHelper.Enable(this.Filter, EventParser.Pet);
            }

            if (Settings.Default.ParseParty)
            {
                this.Filter = FilterHelper.Enable(this.Filter, EventParser.Party);
                this.Filter = FilterHelper.Enable(this.Filter, EventParser.PetParty);
            }

            if (Settings.Default.ParseAlliance)
            {
                this.Filter = FilterHelper.Enable(this.Filter, EventParser.Alliance);
                this.Filter = FilterHelper.Enable(this.Filter, EventParser.PetAlliance);
            }

            if (Settings.Default.ParseOther)
            {
                this.Filter = FilterHelper.Enable(this.Filter, EventParser.Other);
                this.Filter = FilterHelper.Enable(this.Filter, EventParser.PetOther);
            }
        }
 /// <summary>
 /// </summary>
 /// <param name="name"> </param>
 /// <param name="parseControl"> </param>
 protected EventMonitor(string name, ParseControl parseControl)
     : base(name)
 {
     this.Initialize(parseControl);
     EventParser.Instance.OnLogEvent        += this.FilterEvent;
     EventParser.Instance.OnUnknownLogEvent += this.FilterUnknownEvent;
 }
Esempio n. 3
0
 void Start()
 {
     usingParse = _usingParse;
     if(usingParse)
     {
         current = this;
         DontDestroyOnLoad (this);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// </summary>
 /// <param name="name"> </param>
 /// <param name="parseControl"></param>
 public Monster(string name, ParseControl parseControl) : base(name)
 {
     Controller               = parseControl;
     ID                       = 0;
     LineHistory              = new List <LineHistory>();
     Last20DamageActions      = new List <LineHistory>();
     Last20DamageTakenActions = new List <LineHistory>();
     Last20HealingActions     = new List <LineHistory>();
     InitStats();
     StatusUpdateTimer.Elapsed += StatusUpdateTimerOnElapsed;
     StatusUpdateTimer.Start();
 }
Esempio n. 5
0
 /// <summary>
 /// </summary>
 /// <param name="name"> </param>
 /// <param name="parseControl"></param>
 public Monster(string name, ParseControl parseControl) : base(name)
 {
     Controller = parseControl;
     ID = 0;
     LineHistory = new List<LineHistory>();
     Last20DamageActions = new List<LineHistory>();
     Last20DamageTakenActions = new List<LineHistory>();
     Last20HealingActions = new List<LineHistory>();
     Last20Items = new List<LineHistory>();
     InitStats();
     StatusUpdateTimer.Elapsed += StatusUpdateTimerOnElapsed;
     StatusUpdateTimer.Start();
 }
Esempio n. 6
0
    public ParseContext(IParseState <TInput> state, Engine <TInput, TOutput> engine, int rbp, bool canRecurse, string name, ParseControl parseControl)
    {
        Assert.ArgumentNotNull(state, nameof(state));
        Assert.ArgumentNotNull(engine, nameof(engine));
        Assert.ArgumentNotNull(parseControl, nameof(parseControl));

        _state         = state;
        _engine        = engine;
        _rbp           = rbp;
        _startConsumed = state.Input.Consumed;
        Name           = name;
        _parseControl  = parseControl;
        _canRecurse    = canRecurse;
    }
Esempio n. 7
0
    public PartialResult <TOutput> TryParse(IParseState <TInput> state, int rbp, ParseControl parseControl)
    {
        Assert.ArgumentNotNull(state, nameof(state));
        var levelCp = state.Input.Checkpoint();

        try
        {
            return(Parse(state, rbp, parseControl));
        }
        catch (ParseException pe) when(pe.Severity == ParseExceptionSeverity.Level)
        {
            levelCp.Rewind();
            return(new PartialResult <TOutput>(pe.Message, pe.Location ?? state.Input.CurrentLocation));
        }
    }
Esempio n. 8
0
 public Player(string name, ParseControl parseControl) : base(name)
 {
     Controller                    = parseControl;
     this.ID                       = 0;
     this.LineHistory              = new List <LineHistory>();
     this.Last20DamageActions      = new List <LineHistory>();
     this.Last20DamageTakenActions = new List <LineHistory>();
     this.Last20HealingActions     = new List <LineHistory>();
     this.Last20Items              = new List <LineHistory>();
     this.LastActionTime           = DateTime.Now;
     this.InitStats();
     this.StatusUpdateTimer.Elapsed += this.StatusUpdateTimerOnElapsed;
     this.IsActiveTimer.Elapsed     += this.IsActiveTimerOnElapsed;
     this.StatusUpdateTimer.Start();
     this.IsActiveTimer.Start();
 }
Esempio n. 9
0
    private PartialResult <TOutput> Parse(IParseState <TInput> state, int rbp, ParseControl parseControl)
    {
        var startLocation = state.Input.CurrentLocation;
        var leftResult    = GetLeft(state, parseControl);

        if (!leftResult.Success)
        {
            return(new PartialResult <TOutput>(string.Empty, startLocation));
        }

        if (parseControl.IsComplete)
        {
            return(new PartialResult <TOutput>(leftResult.Value !.Value, leftResult.Consumed, startLocation));
        }

        var leftToken = leftResult.Value !;
        int consumed  = leftResult.Consumed;

        while (!parseControl.IsComplete)
        {
            var rightResult = GetRight(state, rbp, leftToken, parseControl);
            if (!rightResult.Success || rightResult.Value == null)
            {
                break;
            }

            // Set the next left value to be the current combined right value and continue
            // the loop
            consumed += rightResult.Consumed;
            leftToken = rightResult.Value;

            // If we have success, but did not consume any input, we will get into an infinite
            // loop if we don't break. One zero-length suffix rule is the maximum
            if (rightResult.Consumed == 0)
            {
                break;
            }
        }

        return(new PartialResult <TOutput>(leftToken.Value, consumed, startLocation));
    }
Esempio n. 10
0
 /// <summary>
 /// </summary>
 public Timeline(ParseControl parseControl)
 {
     Controller       = parseControl;
     FightingRightNow = false;
     DeathFound       = false;
     Fights           = new FightList();
     // setup party
     Overall = new StatGroup("Overall");
     Party   = new StatGroup("Party")
     {
         IncludeSelf = false
     };
     Monster = new StatGroup("Monster")
     {
         IncludeSelf = false
     };
     PlayerCurables = new Dictionary <string, int>();
     SetStoreHistoryInterval();
     InitStats();
     StoreHistoryTimer.Elapsed += StoreHistoryTimerOnElapsed;
     FightingTimer.Elapsed     += FightingTimerOnElapsed;
 }
Esempio n. 11
0
        /// <summary>
        /// </summary>
        public Timeline(ParseControl parseControl)
        {
            this.Controller       = parseControl;
            this.FightingRightNow = false;
            this.DeathFound       = false;
            this.Fights           = new FightList();

            // setup party
            this.Overall = new StatGroup("Overall");
            this.Party   = new StatGroup("Party")
            {
                IncludeSelf = false
            };
            this.Monster = new StatGroup("Monster")
            {
                IncludeSelf = false
            };
            this.PlayerCurables = new Dictionary <string, int>();
            this.SetStoreHistoryInterval();
            this.InitStats();
            this.StoreHistoryTimer.Elapsed += this.StoreHistoryTimerOnElapsed;
            this.FightingTimer.Elapsed     += this.FightingTimerOnElapsed;
        }
Esempio n. 12
0
 /// <summary>
 /// </summary>
 /// <param name="parseControl"> </param>
 public TimelineMonitor(ParseControl parseControl) : base("Timeline", parseControl)
 {
     Filter = (EventParser.SubjectMask | EventParser.DirectionMask | (UInt64)EventType.Loot | (UInt64)EventType.Defeats);
 }
Esempio n. 13
0
    private PartialResult <IPrattToken <TOutput> > GetRight(IParseState <TInput> state, int rbp, IPrattToken <TOutput> leftToken, ParseControl parseControl)
    {
        var cp = state.Input.Checkpoint();

        foreach (var parselet in _ledableParselets.Where(p => rbp < p.Lbp))
        {
            var(success, token, consumed) = parselet.TryGetNext(state);
            if (!success)
            {
                continue;
            }

            var rightContext = new ParseContext <TInput, TOutput>(state, this, parselet.Rbp, true, parselet.Name, parseControl);

            // Transform the IToken into IToken<TOutput> using the LeftDenominator rule and
            // the current left value
            var rightResult = token.LeftDenominator(rightContext, leftToken);
            if (!rightResult.Success)
            {
                cp.Rewind();
                if (parseControl.IsComplete)
                {
                    return(new PartialResult <IPrattToken <TOutput> >("The parse is complete", state.Input.CurrentLocation));
                }
                continue;
            }

            return(new PartialResult <IPrattToken <TOutput> >(rightResult.Value, consumed + rightContext.Consumed, state.Input.CurrentLocation));
        }

        return(new PartialResult <IPrattToken <TOutput> >(string.Empty, state.Input.CurrentLocation));
    }
Esempio n. 14
0
    private PartialResult <IPrattToken <TOutput> > GetLeft(IParseState <TInput> state, ParseControl parseControl)
    {
        var cp = state.Input.Checkpoint();

        foreach (var parselet in _nudableParselets)
        {
            var(success, token, consumed) = parselet.TryGetNext(state);
            if (!success)
            {
                continue;
            }

            var leftContext = new ParseContext <TInput, TOutput>(state, this, parselet.Rbp, consumed > 0, parselet.Name, parseControl);

            // Transform the IToken into IToken<TInput> using the NullDenominator rule
            var leftResult = token.NullDenominator(leftContext);
            if (!leftResult.Success)
            {
                cp.Rewind();
                if (parseControl.IsComplete)
                {
                    return(new PartialResult <IPrattToken <TOutput> >("No parselets matched and transformed at the current position and the parse is complete.", state.Input.CurrentLocation));
                }
                continue;
            }

            consumed += leftContext.Consumed;
            return(new PartialResult <IPrattToken <TOutput> >(leftResult.Value, consumed, state.Input.CurrentLocation));
        }

        return(new PartialResult <IPrattToken <TOutput> >("No parselets matched and transformed at the current position.", state.Input.CurrentLocation));
    }
 /// <summary>
 /// </summary>
 /// <param name="instance"> </param>
 private void Initialize(ParseControl instance)
 {
     ParseControl = instance;
     InitStats();
 }
Esempio n. 16
0
 /// <summary>
 /// </summary>
 /// <param name="instance"> </param>
 private void Initialize(ParseControl instance)
 {
     ParseControl = instance;
     InitStats();
 }
Esempio n. 17
0
 /// <summary>
 /// </summary>
 public Timeline(ParseControl parseControl)
 {
     Controller = parseControl;
     FightingRightNow = false;
     DeathFound = false;
     Fights = new FightList();
     // setup party
     Overall = new StatGroup("Overall");
     Party = new StatGroup("Party")
     {
         IncludeSelf = false
     };
     Monster = new StatGroup("Monster")
     {
         IncludeSelf = false
     };
     PlayerCurables = new Dictionary<string, int>();
     SetStoreHistoryInterval();
     InitStats();
     StoreHistoryTimer.Elapsed += StoreHistoryTimerOnElapsed;
     FightingTimer.Elapsed += FightingTimerOnElapsed;
 }
Esempio n. 18
0
 /// <summary>
 /// </summary>
 /// <param name="instance"> </param>
 private void Initialize(ParseControl instance)
 {
     this.ParseControl = instance;
     this.InitStats();
 }
Esempio n. 19
0
 /// <summary>
 /// </summary>
 /// <param name="parseControl"> </param>
 public TimelineMonitor(ParseControl parseControl)
     : base("Timeline", parseControl)
 {
     this.Filter = EventParser.SubjectMask | EventParser.DirectionMask | (ulong)EventType.Loot | (ulong)EventType.Defeats;
 }
 /// <summary>
 /// </summary>
 /// <param name="name"> </param>
 /// <param name="parseControl"> </param>
 protected EventMonitor(string name, ParseControl parseControl) : base(name)
 {
     Initialize(parseControl);
     EventParser.Instance.OnLogEvent += FilterEvent;
     EventParser.Instance.OnUnknownLogEvent += FilterUnknownEvent;
 }