-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCommands.cpp
154 lines (142 loc) · 4.5 KB
/
Commands.cpp
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include "FindAll.h"
#define ARG(a, b) ((argCount > a) && (_stricmp(args[a].c_str(), b) == 0))
void FindAll::HandleCommandInternal(std::vector<std::string> args, int argCount)
{
if ARG(1, "config")
{
if ARG(2, "instantload")
{
if (ARG(3, "on") || ARG(3, "enabled"))
{
mConfig.SetInstantLoad(true);
}
else if (ARG(3, "off") || ARG(3, "disabled"))
{
mConfig.SetInstantLoad(false);
}
else
{
mConfig.SetInstantLoad(!mConfig.GetInstantLoad());
}
OutputHelper::Outputf(Ashita::LogLevel::Info, "InstantLoad $H%s$R.", mConfig.GetInstantLoad() ? "Enabled" : "Disabled");
return;
}
if ARG(2, "cachetodisc")
{
if (ARG(3, "on") || ARG(3, "enabled"))
{
mConfig.SetCacheToDisc(true);
}
else if (ARG(3, "off") || ARG(3, "disabled"))
{
mConfig.SetCacheToDisc(false);
}
else
{
mConfig.SetCacheToDisc(!mConfig.GetCacheToDisc());
}
OutputHelper::Outputf(Ashita::LogLevel::Info, "CacheToDisc $H%s$R.", mConfig.GetCacheToDisc() ? "Enabled" : "Disabled");
return;
}
if ARG (2, "keyitemprefix")
{
if (ARG(3, "on") || ARG(3, "enabled"))
{
mConfig.SetKeyItemPrefix(true);
}
else if (ARG(3, "off") || ARG(3, "disabled"))
{
mConfig.SetKeyItemPrefix(false);
}
else
{
mConfig.SetKeyItemPrefix(!mConfig.GetKeyItemPrefix());
}
OutputHelper::Outputf(Ashita::LogLevel::Info, "KeyItemPrefix $H%s$R.", mConfig.GetKeyItemPrefix() ? "Enabled" : "Disabled");
return;
}
if ARG (2, "displaymax")
{
if (argCount > 3)
{
mConfig.SetDisplayMax(atoi(args[3].c_str()));
OutputHelper::Outputf(Ashita::LogLevel::Info, "DisplayMax set to $H%d$R.", mConfig.GetDisplayMax());
}
return;
}
if ARG(2, "displaymode")
{
if ARG(3, "chatlog")
{
mConfig.SetDisplayMode(FindAllDisplayMode::ChatLog);
}
else if ARG (3, "imgui")
{
mConfig.SetDisplayMode(FindAllDisplayMode::ImGui);
}
else if (mConfig.GetDisplayMode() == FindAllDisplayMode::ImGui)
{
mConfig.SetDisplayMode(FindAllDisplayMode::ChatLog);
}
else
{
mConfig.SetDisplayMode(FindAllDisplayMode::ImGui);
}
if (mConfig.GetDisplayMode() == FindAllDisplayMode::ImGui)
OutputHelper::Outputf(Ashita::LogLevel::Info, "DisplayMode set to $HImGui$R.");
else
OutputHelper::Outputf(Ashita::LogLevel::Info, "DisplayMode set to $HChat Log$R.");
return;
}
if ARG(2, "writedelay")
{
if (argCount > 3)
{
mConfig.SetWritePeriod(static_cast<uint32_t>(atoll(args[3].c_str())));
OutputHelper::Outputf(Ashita::LogLevel::Info, "WriteDelay set to $H%u$R.", mConfig.GetWritePeriod());
}
return;
}
}
else if ARG(1, "clear")
{
for (std::list<SearchInstance*>::iterator searchIter = mSearches.begin(); searchIter != mSearches.end(); searchIter = mSearches.erase(searchIter))
{
delete *searchIter;
}
return;
}
else if ARG(1, "search")
{
if (argCount > 2)
{
std::vector<std::string> terms;
for (int x = 2; x < argCount; x++)
{
terms.push_back(std::string(args[x]));
}
FindAcrossCharacters(terms);
}
}
else if ARG (1, "local")
{
if (argCount > 2)
{
std::vector<std::string> terms;
for (int x = 2; x < argCount; x++)
{
terms.push_back(std::string(args[x]));
}
FindLocal(terms);
}
}
else if (argCount > 1)
{
std::vector<std::string> terms;
for (int x = 1; x < argCount; x++)
{
terms.push_back(std::string(args[x]));
}
FindAcrossCharacters(terms);
}
}