Skip to content

Commit

Permalink
Horse Station World Change
Browse files Browse the repository at this point in the history
  • Loading branch information
htc16 committed Aug 18, 2024
1 parent 7290a6b commit ea5f2bb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ Storage = {
WagonTicket = 30009,
FirstMageWeapon = 30011,
KawillBlessing = 30014,
RentedHorseTimer = 30015,
FountainOfLife = 30016,
-- Promotion Storage cannot be changed, it is set in source code
Promotion = 30018,
Expand Down Expand Up @@ -2340,7 +2339,9 @@ Storage = {
Addon1 = 43353,
Addon2 = 43354,
},
HorseStationWorldChange = {},
HorseStationWorldChange = {
Timer = 43355,
},
InsectoidInvasionWorldChange = {},
LooseEnds = {},
OverhuntingWorldChange = {},
Expand Down
4 changes: 2 additions & 2 deletions data-otservbr-global/npc/appaloosa.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ local function creatureSayCallback(npc, creature, type, message)
destination:sendMagicEffect(CONST_ME_TELEPORT)
npcHandler:say("Have a nice trip!", npc, creature)
elseif npcHandler:getTopic(playerId) == 2 then
if player:getStorageValue(Storage.RentedHorseTimer) >= os.time() then
if player:getStorageValue(Storage.Quest.U9_1.HorseStationWorldChange.Timer) >= os.time() then
npcHandler:say("You already have a horse.", npc, creature)
return true
end
Expand All @@ -94,7 +94,7 @@ local function creatureSayCallback(npc, creature, type, message)

local mountId = { 22, 25, 26 }
player:addMount(mountId[math.random(#mountId)])
player:setStorageValue(Storage.RentedHorseTimer, os.time() + 86400)
player:setStorageValue(Storage.Quest.U9_1.HorseStationWorldChange.Timer, os.time() + 86400)
player:addAchievement("Natural Born Cowboy")
npcHandler:say("I'll give you one of our experienced ones. Take care! Look out for low hanging branches.", npc, creature)
end
Expand Down
4 changes: 2 additions & 2 deletions data-otservbr-global/npc/palomino.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ local function creatureSayCallback(npc, creature, type, message)
destination:sendMagicEffect(CONST_ME_TELEPORT)
npcHandler:say("Have a nice trip!", npc, creature)
elseif npcHandler:getTopic(playerId) == 2 then
if player:getStorageValue(Storage.RentedHorseTimer) >= os.time() then
if player:getStorageValue(Storage.Quest.U9_1.HorseStationWorldChange.Timer) >= os.time() then
npcHandler:say("You already have a horse.", npc, creature)
return true
end
Expand All @@ -95,7 +95,7 @@ local function creatureSayCallback(npc, creature, type, message)

local mountId = { 22, 25, 26 }
player:addMount(mountId[math.random(#mountId)])
player:setStorageValue(Storage.RentedHorseTimer, os.time() + 86400)
player:setStorageValue(Storage.Quest.U9_1.HorseStationWorldChange.Timer, os.time() + 86400)
player:addAchievement("Natural Born Cowboy")
npcHandler:say("I'll give you one of our experienced ones. Take care! Look out for low hanging branches.", npc, creature)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function rentedMounts.onThink(interval)
local player, outfit
for i = 1, #players do
player = players[i]
if player:getStorageValue(Storage.RentedHorseTimer) < 1 or player:getStorageValue(Storage.RentedHorseTimer) >= os.time() then
if player:getStorageValue(Storage.Quest.U9_1.HorseStationWorldChange.Timer) < 1 or player:getStorageValue(Storage.Quest.U9_1.HorseStationWorldChange.Timer) >= os.time() then
break
end

Expand All @@ -24,7 +24,7 @@ function rentedMounts.onThink(interval)
player:removeMount(mountIds[m])
end

player:setStorageValue(Storage.RentedHorseTimer, -1)
player:setStorageValue(Storage.Quest.U9_1.HorseStationWorldChange.Timer, -1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your contract with your horse expired and it returned back to the horse station.")
end
return true
Expand Down

0 comments on commit ea5f2bb

Please sign in to comment.