-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectT.cs
More file actions
122 lines (108 loc) · 3.07 KB
/
ProjectT.cs
File metadata and controls
122 lines (108 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using Terraria.ModLoader;
using System.Collections.Generic;
using System;
namespace ProjectT
{
public class ProjectT : Mod
{
public static bool BotActivated = false;
public static int currentnetmode = -1;
public static bool unloading = true;
public ProjectT()
{
//banana
}
public override void Load()
{
unloading = false;
TwitchConfigs.Load();
TwitchConfigs.LogDebug("Loading Project-T");
ViewerController.AllViewers = TwitchConfigs.getListConfig();
TwitchConfigs.Karl = ModContent.GetInstance<ProjectTconfig>();
}
public override void Unload()
{
unloading = true;
ViewerController.UpdateViewerList();
//TwitchConfigs.Karl = null;
BotActivated = false;
currentnetmode = -1;
stopBot();
}
public override void PostAddRecipes()
{
startBot();
}
public static void startBot()
{
ThreadWorker.runThread = true;
ThreadWorker.StartThread();
}
public static void stopBot()
{
ThreadWorker.runThread = false;
}
public static void configUpdate(bool enabled)
{
}
public void debugginglog(string message)
{
Logger.Info(message);
}
public override object Call(params object[] args)
{
int argsLength = args.Length;
Array.Resize(ref args, 6);
try
{
string message = args[0] as string;
if (message == "SendMessage")
{
TwitchConfigs.LogDebug("Received Message from other Mod. Trying to send to chatqueue");
MessageQueue.messageQueue.Enqueue(args[1] as string);
TwitchConfigs.LogDebug("Message added to queue");
}
else if (message == "AddCoins")
{
TwitchConfigs.LogDebug("Received Instruction from other Mod. Looking if user exists...");
if (ViewerController.doesViewerExistbyViewer(args[1] as Viewer))
{
TwitchConfigs.LogDebug("Confirmed that user exists. Adding coins to Viewer");
ViewerController.AddCoins(args[1] as Viewer, Convert.ToDouble(args[2] as string));
TwitchConfigs.LogDebug("Coins successfully added to user.");
}
else
{
TwitchConfigs.LogDebug("User does not exist. Discarding.");
}
}
else if (message == "RemoveCoins")
{
TwitchConfigs.LogDebug("Received Instruction from other Mod. Looking if user exists...");
if (ViewerController.doesViewerExistbyViewer(args[1] as Viewer))
{
TwitchConfigs.LogDebug("Confirmed that user exists. attempting to remove coins from user...");
return ViewerController.RemoveCoins(args[1] as Viewer, Convert.ToDouble(args[2] as string));
}
TwitchConfigs.LogDebug("User does not exist. Discarding.");
return false;
}
else if (message == "SendWhisper")
{
TwitchConfigs.LogDebug("Received Message from other Mod. trying to send whisper...");
WhisperQueue.addToQueue(args[1] as string, args[2] as string);
TwitchConfigs.LogDebug("Successfully sent whisper to Viewer");
}
else
{
TwitchConfigs.LogDebug("Call Error: Unknown Call Type: " + message);
}
}
catch (Exception e)
{
TwitchConfigs.LogDebug("Call Error: " + e.StackTrace + e.Message);
}
return null;
}
}
}