-
Notifications
You must be signed in to change notification settings - Fork 498
Expand file tree
/
Copy pathcounters.cpp
More file actions
44 lines (36 loc) · 1.13 KB
/
Copy pathcounters.cpp
File metadata and controls
44 lines (36 loc) · 1.13 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
// Show creature counter values
#include "Console.h"
#include "Export.h"
#include "PluginManager.h"
#include "modules/Gui.h"
#include "df/unit.h"
#include "df/unit_misc_trait.h"
using std::vector;
using std::string;
using namespace DFHack;
using namespace df::enums;
command_result df_counters (color_ostream &out, vector <string> & parameters)
{
df::unit *unit = Gui::getSelectedUnit(out);
if (!unit)
return CR_WRONG_USAGE;
auto &counters = unit->status.misc_traits;
for (size_t i = 0; i < counters.size(); i++)
{
auto counter = counters[i];
out.print("{} ({}) : {}\n", (int)counter->id, ENUM_KEY_STR(misc_trait_type, counter->id), counter->value);
}
return CR_OK;
}
DFHACK_PLUGIN("counters");
DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands)
{
commands.push_back(PluginCommand("counters",
"Display counters for currently selected creature",
df_counters));
return CR_OK;
}
DFhackCExport command_result plugin_shutdown ( color_ostream &out )
{
return CR_OK;
}