1
This commit is contained in:
parent
2260009fc2
commit
f330657fbd
@ -4,6 +4,7 @@
|
|||||||
#include "mt/Buff.h"
|
#include "mt/Buff.h"
|
||||||
|
|
||||||
IMPL_TABLE(mt::Equip)
|
IMPL_TABLE(mt::Equip)
|
||||||
|
std::map<int, const mt::Equip*> mt::Equip::slot_hash_;
|
||||||
|
|
||||||
namespace mt
|
namespace mt
|
||||||
{
|
{
|
||||||
@ -187,6 +188,14 @@ namespace mt
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (inventory_slot().empty()) {
|
||||||
|
_inventory_slot_ = -1;
|
||||||
|
} else {
|
||||||
|
_inventory_slot_ = a8::XValue(inventory_slot());
|
||||||
|
}
|
||||||
|
if (_inventory_slot() > -1) {
|
||||||
|
slot_hash_[_inventory_slot()] = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Equip::GetWeaponIdx() const
|
int Equip::GetWeaponIdx() const
|
||||||
@ -232,5 +241,10 @@ namespace mt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Equip* Equip::GetByIdBySlotId(int slot_id)
|
||||||
|
{
|
||||||
|
auto itr = slot_hash_.find(slot_id);
|
||||||
|
return itr != slot_hash_.end() ? itr->second : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,10 @@ namespace mt
|
|||||||
void Init2();
|
void Init2();
|
||||||
int GetWeaponIdx() const;
|
int GetWeaponIdx() const;
|
||||||
bool Match(CondAddBuff_e cond, int val, int val2) const;
|
bool Match(CondAddBuff_e cond, int val, int val2) const;
|
||||||
static const Equip* GetByIdBySlotId(int slot_id) {};
|
static const Equip* GetByIdBySlotId(int slot_id);
|
||||||
|
|
||||||
};
|
private:
|
||||||
|
static std::map<int, const mt::Equip*> slot_hash_;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user