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.NewInstance(); } }
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.NewInstance(); } } } else { listing.Label("Need new connection"); if (listing.CenteredButton("TwitchToolkitNewConnection".Translate())) { ToolkitIRC.NewInstance(); } } 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 Window") && !Find.WindowStack.TryRemove(typeof(ChatWindow), true)) { ChatWindow chatwnd = new ChatWindow(); Toolkit.client.activeChatWindow = chatwnd; Find.WindowStack.Add(chatwnd); } 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.NewInstance(); } } 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, "Debug Fix")) { Helper.playerMessages = new List <string>(); Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>(); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Tracker")) { Window_Trackers window = new Window_Trackers(); 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", 15); 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_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); Helper.Log("exposing vote weights"); 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); 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.NewInstance(); } } 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_Votewieghts(); } }