Exemple #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);
        }
    }
Exemple #2
0
    public static void Assign(TwitchModule module, string user, [Group(1)] string targetUser)
    {
        if (TwitchPlaySettings.data.AnarchyMode)
        {
            IRCConnection.SendMessageFormat("Sorry {0}, assigning modules is not allowed in anarchy mode.", user);
            return;
        }

        if (module.TakeInProgress != null)
        {
            module.StopCoroutine(module.TakeInProgress);
            module.TakeInProgress = null;
        }

        module.PlayerName = targetUser;
        module.RemoveFromClaimQueue(user);
        module.CanClaimNow(user, true, true);
        module.SetBannerColor(module.ClaimedBackgroundColour);
        IRCConnection.SendMessageFormat(TwitchPlaySettings.data.AssignModule, module.Code, module.PlayerName, user, module.HeaderText);
    }