From b57a154dce6b60c1915edb974024fd027ba69368 Mon Sep 17 00:00:00 2001 From: Carlos Pessoa Date: Sun, 1 Sep 2024 08:51:43 -0300 Subject: [PATCH 1/2] adding highlight loot to quickloot --- data/libs/functions/functions.lua | 7 +++++++ data/scripts/eventcallbacks/monster/ondroploot__base.lua | 2 ++ src/game/game.cpp | 2 ++ src/lua/functions/core/game/lua_enums.cpp | 1 + 4 files changed, 12 insertions(+) diff --git a/data/libs/functions/functions.lua b/data/libs/functions/functions.lua index c2349ce7fd6..cc5cd1fd03d 100644 --- a/data/libs/functions/functions.lua +++ b/data/libs/functions/functions.lua @@ -1154,3 +1154,10 @@ function onDeathForDamagingPlayers(creature, func) end end end + +function setLootHighlight(position) + position:sendMagicEffect(CONST_ME_LOOT_HIGHLIGHT) + addEvent(function() + position:removeMagicEffect(CONST_ME_LOOT_HIGHLIGHT) + end, 60000) +end \ No newline at end of file diff --git a/data/scripts/eventcallbacks/monster/ondroploot__base.lua b/data/scripts/eventcallbacks/monster/ondroploot__base.lua index cb7bc4207e8..539bce6f3b9 100644 --- a/data/scripts/eventcallbacks/monster/ondroploot__base.lua +++ b/data/scripts/eventcallbacks/monster/ondroploot__base.lua @@ -31,6 +31,8 @@ function callback.monsterOnDropLoot(monster, corpse) end local existingSuffix = corpse:getAttribute(ITEM_ATTRIBUTE_LOOTMESSAGE_SUFFIX) or "" corpse:setAttribute(ITEM_ATTRIBUTE_LOOTMESSAGE_SUFFIX, existingSuffix .. msgSuffix) + setLootHighlight(corpse:getPosition()) end callback:register() + diff --git a/src/game/game.cpp b/src/game/game.cpp index df1b401bf48..4586a8f0d3f 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -5452,6 +5452,8 @@ void Game::playerQuickLoot(uint32_t playerId, const Position &pos, uint16_t item } } + g_game().removeMagicEffect(corpse->getPosition(), CONST_ME_LOOT_HIGHLIGHT); + if (pos.x == 0xffff && !browseField && !corpse->isRewardCorpse()) { uint32_t worth = item->getWorth(); ObjectCategory_t category = getObjectCategory(item); diff --git a/src/lua/functions/core/game/lua_enums.cpp b/src/lua/functions/core/game/lua_enums.cpp index 05fc72c019f..4af51176fb6 100644 --- a/src/lua/functions/core/game/lua_enums.cpp +++ b/src/lua/functions/core/game/lua_enums.cpp @@ -608,6 +608,7 @@ void LuaEnums::initConstMeEnums(lua_State* L) { registerEnum(L, CONST_ME_DIVINE_EMPOWERMENT); registerEnum(L, CONST_ME_WATER_FLOATING_THRASH); registerEnum(L, CONST_ME_AGONY); + registerEnum(L, CONST_ME_LOOT_HIGHLIGHT); } void LuaEnums::initConstAniEnums(lua_State* L) { From 4471b64e93f78c75e92c200babaed6db2b858481 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sun, 1 Sep 2024 11:52:23 +0000 Subject: [PATCH 2/2] Lua code format - (Stylua) --- data/libs/functions/functions.lua | 2 +- data/scripts/eventcallbacks/monster/ondroploot__base.lua | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/data/libs/functions/functions.lua b/data/libs/functions/functions.lua index cc5cd1fd03d..9738740442e 100644 --- a/data/libs/functions/functions.lua +++ b/data/libs/functions/functions.lua @@ -1160,4 +1160,4 @@ function setLootHighlight(position) addEvent(function() position:removeMagicEffect(CONST_ME_LOOT_HIGHLIGHT) end, 60000) -end \ No newline at end of file +end diff --git a/data/scripts/eventcallbacks/monster/ondroploot__base.lua b/data/scripts/eventcallbacks/monster/ondroploot__base.lua index 539bce6f3b9..40ef0ccf2d9 100644 --- a/data/scripts/eventcallbacks/monster/ondroploot__base.lua +++ b/data/scripts/eventcallbacks/monster/ondroploot__base.lua @@ -35,4 +35,3 @@ function callback.monsterOnDropLoot(monster, corpse) end callback:register() -