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(); }
public static byte[] ConnectSuccess() { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_CONNECTION); Writer.Bool(true); return Writer.GetBytes(); }
public static byte[] CancelLeaveGame() { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_LEAVE_CALCEL); Writer.Bool(true); return Writer.GetBytes(); }
public static byte[] ServerListPacket(int cliVersion) { //Create a new packet writer to create our packet PacketWriter W = new PacketWriter(); //Write the opcode from server to client W.Create(Opcodes.SERVER.SERVER_SERVERLIST); //Structure of packet below W.Word(0x0201); W.Text("CLOWEN_DEV_PROJECT"); W.Byte(0); //Repeat the following packet data below for each server in the list foreach (KeyValuePair<int, Definitions.Serverdef.ServerDetails> Gameservers in Definitions.Serverdef.Serverlist) { if (cliVersion == Definitions.Serverdef.SilkroadClientVersion) { W.Bool(true); W.Word(Gameservers.Value.id); W.Text(Gameservers.Value.name); W.Word(Gameservers.Value.usedSlots); W.Word(Gameservers.Value.maxSlots); W.Byte(Gameservers.Value.status); } } //Static 0 byte W.Byte(0); //Send the created packet back to the request (client). return W.GetBytes(); }
public static byte[] CloseExhangeWindow() { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_EXCHANGE_CLOSE); Writer.Bool(true); return Writer.GetBytes(); }
public static byte[] CloseNPC() { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_CLOSE_NPC); Writer.Bool(true); return Writer.GetBytes(); }
public static byte[] AgentServer() { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_AGENTSERVER); Writer.Text("AgentServer"); Writer.Bool(true); 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[] 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[] ChatIndexPacket(byte type, byte index) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_CHAT_INDEX); Writer.Bool(true); Writer.Byte(type); Writer.Byte(index); 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(); }
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(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////// // Create Item From Gm console //////////////////////////////////////////////////////////////////////////////////////////////////////////// public static byte[] CREATEITEM(byte type, byte Slot, int id, short plus, int durability, int itemid, int bluecount) { int msid = Convert.ToInt32(DB.GetData("SELECT id FROM char_items WHERE owner='" + id + "' AND slot = '" + Slot + "'", "id")); PlayerMgr.LoadBluesid(msid); PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ITEM_MOVE); Writer.Bool(true); Writer.Byte(6); Item.AddItemPacket(Writer, Slot, id, (byte)plus, plus, durability, itemid, msid, 0); return Writer.GetBytes(); }
public static byte[] EnterStall(int CharacterID, WorldMgr.stall stall) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.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[] OpenNPC(byte type) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_OPEN_NPC); Writer.Bool(true); switch (type) { case 1: //Purchase items Writer.Byte(type); break; case 2: Writer.Byte(2); break; case 12: Writer.Byte(0x01); Writer.Byte(0x01); break; default: Writer.Byte(type); break; } return Writer.GetBytes(); }
public static byte[] ObjectSpawnJob(WorldMgr.character c) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.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 ;) if (c.Position.Walking) { Writer.Byte(c.Position.packetxSec); Writer.Byte(c.Position.packetySec); if (!FileDB.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); } } } else { Writer.Byte(1); Writer.Word(0);//angle } Writer.Byte((byte)(c.State.LastState == 128 ? 2 : 1)); Writer.Byte(0); Writer.Byte(3); Writer.Byte((byte)(c.Information.Berserking ? 1 : 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.Job.Jobname); Writer.Byte(1); Writer.Byte(c.Job.level);//Level job Writer.Byte(c.Information.Level);//Level char 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); Writer.Byte(0); if (c.Network.Guild.Guildid > 0) { Writer.Text(c.Network.Guild.Name); } else { Writer.Word(0);//No guild } Writer.Byte(0); Writer.Byte(0xFF); Writer.Byte(4); #endregion return Writer.GetBytes(); }
public void AttackHim(int AttackType) { try { if (!Runing && Attacking && !bSleep) { PlayerMgr sys = (PlayerMgr)GetTarget(); if (sys == null || Die || GetDie) { AttackStop(); return; } if (sys != null && !Spawned(sys.Character.Information.UniqueID)) { AttackStop(); return; } if (!sys.Character.InGame) { AttackStop(); return; } byte NumberAttack = 1; int p_dmg = 0; byte status = 0, crit = 1; PacketWriter Writer = new PacketWriter(); Writer.Create(Client.OperationCode.SERVER_ACTION_DATA); Writer.Byte(1); Writer.Byte(2); Writer.Byte(0x30); Writer.DWord(AttackType); Writer.DWord(UniqueID); LastCasting = Ids.GetCastingID(); Writer.DWord(LastCasting); Writer.DWord(sys.Character.Information.UniqueID); Writer.Bool(true); Writer.Byte(NumberAttack); Writer.Byte(1); Writer.DWord(sys.Character.Information.UniqueID); for (byte n = 1; n <= NumberAttack; n++) { bool block = false; if (sys.Character.Information.Item.sID != 0 && ObjData.Manager.ItemBase[sys.Character.Information.Item.sID].TypeID2 == 1) { if (Rnd.Next(25) < 10) block = true; } if (!block) { status = 0; crit = 1; p_dmg = (int)Formule.gamedamage(ObjData.Manager.SkillBase[AttackType].MaxAttack, 0, sys.Character.Stat.phy_Absorb, sys.Character.Stat.PhyDef, 50, ObjData.Manager.SkillBase[AttackType].MagPer); p_dmg += Rnd.Next(0, p_dmg.ToString().Length); if (p_dmg <= 0) p_dmg = 1; if (Rnd.Next(20) > 15) { p_dmg *= 2; crit = 2; } if (sys.Character.Stat.Absorb_mp > 0) { int static_dmg = (p_dmg * (100 - (int)sys.Character.Stat.Absorb_mp)) / 100; sys.Character.Stat.SecondMP -= static_dmg; if (sys.Character.Stat.SecondMP < 0) sys.Character.Stat.SecondMP = 0; sys.UpdateMp(); p_dmg = static_dmg; } sys.Character.Stat.SecondHp -= p_dmg; if (sys.Character.Stat.SecondHp <= 0) { sys.BuffAllClose(); status = 128; sys.Character.Stat.SecondHp = 0; sys.Character.State.Die = true; sys.Character.State.DeadType = 1; _agro agro = GetAgroClass(sys.Character.Information.UniqueID); if (agro != null) AgressiveDMG.Remove(agro); DeleteTarget(); AttackStop(); CheckAgro(); if (sys.Character.Action.nAttack) sys.StopAttackTimer(); else if (sys.Character.Action.sAttack || sys.Character.Action.sCasting) sys.StopSkillTimer(); } sys.UpdateHp(); Writer.Byte(status); Writer.Byte(crit); Writer.DWord(p_dmg); Writer.Byte(0); Writer.Word(0); } else Writer.Byte(2); } Send(Writer.GetBytes()); //Game.Effect.EffectMain(sys, AttackType); } } catch (Exception ex) { Log.Exception(ex); } }
public static byte[] UpdateStr() { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_PLAYER_UPDATE_STR); Writer.Bool(true); return Writer.GetBytes(); }
public static byte[] StatePack(int id, byte type1, byte type2, bool type3) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_CHANGE_STATUS); Writer.DWord(id); Writer.Byte(type1); Writer.Byte(type2); if (type1 == 4 && type2 == 1) Writer.Bool(type3); return Writer.GetBytes(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////// // Move Item From Buying To Inventory //////////////////////////////////////////////////////////////////////////////////////////////////////////// public static byte[] MoveItemBuy(byte type, byte shopLine, byte itemLine, byte max, byte slot, short amount) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ITEM_MOVE); Writer.Bool(true); Writer.Byte(type); Writer.Byte(shopLine); Writer.Byte(itemLine); Writer.Byte(1); Writer.Byte(slot); Writer.Word(amount); Writer.DWord(0); return Writer.GetBytes(); }
public static byte[] GameMaster(short FlagType, int Player = 0, int NPC_Mob = 0, int DroppedItem = 0, string Text = "") { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_GM); Writer.Bool(true); Writer.Word(FlagType); if (FlagType == 4) { // WorldStatus Writer.DWord(Player); // Player Count Writer.DWord(NPC_Mob); // NPC_Mob Writer.DWord(DroppedItem); // DroppedItem } else if (FlagType == 1) { Writer.Text(Text); } return Writer.GetBytes(); }
public static byte[] CharacterDataLoad(WorldMgr.character c) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_PLAYERDATA); /////////////////////////////////////////////////////// Character basic info #region Basic info Writer.DWord(c.Ids.GetLoginID); Writer.DWord(c.Information.Model); Writer.Byte(c.Information.Volume); Writer.Byte(c.Information.Level); Writer.Byte(c.Information.Level); Writer.LWord(c.Information.XP); Writer.DWord(c.Information.SpBar); Writer.LWord(c.Information.Gold); Writer.DWord(c.Information.SkillPoint); Writer.Word(c.Information.Attributes); Writer.Byte(c.Information.BerserkBar); Writer.DWord(988); Writer.DWord(c.Stat.SecondHp); Writer.DWord(c.Stat.SecondMP); Writer.Bool(c.Information.Level < 20 ? true : false); #endregion /////////////////////////////////////////////////////// Character Player Kill Info #region Pk information //DB perfection reading with multiple data adapters... while this one is open i can still read anything else from the database //With no speed reduction... DB checkpk = new DB("SELECT * FROM character WHERE name ='" + c.Information.Name + "'"); using (System.Data.SqlClient.SqlDataReader getinfo = checkpk.Read()) { while (getinfo.Read()) { byte dailypk = getinfo.GetByte(48); byte pklevel = getinfo.GetByte(49); byte murderlevel = getinfo.GetByte(50); Writer.Byte(dailypk); Writer.Word(pklevel); Writer.DWord(murderlevel); if (murderlevel != 0) c.Information.Murderer = true; } } #endregion /////////////////////////////////////////////////////// Character Title #region Title Writer.Byte(c.Information.Title); #endregion /////////////////////////////////////////////////////// Character Pvpstate #region Pvp Writer.Byte(c.Information.Pvpstate); if (c.Information.Pvpstate > 0) c.Information.PvP = true; #endregion /////////////////////////////////////////////////////// Character Items #region Item Writer.Byte(c.Information.Slots); DB ms = new DB("SELECT * FROM char_items WHERE owner='" + c.Information.CharacterID + "' AND slot >= '0' AND slot <= '" + c.Information.Slots + "' AND inavatar='0' AND storagetype='0'"); Writer.Byte(ms.Count()); using (System.Data.SqlClient.SqlDataReader msreader = ms.Read()) { while (msreader.Read()) { short amount = msreader.GetInt16(6); if (amount < 1) amount = 1; DB.query("UPDATE char_items SET quantity='" + amount + "' WHERE owner='" + c.Information.CharacterID + "' AND itemid='" + msreader.GetInt32(2) + "' AND id='" + msreader.GetInt32(0) + "' AND storagetype='0'"); if (msreader.GetByte(5) == 6) c.Information.Item.wID = Convert.ToInt32(msreader.GetInt32(2)); if (msreader.GetByte(5) == 7) { c.Information.Item.sID = msreader.GetInt32(2); c.Information.Item.sAmount = msreader.GetInt16(6); } Item.AddItemPacket(Writer, msreader.GetByte(5), msreader.GetInt32(2), msreader.GetByte(4), amount, msreader.GetInt32(7),msreader.GetInt32(0), msreader.GetInt32(9), msreader.GetInt32(30)); } } ms.Close(); //Avatar Writer.Byte(5); ms = new DB("SELECT * FROM char_items WHERE owner='" + c.Information.CharacterID + "' AND slot >= '0' AND slot <= '" + c.Information.Slots + "' AND inavatar='1' AND storagetype='0'"); Writer.Byte(ms.Count()); using (System.Data.SqlClient.SqlDataReader msreader = ms.Read()) { while (msreader.Read()) { Item.AddItemPacket(Writer, msreader.GetByte(5), msreader.GetInt32(2), msreader.GetByte(4), msreader.GetInt16(6), msreader.GetInt32(7), msreader.GetInt32(0), msreader.GetInt32(9),msreader.GetInt32(30)); } } ms.Close(); Writer.Byte(0); // job mastery Writer.Byte(0x0B); Writer.Byte(0); Writer.Byte(0); #endregion /////////////////////////////////////////////////////// Mastery #region Mastery if (c.Information.Model <= 12000) { for (byte i = 1; i <= 7; i++) { Writer.Byte(1); Writer.DWord(c.Stat.Skill.Mastery[i]); Writer.Byte(c.Stat.Skill.Mastery_Level[i]); } } else { if (c.Information.Model >= 14000) { for (byte i = 1; i < 7; i++) { Writer.Byte(1); Writer.DWord(c.Stat.Skill.Mastery[i]); Writer.Byte(c.Stat.Skill.Mastery_Level[i]); } } } #endregion /////////////////////////////////////////////////////// Skills #region Skill Writer.Byte(2); Writer.Byte(0); for (int i = 1; i <= c.Stat.Skill.AmountSkill; i++) { Writer.Byte(1); Writer.DWord(c.Stat.Skill.Skill[i]); Writer.Byte(1); } Writer.Byte(2); #endregion /////////////////////////////////////////////////////// Quests #region Quest Writer.Word(1); // how many Quest ids completed/aborted Writer.DWord(1);// Quest id Writer.Byte(0);//number of Quests that are live #endregion Writer.Byte(0);//? for now /////////////////////////////////////////////////////// Talisman #region Talisman Writer.DWord(1);//new Writer.DWord(1);//new Writer.DWord(0);//? for now Writer.DWord(0x0C);//new #endregion /////////////////////////////////////////////////////// Position + id + speed #region Character id / Position / Speed Writer.DWord(c.Information.UniqueID); Writer.Byte(c.Position.xSec); Writer.Byte(c.Position.ySec); if (!FileDB.CheckCave(c.Position.xSec, 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)); } else { Writer.Float(Formule.cavepacketx(c.Position.x));// Added for cave Coords Writer.Float(c.Position.z); Writer.Float(Formule.cavepackety(c.Position.y));// Added for cave Coords } Writer.Word(0); // Angle Writer.Byte(0); Writer.Byte(1); Writer.Byte(0); Writer.Word(0); // Angle Writer.Word(0); Writer.Byte(0); Writer.Bool(false); //berserk Writer.Byte(0);//new ? Writer.Float(c.Speed.WalkSpeed); Writer.Float(c.Speed.RunSpeed); Writer.Float(c.Speed.BerserkSpeed); #endregion /////////////////////////////////////////////////////// Premium Tickets #region Premium ticket Writer.Byte(0); //ITEM_MALL_GOLD_TIME_SERVICE_TICKET_4W #endregion /////////////////////////////////////////////////////// GM Check + Name #region GM Check + Name Writer.Text(c.Information.Name); #endregion /////////////////////////////////////////////////////// Character jobs #region Character Job / hunter thief trader ( old job things ) //Writer info with job name when on job /*if (c.Job.state == 1 && c.Job.Jobname != "0") { Writer.Text(c.Job.Jobname); Writer.Byte(3); Writer.Byte(1); Writer.DWord(0); Writer.DWord(0); Writer.DWord(0); Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); } //Write basic info noname if (c.Job.Jobname == "0") { Writer.Word(0); Writer.Byte(3); Writer.Byte(1); Writer.DWord(0); Writer.DWord(0); Writer.DWord(0); Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); } //Write no info else { Writer.Word(0); Writer.Byte(0); Writer.Byte(1); Writer.DWord(0); Writer.DWord(0); Writer.DWord(0); Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); }*/ #endregion #region New job system if (c.Job.state == 1) { Writer.Text(c.Job.Jobname); Writer.Byte(1); Writer.Byte(c.Job.level);//Level job Writer.Byte(c.Information.Level);//Level char Writer.Byte(1); // job level? myb Writer.LWord(0);// job exp probably y Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); } else { Writer.Word(0); Writer.Byte(0); Writer.Byte(0); Writer.Byte(2); // job type Writer.Byte(1); // job level? myb Writer.LWord(0);// job exp probably y Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); } #endregion /////////////////////////////////////////////////////// Pvp / Pk State #region Pvp / Pk State if (c.Information.Pvpstate == 1 || c.Information.Murderer) { Writer.Byte(0x22); } else if (c.Information.Pvpstate == 0 || !c.Information.Murderer) { Writer.Byte(0xFF); } #endregion /////////////////////////////////////////////////////// Guide Data #region Guide Data this data stacks on itself so if guide id is 0400000000000000 and next guide is 0300000000000000 the data to send is 0700000000000000 for (int i = 0; i < 8; ++i)//Main Guide Packet Info { Writer.Byte(c.Guideinfo.G1[i]);//Reads From Int Array } #endregion /////////////////////////////////////////////////////// Account / Gm Check #region Account ID + Gm Check Writer.DWord(c.Account.ID); Writer.Byte(c.Information.GM); #endregion /////////////////////////////////////////////////////// Quickbar + Autopotion #region Bar information Writer.Byte(7); PlayerQuickBar(Writer, c.Information.CharacterID); PlayerAutoPot(Writer, c.Information.CharacterID); #endregion /////////////////////////////////////////////////////// Academy #region Academy Writer.Byte(0); // number of player in academy /* // if we have players there Writer.Byte(1); Writer.Text("asd"); */ Writer.Byte(0);//added byte today for 1.310 Writer.Byte(0); Writer.Word(1); Writer.Word(1); Writer.Byte(0); Writer.Byte(1); #endregion return Writer.GetBytes(); }
public static byte[] ObjectSpawn(WorldMgr.character c) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.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 (!FileDB.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);// emblem (guild) Writer.DWord(0); // unique id (union) Writer.DWord(0); //emblem (union) Writer.Byte(0); // flag (guild_war) Writer.Byte(0); // flag (fortress_rank) 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(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////// // Buy Item Back From Npc //////////////////////////////////////////////////////////////////////////////////////////////////////////// public static byte[] MoveItemBuyGetBack(byte slot, byte b_slot, short amount) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ITEM_MOVE); Writer.Bool(true); Writer.Byte(0x22); Writer.Byte(slot); Writer.Byte(b_slot); Writer.Word(amount); return Writer.GetBytes(); }
public static byte[] OpenExhangeWindow(byte type, int id) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_EXCHANGE_PROCESS); Writer.Bool(true); Writer.DWord(id); return Writer.GetBytes(); }
public static byte[] MoveItem(byte type, byte fromSlot, byte toSlot, short quantity, long gold, string action) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ITEM_MOVE); switch (action) { case "MOVE_INSIDE_INVENTORY": Writer.Byte(1); Writer.Byte(type); Writer.Byte(fromSlot); Writer.Byte(toSlot); Writer.Word(quantity); Writer.Byte(0); break; case "MOVE_INSIDE_STORAGE": Writer.Bool(true); Writer.Byte(1); Writer.Byte(fromSlot); Writer.Byte(toSlot); Writer.Word(quantity); break; case "MOVE_INSIDE_GUILD_STORAGE": Writer.Byte(1); Writer.Byte(0x1D);//Type Writer.Byte(fromSlot); Writer.Byte(toSlot); Writer.Word(quantity); break; case "MOVE_TO_STORAGE": Writer.Byte(1); Writer.Byte(2); Writer.Byte(fromSlot); Writer.Byte(toSlot); break; case "MOVE_TO_GUILD_STORAGE": Writer.Byte(1); Writer.Byte(0x1E); Writer.Byte(fromSlot); Writer.Byte(toSlot); break; case "MOVE_FROM_STORAGE": Writer.Byte(1); Writer.Byte(3); Writer.Byte(fromSlot); Writer.Byte(toSlot); break; case "MOVE_FROM_GUILD_STORAGE": Writer.Byte(1); Writer.Byte(0x1F); Writer.Byte(fromSlot); Writer.Byte(toSlot); break; case "MOVE_WAREHOUSE_GOLD": Writer.Bool(true); Writer.Byte(type); Writer.LWord(gold); break; case "MOVE_GENDER_CHANGE": Writer.Byte(1); Writer.Byte(fromSlot); Writer.Byte(0x13); Writer.Byte(2); break; case "DELETE_ITEM": Writer.Byte(1); Writer.Byte(type); Writer.Byte(fromSlot); if (type == 0x0F) Writer.Byte(4); break; case "DELETE_GOLD": Writer.Byte(1); Writer.Byte(type); Writer.LWord(gold); break; } return Writer.GetBytes(); }
void ActionAttack() { try { //Predefined info needs work! #region Predefined info byte NumberAttack = 2; int AttackType = 1; int[] found = new int[3]; byte numbert = 1; int p_dmg = 0; byte status = 0, crit = 1; #endregion client.Send(Packet.ActionState(1, 1)); //Bow information if (CheckBow()) { StopSkillTimer(); StopAttackTimer(); return; } WorldMgr.targetObject target = new WorldMgr.targetObject(Character.Action.Object, this); if (Character.Action.ImbueID != 0 && ObjData.Manager.SkillBase[Character.Action.ImbueID].Series.Remove(ObjData.Manager.SkillBase[Character.Action.ImbueID].Series.Length - 2) == "SKILL_CH_LIGHTNING_GIGONGTA") { numbert = ActionGetObject(ref found, 2, target.x, target.y, Character.Action.Target, 5); } else found[1] = Character.Action.Target; if (Character.Information.Item.wID != 0) { switch (ObjData.Manager.ItemBase[Character.Information.Item.wID].TypeID4) { //Chinese base skills case 2: //One handed sword case 3: NumberAttack = 2; AttackType = 2; break; case 4: //Spear attack + glavie case 5: NumberAttack = 1; AttackType = 40; break; case 6: //Bow attack NumberAttack = 1; AttackType = 70; break; //Europe Base skills case 7: NumberAttack = 1; AttackType = 7127; // One handed sword break; case 8: NumberAttack = 1; AttackType = 7128; // Two handed sword break; case 9: NumberAttack = 2; AttackType = 7129; // Axe basic attack break; case 10: NumberAttack = 1; AttackType = 9069; // Warlock base break; case 11: NumberAttack = 1; AttackType = 8454; // Staff / Tstaff break; case 12: NumberAttack = 1; AttackType = 7909; // Crossbow base break; case 13: NumberAttack = 2; //Dagger AttackType = 7910; break; case 14: NumberAttack = 1; AttackType = 9606; // Harp base break; case 15: NumberAttack = 1; AttackType = 9970; // Light staff cleric break; case 16: NumberAttack = 1; AttackType = ObjData.Manager.SkillBase[Character.Action.UsingSkillID].ID; break; default: Console.WriteLine("Action attack case: {0} , SkillID = {1}" + ObjData.Manager.ItemBase[Character.Information.Item.wID].TypeID4, ObjData.Manager.SkillBase[Character.Action.UsingSkillID].ID); break; } } else { //Punch attack NumberAttack = 1; AttackType = 1; } //Get casting id Character.Action.AttackingID = Character.Ids.GetCastingID(); //Create new packet writer PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ACTION_DATA); Writer.Byte(1); Writer.Byte(2); Writer.Byte(0x30); Writer.DWord(AttackType); Writer.DWord(Character.Information.UniqueID); Writer.DWord(Character.Action.AttackingID); Writer.DWord(Character.Action.Target); Writer.Bool(true); Writer.Byte(NumberAttack); Writer.Byte(numbert); for (int t = 1; t <= numbert; t++) { Writer.DWord(found[t]); for (byte n = 1; n <= NumberAttack; n++) { //Set defaults p_dmg = (int)Formule.gamedamage(Character.Stat.MaxPhyAttack, Character.Stat.AttackPower + MasteryGetPower(AttackType), 0, (double)target.PhyDef, Character.Information.Phy_Balance, Character.Stat.UpdatededPhyAttack); status = 0; crit = 0; //Set target target = new WorldMgr.targetObject(Helpers.GetInformation.GetObjects(found[t]), this); //Make sure we dont get null error if (Character.Action.UsingSkillID != 0) { //If we have an active imbue if (ObjData.Manager.SkillBase[Character.Action.UsingSkillID].Definedname == ObjData.s_data.Definedtype.Imbue) { p_dmg += ObjData.Manager.SkillBase[Character.Action.UsingSkillID].MaxAttack; p_dmg += Rnd.Next(0, p_dmg.ToString().Length); } } if (status != 128) { status = target.HP((int)p_dmg); } else { target.GetDead(); Character.Action.nAttack = false; } Writer.Byte(status); Writer.Byte(crit); Writer.DWord(p_dmg); Writer.Byte(0); Writer.Word(0); p_dmg = 0; } } Send(Writer.GetBytes()); client.Send(Packet.ActionState(2, 0)); } catch (Exception ex) { Log.Exception(ex); } }
public static byte[] SelectObject(int id, int model, byte type, int hp) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_SELECT_OBJECT); Writer.Bool(true); Writer.DWord(id); switch (type) { case 1: Writer.Byte(1); Writer.DWord(hp); Writer.Byte(1); Writer.Byte(5); break; case 2: PlayerMgr.NPC.Chat(model, Writer); break; case 3: PlayerMgr.NPC.Chat(model, Writer); break; case 4: Writer.Byte(1); Writer.DWord(hp); Writer.Byte(1); Writer.Byte(5); break; case 5: Writer.Byte(1); Writer.Byte(5); //Writer.Byte(4); break; default: break; } return Writer.GetBytes(); }
public static void Guild_ListPlayersInfo(List<ObjData.guild_player> guildMembers, PacketWriter Writer) { Writer.Byte(guildMembers.Count); foreach (ObjData.guild_player m in guildMembers) { Writer.DWord(m.MemberID); Writer.Text(m.Name); Writer.Byte(m.Rank); Writer.Byte(m.Level); Writer.DWord(m.DonateGP); System.Collections.BitArray bits = new System.Collections.BitArray(new bool[] { m.noticeeditRight, m.guildstorageRight, m.unionRight, m.withdrawRight, m.joinRight, false,false,false }); byte[] bytes = new byte[1]; bits.CopyTo(bytes, 0); Writer.DWord((int)bytes[0]); Writer.DWord(0); Writer.DWord(0); Writer.DWord(0); if (m.GrantName != null) { if (m.GrantName != "") Writer.Text(m.GrantName); else Writer.Word(0); } else Writer.Word(0); Writer.DWord(m.Model); Writer.Byte(m.FWrank); Writer.Byte(m.Xsector); Writer.Byte(m.Ysector); Writer.DWord(0xFFFFFFFF); // when he entered last time 25794314 Writer.DWord(0x0189EECA); // when he leveled up last time 25816778 later :P Writer.Bool(!m.Online); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////// // Move Item From Inventory To Npc //////////////////////////////////////////////////////////////////////////////////////////////////////////// public static byte[] MoveItemSell(byte type, byte slot, short amount, int id) { PacketWriter Writer = new PacketWriter(); Writer.Create(OperationCode.SERVER_ITEM_MOVE); Writer.Bool(true); Writer.Byte(type); Writer.Byte(slot); Writer.Word(amount); Writer.DWord(id); Writer.Byte(1); return Writer.GetBytes(); }