Ejemplo n.º 1
0
        public void InventoryDrop(RealmTime time, InvDropPacket pkt)
        {
            //TODO: locker again
            const short NORM_BAG = 0x0500;
            const short SOUL_BAG = 0x0503;

            Entity entity = Owner.GetEntity(pkt.Slot.ObjectId);
            IContainer con = entity as IContainer;
            if (con.Inventory[pkt.Slot.SlotId] == null) return;

            Item item = con.Inventory[pkt.Slot.SlotId];
            con.Inventory[pkt.Slot.SlotId] = null;
            entity.UpdateCount++;

            Container container;
            if (item.Soulbound)
            {
                container = new Container(SOUL_BAG, 1000 * 60, true);
                container.BagOwners = new int[] { AccountId };
            }
            else
                container = new Container(NORM_BAG, 1000 * 60, true);
            container.Inventory[0] = item;
            container.Move(entity.X + (float)((invRand.NextDouble() * 2 - 1) * 0.5), entity.Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5));
            container.Size = 75;
            Owner.EnterWorld(container);

            if (entity is Player)
            {
                (entity as Player).CalcBoost();
                (entity as Player).Client.SendPacket(new InvResultPacket()
                {
                    Result = 0
                });
            }
        }
Ejemplo n.º 2
0
        public void InventoryDrop(RealmTime time, InvDropPacket pkt)
        {
            //TODO: locker again
            const short NORM_BAG = 0x0500;
            const short SOUL_BAG = 0x0503;
            const short PDEM_BAG = 0xffd;
            const short DEM_BAG = 0xffe;
            const short SDEM_BAG = 0xfff;

            Entity entity = Owner.GetEntity(pkt.Slot.ObjectId);
            IContainer con = entity as IContainer;
            if (con.Inventory[pkt.Slot.SlotId] == null) return;

            if ((entity is Player) && (entity as Player).Decision == 1)
            {
                (entity as Player).Client.SendPacket(new InvResultPacket() { Result = 1 });
                return;
            }

            Item item = con.Inventory[pkt.Slot.SlotId];
            con.Inventory[pkt.Slot.SlotId] = null;
            entity.UpdateCount++;

            Container container;
            if (item.Soulbound)
            {
                container = new Container(SOUL_BAG, 1000 * 60, true);
                container.BagOwner = AccountId;
            }
            else if (item.Undead)
            {
                container = new Container(DEM_BAG, 1000 * 60, true);
                container.BagOwner = AccountId;
            }
            else if (item.PUndead)
            {
                container = new Container(PDEM_BAG, 1000 * 60, true);
            }
            else if (item.SUndead)
            {
                container = new Container(SDEM_BAG, 1000 * 60, true);
                container.BagOwner = AccountId;
            }
            else
            {
                container = new Container(NORM_BAG, 1000 * 60, true);
            }
            float bagx = entity.X + (float)((invRand.NextDouble() * 2 - 1) * 0.5);
            float bagy = entity.Y + (float)((invRand.NextDouble() * 2 - 1) * 0.5);
            try
            {
                container.Inventory[0] = item;
                container.Move(bagx, bagy);
                container.Size = 75;
                Owner.EnterWorld(container);

                if (entity is Player)
                {
                    (entity as Player).CalcBoost();
                    (entity as Player).Client.SendPacket(new InvResultPacket()
                    {
                        Result = 0
                    });
                    (entity as Player).Client.Save();
                }
            }
            catch
            {
                logger.Warn(Name + " just attempted to dupe.");
            }
        }