LoadBluesid() public static method

public static LoadBluesid ( int idinfo ) : void
idinfo int
return void
Ejemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Create Item From Gm console
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] GM_MAKEITEM(byte type, byte Slot, int id, short plus, int durability, int itemid, int bluecount)
        {
            int msid = Systems.MsSQL.GetDataInt("SELECT id FROM char_items WHERE owner='" + id + "' AND slot = '" + Slot + "'", "id");

            Systems.LoadBluesid(msid);

            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ITEM_MOVE);
            Writer.Bool(true);
            Writer.Byte(6);
            Item.AddItemPacket(Writer, Slot, id, (byte)plus, plus, durability, itemid, msid, 0);
            return(Writer.GetBytes());
        }
Ejemplo n.º 2
0
        public static byte[] Exchange_ItemPacket(int id, List <Global.slotItem> Exhange, bool mine)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_EXCHANGE_ITEM);
            Writer.DWord(id);
            Writer.Byte(Exhange.Count);

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

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

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

                    else
                    {
                        Writer.Byte(0);
                    }
                    Writer.Word(1);
                    Writer.Word(2);
                    Writer.Word(3);
                }
                else if (Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.STONES)
                {
                    Writer.Word(Exhange[i].Amount);
                    Writer.Byte(0);
                }
                else if (Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.MONSTERMASK)
                {
                    Writer.DWord(0);
                }
                else if (Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.ELIXIR)
                {
                    Writer.Word(1);
                }
                else if (Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.ARROW ||
                         Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.BOLT ||
                         Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.HP_POTION ||
                         Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.MP_POTION ||
                         Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.VIGOR_POTION ||
                         Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.SPEED_POTION ||
                         Data.ItemBase[Exhange[i].ID].Ticket == Global.item_database.Tickets.BEGINNER_HELPERS ||
                         Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.ELIXIR ||
                         Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.ALCHEMY_MATERIAL ||
                         Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.EVENT ||
                         Data.ItemBase[Exhange[i].ID].Class_D == 3)
                {
                    Writer.Word(Exhange[i].Amount);
                }
            }
            return(Writer.GetBytes());
        }
Ejemplo n.º 3
0
        public static void StallItemPacket(List <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 (Data.ItemBase[itemid].Name.Contains("MALL"))
                {
                    return;
                }

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

                    else
                    {
                        Writer.Byte(0);
                    }
                    Writer.Word(1);
                    Writer.Word(2);
                    Writer.Word(3);
                }
                else if (Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.STONES)
                {
                    Writer.Word(ItemList[i].Item.Amount);
                    Writer.Byte(0);
                }
                else if (Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.MONSTERMASK)
                {
                    Writer.DWord(0);//Todo : Load monster mask monster model id here
                    return;
                }
                else if (Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.ELIXIR)
                {
                    Writer.Word(1);
                }
                else if (Data.ItemBase[itemid].Itemtype == Global.item_database.ItemType.ARROW ||
                         Data.ItemBase[itemid].Itemtype == Global.item_database.ItemType.BOLT ||
                         Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.HP_POTION ||
                         Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.MP_POTION ||
                         Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.VIGOR_POTION ||
                         Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.SPEED_POTION ||
                         Data.ItemBase[itemid].Ticket == Global.item_database.Tickets.BEGINNER_HELPERS ||
                         Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.ELIXIR ||
                         Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.ALCHEMY_MATERIAL ||
                         Data.ItemBase[itemid].Etctype == Global.item_database.EtcType.EVENT ||
                         Data.ItemBase[itemid].Class_D == 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);
        }
