public static IEnumerator DefaultCommand(TwitchHoldable holdable, string user, bool isWhisper, string cmd)
    {
        if (holdable.CommandType != null)
        {
            return(holdable.RespondToCommand(user, isWhisper));
        }

        return(holdable.RespondToCommand(user, cmd, isWhisper));
    }
Пример #2
0
    public static IEnumerator DefaultCommand(TwitchHoldable holdable, string user, bool isWhisper, string cmd)
    {
        if (holdable.CommandType == typeof(AlarmClockCommands))
        {
            return(AlarmClockCommands.Snooze(holdable, user, isWhisper));
        }

        if (holdable.CommandType != null)
        {
            return(holdable.RespondToCommand(user, isWhisper));
        }

        return(holdable.RespondToCommand(user, cmd, isWhisper));
    }
Пример #3
0
    public static IEnumerator DefaultCommand(TwitchHoldable holdable, string user, bool isWhisper, string cmd)
    {
        if (holdable.CommandType == typeof(AlarmClockCommands))
        {
            return(AlarmClockCommands.Snooze(holdable, user, isWhisper));
        }

        if (holdable.CommandType == typeof(IRCConnectionManagerCommands) ||
            holdable.CommandType == typeof(MissionBinderCommands) ||
            holdable.CommandType == typeof(FreeplayCommands))
        {
            return(holdable.RespondToCommand(user, isWhisper));
        }

        return(holdable.RespondToCommand(user, cmd, isWhisper));
    }
Пример #4
0
    private IEnumerator FindHoldables()
    {
        Holdables.Clear();
        yield return(new WaitForSeconds(0.1f));

        foreach (var holdable in FindObjectsOfType <FloatingHoldable>())
        {
            // Bombs are blacklisted, as they are already handled by TwitchBomb.
            if (holdable.GetComponentInChildren <KMBomb>() != null)
            {
                continue;
            }
            else if (holdable.GetComponent <FreeplayDevice>() != null)
            {
                Holdables["freeplay"] = new TwitchHoldable(holdable, commandType: typeof(FreeplayCommands));
            }
            else if (holdable.GetComponent <BombBinder>() != null)
            {
                Holdables["binder"] = new TwitchHoldable(holdable, commandType: typeof(MissionBinderCommands));
            }
            else if (holdable.GetComponent <AlarmClock>() != null)
            {
                Holdables["alarm"] = new TwitchHoldable(holdable, commandType: typeof(AlarmClockCommands));
            }
            else if (holdable.GetComponent <IRCConnectionManagerHoldable>() != null)
            {
                Holdables["ircmanager"] = new TwitchHoldable(holdable, commandType: typeof(IRCConnectionManagerCommands));
            }
            else if (holdable.GetComponent("ModSelectorTablet") != null)
            {
                Holdables["dmg"] = new TwitchHoldable(holdable, commandType: typeof(DMGCommands), id: "dmg");
            }
            else
            {
                var id = holdable.name.ToLowerInvariant().Replace("(clone)", "");
                // Make sure a modded holdable can’t override a built-in
                if (!Holdables.ContainsKey(id))
                {
                    Holdables[id] = new TwitchHoldable(holdable, allowModded: true);
                }
            }
        }
    }
Пример #5
0
 public static IEnumerator Disconnect(TwitchHoldable holdable, string user, bool isWhisper) =>
 holdable.RespondToCommand(user, string.Empty, isWhisper, Disconnect(holdable.Holdable.GetComponent <IRCConnectionManagerHoldable>()));
Пример #6
0
 public static bool Help(TwitchHoldable holdable, string user, bool isWhisper) => holdable.PrintHelp(user, isWhisper);
Пример #7
0
 public static IEnumerator Flip(TwitchHoldable holdable) => holdable.Turn();
Пример #8
0
 public static IEnumerator Drop(TwitchHoldable holdable) => holdable.Drop();
Пример #9
0
 public static IEnumerator Hold(TwitchHoldable holdable) => holdable.Hold();
 public static IEnumerator Snooze(TwitchHoldable holdable, string user, bool isWhisper) =>
 holdable.RespondToCommand(user, "", isWhisper, Snooze(holdable.Holdable.GetComponent <AlarmClock>()));
Пример #11
0
 /// <summary>Adds a holdable, ensuring that the ID in <see cref="Holdables"/> is the same as the one in it's <see cref="TwitchHoldable"/>.</summary>
 private void AddHoldable(string id, FloatingHoldable holdable, Type commandType = null, bool allowModded = false)
 {
     Holdables[id] = new TwitchHoldable(holdable, commandType, allowModded, id);
 }
 public static IEnumerator SnoozeMultiple(TwitchHoldable holdable, string user, bool isWhisper, [Group(1)] int times) =>
 holdable.RespondToCommand(user, "", isWhisper, Snooze(holdable.Holdable.GetComponent <AlarmClock>(), times));