public static void Take(TwitchModule module, string user, bool isWhisper) { if (isWhisper) { IRCConnection.SendMessageFormat("Sorry {0}, taking modules is not allowed in whispers.", user); } else if (TwitchPlaySettings.data.AnarchyMode) { IRCConnection.SendMessageFormat("Sorry {0}, taking modules is not allowed in anarchy mode.", user); } // Attempt to take over from another user else if (module.PlayerName != null && user != module.PlayerName) { module.AddToClaimQueue(user); if (module.TakeInProgress == null) { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TakeModule, module.PlayerName, user, module.Code, module.HeaderText); module.TakeInProgress = module.TakeModule(); module.StartCoroutine(module.TakeInProgress); } else { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TakeInProgress, user, module.Code, module.HeaderText); } } // Module is already claimed by the same user else if (module.PlayerName != null) { if (!module.PlayerName.Equals(user)) { module.AddToClaimQueue(user); } IRCConnection.SendMessageFormat(TwitchPlaySettings.data.ModuleAlreadyOwned, user, module.Code, module.HeaderText); } // Module is not claimed at all: just claim it else { IRCConnection.SendMessage(module.ClaimModule(user).Second); } }
public static void Take(TwitchModule module, string user, bool isWhisper) { if (isWhisper) { IRCConnection.SendMessage($"@{user}, taking modules is not allowed in whispers."); } else if (TwitchPlaySettings.data.AnarchyMode) { IRCConnection.SendMessage($"@{user}, taking modules is not allowed in anarchy mode."); } // Module is already claimed by the same user else if (module.PlayerName == user) { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.ModuleAlreadyOwned, user, module.Code, module.HeaderText); } // Module is not claimed at all: just claim it else if (module.PlayerName == null) { IRCConnection.SendMessage(module.TryClaim(user).Message); } // Attempt to take over from another user else { module.AddToClaimQueue(user); if (module.TakeInProgress != null) { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TakeInProgress, user, module.Code, module.HeaderText); } else { IRCConnection.SendMessageFormat(TwitchPlaySettings.data.TakeModule, module.PlayerName, user, module.Code, module.HeaderText); module.TakeUser = user; module.TakeInProgress = module.StartCoroutine(module.ProcessTakeover()); } } }