Skip to content

Commit c5c92b0

Browse files
committed
Render text from SID_MESSAGEBOX for chat gateway
1 parent 993ecb3 commit c5c92b0

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/Atlasd/Battlenet/Protocols/Game/Messages/SID_MESSAGEBOX.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,29 @@ public override bool Invoke(MessageContext context)
4747
context.Client.Send(ToByteArray(context.Client.ProtocolType));
4848
return true;
4949
}
50+
51+
public new byte[] ToByteArray(ProtocolType protocolType)
52+
{
53+
if (protocolType.IsChat())
54+
{
55+
using var _m = new MemoryStream(Buffer);
56+
using var r = new BinaryReader(_m);
57+
var style = r.ReadUInt32();
58+
var text = r.ReadByteString();
59+
var caption = r.ReadByteString();
60+
61+
using var m = new MemoryStream();
62+
using var w = new BinaryWriter(m);
63+
w.Write($"{2000 + Id} MESSAGEBOX \"");
64+
w.Write(text);
65+
w.Write('"');
66+
w.Write(Battlenet.Common.NewLine);
67+
return m.GetBuffer();
68+
}
69+
else
70+
{
71+
return base.ToByteArray(protocolType);
72+
}
73+
}
5074
}
5175
}

0 commit comments

Comments
 (0)