TShock plugin that enables twitch integration to allow chatters to spend credits to buy mobs.
⚠ Firstly, this plugin is not vetted by official TShock staff, please read their plugin safety guidelines ⚠
You will need tshock, and a way to compile this mod. You will need Visual Studio, and copy TerrariaServer.dll, TShockAPI.dll, and OTAPI.dll from the tshock installation to the root of this project directory.
Then, after downloading all dependencies using NuGet, which are:
you can then build the plugin locally. In order to make sure all dependencies are present, you will need to create a publishing profile by using Build -> Publish, and select the "Folder" option, after publishing copy the following files in the folder to ServerPlugins folder of TShock:
Microsoft.Extensions.Logging.Abstractions.dllTerrariaKitchen.dllTwitchLib.Client.dllTwitchLib.Client.Enums.dllTwitchLib.Client.Models.dllTwitchLib.Communication.dll
Afterwards you will need to configure your twitch api, you can either do it through console command /setkitchenkey <api key> or put the key in kitchenapi.txt inside the tshock subfolder within Tshock installation. And also configure your settings by adding a kitchen.json in the same folder with the format in the Configuration section.
Once it's all done, load into a world and you can use /startkitchen <twitch channle name> <player name> and twitch integration will start accepting orders from chatters.
Reset the remaining balance of all chatters for the current world.
Give twitch chat user with <username> as their display name <amount> of chat credits for the current world. Number can be negative to deduct credits.
Refresh most settings by re-reading from kitchen.json without restarting the server. Note that ports changes will not be updated and existing pools and waves will also not be affected.
Twitch chat commands are throttled so only 1 command will be processed per unique user every 5 seconds.
Shows the current remaining balance of the chatter
Buy <amount> of <item> spawns, item name is defined in configuration and is case sensitive.
Add <amount> of credits to a pool with index of <index>, if <amount> would bring the over the pool cap, it will automatically be adjusted to match.
Add <amount> of credits to a pool with an event associated with <event name>, if <amount> would go over the event target, it will automatically be adjusted to match. Event name is defined in configuration and is case sensitive. If no event is found, a new pool will start automatically.
Start a wave that will spawn all mobs when the number of mobs in it reaches or go above <target number>.
Buy <amount> of <item> spawns and add them to a wave started by <wave name>. <wave name> is the username of the chatter whose wave you will need to add into. This will not automatically start a new wave if such wave is not found.
Cancel a wave started by you and refund all credits spent on it to everyone.
Give <amount> of credits to <target>. <target> is the username of the recipient chatter.
NPCs will be raffled as a random chatter when they spawn. If a chatter's username matches an NPC, they can use this command to make the NPC say <message> in game!
Configuration is done by kitchen.json
The following is an example of the file
{
"Entries": [
{
"MobName": "slime",
"MobAlias": ["goo"],
"InternalName": 1,
"Price": 100,
"MaxBuys": 10
},
{
"MobName": "skeleton",
"InternalName": 21,
"Price": 100,
"NoDay": true,
"MaxBuys": 10
},
{
"MobName": "kingslime",
"InternalName": 50,
"Price": 2000,
"NoNight": true,
"Pooling": true
}
],
"Events": [
{
"EventName": "goblins",
"EventId": 6,
"EventAlias": ["goblin", "goblininvasion"],
"Price": 1500
}
],
"StartingMoney": 500,
"Income": 10,
"IncomeInterval": 60,
"SubscriberPriceMultiplier": 0.9,
"PlayerDeathIncome": 10,
"PlayerDeathCreditRefund": 0.2,
"SafeSpawnZoneName": "Safe",
"ModAbuse": false,
"XRange": 200,
"YRange": 50,
"OverlayPort": 7770,
"OverlayWsPort": 7771
}
With each purchasable mob as a separate entry.
Entriesis a list of mobs that can be bought by chatters:InternalNameis the ID of the NPC found in this listMobNameis the name that will be entered into the!t buycommand, case sensitiveMobAliasis a list of other similar names that will also be treated as ordering for this entry, also case sensitivePriceis the credits cost per itemMaxBuysis the maximum number of purchases that can be made in a single orderNoDaydefines entry do not spawn during day. Non-wave spawns of this type during the day will fail and not charge the chatter.NoNightdefines entry do not spawn during night. Non-wave spawns of this type during the night will fail and not charge the chatter.Poolingis whether the mob allows pooling credits from multiple chatters
Eventsis a list of events that can be bought by chatters:EventNameis the name that will be entered into the!t eventcommand, case sensitiveEventAliasis a list of other similar names that will also be treated as ordering for this entry, also case sensitivePriceis the credits cost to reach to start the eventEventIdwith a number of the following which will correspond to each event:0: Full Moon1: Blood Moon2: Solar Eclipse3: Sandstorm4: Rain5: Slime Rain6: Goblin Army7: Frost Legion8: Pirate Invasion9: Martian Madness10: Pumpkin Moon11: Frost Moon12: Spawn Eye of Cthulu immediately if it's night, otherwise spawn it on the next night13: Spawn Skeletron Prime immediately if it's night, otherwise spawn it on the next night14: Spawn Mechanical Twins immediately if it's night, otherwise spawn it on the next night15: Spawn The Destroyer immediately if it's night, otherwise spawn it on the next night
StartingMoneyis the credits new chatters will start withIncomeis the amount of credits each chatters still in the channel chat room will receive periodicallyIncomeIntervalis the number of seconds between each income payout, minimum is 5 seconds.SubscriberPriceMultiplieris the price multiplier for channel subscribersPlayerDeathIncomeis the amount of credits all players will get whenever a player diesPlayerDeathCreditRefundis the multiplier of credits price all players will get whenever a player is killed by a purchasable NPC typeSafeSpawnZoneNameis the name of the region marked as safe. If the player the mob spawn is targeting is within the region, the mob will spawn outside the region instead. Note this does not guarantee the region to be completely spawn free.ModAbusebeing set to true will allow mods to buy any mobs among the entries for freeXRangeis the number of tiles horizontally around the player the mobs can spawnYRangeis the number of tiles vertically around the player the mobs can spawnOverlayPortis the port number for the streaming overlay and menu page (Only change if you want to use this port for something else)OverlayWsPortis the port number for the websocket port used by the streaming overlay (Only change if you want to use this port for something else)
You can view the overlay by entering http://localhost:7770, 7770 may be replaced by whatever port you set for OverlayPort, this may be added as a browser source in your streaming software to notify chat of current pools and waves by using green chroma key.
If you visit http://localhost:7770/menu, a formatted menu of mob and event entries will be rendered.