public virtual object ToStats() { return(new { isEnded = IsEnded, winnerNames = Winners.Select(p => p.Name) }); }
public Victory(IList <IPlayer> winners, Notification popup) { Winners = winners.ToImmutableList(); Popup = popup; var winnerNames = string.Join(", ", Winners.Select(winner => winner.Name)); WinnersList = Notification.Popup(DayKey.Congratulations, winnerNames); }
public virtual object ToClient() { return(new { table = new { activePlayerName = Table.ActivePlayer?.Name, }, isEnded = IsEnded, winnerNames = Winners.Select(p => p.Name) }); }
public object ToClient() { return(new { gameName = GameName, instanceGameName = InstanceGameName, token = Token, status = Status.ToString(), playerNames = Players.Select(p => p.Name), game = Game?.ToClient(), stats = GetStats(), winnerNames = Winners.Select(p => p.Name) }); }
public override void Stop() { Program.MainForm.LogDebug("Stopping." + Environment.StackTrace); End?.Stop(); End = null; List <Character> Winners; List <Character> Losers; if (SnowballMap.GetWinner() == SnowballEventState.MAPLE_WIN) { Winners = MapleTeam.ToList(); Losers = StoryTeam.ToList(); } else { Winners = StoryTeam.ToList(); Losers = MapleTeam.ToList(); } _log.Info("Total players: " + (Winners.Count + Losers.Count)); _log.Info("Winners: " + string.Join(", ", Winners.Select(x => x.Name))); _log.Info("Losers: " + string.Join(", ", Losers.Select(x => x.Name))); Winners.ForEach(c => { MapPacket.MapEffect(c, 4, "Coconut/Victory", true); MapPacket.MapEffect(c, 3, "event/coconut/victory", true); }); Losers.ForEach(c => { MapPacket.MapEffect(c, 4, "Coconut/Failed", true); MapPacket.MapEffect(c, 3, "event/coconut/lose", true); }); RepeatingAction.Start("snowball warper", e => { Winners.ForEach(c => c.ChangeMap(WinMapId)); Losers.ForEach(c => c.ChangeMap(LoseMapId)); SnowballMap.TimerEndTime = MasterThread.CurrentTime; MapleTeam.Clear(); StoryTeam.Clear(); SnowballMap.Reset(); base.Stop(); }, 10 * 1000, 0); }
public GameChangeResult End(GameAction endAction) { IsEnded = true; EndAction = endAction; // transition lock status if (HasLock) { PlayerCups.First(pc => pc.LockStatus == LockStatus.Locking).LockStatus = LockStatus.Unavailable; } // highlight matching dices foreach (var matchingDice in PlayerCups.SelectMany(pc => pc.Dices).Where(d => d.Value == Dice.Value || d.Value == 1)) { matchingDice.IsHighlighted = true; } // check if table ends var playersWithDices = PlayerCups.Where(pc => pc.DicesQuantity > 0).Select(pc => pc.Player); if (playersWithDices.Count() == 1) { Table.End(playersWithDices); } var gameEndResult = new GameChangeResult(new { actualQuantity = ActualQuantity, playerCups = PlayerCups.Select(pc => pc.ToClient()), table = new { status = Table.Status.ToString(), activePlayerName = Table.ActivePlayer?.Name, stats = Table.GetStats(), winnerNames = Table.Winners.Select(p => p.Name) }, isEnded = IsEnded, winnerNames = Winners.Select(p => p.Name), endActionName = EndAction?.Name, diceLoserName = DiceLoser?.Name, diceWinnerName = DiceWinner?.Name }); return(gameEndResult); }
protected override void CompileLayout(SuperGumpLayout layout) { base.CompileLayout(layout); layout.Remove("button/header/options"); layout.Remove("label/header/title"); layout.AddReplace( "background/header/base", () => { AddBackground(0, 0, 520, 50, 9270); AddImageTiled(10, 10, 500, 30, 2624); }); layout.Add("label/header/close", () => AddLabel(450, 15, 1287, "Close")); layout.AddReplace("button/header/minimize", () => AddButton(490, 20, 10740, 10742, Close)); layout.Add( "label/header/winners", () => AddLabel(180, 14, HighlightHue, "Winners: " + String.Join(", ", Winners.Select(t => t.Name)))); if (Minimized) { return; } layout.AddReplace("imagetiled/body/spacer", () => AddImageTiled(0, 50, 520, 10, 9274)); Dictionary <int, KeyValuePair <PlayerMobile, PvPProfileHistoryEntry> > range = GetListRange(); if (range.Count == 0) { layout.AddReplace( "background/body/base", () => { AddBackground(0, 55, 520, 520, 9270); AddImageTiled(10, 65, 500, 500, 2624); }); layout.Remove("imagetiled/body/vsep/0"); } else { layout.AddReplace( "background/body/base", () => { AddBackground(0, 55, 520, 47 + (range.Count * 30), 9270); AddImageTiled(10, 65, 500, 25 + (range.Count * 30), 2624); }); layout.Add( "sort/header/name", () => AddButton( 12, 70, 0x853, 0x853, b => { SortType = 0; Refresh(true); })); layout.Add("imagetiled/header/name", () => AddImageTiled(12, 70, 120, 24, 2624)); layout.Add("label/header/name", () => AddLabel(15, 70, GetSelectedHue(0), "Name")); layout.Add( "sort/header/kills", () => AddButton( 115, 70, 0x81C, 0x81C, b => { SortType = 1; Refresh(true); })); layout.Add("imagetiled/header/kills", () => AddImageTiled(115, 70, 90, 24, 2624)); layout.Add("label/header/kills", () => AddLabel(125, 70, GetSelectedHue(1), "Kills")); layout.Add( "sort/header/deaths", () => AddButton( 170, 70, 0x81C, 0x81C, b => { SortType = 2; Refresh(true); })); layout.Add("imagetiled/header/deaths", () => AddImageTiled(170, 70, 90, 24, 2624)); layout.Add("label/header/deaths", () => AddLabel(175, 70, GetSelectedHue(2), "Deaths")); layout.Add( "sort/header/damagedone", () => AddButton( 225, 70, 0x7d3, 0x7d3, b => { SortType = 3; Refresh(true); })); layout.Add("imagetiled/header/damagedone", () => AddImageTiled(225, 70, 130, 24, 2624)); layout.Add("label/header/damagedone", () => AddLabel(240, 70, GetSelectedHue(3), "Damage Done")); layout.Add( "sort/header/healingdone", () => AddButton( 330, 70, 0x7d3, 0x7d3, b => { SortType = 4; Refresh(true); })); layout.Add("imagetiled/header/healingdone", () => AddImageTiled(330, 70, 130, 24, 2624)); layout.Add("label/header/healingdone", () => AddLabel(335, 70, GetSelectedHue(4), "Healing Done")); layout.Add( "sort/header/pointsgained", () => AddButton( 440, 70, 0x853, 0x853, b => { SortType = 5; Refresh(true); })); layout.Add("imagetiled/header/pointsgained", () => AddImageTiled(440, 70, 70, 24, 2624)); layout.Add("label/header/pointsgained", () => AddLabel(440, 70, GetSelectedHue(5), "PvP Rating")); layout.Add("imagetiled/header/hsep", () => AddImageTiled(10, 95, 500, 5, 9277)); layout.AddReplace( "widget/body/scrollbar", () => AddScrollbarH( 6, 46, PageCount, Page, PreviousPage, NextPage, new Rectangle2D(30, 0, 448, 13), new Rectangle2D(0, 0, 28, 13), new Rectangle2D(480, 0, 28, 13))); layout.Remove("imagetiled/body/vsep/0"); } }
protected override void CompileLayout(SuperGumpLayout layout) { base.CompileLayout(layout); layout.AddReplace( "background/header/base", () => { AddBackground(0, 0, 960, 50, 9270); AddImageTiled(10, 10, 940, 30, 2624); }); layout.AddReplace("label/header/close", () => AddLabel(890, 15, 1287, "Close")); layout.AddReplace("button/header/minimize", () => AddButton(930, 20, 10740, 10742, Close)); layout.AddReplace( "label/header/winners", () => AddLabel(400, 14, HighlightHue, "Winners: " + String.Join(", ", Winners.Select(t => t.Name)))); if (Minimized) { return; } layout.AddReplace("imagetiled/body/spacer", () => AddImageTiled(0, 50, 960, 10, 9274)); Dictionary <int, KeyValuePair <PlayerMobile, PvPProfileHistoryEntry> > range = GetListRange(); if (range.Count == 0) { layout.AddReplace( "background/body/base", () => { AddBackground(0, 55, 960, 820, 9270); AddImageTiled(10, 65, 940, 800, 2624); }); layout.Remove("imagetiled/body/vsep/0"); } else { layout.AddReplace( "background/body/base", () => { AddBackground(0, 55, 960, 47 + (range.Count * 30), 9270); AddImageTiled(10, 65, 940, 25 + (range.Count * 30), 2624); }); layout.Add( "sort/header/flagscaptured", () => AddButton( 440, 70, 0x7d3, 0x7d3, b => { SortType = 6; Refresh(true); })); layout.Add("imagetiled/header/flagscaptured", () => AddImageTiled(440, 70, 130, 24, 2624)); layout.Add("label/header/flagscaptured", () => AddLabel(440, 70, GetSelectedHue(6), "Flags Captured")); layout.Add( "sort/header/flagsassaulted", () => AddButton( 555, 70, 0x7d3, 0x7d3, b => { SortType = 7; Refresh(true); })); layout.Add("imagetiled/header/flagsassaulted", () => AddImageTiled(555, 70, 130, 24, 2624)); layout.Add("label/header/flagsassaulted", () => AddLabel(555, 70, GetSelectedHue(7), "Flags Assaulted")); layout.Add( "sort/header/flagsdefended", () => AddButton( 670, 70, 0x7d3, 0x7d3, b => { SortType = 8; Refresh(true); })); layout.Add("imagetiled/header/flagsdefended", () => AddImageTiled(670, 70, 130, 24, 2624)); layout.Add("label/header/flagsdefended", () => AddLabel(670, 70, GetSelectedHue(8), "Flags Defended")); layout.AddReplace( "sort/header/wallscast", () => AddButton( 785, 70, 0x853, 0x853, b => { SortType = 9; Refresh(true); })); layout.AddReplace("imagetiled/header/wallscast", () => AddImageTiled(785, 70, 70, 24, 2624)); layout.AddReplace("label/header/wallscast", () => AddLabel(785, 70, GetSelectedHue(9), "Walls Cast")); layout.AddReplace( "sort/header/pointsgained", () => AddButton( 880, 70, 0x853, 0x853, b => { SortType = 5; Refresh(true); })); layout.AddReplace("imagetiled/header/pointsgained", () => AddImageTiled(880, 70, 70, 24, 2624)); layout.AddReplace("label/header/pointsgained", () => AddLabel(880, 70, GetSelectedHue(5), "PvP Rating")); layout.AddReplace("imagetiled/header/hsep", () => AddImageTiled(10, 95, 940, 5, 9277)); layout.AddReplace( "widget/body/scrollbar", () => AddScrollbarH( 6, 46, PageCount, Page, PreviousPage, NextPage, new Rectangle2D(30, 0, 888, 13), new Rectangle2D(0, 0, 28, 13), new Rectangle2D(920, 0, 28, 13))); layout.Remove("imagetiled/body/vsep/0"); } }