forked from jewalky/srvmgr
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathautobuff.cpp
More file actions
24 lines (21 loc) · 689 Bytes
/
Copy pathautobuff.cpp
File metadata and controls
24 lines (21 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "a2types.h"
#include "lib/utils.hpp"
#include "player_settings.h"
#include "quests.h"
auto a2PickSpell = (void* (__stdcall *)(void* unit, int spell_number, int unused))(0x005a79d6);
bool CanCast(A2Unit* unit, int spell_number) {
if (unit->player->is_ai) {
return true;
}
auto player_settings = settings::Find(unit->player->name);
if (player_settings && (player_settings->autobuff_mask & (1 << spell_number))) {
return false;
}
return true;
}
void* __stdcall autobuff(A2Unit* unit, int spell_number, int unused) {
if (!CanCast(unit, spell_number)) {
return nullptr;
}
return a2PickSpell(unit, spell_number, unused);
}