示例#1
0
        /// <summary>
        /// Lurkers the player level up.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event.</param>
        private void Lurker_PlayerLevelUp(object sender, PlayerLevelUpEvent e)
        {
            try
            {
                var knownPlayer = this._playerBank.GetKnownPlayer(e.PlayerName);
                if (knownPlayer != null)
                {
                    knownPlayer.AddLevel(e.Level);
                    this._playerBank.Players.Remove(knownPlayer);
                    this._playerBank.Players.Insert(0, knownPlayer);
                    this.PlayerChanged?.Invoke(this, knownPlayer);
                    return;
                }

                var externalPlayer = this._playerBank.GetExternalPlayer(e.PlayerName);
                if (externalPlayer != null)
                {
                    externalPlayer.AddLevel(e.Level);
                    return;
                }

                // Wait for location changed event to confirm the new player
                var newPlayer = new Player()
                {
                    Name = e.PlayerName, Levels = new List <int>()
                    {
                        e.Level
                    }
                };
                this.InsertPlayer(newPlayer);
                this.PlayerChanged?.Invoke(this, newPlayer);
            }
            finally
            {
                this.Save();
            }
        }
示例#2
0
 public void HandleEvent(PlayerLevelUpEvent evt, ISession session)
 {
 }
示例#3
0
        /// <summary>
        /// Called when [file changed].
        /// </summary>
        /// <param name="newline">The newline.</param>
        private void OnFileChanged(string newline)
        {
            if (string.IsNullOrEmpty(newline))
            {
                return;
            }

            try
            {
                // TradeEvent need to be parse before whisper
                var tradeEvent = TradeEvent.TryParse(newline);
                if (tradeEvent != null)
                {
                    this.HandleLeague(tradeEvent);
                    this.IncomingOffer?.Invoke(this, tradeEvent);
                    return;
                }

                var outgoingTradeEvent = OutgoingTradeEvent.TryParse(newline);
                if (outgoingTradeEvent != null)
                {
                    this.HandleLeague(outgoingTradeEvent);
                    this.OutgoingOffer?.Invoke(this, outgoingTradeEvent);
                    return;
                }

                var levelUpEvent = PlayerLevelUpEvent.TryParse(newline);
                if (levelUpEvent != null)
                {
                    this.PlayerLevelUp?.Invoke(this, levelUpEvent);
                    return;
                }

                var whisperEvent = WhisperEvent.TryParse(newline);
                if (whisperEvent != null)
                {
                    this.Whispered?.Invoke(this, whisperEvent);
                    return;
                }

                var locationEvent = LocationChangedEvent.TryParse(newline);
                if (locationEvent != null)
                {
                    Models.PoeApplicationContext.Location = locationEvent.Location;
                    this.LocationChanged?.Invoke(this, locationEvent);
                    return;
                }

                var afkEvent = AfkEvent.TryParse(newline);
                if (afkEvent != null)
                {
                    if (Models.PoeApplicationContext.IsAfk != afkEvent.AfkEnable)
                    {
                        Models.PoeApplicationContext.IsAfk = afkEvent.AfkEnable;
                    }

                    this.AfkChanged?.Invoke(this, afkEvent);
                    return;
                }

                var tradeAcceptedEvent = TradeAcceptedEvent.TryParse(newline);
                if (tradeAcceptedEvent != null)
                {
                    this.TradeAccepted?.Invoke(this, tradeAcceptedEvent);
                    return;
                }

                var monsterEvent = MonstersRemainEvent.TryParse(newline);
                if (monsterEvent != null)
                {
                    this.RemainingMonsters?.Invoke(this, monsterEvent);
                    return;
                }

                var playerJoinEvent = PlayerJoinedEvent.TryParse(newline);
                if (playerJoinEvent != null)
                {
                    this.PlayerJoined?.Invoke(this, playerJoinEvent);
                    return;
                }

                var playerLeftEvent = PlayerLeftEvent.TryParse(newline);
                if (playerLeftEvent != null)
                {
                    this.PlayerLeft?.Invoke(this, playerLeftEvent);
                    return;
                }

                Logger.Trace($"Not parsed: {newline}");
            }
            catch (Exception ex)
            {
                var lineError = $"Line in error: {newline}";
                var exception = new Exception(lineError, ex);
                Logger.Error(exception, exception.Message);

#if !DEBUG
                SentrySdk.AddBreadcrumb(message: lineError, level: BreadcrumbLevel.Error);
                SentrySdk.CaptureException(ex);
#endif
            }
        }
示例#4
0
 public void HandleEvent(PlayerLevelUpEvent evt, ISession session)
 {
     Logger.Write("Level up! Rewards: " + evt.Items, session: session);
 }
示例#5
0
 public void HandleEvent(PlayerLevelUpEvent evt, ISession session)
 {
     Logger.Write(
         session.Translation.GetTranslation(TranslationString.EventLevelUpRewards, evt.Items));
 }
示例#6
0
 public void HandleEvent(PlayerLevelUpEvent evt, ISession session)
 {
     Logger.Write(session.Translation.GetTranslation(TranslationString.LevelUp) + evt.Items, session: session);
     Logger.PushToUi(MainRpc.Lvl, session, evt.Level, evt.InventoryFull, evt.Items);
 }