mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-20 06:31:06 +03:00
feat(ui): implement post-token-parsing logic in Script_GetGUIDFromToken
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
This commit is contained in:
parent
43cb20cd0f
commit
6e1eb93ff9
@ -3,6 +3,20 @@
|
||||
#include "ui/game/CGGameUI.hpp"
|
||||
#include <storm/String.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
bool ParseTrailingTokens(const char* token, WOWGUID& guid, CGPlayer_C* player) {
|
||||
// TODO
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Script_GetGUIDFromString(const char*& token, WOWGUID& guid) {
|
||||
// TODO
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Script_GetGUIDFromToken(const char* token, WOWGUID& guid, bool defaultToTarget) {
|
||||
auto activePlayer = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPE_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
@ -118,7 +132,11 @@ bool Script_GetGUIDFromToken(const char* token, WOWGUID& guid, bool defaultToTar
|
||||
else if (!SStrCmpI(parseToken, "mouseover", 9)) {
|
||||
parseToken += 9;
|
||||
|
||||
// TODO
|
||||
auto trackedObjectGuid = CGGameUI::GetCurrentObjectTrack();
|
||||
|
||||
if (ClntObjMgrObjectPtr(trackedObjectGuid, TYPE_UNIT, __FILE__, __LINE__) || CGGameUI::IsRaidMemberOrPet(trackedObjectGuid)) {
|
||||
guid = trackedObjectGuid;
|
||||
}
|
||||
}
|
||||
|
||||
// focus - focus target
|
||||
@ -149,9 +167,25 @@ bool Script_GetGUIDFromToken(const char* token, WOWGUID& guid, bool defaultToTar
|
||||
guid = -1;
|
||||
}
|
||||
|
||||
// TODO ParseTrailingTokens
|
||||
// TODO Script_GetGUIDFromString
|
||||
// TODO guid -2
|
||||
// Token string was fully parsed or GUID was determined and token string potentially includes
|
||||
// trailing tokens
|
||||
if ((*parseToken == '\0' || guid) && ParseTrailingTokens(parseToken, guid, activePlayer)) {
|
||||
if (!guid) {
|
||||
guid = -2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token string was either not parsed or only partially parsed and GUID was not determined
|
||||
if (!guid && Script_GetGUIDFromString(token, guid) && ParseTrailingTokens(token, guid, activePlayer)) {
|
||||
if (!guid) {
|
||||
guid = -2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// GUID was not successfully determined
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include "util/GUID.hpp"
|
||||
|
||||
bool Script_GetGUIDFromString(const char*& token, WOWGUID& guid);
|
||||
|
||||
bool Script_GetGUIDFromToken(const char* token, WOWGUID& guid, bool defaultToTarget);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user