public static byte[] PrivateMessageCheck(WorldMgr.character c) { DB ms = new DB("SELECT * FROM message WHERE receiver='" + c.Information.Name + "'"); PacketWriter Writer = new PacketWriter(); int count = ms.Count(); Writer.Create(OperationCode.SERVER_PM_MESSAGE); Writer.Byte(1);//Static Writer.Byte(Convert.ToByte(count));//Total count using (System.Data.SqlClient.SqlDataReader reader = ms.Read()) { while (reader.Read()) { string pmfrom = reader.GetString(1); string pmto = reader.GetString(2); string pmmessage = reader.GetString(3); byte pmstatus = reader.GetByte(4); DateTime pmdate = Convert.ToDateTime(reader.GetDateTime(5)); Writer.Text(pmfrom); // Message From Writer.DWord(0x8A070000); // date Writer.DWord(0xC7058401); // date Writer.Byte(pmstatus); // Status (0 = Unread) (1 = Read) } ms.Close(); } return Writer.GetBytes(); }
public static byte[] AlchemyResponse(bool isSuccess, ObjData.slotItem sItem, byte type, byte totalblue) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ALCHEMY); Writer.Byte(1); Writer.Byte(2); Writer.Bool(isSuccess); Writer.Byte(sItem.Slot); if (!isSuccess) { Writer.Byte(0); } Writer.DWord(0); Writer.DWord(sItem.ID); Writer.Byte(sItem.PlusValue); Writer.LWord(0); Writer.DWord(sItem.Durability); Writer.Byte(ObjData.Manager.ItemBlue[sItem.dbID].totalblue); for (int i = 0; i <= ObjData.Manager.ItemBlue[sItem.dbID].totalblue - 1; i++) { Writer.DWord(ObjData.Manager.MagicOptions.Find(mg => (mg.Name == Convert.ToString(ObjData.Manager.ItemBlue[sItem.dbID].blue[i]))).ID); Writer.DWord(ObjData.Manager.ItemBlue[sItem.dbID].blueamount[i]); } Writer.Word(1); Writer.Word(2); Writer.Word(3); return Writer.GetBytes(); }
/////////////////////////////////////////////////////////////////////////// // Despawn Pet /////////////////////////////////////////////////////////////////////////// public static byte[] PetSpawn(int petid, byte type, CLGameServer.WorldMgr.pet_obj o) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_PLAYER_SPAWN_PET); //Select Opcode Writer.DWord(petid); //Pet ID switch (type) { case 1: //Despawn pet Writer.Byte(1); break; case 2: //Rename pet respawn Writer.Byte(5); Writer.Text(o.Petname); break; case 3: //Attack pet respawn for exp info Writer.Byte(3);//Static Writer.LWord(o.exp);//New exp Writer.DWord(o.OwnerID);//Owner id break; } return Writer.GetBytes(); }
public static byte[] InfoUpdate(byte type, int obje, byte bT) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_INFO_UPDATE); Writer.Byte(type); switch (type) { case 1: Writer.LWord(obje); Writer.Byte(0); break; case 2: Writer.DWord(obje); Writer.Byte(0); break; case 4: Writer.Byte(bT); Writer.DWord(obje); break; default: break; } return Writer.GetBytes(); }
public static byte[] CreateFormedParty(WorldMgr.party pt) { //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode to packet Writer.Create(OperationCode.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[] Effects2Dmg(int id, int dmg) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_EFFECT_DAMAGE); Writer.DWord(id); Writer.DWord(dmg); return Writer.GetBytes(); }
public static byte[] BalloonTicket(int charid, int info) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_TICKET); Writer.Byte(0); Writer.DWord(charid); Writer.DWord(info); return Writer.GetBytes(); }
public static byte[] Player_UpToHorse(int ownerID, bool type, int petID) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_PLAYER_UPTOHORSE); //Select opcode Writer.Byte(1); //Static byte Writer.DWord(ownerID); //Horse Owner ID Writer.Byte(type); //Horse Type Writer.DWord(petID); //Horse ID return Writer.GetBytes(); }
/////////////////////////////////////////////////////////////////////////// // Grab pet settings /////////////////////////////////////////////////////////////////////////// public static byte[] ChangePetSettings(byte option, int petid, byte type, int settings) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_GPET_SETTINGS); Writer.Byte(option); Writer.DWord(petid); Writer.Byte(type); Writer.DWord(settings); return Writer.GetBytes(); }
public static byte[] PasswordFailed(int CurrentAttempts, int MaxAttempts) { PacketWriter Write = new PacketWriter(); Write.Create(Opcodes.SERVER.SERVER_GATEWAY_LOGIN_RESPONSE); Write.Byte(2); Write.Byte(1); Write.DWord(MaxAttempts); Write.DWord(CurrentAttempts); return Write.GetBytes(); }
public static byte[] EffectUpdate(int objectid, CLGameServer.Effect.EffectNumbers effectid, bool start) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_SKILL_EFFECTS); Writer.DWord(objectid); Writer.Byte(1); Writer.Bool(start); Writer.Byte(4); // effect change Writer.DWord(effectid); return Writer.GetBytes(); }
public static byte[] Pet_Information(int id, int model, int hp, int charid, CLGameServer.WorldMgr.pet_obj o) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_PET_INFORMATION); //Select opcode Writer.DWord(id); //Horse ID Writer.DWord(model); //Horse Model Writer.DWord(hp); //Horse HP Writer.DWord(hp); //Horse SEC HP Writer.Byte(0); //Static byte ? return Writer.GetBytes(); }
public static byte[] GuildSetTitle2(int guildid, int charid, string title) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_GUILD_SET_TITLE2); Writer.Byte(1); Writer.DWord(guildid); Writer.DWord(charid); Writer.Word(title.Length); Writer.String(title); return Writer.GetBytes(); }
public 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(OperationCode.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 } }
public static byte[] GuildSetOnline(WorldMgr.guild c, int memberid) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_GUILD_ONLINE); Writer.DWord(memberid); Writer.DWord(c.Guildid); Writer.Text(c.Name); Writer.Word(0); Writer.DWord(0); Writer.DWord(0); Writer.DWord(0); Writer.Byte(0); Writer.Byte(1); return Writer.GetBytes(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////// // Delete Item from inventory visual //////////////////////////////////////////////////////////////////////////////////////////////////////////// public static byte[] DespawnFromInventory(int id) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ITEM_DELETE); Writer.DWord(id); return Writer.GetBytes(); }
public static byte[] FriendGroupManage(string type,string groupname, short groupid, int targetid) { PacketWriter Writer = new PacketWriter(); switch (type) { case "ADD": Writer.Create(OperationCode.SERVER_FRIEND_GROUP); Writer.Byte(1); Writer.Text(groupname); Writer.Word(groupid); break; case "REMOVE": Writer.Create(OperationCode.SERVER_FRIEND_GROUP_REMOVE); Writer.Byte(1); Writer.Word(groupid); break; case "MOVE": Writer.Create(OperationCode.SERVER_FRIEND_GROUP_MANAGE_FRIEND); Writer.Byte(1); Writer.DWord(targetid); Writer.Word(groupid); break; } return Writer.GetBytes(); }
public static byte[] ActionPacket(byte type1, byte type2, int skillid, int ownerid, int castingid, int target) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ACTION_DATA); Writer.Byte(type1); Writer.Byte(type2); Writer.Byte(0x30); Writer.DWord(skillid); Writer.DWord(ownerid); Writer.DWord(castingid); Writer.DWord(target); Writer.Byte(0); return Writer.GetBytes(); }
public static byte[] ObjectDeSpawn(int id) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_SOLO_DESPAWN); Writer.DWord(id); return Writer.GetBytes(); }
public static byte[] TeleportOtherStart() { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_TELEPORTOTHERSTART); Writer.DWord(0); return Writer.GetBytes(); }
public static byte[] GuildKick(int memberid) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_GUILD_DISBAND); Writer.DWord(memberid); return Writer.GetBytes(); }
public static byte[] Movement(ObjData.vektor p) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_MOVEMENT); //Select opcode Writer.DWord(p.ID); //Player ID Writer.Bool(true); //Bool 1 Writer.Byte(p.xSec); //Player X Sector Writer.Byte(p.ySec); //Player Y Sector if (!FileDB.CheckCave(p.xSec, p.ySec)) { Writer.Word(p.x); //Player X Location Writer.Word(p.z); //Player Z Location Writer.Word(p.y); //Player Y Location } else { if (p.x < 0) { Writer.Word(p.x); Writer.Word(0xFFFF); } else { Writer.DWord(p.x); } Writer.DWord(p.z); if (p.y < 0) { Writer.Word(p.y); Writer.Word(0xFFFF); } else { Writer.DWord(p.y); } } Writer.Bool(false); /* ReSearch this is ext packets Writer.Byte(p.xSec); //Player X Sector Writer.Byte(p.ySec); //Player Y Sector Writer.Word(p.x); //Player X Location Writer.DWord(p.z); //Player Z Location Writer.Word(p.y); */ //Player Y Location return Writer.GetBytes(); }
public static byte[] Angle(int UniqueID, ushort angle) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ANGLE); Writer.DWord(UniqueID); Writer.Word(angle); return Writer.GetBytes(); }
public static byte[] StallCloseGlobal(int charid) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_STALL_CLOSE); Writer.DWord(charid); Writer.Word(0); return Writer.GetBytes(); }
public static byte[] SkillEndBuffPacket(int overid) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_SKILL_ENDBUFF); Writer.Bool(true); Writer.DWord(overid); return Writer.GetBytes(); }
public static byte[] JoinFormedRequest(WorldMgr.character requesting, WorldMgr.character owner) { //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode for packet Writer.Create(OperationCode.SERVER_PARTY_JOIN_FORMED); //Character model information (Req). Writer.DWord(requesting.Information.Model); //Leader id Writer.DWord(requesting.Information.UniqueID); //Party id Writer.DWord(owner.Network.Party.ptid); //Static Writer.DWord(0); Writer.DWord(0); Writer.Byte(0); Writer.Byte(0xFF); //Write character unique id Writer.DWord(requesting.Information.UniqueID); //Write character name Writer.Text(requesting.Information.Name); //Write model information Writer.DWord(requesting.Information.Model); //Write level information Writer.Byte(requesting.Information.Level); //Static Writer.Byte(0xAA); //X and Y Sector Writer.Byte(requesting.Position.xSec); Writer.Byte(requesting.Position.ySec); //Static Writer.Word(0); Writer.Word(0); Writer.Word(0); Writer.Word(1); Writer.Word(1); //If character is in a guild if (requesting.Network.Guild != null) //Write guild name Writer.Text(requesting.Network.Guild.Name); //If character is not in a guild else //Write word value 0 Writer.Word(0); //Static Writer.Byte(0); Writer.DWord(0); Writer.DWord(0); //Return all bytes to send return Writer.GetBytes(); }
public void ListPartyMatching(List<WorldMgr.party> pt) { //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode Writer.Create(OperationCode.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 (WorldMgr.party currpt in pt) { //Get player information using leaderid PlayerMgr s = Helpers.GetInformation.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(currpt.Race); //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()); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////// // Chat Packet //////////////////////////////////////////////////////////////////////////////////////////////////////////// public static byte[] ChatPacket(byte type, int id, string text, string name) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.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[] GuildSetTitle(int charid, string charname, string title) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_GUILD_SET_TITLE); Writer.DWord(charid); Writer.Text(charname); Writer.Text(title); return Writer.GetBytes(); }
public static byte[] MasteryUpPacket(int mastery, byte level) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_MASTERY_UP); Writer.Bool(true); Writer.DWord(mastery); Writer.Byte(level); return Writer.GetBytes(); }