Skip to content

Commit

Permalink
adding highlight loot to quickloot
Browse files Browse the repository at this point in the history
  • Loading branch information
carlospess0a committed Sep 1, 2024
1 parent 8056ca6 commit b57a154
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions data/libs/functions/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions data/scripts/eventcallbacks/monster/ondroploot__base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()

2 changes: 2 additions & 0 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/lua/functions/core/game/lua_enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b57a154

Please sign in to comment.