示例#1
0
        private void RetrieveRealmList()
        {
            Realm[] Realms;

            byte   op          = win.ReadByte();
            UInt16 Length      = win.ReadUInt16();
            UInt32 Request     = win.ReadUInt32();
            UInt16 NumOfRealms = win.ReadUInt16();

            Realms = new Realm[NumOfRealms];

            for (int i = 0; i < NumOfRealms; i++)
            {
                if ((i + 1) % 10 == 0)
                {
                    BoogieCore.Log(LogType.SystemDebug, "Retrieved realm {0} of {1}.", i + 1, NumOfRealms);
                }

                Realms[i].Type  = win.ReadByte();
                Realms[i].Color = win.ReadByte();
                win.ReadByte(); // unk
                Realms[i].Name       = win.ReadString();
                Realms[i].Address    = win.ReadString();
                Realms[i].Population = win.ReadFloat();
                Realms[i].NumChars   = win.ReadByte();
                Realms[i].Language   = win.ReadByte();
                Realms[i].Unk        = win.ReadByte();
            }

            byte Unk1 = win.ReadByte();
            byte Unk2 = win.ReadByte();

            BoogieCore.Log(LogType.SystemDebug, "Done.");

            String defaultRealm = BoogieCore.configFile.ReadString("Connection", "DefaultRealm");

            if (defaultRealm != "")
            {
                foreach (Realm r in Realms)
                {
                    if (r.Name.ToLower() == defaultRealm.ToLower())
                    {
                        BoogieCore.Log(LogType.System, "Defaulting to realm {0}", defaultRealm);

                        string[] address = r.Address.Split(':');
                        BoogieCore.Log(LogType.System, "Defaulting to realm {0} IP: {1} port: {2}", defaultRealm, address[0], address[1]);
                        IPAddress WSAddr = IPAddress.Parse(address[0]);//Dns.GetHostEntry(address[0]).AddressList[0];
                        BoogieCore.Log(LogType.System, "IP: {0}", WSAddr.ToString());
                        int WSPort = Int32.Parse(address[1]);
                        BoogieCore.ConnectToWorldServer(new IPEndPoint(WSAddr, WSPort));

                        return;
                    }
                }
            }

            BoogieCore.Event(new Event(EventType.EVENT_REALMLIST, Time.GetTime(), Realms));
        }
示例#2
0
        public MovementInfo(WoWReader wr)
        {
            transGuid = 0;
            flags     = wr.ReadUInt32();
            wr.ReadByte();
            time = wr.ReadUInt32();

            x           = wr.ReadFloat();
            y           = wr.ReadFloat();
            z           = wr.ReadFloat();
            orientation = wr.ReadFloat();

            if ((flags & 0x2000000) >= 1) // Transport
            {
                transGuid = wr.ReadUInt64();

                transX = wr.ReadFloat();
                transY = wr.ReadFloat();
                transZ = wr.ReadFloat();
                transO = wr.ReadFloat();
            }

            if ((flags & 0x200000) >= 1) // Swimming
            {
                unk6 = wr.ReadFloat();
            }

            if ((flags & 0x2000) >= 1) // Falling
            {
                FallTime = wr.ReadUInt32();
                unk8     = wr.ReadUInt32();
                unk9     = wr.ReadUInt32();
                unk10    = wr.ReadUInt32();
            }

            if ((flags & 0x4000000) >= 1)
            {
                unk12 = wr.ReadUInt32();
            }

            //if (wr.Remaining >= 4) unklast = wr.ReadUInt32();
        }
示例#3
0
        private void Handle_CharEnum(WoWReader wr)
        {
            BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Character List..");
            byte count = wr.ReadByte();

            characterList = new Character[count];

            for (int i = 0; i < count; i++)
            {
                characterList[i].GUID        = wr.ReadUInt64();
                characterList[i].Name        = wr.ReadString();
                characterList[i].Race        = wr.ReadByte();
                characterList[i].Class       = wr.ReadByte();
                characterList[i].Gender      = wr.ReadByte();
                characterList[i].Skin        = wr.ReadByte();
                characterList[i].Face        = wr.ReadByte();
                characterList[i].HairStyle   = wr.ReadByte();
                characterList[i].HairColor   = wr.ReadByte();
                characterList[i].FacialHair  = wr.ReadByte();
                characterList[i].Level       = wr.ReadByte();
                characterList[i].ZoneID      = wr.ReadUInt32();
                characterList[i].MapID       = wr.ReadUInt32();
                characterList[i].X           = wr.ReadFloat();
                characterList[i].Y           = wr.ReadFloat();
                characterList[i].Z           = wr.ReadFloat();
                characterList[i].Guild       = wr.ReadUInt32();
                characterList[i].Unk         = wr.ReadUInt32();
                characterList[i].RestState   = wr.ReadByte();
                characterList[i].PetInfoID   = wr.ReadUInt32();
                characterList[i].PetLevel    = wr.ReadUInt32();
                characterList[i].PetFamilyID = wr.ReadUInt32();

                CharEquipment[] equip = new CharEquipment[20];

                for (int x = 0; x < 20; x++)
                {
                    equip[x].EntryID = wr.ReadUInt32();
                    equip[x].Type    = wr.ReadByte();
                    wr.ReadUInt32(); // enchant (2.4 patch)
                }

                characterList[i].Equipment = equip;
            }

            BoogieCore.Log(LogType.NeworkComms, "{0} characters in total.", characterList.Length);

            String defaultChar = BoogieCore.configFile.ReadString("Connection", "DefaultChar");

            if (defaultChar != "")
            {
                foreach (Character c in characterList)
                {
                    if (c.Name.ToLower() == defaultChar.ToLower())
                    {
                        BoogieCore.Log(LogType.System, "Defaulting to Character {0}", defaultChar);
                        BoogieCore.WorldServerClient.LoginChar(c.GUID);
                        return;
                    }
                }
            }

            if (count < 1)
            {
                string name = RandomString(6, false);
                BoogieCore.Log(LogType.System, "Auto-Generating Human Character with the name {0}", name);

                WoWWriter ww = new WoWWriter(OpCode.CMSG_CHAR_CREATE);
                ww.Write(name);
                ww.Write((byte)1); // race - human
                ww.Write((byte)1); // class - warrior
                ww.Write((byte)0); // gender - male
                ww.Write((byte)1); // skin
                ww.Write((byte)1); // face
                ww.Write((byte)1); // hair style
                ww.Write((byte)1); // hair color
                ww.Write((byte)1); // facial hair
                ww.Write((byte)1); // outfit id
                Send(ww.ToArray());
                ww = new WoWWriter(OpCode.CMSG_CHAR_ENUM);
                Send(ww.ToArray());
                return;
            }

            if (count == 1)
            {
                BoogieCore.Log(LogType.System, "Defaulting to Character {0}", characterList[0].Name);
                BoogieCore.WorldServerClient.LoginChar(characterList[0].GUID);
                return;
            }

            BoogieCore.Event(new Event(EventType.EVENT_CHAR_LIST, Time.GetTime(), characterList));
        }