Skip to content

Commit

Permalink
Spirithunters Quest
Browse files Browse the repository at this point in the history
  • Loading branch information
htc16 committed Aug 10, 2024
1 parent b1275cd commit c98dcc6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 53 deletions.
8 changes: 4 additions & 4 deletions data-otservbr-global/lib/core/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6173,12 +6173,12 @@ if not Quests then
},
[45] = {
name = "Spirithunters Quest",
startStorageId = Storage.SpiritHunters.Mission01,
startStorageId = Storage.Quest.U8_7.SpiritHunters.Mission01,
startStorageValue = 1,
missions = {
[1] = {
name = "Method",
storageId = Storage.SpiritHunters.Mission01,
storageId = Storage.Quest.U8_7.SpiritHunters.Mission01,
missionId = 10426,
startValue = 1,
endValue = 2,
Expand All @@ -6189,7 +6189,7 @@ if not Quests then
},
[2] = {
name = "First Mission",
storageId = Storage.SpiritHunters.Mission01,
storageId = Storage.Quest.U8_7.SpiritHunters.Mission01,
missionId = 10427,
startValue = 2,
endValue = 4,
Expand All @@ -6200,7 +6200,7 @@ if not Quests then
},
[3] = {
name = "Second Mission",
storageId = Storage.SpiritHunters.Mission01,
storageId = Storage.Quest.U8_7.SpiritHunters.Mission01,
missionId = 10428,
startValue = 4,
endValue = 6,
Expand Down
19 changes: 8 additions & 11 deletions data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -921,15 +921,6 @@ Storage = {
Sinew = 52052,
},
},
SpiritHunters = {
-- Reserved storage from 52100 - 52109
Mission01 = 52100,
TombUse = 52101,
CharmUse = 52102,
NightstalkerUse = 52103,
SouleaterUse = 52104,
GhostUse = 52105,
},
Diapason = {
-- Reserved storage from 52120 - 52129
Lyre = 52120,
Expand Down Expand Up @@ -2323,7 +2314,6 @@ Storage = {
AnnualAutumnVintage = {},
Bewitched = {},
DemonsLullaby = {},
JackToTheFuture = {},
LastCreepStanding = {},
ResearchAndDevelopment = {},
RottinWoodAndTheMarriedMen = {
Expand All @@ -2335,7 +2325,14 @@ Storage = {
Mission03 = 43236,
FirstTime = 43237,
},
Spirithunters = {},
SpiritHunters = {
Mission01 = 52100,
TombUse = 52101,
CharmUse = 52102,
NightstalkerUse = 52103,
SouleaterUse = 52104,
GhostUse = 52105,
},
TheColoursOfMagic = {},
},
U9_1 = { --update 9.1 - Reserved Storages 43351 - 43550
Expand Down
33 changes: 9 additions & 24 deletions data-otservbr-global/npc/sinclair.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

local function releasePlayer(npc, creature)
if not Player(creature) then
return
end

npcHandler:removeInteraction(npc, creature)
npcHandler:resetNpc(creature)
end

local function creatureSayCallback(npc, creature, type, message)
local player = Player(creature)
local playerId = player:getId()
Expand All @@ -77,7 +68,7 @@ local function creatureSayCallback(npc, creature, type, message)
end

if MsgContains(message, "mission") then
local qStorage = player:getStorageValue(Storage.SpiritHunters.Mission01)
local qStorage = player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01)
if qStorage == 3 then
npcHandler:say("So, did you find anything worth examining? Did you actually catch a ghost?", npc, creature)
npcHandler:setTopic(playerId, 3)
Expand All @@ -101,23 +92,20 @@ local function creatureSayCallback(npc, creature, type, message)
npcHandler:setTopic(playerId, 2)
elseif npcHandler:getTopic(playerId) == 2 then
npcHandler:say("Good, now all you need to do is find a ghost, defeat it and catch its very essence with the cage. Once you have it, return to me and Spectulus and I will move it into our chamber device. Good luck, return to me as soon as you are prepared.", npc, creature)
player:setStorageValue(Storage.SpiritHunters.Mission01, 3)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01, 3)
player:addItem(4050, 1)
npcHandler:setTopic(playerId, 0)
elseif npcHandler:getTopic(playerId) == 3 then
if player:getStorageValue(Storage.SpiritHunters.CharmUse) == 1 then
if player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.CharmUse) == 1 then
npcHandler:say({
"Fascinating, let me see. ...",
"Amazing! I will transfer this to our spirit chamber right about - now! ...",
"Alright, the device is holding it. The magical barrier should be able to contain nearly 20 times the current load. That's a complete success! Spectulus, are you seeing this? We did it! ...",
"Well, you did! You really helped us pulling this off. Thank you Lord Stalks! ...",
"I doubt we will have much time to hunt for new specimens ourselves in the near future. If you like, you can continue helping us by finding and capturing more and different ghosts. Just talk to me to receive a new task.",
}, npc, creature)
player:setStorageValue(Storage.SpiritHunters.Mission01, 4)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01, 4)
player:addExperience(500, true)
addEvent(function()
releasePlayer(npc, creature)
end, 1000)
npcHandler:setTopic(playerId, 0)
else
npcHandler:say("Go and use the machine in a dead ghost!", npc, creature)
Expand All @@ -131,29 +119,26 @@ local function creatureSayCallback(npc, creature, type, message)
"Furhtermore, to successfully bind Nightstalkers to the cage, you will need to have caught at least 5 Ghosts. To bind Souleaters, you will need at least 5 Ghosts and 5 Nightstalkers. ...",
"The higher the amount of spirit energy in the cage, the higher its effective capacity. Oh and always come back and tell me if you lose your spirit cage.",
}, npc, creature)
player:setStorageValue(Storage.SpiritHunters.Mission01, 5)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01, 5)
npcHandler:setTopic(playerId, 0)
elseif npcHandler:getTopic(playerId) == 5 then
npcHandler:say("Good, of course you will also receive an additional monetary reward for your troubles. Are you fine with that?", npc, creature)
npcHandler:setTopic(playerId, 6)
elseif npcHandler:getTopic(playerId) == 6 then
local nightstalkers, souleaters, ghost = player:getStorageValue(Storage.SpiritHunters.NightstalkerUse), player:getStorageValue(Storage.SpiritHunters.SouleaterUse), player:getStorageValue(Storage.SpiritHunters.GhostUse)
local nightstalkers, souleaters, ghost = player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.NightstalkerUse), player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.SouleaterUse), player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.GhostUse)
if nightstalkers >= 4 and souleaters >= 4 and ghost >= 4 then
npcHandler:say("Alright, let us see how many ghosts you caught!", npc, creature)
player:setStorageValue(Storage.SpiritHunters.Mission01, 6)
player:addExperience(8000, true)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01, 6)
player:addExperience(10000, true)
player:addItem(3035, 60)
addEvent(function()
releasePlayer(npc, creature)
end, 1000)
npcHandler:setTopic(playerId, 0)
else
npcHandler:say("You didnt catch the ghost pieces.", npc, creature)
npcHandler:setTopic(playerId, 0)
end
end
elseif MsgContains(message, "research") then
local qStorage = player:getStorageValue(Storage.SpiritHunters.Mission01)
local qStorage = player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01)
if qStorage == 4 then
npcHandler:say({
"We are still in need of more research concerning environmental as well as psychic ecto-magical influences. Besides more common ghosts we also need some of the harder to come by nightstalkers and - if you're really hardboiled - souleaters. ...",
Expand Down
12 changes: 6 additions & 6 deletions data-otservbr-global/npc/spectulus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ local function creatureSayCallback(npc, creature, type, message)
return false
end

if MsgContains(message, "research") then
local qStorage = player:getStorageValue(Storage.SpiritHunters.Mission01)
local tombsStorage = player:getStorageValue(Storage.SpiritHunters.TombUse)
if MsgContains(message, "research") and player:getStorageValue(Storage.TibiaTales.JackFutureQuest.QuestLine) == 11 then
local qStorage = player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01)
local tombsStorage = player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.TombUse)
if qStorage == -1 then
if npcHandler:getTopic(playerId) == 17 then
npcHandler:say({
Expand Down Expand Up @@ -270,14 +270,14 @@ local function creatureSayCallback(npc, creature, type, message)
npcHandler:setTopic(playerId, 17)
elseif npcHandler:getTopic(playerId) == 18 then
npcHandler:say("Good. Take this wand - we call it a spirit meter - and go to the graveyard I have marked on your map and take a few measurements on the graves.", npc, creature)
player:setStorageValue(Storage.SpiritHunters.Mission01, 1)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01, 1)
player:addItem(4049, 1)
npcHandler:setTopic(playerId, 0)
elseif npcHandler:getTopic(playerId) == 19 then
npcHandler:say("Let me see the spirit meter. Hmmm... those are grave news you bring - uhm, you know what I mean. But this is awesome! Now I know for sure that the calibration is only some short bursts of magically enhanced energy away.", npc, creature)
player:addExperience(500, true)
player:addItem(3035, 5)
player:setStorageValue(Storage.SpiritHunters.Mission01, 2)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01, 2)
npcHandler:setTopic(playerId, 0)
elseif npcHandler:getTopic(playerId) == 27 then
npcHandler:say({
Expand Down Expand Up @@ -350,7 +350,7 @@ local function creatureSayCallback(npc, creature, type, message)
npcHandler:setTopic(playerId, 0)
end
elseif MsgContains(message, "collective apparitions") then
local qStorage = player:getStorageValue(Storage.SpiritHunters.Mission01)
local qStorage = player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01)
if qStorage == -1 then
if npcHandler:getTopic(playerId) == 15 then
npcHandler:say("Ah well, let's forget about the scientific details - you will do just fine as long as you do exactly what I say. Ready for me to go on with your task?", npc, creature)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ function spiritMagical.onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if item:getId() == 4049 then
if itemEx.itemid == 1979 then
if player:getStorageValue(Storage.SpiritHunters.Mission01 == 1) then
qStorage = player:getStorageValue(Storage.SpiritHunters.TombUse)
if player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.Mission01 == 1) then
qStorage = player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.TombUse)
if qStorage < 3 then
position = player:getPosition()
player:say("An incredibly slimy substance oozes out of every crack in the old gravestone. It seems to attack you.", TALKTYPE_MONSTER_SAY)
player:setStorageValue(Storage.SpiritHunters.TombUse, qStorage + 1)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.TombUse, qStorage + 1)
Game.createMonster("Squidgy Slime", Position(position.x + 1, position.y, position.z), false, false)
elseif qStorage == 4 then
player:say("You have used items in gravestone.", TALKTYPE_MONSTER_SAY)
Expand All @@ -18,21 +18,21 @@ function spiritMagical.onUse(cid, item, fromPosition, itemEx, toPosition)
elseif item:getId() == 4050 then
if itemEx.itemid == 5993 then -- ghost
player:say("As you open the device a bright light pours out of its interior and drags all remaining energy of the ghost into it.", TALKTYPE_MONSTER_SAY)
if player:getStorageValue(Storage.SpiritHunters.CharmUse) < 1 then
player:setStorageValue(Storage.SpiritHunters.CharmUse, 1)
if player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.CharmUse) < 1 then
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.CharmUse, 1)
else
player:setStorageValue(Storage.SpiritHunters.GhostUse, player:getStorageValue(Storage.SpiritHunters.GhostUse) + 1)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.GhostUse, player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.GhostUse) + 1)
end
itemEx:transform(itemEx:getType():getDecayId())
toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
elseif itemEx.itemid == 11675 or itemEx.itemid == 11676 then -- souleater
player:say("As you open the device a bright light pours out of its interior and drags all remaining energy of the souleater into it.", TALKTYPE_MONSTER_SAY)
player:setStorageValue(Storage.SpiritHunters.SouleaterUse, player:getStorageValue(Storage.SpiritHunters.SouleaterUse) + 1)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.SouleaterUse, player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.SouleaterUse) + 1)
itemEx:transform(itemEx:getType():getDecayId())
toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
elseif itemEx.itemid == 9001 or itemEx.itemid == 9002 then --nightstalker
player:say("As you open the device a bright light pours out of its interior and drags all remaining energy of the nightstalker into it.", TALKTYPE_MONSTER_SAY)
player:setStorageValue(Storage.SpiritHunters.NightstalkerUse, player:getStorageValue(Storage.SpiritHunters.NightstalkerUse) + 1)
player:setStorageValue(Storage.Quest.U8_7.SpiritHunters.NightstalkerUse, player:getStorageValue(Storage.Quest.U8_7.SpiritHunters.NightstalkerUse) + 1)
itemEx:transform(itemEx:getType():getDecayId())
toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
Expand Down

0 comments on commit c98dcc6

Please sign in to comment.