Skip to content

Commit

Permalink
fix: npc lokur selling wagon tickets (opentibiabr#1762)
Browse files Browse the repository at this point in the history
Added the option to buy wagon tickets from NPC Lokur.

Fixes opentibiabr#1755
  • Loading branch information
lamonato29 authored and marcusvcj committed Nov 1, 2023
1 parent 8732b97 commit 9494f61
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions data-otservbr-global/npc/lokur.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,32 @@ local function creatureSayCallback(npc, creature, type, message)
return false
end

if MsgContains(message, "ticket") then
if Player(creature):getStorageValue(Storage.WagonTicket) >= os.time() then
npcHandler:say("Your weekly ticket is still valid. Would be a waste of money to purchase a second one", npc, creature)
return true
end

npcHandler:say("Do you want to purchase a weekly ticket for the ore wagons? With it you can travel freely and swiftly through Kazordoon for one week. 250 gold only. Deal?", npc, creature)
npcHandler:setTopic(playerId, 9)
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) > 0 then
local player = Player(creature)
if npcHandler:getTopic(playerId) == 9 then
if not player:removeMoneyBank(250) then
npcHandler:say("You don't have enough money.", npc, creature)
npcHandler:setTopic(playerId, 0)
return true
end

player:setStorageValue(Storage.WagonTicket, os.time() + 7 * 24 * 60 * 60)
npcHandler:say("Here is your stamp. It can't be transferred to another person and will last one week from now. You'll get notified upon using an ore wagon when it isn't valid anymore.", npc, creature)
end
npcHandler:setTopic(playerId, 0)
elseif MsgContains(message, "no") and npcHandler:getTopic(playerId) > 0 then
npcHandler:say("No then.", npc, creature)
npcHandler:setTopic(playerId, 0)
end

-- Parse bank
npc:parseBank(message, npc, creature, npcHandler)
-- Parse guild bank
Expand Down

0 comments on commit 9494f61

Please sign in to comment.