Skip to content

Commit

Permalink
Roshamuul Quest
Browse files Browse the repository at this point in the history
I managed to make some scripts that weren't working work, however, I realized that all or part of the task mechanics needed to be developed.
  • Loading branch information
htc16 committed Sep 4, 2024
1 parent 4989c6a commit 6ccd18d
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 59 deletions.
4 changes: 0 additions & 4 deletions data-otservbr-global/lib/core/constants.lua
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
ROSHAMUUL_MORTAR_THROWN = 20200
ROSHAMUUL_KILLED_FRAZZLEMAWS = 20201
ROSHAMUUL_KILLED_SILENCERS = 20202
ROSHAMUUL_GOLD_RECORD = 20203
9 changes: 8 additions & 1 deletion data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,14 @@ Storage = {
},
U10_30 = { -- update 10.30 - Reserved Storages 44401 - 44500
DreamWardenOutfits = {},
Roshamuul = {},
RoshamuulQuest = {
Constants = {
Roshamuul_Mortar_Thrown = 44401,
Roshamuul_Killed_Frazzlemaws = 44402,
Roshamuul_Killed_Silencers = 44403,
Roshamuul_Gold_Record = 44404,
},
},
},
U10_37 = { -- update 10.37 - Reserved Storages 44501 - 44550
TinderBox = {},
Expand Down
32 changes: 16 additions & 16 deletions data-otservbr-global/npc/sandomo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ end

function Player.getInquisitionGold(self)
local v = {
math.max(0, self:getStorageValue(ROSHAMUUL_MORTAR_THROWN)) * 100,
math.max(0, self:getStorageValue(ROSHAMUUL_KILLED_FRAZZLEMAWS)),
math.max(0, self:getStorageValue(ROSHAMUUL_KILLED_SILENCERS)),
math.max(0, self:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown)) * 100,
math.max(0, self:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Frazzlemaws)),
math.max(0, self:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Silencers)),
}
return v[1] + v[2] + v[3]
end
Expand Down Expand Up @@ -102,17 +102,17 @@ local function creatureSayCallback(npc, creature, type, message)
if player:getInquisitionGold() > 0 then
npcHandler:setTopic(playerId, 4)
npcHandler:say({
"Alright, so you mixed and delivered " .. math.max(0, player:getStorageValue(ROSHAMUUL_MORTAR_THROWN)) .. " mortar and ...",
"You killed " .. math.max(0, player:getStorageValue(ROSHAMUUL_KILLED_FRAZZLEMAWS)) .. " frazzlemaws and ...",
"You also hunted " .. math.max(0, player:getStorageValue(ROSHAMUUL_KILLED_SILENCERS)) .. " silencers. That would equal " .. player:getInquisitionGold() .. " of inquisition gold - BUT we are currently short of this valuable metal so... do you want me to add this amount to my {books} for now or {trade} it for something else.",
"Alright, so you mixed and delivered " .. math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown)) .. " mortar and ...",
"You killed " .. math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Frazzlemaws)) .. " frazzlemaws and ...",
"You also hunted " .. math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Silencers)) .. " silencers. That would equal " .. player:getInquisitionGold() .. " of inquisition gold - BUT we are currently short of this valuable metal so... do you want me to add this amount to my {books} for now or {trade} it for something else.",
}, npc, creature)
else
npcHandler:setTopic(playerId, nil)
npcHandler:say("Come back after you have done at least one of the tasks I talked you about.", npc, creature)
end
end
elseif npcHandler:getTopic(playerId) == 4 then
local v = math.max(0, player:getStorageValue(ROSHAMUUL_GOLD_RECORD))
local v = math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record))
if MsgContains(message, "book") or MsgContains(message, "books") then
npcHandler:setTopic(playerId, 5)
npcHandler:say({
Expand All @@ -126,21 +126,21 @@ local function creatureSayCallback(npc, creature, type, message)
"Good. Registered as... " .. player:getName() .. "... with... about " .. player:getInquisitionGold() .. " of righteously earned inquisition gold added. There. Thanks for your help! ..",
"Good. Ask me any time in case you want to know your current {record}. If you have time, Remember you can also {trade} your earnings into some of these... probably far more valuable, ahem... cluster... things, yes.",
}, npc, creature)
player:setStorageValue(ROSHAMUUL_GOLD_RECORD, player:getInquisitionGold())
player:setStorageValue(ROSHAMUUL_MORTAR_THROWN, 0)
player:setStorageValue(ROSHAMUUL_KILLED_FRAZZLEMAWS, 0)
player:setStorageValue(ROSHAMUUL_KILLED_SILENCERS, 0)
player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record, player:getInquisitionGold())
player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown, 0)
player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Frazzlemaws, 0)
player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Silencers, 0)
npcHandler:setTopic(playerId, nil)
end
elseif MsgContains(message, "record") then
local v = player:getStorageValue(ROSHAMUUL_GOLD_RECORD)
local v = player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record)
if v > 0 then
npcHandler:say("You have " .. v .. " inquisition gold registered in my book.", npc, creature)
else
npcHandler:say("I do not see inquisition gold registered in my book from you.", npc, creature)
end
elseif MsgContains(message, "trade") then
local v = player:getStorageValue(ROSHAMUUL_GOLD_RECORD)
local v = player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record)
if v >= 100 then
npcHandler:setTopic(playerId, 6)
npcHandler:say("Ah yes, you currently have " .. v .. " of righteously earned inquisition gold in my book. 100 inquisition gold equals one cluster. How many clusters do you want in exchange?", npc, creature)
Expand All @@ -154,15 +154,15 @@ local function creatureSayCallback(npc, creature, type, message)
return npcHandler:say("You should tell me a real number.", npc, creature)
end

