BattleNet.GameServer.NpcMovement C# (CSharp) Method

NpcMovement() protected method

protected NpcMovement ( byte type, List data ) : void
type byte
data List
return void
        protected void NpcMovement(byte type, List<byte> data)
        {
            byte[] packet = data.ToArray();
            UInt32 id = BitConverter.ToUInt32(packet, 1);
            byte movementType = packet[5];
            Int32 x = BitConverter.ToUInt16(packet, 6);
            Int32 y = BitConverter.ToUInt16(packet, 8);
            bool running;
            if (movementType == 0x17)
                running = true;
            else if (movementType == 0x01)
                running = false;
            else
                return;

            if (!m_owner.BotGameData.Npcs.ContainsKey(id))
            {
                Console.WriteLine("{0}: [D2GS] Npc ({1}) not found in map... Adding with type = 0", m_owner.Account, id);
                m_owner.BotGameData.Npcs.Add(id, new NpcEntity(id, 0, 0, x, y));
            }
            m_owner.BotGameData.Npcs[id].Moving = true;
            m_owner.BotGameData.Npcs[id].Running = running;
            m_owner.BotGameData.Npcs[id].TargetLocation = new Coordinate(x, y);
        }