public Dungeon(string name, List<Room> rooms) : base() { //ID = Guid.NewGuid(); Name = name; Rooms = rooms; Dungeons.Add(this); }
private void ComposeDungeons() { int teleportindex = -1; HashSet <SCTeleport> usedEnterTeles = new HashSet <SCTeleport>(new SCTEleportTargetEqualityComparer()); foreach (var et in enter.Select(e => new SCTeleport(e, SCPointOfInterestType.OwEntrance))) { teleportindex++; if (usedEnterTeles.Contains(et)) { continue; } Dungeons.Add(new SCDungeon(et, (OverworldTeleportIndex)teleportindex, scmaps, usedEnterTeles)); } }
public void Add(Play play, int begin, int end) { var playes = Plays.SingleOrDefault(p => p.Name == play.Name); if (playes == null) { Plays.Add(play); var dungeon = new Dungeon(begin, end, play, user); Dungeons.Add(dungeon); } else { var dungeon = new Dungeon(begin, end, play, user); Dungeons.Add(dungeon); } Save(); }
public static bool EnterDungeon(PlayerMobile pm, DungeonInfo info, bool confirm) { if (pm == null || pm.Deleted || info == null || info.ID == DungeonID.None) { return(false); } if (confirm) { var html = new StringBuilder(); html.AppendLine(info.Desc.WrapUOHtmlColor(Color.PaleGoldenrod)); html.AppendLine(); html.AppendLine("You are about to enter {0}.", info.Name); html.AppendLine( "You have {0} to complete your raid...", info.Duration.ToSimpleString("!d# days #h# hours #m# minutes and #s# seconds#")); html.AppendLine(); html.AppendLine("Click OK to enter {0}!", info.Name); new ConfirmDialogGump(pm) { Width = 500, Height = 400, Title = info.Name, Html = html.ToString(), HtmlColor = Color.White, AcceptHandler = b => EnterDungeon(pm, info, false) }.Send(); return(false); } if (info.Expansion != Expansion.None && pm.NetState != null && !pm.NetState.SupportsExpansion(info.Expansion, false)) { pm.SendMessage(0x22, "The {0} expansion is required to enter {1}.", info.Expansion, info.Name); return(false); } TimeSpan lockout; if (IsLockedOut(pm, info.ID, out lockout)) { pm.SendMessage( 0x22, "You must wait {0} before you can enter {1} again.", lockout.ToSimpleString("!d# days #h# hours #m# minutes and #s# seconds#"), info.Name); var ui = new TimeBoostsUI(pm, null, TimeBoosts.TimeBoosts.EnsureProfile(pm)) { Title = info.Name, SubTitle = "Reduce Wait?", SummaryText = "Next Raid", GetTime = () => GetLockout(pm, info.ID), SetTime = t => SetLockout(pm, info.ID, t) }; ui.BoostUsed = b => { if (IsLockedOut(pm, info.ID, out lockout)) { pm.SendMessage( 0x22, "You must wait {0} before you can enter {1} again.", lockout.ToSimpleString("!d# days #h# hours #m# minutes and #s# seconds#"), info.Name); } else { ui.Close(true); EnterDungeon(pm, info, false); } }; ui.Send(); return(false); } var party = Party.Get(pm); var isParty = false; Dungeon dungeon = null; if (party != null && party.Leader is PlayerMobile && party.Leader != pm) { isParty = true; var pl = (PlayerMobile)party.Leader; dungeon = Dungeons.Values.FirstOrDefault( d => d != null && !d.Deleted && d.ID == info.ID && (d.Group.Count == 0 || d.Group.Contains(pl))); } if (dungeon == null && isParty) { pm.SendMessage(0x22, "Your party leader must be the first to enter {0}.", info.Name); return(false); } if (dungeon == null) { dungeon = Dungeons.Values.FirstOrDefault( d => d != null && !d.Deleted && d.ID == info.ID && (d.Group.Count == 0 || d.Group.Contains(pm))); } if (dungeon != null && dungeon.Group.Count(gp => gp != null && gp != pm && gp.Map == dungeon.Map) >= dungeon.GroupMax) { pm.SendMessage(0x22, "{0} is currently at maximum capacity.", info.Name); return(false); } if (dungeon == null || dungeon.Deleted) { dungeon = info.Type.CreateInstanceSafe <Dungeon>(); if (dungeon != null && !dungeon.Deleted) { Dungeons.Add(dungeon.Serial, dungeon); } } if (dungeon != null && !dungeon.Deleted) { dungeon.Init(); var lifespan = dungeon.Deadline - DateTime.UtcNow; if (dungeon.Map == null || dungeon.Map.Deleted || lifespan <= TimeSpan.Zero) { pm.SendMessage(0x22, "A rip in the fabric of reality prevents you from entering {0}.", info.Name); if (dungeon.Group.Count == 0 || (dungeon.Group.Count == 1 && dungeon.Group.Contains(pm))) { dungeon.Delete(); } return(false); } if (dungeon.Entrance == Point3D.Zero || !dungeon.CanEnterDungeon(pm)) { pm.SendMessage(0x22, "Mystical forces prevent you from entering {0}.", info.Name); if (dungeon.Group.Count == 0 || (dungeon.Group.Count == 1 && dungeon.Group.Contains(pm))) { dungeon.Delete(); } return(false); } string time = lifespan.ToSimpleString("!d# days #h# hours #m# minutes and #s# seconds#"); /*if (lifespan.TotalDays > 1.0) * { * time = String.Format("{0:#,0} days", (int)lifespan.TotalDays); * } * else if (lifespan.TotalHours > 1.0) * { * time = String.Format("{0:#,0} hours", (int)lifespan.TotalHours); * } * else if (lifespan.TotalMinutes > 1.0) * { * time = String.Format("{0:#,0} minutes", (int)lifespan.TotalMinutes); * } * else * { * time = String.Format("{0:#,0} seconds", (int)lifespan.TotalSeconds); * }*/ pm.SendMessage(0x55, "You have {0} before reality breaks down and {1} ceases to exist.", time, info.Name); dungeon.Teleport(pm, dungeon.Entrance, dungeon.Map); dungeon.OnEnterDungeon(pm); return(true); } pm.SendMessage(0x22, "{0} is currently unavailable.", info.Name); return(false); }