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); } }
public void AddDrop(Drop drop) { Drops.Add(drop.ID, drop); using (var spawn = Handler7.ShowDrop(drop)) { Broadcast(spawn); } }
public void RemoveDrop(Drop drop) { if (Drops.Remove(drop.ID)) { using (var removedrop = Handler6.RemoveDrop(drop)) { Broadcast(removedrop); } } }
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; } }
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); }
public void DropItem(Item item) { Drop drop; if (item is Equip) { drop = new Drop(item as Equip, this, Position.X, Position.Y, 120); } else { drop = new Drop(item, this, Position.X, Position.Y, 120); } InventoryItems.Remove(item.Slot); item.Remove(); Handler12.ModifyInventorySlot(this, 0x24, (byte)item.Slot, 0, null); Map.AddDrop(drop); }
public static Packet ShowDrop(Drop drop) { Packet packet = new Packet(SH7Type.ShowDrop); drop.Write(packet); return packet; }
public static Packet RemoveDrop(Drop drop) { Packet packet = new Packet(SH6Type.RemoveDrop); packet.WriteUShort(drop.ID); return packet; }
public void DropItem(Item Item) { Drop mDrop = new Drop(Item, this, this.Position.X, this.Position.Y, 300); this.Map.AddDrop(mDrop); }
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); }