diff --git a/lib/GMLIB_API-JS.d.ts b/lib/GMLIB_API-JS.d.ts index 1109e5f..ed07bc1 100644 --- a/lib/GMLIB_API-JS.d.ts +++ b/lib/GMLIB_API-JS.d.ts @@ -1103,49 +1103,6 @@ interface Player { /** 效果ID */ effectId: number ): boolean; - - /** (GMLIB)获取buff信息 */ - getEffectInfo( - /** 效果ID */ - effectId: number - ): { - /** 效果ID */ - Id: number, - /** 效果等级 */ - Amplifier: number, - /** 持续时间 */ - Duration: number, - /** 简单难度下的持续时间 */ - DurationEasy: number, - /** 普通难度下的持续时间 */ - DurationNormal: number, - /** 困难难度下的持续时间 */ - DurationHard: number, - /** 是否为信标给予 */ - Ambient: boolean, - /** 是否显示粒子效果 */ - ShowParticles: boolean - } | null; - - /** (GMLIB)获取所有buff信息 */ - getAllEffectsInfo(): { - /** 效果ID */ - Id: number, - /** 效果等级 */ - Amplifier: number, - /** 持续时间 */ - Duration: number, - /** 简单难度下的持续时间 */ - DurationEasy: number, - /** 普通难度下的持续时间 */ - DurationNormal: number, - /** 困难难度下的持续时间 */ - DurationHard: number, - /** 是否为信标给予 */ - Ambient: boolean, - /** 是否显示粒子效果 */ - ShowParticles: boolean - }[]; } interface Entity { @@ -1204,6 +1161,49 @@ interface Entity { /** 实体族 */ family: string ): boolean; + + /** (GMLIB)获取buff信息 */ + getEffectInfo( + /** 效果ID */ + effectId: number + ): { + /** 效果ID */ + Id: number, + /** 效果等级 */ + Amplifier: number, + /** 持续时间 */ + Duration: number, + /** 简单难度下的持续时间 */ + DurationEasy: number, + /** 普通难度下的持续时间 */ + DurationNormal: number, + /** 困难难度下的持续时间 */ + DurationHard: number, + /** 是否为信标给予 */ + Ambient: boolean, + /** 是否显示粒子效果 */ + ShowParticles: boolean + } | null; + + /** (GMLIB)获取所有buff信息 */ + getAllEffectsInfo(): { + /** 效果ID */ + Id: number, + /** 效果等级 */ + Amplifier: number, + /** 持续时间 */ + Duration: number, + /** 简单难度下的持续时间 */ + DurationEasy: number, + /** 普通难度下的持续时间 */ + DurationNormal: number, + /** 困难难度下的持续时间 */ + DurationHard: number, + /** 是否为信标给予 */ + Ambient: boolean, + /** 是否显示粒子效果 */ + ShowParticles: boolean + }[]; } interface Block { diff --git a/lib/GMLIB_API-JS.js b/lib/GMLIB_API-JS.js index f9cf0c2..0813107 100644 --- a/lib/GMLIB_API-JS.js +++ b/lib/GMLIB_API-JS.js @@ -345,21 +345,21 @@ const GMLIB_API = { /** 获取玩家破坏方块所需时间 @type {function(Player,Block):number} */ getPlayerDestroyBlockProgress: ll.import("GMLIB_API", "getPlayerDestroyBlockProgress"), /** 获取玩家的buff是否显示 @type {function(Player,number):boolean} */ - getPlayerEffectVisible: ll.import("GMLIB_API", "getPlayerEffectVisible"), + getEntityEffectVisible: ll.import("GMLIB_API", "getEntityEffectVisible"), /** 获取玩家的buff持续时间 @type {function(Player,number):number} */ - getPlayerEffectDuration: ll.import("GMLIB_API", "getPlayerEffectDuration"), + getEntityEffectDuration: ll.import("GMLIB_API", "getEntityEffectDuration"), /** 获取玩家的buff简单模式下的持续时间 @type {function(Player,number):number} */ - getPlayerEffectDurationEasy: ll.import("GMLIB_API", "getPlayerEffectDuration"), + getEntityEffectDurationEasy: ll.import("GMLIB_API", "getEntityEffectDuration"), /** 获取玩家的buff困难模式下的持续时间 @type {function(Player,number):number} */ - getPlayerEffectDurationHard: ll.import("GMLIB_API", "getPlayerEffectDurationHard"), + getEntityEffectDurationHard: ll.import("GMLIB_API", "getEntityEffectDurationHard"), /** 获取玩家的buff普通模式下的持续时间 @type {function(Player,number):number} */ - getPlayerEffectDurationNormal: ll.import("GMLIB_API", "getPlayerEffectDurationNormal"), + getEntityEffectDurationNormal: ll.import("GMLIB_API", "getEntityEffectDurationNormal"), /** 获取玩家的buff效果等级 @type {function(Player,number):number} */ - getPlayerEffectAmplifier: ll.import("GMLIB_API", "getPlayerEffectAmplifier"), + getEntityEffectAmplifier: ll.import("GMLIB_API", "getEntityEffectAmplifier"), /** 获取玩家的buff是否为信标给予 @type {function(Player,number):boolean} */ - getPlayerEffectAmbient: ll.import("GMLIB_API", "getPlayerEffectAmbient"), + getEntityEffectAmbient: ll.import("GMLIB_API", "getEntityEffectAmbient"), /** 玩家是否拥有buff效果 @type {function(Player,number):boolean} */ - playerHasEffect: ll.import("GMLIB_API", "playerHasEffect"), + entityHasEffect: ll.import("GMLIB_API", "entityHasEffect"), /** 获取游戏难度 @type {function():number} */ getGameDifficulty: ll.import("GMLIB_API", "getGameDifficulty"), /** 设置游戏难度 @type {function(difficulty):void} */ @@ -2583,7 +2583,7 @@ LLSE_Player.prototype.getDestroyProgress = return GMLIB_API.getPlayerDestroyBlockProgress(this, block); } -LLSE_Player.prototype.hasEffect = +LLSE_Entity.prototype.hasEffect = /** * 玩家是否拥有buff效果 * @param {number} effectId buff效果ID @@ -2593,7 +2593,7 @@ LLSE_Player.prototype.hasEffect = return GMLIB_API.playerHasEffect(this, effectId); } -LLSE_Player.prototype.getEffectInfo = +LLSE_Entity.prototype.getEffectInfo = /** * 获取buff信息 * @param {number} effectId buff效果ID @@ -2603,17 +2603,17 @@ LLSE_Player.prototype.getEffectInfo = if (!this.hasEffect(effectId)) return null; return { Id: id, - Amplifier: GMLIB_API.getPlayerEffectAmbient(this, effectId), - Duration: GMLIB_API.getPlayerEffectDuration(this, effectId), - DurationEasy: GMLIB_API.getPlayerEffectDurationEasy(this, effectId), - DurationNormal: GMLIB_API.getPlayerEffectDurationNormal(this, effectId), - DurationHard: GMLIB_API.getPlayerEffectDurationHard(this, effectId), - Ambient: GMLIB_API.getPlayerEffectAmbient(this, effectId), - ShowParticles: GMLIB_API.getPlayerEffectAmbient(this, effectId), + Amplifier: GMLIB_API.getEntityEffectAmbient(this, effectId), + Duration: GMLIB_API.getEntityEffectDuration(this, effectId), + DurationEasy: GMLIB_API.getEntityEffectDurationEasy(this, effectId), + DurationNormal: GMLIB_API.getEntityEffectDurationNormal(this, effectId), + DurationHard: GMLIB_API.getEntityEffectDurationHard(this, effectId), + Ambient: GMLIB_API.getEntityEffectAmbient(this, effectId), + ShowParticles: GMLIB_API.getEntityEffectAmbient(this, effectId), } } -LLSE_Player.prototype.getAllEffectsInfo = +LLSE_Entity.prototype.getAllEffectsInfo = /** * 获取所有buff信息 * @returns {{Id: number, Amplifier: number, Duration: number, DurationEasy: number, DurationNormal: number, DurationHard: number, Ambient: boolean, ShowParticles: boolean}[]} diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index 4ef3312..e09c092 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -890,50 +890,50 @@ void Export_Compatibility_API() { RemoteCall::exportAs("GMLIB_API", "getPlayerDestroyBlockProgress", [](Player* player, Block const* block) -> float { return player->getDestroyProgress(*block); }); - RemoteCall::exportAs("GMLIB_API", "getPlayerEffectVisible", [](Player* player, int effectId) -> bool { - if (auto effect = player->getEffect(effectId)) { + RemoteCall::exportAs("GMLIB_API", "getEntityEffectVisible", [](Actor* entity, int effectId) -> bool { + if (auto effect = entity->getEffect(effectId)) { return effect->mEffectVisible; } return 0; }); - RemoteCall::exportAs("GMLIB_API", "getPlayerEffectDuration", [](Player* player, int effectId) -> int { - if (auto effect = player->getEffect(effectId)) { + RemoteCall::exportAs("GMLIB_API", "getEntityEffectDuration", [](Actor* entity, int effectId) -> int { + if (auto effect = entity->getEffect(effectId)) { return effect->mDuration; } return 0; }); - RemoteCall::exportAs("GMLIB_API", "getPlayerEffectDurationEasy", [](Player* player, int effectId) -> int { - if (auto effect = player->getEffect(effectId)) { + RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationEasy", [](Actor* entity, int effectId) -> int { + if (auto effect = entity->getEffect(effectId)) { return effect->mDurationEasy; } return 0; }); - RemoteCall::exportAs("GMLIB_API", "getPlayerEffectDurationHard", [](Player* player, int effectId) -> int { - if (auto effect = player->getEffect(effectId)) { + RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationHard", [](Actor* entity, int effectId) -> int { + if (auto effect = entity->getEffect(effectId)) { return effect->mDurationHard; } return 0; }); - RemoteCall::exportAs("GMLIB_API", "getPlayerEffectDurationNormal", [](Player* player, int effectId) -> int { - if (auto effect = player->getEffect(effectId)) { + RemoteCall::exportAs("GMLIB_API", "getEntityEffectDurationNormal", [](Actor* entity, int effectId) -> int { + if (auto effect = entity->getEffect(effectId)) { return effect->mDurationNormal; } return 0; }); - RemoteCall::exportAs("GMLIB_API", "getPlayerEffectAmplifier", [](Player* player, int effectId) -> int { - if (auto effect = player->getEffect(effectId)) { + RemoteCall::exportAs("GMLIB_API", "getEntityEffectAmplifier", [](Actor* entity, int effectId) -> int { + if (auto effect = entity->getEffect(effectId)) { return effect->mAmplifier; } return 0; }); - RemoteCall::exportAs("GMLIB_API", "getPlayerEffectAmbient", [](Player* player, int effectId) -> bool { - if (auto effect = player->getEffect(effectId)) { + RemoteCall::exportAs("GMLIB_API", "getEntityEffectAmbient", [](Actor* entity, int effectId) -> bool { + if (auto effect = entity->getEffect(effectId)) { return effect->mAmbient; } return 0; }); - RemoteCall::exportAs("GMLIB_API", "playerHasEffect", [](Player* player, int effectId) -> int { - return player->hasEffect(*MobEffect::getById(effectId)); + RemoteCall::exportAs("GMLIB_API", "entityHasEffect", [](Actor* entity, int effectId) -> int { + return entity->hasEffect(*MobEffect::getById(effectId)); }); RemoteCall::exportAs("GMLIB_API", "getGameDifficulty", []() -> int { if (auto level = ll::service::getLevel()) {