This repository has been archived by the owner on Oct 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
cmd_jvars.cpp
executable file
·70 lines (63 loc) · 1.78 KB
/
cmd_jvars.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
#include "Revelation.h"
#include "ModuleFactory.h"
#include "Game.h"
#include "JASS.h"
class cmd_jvars : public ModuleFactory
{
public:
cmd_jvars() : ModuleFactory("jvar") { }
private:
virtual bool HandleCommand(string szPayload) const {
if (!szPayload.empty()) {
JASSVar *jVar = GetJassVar(szPayload.c_str());
if (!jVar)
g_Revelation->m_Game->PrintChat(format("Invalid JASS variable %s.") % szPayload, 0xFFFF0000);
else {
string type;
switch (jVar->vartype) {
case 0:
type = "void";
break;
case 4:
type = "integer";
break;
case 5:
type = "real";
g_Revelation->m_Game->PrintChat(format("Found JASS variable %s %s - %.7f") % type % szPayload % * (float *)&jVar->value);
return true;
case 6:
type = "string";
g_Revelation->m_Game->PrintChat(format("Found JASS variable %s %s - %s") % type % szPayload % jStrGet((HANDLE)jVar->value));
return true;
case 8:
type = "boolean";
break;
case 9:
type = "integer array";
break;
case 10:
type = "real array";
break;
case 11:
type = "string array";
break;
case 13:
type = "boolean array";
break;
case 7:
type = "handle";
break;
default:
type = "unknown";
break;
}
g_Revelation->m_Game->PrintChat(format("Found JASS variable %s %s - %X") % type % szPayload % jVar->value);
}
}
return true;
}
static const cmd_jvars m_RegisterThis;
};
#ifdef _DEBUG
const cmd_jvars cmd_jvars::m_RegisterThis;
#endif