BattleNet.GameServer.LifeManaPacket C# (CSharp) Метод

LifeManaPacket() защищенный Метод

protected LifeManaPacket ( byte type, List data ) : void
type byte
data List
Результат void
        protected void LifeManaPacket(byte type, List<byte> data)
        {
            byte[] packet = data.ToArray();
            if (BitConverter.ToUInt16(packet, 6) == 0x0000)
                return;

            UInt32 plife = (uint)BitConverter.ToUInt16(packet, 1) & 0x7FFF;
            if (m_owner.BotGameData.CurrentLife == 0)
                m_owner.BotGameData.CurrentLife = plife;

            if (plife < m_owner.BotGameData.CurrentLife && plife > 0)
            {
                UInt32 damage = m_owner.BotGameData.CurrentLife - plife;
                Console.WriteLine("{0}: [D2GS] {1} damage was dealt to {2} ({3} left)", m_owner.Account, damage, m_owner.Character, plife);
                if (plife <= m_owner.ChickenLife)
                {
                    Console.WriteLine("{0}: [D2GS] Chickening with {1} left!", m_owner.Account, plife);
                    m_owner.InGame = false;
                    m_owner.ConnectedToGs = false;

                    Console.WriteLine("{0}: [D2GS] Leaving the game.", m_owner.Account);
                    Write(new byte[] {0x69});

                    Thread.Sleep(500);

                    if (m_pingThread.IsAlive)
                        m_pingThread.Join();
                    m_owner.Status = ClientlessBot.ClientStatus.STATUS_NOT_IN_GAME;
                    Kill();
                }
                else if (plife <= m_owner.PotLife)
                {
                    Console.WriteLine("{0}: [D2GS] Attempting to use potion with {1} life left.", m_owner.Account, plife);
                    m_owner.UsePotion();
                }
            }

            m_owner.BotGameData.CurrentLife = plife;
        }