static Report CompileTop15() { var report = new Report("Top 15 Duelists", "80%"); report.Columns.Add("6%", "center", "Rank"); report.Columns.Add("6%", "center", "Level"); report.Columns.Add("6%", "center", "Guild"); report.Columns.Add("70%", "left", "Name"); report.Columns.Add("6%", "center", "Wins"); report.Columns.Add("6%", "center", "Losses"); var ladder = Ladder.Instance; if (ladder != null) { var entries = ladder.ToArrayList(); for (var i = 0; i < entries.Count && i < 15; ++i) { var entry = (LadderEntry)entries[i]; var level = Ladder.GetLevel(entry.Experience); var guild = string.Empty; if (entry.Mobile.Guild != null) { guild = entry.Mobile.Guild.Abbreviation; } var item = new ReportItem(); item.Values.Add(LadderGump.Rank(entry.Index + 1)); item.Values.Add(level.ToString(), "N0"); item.Values.Add(guild); item.Values.Add(entry.Mobile.Name); item.Values.Add(entry.Wins.ToString(), "N0"); item.Values.Add(entry.Losses.ToString(), "N0"); report.Items.Add(item); } } return(report); }
public CTFBoardGump(Mobile mob, CTFGame game, CTFTeamInfo section = null) : base(60, 60) { m_Game = game; var ourTeam = game.GetTeamInfo(mob); var entries = new List <IRankedCTF>(); if (section == null) { for (var i = 0; i < game.Context.Participants.Count; ++i) { var teamInfo = game.Controller.TeamInfo[i % 8]; if (teamInfo?.Flag == null) { continue; } entries.Add(teamInfo); } } else { foreach (var player in section.Players.Values) { if (player.Score > 0) { entries.Add(player); } } } entries.Sort((a, b) => b.Score - a.Score); var height = 0; if (section == null) { height = 73 + entries.Count * 75 + 28; } Closable = false; AddPage(0); AddBackground(1, 1, 398, height, 3600); AddImageTiled(16, 15, 369, height - 29, 3604); for (var i = 0; i < entries.Count; i += 1) { AddImageTiled(22, 58 + i * 75, 357, 70, 0x2430); } AddAlphaRegion(16, 15, 369, height - 29); AddImage(215, -45, 0xEE40); // AddImage( 330, 141, 0x8BA ); AddBorderedText(22, 22, 294, 20, Center("CTF Scoreboard"), LabelColor32, BlackColor32); AddImageTiled(32, 50, 264, 1, 9107); AddImageTiled(42, 52, 264, 1, 9157); if (section == null) { for (var i = 0; i < entries.Count; ++i) { var teamInfo = entries[i] as CTFTeamInfo; if (teamInfo == null) { continue; } AddImage(30, 70 + i * 75, 10152); AddImage(30, 85 + i * 75, 10151); AddImage(30, 100 + i * 75, 10151); AddImage(30, 106 + i * 75, 10154); AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1); var nameColor = LabelColor32; var borderColor = BlackColor32; switch (teamInfo.Color) { case 0x47E: nameColor = 0xFFFFFF; break; case 0x4F2: nameColor = 0x3399FF; break; case 0x4F7: nameColor = 0x33FF33; break; case 0x4FC: nameColor = 0xFF00FF; break; case 0x021: nameColor = 0xFF3333; break; case 0x01A: nameColor = 0xFF66FF; break; case 0x455: nameColor = 0x333333; borderColor = 0xFFFFFF; break; } AddBorderedText( 60, 65 + i * 75, 250, 20, $"{LadderGump.Rank(1 + i)}: {teamInfo.Name} Team", nameColor, borderColor ); AddBorderedText(50 + 10, 85 + i * 75, 100, 20, "Score:", 0xFFC000, BlackColor32); AddBorderedText(50 + 15, 105 + i * 75, 100, 20, teamInfo.Score.ToString("N0"), 0xFFC000, BlackColor32); AddBorderedText(110 + 10, 85 + i * 75, 100, 20, "Kills:", 0xFFC000, BlackColor32); AddBorderedText(110 + 15, 105 + i * 75, 100, 20, teamInfo.Kills.ToString("N0"), 0xFFC000, BlackColor32); AddBorderedText(160 + 10, 85 + i * 75, 100, 20, "Captures:", 0xFFC000, BlackColor32); AddBorderedText( 160 + 15, 105 + i * 75, 100, 20, teamInfo.Captures.ToString("N0"), 0xFFC000, BlackColor32 ); var pl = teamInfo.Leader; AddBorderedText(235 + 10, 85 + i * 75, 250, 20, "Leader:", 0xFFC000, BlackColor32); if (pl != null) { AddBorderedText(235 + 15, 105 + i * 75, 250, 20, pl.Player.Name, 0xFFC000, BlackColor32); } } } AddButton(314, height - 42, 247, 248, 1); }
public PlayerDetailGump(PlayerMobile from, PlayerMobile mobile) { _from = from; _mobile = mobile; Width = 320; int n = Notoriety.Compute(from, mobile); int notoColor = _notorietyColors[n]; AddBorderedText(20, 18, Width - 40, 20, Center(mobile.Name ?? "Unknown"), notoColor, BlackColor32); AddSeperator(30, 40, Width - 60); const int LabelOffset = 20; const int LabelWidth = 55; const int ValueOffset = 25 + LabelWidth; int ValueWidth = Width - (20 + ValueOffset); int y = 44; PlayerMobile pm = mobile as PlayerMobile; Guild guild = mobile.Guild as Guild; if (guild != null) { AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Guild:"), LabelColor32, BlackColor32); AddBorderedText(ValueOffset, y, ValueWidth, 20, guild.Name ?? "Unknown", WhiteColor32, BlackColor32); y += 20; } if (mobile.PublicMyRunUO && mobile.Kills >= 5) { AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Kills:"), LabelColor32, BlackColor32); AddBorderedText(ValueOffset, y, ValueWidth, 20, mobile.Kills.ToString("N0"), WhiteColor32, BlackColor32); y += 20; } Account acct = mobile.Account as Account; if (acct != null) { TimeSpan age = DateTime.UtcNow - acct.Created; int ageInDays = ( int )age.TotalDays; int ageInYears = ((ageInDays + 162) / 365); int ageInMonths = ((ageInDays + 15) / 30); int ageInWeeks = ((ageInDays + 3) / 7); string ageString; if (ageInYears > 0) { ageString = String.Format("{0:N0} year{1}", ageInYears, ageInYears == 1?"":"s"); } else if (ageInMonths > 1) { ageString = String.Format("{0:N0} month{1}", ageInMonths, ageInMonths == 1?"":"s"); } else if (ageInWeeks > 1) { ageString = String.Format("{0:N0} week{1}", ageInWeeks, ageInWeeks == 1?"":"s"); } else { ageString = String.Format("Newbie", ageInDays, ageInDays == 1?"":"s"); } AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Age:"), LabelColor32, BlackColor32); AddBorderedText(ValueOffset, y, ValueWidth, 20, ageString, WhiteColor32, BlackColor32); y += 20; } PlayerState ps = PlayerState.Find(mobile); if (ps != null) { Faction fac = ps.Faction; //AddItem( Width - 51, 7, 5535, (fac.Definition.HueSecondary ^ 0x0000) - 1 ); AddItem(7, 7, 5534, (fac.Definition.HuePrimary ^ 0x0000) - 1); y += 8; AddBorderedText(LabelOffset, y, LabelWidth + ValueWidth, 20, fac.Definition.FriendlyName, WhiteColor32, BlackColor32); y += 21; AddSeperator(30, y, Width - 60); y += 3; string rank = String.Format( "Level {0} {1}", ps.Rank.Rank, ps.Rank.Title.String ); AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Rank:"), LabelColor32, BlackColor32); AddBorderedText(ValueOffset, y, ValueWidth, 20, rank, WhiteColor32, BlackColor32); y += 20; AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Points:"), LabelColor32, BlackColor32); AddBorderedText(ValueOffset, y, ValueWidth, 20, String.Format("{0:N0}", ps.KillPoints), WhiteColor32, BlackColor32); y += 20; } Ladder instance = Ladder.Instance; if (instance != null) { LadderEntry entry = instance.Find(mobile); if (entry != null && (entry.Wins + entry.Losses) > 0) { y += 8; AddBorderedText(LabelOffset, y, LabelWidth + ValueWidth, 20, "Duelist", WhiteColor32, BlackColor32); y += 21; AddSeperator(30, y, Width - 60); y += 3; string rank = LadderGump.Rank(entry.Index + 1); AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Rank:"), LabelColor32, BlackColor32); AddBorderedText(ValueOffset, y, ValueWidth, 20, rank, WhiteColor32, BlackColor32); y += 20; AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Level:"), LabelColor32, BlackColor32); AddBorderedText(ValueOffset, y, ValueWidth, 20, Ladder.GetLevel(entry.Experience).ToString("N0"), WhiteColor32, BlackColor32); y += 20; AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Matches:"), LabelColor32, BlackColor32); AddBorderedText(ValueOffset, y, ValueWidth, 20, String.Format("{0:N0}", (entry.Wins + entry.Losses)), WhiteColor32, BlackColor32); y += 20; } } Height = y + 12; Ethic ethic = Ethic.Find(mobile); if (ethic == Ethic.Hero) { AddItem(Width - 36, Height - 26, 7188); } else if (ethic == Ethic.Evil) { AddItem(Width - 35, Height - 36, 6232); } }