public void UnbanPlayer(InGamePlayerInfo player) { if (!game.Settings.MuteOnDeath && !game.Settings.UseMuteBlacklist) { return; } if (game.Settings.UseMuteBlacklist && !MutedPlayers.Contains(player)) { return; } var permissions = game.GameChannel.GetPermissionOverwrite(player.User.DiscordUser); if (permissions.HasValue && permissions.Value.SendMessages == Discord.PermValue.Deny) { if (permissions.Value.ToDenyList().Count == 1) { game.GameChannel.RemovePermissionOverwriteAsync(player.User.DiscordUser).Wait(); } else { var newPermissions = permissions.Value.Modify(sendMessages: Discord.PermValue.Inherit); game.GameChannel.AddPermissionOverwriteAsync(player.User.DiscordUser, newPermissions).Wait(); } } }
public bool HasActivityAgainst(InGamePlayerInfo target) { foreach (var item in ActivityList) { if (item.HasActivityAgainst(target)) { return(true); } } return(Role != null?Role.HasActivityAgainst(target) : false); }
private static int ActivityCheckDayComparer(InGamePlayerInfo player1, InGamePlayerInfo player2) { var idx1 = Array.IndexOf(_daySortPositions, player1.Role.GetType().Name); if (idx1 < 0) { idx1 = int.MaxValue; } var idx2 = Array.IndexOf(_daySortPositions, player2.Role.GetType().Name); if (idx2 < 0) { idx2 = int.MaxValue; } return(idx1 - idx2); }
public void CancelActivity(InGamePlayerInfo onlyAgainstTarget = null) { if (onlyAgainstTarget != null && HasActivityAgainst(onlyAgainstTarget)) { if (TryUseAntiMask()) { return; } } Role?.ClearActivity(true, onlyAgainstTarget); if (onlyAgainstTarget != null) { var itemsToRemove = new List <BaseActivity>(); foreach (var item in ActivityList) { item.Cancel(onlyAgainstTarget); if (item.IsCanceled) { itemsToRemove.Add(item); } } foreach (var item in itemsToRemove) { ActivityList.Remove(item); } } else { IsTurnSkipped = false; var itemsToRemove = new List <BaseActivity>(); foreach (var item in ActivityList) { // Дневное и вечернее голосование отменяется через CancelVote if (Game.CurrentState == GameState.Day && item == VoteFor || Game.CurrentState == GameState.Evening && item == EveningVoteActivity) { continue; } item.Cancel(); itemsToRemove.Add(item); } foreach (var item in itemsToRemove) { ActivityList.Remove(item); } } }
public void BanPlayer(InGamePlayerInfo player) { if (!MuteOnDeath) { return; } var permissions = Channel.GetPermissionOverwrite(player.User.DiscordUser); if (permissions.HasValue) { permissions = permissions.Value.Modify(sendMessages: Discord.PermValue.Deny); } else { permissions = new Discord.OverwritePermissions(sendMessages: Discord.PermValue.Deny); } Channel.AddPermissionOverwriteAsync(player.User.DiscordUser, permissions.Value).Wait(); }
public void UnbanPlayer(InGamePlayerInfo player) { if (!MuteOnDeath) { return; } var permissions = Channel.GetPermissionOverwrite(player.User.DiscordUser); if (permissions.HasValue && permissions.Value.SendMessages == Discord.PermValue.Deny) { if (permissions.Value.ToDenyList().Count == 1) { Channel.RemovePermissionOverwriteAsync(player.User.DiscordUser).Wait(); } else { var newPermissions = permissions.Value.Modify(sendMessages: Discord.PermValue.Inherit); Channel.AddPermissionOverwriteAsync(player.User.DiscordUser, newPermissions).Wait(); } } }
public void BanPlayer(InGamePlayerInfo player) { if (!game.Settings.MuteOnDeath && !game.Settings.UseMuteBlacklist) { return; } if (game.Settings.UseMuteBlacklist && player.DbUser.IsMuteEnabled != true) { return; } var permissions = game.GameChannel.GetPermissionOverwrite(player.User.DiscordUser); if (permissions.HasValue) { permissions = permissions.Value.Modify(sendMessages: Discord.PermValue.Deny); } else { permissions = new Discord.OverwritePermissions(sendMessages: Discord.PermValue.Deny); } MutedPlayers.Add(player); game.GameChannel.AddPermissionOverwriteAsync(player.User.DiscordUser, permissions.Value).Wait(); }
public void AssignStartRole(InGamePlayerInfo player, BaseRole role) { player.StartRole = role; role.Player = player; }
public void Kill(InGamePlayerInfo player) { KilledPlayers.Add(player); }