private static bool CheckIfIncidentIsOnCooldownPrefix(StoreIncident incident, string username, ref bool __result) { EventItem itemEvent = Data.Events.Find(e => string.Equals(e.DefName, incident.defName)); __result = itemEvent == null || UsageService.IsOnCooldown(itemEvent, username); return(false); }
private static bool CheckIfCarePackageIsOnCooldownPrefix(string username, ref bool __result) { EventItem itemEvent = Data.Events.Find(e => string.Equals(e.DefName, IncidentDefOf.Item.defName)); __result = itemEvent != null && UsageService.IsOnCooldown(itemEvent, username); return(false); }
public static void Execute([NotNull] this Command command, [NotNull] ITwitchMessage message, bool emojiOverride = false) { if (command.requiresAdmin && !message.HasBadges("broadcaster")) { return; } if (command.requiresMod && !message.HasBadges("broadcaster", "moderator", "global_mod", "staff")) { return; } CommandItem item = Data.Commands.Find(c => string.Equals(c.DefName, command.defName)); if (item != null && UsageService.IsOnCooldown(item, message.Username)) { return; } if (emojiOverride) { bool emojis = TkSettings.Emojis; TkSettings.Emojis = false; ExecuteInternal(command, message); TkSettings.Emojis = emojis; } else { ExecuteInternal(command, message); } if (item != null) { UsageService.RecordUsage(item, message.Username); } }