using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Chop { public class NewProtocolMessage { private StringBuilder Builder; public NewProtocolMessage(int messageID) { Builder = new StringBuilder(HabboEncoding.EncodeB64(messageID)); } public NewProtocolMessage() { Builder = new StringBuilder(); } public void Init(int messageID) { Builder = new StringBuilder(HabboEncoding.EncodeB64(messageID)); } public void Append(object o) { Builder.Append(o); } public void AppendChar(int i) { Append(Convert.ToChar(i)); } public void AppendString(object o) { AppendString(o, 2); } public void AppendString(object o, char c) { Append(o); Append(c); } public void AppendString(object o, byte b) { Append(o); AppendChar(b); } public void AppendWired(object o) { Append(HabboEncoding.EncodeWired(Convert.ToInt32(o))); } public void AppendWiredBoolean(bool b) { Append(b ? 'I' : 'H'); } public override string ToString() { return Builder.ToString(); } public string ToPacketFormatString() { Builder.Append('\0'); return "\0\0\0" + (char)Builder.Length + Builder.ToString(); } public bool HasContent() { return Builder.Length > 2; } } }