63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
#include "precompile.h"
|
|
|
|
#include "mt/Grasp.h"
|
|
|
|
IMPL_TABLE(mt::Grasp)
|
|
std::map<long long, std::map<int, mt::GraspBuffs>> mt::Grasp:: hero_weapon_hash_;
|
|
|
|
namespace mt
|
|
{
|
|
|
|
void Grasp::Init1()
|
|
{
|
|
buff1_meta = mt::GraspBuff::GetById(graspbuff_id1());
|
|
if (graspbuff_id1() && !buff1_meta) {
|
|
abort();
|
|
}
|
|
floor2_buff_meta = mt::GraspBuff::GetById(graspbuff_id1_floor2());
|
|
if (graspbuff_id1_floor2() && !floor2_buff_meta) {
|
|
abort();
|
|
}
|
|
buff2_meta = mt::GraspBuff::GetById(graspbuff_id2());
|
|
if (graspbuff_id2() && !buff2_meta) {
|
|
abort();
|
|
}
|
|
}
|
|
|
|
void Grasp::Init2()
|
|
{
|
|
|
|
}
|
|
|
|
void Grasp::StaticPreInit()
|
|
{
|
|
Traverse
|
|
(
|
|
[] (const mt::Grasp* meta, bool& stop)
|
|
{
|
|
auto itr = hero_weapon_hash_.find(a8::MakeInt64(meta->hero_id(), meta->weapon_id()));
|
|
if (itr != hero_weapon_hash_.end()) {
|
|
auto itr2 = itr->second.find(meta->hero_lv());
|
|
if (itr2 == itr->second.end()) {
|
|
itr->second[meta->hero_lv()] = GraspBuffs();
|
|
}
|
|
itr2 = itr->second.find(meta->hero_lv());
|
|
if (itr2 == itr->second.end()) {
|
|
abort();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
GraspBuffs* Grasp::GetGrasp(int hero_id, int hero_lv, int weapon_id)
|
|
{
|
|
auto itr = hero_weapon_hash_.find(a8::MakeInt64(hero_id, weapon_id));
|
|
if (itr != hero_weapon_hash_.end()) {
|
|
auto itr2 = itr->second.find(hero_lv);
|
|
return itr2 != itr->second.end() ? &itr2->second : nullptr;
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
}
|