Skip to content

Commit

Permalink
feat: The Lost Brother Quest (#2454)
Browse files Browse the repository at this point in the history
Implementation of the quest "The Lost Brother". It's a small quest initiated with the NPC Tarun, with one of the rewards being able to negotiate with the NPC. So, this part was also modified so that the negotiation can only be done once this quest is complete.
  • Loading branch information
CarlosE-Dev authored Apr 26, 2024
1 parent 142066a commit 56793a0
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 2 deletions.
14 changes: 13 additions & 1 deletion data-otservbr-global/lib/core/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5592,7 +5592,7 @@ if not Quests then
},
[41] = {
name = "Adventurers Guild",
startStorageId = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton,
startStorageId = Storage.AdventurersGuild.QuestLine,
startStorageValue = 1,
missions = {
[1] = {
Expand All @@ -5606,6 +5606,18 @@ if not Quests then
But the dragon hoards might justify the risks. You killed %d/50 dragons and dragon lords."):format(math.max(player:getStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter), 0))
end,
},
[2] = {
name = "The Lost Brother",
storageId = Storage.AdventurersGuild.TheLostBrother,
missionId = 11000,
startValue = 1,
endValue = 3,
states = {
[1] = "At the Kha'zeel Mountains you met the merchant Tarun. His brother has gone missing and was last seen following a beautiful woman into a palace. Tarun fears this woman might have been a demon.",
[2] = "You found the remains of Tarun's brother containing a message. Go back to Tarun and report his brother's last words.",
[3] = "You told Tarun about his brother's sad fate. He was very downhearted but gave you his sincere thanks. The beautiful asuri have taken a young man's life and the happiness of another one.",
},
},
},
},
[42] = {
Expand Down
3 changes: 2 additions & 1 deletion data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,8 @@ Storage = {
WarriorSkeleton = 52146,
DragonCounter = 52147,
},
QuestLine = 52148,
TheLostBrother = 52149,
},
DreamersChallenge = {
-- Reserved storage from 52160 - 52199
Expand Down Expand Up @@ -2534,7 +2536,6 @@ Storage = {
NightmareTeddy = {},
PoacherCavesMiniWorldChange = {},
TheGreatDragonHunt = {},
TheLostBrother = {},
TheTaintedSouls = {},
},
U10_90 = { -- update 10.90 - Reserved Storages 45201 - 45350
Expand Down
68 changes: 68 additions & 0 deletions data-otservbr-global/npc/tarun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,74 @@ npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

local function creatureSayCallback(npc, creature, type, message)
local player = Player(creature)
if not player then
return false
end
local playerId = player:getId()

if not npcHandler:checkInteraction(npc, creature) then
return false
end

local theLostBrotherStorage = player:getStorageValue(Storage.AdventurersGuild.TheLostBrother)
if MsgContains(message, "mission") then
if theLostBrotherStorage < 1 then
npcHandler:say({
"My brother is missing. I fear, he went to this evil palace north of here. A place of great beauty, certainly filled with riches and luxury. But in truth it is a threshold to hell and demonesses are after his blood. ...",
"He is my brother, and I am deeply ashamed to admit but I don't dare to go there. Perhaps your heart is more courageous than mine. Would you go to see this place and search for my brother?",
}, npc, creature)
npcHandler:setTopic(playerId, 1)
elseif theLostBrotherStorage == 1 then
npcHandler:say("I hope you will find my brother.", npc, creature)
npcHandler:setTopic(playerId, 0)
elseif theLostBrotherStorage == 2 then
npcHandler:say({
"So, he is dead as I feared. I warned him not to go with this woman, but he gave in to temptation. My heart darkens and moans. But you have my sincere thanks. ...",
"Without your help I would have stayed in the dark about his fate. Please, take this as a little recompense.",
}, npc, creature)
player:addItem(3039, 1)
player:addExperience(3000, true)
player:setStorageValue(Storage.AdventurersGuild.TheLostBrother, 3)
npcHandler:setTopic(playerId, 0)
end
elseif npcHandler:getTopic(playerId) == 1 then
if MsgContains(message, "yes") then
npcHandler:say("I thank you! This is more than I could hope!", npc, creature)
if theLostBrotherStorage < 1 then
player:setStorageValue(Storage.AdventurersGuild.QuestLine, 1)
end
player:setStorageValue(Storage.AdventurersGuild.TheLostBrother, 1)
elseif MsgContains(message, "no") then
npcHandler:say("As you wish.", npc, creature)
end
npcHandler:setTopic(playerId, 0)
end

return true
end

local function onTradeRequest(npc, creature)
local player = Player(creature)
if not player then
return false
end
local playerId = player:getId()

if player:getStorageValue(Storage.AdventurersGuild.TheLostBrother) ~= 3 then
return false
end

return true
end

npcHandler:setMessage(MESSAGE_GREET, "Greetings!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell.")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Of course, just have a look.")
npcHandler:setCallback(CALLBACK_ON_TRADE_REQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell.")
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

npcConfig.shop = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ function adventurersWarriorSkeleton.onUse(player, item, fromPosition, target, to
if player:getStorageValue(Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton) < 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have discovered a deceased warrior's skeleton. It seems he tried to hunt the dragons around here - and failed.")
player:addItem(5882, 1) -- red dragon scale

if player:getStorageValue(Storage.AdventurersGuild.QuestLine) < 1 then
player:setStorageValue(Storage.AdventurersGuild.QuestLine, 1)
end

player:setStorageValue(Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, 1)
player:setStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter, 0)
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,10 @@ local questTable = {
{ storage = Storage.Quest.U11_40.ThreatenedDreams.QuestLine, storageValue = 1 },
{ storage = Storage.Quest.U11_40.ThreatenedDreams.Mission01[1], storageValue = 16 },
{ storage = Storage.Quest.U11_40.ThreatenedDreams.Mission02.KroazurAccess, storageValue = 1 },
{ storage = Storage.AdventurersGuild.QuestLine, storageValue = 1 },
{ storage = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, storageValue = 1 },
{ storage = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, storageValue = 2 },
{ storage = Storage.AdventurersGuild.TheLostBrother, storageValue = 3 },
{ storage = Storage.Quest.U10_55.Dawnport.Questline, storageValue = 1 },
{ storage = Storage.Quest.U10_55.Dawnport.GoMain, storageValue = 1 },
{ storage = Storage.ForgottenKnowledge.AccessDeath, storageValue = 1 },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local findRemains = MoveEvent()

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

if player:getStorageValue(Storage.AdventurersGuild.TheLostBrother) == 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You stumble over some old bones. Something is carved into the stone wall here: 'Tarun, my brother, you were right. She's evil.'")
player:setStorageValue(Storage.AdventurersGuild.TheLostBrother, 2)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
end

return true
end

findRemains:position(Position(32959, 32674, 4))
findRemains:register()

0 comments on commit 56793a0

Please sign in to comment.