static void NewTwitchConnection() { if (Toolkit.client != null) { Toolkit.client.Disconnect(); } Log.Message("<color=#6441A4>== TWITCH TOOLKIT ==</color> Creating new chat client connection"); if (ToolkitSettings.AutoConnect) ToolkitIRC.Reset(); }
public override void DoWindowContents(Listing_Standard listing) { listing.Label("Let's make sure your connection details are correct."); if (Toolkit.client != null) { if (Toolkit.client.Connected) { listing.Label("<color=#21D80E>" + "TwitchToolkitConnected".Translate() + "</color>"); if (listing.CenteredButton("TwitchToolkitDisconnect".Translate())) { Toolkit.client.Disconnect(); } if (listing.CenteredButton("TwitchToolkitReconnect".Translate())) { Toolkit.client.Reconnect(); } } else { if (listing.CenteredButton("TwitchToolkitConnect".Translate())) { ToolkitIRC.Reset(); } } } else { listing.Label("Need new connection"); if (listing.CenteredButton("TwitchToolkitNewConnection".Translate())) { ToolkitIRC.Reset(); } } listing.Gap(); if (!Helper.ModActive) { listing.Label("<b>Commands will not be responded to till you are ingame</b>"); } listing.Gap(); if (Toolkit.client != null && Toolkit.client.Connected) { listing.TextEntry(string.Join("\r\n", Toolkit.client.MessageLog), 6); } }
public override void DoWindowContents(Rect inRect) { base.DoWindowContents(inRect); float padding = 5f; float btnWidth = 100f; float btnHeight = 30f; var rectBtn = new Rect(padding, 0, btnWidth, btnHeight); if (Widgets.ButtonText(rectBtn, "Chat Box")) { Window_ChatBoxSetup window = new Window_ChatBoxSetup(); if (!Find.WindowStack.TryRemove(window.GetType())) { Find.WindowStack.Add(window); } } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Events")) { Type type = typeof(StoreIncidentsWindow); Find.WindowStack.TryRemove(type); Window window = new StoreIncidentsWindow(); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Items")) { Type type = typeof(StoreItemsWindow); Find.WindowStack.TryRemove(type); Window window = new StoreItemsWindow(); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Settings")) { Mod mod = LoadedModManager.GetMod(typeof(TwitchToolkit)); Type type = typeof(SettingsWindow); Find.WindowStack.TryRemove(type); Window window = new SettingsWindow(mod); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Toolkit.client != null && Toolkit.client.Connected) { if (Widgets.ButtonText(rectBtn, "TwitchToolkitReconnect".Translate())) { Toolkit.client.Reconnect(); Helper.playerMessages = new List <string>(); Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>(); } } else { if (Widgets.ButtonText(rectBtn, "TwitchToolkitConnect".Translate())) { ToolkitIRC.Reset(); } } rectBtn.x = padding; rectBtn.y += padding + 28f; if (Widgets.ButtonText(rectBtn, "Name Queue")) { Type type = typeof(QueueWindow); Find.WindowStack.TryRemove(type); Window window = new QueueWindow(); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Viewers")) { Type type = typeof(Window_Viewers); Find.WindowStack.TryRemove(type); Window window = new Window_Viewers(); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Cooldowns")) { Window_Cooldowns window = new Window_Cooldowns(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Commands")) { Window_Commands window = new Window_Commands(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Socket")) { Window_SocketClient window = new Window_SocketClient(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } //rectBtn.x += btnWidth + padding; //if (Widgets.ButtonText(rectBtn, "Badges")) //{ // TwitchBadges.GetBadgeInfo(); //} var rectMessages = new Rect(padding, rectBtn.height + 36f, inRect.width - (padding * 3), 180f); if (Toolkit.client != null) { Widgets.TextArea(rectMessages, string.Join("\r\n", Toolkit.client.MessageLog), true); } btnWidth = inRect.width - (padding / 2); rectBtn = new Rect(padding, rectMessages.y + rectMessages.height, btnWidth, btnHeight); Widgets.CheckboxLabeled(rectBtn, "TwitchToolkitEarningCoins".Translate(), ref ToolkitSettings.EarningCoins); }
public override void ExposeData() { Scribe_Values.Look(ref FirstTimeInstallation, "FirstTimeInstallation", true); Scribe_Values.Look(ref Channel, "Channel", ""); Scribe_Values.Look(ref Username, "Username", ""); Scribe_Values.Look(ref OAuth, "OAuth", ""); Scribe_Values.Look(ref AutoConnect, "AutoConnect", true); Scribe_Values.Look(ref UseSeparateChatRoom, "UseSeparateChatRoom", false); Scribe_Values.Look(ref AllowBothChatRooms, "AllowBothChatRooms", false); Scribe_Values.Look(ref WhispersGoToChatRoom, "WhispersGoToChatRoom", true); Scribe_Values.Look(ref ChannelID, "ChannelID", ""); Scribe_Values.Look(ref ChatroomUUID, "ChatroomUUID", ""); Scribe_Values.Look(ref VoteTime, "VoteTime", 2); Scribe_Values.Look(ref VoteOptions, "VoteOptions", 3); Scribe_Values.Look(ref TimedStorytelling, "TimedStorytelling", false); Scribe_Values.Look(ref TimeBetweenStorytellingEvents, "TimeBetweenStorytellingEvents", 10); Scribe_Values.Look(ref VotingChatMsgs, "VotingChatMsgs", false); Scribe_Values.Look(ref VotingWindow, "VotingWindow", true); Scribe_Values.Look(ref VotingWindowx, "VotingWindowx", -1); Scribe_Values.Look(ref VotingWindowy, "VotingWindowy", -1); Scribe_Values.Look(ref LargeVotingWindow, "LargeVotingWindow", true); Scribe_Values.Look(ref StartingBalance, "StartingBalance", 150); Scribe_Values.Look(ref CoinInterval, "CoinInterval", 2); Scribe_Values.Look(ref CoinAmount, "CoinAmount", 30); Scribe_Values.Look(ref MinimumPurchasePrice, "MinimumPurchasePrice", 60); Scribe_Values.Look(ref UnlimitedCoins, "UnlimitedCoins", false); Scribe_Values.Look(ref EarningCoins, "EarningCoins", true); Scribe_Values.Look(ref CustomPricingSheetLink, "CustomPricingSheetLink", "bit.ly/toolkit-list"); Scribe_Values.Look(ref WhisperCmdsAllowed, "WhisperCmdsAllowed", true); Scribe_Values.Look(ref WhisperCmdsOnly, "WhisperCmdsOnly", false); Scribe_Values.Look(ref PurchaseConfirmations, "PurchaseConfirmations", true); Scribe_Values.Look(ref RepeatViewerNames, "RepeatViewerNames", false); Scribe_Values.Look(ref MinifiableBuildings, "MinifiableBuildings", false); Scribe_Values.Look(ref SyncStreamElements, "SyncStreamElements", false); Scribe_Values.Look(ref AccountID, "AccountID", ""); Scribe_Values.Look(ref JWTToken, "JWTToken", ""); Scribe_Values.Look(ref SyncStreamLabs, "SyncStreamLabs", false); Scribe_Values.Look(ref StartingKarma, "StartingKarma", 100); Scribe_Values.Look(ref KarmaCap, "KarmaCap", 140); Scribe_Values.Look(ref BanViewersWhoPurchaseAlwaysBad, "BanViewersWhoPurchaseAlwaysBad", true); Scribe_Values.Look(ref KarmaReqsForGifting, "KarmaReqsForGifting", false); Scribe_Values.Look(ref MinimumKarmaToRecieveGifts, "MinimumKarmaToRecieveGifts", 33); Scribe_Values.Look(ref MinimumKarmaToSendGifts, "MinimumKarmaToSendGifts", 100); Scribe_Values.Look(ref KarmaMinimum, "KarmaMinimum", 10); Scribe_Values.Look(ref TierOneGoodBonus, "TierOneGoodBonus", 16, true); Scribe_Values.Look(ref TierOneNeutralBonus, "TierOneNeutralBonus", 36, true); Scribe_Values.Look(ref TierOneBadBonus, "TierOneBadBonus", 24, true); Scribe_Values.Look(ref TierTwoGoodBonus, "TierTwoGoodBonus", 10, true); Scribe_Values.Look(ref TierTwoNeutralBonus, "TierTwoNeutralBonus", 30, true); Scribe_Values.Look(ref TierTwoBadBonus, "TierTwoBadBonus", 20, true); Scribe_Values.Look(ref TierThreeGoodBonus, "TierThreeGoodBonus", 10, true); Scribe_Values.Look(ref TierThreeNeutralBonus, "TierThreeNeutralBonus", 24, true); Scribe_Values.Look(ref TierThreeBadBonus, "TierThreeBadBonus", 18, true); Scribe_Values.Look(ref TierFourGoodBonus, "TierFourGoodBonus", 6, true); Scribe_Values.Look(ref TierFourNeutralBonus, "TierFourNeutralBonus", 18, true); Scribe_Values.Look(ref TierFourBadBonus, "TierFourBadBonus", 12, true); Scribe_Values.Look(ref DoomBonus, "DoomBonus", 67, true); Scribe_Values.Look(ref ChatReqsForCoins, "ChatReqsForCoins", true); Scribe_Values.Look(ref TimeBeforeHalfCoins, "TimeBeforeHalfCoins", 30); Scribe_Values.Look(ref TimeBeforeNoCoins, "TimeBeforeNoCoins", 60); Scribe_Values.Look(ref KarmaDecay, "KarmaDecay", false); Scribe_Values.Look(ref KarmaDecayPeriod, "KarmaDecayPeriod", 5); Scribe_Values.Look(ref MaxBadEventsBeforeDecay, "MaxBadEventsBeforeDecay", 0); Scribe_Values.Look(ref MaxGoodEventsBeforeDecay, "MaxGoodEventsBeforeDecay", 0); Scribe_Values.Look(ref MaxNeutralEventsBeforeDecay, "MaxNeutralEventsBeforeDecay", 0); Scribe_Values.Look(ref MaxEvents, "MaxEvents", false); Scribe_Values.Look(ref MaxEventsPeriod, "MaxEventsPeriod", 5); Scribe_Values.Look(ref MaxBadEventsPerInterval, "MaxBadEventsPerInterval", 3); Scribe_Values.Look(ref MaxGoodEventsPerInterval, "MaxGoodEventsPerInterval", 10); Scribe_Values.Look(ref MaxNeutralEventsPerInterval, "MaxNeutralEventsPerInterval", 10); Scribe_Values.Look(ref MaxCarePackagesPerInterval, "MaxCarePackagesPerInterval", 10); Scribe_Values.Look(ref EventsHaveCooldowns, "EventsHaveCooldowns", true); Scribe_Values.Look(ref EventCooldownInterval, "EventCooldownInterval", 5); Scribe_Collections.Look(ref ViewerColorCodes, "ViewerColorCodes", LookMode.Value, LookMode.Value); Scribe_Collections.Look(ref ViewerModerators, "ViewerModerators", LookMode.Value, LookMode.Value); Scribe_Collections.Look(ref BannedViewers, "BannedViewers", LookMode.Value); Scribe_Collections.Look(ref GloballyBannedViewers, "GloballyBannedViewers", LookMode.Value); Scribe_Collections.Look(ref GlobalToolkitMods, "GlobalToolkitMods", LookMode.Value); Scribe_Values.Look(ref EnableViewerQueue, "EnableViewerQueue", true); Scribe_Values.Look(ref ViewerNamedColonistQueue, "ViewerNamedColonistQueue", true); Scribe_Values.Look(ref ChargeViewersForQueue, "ChargeViewersForQueue", false); Scribe_Values.Look(ref CostToJoinQueue, "CostToJoinQueue", 0); Scribe_Values.Look(ref SubscriberExtraCoins, "SubscriberExtraCoins", 10); Scribe_Values.Look(ref SubscriberCoinMultiplier, "SubscriberCoinMultiplier", 1.25f); Scribe_Values.Look(ref SubscriberExtraVotes, "SubscriberExtraVotes", 1); Scribe_Values.Look(ref VIPExtraCoins, "VIPExtraCoins", 5); Scribe_Values.Look(ref VIPCoinMultiplier, "VIPCoinMultiplier", 1.15f); Scribe_Values.Look(ref VIPExtraVotes, "VIPExtraVotes", 0); Scribe_Values.Look(ref ModExtraCoins, "ModExtraCoins", 3); Scribe_Values.Look(ref ModCoinMultiplier, "ModCoinMultiplier", 1.15f); Scribe_Values.Look(ref ModExtraVotes, "ModExtraVotes", 0); Scribe_Collections.Look(ref VoteWeights, "VoteWeights", LookMode.Value, LookMode.Value); Scribe_Values.Look(ref ToryTalkerEnabled, "ToryTalkerEnabled", false); Scribe_Values.Look(ref ToryTalkerMTBDays, "ToryTalkerMTBDays", 2); Scribe_Values.Look(ref HodlBotEnabled, "HodlBotEnabled", true); Scribe_Values.Look(ref HodlBotMTBDays, "HodlBotMTBDays", 1); Scribe_Collections.Look(ref VoteTypeWeights, "VoteTypeWeights", LookMode.Value, LookMode.Value); Scribe_Collections.Look(ref VoteCategoryWeights, "VoteCategoryWeights", LookMode.Value, LookMode.Value); Scribe_Values.Look(ref UristBotEnabled, "UristBotEnabled", false); Scribe_Values.Look(ref UristBotMTBDays, "UristBotMTBDays", 6); Scribe_Values.Look(ref MilasandraEnabled, "MilasandraEnabled", false); Scribe_Values.Look(ref MercuriusEnabled, "MercuriusEnabled", false); Scribe_Values.Look(ref CommandsModsEnabled, "CommandsModsEnabled", true); Scribe_Collections.Look(ref CustomCommandDefs, "CustomCommandDefs", LookMode.Value); Scribe_Values.Look(ref ChatBoxEnabled, "ChatBoxEnabled", false); Scribe_Values.Look(ref ChatBoxPositionX, "ChatBoxPositionX", 100); Scribe_Values.Look(ref ChatBoxPositionY, "ChatBoxPositionY", 100); Scribe_Values.Look(ref ChatBoxMaxWidth, "ChatBoxMaxWidth", 400); Scribe_Values.Look(ref ChatBoxMessageCount, "ChatBoxMessageCount", 10); List <StoreIncidentVariables> variableIncidents = DefDatabase <StoreIncidentVariables> .AllDefs.Where(s => s.customSettings).ToList(); foreach (StoreIncidentVariables incident in variableIncidents) { incident.RegisterCustomSettings(); incident.settings.ExposeData(); } if (BannedViewers == null || BannedViewers.Count < 1) { BannedViewers = new List <string>(PubliclyKnownBots); } if (AutoConnect) { if (Toolkit.client == null) { ToolkitIRC.Reset(); } } if (VoteWeights == null || VoteWeights.Count < 1) { ToolkitSettings.VoteWeights = new Dictionary <string, int>(); foreach (VotingIncident vote in DefDatabase <VotingIncident> .AllDefs) { ToolkitSettings.VoteWeights.Add(vote.defName, 100); } } else { Settings_VoteWeights.Load_VoteWeights(); } if ((VoteTypeWeights == null || VoteTypeWeights.Count < 1) || (VoteCategoryWeights == null || VoteCategoryWeights.Count < 1)) { Settings_Storyteller.ResetVoteWeights(); } }