コード例 #1
0
        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();
        }
コード例 #2
0
 public static byte[] OpenWarehouse(long t)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_OPEN_WAREHOUSE);
     Writer.LWord(t);
     return Writer.GetBytes();
 }
コード例 #3
0
        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();
        }
コード例 #4
0
 ///////////////////////////////////////////////////////////////////////////
 // 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();
 }
コード例 #5
0
 public static byte[] Exchange_Gold(long gold)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_EXCHANGE_GOLD);
     Writer.Byte(2);
     Writer.LWord(gold);
     return Writer.GetBytes();
 }
コード例 #6
0
        public static byte[] Exchange_ItemPacket(int id, List<ObjData.slotItem> Exhange, bool mine)
        {
            PacketWriter Writer = new PacketWriter();
            Writer.Create(OperationCode.SERVER_EXCHANGE_ITEM);
            Writer.DWord(id);
            Writer.Byte(Exhange.Count);

            for (byte i = 0; i < Exhange.Count; i++)
            {
                PlayerMgr.LoadBluesid(Exhange[i].dbID);
                if (mine) Writer.Byte(Exhange[i].Slot);

                Writer.Byte(i);
                Writer.DWord(0);
                Writer.DWord(Exhange[i].ID);

                if (ObjData.Manager.ItemBase[Exhange[i].ID].Type == ObjData.item_database.ArmorType.ARMOR ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Type == ObjData.item_database.ArmorType.GARMENT ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Type == ObjData.item_database.ArmorType.GM ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Type == ObjData.item_database.ArmorType.HEAVY ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Type == ObjData.item_database.ArmorType.LIGHT ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Type == ObjData.item_database.ArmorType.PROTECTOR ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Type == ObjData.item_database.ArmorType.ROBE ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EARRING ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.RING ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.NECKLACE ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.BLADE ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.BOW ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_AXE ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_CROSSBOW ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_DAGGER ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_DARKSTAFF ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_HARP ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_STAFF ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_SWORD ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_TSTAFF ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_TSWORD ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.GLAVIE ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.SPEAR ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.SWORD ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.CH_SHIELD ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.EU_SHIELD)
                {
                    Writer.Byte(Exhange[i].PlusValue);
                        Writer.LWord(0);
                        Writer.DWord(ObjData.Manager.ItemBase[Exhange[i].ID].Defans.Durability);
                        if (ObjData.Manager.ItemBlue[Exhange[i].dbID].totalblue != 0)
                        {
                            Writer.Byte(Convert.ToByte(ObjData.Manager.ItemBlue[Exhange[i].dbID].totalblue));
                            for (int a = 1; a <= ObjData.Manager.ItemBlue[Exhange[i].dbID].totalblue; a++)
                            {
                                Writer.DWord(ObjData.Manager.MagicOptions.Find(mg => (mg.Name == Convert.ToString(ObjData.Manager.ItemBlue[Exhange[i].dbID].blue[i]))).ID);
                                Writer.DWord(ObjData.Manager.ItemBlue[Exhange[i].dbID].blueamount[i]);
                            }
                        }

                        else
                        {
                            Writer.Byte(0);
                        }
                        Writer.Word(1);
                        Writer.Word(2);
                        Writer.Word(3);
                }
                else if (ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.STONES)
                {
                    Writer.Word(Exhange[i].Amount);
                    Writer.Byte(0);
                }
                else if (ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.MONSTERMASK)
                {
                    Writer.DWord(0);
                }
                else if (ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.ELIXIR)
                {
                    Writer.Word(1);
                }
                    else if (ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.ARROW ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Itemtype == ObjData.item_database.ItemType.BOLT ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.HP_POTION ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.MP_POTION ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.VIGOR_POTION ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.SPEED_POTION ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Ticket == ObjData.item_database.Tickets.BEGINNER_HELPERS ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.ELIXIR ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].Etctype == ObjData.item_database.EtcType.ALCHEMY_MATERIAL ||
                    ObjData.Manager.ItemBase[Exhange[i].ID].TypeID2 == 3)
                {
                    Writer.Word(Exhange[i].Amount);
                }
            }
            return Writer.GetBytes();
        }
