예제 #1
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));
        }
예제 #2
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));
        }