wServer.realm.entities.player.Player.DropBag C# (CSharp) Method

DropBag() public method

public DropBag ( Item i ) : void
i Item
return void
        public void DropBag(Item i)
        {
            short bagId = 0x0500;
            var soulbound = false;
            if (i.Soulbound)
            {
                bagId = 0x0503;
                soulbound = true;
            }
            else if (i.Undead)
            {
                bagId = 0xffe;
                soulbound = true;
            }
            else if (i.SUndead)
            {
                bagId = 0xfff;
                soulbound = true;
            }
            else if (i.PUndead)
            {
                bagId = 0xffd;
            }

            var container = new Container(bagId, 1000*60, true);
            if (soulbound)
                container.BagOwner = AccountId;
            container.Inventory[0] = i;
            container.Move(X + (float) ((invRand.NextDouble()*2 - 1)*0.5),
                Y + (float) ((invRand.NextDouble()*2 - 1)*0.5));
            container.Size = 75;
            Owner.EnterWorld(container);

            if (Owner is Vault)
                if ((Owner as Vault).psr.Account.Name == psr.Account.Name)
                    return;

            const string dir = @"logs";
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            using (var writer = new StreamWriter(@"logs\DropLog.log", true))
            {
                writer.WriteLine(Name + " dropped a " + i.ObjectId + (soulbound ? " (Soulbound)" : ""));
            }
        }