Skip to content

Commit

Permalink
Spike Task Quests - Tasks 25-49
Browse files Browse the repository at this point in the history
  • Loading branch information
htc16 committed Sep 3, 2024
1 parent 5003476 commit 56e1f1a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
11 changes: 6 additions & 5 deletions data-otservbr-global/npc/gnomilly.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ local function creatureSayCallback(npc, creature, type, message)
player:addFamePoint()
player:addExperience(1000, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Pacifier_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Pacifier_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Pacifier_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Take the resonance charger and use it on seven of the pacifiers in the cave.", npc, creature)
end
elseif MsgContains(message, "release") then
if player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Main) == -1 then
npcHandler:say("You have not started that mission.", npc, creature)
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Main) == 4 then
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Main) == 1 then
npcHandler:say("You have done well. Here, take your reward.", npc, creature)
player:addFamePoint()
player:addExperience(1000, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Take the spirit shovel use it on four graves in the cave system.", npc, creature)
end
Expand All @@ -118,7 +118,7 @@ local function creatureSayCallback(npc, creature, type, message)
player:addFamePoint()
player:addExperience(1000, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Track_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Track_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Track_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Take the tracking device in the caves and locate the residual spirit energy.", npc, creature)
end
Expand All @@ -130,7 +130,7 @@ local function creatureSayCallback(npc, creature, type, message)
player:addFamePoint()
player:addExperience(1000, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Kill_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Kill_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Kill_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Just go out to the caves and kill at least seven demon skeletons.", npc, creature)
end
Expand Down Expand Up @@ -275,6 +275,7 @@ local function creatureSayCallback(npc, creature, type, message)
return true
end

npcHandler:setMessage(MESSAGE_GREET, "Hi!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ if not GHOST_DETECTOR_MAP then
end

ghost_detector_area = {
from = Position(32008, 32522, 8),
to = Position(32365, 32759, 10),
from = Position(32171, 32512, 8),
to = Position(32352, 32671, 10),
}

local function getSearchString(fromPos, toPos)
Expand Down Expand Up @@ -73,19 +73,27 @@ function spikeTasksGhost.onUse(player, item, fromPosition, target, toPosition, i

local current = GHOST_DETECTOR_MAP[player:getGuid()]
if not current then
local random = Position.getFreeSand()
local levelZ = 8 + stat
local random = Position(math.random(32171, 32352), math.random(32512, 32671), levelZ)
GHOST_DETECTOR_MAP[player:getGuid()] = random
current = random
end

if player:getPosition():compare(current) then
local playerPos = player:getPosition()
local dx = math.abs(playerPos.x - current.x)
local dy = math.abs(playerPos.y - current.y)
local dz = math.abs(playerPos.z - current.z)

if dx <= 4 and dy <= 4 and dz == 0 then
if stat == 2 then
item:remove()
GHOST_DETECTOR_MAP[player:getGuid()] = nil
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Report the task to Gnomilly.")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found a malignant presence, the glowing detector signals that it does not need any further data.")
else
GHOST_DETECTOR_MAP[player:getGuid()] = getFreeSand()
local levelZ = 8 + (stat + 1) % 3
local random = Position(math.random(32171, 32352), math.random(32512, 32671), levelZ)
GHOST_DETECTOR_MAP[player:getGuid()] = random
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found a malignant presence, the glowing detector signals another presence nearby.")
end
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Track_Main, stat + 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local chance = {

local spikeTasksShovel = Action()
function spikeTasksShovel.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if table.contains({ -1, 4 }, player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Main)) then
if table.contains({ -1, 1 }, player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Main)) then
return player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
end

Expand All @@ -28,7 +28,7 @@ function spikeTasksShovel.onUse(player, item, fromPosition, target, toPosition,
if i == 1 then
local sum = player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Main) + 1
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Upper_Mound_Main, sum)
if sum == 4 then
if sum == 1 then
item:remove()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Report the task to Gnomilly.")
end
Expand Down
8 changes: 8 additions & 0 deletions data-otservbr-global/startup/tables/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,18 @@ ItemAction = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 8 } },
},
[4229] = {
itemId = 19387,
itemPos = { { x = 32226, y = 32595, z = 8 } },
},
[4230] = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 9 } },
},
[4231] = {
itemId = 19387,
itemPos = { { x = 32242, y = 32620, z = 9 } },
},
[4232] = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 10 } },
Expand Down

0 comments on commit 56e1f1a

Please sign in to comment.