This commit is contained in:
aozhiwei 2023-02-13 11:19:38 +08:00
parent 3f994216e1
commit 4607c7a071
2 changed files with 60 additions and 1 deletions

View File

@ -1,10 +1,18 @@
#include "precompile.h"
#include <a8/magicenum.h>
#include "selfchecker.h"
#include "mt/Equip.h"
#include "mt/Buff.h"
std::set<int> SelfChecker::used_buffs;
void SelfChecker::Init()
{
std::set<int> buff_list({
#if 0
std::set<int> used_buffs({
1005,
1025,
1039,
@ -15,6 +23,44 @@ void SelfChecker::Init()
FLY_BUFFID,
JUMP_BUFFID
});
#endif
auto fields = a8::GetEnumFields<SpecBuffId_e>();
for (auto& pair : *fields) {
AddBuff(pair.second);
}
mt::Equip::Traverse
(
[] (const mt::Equip* meta, bool& stop)
{
if (meta->buffid()) {
SelfChecker::AddBuff(meta->buffid());
}
if (meta->equip_subtype() == GUN_SUB_EQUIP_TYPE_FLY_HOOk) {
SelfCheker::AddBuff(meta->_int_param1);
SelfChecker::AddBuff(meta->_int_param2);
}
if (meta->equip_type() == EQUIP_TYPE_THROW &&
meta->equip_subtype() == THROW_EQUIP_TYPE_ADD_BUFF) {
SelfCheker::AddBuff(meta->_int_param1);
}
switch (meta->_inventory_slot()) {
case IS_C4:
{
SelfCheker::AddBuff(meta->_int_param1);
}
break;
default:
{
}
break;
}
});
mt::Buff::Traverse
(
[] (const mt::Buff* meta, bool& stop)
{
});
}
void SelfChecker::UnInit()
@ -26,3 +72,11 @@ void SelfChecker::Check()
{
}
void SelfChecker::AddBuff(int buff_id)
{
if (!mt::Buff::GetById(buff_id)) {
abort();
}
used_buffs.insert(buff_id);
}

View File

@ -7,4 +7,9 @@ class SelfChecker
static void UnInit();
static void Check();
private:
static void AddBuff(int buff_id);
static std::set<int> used_buffs;
};