From 51799c17c181615a7157a237368ca228efb8bb9c Mon Sep 17 00:00:00 2001 From: Elson Costa Date: Thu, 22 Feb 2024 14:53:17 -0300 Subject: [PATCH] lua formatter. --- data-otservbr-global/npc/altar.lua | 61 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/data-otservbr-global/npc/altar.lua b/data-otservbr-global/npc/altar.lua index 44c7758844a..7c5f27bed5c 100644 --- a/data-otservbr-global/npc/altar.lua +++ b/data-otservbr-global/npc/altar.lua @@ -42,39 +42,40 @@ npcType.onSay = function(npc, creature, type, message) end local function creatureSayCallback(npc, creature, type, message) - local player = Player(creature) - local playerId = player:getId() - - if not npcHandler:checkInteraction(npc, creature) then - return false - end - - message = message:lower() - if MsgContains(message, "offer") then - npcHandler:say("Five tainted hearts and five darklight hearts drowned in a worldly wealth of 50000000 gold pieces for the righteous. Are you prepared?", npc, creature) - npcHandler:setTopic(playerId, 1) - elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 1 then - npcHandler:setTopic(playerId, 0) - if player:getItemCount(43855) < 5 or player:getItemCount(43854) < 5 then -- Verifica se o jogador tem menos de 5 de cada item - npcHandler:say("Sorry, you don't have all items.", npc, creature) - return true - end - - if not player:removeMoneyBank(50000000) then + local player = Player(creature) + local playerId = player:getId() + + if not npcHandler:checkInteraction(npc, creature) then + return false + end + + message = message:lower() + if MsgContains(message, "offer") then + npcHandler:say("Five tainted hearts and five darklight hearts drowned in a worldly wealth of 50000000 gold pieces for the righteous. Are you prepared?", npc, creature) + npcHandler:setTopic(playerId, 1) + elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 1 then + npcHandler:setTopic(playerId, 0) + if player:getItemCount(43855) < 5 or player:getItemCount(43854) < 5 then + -- Verifica se o jogador tem menos de 5 de cada item + npcHandler:say("Sorry, you don't have all items.", npc, creature) + return true + end + + if not player:removeMoneyBank(50000000) then npcHandler:say("Sorry, you don't have enough gold.", npc, creature) - return true - end - - if player:removeItem(43855, 5) and player:removeItem(43854, 5) then - player:addItem(43895, 1) - npcHandler:say("Your sacrifice has been accepted, mortal. Embrace your reward!", npc, creature) - end - elseif MsgContains(message, "no") and npcHandler:getTopic(playerId) == 1 then - npcHandler:setTopic(playerId, 0) + return true + end + + if player:removeItem(43855, 5) and player:removeItem(43854, 5) then + player:addItem(43895, 1) + npcHandler:say("Your sacrifice has been accepted, mortal. Embrace your reward!", npc, creature) + end + elseif MsgContains(message, "no") and npcHandler:getTopic(playerId) == 1 then + npcHandler:setTopic(playerId, 0) npcHandler:say("Ok then not.", npc, creature) - end + end - return true + return true end npcHandler:setMessage(MESSAGE_GREET, "Kneel before the all-devouring power of blooded decay.")