public void Dispatch(ISession session, IPacket packet) { ulong targetGuid = packet.CreateReader().ReadUInt64(); var message = new GossipMessage(2, new[] { new GossipMenuItem(2, GossipMenuIcon.Banker, false, "Need bank?"), new GossipMenuItem(1, GossipMenuIcon.Gossip, false, "I would die!") }, new[] { new QuestsMenuItem(3, 2, "hi"), }); session.SendGossipMessage(targetGuid, message); }
private static IPacket GetGossipMessagePkt(ulong guid, GossipMessage gossipMessage) { IPacket packet = WorldPacketFactory.Create(WMSG.SMSG_GOSSIP_MESSAGE); BinaryWriter writer = packet.CreateWriter(); writer.Write(guid); writer.Write(0); writer.Write(gossipMessage.TextId); writer.Write(gossipMessage.GossipMenu.Count); foreach(GossipMenuItem menuItem in gossipMessage.GossipMenu) { writer.Write(menuItem.MenuId); writer.Write((byte)menuItem.Icon); writer.Write((byte)(menuItem.InputBox ? 1 : 0)); writer.Write(menuItem.Cost); writer.WriteCString(menuItem.Text); writer.WriteCString(menuItem.AcceptText); } writer.Write(gossipMessage.QuestsMenu.Count); foreach(QuestsMenuItem menuItem in gossipMessage.QuestsMenu) { writer.Write(menuItem.Id); writer.Write(menuItem.Icon); writer.Write((uint)0); writer.Write(menuItem.Text); } return packet; }
public void SendGossipMessage(ulong targetGuid, GossipMessage message) { Send(GetGossipMessagePkt(targetGuid, message)); }