public void LoginChar(UInt64 guid) { foreach (Character c in characterList) { if (c.GUID == guid) { BoogieCore.World.setPlayer(c.MapID, new WoWGuid(guid)); BoogieCore.Player.setPlayer(c); } } characterList = null; // No longer needed! WoWWriter ww = new WoWWriter(OpCode.CMSG_PLAYER_LOGIN); ww.Write(guid); Send(ww.ToArray()); ww = new WoWWriter(OpCode.CMSG_UPDATE_ACCOUNT_DATA); ww.Write((UInt32)7); ww.Write((UInt32)5144); ww.Write(account_data); Send(ww.ToArray()); ww = new WoWWriter(OpCode.CMSG_NAME_QUERY); ww.Write(guid); Send(ww.ToArray()); ww = new WoWWriter(OpCode.CMSG_SET_ACTIVE_MOVER); ww.Write(guid); Send(ww.ToArray()); //MoveUpdateTimer.Enabled = true; }
public WoWWriter CreatureQuery(WoWGuid guid, UInt32 entry) { WoWWriter wr = new WoWWriter(OpCode.CMSG_CREATURE_QUERY); wr.Write(entry); wr.Write(guid.GetOldGuid()); return(wr); }
public WoWWriter GameObjectQuery(WoWGuid guid, UInt32 entry) { WoWWriter wr = new WoWWriter(OpCode.CMSG_GAMEOBJECT_QUERY); wr.Write(entry); wr.Write(guid.GetOldGuid()); return(wr); }
private void Query_Item_Single(UInt32 id) { WoWWriter ww = new WoWWriter(OpCode.CMSG_ITEM_QUERY_SINGLE); ww.Write(id); ww.Write((UInt64)0); Send(ww.ToArray()); }
public void SendEmoteMsg(ChatMsg Type, Languages Language, string Message, string To) { WoWWriter wr = new WoWWriter(OpCode.CMSG_TEXT_EMOTE); wr.Write((UInt32)Type); wr.Write((UInt32)Languages.LANG_ORCISH); wr.Write(Message); Send(wr.ToArray()); }
public void PartChannel(string channel) { WoWWriter wr = new WoWWriter(OpCode.CMSG_LEAVE_CHANNEL); wr.Write((UInt32)0); wr.Write(channel); Send(wr.ToArray()); ChannelList.Remove(channel); BoogieCore.Event(new Event(EventType.EVENT_CHANNEL_LEFT, Time.GetTime(), channel)); }
public void SendChatMsg(ChatMsg Type, Languages Language, string Message, string To) { WoWWriter wr = new WoWWriter(OpCode.CMSG_MESSAGECHAT); wr.Write((UInt32)Type); wr.Write((UInt32)Languages.LANG_ORCISH); if ((Type == ChatMsg.CHAT_MSG_WHISPER || Type == ChatMsg.CHAT_MSG_CHANNEL) && To != "") { wr.Write(To); } wr.Write(Message); Send(wr.ToArray()); }
public void JoinChannel(string channel, string password) { WoWWriter wr = new WoWWriter(OpCode.CMSG_JOIN_CHANNEL); wr.Write((UInt32)0); // dbc id?? wr.Write((UInt16)0); // crap as ascent put it wr.Write(channel); wr.Write((byte)0); Send(wr.ToArray()); ChannelList.Add(channel); BoogieCore.Event(new Event(EventType.EVENT_CHANNEL_JOINED, Time.GetTime(), channel)); }
public void QueryName(UInt64 guid) { WoWWriter wr = new WoWWriter(OpCode.CMSG_NAME_QUERY); wr.Write(guid); Send(wr.ToArray()); }
public void QueryName(WoWGuid guid) { WoWWriter wr = new WoWWriter(OpCode.CMSG_NAME_QUERY); wr.Write(guid.GetOldGuid()); Send(wr.ToArray()); }
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()); }
public void Query_GetMailList(WoWGuid mailbox_guid) { WoWWriter wr = new WoWWriter(OpCode.CMSG_GET_MAIL_LIST); wr.Write(mailbox_guid.GetOldGuid()); Send(wr.ToArray()); }
private void Ping(object source, ElapsedEventArgs e) { if (!mSocket.Connected) { PingTimer.Enabled = false; PingTimer.Stop(); return; } Ping_Req_Time = MM_GetTime(); BoogieCore.Log(LogType.NeworkComms, "Ping!"); WoWWriter ww = new WoWWriter(OpCode.CMSG_PING); ww.Write(Ping_Seq); ww.Write(Latency); Send(ww.ToArray()); }
private void Query_AH(UInt32 entry) { WoWWriter wr = new WoWWriter(OpCode.CMSG_AUCTION_LIST_ITEMS); wr.Write(entry); wr.Write((byte)0); // "message" wr.Write((byte)0); // minlevel wr.Write((byte)0); // maxlevel wr.Write(0xFFFFFFFF); // unk wr.Write(0xFFFFFFFF); // item class wr.Write(0xFFFFFFFF); // item subclass wr.Write(0xFFFFFFFF); // rarity wr.Write((byte)0); // usable Send(wr.ToArray()); AHEntry = entry + 50; }
public void WorldZone(UInt64 guid) { WoWWriter ww = new WoWWriter(OpCode.CMSG_PLAYER_LOGIN); ww.Write(guid); Send(ww.ToArray()); ww = new WoWWriter(OpCode.CMSG_UPDATE_ACCOUNT_DATA); ww.Write((UInt32)7); ww.Write((UInt32)5144); ww.Write(account_data); Send(ww.ToArray()); ww = new WoWWriter(OpCode.CMSG_NAME_QUERY); ww.Write(guid); Send(ww.ToArray()); ww = new WoWWriter(OpCode.CMSG_SET_ACTIVE_MOVER); ww.Write(guid); Send(ww.ToArray()); }
private void BuildMovePacket(OpCode op, float x, float y, float z, float o) { WoWWriter ww = new WoWWriter(op); ww.Write((UInt32)MoveFlags); ww.Write((byte)255); ww.Write((UInt32)MM_GetTime()); ww.Write(x); ww.Write(y); ww.Write(z); ww.Write(o); ww.Write((UInt32)0); Send(ww.ToArray()); }
private void Handle_CreatureQuery(WoWReader wr) { Entry entry = new Entry(); entry.entry = wr.ReadUInt32(); entry.name = wr.ReadString(); entry.blarg = wr.ReadBytes(3); entry.subname = wr.ReadString(); entry.flags = wr.ReadUInt32(); entry.subtype = wr.ReadUInt32(); entry.family = wr.ReadUInt32(); entry.rank = wr.ReadUInt32(); BoogieCore.Log(LogType.NeworkComms, "Got CreatureQuery Response - Entry: {0} - Name: {1} - SubName {2}", entry.entry, entry.name, entry.subname); if (EntryList.ContainsKey(entry.entry) == false) { EntryList.Add(entry.entry, entry); } if (EntryQueue.ContainsKey(entry.entry)) { EntryQueue.Remove(entry.entry); } foreach (Object obj in BoogieCore.world.getObjectList()) { if (obj.Fields != null) { if (obj.Fields[(int)UpdateFields.OBJECT_FIELD_ENTRY] == entry.entry) { if (entry.name.Contains("Auctioneer") && SentHello == false) { WoWWriter ww = new WoWWriter(OpCode.MSG_AUCTION_HELLO); ww.Write(obj.GUID.GetOldGuid()); Send(ww.ToArray()); BoogieCore.Log(LogType.SystemDebug, "Sent AH Hello!"); SentHello = true; } obj.Name = entry.name; obj.SubName = entry.subname; obj.SubType = entry.subtype; obj.Family = entry.family; obj.Rank = entry.rank; } } } }
private void Handle_AuthRequest(WoWReader wr) { BoogieCore.Log(LogType.System, "WS: Recieved Authentication Challenge: Sending out response"); ServerSeed = wr.ReadUInt32(); ClientSeed = (UInt32)random.Next(); Sha1Hash sha = new Sha1Hash(); sha.Update(mUsername); sha.Update(0); // t sha.Update(ClientSeed); sha.Update(ServerSeed); sha.Update(Key); byte[] Digest = sha.Final(); WoWWriter ww = new WoWWriter(OpCode.CMSG_AUTH_SESSION); ww.Write(BoogieCore.configFile.ReadInteger("WoW", "Build")); ww.Write((UInt32)0); ww.Write(mUsername); ww.Write(ClientSeed); ww.Write(Digest); StreamReader SR; WoWWriter buffer = new WoWWriter(); SR = File.OpenText("Addons.txt"); string Line = SR.ReadLine(); while (Line != null) { string[] Fields = new string[3]; string Name = null; UInt64 Checksum = 0; byte unk = 0x0; Fields = Line.Split(':'); Name = Fields[0]; Checksum = UInt64.Parse(Fields[1]); //unk = (Fields[2].ToCharArray())[0]; if (Name != null && Checksum > 0) { buffer.Write(Name); buffer.Write(Checksum); buffer.Write(unk); //BoogieCore.Log("Adding addon {0} with the checksum {1}", Name, Checksum); } Line = SR.ReadLine(); } SR.Close(); byte[] buffer2 = Foole.Utils.Compression.Compress(buffer.ToArray()); UInt32 Size = (UInt32)buffer.ToArray().Length; ww.Write(Size); ww.Write(buffer2); Send(ww); mCrypt.Init(Key); }
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)); }
private void SendRealmlistRequest() { wout.Write((byte)RLOp.REALM_LIST); wout.Write(0); wout.Flush(); }
protected void processData(byte[] Data) { WoWReader wr = new WoWReader(Data); OpCode Op = (OpCode)wr.ReadUInt16(); BoogieCore.Log(LogType.NeworkComms, "Debugging packet for opcode: {0}", Op); SMSG_Debug(new WoWReader(Data)); try { switch (Op) { case OpCode.SMSG_AUTH_CHALLENGE: Handle_AuthRequest(wr); break; case OpCode.SMSG_AUTH_RESPONSE: Handle_AuthResponse(wr); break; case OpCode.SMSG_CHAR_ENUM: Handle_CharEnum(wr); break; case OpCode.SMSG_WARDEN_DATA: // Warden was figured out. but I won't give it out. GL break; case OpCode.SMSG_ACCOUNT_DATA_MD5: WoWWriter ww = new WoWWriter(OpCode.CMSG_UPDATE_ACCOUNT_DATA); ww.Write(0x00000002); ww.Write((UInt32)0); Send(ww.ToArray()); break; case OpCode.SMSG_PONG: { UInt32 Server_Seq = wr.ReadUInt32(); if (Server_Seq == Ping_Seq) { Ping_Res_Time = MM_GetTime(); Latency = Ping_Res_Time - Ping_Req_Time; Ping_Seq += 1; //BoogieCore.Log(LogType.NeworkComms, "Got pong'd with a latency of: {0} sequence: {1}", Latency, Server_Seq); } else { BoogieCore.Log(LogType.Error, "Server pong'd bad sequence! Ours: {0} Theirs: {1}", Ping_Seq, Server_Seq); } break; } case OpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE: BoogieCore.Log(LogType.NeworkComms, "Got Item Response"); break; case OpCode.SMSG_SET_PROFICIENCY: break; case OpCode.MSG_MOVE_HEARTBEAT: case OpCode.MSG_MOVE_START_TURN_RIGHT: case OpCode.MSG_MOVE_STOP: case OpCode.MSG_MOVE_START_TURN_LEFT: case OpCode.MSG_MOVE_START_FORWARD: case OpCode.MSG_MOVE_START_BACKWARD: case OpCode.MSG_MOVE_STOP_TURN: case OpCode.MSG_MOVE_START_STRAFE_LEFT: case OpCode.MSG_MOVE_START_STRAFE_RIGHT: case OpCode.MSG_MOVE_STOP_STRAFE: case OpCode.MSG_MOVE_FALL_LAND: case OpCode.MSG_MOVE_JUMP: case OpCode.MSG_MOVE_SET_FACING: MovementHandler(wr); break; case OpCode.SMSG_EMOTE: break; case OpCode.SMSG_WEATHER: break; case OpCode.MSG_MOVE_TELEPORT_ACK: TeleportHandler(wr); break; case OpCode.SMSG_NEW_WORLD: Handle_NewWorld(wr); break; case OpCode.SMSG_FORCE_MOVE_UNROOT: SendMoveHeartBeat(BoogieCore.world.getPlayerObject().GetCoordinates()); break; case OpCode.SMSG_UPDATE_OBJECT: Handle_ObjUpdate(wr, false); break; case OpCode.SMSG_DESTROY_OBJECT: Handle_ObjDestroy(wr); break; case OpCode.SMSG_COMPRESSED_UPDATE_OBJECT: Handle_ObjUpdate(wr, true); break; case OpCode.SMSG_SPELL_START: break; case OpCode.SMSG_SPELL_GO: break; case OpCode.SMSG_CAST_RESULT: break; case OpCode.SMSG_MESSAGECHAT: Handle_MessageChat(wr); break; case OpCode.SMSG_CHANNEL_NOTIFY: break; case OpCode.SMSG_NAME_QUERY_RESPONSE: Handle_NameQuery(wr); break; case OpCode.SMSG_CREATURE_QUERY_RESPONSE: Handle_CreatureQuery(wr); break; case OpCode.SMSG_GAMEOBJECT_QUERY_RESPONSE: SMSG_Debug(wr); break; case OpCode.MSG_AUCTION_HELLO: BoogieCore.Log(LogType.NeworkComms, "Got ah Hello!"); Query_AH(AHEntry); break; case OpCode.SMSG_AUCTION_LIST_RESULT: BoogieCore.Log(LogType.NeworkComms, "Got ah response!"); Query_AH(AHEntry); break; case OpCode.SMSG_FRIEND_LIST: Handle_FriendsList(wr); break; case OpCode.SMSG_FRIEND_STATUS: Handle_FriendStatus(wr); break; //case OpCode.SMSG_IGNORE_LIST: // Handle_IgnoreList(wr); // break; case OpCode.SMSG_INIT_WORLD_STATES: Handle_InitWorldStates(wr); break; case OpCode.SMSG_INITIAL_SPELLS: Handle_InitialSpells(wr); break; case OpCode.SMSG_LEARNED_SPELL: Handle_LearntSpell(wr); break; case OpCode.SMSG_SUPERCEDED_SPELL: Handle_SupercededSpell(wr); break; case OpCode.SMSG_INITIALIZE_FACTIONS: Handle_InitializeFactions(wr); break; case OpCode.SMSG_LOGIN_SETTIMESPEED: Handle_LoginSetTimeSpeed(wr); break; case OpCode.SMSG_SPELLLOGEXECUTE: Handle_SpellLogExecute(wr); break; case OpCode.SMSG_MAIL_LIST_RESULT: Handle_MailList(wr); break; case OpCode.SMSG_SEND_MAIL_RESULT: // We don't send mail (yet). break; case OpCode.SMSG_RECEIVED_MAIL: // You've got MAIL! break; case OpCode.SMSG_LIST_INVENTORY: Handle_VendorInventoryList(wr); break; case OpCode.SMSG_ACTION_BUTTONS: Handle_ActionButtons(wr); break; case OpCode.SMSG_LEVELUP_INFO: Handle_LevelUp(wr); break; case OpCode.SMSG_LOG_XPGAIN: Handle_XpGain(wr); break; default: BoogieCore.Log(LogType.NeworkComms, "Got unknown opcode: {0} length: {1}", Op, wr.Remaining); break; } } catch (Exception ex) { BoogieCore.Log(LogType.Error, "Caught Exception while processing packet with opcode of {0}: Exception is: {1}", Op, ex.Message); //BoogieCore.Log(LogType.Error, "{0}", ex.StackTrace); } }