Ejemplo n.º 4
0
        public static void AddItemPacket(PacketWriter Writer, byte slot, int id, byte plus, short amount, int durability, int itemid, int bluecount, int modelid)
        {
            try
            {
                //Blues pre loading
                #region Load blues for items
                Systems.LoadBluesid(itemid);
                #endregion
                //Static information for packet
                #region Static packet info
                if (slot != 255)
                {
                    Writer.Byte(slot);              // slot
                }
                Writer.DWord(0);                    // sttaic 0
                Writer.DWord(id);                   // Item ID
                #endregion
                //Armor types and jewerly
                #region Armor related
                if (Data.ItemBase[id].Type == Global.item_database.ArmorType.ARMOR ||
                    Data.ItemBase[id].Type == Global.item_database.ArmorType.GARMENT ||
                    Data.ItemBase[id].Type == Global.item_database.ArmorType.GM ||
                    Data.ItemBase[id].Type == Global.item_database.ArmorType.HEAVY ||
                    Data.ItemBase[id].Type == Global.item_database.ArmorType.LIGHT ||
                    Data.ItemBase[id].Type == Global.item_database.ArmorType.PROTECTOR ||
                    Data.ItemBase[id].Type == Global.item_database.ArmorType.ROBE ||
                    Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EARRING ||
                    Data.ItemBase[id].Itemtype == Global.item_database.ItemType.RING ||
                    Data.ItemBase[id].Itemtype == Global.item_database.ItemType.NECKLACE)
                {
                    Writer.Byte(plus);
                    Writer.Byte(0);                 //Durability + %
                    Writer.Byte(0);                 //Item Phy/Mag reinforce value %
                    Writer.Byte(0);                 //Physical defense power %
                    Writer.Byte(0);                 //Magical defense power %
                    Writer.Byte(0);                 //Static byte ?
                    Writer.Byte(0);                 //Static byte ?
                    Writer.Byte(0);                 //Static byte ?
                    Writer.Byte(0);                 //Static byte ?
                    Writer.DWord(durability);       //Durability

                    if (bluecount != 0)
                    {
                        Writer.Byte(Convert.ToByte(Data.ItemBlue[itemid].totalblue));
                        for (int i = 0; i <= Data.ItemBlue[itemid].totalblue - 1; i++)
                        {
                            Writer.DWord(Data.MagicOptions.Find(mg => (mg.Name == Convert.ToString(Data.ItemBlue[itemid].blue[i]))).ID);
                            Writer.DWord(Data.ItemBlue[itemid].blueamount[i]);
                        }
                    }
                    else
                    {
                        Writer.Byte(0);
                    }

                    Writer.Byte(1);
                    Writer.Byte(0);
                    Writer.Byte(2);
                    Writer.Byte(0);
                    Writer.Byte(3);
                    Writer.Byte(0);
                    return;
                }
                #endregion
                //Weaponry (Weapons).
                #region Weapons
                else if (Data.ItemBase[id].Itemtype == Global.item_database.ItemType.BLADE ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.BOW ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_AXE ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_CROSSBOW ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_DAGGER ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_DARKSTAFF ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_HARP ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_STAFF ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_SWORD ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_TSTAFF ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_TSWORD ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.GLAVIE ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.SPEAR ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.SWORD)
                {
                    Writer.Byte(plus);              //Item Plus Value
                    Writer.Byte(0x64);              //Durability + %
                    Writer.Byte(0);                 //Item Phy/Mag reinforce value %
                    Writer.Byte(0);                 //Attack rating / blocking ratio
                    Writer.Byte(0);                 //Magical defense power %
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.DWord(durability);

                    if (bluecount != 0)
                    {
                        Writer.Byte(Convert.ToByte(Data.ItemBlue[itemid].totalblue));
                        for (int i = 0; i <= Data.ItemBlue[itemid].totalblue - 1; i++)
                        {
                            Writer.DWord(Data.MagicOptions.Find(mg => (mg.Name == Convert.ToString(Data.ItemBlue[itemid].blue[i]))).ID);
                            Writer.DWord(Data.ItemBlue[itemid].blueamount[i]);
                        }
                    }

                    else
                    {
                        Writer.Byte(0);
                    }
                    Writer.Byte(1);
                    Writer.Byte(0);
                    Writer.Byte(2);
                    Writer.Byte(0);
                    Writer.Byte(3);
                    Writer.Byte(0);
                    return;
                }
                #endregion
                //Shields
                #region Shields
                else if (Data.ItemBase[id].Itemtype == Global.item_database.ItemType.CH_SHIELD ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.EU_SHIELD)
                {
                    Writer.Byte(plus);              //Item Plus Value
                    Writer.Byte(0);                 //Durability + %
                    Writer.Byte(0);                 //Item Phy/Mag reinforce value %
                    Writer.Byte(9);                 //blocking ratio
                    Writer.Byte(0);                 //Magical defense power %
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.DWord(durability);       //Durability

                    if (bluecount != 0)
                    {
                        Writer.Byte(Convert.ToByte(Data.ItemBlue[itemid].totalblue));
                        for (int i = 0; i <= Data.ItemBlue[itemid].totalblue - 1; i++)
                        {
                            Writer.DWord(Data.MagicOptions.Find(mg => (mg.Name == Convert.ToString(Data.ItemBlue[itemid].blue[i]))).ID);
                            Writer.DWord(Data.ItemBlue[itemid].blueamount[i]);
                        }
                    }

                    else
                    {
                        Writer.Byte(0);
                    }
                    Writer.Byte(1);
                    Writer.Byte(0);
                    Writer.Byte(2);
                    Writer.Byte(0);
                    Writer.Byte(3);
                    Writer.Byte(0);
                    return;
                }
                #endregion
                //Avatars
                #region Avatars
                else if (Data.ItemBase[id].Type == Global.item_database.ArmorType.AVATAR ||
                         Data.ItemBase[id].Type == Global.item_database.ArmorType.AVATARATTACH ||
                         Data.ItemBase[id].Type == Global.item_database.ArmorType.AVATARHAT)
                {
                    Writer.Byte(plus);              //Item Plus Value
                    Writer.Byte(0);                 //Item Magical Reinforce value
                    Writer.Byte(0);                 //Item Phy reinforce value
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Word(0);
                    Writer.Word(0);
                    Writer.DWord(durability);       //Item Durability
                    Writer.Byte(0);
                    Writer.Word(1);
                    Writer.Word(2);
                    Writer.Word(3);
                    return;
                }
                #endregion
                //Grabpets
                #region Grabpets
                else if (Data.ItemBase[id].Pettype == Global.item_database.PetType.GRABPET)
                {
                    Writer.Byte(0);           // State :0 = Not opened yet, 1 =  , 3 = Expired
                    Writer.DWord(0x00002432); //Time date probably
                    Writer.Word(0);
                    Writer.DWord(1);
                    Writer.Byte(0);
                    return;
                }
                #endregion
                //Attack pets
                #region Attackpets
                else if (Data.ItemBase[id].Pettype == Global.item_database.PetType.ATTACKPET)
                {
                    Writer.Byte(0);             //
                    Writer.Byte(2);             //
                    Writer.Byte(24);            // Level
                    Writer.Word(0);             //
                    Writer.Word(0);             //Petname
                    Writer.Byte(0);
                    return;
                }
                #endregion
                //Normal stones
                #region Stones
                else if (Data.ItemBase[id].Etctype == Global.item_database.EtcType.STONES)
                {
                    Writer.Word(amount);
                    Writer.Byte(0);//Assumability %
                    return;
                }
                #endregion
                //Monster masks
                #region Monster masks
                else if (Data.ItemBase[id].Etctype == Global.item_database.EtcType.MONSTERMASK)
                {
                    Writer.DWord(modelid);
                    return;
                }
                #endregion
                //Stall decoration
                #region  Stall decoration
                else if (Data.ItemBase[id].Etctype == Global.item_database.EtcType.STALLDECORATION)
                {
                    Writer.Byte(0);
                    Writer.Word(1);
                    return;
                }
                #endregion
                //Elixirs
                #region Elixirs
                else if (Data.ItemBase[id].Etctype == Global.item_database.EtcType.ELIXIR)
                {
                    Writer.Word(1);
                    return;
                }
                #endregion
                //Other items (To filter later).
                #region Other items
                //Need to add more and add more on fileload
                else if (Data.ItemBase[id].Itemtype == Global.item_database.ItemType.ARROW ||
                         Data.ItemBase[id].Itemtype == Global.item_database.ItemType.BOLT ||
                         Data.ItemBase[id].Etctype == Global.item_database.EtcType.HP_POTION ||
                         Data.ItemBase[id].Etctype == Global.item_database.EtcType.MP_POTION ||
                         Data.ItemBase[id].Etctype == Global.item_database.EtcType.VIGOR_POTION ||
                         Data.ItemBase[id].Etctype == Global.item_database.EtcType.SPEED_POTION ||
                         Data.ItemBase[id].Ticket == Global.item_database.Tickets.BEGINNER_HELPERS ||
                         Data.ItemBase[id].Etctype == Global.item_database.EtcType.ELIXIR ||
                         Data.ItemBase[id].Etctype == Global.item_database.EtcType.ALCHEMY_MATERIAL ||
                         Data.ItemBase[id].Etctype == Global.item_database.EtcType.EVENT ||
                         Data.ItemBase[id].Class_D == 3)
                {
                    Writer.Word(amount);
                    return;
                }
                else
                {
                    Writer.Byte(0);
                    Writer.Word(1);
                    return;
                }
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine("Load item error: {0}", ex);
            }
        }