示例#1
0
    public static void Unclaim(TwitchModule module, string user, [Group(1)] string cmd)
    {
        if (module.Solved)
        {
            IRCConnection.SendMessageFormat(TwitchPlaySettings.data.AlreadySolved, module.Code, module.PlayerName, user, module.HeaderText);
            return;
        }

        // If module is already unclaimed, just remove from claim queue
        if (module.PlayerName == null)
        {
            module.RemoveFromClaimQueue(user);
            return;
        }

        // Error if a non-mod tries to unclaim someone else’s module
        if (!UserAccess.HasAccess(user, AccessLevel.Mod, true) && module.PlayerName != user)
        {
            IRCConnection.SendMessage($"{user}, module {module.Code} ({module.HeaderText}) is not claimed by you.");
            return;
        }

        module.SetUnclaimed();
        if (cmd.Contains("v"))
        {
            TwitchGame.ModuleCameras?.UnviewModule(module);
        }
    }