예제 #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.BagOwner = 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
                });
            }
        }
예제 #2
0
        public void MoveTo(int slot, Client client, bool ground = false, bool bag = false)
        {
            SlotObject slot1 = new SlotObject();
            SlotObject slot2 = new SlotObject();

            slot1.ObjectId   = client.ObjectId;
            slot1.ObjectType = ObjectType;
            slot1.SlotId     = (byte)Slot;
            if (!ground && !bag)
            {
                slot2.ObjectId   = client.ObjectId;
                slot2.ObjectType = slot < 12 ? client.PlayerData.Slot[slot] : client.PlayerData.BackPack[slot - 11];
                slot2.SlotId     = (byte)slot;
            }
            else if (!ground && bag)
            {
                slot2.ObjectId   = client.ObjectId;
                slot2.ObjectType = -1;
                slot2.SlotId     = 1;
            }
            else
            {
                InvDropPacket dropPacket = (InvDropPacket)Packet.Create(PacketType.INVDROP);
                dropPacket.Slot = slot1;
                client.SendToServer(dropPacket);
                return;
            }

            InvSwapPacket swapPacket = (InvSwapPacket)Packet.Create(PacketType.INVSWAP);

            swapPacket.Position    = client.PlayerData.Pos;
            swapPacket.SlotObject1 = slot1;
            swapPacket.SlotObject2 = slot2;
            swapPacket.Time        = client.Time;
            client.SendToServer(swapPacket);
        }
예제 #3
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;

            var entity = Owner.GetEntity(pkt.Slot.ObjectId);
            var 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;
            }

            var 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)
                {
                    BagOwner = AccountId
                };
            }
            else if (item.Undead)
            {
                container = new Container(DEM_BAG, 1000 * 60, true)
                {
                    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)
                {
                    BagOwner = AccountId
                };
            }
            else
            {
                container = new Container(NORM_BAG, 1000 * 60, true);
            }
            var bagx = entity.X + (float)((invRand.NextDouble() * 2 - 1) * 0.5);
            var 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();
                }

                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 " + item.ObjectId +
                                     (container.BagOwner != null ? " (Soulbound)" : ""));
                }
            }
            catch
            {
                Console.Out.WriteLine(Name + " just attempted to dupe.");
            }
        }
예제 #4
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
            {
                Console.Out.WriteLine(Name + " just attempted to dupe.");
                var dir = @"logs"; //start of logging code
                if (!System.IO.Directory.Exists(dir))
                {
                    System.IO.Directory.CreateDirectory(dir);
                }
                using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\VaultDupeLog.txt", true))
                {
                    writer.WriteLine("[" + DateTime.Now + "]" + Name + "has attempted to dupe.");
                } //end of logging code
            }
        }
        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
            {
                Console.Out.WriteLine(Name + " just attempted to dupe.");
            }
        }