private void ProcessMatchEnd(int matchId) { MatchEndEventArgs args = new MatchEndEventArgs { Guild = Manager.Guild, TName = Match.TName, CTName = Match.CTName, TScore = Match.TScore + Match.TSwapScore, CTScore = Match.CTScore + Match.CtSwapScore, TimeStamp = DateTime.UtcNow.AddHours(Config.TimeZoneOffset), MatchId = matchId }; OnMatchEnd(args); }
public void RegisterMatchResult(MatchEndEventArgs matchEndArgs, MatchType type) { var winningCharacter = GetOrCreateCharacter(matchEndArgs.WinningPlayerName); var loosingCharacter = GetOrCreateCharacter(matchEndArgs.LoosingPlayerName); var matchRecord = new MatchRecord { WinnerCharacterId = winningCharacter.CharacterId, LoserCharacterId = loosingCharacter.CharacterId, WinnerSalt = matchEndArgs.WinnerSalt, LoserSalt = matchEndArgs.LoserSalt, Tier = matchEndArgs.Tier, MatchStart = matchEndArgs.MatchStart, MatchLength = matchEndArgs.MatchLength, MatchType = type, }; RegisterMatchResult(matchRecord); }
private async void CsServerMatchEndAsync(object sender, MatchEndEventArgs e) { var eb = new EmbedBuilder { Title = $"Match complete {e.MapName} {e.CTName}({e.CTScore}) {e.TName}({e.TScore})", ThumbnailUrl = "https://cdn.discordapp.com/attachments/546946476836782090/546955027210829825/no_backround.png", Color = Color.Teal }; var fieldBuilder = new EmbedFieldBuilder { Name = $"Match Info https://play.esea.net/match/{e.MatchId}", Value = "field" }; eb.AddField("Stats available: ", fieldBuilder.Build()); eb.WithFooter($"Use command \"{Config.Prefix}{CommandConstants.Help}\" to list all available commands"); await(await GetChannelAsync(e.Guild, ChannelNames.MatchCard) as ISocketMessageChannel).SendMessageAsync(string.Empty, false, eb.Build()); }
private void MatchFinished() { Players winningPlayer; var winningPlayerName = MatchInformation.winningplayer; string losingPlayerName; int winnerSalt; int loserSalt; int balanceChange; int salt = MatchInformation.SaltBeforeMatch; if (winningPlayerName == MatchInformation.currentBluePlayer) { winningPlayer = Players.BluePlayer; winnerSalt = MatchInformation.BlueSalt; losingPlayerName = MatchInformation.currentRedPlayer; loserSalt = MatchInformation.RedSalt; } else { winningPlayer = Players.RedPlayer; winnerSalt = MatchInformation.RedSalt; losingPlayerName = MatchInformation.currentBluePlayer; loserSalt = MatchInformation.BlueSalt; } if (winningPlayerName == MatchInformation.currentBettedPlayer) { balanceChange = DataExtractor.GetPayout(); } else { balanceChange = MatchInformation.SaltBettedOnMatch * -1; } var matchEndEventArgs = new MatchEndEventArgs { BluePlayer = MatchInformation.currentBluePlayer, RedPlayer = MatchInformation.currentRedPlayer, Tournament = _lastMatchType == MatchType.Tournament, TournamentPlayersRemaining = _bracketCount, WinningPlayer = winningPlayer, WinningPlayerName = winningPlayerName, LoosingPlayerName = losingPlayerName, PickedPlayerName = MatchInformation.currentBettedPlayer, Tier = MatchInformation.Tier, WinnerSalt = winnerSalt, LoserSalt = loserSalt, MatchStart = MatchInformation.MatchStart, MatchLength = DateTime.Now - MatchInformation.MatchStart, SaltBalanceChange = balanceChange, Salt = salt + balanceChange, }; switch (_lastMatchType) { case MatchType.Tournament: OnTournamentMatchEnd(matchEndEventArgs); break; case MatchType.Exhibition: OnExhibitionMatchEnded(matchEndEventArgs); break; case MatchType.Matchmaking: OnMatchEnd(matchEndEventArgs); break; } }
private void OnMatchEnd(MatchEndEventArgs args) { MatchEndEventArgs?.Invoke(this, args); }