コード例 #1
0
ファイル: Looter.cs プロジェクト: Buguslavv/kedrahcore
        private bool Proxy_ReceivedContainerOpenIncomingPacket(IncomingPacket packet)
        {
            if (Enabled && Looting && LootItems.Count > 0)
            {
                ContainerOpenPacket p = (ContainerOpenPacket)packet;
                Thread handler        = new Thread(new ThreadStart(delegate()
                {
                    AutoResetEvent ev = new AutoResetEvent(false);
                    Thread thread     = new Thread(new ThreadStart(delegate()
                    {
                        IsLooting = true;
                        Core.Player.Stop();
                        Thread.Sleep(100);
                        Loot(p.Id);
                    }));

                    thread.Priority = ThreadPriority.AboveNormal;
                    thread.Start();

                    if (!ev.WaitOne(2000))
                    {
                        thread.Abort();
                    }

                    IsLooting = false;
                }));
                handler.Start();
            }

            return(true);
        }
コード例 #2
0
        bool Proxy_ReceivedContainerOpenIncomingPacket(IncomingPacket packet)
        {
            if (_autoLoot && _lootItems.Count > 0)
            {
                ContainerOpenPacket p = (ContainerOpenPacket)packet;

                bool lootContainer = isLootContainer(p.Id);

                if (lootContainer && !Tibia.Constants.ItemLists.Container.ContainsKey(p.ItemId))
                {
                    Scheduler.AddTask(new Action(autoLoot), null, 200);
                }
                else if (!lootContainer)
                {
                    p.Name = "Container " + (p.Id + 1);

                    if (_autoLootWait == AutoLootWait_t.OPEN_NEW_LOOT_CONTAINER)
                    {
                        _autoLootWait = AutoLootWait_t.STOP;
                        Scheduler.AddTask(new Action(autoLoot), null, 100);
                    }
                }
            }

            return(true);
        }
コード例 #3
0
        private bool Proxy_ReceivedContainerOpenIncomingPacket(IncomingPacket packet)
        {
            if (OpenSmall)
            {
                ContainerOpenPacket p     = (ContainerOpenPacket)packet;
                List <Item>         items = p.Items;
                p.Items = new List <Item>();
                p.Send();
                p.Items = items;
            }

            return(true);
        }
コード例 #4
0
        public override void OnOpen(Player player)
        {
            base.OnOpen(player);

            ContainerOpenPacket pk = new ContainerOpenPacket();

            pk.WindowId = this.Type;
            pk.Type     = this.Type;
            InventoryHolder holder = this.Holder;

            pk.Position = new Vector3(holder.X, holder.Y, holder.Z);
            player.SendPacket(pk);
        }
コード例 #5
0
        public void SendContainerOpen(Container container, byte containerId)
        {
            NetworkMessage message = new NetworkMessage();

            ContainerOpenPacket.Add(
                message,
                containerId,
                container.Info.SpriteId,
                "Container",
                container.Volume,
                container.Parent != null,
                container.Items
                );

            Send(message);
        }
コード例 #6
0
        public override void OnOpen(Player player)
        {
            base.OnOpen(player);

            ContainerOpenPacket pk = new ContainerOpenPacket
            {
                WindowId = player.Inventory.OpendWindowId,
                Type     = this.Type
            };
            InventoryHolder holder = this.Holder;

            pk.Position = new BlockCoordinate3D((int)holder.X, (int)holder.Y, (int)holder.Z);
            player.SendPacket(pk);

            this.SendContents(player);
        }