Esempio n. 1
0
        public void AddDrop(Drop drop)
        {
            ushort key = 0;

            if (availableDropKeys.Count > 0)
            {
                key = availableDropKeys.Dequeue();
            }
            else
            {
                if (dropIndexer == ushort.MaxValue)
                {
                    Log.WriteLine(LogLevel.Warn, "Drop buffer overflow at map {0}.", this.MapInfo.ShortName);
                    return;
                }
                else
                {
                    key = dropIndexer++;
                }
            }

            if (Drops.TryAdd(key, drop))
            {
                drop.ID        = key;
                drop.MapSector = GetSectorByPos(drop.Position);
                drop.MapSector.AddDrop(drop);
            }
            else
            {
                Log.WriteLine(LogLevel.Warn, "Failed to add drop at map {0}.", this.MapInfo.ShortName);
            }
        }
Esempio n. 2
0
 public void AddDrop(Drop drop)
 {
     Drops.Add(drop.ID, drop);
     using (var spawn = Handler7.ShowDrop(drop))
     {
         Broadcast(spawn);
     }
 }
Esempio n. 3
0
 public void RemoveDrop(Drop drop)
 {
     if (Drops.Remove(drop.ID))
     {
         using (var removedrop = Handler6.RemoveDrop(drop))
         {
             Broadcast(removedrop);
         }
     }
 }
Esempio n. 4
0
        public void RemoveDrop(Drop drop)
        {
            if (drop.MapSector == null)
            {
                Log.WriteLine(LogLevel.Warn, "Tried to remove drop where sectors wasn't assigned.");
                return;
            }
            Drop test;

            if (Drops.TryRemove(drop.ID, out test) && test == drop)
            {
                availableDropKeys.Enqueue(drop.ID);
                drop.MapSector.RemoveDrop(drop);
                drop.MapSector = null;
            }
        }
Esempio n. 5
0
        public void DropItem(Item Item)
        {
            var mDrop = new Drop(Item, this, Position.X, Position.Y, 300);

            Map.AddDrop(mDrop);
        }
Esempio n. 6
0
 public void DropItem(Item item)
 {
     Drop drop = new Drop(item, this, Position.X, Position.Y, 120);
     if(drop == null)
     return;
     this.Inventory.InventoryItems.Remove((byte)item.Slot);
     item.Delete();
     Handler12.ModifyInventorySlot(this, 0x24, (byte)item.Slot, 0, null);
     Map.AddDrop(drop);
 }
Esempio n. 7
0
        public void AddDrop(Drop drop)
        {
            ushort key = 0;
            if (availableDropKeys.Count > 0)
            {
                key = availableDropKeys.Dequeue();
            }
            else
            {
                if (dropIndexer == ushort.MaxValue)
                {
                    Log.WriteLine(LogLevel.Warn, "Drop buffer overflow at map {0}.", this.MapInfo.ShortName);
                    return;
                }
                else
                    key = dropIndexer++;
            }

            if (Drops.TryAdd(key, drop))
            {
                drop.ID = key;
                drop.MapSector = GetSectorByPos(drop.Position);
                drop.MapSector.AddDrop(drop);
            }
            else Log.WriteLine(LogLevel.Warn, "Failed to add drop at map {0}.", this.MapInfo.ShortName);
        }
Esempio n. 8
0
 public void RemoveDrop(Drop drop)
 {
     if (drop.MapSector == null)
     {
         Log.WriteLine(LogLevel.Warn, "Tried to remove drop where sectors wasn't assigned.");
         return;
     }
     Drop test;
     if (Drops.TryRemove(drop.ID, out test) && test == drop)
     {
         availableDropKeys.Enqueue(drop.ID);
         drop.MapSector.RemoveDrop(drop);
         drop.MapSector = null;
     }
 }
Esempio n. 9
0
 public static Packet RemoveDrop(Drop drop)
 {
     Packet packet = new Packet(SH6Type.RemoveDrop);
     packet.WriteUShort(drop.ID);
     return packet;
 }
Esempio n. 10
0
        public void DropItem(Item Item)
        {
            Drop mDrop = new Drop(Item, this, this.Position.X, this.Position.Y, 300);

            this.Map.AddDrop(mDrop);
        }
Esempio n. 11
0
 public static Packet ShowDrop(Drop drop)
 {
     Packet packet = new Packet(SH7Type.ShowDrop);
     drop.Write(packet);
     return packet;
 }
Esempio n. 12
0
        public void DropItem(Item Item)
        {
            Drop mDrop = new Drop(Item, this, this.Position.X, this.Position.Y, 300);

            this.Map.AddDrop(mDrop);
        }