Skip to content

Commit

Permalink
lua formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed Feb 22, 2024
1 parent 9f888bb commit 51799c1
Showing 1 changed file with 31 additions and 30 deletions.
61 changes: 31 additions & 30 deletions data-otservbr-global/npc/altar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit 51799c1

Please sign in to comment.