public static void DisplayTo(Mobile user, bool refreshOnly, Dungeon dungeon) { var info = EnumerateInstances <DungeonLootUI>(user).FirstOrDefault(g => g != null && !g.IsDisposed && g.IsOpen); if (info == null) { if (refreshOnly) { return; } info = new DungeonLootUI(user, dungeon); } else if (info.Dungeon == dungeon && info.EntryCount >= info.EntriesPerPage) { return; } if (dungeon != null && !dungeon.Deleted) { info.Dungeon = dungeon; } info.Refresh(true); }
protected virtual void ProcessLoot() { if (_ProcessingLoot || Loot == null || Loot.Count == 0) { return; } _ProcessingLoot = true; Loot.RemoveAll( e => { if (e == null) { return(true); } if (!e.Valid || e.HasWinner) { e.Free(); return(true); } return(false); }); if (Loot.Count == 0) { Loot.Free(false); _ProcessingLoot = false; return; } var now = DateTime.UtcNow; var players = new List <PlayerMobile>(); var count = Loot.Count; while (--count >= 0) { var e = Loot[count]; if (e.Process(e.Expire < now)) { Loot.Remove(e); e.Free(); } else { DungeonLootUI dui; foreach ( var kv in e.Rolls.Where(kv => kv.Value == null && kv.Key != null && !kv.Key.Deleted && !players.Contains(kv.Key))) { dui = SuperGump.EnumerateInstances <DungeonLootUI>(kv.Key).FirstOrDefault(ui => ui != null && !ui.IsDisposed); if (dui == null || dui.Dungeon != this) { players.AddOrReplace(kv.Key); } if (dui == null) { continue; } if (!Loot.Where(loot => loot.Rolls.ContainsKey(kv.Key) && loot.Rolls[kv.Key] == null).All(dui.List.Contains)) { players.AddOrReplace(kv.Key); } } } } players.ForEach(m => DungeonLootUI.DisplayTo(m, false, this)); players.Free(true); _ProcessingLoot = false; }