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(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////// // 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(); }
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(); }
public static byte[] ObjectSpawn(character c) { PacketWriter Writer = new PacketWriter(); Writer.Create(Systems.SERVER_SOLO_SPAWN); /////////////////////////////////////////////////////// Character basic info #region Basic info Writer.DWord(c.Information.Model); Writer.Byte(c.Information.Volume); //Char Volume Writer.Byte(c.Information.Title); //Char Title Writer.Byte(c.Information.Pvpstate); //Pvp state if (c.Information.Pvpstate != 0) c.Information.PvP = true; Writer.Bool((c.Information.Level < 20 ? true : false)); //Beginners Icon Writer.Byte(c.Information.Slots); // Amount of items #endregion /////////////////////////////////////////////////////// Item info #region Item info Function.Items.PrivateItemPacket(Writer, c.Information.CharacterID, 8, 0,true); Writer.Byte(5); Function.Items.PrivateItemPacket(Writer, c.Information.CharacterID, 5, 1,true); Writer.Byte(0); #endregion /////////////////////////////////////////////////////// Character Location / id #region Location info / state Writer.DWord(c.Information.UniqueID); Writer.Byte(c.Position.xSec); Writer.Byte(c.Position.ySec); Writer.Float(Formule.packetx(c.Position.x, c.Position.xSec)); Writer.Float(c.Position.z); Writer.Float(Formule.packety(c.Position.y, c.Position.ySec)); Writer.Word(0);//angle Writer.Bool(c.Position.Walking); Writer.Byte(1); // walk:0 run:1 ;) //This should send the location information while moving. and where we moving if (c.Position.Walking) { Writer.Byte(c.Position.packetxSec); Writer.Byte(c.Position.packetySec); if (!DarkEmu_GameServer.File.FileLoad.CheckCave(c.Position.packetxSec, c.Position.packetySec)) { Writer.Word(c.Position.packetX); Writer.Word(c.Position.packetZ); Writer.Word(c.Position.packetY); } else { if(c.Position.packetX < 0) { Writer.Word(c.Position.packetX); Writer.Word(0xFFFF); } else { Writer.DWord(c.Position.packetX); } Writer.DWord(c.Position.packetZ); if(c.Position.packetY < 0) { Writer.Word(c.Position.packetY); Writer.Word(0xFFFF); } else { Writer.DWord(c.Position.packetY); } } /*byte[] x = BitConverter.GetBytes(c.Position.packetX); Array.Reverse(x); Writer.Buffer(x); Writer.Word(c.Position.packetZ); byte[] y = BitConverter.GetBytes(c.Position.packetY); Array.Reverse(y); Writer.Buffer(y);*/ } else { Writer.Byte(1); Writer.Word(0);//angle } Writer.Byte((byte)(c.State.LastState == 128 ? 2 : 1)); Writer.Byte(0); //Info : If a player spawns at your location and is walking it send byte 3, else 0 byte. if (c.Transport.Right) Writer.Byte(c.Transport.Horse.Walking == true ? 3 : 0); else Writer.Byte(c.Position.Walking == true ? 3 : 0); Writer.Byte((byte)(c.Information.Berserking ? 1 : 0)); Writer.Byte(0); Writer.Float(c.Speed.WalkSpeed); Writer.Float(c.Speed.RunSpeed); Writer.Float(c.Speed.BerserkSpeed); Writer.Byte(c.Action.Buff.count); for (byte b = 0; b < c.Action.Buff.SkillID.Length; b++) { if (c.Action.Buff.SkillID[b] != 0) { Writer.DWord(c.Action.Buff.SkillID[b]); Writer.DWord(c.Action.Buff.OverID[b]); } } #endregion /////////////////////////////////////////////////////// Character Job information / name #region Job information & name Writer.Text(c.Information.Name); Writer.Byte(0); if (c.Transport.Right) { Writer.Byte(1); Writer.Byte(0); Writer.DWord(c.Transport.Horse.UniqueID); } else { Writer.Byte(0); Writer.Byte(0); } Writer.Byte(0); if (c.Network.Stall != null && c.Network.Stall.ownerID == c.Information.UniqueID) Writer.Byte(0x04); else Writer.Byte(0); //Writer.Byte(0); if (c.Network.Guild.Guildid > 0) { Writer.Text(c.Network.Guild.Name); if (c.Network.Guild.GrantName != "") { Writer.DWord(0);//Icon ? Writer.Text(c.Network.Guild.GrantName); } else { Writer.DWord(0);//Icon Writer.Word(0);//No grantname } } else { Writer.Word(0);//No guild Writer.DWord(0);//No icon Writer.Word(0);//No grantname } Writer.DWord(0);//need to check not static Writer.DWord(0); Writer.DWord(0); Writer.Byte(0); Writer.Byte(0); if (c.Network.Stall != null && c.Network.Stall.ownerID == c.Information.UniqueID) { Writer.Text3(c.Network.Stall.StallName); Writer.DWord(c.Information.StallModel); } Writer.Byte(0); #endregion /////////////////////////////////////////////////////// Pvp state #region pvpstate if (c.Information.Pvpstate > 0 || c.Information.Murderer) { Writer.Byte(0x22); } else { Writer.Byte(0xFF); } #endregion Writer.Byte(4); 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(); }
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[] StallNameGlobal(int characterid, string stallname) { PacketWriter Writer = new PacketWriter(); Writer.Create(Systems.SERVER_STALL_RENAME); Writer.DWord(characterid); Writer.Text3(stallname); return Writer.GetBytes(); }