private void TeleportHandler(WoWReader wr) { float x, y, z, orient; byte mask = wr.ReadByte(); WoWGuid guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask))); wr.ReadUInt32(); // flags wr.ReadUInt32(); // time? wr.ReadByte(); // unk 2.3.0 wr.ReadSingle(); // unk2 x = wr.ReadSingle(); y = wr.ReadSingle(); z = wr.ReadSingle(); orient = wr.ReadSingle(); wr.ReadUInt16(); // unk3 wr.ReadByte(); // unk4 BoogieCore.Log(LogType.SystemDebug, "Got teleport to: {0} {1} {2} {3}", x, y, z, orient); BoogieCore.world.getPlayerObject().SetCoordinates(new Coordinate(x, y, z, orient)); WoWWriter ww = new WoWWriter(OpCode.MSG_MOVE_TELEPORT_ACK); ww.Write(BoogieCore.world.getPlayerObject().GUID.GetOldGuid()); Send(ww.ToArray()); SendMoveHeartBeat(BoogieCore.world.getPlayerObject().GetCoordinates()); }
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)); }
private void Handle_ActionButtons(WoWReader wr) { ActionButton[] actionButtonList = new ActionButton[ActionBars.MaxButtons]; for (int i = 0; i < ActionBars.MaxButtons; i++) { actionButtonList[i].action = wr.ReadUInt16(); actionButtonList[i].type = wr.ReadByte(); actionButtonList[i].misc = wr.ReadByte(); } BoogieCore.Player.setActionBars(actionButtonList); }
private void Handle_InitializeFactions(WoWReader wr) { UInt32 count = wr.ReadUInt32(); // always 64 ReputationItem[] reputationList = new ReputationItem[count]; for (int i = 0; i < count; i++) { reputationList[i].flag = wr.ReadByte(); reputationList[i].standing = wr.ReadUInt32(); } BoogieCore.Player.setReputation(reputationList); }
private void Handle_IgnoreList(WoWReader wr) { byte count = wr.ReadByte(); IgnoreListItem[] ignoreList = new IgnoreListItem[count]; for (int i = 0; i < count; i++) { ignoreList[i] = new IgnoreListItem(); ignoreList[i].guid = new WoWGuid(wr.ReadUInt64()); QueryName(ignoreList[i].guid); } BoogieCore.Player.setIgnoreList(ignoreList); }
private void Handle_FriendsList(WoWReader wr) { byte count = wr.ReadByte(); FriendsListItem[] friendsList = new FriendsListItem[count]; for (int i = 0; i < count; i++) { friendsList[i] = new FriendsListItem(); friendsList[i].guid = new WoWGuid(wr.ReadUInt64()); friendsList[i].online = wr.ReadBoolean(); QueryName(friendsList[i].guid); } BoogieCore.Player.setFriendList(friendsList); }
private void Handle_InitialSpells(WoWReader wr) { byte unknown = wr.ReadByte(); // Dunno. wowd sends a 0. UInt16 count = wr.ReadUInt16(); SpellItem[] spellList = new SpellItem[count]; for (int i = 0; i < count; i++) { spellList[i].spellID = wr.ReadUInt16(); spellList[i].unknown = wr.ReadUInt16(); // 0xeeee } wr.ReadUInt16(); // Another 0 according to wowd. BoogieCore.Player.setSpells(spellList); }
private void Handle_NameQuery(WoWReader wr) { WoWGuid guid = new WoWGuid(wr.ReadUInt64()); string name = wr.ReadString(); UInt16 unk = wr.ReadByte(); UInt32 Race = wr.ReadUInt32(); UInt32 Gender = wr.ReadUInt32(); UInt32 Level = wr.ReadUInt32(); BoogieCore.Log(LogType.NeworkComms, "Got NameQuery Response - GUID: {4} Name: {0} - Race: {1} - Gender: {2} - Level: {3}", name, Race, Gender, Level, BitConverter.ToUInt64(guid.GetNewGuid(), 0)); Object obj = BoogieCore.world.getObject(guid); if (obj != null) // Update existing object { obj.Name = name; obj.Race = Race; obj.Gender = Gender; obj.Level = Level; BoogieCore.world.updateObject(obj); } else // Create new Object -- FIXME: Add to new 'names only' list? { obj = new Object(); obj.GUID = guid; obj.Name = name; obj.Race = Race; obj.Gender = Gender; obj.Level = Level; BoogieCore.world.newObject(obj, true); } /* Process chat message if we looked them up now */ for (int i = 0; i < ChatQueued.Count; i++) { ChatQueue message = (ChatQueue)ChatQueued[i]; if (message.GUID.GetOldGuid() == guid.GetOldGuid()) { BoogieCore.Event(new Event(EventType.EVENT_CHAT, Time.GetTime(), message, name)); ChatQueued.Remove(message); } } // WoWChat uses this to retrive names on friends and ignore list. BoogieCore.Event(new Event(EventType.EVENT_NAMEQUERY_RESPONSE, Time.GetTime(), guid, name)); }
private void Handle_AuthResponse(WoWReader wr) { byte error = wr.ReadByte(); if (error != 0x0C) { BoogieCore.Log(LogType.Error, "WS: Authentication Failed: Error = {0}", error); return; } BoogieCore.Log(LogType.System, "WS: Authentication Successful!"); BoogieCore.Log(LogType.System, "WS: Requesting Character List..."); WoWWriter ww = new WoWWriter(OpCode.CMSG_CHAR_ENUM); Send(ww.ToArray()); PingTimer.Enabled = true; }
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(); }
private void MovementHandler(WoWReader wr) { WoWGuid guid; byte mask = wr.ReadByte(); if (mask == 0x00) { return; } guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask))); MovementInfo mi = new MovementInfo(wr); if (BoogieCore.world.getObject(guid) != null) { //BoogieCore.Log(LogType.Error, "Updating coordinates for object {0}, x={1} y={2} z={3}", BoogieCore.world.getObject(guid).Name, mi.x, mi.y, mi.z); BoogieCore.world.getObject(guid).SetCoordinates(mi.GetCoordinates()); } }
private void Handle_MessageChat(WoWReader wr) { string channel = null; UInt64 guid = 0; WoWGuid fguid = null, fguid2 = null; byte Type = wr.ReadByte(); UInt32 Language = wr.ReadUInt32(); fguid = new WoWGuid(wr.ReadUInt64()); wr.ReadUInt32(); // rank? if ((ChatMsg)Type == ChatMsg.CHAT_MSG_CHANNEL) { channel = wr.ReadString(); //pvp_rank = wr.ReadUInt32(); } //if (Type == 0 || Type == 1 || Type == 5 || Type == 0x53) //{ fguid2 = new WoWGuid(wr.ReadUInt64()); //} UInt32 Length = wr.ReadUInt32(); string Message = wr.ReadString(); byte afk = wr.ReadByte(); string username = null; ChatQueue que = new ChatQueue(); que.GUID = fguid; que.Type = Type; que.Language = Language; if ((ChatMsg)Type == ChatMsg.CHAT_MSG_CHANNEL) { que.Channel = channel; } que.Length = Length; que.Message = Message; que.AFK = afk; if (fguid.GetOldGuid() == 0) { username = "******"; } else { username = BoogieCore.world.getObjectName(fguid); } if (username == null) { ChatQueued.Add(que); QueryName(guid); return; } ParseCommands(que, username); BoogieCore.Event(new Event(EventType.EVENT_CHAT, Time.GetTime(), que, username)); }
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)); }