From fc72bff73ad8071e49f300a82170d63544e90570 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Fri, 26 Jan 2024 18:09:28 -0300 Subject: [PATCH] fix: gem atelier drop loot --- data/libs/functions/player.lua | 1 - .../monster/ondroploot_gem_atelier.lua | 14 ++++++++++++++ data/scripts/reward_chest/boss_death.lua | 3 ++- data/scripts/talkactions/god/zones.lua | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 data/scripts/eventcallbacks/monster/ondroploot_gem_atelier.lua diff --git a/data/libs/functions/player.lua b/data/libs/functions/player.lua index f9940570c1d..4392a85b2bb 100644 --- a/data/libs/functions/player.lua +++ b/data/libs/functions/player.lua @@ -354,7 +354,6 @@ function Player.sendWeatherEffect(self, groundEffect, fallEffect, thunderEffect) if topCreature and topCreature:isPlayer() and topCreature:getAccountType() < ACCOUNT_TYPE_SENIORTUTOR then position:sendMagicEffect(CONST_ME_BIGCLOUDS, self) doTargetCombatHealth(0, self, COMBAT_ENERGYDAMAGE, -weatherConfig.minDMG, -weatherConfig.maxDMG, CONST_ME_NONE) - --self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You were hit by lightning and lost some health.") end end end diff --git a/data/scripts/eventcallbacks/monster/ondroploot_gem_atelier.lua b/data/scripts/eventcallbacks/monster/ondroploot_gem_atelier.lua new file mode 100644 index 00000000000..d1fb6ad38b1 --- /dev/null +++ b/data/scripts/eventcallbacks/monster/ondroploot_gem_atelier.lua @@ -0,0 +1,14 @@ +local callback = EventCallback() + +function callback.monsterOnDropLoot(monster, corpse) + if not monster or not corpse then + return + end + local player = Player(corpse:getCorpseOwner()) + if not player or not player:canReceiveLoot() then + return + end + corpse:addLoot(monster:generateGemAtelierLoot()) +end + +callback:register() diff --git a/data/scripts/reward_chest/boss_death.lua b/data/scripts/reward_chest/boss_death.lua index 04bb12b84bc..900d8538d01 100644 --- a/data/scripts/reward_chest/boss_death.lua +++ b/data/scripts/reward_chest/boss_death.lua @@ -102,7 +102,8 @@ function bossDeath.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUn rolls = math.floor(rolls) end - local playerLoot = monsterType:getBossReward(lootFactor, _ == 1, false, {}) + local playerLoot = creature:generateGemAtelierLoot() + playerLoot = monsterType:getBossReward(lootFactor, _ == 1, false, playerLoot) for _ = 2, rolls do playerLoot = monsterType:getBossReward(lootFactor, false, true, playerLoot) end diff --git a/data/scripts/talkactions/god/zones.lua b/data/scripts/talkactions/god/zones.lua index 1eaaf37a098..542a82844c2 100644 --- a/data/scripts/talkactions/god/zones.lua +++ b/data/scripts/talkactions/god/zones.lua @@ -4,7 +4,7 @@ function zones.onSay(player, words, param) local params = string.split(param, ",") local cmd = params[1] if not cmd then - player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command not found.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Command not found.") return true end