예제 #1
0
 private static void OnReSubscriber(object sender, OnReSubscriberArgs e)
 {
     if (!Context.IsWorldReady)
     {
         return;
     }
     Spawner.SpawnTwitchJunimo(e.ReSubscriber.DisplayName);
     if (Config.ShowDebug() && BNC_Core.config.Spawn_Subscriber_Junimo)
     {
         BNC_Core.Logger.Log($"Adding Junimo to queue from resub: {e.ReSubscriber.DisplayName}", LogLevel.Info);
     }
 }
 private static void OnNewSubscriber(object sender, OnNewSubscriberArgs e)
 {
     if (!Context.IsWorldReady)
     {
         return;
     }
     Spawner.SpawnTwitchJunimo(e.Subscriber.DisplayName);
     if (Config.ShowDebug() && BNC_Core.config.Spawn_Subscriber_Junimo)
     {
         BNC_Core.Logger.Log($"Attemting to spawn Junimo:{e.Subscriber.DisplayName} from resub", LogLevel.Info);
     }
 }
예제 #3
0
        private static void DebugCommands(string msg, string sender)
        {
            if (msg.ToLower().Contains("$bits"))
            {
                MatchCollection matches = Regex.Matches(msg.ToLower(), "\\$bits([0-9]+)");

                if (Config.ShowDebug())
                {
                    BNC_Core.Logger.Log($"DEBUGMODE: {matches.Count} cheer found from {sender}", LogLevel.Debug);
                }

                if (matches.Count > 0)
                {
                    ArrayList bitList = new ArrayList();
                    int[]     list    = new int[matches.Count];

                    int i = 0;
                    int totalBitsCounted = 0;
                    foreach (Match match in matches)
                    {
                        int bitamt = 0;
                        try
                        {
                            bitamt            = int.Parse(match.Groups[1].ToString());
                            list[i++]         = bitamt;
                            totalBitsCounted += bitamt;
                        }
                        catch { BNC_Core.Logger.Log($"{match.Groups[1].ToString()} is not a valid number from {sender}", LogLevel.Warn); }
                    }

                    foreach (int bitamt in list)
                    {
                        TwitchMobType?type = (TwitchMobType)Spawner.GetMonsterFromBits(bitamt);

                        if (type != null)
                        {
                            if (Config.ShowDebug())
                            {
                                BNC_Core.Logger.Log($"DEBUGMODE: Adding Monster:{type.ToString()}:{sender} to queue with {bitamt}bits", LogLevel.Debug);
                            }
                            Spawner.AddMonsterToSpawnFromType((TwitchMobType)type, sender);
                        }
                        else if (Config.ShowDebug())
                        {
                            BNC_Core.Logger.Log($"DEBUGMODE: Failed to add monster to queue with {bitamt}bits from {sender}", LogLevel.Debug);
                        }
                    }
                }

                /*
                 * BNC_Core.Logger.Log($"split {split.Length} length");
                 * if (split.Length >= 2)
                 * {
                 *  int bitamt = 0;
                 *
                 *  try
                 *  {
                 *      bitamt = int.Parse(split[1]);
                 *  }
                 *  catch{ BNC_Core.Logger.Log($"{split[1]} is not a valid number from {sender}"); }
                 *
                 *  if(bitamt > 0)
                 *  {
                 *      TwitchMobType? type = (TwitchMobType?)Spawner.GetMonsterFromBits(bitamt);
                 *
                 *      if (type != null)
                 *      {
                 *          if (Config.ShowDebug())
                 *              BNC_Core.Logger.Log($"DEBUGMODE: Adding Monster:{type.ToString()}:{sender} to queue with {bitamt}bits");
                 *          Spawner.AddMonsterToSpawnFromType((TwitchMobType)type, sender);
                 *      }
                 *      else if (Config.ShowDebug())
                 *          BNC_Core.Logger.Log($"DEBUGMODE: Failed to add monster to queue with {bitamt}bits from {sender}");
                 *  }
                 *
                 * }
                 */
            }
            else if (msg.StartsWith("$sub"))
            {
                if (BNC_Core.config.Spawn_Subscriber_Junimo)
                {
                    Spawner.SpawnTwitchJunimo(sender);
                }
                else
                {
                    BNC_Core.Logger.Log($"DEBUGMODE: 'Spawn_Subscriber_Junimo' Config option is turned off for subscribers");
                }

                if (Config.ShowDebug() && BNC_Core.config.Spawn_Subscriber_Junimo)
                {
                    BNC_Core.Logger.Log($"DEBUGMODE: Adding Junimo:{sender} to queue from a new sub");
                }
            }
            else if (msg.StartsWith("$gift"))
            {
                if (BNC_Core.config.Spawn_GiftSub_Subscriber_Mobs)
                {
                    Spawner.AddMonsterToSpawnFromType(TwitchMobType.Slime, sender, true);
                }
                else
                {
                    BNC_Core.Logger.Log($"DEBUGMODE: 'Spawn_GiftSub_Subscriber_Mobs' Config option is turned off for gift subs");
                }

                if (Config.ShowDebug())
                {
                    BNC_Core.Logger.Log($"DEBUGMODE: Adding GiftSub Slime:{sender} to queue...");
                }
            }
            else if (msg.StartsWith("$resub"))
            {
                if (BNC_Core.config.Spawn_Subscriber_Junimo)
                {
                    Spawner.SpawnTwitchJunimo(sender);
                }
                else
                {
                    BNC_Core.Logger.Log($"DEBUGMODE: 'Spawn_Subscriber_Junimo' Config option is turned off for subscribers");
                }

                if (Config.ShowDebug() && BNC_Core.config.Spawn_Subscriber_Junimo)
                {
                    BNC_Core.Logger.Log($"DEBUGMODE: Adding Junimo:{sender} to queue from a new resubs");
                }
            }
            else if (msg.StartsWith("$help") && DateTime.Now > lastHelp.AddSeconds(15))
            {
                sendMessage("Current Debug Commands: '$bits <amt>', '$gift', '$resub', and '$sub'");
                lastHelp = DateTime.Now;
            }
        }