Ejemplo 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);
            }
        }
Ejemplo n.º 2
0
 public void AddDrop(Drop drop)
 {
     Drops.Add(drop.ID, drop);
     using (var spawn = Handler7.ShowDrop(drop))
     {
         Broadcast(spawn);
     }
 }
Ejemplo n.º 3
0
 public void RemoveDrop(Drop drop)
 {
     if (Drops.Remove(drop.ID))
     {
         using (var removedrop = Handler6.RemoveDrop(drop))
         {
             Broadcast(removedrop);
         }
     }
 }
Ejemplo 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;
            }
        }
Ejemplo n.º 5
0
        public void DropItem(Item Item)
        {
            var mDrop = new Drop(Item, this, Position.X, Position.Y, 300);

            Map.AddDrop(mDrop);
        }
Ejemplo 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);
 }
Ejemplo 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);
        }
Ejemplo 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;
     }
 }
Ejemplo n.º 9
0
 public static Packet RemoveDrop(Drop drop)
 {
     Packet packet = new Packet(SH6Type.RemoveDrop);
     packet.WriteUShort(drop.ID);
     return packet;
 }
Ejemplo 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);
        }
Ejemplo n.º 11
0
 public static Packet ShowDrop(Drop drop)
 {
     Packet packet = new Packet(SH7Type.ShowDrop);
     drop.Write(packet);
     return packet;
 }
Ejemplo 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);
        }