添加getEntityAllEffects接口

This commit is contained in:
子沐呀
2024-08-01 21:23:33 +08:00
Unverified
parent 2f987b1c93
commit 4857867821
3 changed files with 26 additions and 15 deletions
+9
View File
@@ -1,5 +1,6 @@
#include "Global.h"
#include <regex>
#include <vector>
bool isInteger(const std::string& str) {
std::regex pattern("^[+-]?\\d+$");
@@ -935,6 +936,14 @@ void Export_Compatibility_API() {
RemoteCall::exportAs("GMLIB_API", "entityHasEffect", [](Actor* entity, int effectId) -> int {
return entity->hasEffect(*MobEffect::getById(effectId));
});
RemoteCall::exportAs("GMLIB_API", "getEntityAllEffects", [](Actor* entity) -> std::vector<int> {
auto effects = entity->getAllEffects();
std::vector<int> results = {};
for (auto effect : effects) {
results.push_back((int)effect.mId);
}
return results;
});
RemoteCall::exportAs("GMLIB_API", "getGameDifficulty", []() -> int {
if (auto level = ll::service::getLevel()) {
return (int)level->getDifficulty();