public void HandleMessageChat(ref IPacketReader packet, ref IWorldManager manager) { var character = manager.Account.ActiveCharacter; PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_MESSAGECHAT], "SMSG_MESSAGECHAT"); writer.WriteUInt8((byte)packet.ReadInt32()); // System Message packet.ReadUInt32(); writer.WriteUInt32(0); // Language: General writer.WriteUInt64(character.Guid); string message = packet.ReadString(); writer.WriteString(message); writer.WriteUInt8(0); if (!CommandManager.InvokeHandler(message, manager)) { manager.Send(writer); } }
public void HandleAuthSession(ref IPacketReader packet, ref IWorldManager manager) { Authenticator.PacketCrypt.Initialised = true; packet.Position += 8; // client version, session id string name = packet.ReadString().ToUpper(); packet.Position += 4 + 4 + 20 + 4 + 4; // realm type, salt, encrypted password if (Authenticator.ClientBuild > 12213) { packet.Position += 12; } int addonsize = packet.ReadInt32(); Account account = new Account(name); account.Load <Character>(); manager.Account = account; // enable addons var addonPacketInfo = new PacketReader(this.GetAddonInfo(packet), false); var addonPacketResponse = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_ADDON_INFO], "SMSG_ADDON_INFO"); this.WriteAddonInfo(addonPacketInfo, addonPacketResponse, addonsize); manager.Send(addonPacketResponse); PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_AUTH_RESPONSE], "SMSG_AUTH_RESPONSE"); writer.WriteUInt8(0x0C); // AUTH_OK writer.WriteUInt32(0); writer.WriteUInt8(0); writer.WriteUInt32(0); writer.WriteUInt8(Authenticator.ExpansionLevel.Clamp(1, 2)); // Expansion level manager.Send(writer); }