コード例 #1
0
        public static void GameActionFightLifePointsLostMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameActionFightLifePointsLostMessage msg = (GameActionFightLifePointsLostMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.FightData.UpdateFighterLifePoints(msg.targetId, -msg.loss);
        }
コード例 #2
0
ファイル: FightGame.cs プロジェクト: Kuh4ku/Mercybot
        public void Update(GameActionFightLifePointsLostMessage message)
        {
            GetFighter(message.TargetId)?.Update(message);

            // Trigger update event if its our character
            if (message.TargetId == PlayedFighter?.ContextualId)
            {
                _account.Game.Character.Stats.MaxLifePoints = (uint)PlayedFighter?.MaxLifePoints;
                _account.Game.Character.Stats.LifePoints    = (uint)PlayedFighter?.LifePoints;
                FighterStatsUpdated?.Invoke();
            }
        }
コード例 #3
0
        public void HandleGameActionFightLifePointsLostMessage(Bot bot, GameActionFightLifePointsLostMessage message)
        {
            if (bot == null || bot.Character == null || bot.Character.Fight == null)
            {
                logger.Error("Fight is not properly initialized.");
                return; // Can't handle the message
            }
            var fighter = bot.Character.Fight.GetFighter(message.targetId);

            if (fighter == null)
            {
                logger.Error("Fighter {0} has lost {2} HP cast but doesn't exist, or is it {1} ?", message.targetId, message.sourceId, message.loss);
            }
            else
            {
                fighter.UpdateHP(message);
            }
        }
コード例 #4
0
        public static void GameActionFightLifePointsLostMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameActionFightLifePointsLostMessage msg = (GameActionFightLifePointsLostMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            if (account.Fight != null && account.state == Status.Fighting)
            {
                BFighter fighter = account.Fight.GetFighter(msg.targetId);
                account.Fight.Fighters[account.Fight.Fighters.IndexOf(fighter)].LifePoints -= msg.loss;
                if (fighter.Id == account.Fight.Fighter.Id)
                {
                    account.ModifBar(2, account.Fight.Fighter.MaxLifePoints, account.Fight.Fighter.LifePoints, "Vitalité");
                }
            }
        }
コード例 #5
0
ファイル: FightFrame.cs プロジェクト: Kuh4ku/Mercybot
        public static Task HandleGameActionFightLifePointsLostMessage(Account account, GameActionFightLifePointsLostMessage message)
        => Task.Run(() =>
        {
            account.Game.Fight.Update(message);

            var fighter = account.Game.Fight.GetFighter(message.TargetId);
            if (fighter != null)
            {
                account.Logger.LogInfo(fighter.GetName(), $"- {message.Loss} HP{(fighter.LifePoints == 0 ? " (mort)." : ".")}");
            }
        });
コード例 #6
0
ファイル: FighterEntry.cs プロジェクト: Kuh4ku/Mercybot
 public void Update(GameActionFightLifePointsLostMessage message)
 {
     LifePoints    -= (int)message.Loss;
     MaxLifePoints -= (int)message.PermanentDamages;
 }