diff --git a/Source/Contents/NavigationManager.h b/Source/Contents/NavigationManager.h index 1d8ba3ad..ba3939ef 100644 --- a/Source/Contents/NavigationManager.h +++ b/Source/Contents/NavigationManager.h @@ -163,6 +163,8 @@ struct NaviObjectRecord { }; #pragma pack(pop) +CNavi_Object* FindNaviObjectByName(const char* name, const std::vector& objects); + class CNaviInfo { public: CNaviInfo(int index, const char* name, const char* title, int cellX, int cellY, int type); @@ -184,6 +186,7 @@ public: CNavi_Link* FindLink(unsigned int key, bool byId); CNavi_Object* FindNpc(unsigned int key, bool byId); CNavi_Object* FindNpcAt(int cellX, int cellY); + CNavi_Object* FindMobByName(const char* name); std::vector* Npcs(); int LinkCount() const; int MobCount() const; diff --git a/Source/Contents/NavigationRequest.cpp b/Source/Contents/NavigationRequest.cpp index d4a68bd9..285e78ae 100644 --- a/Source/Contents/NavigationRequest.cpp +++ b/Source/Contents/NavigationRequest.cpp @@ -9,6 +9,17 @@ #include #include +// OFFSET: 0x00B8C0B0 +// FUNCTION: fn_19420 +__declspec(noinline) CNavi_Object* FindNaviObjectByName(const char* name, const std::vector& objects) { + for (CNavi_Object* object : objects) { + if (name && std::string(name) == object->name) { + return object; + } + } + return nullptr; +} + // OFFSET: 0x00B8DF10 // FUNCTION: fn_19461 std::uint16_t CNavi_Object::GetFlag() const { @@ -540,3 +551,9 @@ void CNaviInfo::SearchNpcs(const std::vector& keywords, std::vector out.push_back(target); } } + +// OFFSET: 0x00B8E410 +// FUNCTION: fn_19470 +CNavi_Object* CNaviInfo::FindMobByName(const char* name) { + return FindNaviObjectByName(name, this->mobs); +}