コード例 #7
0
 public static byte[] ItemExchange_Gold(long gold)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_ITEM_MOVE);
     Writer.Byte(1);
     Writer.Byte(13);
     Writer.LWord(gold);
     return Writer.GetBytes();
 }
コード例 #8
0
 public static byte[] GuildGoldUpdate(long info, byte type)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_ITEM_MOVE);
     Writer.Byte(1);
     Writer.Byte(type);
     Writer.LWord(info);
     return Writer.GetBytes();
 }
コード例 #9
0
 public static byte[] Player_getExp(int id, long exp, long sp, short level)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_PLAYER_GET_EXP);
     Writer.DWord(id);
     Writer.LWord(exp);
     Writer.LWord(sp);
     Writer.Byte(0);
     if (level != 0) Writer.Word(level);
     return Writer.GetBytes();
 }
コード例 #10
0
        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();
        }
コード例 #11
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Character listening packet
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] CharacterListing(string name)
        {
            DB ms    = new DB("SELECT TOP 4 * FROM character WHERE account='" + name + "'");
            PacketWriter Writer = new PacketWriter();

            Writer.Create(OperationCode.SERVER_CHARACTERSCREEN);      // Select opcode
            Writer.Byte(2);                                     // Static byte 2
            Writer.Byte(1);                                     // Static byte 1
            Writer.Byte(ms.Count());                            // Byte WorldMgr.character count

            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    Writer.DWord(reader.GetInt32(3));           // DWord Skin Model
                    Writer.Text(reader.GetString(2));           // String Name

                    Writer.Byte(reader.GetByte(4));             // Byte Skin Volume
                    Writer.Byte(reader.GetByte(5));             // Byte Level

                    Writer.LWord(reader.GetInt64(12));          // Long Experience

                    Writer.Word(reader.GetInt16(6));            // Word STR
                    Writer.Word(reader.GetInt16(7));            // Word INT
                    Writer.Word(reader.GetInt16(8));            // Attribute points

                    Writer.DWord(reader.GetInt32(9));           // HP
                    Writer.DWord(reader.GetInt32(10));          // MP

                    TimeSpan ts = Convert.ToDateTime(reader.GetDateTime(43)) - DateTime.Now;
                    double time = ts.TotalMinutes;

                    if (Math.Round(time) > 0)
                    {
                        Writer.Byte(1);
                        Writer.DWord(Math.Round(time));
                    }
                    else
                    {
                        Writer.Byte(0);
                    }

                    if (Math.Round(time) < 0 && DateTime.Now != reader.GetDateTime(43))
                    {
                        DB.query("UPDATE character SET deleted='1' Where id='" + reader.GetInt32(0) + "'");
                    }

                    Writer.Word(0);
                    Writer.Byte(0);

                    Function.Items.PrivateItemPacket(Writer, reader.GetInt32(0), 8, 0,false);
                    Function.Items.PrivateItemPacket(Writer, reader.GetInt32(0), 5, 1,false);
                }
                //Jobtype information
                byte jobinfo = Convert.ToByte(DB.GetData("SELECT * FROM users WHERE id='"+ name +"'", "jobtype"));
                Writer.Byte(jobinfo);
            }
            ms.Close();

            return Writer.GetBytes();
        }
コード例 #12
0
 public static byte[] GuildStorageGold(WorldMgr.character c)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_GUILD_STORAGE_GOLD);
     Writer.LWord(c.Network.Guild.StorageGold);
     return Writer.GetBytes();
 }
