//////////////////////////////////////////////////////////////////////////////////////////////////////////// // Chat Packet //////////////////////////////////////////////////////////////////////////////////////////////////////////// public static byte[] ChatPacket(byte type, int id, string text, string name) { PacketWriter Writer = new PacketWriter(); Writer.Create(Systems.SERVER_CHAT); Writer.Byte(type); switch (type) { case 1: Writer.DWord(id); Writer.Text3(text); break; case 3: Writer.DWord(id); Writer.Text3(text); break; case 2: Writer.Text(name); Writer.Text3(text); break; case 4: Writer.Text(name); Writer.Text3(text); break; case 5: Writer.Text(name); Writer.Text3(text); break; case 6: Writer.Text(name); Writer.Text3(text); break; case 7: Writer.Text3(text); break; case 9: Writer.Text(name); Writer.Text3(text); break; case 11: Writer.Text(name); Writer.Text3(text); break; } return(Writer.GetBytes()); }
public static byte[] CreateFormedParty(party pt) { //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode to packet Writer.Create(Systems.SERVER_FORMED_PARTY_CREATED); //Static byte Writer.Byte(1); //Party id Writer.DWord(pt.ptid); //0 Dword value Writer.DWord(0); //Party type Writer.Byte(pt.Type); //Party purpose Writer.Byte(pt.ptpurpose); //Party min level required Writer.Byte(pt.minlevel); //Party max level allowed Writer.Byte(pt.maxlevel); //Party name Writer.Text3(pt.partyname); //Return all bytes to send return(Writer.GetBytes()); }
public static byte[] StallNameGlobal(int characterid, string stallname) { PacketWriter Writer = new PacketWriter(); Writer.Create(Systems.SERVER_STALL_RENAME); Writer.DWord(characterid); Writer.Text3(stallname); return(Writer.GetBytes()); }
public static byte[] StallOpenGlobal(string stallname, int CharacterID, int StallModel) { PacketWriter Writer = new PacketWriter(); Writer.Create(Systems.SERVER_STALL_OPEN); Writer.DWord(CharacterID); Writer.Text3(stallname); Writer.DWord(StallModel); //Decoration return(Writer.GetBytes()); }
public static byte[] StallWelcome(string welcome) { PacketWriter Writer = new PacketWriter(); Writer.Create(Systems.SERVER_STALL_ACTION); Writer.Byte(1); Writer.Byte(6); Writer.Text3(welcome); return(Writer.GetBytes()); }
void RenameParty() { try { //Create new packet reader PacketReader reader = new PacketReader(PacketInformation.buffer); //First integer is party id int partyid = reader.Int32(); //Second integer is not needed int NotNeeded = reader.Int32(); //Byte party type byte ptype = reader.Byte(); //Byte party purpose byte purpose = reader.Byte(); //Byte minimum level byte minlevel = reader.Byte(); //Byte max level to enter party byte maxlevel = reader.Byte(); //Party name lenght short namel = reader.Int16(); //Party name each character is a word value using text3 string pname = reader.Text3(); //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode to server packet Writer.Create(Systems.SERVER_PARTY_CHANGENAME); //Write static byte 1 Writer.Byte(1); //Write party id Writer.DWord(partyid); //Write dword 0 Writer.DWord(0); //Write party type Writer.Byte(ptype); //Write party purpose Writer.Byte(purpose); //Write party minimum level Writer.Byte(minlevel); //Write party max level Writer.Byte(maxlevel); //Write party name Writer.Text3(pname); //Send bytes to client client.Send(Writer.GetBytes()); } //If a error happens catch (Exception ex) { //Write the exception to the log Systems.Debugger.Write(ex); } }
void ListPartyMatching(List <party> pt) { //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode Writer.Create(Systems.SERVER_SEND_PARTYLIST); //Write static bytes Writer.Byte(1); Writer.Byte(4); Writer.Byte(0); //Write total count of partys Writer.Byte(pt.Count); //If party count higher is then zero if (pt.Count > 0) { //Repeat for each party in list of party's foreach (party currpt in pt) { //Get player information using leaderid Systems s = Systems.GetPlayer(currpt.LeaderID); //Write party id Writer.DWord(currpt.ptid); //Write leader id Writer.DWord(currpt.LeaderID); //Write charactername Writer.Text(s.Character.Information.Name); //Write static byte 1 Writer.Byte(1); //Write current party players count Writer.Byte(currpt.Members.Count); //Write party type Writer.Byte(currpt.Type); //Write party purpose Writer.Byte(currpt.ptpurpose); //Write min level required Writer.Byte(currpt.minlevel); //Write max level to join the party Writer.Byte(currpt.maxlevel); //Write party name Writer.Text3(currpt.partyname); } } //Send bytes to the client client.Send(Writer.GetBytes()); }
public static byte[] EnterStall(int CharacterID, stall stall) { PacketWriter Writer = new PacketWriter(); Writer.Create(Systems.SERVER_STALL_OTHER_OPEN); Writer.Byte(1); Writer.DWord(stall.ownerID); Writer.Text3(stall.WelcomeMsg); Writer.Bool(stall.isOpened); Writer.Byte(0); StallItemPacket(stall.ItemList, Writer); Writer.Byte(stall.Members.Count - 2); for (byte i = 0; i < stall.Members.Count; i++) { if (stall.Members[i] != stall.ownerID && stall.Members[i] != CharacterID) { Writer.DWord(stall.Members[i]); } } return(Writer.GetBytes()); }