Exemple #1
0
 public static double gamedistance(WorldMgr.Items p1, WorldMgr.character._pos p2)
 {  // Nukei: for test with range checking on objects, maybe faster than only calculating distance
     if ((p1.xSec >= p2.xSec - 1) && (p1.xSec <= p2.xSec + 1) && (p1.ySec >= p2.ySec - 1) && (p1.ySec <= p2.ySec + 1))
     {
         return(gamedistance(p1.x, p1.y, p2.x, p2.y));
     }
     else
     {
         return(99999999999999);
     }
 }
        /////////////////////////////////////////////////////////////////////////////////
        // Movement checks before picking
        /////////////////////////////////////////////////////////////////////////////////
        void Player_PickUp()
        {
            try
            {
                if (Character.State.Sitting)
                {
                    return;
                }
                if (Character.State.Exchanging)
                {
                    return;
                }

                if (Character.Action.Target != 0)
                {
                    WorldMgr.Items item = Helpers.GetInformation.GetWorldItem(Character.Action.Target);

                    if (item == null)
                    {
                        return;
                    }

                    double distance = Formule.gamedistance(Character.Position.x, Character.Position.y, item.x, item.y);

                    if (distance >= 1)
                    {
                        Character.Position.wX = item.x - Character.Position.x;
                        Character.Position.wY = item.y - Character.Position.y;

                        Send(Packet.Movement(new ObjData.vektor(Character.Information.UniqueID, Formule.packetx(item.x, item.xSec), Character.Position.z, Formule.packety(item.y, item.ySec), Character.Position.xSec, Character.Position.ySec)));

                        StartMovementTimer(GetMovementTime(distance));
                        return;
                    }

                    Player_PickUpItem();
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
Exemple #3
0
        void GMmakeitem(int itemID, byte PlusValue)
        {
            try
            {
                WorldMgr.Items sitem = new WorldMgr.Items();
                sitem.Model     = itemID;
                sitem.Ids       = new GenerateUniqueID(GenerateUniqueID.IDS.World);
                sitem.UniqueID  = sitem.Ids.GetUniqueID;
                sitem.amount    = 1;
                sitem.PlusValue = PlusValue;
                sitem.x         = Character.Position.x;
                sitem.z         = Character.Position.z;
                sitem.y         = Character.Position.y;
                sitem.xSec      = Character.Position.xSec;
                sitem.ySec      = Character.Position.ySec;
                sitem.CalculateNewPosition();
                #region Amount definition
                if (ObjData.Manager.ItemBase[sitem.Model].Equip)
                {
                    sitem.Type = 2;
                }
                else
                {
                    sitem.Type = 3;
                }
                #endregion

                sitem.fromType  = 5;
                sitem.fromOwner = 0;
                sitem.downType  = false;
                sitem.Owner     = Character.Account.ID;
                Helpers.Manager.WorldItem.Add(sitem);

                sitem.Send(Packet.ObjectSpawn(sitem), true);
                Print.Format("[Gameserver:" + Character.Information.Name + " Has created:  {0}", ObjData.Manager.ItemBase[itemID].Name);
            }
            catch (Exception ex)
            {
                Console.WriteLine("GM_MakeItem: {0}", ex);
            }
        }
        public void MonsterDrop()
        {
            try
            {
                if (GetDie || Die)
                {
                    if (Type != 16)
                    {
                        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        // Set Target Information
                        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        PlayerMgr sys = (PlayerMgr)GetTarget();
                        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        // If There's no target return
                        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        if (sys == null) return;

                        sbyte Leveldiff = (sbyte)(sys.Character.Information.Level - ObjData.Manager.ObjectBase[ID].Level);
                        int Amountinfo = 0;

                        if (Math.Abs(Leveldiff) < 10 || Math.Abs(Leveldiff) == 0)
                        {
                            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                            // Gold Drop
                            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                            #region Gold
                            int Golddrop = Rnd.Next(ObjData.Manager.LevelGold[ObjData.Manager.ObjectBase[ID].Level].min, ObjData.Manager.LevelGold[ObjData.Manager.ObjectBase[ID].Level].max);
                            Amountinfo = 0;
                            if (Type == 4 && (Rnd.Next(0, 200) < 200 * Helpers.Settings.Rate.Gold)) Amountinfo = Convert.ToByte(Rnd.Next(1, 3));
                            if (Type == 3 && (Rnd.Next(0, 200) < 200 * Helpers.Settings.Rate.Gold)) Amountinfo = Convert.ToByte(Rnd.Next(4, 6));
                            if (Type == 1 && (Rnd.Next(0, 200) < 200 * Helpers.Settings.Rate.Gold)) Amountinfo = Convert.ToByte(Rnd.Next(1, 3));
                            if (Type == 0 && (Rnd.Next(0, 200) < 100 * Helpers.Settings.Rate.Gold)) Amountinfo = 1;

                            for (byte a = 1; a <= Amountinfo;)
                            {
                                WorldMgr.Items Gold_Drop = new WorldMgr.Items();

                                Gold_Drop.amount = Golddrop * Helpers.Settings.Rate.Gold;
                                Gold_Drop.Model = 1;

                                if (Gold_Drop.amount < 1000)
                                    Gold_Drop.Model = 1;
                                else if (Gold_Drop.amount > 1000 && Gold_Drop.amount < 10000)
                                    Gold_Drop.Model = 2;
                                else if (Gold_Drop.amount > 10000)
                                    Gold_Drop.Model = 3;

                                Gold_Drop.Ids = new GenerateUniqueID(GenerateUniqueID.IDS.World);
                                Gold_Drop.UniqueID = Gold_Drop.Ids.GetUniqueID;
                                Gold_Drop.x = x;
                                Gold_Drop.z = z;
                                Gold_Drop.y = y;
                                Gold_Drop.xSec = xSec;
                                Gold_Drop.ySec = ySec;
                                Gold_Drop.Type = 1;
                                Gold_Drop.downType = true;
                                Gold_Drop.fromType = 5;
                                Gold_Drop.CalculateNewPosition();

                                Helpers.Manager.WorldItem.Add(Gold_Drop);
                                Gold_Drop.Send(Client.Packet.ObjectSpawn(Gold_Drop), true);
                                a++;

                                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                // Send Info To Grabpet
                                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                if (((PlayerMgr)GetTarget()).Character.Grabpet.Active)
                                {
                                    ((PlayerMgr)GetTarget()).Pet_PickupItem(Gold_Drop);
                                }
                            }
                            #endregion
                            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                            // Drop Database
                            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                            #region Drop Databases
                            foreach (KeyValuePair<string, ObjData.drop_database> p in ObjData.Manager.DropBase)
                            {
                                Amountinfo = p.Value.GetAmount(ObjData.Manager.ObjectBase[ID].Type, p.Key);
                                if (Amountinfo > 0)
                                {
                                    for (byte c = 1; c <= Amountinfo; c++)
                                    {
                                        Items Dropped_Item = new Items();
                                        Dropped_Item.Model = p.Value.GetDrop(ObjData.Manager.ObjectBase[ID].Level, ID, p.Key, sys.Character.Information.Race);
                                        if (Dropped_Item.Model == -1) continue;
                                        Dropped_Item.Ids = new GenerateUniqueID(GenerateUniqueID.IDS.World);
                                        Dropped_Item.UniqueID = Dropped_Item.Ids.GetUniqueID;
                                        Dropped_Item.PlusValue = Function.Items.RandomPlusValue();
                                        Dropped_Item.MagAtt = Function.Items.RandomStatValue();
                                        Dropped_Item.x = x;
                                        Dropped_Item.z = z;
                                        Dropped_Item.y = y;
                                        Dropped_Item.xSec = xSec;
                                        Dropped_Item.ySec = ySec;
                                        Dropped_Item.Type = p.Value.GetSpawnType(p.Key);
                                        Dropped_Item.fromType = 5;
                                        Dropped_Item.downType = true;
                                        Dropped_Item.fromOwner = UniqueID;
                                        Dropped_Item.amount = p.Value.GetQuantity(Type, p.Key);
                                        Dropped_Item.Owner = ((PlayerMgr)GetTarget()).Character.Account.ID;
                                        Dropped_Item.CalculateNewPosition();
                                        Helpers.Manager.WorldItem.Add(Dropped_Item);
                                        Dropped_Item.Send(Client.Packet.ObjectSpawn(Dropped_Item), true);
                                    }
                                }
                            }
                        }
                        #endregion

                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Drop system error: {0}", ex);
            }
        }
        void GMmakeitem(int itemID, byte PlusValue)
        {
            try
            {
                WorldMgr.Items sitem = new WorldMgr.Items();
                sitem.Model = itemID;
                sitem.Ids = new GenerateUniqueID(GenerateUniqueID.IDS.World);
                sitem.UniqueID = sitem.Ids.GetUniqueID;
                sitem.amount = 1;
                sitem.PlusValue = PlusValue;
                sitem.x = Character.Position.x;
                sitem.z = Character.Position.z;
                sitem.y = Character.Position.y;
                sitem.xSec = Character.Position.xSec;
                sitem.ySec = Character.Position.ySec;
                sitem.CalculateNewPosition();
                #region Amount definition
                if (ObjData.Manager.ItemBase[sitem.Model].Equip)
                    sitem.Type = 2;
                else
                    sitem.Type = 3;
                #endregion

                sitem.fromType = 5;
                sitem.fromOwner = 0;
                sitem.downType = false;
                sitem.Owner = Character.Account.ID;
                Helpers.Manager.WorldItem.Add(sitem);

                sitem.Send(Packet.ObjectSpawn(sitem), true);
                Print.Format("[Gameserver:" + Character.Information.Name + " Has created:  {0}", ObjData.Manager.ItemBase[itemID].Name);
            }
            catch (Exception ex)
            {
                Console.WriteLine("GM_MakeItem: {0}", ex);
            }
        }
 /////////////////////////////////////////////////////////////////////////////////
 // Pickup item
 /////////////////////////////////////////////////////////////////////////////////
 void Player_PickUpItem()
 {
     try
     {
         //First check if player allready is picking up an item
         if (Character.Action.PickUping)
         {
             //Get item information that the player has selected.
             WorldMgr.Items item = Helpers.GetInformation.GetWorldItem(Character.Action.Target);
             //Checks
             if (item == null)
             {
                 Character.Action.PickUping = false; return;
             }
             //If the amount is lower then one
             if (item.amount < 1)
             {
                 item.amount = 1;
             }
             //If not gold model
             if (item.Model > 3)
             {
                 //Get our free slots
                 byte slot = GetFreeSlot();
                 //If to low
                 if (slot <= 12)
                 {
                     Character.Action.PickUping = false;
                     client.Send(Packet.MoveItemError());
                     return;
                 }
                 //Else continue stop delete timer because its allready beeing removed.
                 item.StopDeleteTimer();
                 //Remove the world item spawn
                 Helpers.Manager.WorldItem.Remove(item);
                 //Delete the global id
                 GenerateUniqueID.Delete(item.UniqueID);
                 //Move towards the item
                 Send(Packet.StopMovement(new ObjData.vektor(Character.Information.UniqueID,
                                                             (float)Formule.packetx((float)item.x, item.xSec),
                                                             (float)Character.Position.z,
                                                             (float)Formule.packety((float)(float)item.y, item.ySec),
                                                             Character.Position.xSec,
                                                             Character.Position.ySec)));
                 //Send animation packet pickup
                 Send(Packet.Pickup_Animation(Character.Information.UniqueID, 0));
                 //Check what item type we have (Etc, or armor / weapon).
                 int amount = 0;
                 //Set amount or plusvalue
                 #region Amount definition
                 if (ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.BLADE ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.CH_SHIELD ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_SHIELD ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.BOW ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_AXE ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_CROSSBOW ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_DAGGER ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_DARKSTAFF ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_HARP ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_STAFF ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_SWORD ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_TSTAFF ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EU_TSWORD ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.GLAVIE ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.SPEAR ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.SWORD ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.EARRING ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.RING ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.NECKLACE ||
                     ObjData.Manager.ItemBase[item.Model].Type == ObjData.item_database.ArmorType.ARMOR ||
                     ObjData.Manager.ItemBase[item.Model].Type == ObjData.item_database.ArmorType.GARMENT ||
                     ObjData.Manager.ItemBase[item.Model].Type == ObjData.item_database.ArmorType.GM ||
                     ObjData.Manager.ItemBase[item.Model].Type == ObjData.item_database.ArmorType.HEAVY ||
                     ObjData.Manager.ItemBase[item.Model].Type == ObjData.item_database.ArmorType.LIGHT ||
                     ObjData.Manager.ItemBase[item.Model].Type == ObjData.item_database.ArmorType.PROTECTOR ||
                     ObjData.Manager.ItemBase[item.Model].Itemtype == ObjData.item_database.ItemType.AVATAR ||
                     ObjData.Manager.ItemBase[item.Model].Type == ObjData.item_database.ArmorType.ROBE)
                 {
                     amount = item.PlusValue;
                 }
                 else
                 {
                     amount = item.amount;
                 }
                 #endregion
                 //Send item creation packet
                 client.Send(Packet.CREATEITEM(0, slot, item.Model, (short)amount, (int)ObjData.Manager.ItemBase[item.Model].Defans.Durability, ObjData.Manager.ItemBase[item.Model].ID, item.UniqueID));
                 //Save to database
                 AddItem(item.Model, (short)amount, slot, Character.Information.CharacterID, item.Model);
             }
             //If the item is gold
             else
             {
                 //Remove the spawned item
                 Helpers.Manager.WorldItem.Remove(item);
                 //Remove global id
                 GenerateUniqueID.Delete(item.UniqueID);
                 //Movement packet
                 Send(Packet.StopMovement(new ObjData.vektor(Character.Information.UniqueID,
                                                             (float)Formule.packetx((float)item.x, item.xSec),
                                                             (float)Character.Position.z,
                                                             (float)Formule.packety((float)(float)item.y, item.ySec),
                                                             Character.Position.xSec,
                                                             Character.Position.ySec)));
                 //Send animation packet
                 Send(Packet.Pickup_Animation(Character.Information.UniqueID, 0));
                 //Add gold to player information
                 Character.Information.Gold += item.amount;
                 //Send visual packet for gold
                 client.Send(Packet.UpdateGold(Character.Information.Gold));
                 //Send message packet gold gained
                 client.Send(Packet.GoldMessagePick(item.amount));
                 //Save player gold
                 SaveGold();
             }
             //Despawn item for us
             item.DeSpawnMe();
             //Dispose of the item
             item.Dispose();
             //Set picking to false
             Character.Action.PickUping = false;
             if (Timer.Pickup != null)
             {
                 Timer.Pickup.Dispose();
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Pickup Error {0}", ex);
         Log.Exception(ex);
     }
 }
 public void Pet_PickupItem(WorldMgr.Items item)
 {
 }
        /////////////////////////////////////////////////////////////////////////////////
        // Drop Item
        /////////////////////////////////////////////////////////////////////////////////
        void Player_DropItem(byte slot)
        {
            #region Drop Item
            try
            {
                if (Character.Action.nAttack) return;
                if (Character.Action.sAttack) return;
                if (Character.Stall.Stallactive) return;
                if (Character.State.Exchanging) return;
                if (Character.Alchemy.working) return;
                if (Character.State.Busy) return;
                if (Character.Network.Guild.UsingStorage) return;
                //Else we continue
                else
                {
                    //Get item information from slot.
                    ObjData.slotItem item = GetItem((uint)Character.Information.CharacterID, slot, 0);
                    //Check if the item is a item mall item before dropping.
                    if (ObjData.Manager.ItemBase[item.ID].Etctype == ObjData.item_database.EtcType.AVATAR28D ||
                        ObjData.Manager.ItemBase[item.ID].Etctype == ObjData.item_database.EtcType.CHANGESKIN ||
                        ObjData.Manager.ItemBase[item.ID].Etctype == ObjData.item_database.EtcType.GLOBALCHAT ||
                        ObjData.Manager.ItemBase[item.ID].Etctype == ObjData.item_database.EtcType.INVENTORYEXPANSION ||
                        ObjData.Manager.ItemBase[item.ID].Etctype == ObjData.item_database.EtcType.REVERSESCROLL ||
                        ObjData.Manager.ItemBase[item.ID].Etctype == ObjData.item_database.EtcType.STALLDECORATION ||
                        ObjData.Manager.ItemBase[item.ID].Etctype == ObjData.item_database.EtcType.WAREHOUSE ||
                        ObjData.Manager.ItemBase[item.ID].Etctype == ObjData.item_database.EtcType.AVATAR28D ||
                        ObjData.Manager.ItemBase[item.ID].Type == ObjData.item_database.ArmorType.AVATAR ||
                        ObjData.Manager.ItemBase[item.ID].Type == ObjData.item_database.ArmorType.AVATARATTACH ||
                        ObjData.Manager.ItemBase[item.ID].Type == ObjData.item_database.ArmorType.AVATARHAT ||
                        ObjData.Manager.ItemBase[item.ID].Pettype == ObjData.item_database.PetType.ATTACKPET ||
                        ObjData.Manager.ItemBase[item.ID].Pettype == ObjData.item_database.PetType.GRABPET)
                        return;
                    //If the id model is lower then 4 dont allow to drop.
                    //Gold drop requires another drop part.
                    if (item.ID < 4) return;
                    //Anti hack check
                    int owner = Convert.ToInt32(DB.GetData("SELECT * FROM char_items WHERE id='" + item.dbID + "'", "owner"));
                    //If the player really is the owner of this item we continue to drop it.
                    if (owner == Character.Information.CharacterID)
                    {
                        //Check for item amount.
                        if (item.Amount <= ObjData.Manager.ItemBase[item.ID].Max_Stack)
                        {
                            //Spawn new item globally
                            WorldMgr.Items sitem = new WorldMgr.Items();
                            sitem.Model = item.ID;
                            sitem.Ids = new GenerateUniqueID(GenerateUniqueID.IDS.World);
                            sitem.UniqueID = sitem.Ids.GetUniqueID;
                            sitem.amount = item.Amount;
                            sitem.PlusValue = item.PlusValue;
                            sitem.x = Character.Position.x;
                            sitem.z = Character.Position.z;
                            sitem.y = Character.Position.y;
                            sitem.CalculateNewPosition();
                            sitem.xSec = Character.Position.xSec;
                            sitem.ySec = Character.Position.ySec;

                            #region Amount definition
                            if (ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.BLADE ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.CH_SHIELD ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_SHIELD ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.BOW ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_AXE ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_CROSSBOW ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_DAGGER ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_DARKSTAFF ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_HARP ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_STAFF ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_SWORD ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_TSTAFF ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EU_TSWORD ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.GLAVIE ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.SPEAR ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.SWORD ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.EARRING ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.RING ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.NECKLACE ||
                                 ObjData.Manager.ItemBase[sitem.Model].Type == ObjData.item_database.ArmorType.ARMOR ||
                                 ObjData.Manager.ItemBase[sitem.Model].Type == ObjData.item_database.ArmorType.GARMENT ||
                                 ObjData.Manager.ItemBase[sitem.Model].Type == ObjData.item_database.ArmorType.GM ||
                                 ObjData.Manager.ItemBase[sitem.Model].Type == ObjData.item_database.ArmorType.HEAVY ||
                                 ObjData.Manager.ItemBase[sitem.Model].Type == ObjData.item_database.ArmorType.LIGHT ||
                                 ObjData.Manager.ItemBase[sitem.Model].Type == ObjData.item_database.ArmorType.PROTECTOR ||
                                 ObjData.Manager.ItemBase[sitem.Model].Itemtype == ObjData.item_database.ItemType.AVATAR ||
                                 ObjData.Manager.ItemBase[sitem.Model].Type == ObjData.item_database.ArmorType.ROBE)
                                sitem.Type = 2;
                            else
                                sitem.Type = 3;
                            #endregion

                            sitem.fromType = 6;
                            sitem.fromOwner = Character.Information.UniqueID;
                            sitem.downType = false;
                            sitem.Owner = 0;
                            sitem.Send(Packet.ObjectSpawn(sitem), true);
                            Helpers.Manager.WorldItem.Add(sitem);
                            //Send visual packet for removing the item from inventory.
                            client.Send(Packet.DespawnFromInventory(sitem.UniqueID));
                            client.Send(Packet.MoveItem(7, slot, 0, 0, 0, "DELETE_ITEM"));
                            //Update database and remove the item
                            DB.query("delete from char_items where itemnumber='item" + slot + "' AND owner='" + Character.Information.CharacterID + "'");
                            //Save player information
                            SavePlayerInfo();
                        }
                        else
                            return;
                    }
                    //If the player is not the owner of the item beeing dropped we ban the player.
                    else
                    {
                        Disconnect("ban");
                        Log.Exception("Autobanned user: "******" Due to hacking");
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            #endregion
        }
        /////////////////////////////////////////////////////////////////////////////////
        // Drop Gold
        /////////////////////////////////////////////////////////////////////////////////
        void Player_DropGold(ulong Gold)
        {
            #region Drop Gold
            try
            {
                if (Character.Action.nAttack) return;
                if (Character.Action.sAttack) return;
                if (Character.Stall.Stallactive) return;
                if (Character.State.Exchanging) return;
                if (Character.Alchemy.working) return;
                if ((ulong)Character.Information.Gold >= Gold)
                {
                    GetFreeSlot();
                    WorldMgr.Items item = new WorldMgr.Items();
                    item.amount = (int)Gold;
                    item.Model = 1;
                    if (item.amount < 1000) item.Model = 1;
                    else if (item.amount > 1000 && item.amount < 10000) item.Model = 2;
                    else if (item.amount > 10000) item.Model = 3;
                    item.Ids = new GenerateUniqueID(GenerateUniqueID.IDS.World);
                    item.UniqueID = item.Ids.GetUniqueID;
                    item.x = Character.Position.x;
                    item.z = Character.Position.z;
                    item.y = Character.Position.y;
                    item.CalculateNewPosition();
                    item.xSec = Character.Position.xSec;
                    item.ySec = Character.Position.ySec;
                    item.Type = 1;
                    item.fromType = 6;
                    item.Owner = 0;
                    Helpers.Manager.WorldItem.Add(item);
                    item.Send(Packet.ObjectSpawn(item), true);
                    Character.Information.Gold -= (long)Gold;
                    client.Send(Packet.InfoUpdate(1, (int)Character.Information.Gold, 0));
                    client.Send(Packet.MoveItem(0x0A, 0, 0, 0, (long)Gold, "DELETE_GOLD"));
                    SaveGold();
                }
                else
                {
                    client.Send(Packet.Message(OperationCode.SERVER_UPDATEGOLD, Messages.UIIT_MSG_STRGERR_NOT_ENOUGH_GOLD));
                }

            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            #endregion
        }