コード例 #13
0
        public static void StallItemPacket(List<WorldMgr.stall.stallItem> ItemList, PacketWriter Writer)
        {
            for (byte i = 0; i < ItemList.Count; i++)
            {
                //Define item id
                int itemid = ItemList[i].Item.ID;
                //Temp disable mall type, todo : Enable PRE-Mall to sell in stalls.
                if (ObjData.Manager.ItemBase[itemid].Name.Contains("MALL")) return;

                PlayerMgr.LoadBluesid(ItemList[i].Item.dbID);

                Writer.Byte(ItemList[i].stallSlot);
                Writer.DWord(0);
                Writer.DWord(itemid);

                //Define what types of item we are adding to the stall
                if (ObjData.Manager.ItemBase[itemid].Type == ObjData.item_database.ArmorType.ARMOR ||
                    ObjData.Manager.ItemBase[itemid].Type == ObjData.item_database.ArmorType.GARMENT ||
                    ObjData.Manager.ItemBase[itemid].Type == ObjData.item_database.ArmorType.GM ||
                    ObjData.Manager.ItemBase[itemid].Type == ObjData.item_database.ArmorType.HEAVY ||
                    ObjData.Manager.ItemBase[itemid].Type == ObjData.item_database.ArmorType.LIGHT ||
                    ObjData.Manager.ItemBase[itemid].Type == ObjData.item_database.ArmorType.PROTECTOR ||
                    ObjData.Manager.ItemBase[itemid].Type == ObjData.item_database.ArmorType.ROBE ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EARRING ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.RING ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.NECKLACE ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.BLADE ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.BOW ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_AXE ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_CROSSBOW ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_DAGGER ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_DARKSTAFF ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_HARP ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_STAFF ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_SWORD ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_TSTAFF ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_TSWORD ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.GLAVIE ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.SPEAR ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.SWORD ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.CH_SHIELD ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.EU_SHIELD)
                {
                    Writer.Byte(ItemList[i].Item.PlusValue);
                        Writer.LWord(0);
                        Writer.DWord(ObjData.Manager.ItemBase[ItemList[i].Item.ID].Defans.Durability);
                        if (ObjData.Manager.ItemBlue[ItemList[i].Item.dbID].totalblue != 0)
                        {
                            Writer.Byte(Convert.ToByte(ObjData.Manager.ItemBlue[ItemList[i].Item.dbID].totalblue));
                            for (int a = 1; a <= ObjData.Manager.ItemBlue[ItemList[i].Item.dbID].totalblue; a++)
                            {
                                Writer.DWord(ObjData.Manager.MagicOptions.Find(mg => (mg.Name == Convert.ToString(ObjData.Manager.ItemBlue[ItemList[i].Item.dbID].blue[i]))).ID);
                                Writer.DWord(ObjData.Manager.ItemBlue[ItemList[i].Item.dbID].blueamount[i]);
                            }
                        }

                        else
                        {
                            Writer.Byte(0);
                        }
                        Writer.Word(1);
                        Writer.Word(2);
                        Writer.Word(3);
                }
                else if (ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.STONES)
                {
                    Writer.Word(ItemList[i].Item.Amount);
                    Writer.Byte(0);
                }
                else if (ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.MONSTERMASK)
                {
                    Writer.DWord(0);//Todo : Load monster mask monster model id here
                    return;
                }
                else if (ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.ELIXIR)
                {
                    Writer.Word(1);
                }
                    else if (ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.ARROW ||
                    ObjData.Manager.ItemBase[itemid].Itemtype == ObjData.item_database.ItemType.BOLT ||
                    ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.HP_POTION ||
                    ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.MP_POTION ||
                    ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.VIGOR_POTION ||
                    ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.SPEED_POTION ||
                    ObjData.Manager.ItemBase[itemid].Ticket == ObjData.item_database.Tickets.BEGINNER_HELPERS ||
                    ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.ELIXIR ||
                    ObjData.Manager.ItemBase[itemid].Etctype == ObjData.item_database.EtcType.ALCHEMY_MATERIAL ||
                    ObjData.Manager.ItemBase[itemid].TypeID2 == 3)
                {
                    Writer.Word(ItemList[i].Item.Amount);
                }
                Writer.Byte(ItemList[i].Item.Slot);
                Writer.Word(ItemList[i].Item.Amount);
                Writer.LWord(ItemList[i].price);
            }
            Writer.Byte(0xFF);
        }
コード例 #14
0
 public static byte[] StallModifyItem(byte stallSlot, ulong price)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_STALL_ACTION);
     Writer.Byte(1);
     Writer.Byte(1);
     Writer.Byte(stallSlot);
     Writer.Word(1);
     Writer.LWord(price);
     Writer.Word(0);
     return Writer.GetBytes();
 }
コード例 #15
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Update gold
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public static byte[] UpdateGold(long gold)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_UPDATEGOLD);
     Writer.Byte(1);
     Writer.LWord(gold);
     Writer.Byte(0);
     return Writer.GetBytes();
 }
コード例 #16
0
 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();
 }