local max = math.floor(player:getStorageValue(ROSHAMUUL_GOLD_RECORD) / 100)
local max = math.floor(player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record) / 100)
if v > max then
return npcHandler:say("You do not have enough inquisition gold for that, so far you can ask for up to " .. max .. " clusters.", npc, creature)
end

player:addItem(20062, v)
npcHandler:setTopic(playerId, nil)
player:setStorageValue(ROSHAMUUL_GOLD_RECORD, player:getStorageValue(ROSHAMUUL_GOLD_RECORD) - (v * 100))
npcHandler:say("There you are. Now I register " .. player:getStorageValue(ROSHAMUUL_GOLD_RECORD) .. " inquisition gold of yours in my book.", npc, creature)
player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record) - (v * 100))
npcHandler:say("There you are. Now I register " .. player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record) .. " inquisition gold of yours in my book.", npc, creature)
end

if MsgContains(message, "bucket") or MsgContains(message, "supplies") then
Expand Down
16 changes: 7 additions & 9 deletions data-otservbr-global/scripts/lib/register_actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -773,23 +773,21 @@ function onUsePick(player, item, fromPosition, target, toPosition, isHotkey)
addEvent(revertItem, 2 * 60 * 1000, { x = 33277, y = 31754, z = 7 }, 2066, 2071)
end
end
else
return false
end
if (target ~= nil) and target:isItem() and (target:getId() == 20135) then
--Lower Roshamuul
if math.random(100) > 50 then
elseif target.itemid == 20135 then
local chance = math.random(100)
if chance > 50 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Crushing the stone produces some fine gravel.")
target:transform(20133)
target:decay()
else
Game.createMonster("Frazzlemaw", toPosition)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Crushing the stone yields nothing but slightly finer, yet still unusable rubber.")
target:transform(20134)
target:decay()
end
return true
target:decay()
else
return false
end

return true
end

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local lowerRoshamuulTrough = Action()

function lowerRoshamuulTrough.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if (target == nil) or not target:isItem() then
return false
Expand All @@ -7,7 +8,7 @@ function lowerRoshamuulTrough.onUse(player, item, fromPosition, target, toPositi
if target:getId() == 20216 then
item:transform(2873, 0)
toPosition:sendMagicEffect(10)
player:setStorageValue(ROSHAMUUL_MORTAR_THROWN, math.max(0, player:getStorageValue(ROSHAMUUL_MORTAR_THROWN)) + 1)
player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown, math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown)) + 1)
end
return true
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
local lowerRoshamuul20122 = MoveEvent()

function lowerRoshamuul20122.onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return false
end

if item:getId() == 20122 then
player:teleportTo(Position(33554, 32546, 7))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
end

return false
end

lowerRoshamuul20122:type("stepin")
lowerRoshamuul20122:id(20122)
lowerRoshamuul20122:register()

local roshamuulCaves = {
Position(33560, 32523, 8),
Position(33554, 32543, 8),
Position(33573, 32545, 8),
Position(33543, 32560, 8),
Position(33579, 32565, 8),
Position(33527, 32597, 8),
}

local lowerRoshamuul1500 = MoveEvent()

function lowerRoshamuul1500.onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return false
end

if item:getActionId() == 55000 then
player:teleportTo(roshamuulCaves[math.random(#roshamuulCaves)])
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
end

return false
end

lowerRoshamuul1500:type("stepin")
lowerRoshamuul1500:aid(55000)
lowerRoshamuul1500:register()
11 changes: 11 additions & 0 deletions data-otservbr-global/startup/tables/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,17 @@ ItemAction = {
{ x = 32788, y = 32227, z = 14 },
},
},
-- Roshamuul Quest
[55000] = {
itemId = false,
itemPos = {
{ x = 33560, y = 32525, z = 7 },
{ x = 33554, y = 32545, z = 7 },
{ x = 33573, y = 32547, z = 7 },
{ x = 33543, y = 32562, z = 7 },
{ x = 33579, y = 32567, z = 7 },
},
},
-- Spike Tasks
[56421] = {
itemId = 1949,
Expand Down

0 comments on commit 6ccd18d

Please sign in to comment.