예제 #1
0
        /////////////////////////////////////////////////////////////////////////////////
        // Move item to exchange slot (Will come when fixing exchange system).
        /////////////////////////////////////////////////////////////////////////////////
        void ItemMoveToExhangePage(byte f_slot)
        {
            #region Move to exchange
            try
            {
                PlayerMgr sys = Helpers.GetInformation.GetPlayer(Character.Network.TargetID);
                if (Character.Network.Exchange.ItemList.Count < 12 && sys.GetFreeSlotMax() > (byte)Character.Network.Exchange.ItemList.Count)
                {
                    ObjData.slotItem newitem = GetItem((uint)Character.Information.CharacterID, f_slot, 0);

                    LoadBluesid(newitem.dbID);
                    if (newitem.Amount <= ObjData.Manager.ItemBase[newitem.ID].Max_Stack)
                    {
                        Character.Network.Exchange.ItemList.Add(newitem);

                        client.Send(Packet.Exchange_ItemPacket(Character.Information.UniqueID, Character.Network.Exchange.ItemList, true));
                        sys.Send(Packet.Exchange_ItemPacket(sys.Character.Information.UniqueID, sys.Character.Network.Exchange.ItemList, true));

                        client.Send(Packet.Exchange_ItemSlot(4, f_slot));
                        sys.Send(Packet.Exchange_ItemSlot(4, f_slot));
                    }
                    else
                    {
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception("Exchange add item error: ", ex);
            }
            #endregion
        }
 /////////////////////////////////////////////////////////////////////////////////
 // Get degree information
 /////////////////////////////////////////////////////////////////////////////////
 public int GetItemDegree(ObjData.slotItem item)
 {
     try
     {
         if (1 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 8)
         {
             return(1);
         }
         else if (8 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 16)
         {
             return(2);
         }
         else if (16 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 24)
         {
             return(3);
         }
         else if (24 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 32)
         {
             return(4);
         }
         else if (32 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 42)
         {
             return(5);
         }
         else if (42 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 52)
         {
             return(6);
         }
         else if (52 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 64)
         {
             return(7);
         }
         else if (64 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 76)
         {
             return(8);
         }
         else if (76 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 90)
         {
             return(9);
         }
         else if (90 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 101)
         {
             return(10);
         }
         else if (101 <= ObjData.Manager.ItemBase[item.ID].Level && ObjData.Manager.ItemBase[item.ID].Level < 110)
         {
             return(11);
         }
         else
         {
             return(1);
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
     return(1);
 }
예제 #3
0
        /////////////////////////////////////////////////////////////////////////////////
        // Move from exchange to inventory (Will come when fixing exchange system).
        /////////////////////////////////////////////////////////////////////////////////
        void ItemMoveExchangeToInv(byte f_slot)
        {
            #region From exchange to inventory
            ObjData.slotItem wannadeleteitem = Character.Network.Exchange.ItemList[f_slot];
            Character.Network.Exchange.ItemList.Remove(wannadeleteitem);

            client.Send(Packet.Exchange_ItemPacket(Character.Information.UniqueID, Character.Network.Exchange.ItemList, true));
            client.Send(Packet.Exchange_ItemSlot(5, f_slot));
            #endregion
        }
예제 #4
0
        /////////////////////////////////////////////////////////////////////////////////
        // Convert to item
        /////////////////////////////////////////////////////////////////////////////////
        ObjData.slotItem ConvertToItem(int id, byte slots, short amount, byte index)
        {
            #region Arrow convert info
            ObjData.slotItem slot = new ObjData.slotItem();
            slot.ID     = id;
            slot.Slot   = slots;
            slot.Amount = amount;
            return(slot);

            #endregion
        }
예제 #5
0
 /////////////////////////////////////////////////////////////////////////////////
 // Move From Storage To Inventory
 /////////////////////////////////////////////////////////////////////////////////
 void Player_MoveStorageItemToInv(byte f_slot, byte t_slot, int o_id)
 {
     #region Move from storage to inv
     try
     {
         //Check if the user isnt in any state/action that we will not allow.
         if (!Character.State.Die || !Character.Stall.Stallactive || !Character.Alchemy.working || !Character.Position.Walking)
         {
             //Normal storage
             if (!Character.Network.Guild.UsingStorage)
             {
                 //Get free slots of player inventory
                 byte freeslot = GetFreeSlot();
                 //Get item information the one that user selected to move.
                 ObjData.slotItem item = GetItem((uint)Player.ID, f_slot, 1);
                 //Cannot drag and drop onto equip slots.
                 if (t_slot < 13)
                 {
                     return;
                 }
                 //Update database information
                 DB.query("UPDATE char_items SET itemnumber='item" + t_slot + "',slot='" + t_slot + "',storagetype='0', owner=" + Character.Information.CharacterID + " WHERE storageacc='" + Player.ID + "' AND id='" + item.dbID + "'");
                 //Send visual packet
                 client.Send(Packet.MoveItem(3, f_slot, t_slot, 0, 0, "MOVE_FROM_STORAGE"));
             }
             //Guild storage
             else
             {
                 //Get free slots of player inventory
                 byte freeslot = GetFreeSlot();
                 //Get item information the one that user selected to move.
                 ObjData.slotItem item = GetItem((uint)Player.ID, f_slot, 3);
                 //Cannot drag and drop onto equip slots.
                 if (t_slot < 13)
                 {
                     return;
                 }
                 //Update database information
                 DB.query("UPDATE char_items SET itemnumber='item" + t_slot + "',slot='" + t_slot + "',storagetype='0', owner=" + Character.Information.CharacterID + " WHERE guild_storage_id='" + Character.Network.Guild.Guildid + "' AND id='" + item.dbID + "'");
                 //Send visual packet
                 client.Send(Packet.MoveItem(3, f_slot, t_slot, 0, 0, "MOVE_FROM_GUILD_STORAGE"));
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Move item from storage error: {0}", ex);
         Log.Exception(ex);
     }
     //Save player information
     SavePlayerInfo();
     #endregion
 }
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Update Player Slot / Do not remove item
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void HandleUpdateSlotn(byte slot, ObjData.slotItem item, int packet)
 {
     try
     {
         client.Send(Packet.Player_HandleUpdateSlot(slot, (ushort)item.Amount, packet));
         Send(Packet.Player_HandleEffect(Character.Information.UniqueID, item.ID));
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
 ///////////////////////////////////////////////////////////////////////////
 // Move item from pet
 ///////////////////////////////////////////////////////////////////////////
 void MoveItemFromPet(int itemid, byte f_slot, byte t_slot)
 {
     try
     {
         ObjData.slotItem item = GetItem((uint)Character.Information.CharacterID, f_slot, 2);
         DB.query("UPDATE char_items SET itemnumber='item" + t_slot + "',slot='" + t_slot + "',storagetype='0',pet_storage_id='0' WHERE owner='" + Character.Information.CharacterID + "' AND id='" + item.dbID + "'");
         client.Send(Packet.MoveItemPet(itemid, f_slot, t_slot, Character.Grabpet.Details, 0, "MOVE_FROM_PET"));
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
예제 #8
0
        /////////////////////////////////////////////////////////////////////////////////
        // Get Slot Item Information
        /////////////////////////////////////////////////////////////////////////////////
        static ObjData.slotItem GetItem(uint id, byte slot, int type)
        {
            #region Slot item info

            try
            {
                if (id != 0)
                {
                    ObjData.slotItem slotItem = new ObjData.slotItem();
                    int row = type;

                    DB ms;
                    if (row == 1)
                    {
                        ms = new DB("SELECT * FROM char_items WHERE itemnumber='item" + slot + "' AND storageacc='" + id + "' AND storagetype='" + row + "' AND slot='" + slot + "'");
                    }
                    else if (row == 3)
                    {
                        ms = new DB("SELECT * FROM char_items WHERE itemnumber='item" + slot + "' AND storagetype='" + row + "' AND slot='" + slot + "'");
                    }
                    else
                    {
                        ms = new DB("SELECT * FROM char_items WHERE itemnumber='item" + slot + "' AND owner='" + id + "' AND storagetype='" + row + "' AND slot='" + slot + "'");
                    }

                    using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
                    {
                        while (reader.Read())
                        {
                            slotItem.dbID       = reader.GetInt32(0);
                            slotItem.ID         = reader.GetInt32(2);
                            slotItem.PlusValue  = reader.GetByte(4);
                            slotItem.Amount     = reader.GetInt16(6);
                            slotItem.Durability = reader.GetInt32(7);
                            slotItem.Slot       = slot;
                            LoadBluesid(slotItem.dbID);
                        }
                    }
                    ms.Close();
                    return(slotItem);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            return(null);

            #endregion
        }
예제 #9
0
 /////////////////////////////////////////////////////////////////////////////////
 // Update Item Count
 /////////////////////////////////////////////////////////////////////////////////
 void ItemUpdateAmount(ObjData.slotItem sItem, int owner)
 {
     #region Item Update Amount
     if (sItem.Amount <= 0)
     {
         DB.query("delete from char_items where slot='" + sItem.Slot + "' AND owner='" + owner + "'");
     }
     else
     {
         DB.query("UPDATE char_items SET quantity='" + Math.Abs(sItem.Amount) + "' WHERE slot='" + sItem.Slot + "' AND owner='" + owner + "'");
     }
     client.Send(Packet.ItemUpdate_Quantity(sItem.Slot, sItem.Amount));
     #endregion
 }
예제 #10
0
        /////////////////////////////////////////////////////////////////////////////////
        // Check Armor Type
        /////////////////////////////////////////////////////////////////////////////////
        public static bool CheckArmorType(int FromItemID, int uid)
        {
            #region Armor Type

            ObjData.item_database.ArmorType[] SameType = new ObjData.item_database.ArmorType[6];
            for (byte i = 0; i <= 5; i++)
            {
                ObjData.slotItem env = GetItem((uint)uid, i, 0);
                if (env.ID != 0)
                {
                    SameType[i] = ObjData.Manager.ItemBase[env.ID].Type;
                }
            }
            if (SameType != null)
            {
                if ((ObjData.Manager.ItemBase[FromItemID].Type == ObjData.item_database.ArmorType.ARMOR && SameType.Count(st => (st == ObjData.item_database.ArmorType.GARMENT)) > 0))
                {
                    return(false);
                }
                else if (ObjData.Manager.ItemBase[FromItemID].Type == ObjData.item_database.ArmorType.PROTECTOR && SameType.Count(st => (st == ObjData.item_database.ArmorType.GARMENT)) > 0)
                {
                    return(false);
                }
                else if (ObjData.Manager.ItemBase[FromItemID].Type == ObjData.item_database.ArmorType.HEAVY && SameType.Count(st => (st == ObjData.item_database.ArmorType.ROBE)) > 0)
                {
                    return(false);
                }
                else if (ObjData.Manager.ItemBase[FromItemID].Type == ObjData.item_database.ArmorType.LIGHT && SameType.Count(st => (st == ObjData.item_database.ArmorType.ROBE)) > 0)
                {
                    return(false);
                }
                else if (ObjData.Manager.ItemBase[FromItemID].Type == ObjData.item_database.ArmorType.GARMENT && ((SameType.Count(st => (st == ObjData.item_database.ArmorType.ARMOR)) > 0) || (SameType.Count(st => (st == ObjData.item_database.ArmorType.PROTECTOR)) > 0)))
                {
                    return(false);
                }
                else if (ObjData.Manager.ItemBase[FromItemID].Type == ObjData.item_database.ArmorType.ROBE && ((SameType.Count(st => (st == ObjData.item_database.ArmorType.HEAVY)) > 0) || (SameType.Count(st => (st == ObjData.item_database.ArmorType.LIGHT)) > 0)))
                {
                    return(false);
                }
                return(true);
            }
            return(true);

            #endregion
        }
예제 #11
0
        /////////////////////////////////////////////////////////////////////////////////
        // Arrow Item Check
        /////////////////////////////////////////////////////////////////////////////////
        bool ItemCheckArrow()
        {
            #region Check Arrow
            DB ms = new DB("SELECT * FROM char_items WHERE owner='" + Character.Information.CharacterID + "' AND slot >= '13' AND slot <= '" + Character.Information.Slots + "' AND inavatar='0' AND itemid='62' AND storagetype='0'");
            if (ms.Count() == 0)
            {
                ms = new DB("SELECT * FROM char_items WHERE owner='" + Character.Information.CharacterID + "' AND slot >= '13' AND slot <= '" + Character.Information.Slots + "' AND inavatar='0' AND itemid='3823' AND storagetype='0'");
            }
            else if (ms.Count() == 0)
            {
                ms = new DB("SELECT * FROM char_items WHERE owner='" + Character.Information.CharacterID + "' AND slot >= '13' AND slot <= '" + Character.Information.Slots + "' AND inavatar='0' AND itemid='10302' AND storagetype='0'");
            }
            else if (ms.Count() == 0)
            {
                ms = new DB("SELECT * FROM char_items WHERE owner='" + Character.Information.CharacterID + "' AND slot >= '13' AND slot <= '" + Character.Information.Slots + "' AND inavatar='0' AND itemid='10487' AND storagetype='0'");
            }
            if (ms.Count() == 0)
            {
                return(false);
            }
            else
            {
                ObjData.slotItem items = null;
                using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
                {
                    while (reader.Read())
                    {
                        items = ConvertToItem(reader.GetInt32(2), reader.GetByte(5), reader.GetInt16(6), 1);
                    }
                }
                ms.Close();
                DB.query("UPDATE char_items SET itemnumber='item" + 7 + "',slot='" + 7 + "' WHERE itemnumber='" + "item" + items.Slot + "' AND owner='" + Character.Information.CharacterID + "' AND itemid='" + items.ID + "'");
                client.Send(Packet.MoveItem(0, items.Slot, 7, items.Amount, 0, "MOVE_INSIDE_INVENTORY"));

                Character.Information.Item.sAmount = items.Amount;
                Character.Information.Item.sID     = items.ID;
                ;
                return(true);
            }
            #endregion
        }
예제 #12
0
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Monster Masks Base
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void MonsterMasks(int itemid, byte slot)
 {
     try
     {
         //Load Mask Info
         ObjData.slotItem item = GetItem((uint)Character.Information.CharacterID, slot, 0);
         int skillid           = 7126;
         SpecialBuff(skillid);
         //Load Model Info From Database
         int modelid = Convert.ToInt32(DB.GetData("SELECT modelid FROM char_items WHERE slot='" + slot + "' AND owner='" + Character.Information.CharacterID + "'", "modelid"));
         //Create send to list
         List <int> To = Character.Spawn;
         //Transform the player
         Send(To, Packet.Transform(modelid, Character.Information.UniqueID));
     }
     catch (Exception ex)
     {
         Console.WriteLine("Monster Mask Usage error : {0}", ex);
         Log.Exception(ex);
     }
 }
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Update Player Slot / Remove item
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void HandleUpdateSlot(byte slot, ObjData.slotItem item, int packet)
 {
     try
     {
         item.Amount--;
         client.Send(Packet.Player_HandleUpdateSlot(slot, (ushort)item.Amount, packet));
         if (item.Amount > 0)
         {
             DB.query("UPDATE char_items SET quantity='" + Math.Abs(item.Amount) + "' WHERE owner='" + Character.Information.CharacterID + "' AND itemnumber='item" + item.Slot + "' AND id='" + item.dbID + "'");
         }
         else
         {
             DB.query("delete from char_items where id='" + item.dbID + "'");
         }
         //Need to be defined per item type (potion or private item)
         Send(Packet.Player_HandleEffect(Character.Information.UniqueID, item.ID));
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
        ///////////////////////////////////////////////////////////////////////////
        // Move inside pet
        ///////////////////////////////////////////////////////////////////////////
        void MovePetToPet(int itemid, byte f_slot, byte t_slot, short info)
        {
            try
            {
                ObjData.slotItem itemfrom = GetItem((uint)Character.Information.CharacterID, f_slot, 2);
                ObjData.slotItem itemto   = GetItem((uint)Character.Information.CharacterID, t_slot, 2);

                if (itemto.ID != 0)
                {
                    DB.query("UPDATE char_items SET itemnumber='item" + t_slot + "',slot='" + t_slot + "' WHERE id='" + itemfrom.dbID + "' AND owner='" + Character.Information.CharacterID + "' AND pet_storage_id='" + Character.Grabpet.Grabpetid + "'");
                    DB.query("UPDATE char_items SET itemnumber='item" + f_slot + "',slot='" + f_slot + "' WHERE id='" + itemto.dbID + "' AND owner='" + Character.Information.CharacterID + "' AND pet_storage_id='" + Character.Grabpet.Grabpetid + "'");
                }
                else
                {
                    DB.query("UPDATE char_items SET itemnumber='item" + t_slot + "',slot='" + t_slot + "' WHERE id='" + itemfrom.dbID + "' AND owner='" + Character.Information.CharacterID + "' AND pet_storage_id='" + Character.Grabpet.Grabpetid + "'");
                }
                client.Send(Packet.MoveItemPet(itemid, t_slot, f_slot, Character.Grabpet.Details, info, "MOVE_INSIDE_PET"));
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
        /////////////////////////////////////////////////////////////////////////////////
        // Create stones
        /////////////////////////////////////////////////////////////////////////////////
        public void AlchemyCreateStone()
        {
            try
            {
                //Open packet reader
                PacketReader reader       = new PacketReader(PacketInformation.buffer);
                byte         type         = reader.Byte();
                byte         type1        = reader.Byte();
                byte         type2        = reader.Byte();
                byte         tabletslot   = reader.Byte();
                byte         elementslot1 = reader.Byte();
                byte         elementslot2 = reader.Byte();
                byte         elementslot3 = reader.Byte();
                byte         elementslot4 = reader.Byte();
                reader.Close();

                //Tablet information
                ObjData.slotItem tabletslotitem = GetItem((uint)Character.Information.CharacterID, tabletslot, 0);

                //Get stone information equaly to the tablet
                int stone = GetStoneFromTablet(tabletslotitem.ID);

                //Earth element information
                ObjData.slotItem element1slotitem = GetItem((uint)Character.Information.CharacterID, elementslot1, 0);
                //Water element information
                ObjData.slotItem element2slotitem = GetItem((uint)Character.Information.CharacterID, elementslot2, 0);
                //Fire element information
                ObjData.slotItem element3slotitem = GetItem((uint)Character.Information.CharacterID, elementslot3, 0);
                //Wind element information
                ObjData.slotItem element4slotitem = GetItem((uint)Character.Information.CharacterID, elementslot4, 0);

                //Check if the requirements are ok (Extra check amount).
                if (element1slotitem.Amount < ObjData.Manager.ItemBase[tabletslotitem.ID].EARTH_ELEMENTS_AMOUNT_REQ)
                {
                    return;
                }
                if (element2slotitem.Amount < ObjData.Manager.ItemBase[tabletslotitem.ID].WATER_ELEMENTS_AMOUNT_REQ)
                {
                    return;
                }
                if (element3slotitem.Amount < ObjData.Manager.ItemBase[tabletslotitem.ID].FIRE_ELEMENTS_AMOUNT_REQ)
                {
                    return;
                }
                if (element2slotitem.Amount < ObjData.Manager.ItemBase[tabletslotitem.ID].WIND_ELEMENTS_AMOUNT_REQ)
                {
                    return;
                }

                //Check if the requirements are ok (Extra check element name).
                if (ObjData.Manager.ItemBase[element1slotitem.ID].Name != ObjData.Manager.ItemBase[tabletslotitem.ID].EARTH_ELEMENTS_NAME)
                {
                    return;
                }
                if (ObjData.Manager.ItemBase[element2slotitem.ID].Name != ObjData.Manager.ItemBase[tabletslotitem.ID].WATER_ELEMENTS_NAME)
                {
                    return;
                }
                if (ObjData.Manager.ItemBase[element3slotitem.ID].Name != ObjData.Manager.ItemBase[tabletslotitem.ID].FIRE_ELEMENTS_NAME)
                {
                    return;
                }
                if (ObjData.Manager.ItemBase[element4slotitem.ID].Name != ObjData.Manager.ItemBase[tabletslotitem.ID].WIND_ELEMENTS_NAME)
                {
                    return;
                }

                //Update amount of elements
                element1slotitem.Amount -= (short)ObjData.Manager.ItemBase[tabletslotitem.ID].EARTH_ELEMENTS_AMOUNT_REQ;
                element2slotitem.Amount -= (short)ObjData.Manager.ItemBase[tabletslotitem.ID].WATER_ELEMENTS_AMOUNT_REQ;
                element3slotitem.Amount -= (short)ObjData.Manager.ItemBase[tabletslotitem.ID].FIRE_ELEMENTS_AMOUNT_REQ;
                element4slotitem.Amount -= (short)ObjData.Manager.ItemBase[tabletslotitem.ID].WIND_ELEMENTS_AMOUNT_REQ;

                ItemUpdateAmount(element1slotitem, Character.Information.CharacterID);
                ItemUpdateAmount(element2slotitem, Character.Information.CharacterID);
                ItemUpdateAmount(element3slotitem, Character.Information.CharacterID);
                ItemUpdateAmount(element4slotitem, Character.Information.CharacterID);

                //Update amount of tablet
                tabletslotitem.Amount -= 1;
                ItemUpdateAmount(tabletslotitem, Character.Information.CharacterID);

                //Send alchemy packet
                client.Send(Packet.StoneCreation(tabletslot));

                //Check for new free slots in inventory
                byte freeslot = GetFreeSlot();
                //Update database and insert new item
                AddItem(stone, 1, freeslot, Character.Information.CharacterID, 0);
                //Send visual packet add stone (creation works, just need to check why it sends 2x same packet).
                client.Send(Packet.GainElements(freeslot, stone, 1));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Stone creation error {0}", ex);
                Log.Exception(ex);
            }
        }
        public void Handle()
        {
            try
            {
                //Read packet information
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                byte         iSlot  = Reader.Byte();
                //Get global item information
                ObjData.slotItem uItemID = GetItem((uint)Character.Information.CharacterID, iSlot, 0);
                //Checks before continuing
                if (uItemID.ID != 0 || !Character.State.Die)
                {
                    //###########################################################################################
                    // Grabpets
                    //###########################################################################################
                    #region Pets (PET OBJECTS)

                    // Grabpets
                    #region Grabpets
                    if (ObjData.Manager.ItemBase[uItemID.ID].Pettype == ObjData.item_database.PetType.GRABPET)
                    {
                        //Check if we have pet active allready.
                        if (!Character.Grabpet.Active && Character.Action.MonsterID.Count == 0)
                        {
                            //If not active , add new pet object.
                            HandleGrabPet(iSlot, uItemID.ID);
                            //Need to change this to active effect on slot.
                            HandleUpdateSlotn(iSlot, uItemID, Reader.Int32());
                        }
                    }
                    #endregion
                    // Attackpets
                    #region Attackpets
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Pettype == ObjData.item_database.PetType.ATTACKPET)
                    {
                        //Check if we have pet active allready.
                        if (!Character.Attackpet.Active && Character.Action.MonsterID.Count == 0 || !Character.Attackpet.Active && Character.Action.MonsterID == null)
                        {
                            //If not active , add new pet object.
                            if (!Character.Attackpet.Active)
                            {
                                HandleUpdateSlotn(iSlot, uItemID, Reader.Int32());
                                HandleAttackPet(iSlot, uItemID.ID);
                                client.Send(Packet.Update2(iSlot));
                                client.Send(Packet.ChangeStatus(Character.Information.UniqueID, 5, 0));
                            }
                        }
                    }
                    #endregion
                    #endregion
                    // Horses (NOTE: Detail error messages per if statement (if level, summoned etc).
                    #region Horses
                    if (ObjData.Manager.ItemBase[uItemID.ID].Pettype == ObjData.item_database.PetType.TRANSPORT)
                    {
                        //Checks before we continue
                        if (!Character.Stall.Stallactive && !Character.Transport.Right && Character.Action.MonsterID.Count == 0 && !Character.State.Sitting && !Character.Information.Scroll)
                        {
                            //Check if level is high enough
                            if (Character.Information.Level >= ObjData.Manager.ItemBase[uItemID.ID].Level)
                            {
                                HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                                HandleHorseScroll(uItemID.ID);
                            }
                            //Else
                            else
                            {
                                client.Send(Packet.Message(OperationCode.SERVER_PLAYER_UPTOHORSE, Messages.UIIT_MSG_COSPETERR_CANT_PETSUM_HIGHLEVEL));
                            }
                        }
                    }
                    #endregion
                    // Special transport
                    #region Special transport
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Pettype == ObjData.item_database.PetType.ATTACKPET)
                    {
                    }
                    #endregion
                    // Job Transport
                    #region Job Transport
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Pettype == ObjData.item_database.PetType.JOBTRANSPORT)
                    {
                        //HandleJobTransport(uItemID.ID);
                    }
                    #endregion
                    //###########################################################################################
                    // Potions
                    //###########################################################################################
                    #region Potions
                    #region HP potion
                    if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.HP_POTION && ObjData.Manager.ItemBase[uItemID.ID].Etctype != ObjData.item_database.EtcType.HPSTATPOTION)
                    {
                        HandlePotion(1, uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    #region HP STAT Potions
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype != ObjData.item_database.EtcType.HP_POTION && ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.HPSTATPOTION)
                    {
                    }
                    #endregion
                    #region MP potions
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.MP_POTION && ObjData.Manager.ItemBase[uItemID.ID].Etctype != ObjData.item_database.EtcType.MPSTATPOTION)
                    {
                        HandlePotion(2, uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    #region HP STAT Potions
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype != ObjData.item_database.EtcType.HP_POTION && ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.MPSTATPOTION)
                    {
                    }
                    #endregion
                    #region Vigor potions
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.VIGOR_POTION)
                    {
                        HandlePotion(5, uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    #region Speed potions
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.SPEED_POTION)
                    {
                        if (SkillGetSameBuff(ObjData.Manager.ItemBase[uItemID.ID].SkillID))
                        {
                            SpecialBuff(ObjData.Manager.ItemBase[uItemID.ID].SkillID);
                            HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                        }
                    }
                    #endregion
                    #region Berserk Potion
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.BERSERKPOTION)
                    {
                        if (Character.Information.BerserkBar < 5)
                        {
                            if (Character.Information.Berserking == false)
                            {
                                Character.Information.BerserkBar = 5;
                                client.Send(Packet.InfoUpdate(4, 0, Character.Information.BerserkBar));
                                HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                            }
                        }
                    }
                    #endregion
                    #endregion
                    //###########################################################################################
                    // Tickets
                    //###########################################################################################
                    #region Tickets
                    //Forgotten world
                    #region Forgotten world
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Ticket == ObjData.item_database.Tickets.DUNGEON_FORGOTTEN_WORLD)
                    {
                        //Must add check if user location currently is forgotten world.
                        //Must add level check of portal.
                        ForgottenWorld(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    #endregion
                    //###########################################################################################
                    // Global chat
                    //###########################################################################################
                    #region Global Chat
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.GLOBALCHAT)
                    {
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                        byte   something = Reader.Byte();
                        string text      = Reader.Text3();
                        Reader.Close();
                        Helpers.SendToClient.SendAll(Packet.ChatPacket(6, 0, text, Character.Information.Name));
                    }
                    #endregion
                    //###########################################################################################
                    // Stall decoration
                    //###########################################################################################
                    #region Stall decoration
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.STALLDECORATION)
                    {
                        StallDeco(uItemID.ID, iSlot);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Monster masks
                    //###########################################################################################
                    #region Monster masks
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.MONSTERMASK)
                    {
                        //If character monster mask isnt enabled allready.
                        if (!Character.Transformed)
                        {
                            if (Character.Information.Level >= ObjData.Manager.ItemBase[uItemID.ID].Level)
                            {
                                //Load Mask
                                MonsterMasks(uItemID.ID, iSlot);
                                HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                            }
                            else
                            {
                                //Send msg level to low
                            }
                        }
                        else
                        {
                            //Send msg allready in use
                        }
                    }
                    #endregion
                    //###########################################################################################
                    // Return scrolls
                    //###########################################################################################
                    #region Return scrolls
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.RETURNSCROLL && ObjData.Manager.ItemBase[uItemID.ID].Etctype != ObjData.item_database.EtcType.REVERSESCROLL)
                    {
                        if (Character.Information.Scroll)
                        {
                            return;
                        }
                        if (Timer.Movement != null)
                        {
                            Timer.Movement.Dispose();
                            Character.Position.Walking = false;
                        }
                        HandleReturnScroll(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Reverse scrolls
                    //###########################################################################################
                    #region Reverse scrolls
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.REVERSESCROLL)
                    {
                        if (Character.Information.Scroll)
                        {
                            return;
                        }
                        if (Character.Position.Walking)
                        {
                            return;
                        }
                        //Read item id
                        int itemid = Reader.Int32();
                        //Our switch byte
                        byte type = Reader.Byte();
                        //locations for reverse
                        int locid = 0;
                        if (type == 7)
                        {
                            locid = Reader.Int32();
                        }
                        //Start our handle
                        HandleReverse(itemid, type, locid);
                        //Update slot
                        HandleUpdateSlot(iSlot, uItemID, itemid);
                    }
                    #endregion
                    //###########################################################################################
                    // Thief scrolls
                    //###########################################################################################
                    #region Thief scrolls
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.BANDITSCROLL)
                    {
                        if (Character.Information.Scroll)
                        {
                            return;
                        }
                        HandleThiefScroll(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Summon scrolls
                    //###########################################################################################
                    #region Summon scrolls
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.SUMMONSCROLL)
                    {
                        HandleSummon(Character.Information.Level);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Skin change scrolls
                    //###########################################################################################
                    #region Skin change scrolls
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.CHANGESKIN)
                    {
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                        int skinmodel = Reader.Int32();
                        HandleSkinScroll(skinmodel, uItemID.ID);
                    }
                    #endregion
                    #region Repair Items
                    //if (!Character.Action.repair)
                    //{
                    //    Character.Action.repair = true;
                    //    RepairTimer(30000);
                    //    //Check if there are any items that need repair
                    //    double durability = ObjData.Manager.ItemBase[uItemID.ID].Defans.Durability;
                    //    double currentdurability = ObjData.Manager.ItemBase[uItemID.dbID].Defans.Durability;


                    //    if (currentdurability < durability)
                    //    {
                    //        int countrepairs = DB.GetRowsCount("SELECT * FROM char_items WHERE owner='" + Character.Information.CharacterID + "'");
                    //        if (countrepairs == 0)
                    //        {
                    //            //Do nothing client sends message automaticly
                    //        }
                    //        else
                    //        {
                    //            //Start repairing call handle
                    //            HandleRepair(iSlot, uItemID.dbID);
                    //            HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    //        }
                    //    }
                    //}
                    #endregion
                    #region Item change tool
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.ITEMCHANGETOOL)
                    {
                        int  itemid     = Reader.Int32();
                        byte targetslot = Reader.Byte();
                        //Make sure the item target is not equiped.
                        if (targetslot < 13)
                        {
                            return;
                        }
                        //Continue
                        HandleUpdateSlot(iSlot, uItemID, itemid);
                        HandleItemChange(uItemID.ID, iSlot, targetslot);
                    }
                    #endregion
                    //###########################################################################################
                    // Dungeon items
                    //###########################################################################################
                    #region Forgotten world
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Ticket == ObjData.item_database.Tickets.DUNGEON_FORGOTTEN_WORLD)
                    {
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                        ForgottenWorld(uItemID.ID);
                    }
                    #endregion
                    //###########################################################################################
                    // Inventory expansion
                    //###########################################################################################
                    #region Inventory expansion
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.INVENTORYEXPANSION)
                    {
                        if (HandleInventoryExp(uItemID.ID))
                        {
                            HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                        }
                    }
                    #endregion
                    //###########################################################################################
                    // Warehouse expansion
                    //###########################################################################################
                    #region Warehouse expansion
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.WAREHOUSE)
                    {
                        HandleWareHouse(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Guild related
                    //###########################################################################################
                    #region Guild Icon
                    else if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.GUILD_ICON)
                    {
                        HandleRegisterIcon();
                    }
                    #endregion
                    //###########################################################################################
                    // Non coded types
                    //###########################################################################################
                    else
                    {
                        //Need to make message in progress or such
                    }
                }
                // Close our packet reader
                Reader.Close();
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
        //##########################################
        // Item gender change
        //##########################################
        public void HandleItemChange(int itemid, byte slot, byte target_slot)
        {
            try
            {
                //Get information for the current item
                ObjData.slotItem iteminfo = GetItem((uint)Character.Information.CharacterID, target_slot, 0);
                ObjData.slotItem toolinfo = GetItem((uint)Character.Information.CharacterID, slot, 0);
                //Get item name
                string itemname = ObjData.Manager.ItemBase[iteminfo.ID].Name;

                //Checks before continuing (degree item).
                if (ObjData.Manager.ItemBase[toolinfo.ID].Name.Contains("_01"))
                {
                    if (ObjData.Manager.ItemBase[iteminfo.ID].Degree > 3)
                    {
                        return;
                    }
                }
                else if (ObjData.Manager.ItemBase[toolinfo.ID].Name.Contains("_02"))
                {
                    if (ObjData.Manager.ItemBase[iteminfo.ID].Degree > 6 && ObjData.Manager.ItemBase[iteminfo.ID].Degree < 8)
                    {
                        return;
                    }
                }
                else if (ObjData.Manager.ItemBase[toolinfo.ID].Name.Contains("_03"))
                {
                    if (ObjData.Manager.ItemBase[iteminfo.ID].Degree > 9 && ObjData.Manager.ItemBase[iteminfo.ID].Degree < 6)
                    {
                        return;
                    }
                }
                else if (ObjData.Manager.ItemBase[toolinfo.ID].Name.Contains("_04"))
                {
                    if (ObjData.Manager.ItemBase[iteminfo.ID].Degree > 12 && ObjData.Manager.ItemBase[iteminfo.ID].Degree < 10)
                    {
                        return;
                    }
                }
                //Rename the item to the opposite gender for getting the new id
                if (itemname.Contains("_M_"))
                {
                    itemname = itemname.Replace("_M_", "_W_");
                }
                else if (itemname.Contains("_W_"))
                {
                    itemname = itemname.Replace("_W_", "_M_");
                }
                //Return the new itemid value
                iteminfo.ID = GetGenderItem(itemname);
                //Send 1st packet
                client.Send(Packet.ChangeItemQ(target_slot, iteminfo.ID));
                //Remove the gender change item visually (amount).
                HandleUpdateSlotChange(target_slot, iteminfo, iteminfo.ID);
                //Need to refactor the packets for item move will do that later
                client.Send(Packet.MoveItem(target_slot, slot, 0, 0, 0, "MOVE_GENDER_CHANGE"));
                //Need to check refresh info for the item. (Rest works).
            }
            catch (Exception ex)
            {
                Console.WriteLine("Item gender change error {0}", ex);
                Log.Exception(ex);
            }
        }
예제 #18
0
 /////////////////////////////////////////////////////////////////////////////////
 // Slot update packet
 /////////////////////////////////////////////////////////////////////////////////
 void GetUpdateSlot(ObjData.slotItem item, byte toSlot, int toItemID, short quantity)
 {
     #region Send item move packet
     client.Send(Packet.MoveItem(0, item.Slot, toSlot, quantity, 0, "MOVE_INSIDE_INVENTORY"));
     #endregion
 }
예제 #19
0
        /////////////////////////////////////////////////////////////////////////////////
        // Move inside Storages
        /////////////////////////////////////////////////////////////////////////////////
        void ItemMoveInStorage(byte fromSlot, byte toSlot, short quantity)
        {
            #region Move Inside Storage
            try
            {
                //Get item information of selected item
                ObjData.slotItem fromItem = GetItem((uint)Character.Information.CharacterID, fromSlot, 1);
                //Check item where we are moving to
                ObjData.slotItem toItem = GetItem((uint)Character.Information.CharacterID, toSlot, 1);
                //If the slot where we are moving to has an item

                //Check what type of storage we use.
                int storagetype = 1;
                //Set storage type
                if (Character.Network.Guild.UsingStorage)
                {
                    storagetype = 3;
                }
                if (!Character.Network.Guild.UsingStorage)
                {
                    if (toItem.ID != 0)
                    {
                        //Visual packet
                        client.Send(Packet.MoveItem(0, toSlot, fromSlot, quantity, 0, "MOVE_INSIDE_STORAGE"));
                        //First we update database with the 2 items (From item).
                        DB.query("UPDATE char_items SET itemnumber='item" + toSlot + "',slot='" + toSlot + "' WHERE itemnumber='" + "item" + fromSlot + "' AND owner='" + Player.ID + "' AND itemid='" + fromItem.ID + "' AND id='" + fromItem.dbID + "' AND storagetype='" + storagetype + "'");
                        //To item database update
                        DB.query("UPDATE char_items SET itemnumber='item" + fromSlot + "',slot='" + fromSlot + "' WHERE itemnumber='" + "item" + toSlot + "' AND owner='" + Player.ID + "' AND itemid='" + toItem.ID + "' AND id='" + toItem.dbID + "' AND storagetype='" + storagetype + "'");
                    }
                    else
                    {
                        client.Send(Packet.MoveItem(0, fromSlot, toSlot, quantity, 0, "MOVE_INSIDE_STORAGE"));
                        DB.query("UPDATE char_items SET itemnumber='item" + toSlot + "',slot='" + toSlot + "' WHERE itemnumber='" + "item" + fromSlot + "' AND owner='" + Player.ID + "' AND itemid='" + fromItem.ID + "' AND storagetype='" + storagetype + "'");
                    }
                }
                //Guild storage
                else
                {
                    fromItem = GetItem((uint)Character.Information.CharacterID, fromSlot, 3);
                    //Check item where we are moving to
                    toItem = GetItem((uint)Character.Information.CharacterID, toSlot, 3);

                    if (toItem.ID != 0)
                    {
                        //Visual packet
                        client.Send(Packet.MoveItem(0, toSlot, fromSlot, quantity, 0, "MOVE_INSIDE_GUILD_STORAGE"));
                        //First we update database with the 2 items (From item).
                        DB.query("UPDATE char_items SET itemnumber='item" + toSlot + "',slot='" + toSlot + "' WHERE itemnumber='" + "item" + fromSlot + "' AND guild_storage_id='" + Character.Network.Guild.Guildid + "' AND itemid='" + fromItem.ID + "' AND id='" + fromItem.dbID + "' AND storagetype='" + storagetype + "'");
                        //To item database update
                        DB.query("UPDATE char_items SET itemnumber='item" + fromSlot + "',slot='" + fromSlot + "' WHERE itemnumber='" + "item" + toSlot + "' AND guild_storage_id='" + Character.Network.Guild.Guildid + "' AND itemid='" + toItem.ID + "' AND id='" + toItem.dbID + "' AND storagetype='" + storagetype + "'");
                    }
                    else
                    {
                        client.Send(Packet.MoveItem(0, fromSlot, toSlot, quantity, 0, "MOVE_INSIDE_GUILD_STORAGE"));
                        DB.query("UPDATE char_items SET itemnumber='item" + toSlot + "',slot='" + toSlot + "' WHERE itemnumber='" + "item" + fromSlot + "' AND guild_storage_id='" + Character.Network.Guild.Guildid + "' AND itemid='" + fromItem.ID + "' AND storagetype='" + storagetype + "'");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Move inside storage error {0}", ex);
                Log.Exception(ex);
            }
            //Save player information
            SavePlayerInfo();
            #endregion
        }
예제 #20
0
 /////////////////////////////////////////////////////////////////////////////////
 // Move item to storage
 /////////////////////////////////////////////////////////////////////////////////
 void Player_MoveItemToStorage(byte f_slot, byte t_slot, int o_id)
 {
     #region Move item to storage
     try
     {
         //Check if the user isnt in any state/action that we will not allow.
         if (Character.State.Die)
         {
             return;
         }
         if (Character.Stall.Stallactive)
         {
             return;
         }
         if (Character.Alchemy.working)
         {
             return;
         }
         if (Character.Position.Walking)
         {
             return;
         }
         //Normal storage
         if (!Character.Network.Guild.UsingStorage)
         {
             //Get item information
             ObjData.slotItem item = GetItem((uint)Character.Information.CharacterID, f_slot, 0);
             //Get storage price of the item
             int storageprice = ObjData.Manager.ItemBase[item.ID].Storage_price;
             //Set amount if its only 1
             if (item.Amount == 0)
             {
                 item.Amount = 1;
             }
             //Multiply the price, per amount
             storageprice *= item.Amount;
             //Anti hack check make sure that the owner of the item is correct
             int ownerid = Convert.ToInt32(DB.GetData("SELECT * FROM char_items WHERE id='" + item.dbID + "'", "owner"));
             //Check if the owner really owns the item.
             if (ownerid == Character.Information.CharacterID)
             {
                 //Make sure the stack count is equal or lower then max stack amount
                 if (item.Amount <= ObjData.Manager.ItemBase[item.ID].Max_Stack)
                 {
                     //If the user has enough gold (Equally or higher to storage price).
                     if (Character.Information.Gold >= storageprice)
                     {
                         //Set character gold
                         Character.Information.Gold -= storageprice;
                         //Send update packet for gold
                         client.Send(Packet.UpdateGold(Character.Information.Gold));
                         //Update DB database information
                         DB.query("UPDATE char_items SET itemnumber='item" + t_slot + "',slot='" + t_slot + "',storagetype='1' WHERE storageacc='" + Player.ID + "' AND id='" + item.dbID + "'");
                         //Send visual move packet to player
                         client.Send(Packet.MoveItem(2, f_slot, t_slot, 0, 0, "MOVE_TO_STORAGE"));
                         //Save the player gold
                         SaveGold();
                     }
                     //If the user does not have enough gold
                     else
                     {
                         client.Send(Packet.Message(OperationCode.SERVER_ITEM_MOVE, Messages.UIIT_MSG_STRGERR_NOT_ENOUGH_GOLD));
                     }
                 }
                 //This should not happen but if the stack is to high.
                 else
                 {
                     return;
                 }
             }
             //If the player is not the item owner (Hacking attempt).
             else
             {
                 Disconnect("ban");
                 Log.Exception("Autobanned user: "******" Due to hacking");
             }
         }
         //Guild storage
         else
         {
             //Get item information
             ObjData.slotItem item = GetItem((uint)Character.Information.CharacterID, f_slot, 0);
             //Get storage price of the item
             int storageprice = ObjData.Manager.ItemBase[item.ID].Storage_price;
             //Set amount if its only 1
             if (item.Amount == 0)
             {
                 item.Amount = 1;
             }
             //Multiply the price, per amount
             storageprice *= item.Amount;
             //Anti hack check make sure that the owner of the item is correct
             int ownerid = Convert.ToInt32(DB.GetData("SELECT * FROM char_items WHERE id='" + item.dbID + "'", "owner"));
             //Check if the owner really owns the item.
             if (ownerid == Character.Information.CharacterID)
             {
                 //Make sure the stack count is equal or lower then max stack amount
                 if (item.Amount <= ObjData.Manager.ItemBase[item.ID].Max_Stack)
                 {
                     //If the user has enough gold (Equally or higher to storage price).
                     if (Character.Information.Gold >= storageprice)
                     {
                         //Set character gold
                         Character.Information.Gold -= storageprice;
                         //Send update packet for gold
                         client.Send(Packet.UpdateGold(Character.Information.Gold));
                         //Update DB database information
                         DB.query("UPDATE char_items SET itemnumber='item" + t_slot + "',slot='" + t_slot + "',storagetype='3' ,guild_storage_id='" + Character.Network.Guild.Guildid + "' WHERE id='" + item.dbID + "'");
                         //Send visual move packet to player
                         client.Send(Packet.MoveItem(2, f_slot, t_slot, 0, 0, "MOVE_TO_GUILD_STORAGE"));
                         //Save the player gold
                         SaveGold();
                     }
                     //If the user does not have enough gold
                     else
                     {
                         client.Send(Packet.Message(OperationCode.SERVER_ITEM_MOVE, Messages.UIIT_MSG_STRGERR_NOT_ENOUGH_GOLD));
                     }
                 }
                 //This should not happen but if the stack is to high.
                 else
                 {
                     return;
                 }
             }
             //If the player is not the item owner (Hacking attempt).
             else
             {
                 Disconnect("ban");
                 Log.Exception("Autobanned user: "******" Due to hacking");
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Storage move error : {0}", ex);
         Log.Exception(ex);
     }
     //Save player information
     SavePlayerInfo();
     #endregion
 }
        /////////////////////////////////////////////////////////////////////////////////
        // Item destruction with alchemy
        /////////////////////////////////////////////////////////////////////////////////
        public void BreakItem()
        {
            try
            {
                //Checks before we continue
                if (Character.Stall.Stallactive || Character.Action.nAttack || Character.Action.sAttack || Character.Alchemy.working)
                {
                    return;
                }
                //Set bool
                Character.Alchemy.working = true;
                //TODO: Timer for alchemy start / end
                PacketReader reader        = new PacketReader(PacketInformation.buffer);
                byte         rondorequired = reader.Byte();
                byte         slot          = reader.Byte();
                reader.Close();


                //Get our item information (item)
                ObjData.slotItem item = GetItem((uint)Character.Information.CharacterID, slot, 0);

                //Get our degree information
                byte itemdegree = ObjData.Manager.ItemBase[item.ID].Degree;

                //First we get our elements (Same degree as weapon)
                //This should return 4 items
                //Add check rondo count if high enough.
                Character.Alchemy.Elementlist = GetDegreeElements(item.ID, Character);
                //Check if the item has any blues on it.
                if (ObjData.Manager.ItemBlue[item.dbID].totalblue != 0)
                {
                    Character.Alchemy.StonesList = GetStonesDegree(item.ID, Character);
                }

                //Check current free slots of the player
                byte slotcheck = GetFreeSlot();
                //If slot amount is lower then 4 return
                //Slots free must be 6 i believe because of stones (TODO: Check info official).
                if (slotcheck < 4)
                {
                    //Send error message inventory full ...
                    return;
                }
                //Player has enough slots so we continue adding the new items
                else
                {
                    //Update rondo quantity
                    Character.Information.InventorylistSlot = GetPlayerItems(Character);
                    foreach (byte e in Character.Information.InventorylistSlot)
                    {
                        //Set slotitem
                        ObjData.slotItem itemrondoinfo = GetItem((uint)Character.Information.CharacterID, e, 0);
                        if (itemrondoinfo.ID != 0)
                        {
                            if (ObjData.Manager.ItemBase[itemrondoinfo.ID].Etctype == ObjData.item_database.EtcType.DESTROYER_RONDO)
                            {
                                //Update amount
                                itemrondoinfo.Amount -= rondorequired;
                                ItemUpdateAmount(itemrondoinfo, Character.Information.CharacterID);
                            }
                        }
                    }
                    //Clean our list
                    Character.Information.InventorylistSlot.Clear();
                    //Remove the item used in dissembling (Query).
                    DB.query("DELETE FROM char_items WHERE id='" + item.dbID + "' AND owner='" + Character.Information.CharacterID + "'");
                    //Remove the item used in dissembling (Visual).
                    ItemUpdateAmount(item, Character.Information.CharacterID);
                    //Send packet #2
                    client.Send(Packet.DestroyItem());
                    //Repeat for each element in our list.
                    foreach (int e in Character.Alchemy.Elementlist)
                    {
                        if (e != 0)
                        {
                            //TODO: Make detailed randoms
                            //Make random add count for the elements
                            //NOTE: Check what item has what element on destruction. if pk2 contains or not.
                            int elementamount = 0;

                            #region Amounts
                            if (ObjData.Manager.ItemBase[item.ID].Degree == 1)
                            {
                                elementamount = Rnd.Next(1, 60);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 2)
                            {
                                elementamount = Rnd.Next(1, 90);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 3)
                            {
                                elementamount = Rnd.Next(1, 120);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 4)
                            {
                                elementamount = Rnd.Next(1, 150);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 5)
                            {
                                elementamount = Rnd.Next(1, 200);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 6)
                            {
                                elementamount = Rnd.Next(1, 250);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 7)
                            {
                                elementamount = Rnd.Next(1, 300);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 8)
                            {
                                elementamount = Rnd.Next(1, 375);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 9)
                            {
                                elementamount = Rnd.Next(1, 450);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 10)
                            {
                                elementamount = Rnd.Next(1, 600);
                            }
                            else if (ObjData.Manager.ItemBase[item.ID].Degree == 11)
                            {
                                elementamount = Rnd.Next(1, 800);
                            }
                            #endregion

                            int stoneamount = 0;

                            #region Stones
                            if (ObjData.Manager.ItemBlue[item.dbID].totalblue != 0)
                            {
                                if (ObjData.Manager.ItemBlue[item.dbID].totalblue == 1)
                                {
                                    stoneamount = Rnd.Next(0, 1);
                                }
                                else if (ObjData.Manager.ItemBlue[item.dbID].totalblue == 2)
                                {
                                    stoneamount = Rnd.Next(0, 2);
                                }
                            }
                            #endregion

                            slotcheck = GetFreeSlot();
                            //Stack items todo
                            AddItem(ObjData.Manager.ItemBase[e].ID, 10, slotcheck, Character.Information.CharacterID, 0);
                            client.Send(Packet.GainElements(slotcheck, ObjData.Manager.ItemBase[e].ID, (short)elementamount));
                        }
                    }
                    //Clear created list content.
                    Character.Alchemy.Elementlist.Clear();
                }
                //Reset bool
                Character.Alchemy.working = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Alchemy error destroyer {0}", ex);
            }
        }
 void HandleUpdateSlotChange(byte slot, ObjData.slotItem item, int packet)
 {
     DB.query("UPDATE char_items SET itemid='" + packet + "' WHERE owner='" + Character.Information.CharacterID + "' AND itemnumber='item" + item.Slot + "' AND id='" + item.dbID + "'");
     //Need to be defined per item type (potion or private item)
     Send(Packet.Player_HandleEffect(Character.Information.UniqueID, item.ID));
 }
        /////////////////////////////////////////////////////////////////////////////////
        // Avatar Equiped
        /////////////////////////////////////////////////////////////////////////////////
        void ItemAvatarEquip(byte fromSlot, byte toSlot)
        {
            #region Avatar equiped
            try
            {
                GetFreeSlot();
                ObjData.slotItem toItem = new ObjData.slotItem();
                ObjData.slotItem fromItem = GetItem((uint)Character.Information.CharacterID, fromSlot, 0);

                DB ms = new DB("SELECT * FROM char_items WHERE itemnumber='avatar" + toSlot + "' AND owner='" + Character.Information.CharacterID + "'");
                using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
                {
                    while (reader.Read())
                    {
                        toItem.ID = reader.GetInt32(2);
                        toItem.dbID = reader.GetInt32(0);
                    }
                }
                ms.Close();

                if (toItem.ID != 0) return;

                if (fromItem.ID == 0) return;
                if (!CheckGender(Character.Information.Model, fromItem.ID))
                {
                    return;
                }

                else
                {
                    string nonquery = "UPDATE char_items SET itemnumber='avatar" + toSlot + "',inAvatar='1',slot='" + toSlot + "' WHERE owner='" + Character.Information.CharacterID + "' AND itemnumber='item" + fromSlot + "' AND id='" + fromItem.dbID + "'";
                    DB.query(nonquery);
                }
                Send(Packet.MoveItemEnquipEffect(Character.Information.UniqueID, toSlot, fromItem.ID, 0));
                client.Send(Packet.MoveItem(36, fromSlot, toSlot, 1, 0, "MOVE_INSIDE_INVENTORY"));
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            #endregion
        }
 /////////////////////////////////////////////////////////////////////////////////
 // Convert to item
 /////////////////////////////////////////////////////////////////////////////////
 ObjData.slotItem ConvertToItem(int id, byte slots, short amount, byte index)
 {
     #region Arrow convert info
     ObjData.slotItem slot = new ObjData.slotItem();
     slot.ID = id;
     slot.Slot = slots;
     slot.Amount = amount;
     return slot;
     #endregion
 }
        /////////////////////////////////////////////////////////////////////////////////
        // Get Slot Item Information
        /////////////////////////////////////////////////////////////////////////////////
        static ObjData.slotItem GetItem(uint id, byte slot, int type)
        {
            #region Slot item info

            try
            {
                if (id != 0)
                {
                    ObjData.slotItem slotItem = new ObjData.slotItem();
                    int row = type;

                    DB ms;
                    if (row == 1)
                    {
                        ms = new DB("SELECT * FROM char_items WHERE itemnumber='item" + slot + "' AND storageacc='" + id + "' AND storagetype='" + row + "' AND slot='" + slot + "'");
                    }
                    else if (row == 3)
                    {
                        ms = new DB("SELECT * FROM char_items WHERE itemnumber='item" + slot + "' AND storagetype='" + row + "' AND slot='" + slot + "'");
                    }
                    else
                    {
                        ms = new DB("SELECT * FROM char_items WHERE itemnumber='item" + slot + "' AND owner='" + id + "' AND storagetype='" + row + "' AND slot='" + slot + "'");
                    }

                    using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
                    {
                        while (reader.Read())
                        {
                            slotItem.dbID = reader.GetInt32(0);
                            slotItem.ID = reader.GetInt32(2);
                            slotItem.PlusValue = reader.GetByte(4);
                            slotItem.Amount = reader.GetInt16(6);
                            slotItem.Durability = reader.GetInt32(7);
                            slotItem.Slot = slot;
                            LoadBluesid(slotItem.dbID);
                        }
                    }
                    ms.Close();
                    return slotItem;
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            return null;
            #endregion
        }
 ///////////////////////////////////////////////////////////////////////////
 // Load grabpet
 ///////////////////////////////////////////////////////////////////////////
 public void HandleGrabPet(byte slot, int ItemID)
 {
     try
     {
         //Checks before we continue (Level check).
         if (!CheckItemLevel(Character.Information.Level, ItemID))
         {
             client.Send(Packet.MoveItemError(0x6C, 0x18));
         }
         //Else we continue
         else
         {
             //Our database query for loading pet information.
             DB ms = new DB("SELECT * FROM pets WHERE pet_itemid='" + ItemID + "' AND playerid='" + Character.Information.CharacterID + "'");
             //Get detailed item information.
             ObjData.slotItem item = GetItem((uint)Character.Information.CharacterID, slot, 0);
             //Get item model information
             int model = ObjData.objectdata.GetItem(ObjData.Manager.ItemBase[ItemID].ObjectName);
             //Create new pet object
             WorldMgr.pet_obj o = new WorldMgr.pet_obj();
             //Our sql data reader
             using (SqlDataReader reader = ms.Read())
             {
                 //While our reader is open we read all info below.
                 while (reader.Read())
                 {
                     int itemid = reader.GetInt32(7);
                     Character.Grabpet.Grabpetid = item.dbID;
                     o.UniqueID  = Character.Grabpet.Grabpetid;
                     o.Model     = model;
                     o.Slots     = reader.GetByte(8);
                     o.x         = Character.Position.x + Rnd.Next(1, 3);
                     o.z         = Character.Position.z;
                     o.y         = Character.Position.y + Rnd.Next(1, 3);
                     o.xSec      = Character.Position.xSec;
                     o.ySec      = Character.Position.ySec;
                     o.OwnerID   = Character.Information.CharacterID;
                     o.OwnerName = Character.Information.Name;
                     o.Walking   = Character.Position.Walking;
                     o.Petname   = reader.GetString(3);
                     o.Named     = 2;
                     o.Run       = Character.Speed.RunSpeed;
                     o.Walk      = Character.Speed.WalkSpeed;
                     o.Zerk      = Character.Speed.BerserkSpeed;
                 }
                 ms.Close();
             }
             //We set our pet active bool, so user cannot spawn multiple.
             Character.Grabpet.Active = true;
             o.Information            = true;
             //Set all details above to definitions
             Character.Grabpet.Details = o;
             //Global spawn the pet
             Helpers.Manager.HelperObject.Add(o);
             //Spawn ourselfs
             o.SpawnMe();
             //Send then packet required (Pet information block).
             client.Send(Packet.Pet_Information_grab(o, slot));
             //Update pet status to active (For relog purposes).
             DB.query("UPDATE pets SET pet_active='1' WHERE pet_unique='" + Character.Grabpet.Grabpetid + "' AND playerid='" + Character.Information.CharacterID + "'");
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
        public void StallMain()
        {
            try
            {
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                byte         Type   = Reader.Byte();

                //Item edit
                if (Type == 1)
                {
                    if (Character.Network.Stall.isOpened)
                    {
                        return;
                    }
                    byte stallslot = Reader.Byte();
                    Reader.Skip(2);
                    ulong price = Reader.UInt64();
                    if (price <= 999999999)
                    {
                        int StallItemIndex = Character.Network.Stall.ItemList.FindIndex(i => (i.stallSlot == stallslot));
                        Character.Network.Stall.ItemList[StallItemIndex].price = price;

                        Character.Network.Stall.Send(Packet.StallModifyItem(stallslot, price));
                    }
                    else
                    {
                        return;
                    }
                }
                //Add an item
                else if (Type == 2)
                {
                    if (Character.Network.Stall.isOpened)
                    {
                        return;
                    }
                    byte  stallslot = Reader.Byte();
                    byte  invpos    = Reader.Byte();
                    short quantity  = Reader.Int16();
                    ulong price     = Reader.UInt64();

                    ObjData.slotItem uItemID = GetItem((uint)Character.Information.CharacterID, invpos, 0);

                    //Disable item mall items in stalls for now.
                    if (ObjData.Manager.ItemBase[uItemID.ID].Etctype == ObjData.item_database.EtcType.GLOBALCHAT ||
                        ObjData.Manager.ItemBase[uItemID.ID].Type == ObjData.item_database.ArmorType.AVATAR ||
                        ObjData.Manager.ItemBase[uItemID.ID].Type == ObjData.item_database.ArmorType.AVATARHAT ||
                        ObjData.Manager.ItemBase[uItemID.ID].Type == ObjData.item_database.ArmorType.AVATARATTACH
                        )
                    {
                        return;
                    }

                    if (quantity <= ObjData.Manager.ItemBase[uItemID.ID].Max_Stack)
                    {
                        WorldMgr.stall.stallItem StallItem = new WorldMgr.stall.stallItem();
                        LoadBluesid(uItemID.dbID);
                        StallItem.stallSlot = stallslot;
                        StallItem.price     = price;
                        StallItem.Item      = (GetItem((uint)Character.Information.CharacterID, invpos, 0));

                        if (Character.Network.Stall.ItemList.Exists((get => get.Item.dbID == StallItem.Item.dbID)))
                        {
                            return;
                        }

                        Character.Network.Stall.ItemList.Add(StallItem);
                        Character.Network.Stall.Send(Packet.StallItemMain(Character.Network.Stall.ItemList));
                    }
                    else
                    {
                        return;
                    }
                }
                //Item pulling out
                else if (Type == 3)
                {
                    if (Character.Network.Stall.isOpened)
                    {
                        return;
                    }
                    byte stallslot = Reader.Byte();

                    //remove stallItem from stall
                    Character.Network.Stall.ItemList.Remove(Character.Network.Stall.ItemList.Find(i => (i.stallSlot == stallslot)));
                    Character.Network.Stall.Send(Packet.StallItemMain(Character.Network.Stall.ItemList));
                }
                //Stall modify state
                else if (Type == 5)
                {
                    byte State = Reader.Byte();
                    Character.Network.Stall.isOpened = (State == 1) ? true : false;

                    Character.Network.Stall.Send(Packet.StallSetState(State));
                }
                //Set Welcome msg
                else if (Type == 6)
                {
                    if (Character.Network.Stall.isOpened)
                    {
                        return;
                    }
                    short length = Reader.Int16();
                    Character.Network.Stall.WelcomeMsg = Reader.Text3();
                    //Console.WriteLine("New Welcome msg:" + welcome);
                    Character.Network.Stall.Send(Packet.StallWelcome(Character.Network.Stall.WelcomeMsg));
                }
                //Set StallName
                else if (Type == 7)
                {
                    string stallname = Reader.Text3();
                    Send(Packet.StallNameGlobal(Character.Information.UniqueID, stallname));
                    Character.Network.Stall.Send(Packet.StallName(stallname));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Additem Stall error: {0}", ex);
            }
        }
 void LoadGrabPet()
 {
     //Wrap our function inside a catcher
     try
     {
         //Query check
         DB ms = new DB("SELECT * FROM pets WHERE playerid='" + Character.Information.CharacterID + "' AND pet_active='1'");
         //Get active pet count
         int checkactive = ms.Count();
         //If the player has an active grabpet
         if (checkactive > 0)
         {
             //Set new pet object
             WorldMgr.pet_obj o = new WorldMgr.pet_obj();
             //Create new data reader for DB
             using (SqlDataReader reader = ms.Read())
             {
                 //While the sql data reader is reading
                 while (reader.Read())
                 {
                     //Get pet location inside the player inventory
                     string slot = reader.GetString(12);
                     //Check our slot inside the database
                     int slotcheck = Convert.ToInt32(DB.GetData("SELECT * FROM char_items WHERE itemnumber='" + slot + "' AND owner='" + Character.Information.CharacterID + "' AND storagetype='0'", "slot"));
                     //Set slot item information (item).
                     ObjData.slotItem item = GetItem((uint)Character.Information.CharacterID, Convert.ToByte(slotcheck), 0);
                     //Set model information of the pet
                     int model = ObjData.item_database.GetItem(ObjData.Manager.ItemBase[item.ID].ObjectName);
                     //Set id for the pet (First database value is always unique).
                     Character.Grabpet.Grabpetid = item.dbID;
                     //Set unique id
                     o.UniqueID = Character.Grabpet.Grabpetid;
                     //Pet object model
                     o.Model = model;
                     //Spawning location of the pet
                     o.x    = Character.Position.x + Rnd.Next(1, 3);
                     o.z    = Character.Position.z;
                     o.y    = Character.Position.y + Rnd.Next(1, 3);
                     o.xSec = Character.Position.xSec;
                     o.ySec = Character.Position.ySec;
                     //Owner id information
                     o.OwnerID = Character.Information.CharacterID;
                     //Owner name information
                     o.OwnerName = Character.Information.Name;
                     //Set walking state
                     o.Walking = Character.Position.Walking;
                     //Set petname
                     o.Petname = reader.GetString(3);
                     //Set our switch case
                     o.Named = 2;
                     //Set speed of pet (Need to check speed on official).
                     o.Run  = Character.Speed.RunSpeed - 3;
                     o.Walk = Character.Speed.WalkSpeed - 3;
                     o.Zerk = Character.Speed.BerserkSpeed - 3;
                     //Set grabpet as active so there cant be double spawns
                     Character.Grabpet.Active = true;
                     //Set object information to true
                     o.Information = true;
                     //Spawn the pet
                     Helpers.Manager.HelperObject.Add(o);
                     //Set global information for the pet
                     Character.Grabpet.Details = o;
                     //Send the visual packet for details of the pet management
                     client.Send(Packet.Pet_Information_grab(o, Convert.ToByte(slotcheck)));
                     //Spawn
                     o.SpawnMe();
                     //Update state into database
                     DB.query("UPDATE pets SET pet_active='1' WHERE pet_unique='" + Character.Grabpet.Grabpetid + "' AND playerid='" + Character.Information.CharacterID + "'");
                 }
                 //Close sql reader
                 ms.Close();
             }
             //Set state
             Character.Grabpet.Active = true;
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }