Skip to content

Commit

Permalink
Spike Task Quests - Tasks 50-79
Browse files Browse the repository at this point in the history
  • Loading branch information
htc16 committed Sep 4, 2024
1 parent 56e1f1a commit c790f50
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 42 deletions.
13 changes: 7 additions & 6 deletions data-otservbr-global/npc/gnombold.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ local function creatureSayCallback(npc, creature, type, message)
if MsgContains(message, "charges") then
if player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main) == -1 then
npcHandler:say("You have not started that mission.", npc, creature)
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main) == 2 then
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main) == 3 then
npcHandler:say("You have done well. Here, take your reward.", npc, creature)
player:addFamePoint()
player:addExperience(2000, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Charge this magnet at three monoliths in the cave system. With three charges, the magnet will disintegrate and charge you with its gathered energies. Step on the magnetic extractor here to deliver the charge to us, then report to me.", npc, creature)
end
Expand All @@ -107,19 +107,19 @@ local function creatureSayCallback(npc, creature, type, message)
player:addFamePoint()
player:addExperience(2000, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Mushroom_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Mushroom_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Mushroom_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Use the fertiliser on four gardener mushroom in the caves.", npc, creature)
end
elseif MsgContains(message, "nests") then
if player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Main) == -1 then
npcHandler:say("You have not started that mission.", npc, creature)
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Main) == 8 then
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Main) == 5 then
npcHandler:say("You have done well. Here, take your reward.", npc, creature)
player:addFamePoint()
player:addExperience(2000, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Step into the transformer and destroy eight monster nests.", npc, creature)
end
Expand All @@ -131,7 +131,7 @@ local function creatureSayCallback(npc, creature, type, message)
player:addFamePoint()
player:addExperience(2000, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Kill_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Kill_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Kill_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Just go out to the caves and kill at least seven crystalcrushers.", npc, creature)
end
Expand Down Expand Up @@ -274,6 +274,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
@@ -1,43 +1,57 @@
local transformTo = {
[19207] = 19216,
[19216] = 19218,
}

local area = { --area where to teleport
Position(32152, 32502, 11),
Position(32365, 32725, 12),
local area = {
Position(32152, 32502, 11),
Position(32365, 32725, 12),
}

local spikeTasksStone = Action()

function spikeTasksStone.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main) ~= 0 then
return false
end

if (target == nil) or not target:isItem() or (target:getId() ~= 19217) then
return false
end

target:transform(19379)
target:decay()
if item:getId() == 19218 then
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, 1)
player:getPosition():sendMagicEffect(12)
player:say("Your tinkering caused some kind of magnetic storm that caused you to get disorientated.", TALKTYPE_MONSTER_SAY)
item:remove()
else
item:transform(transformTo[item:getId()])
if math.random(100) > 60 then
player:teleportTo(Position.getFreePosition(area[1], area[2]))
player:getPosition():sendMagicEffect(11)
end
end
return toPosition:sendMagicEffect(12)
local currentProgress = player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main)
if currentProgress == 3 then
return false
end

if (target == nil) or not target:isItem() or (target:getId() ~= 19217) then
return false
end

if target:getId() == 19217 then
target:transform(19379)
target:decay()
end

local itemId = item:getId()

if itemId == 19207 then
item:transform(19216)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, 1) -- Define o progresso inicial
elseif itemId == 19216 then
local useCount = player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main)
if useCount == -1 then
useCount = 0
end

useCount = useCount + 1
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, useCount)

if useCount == 3 then -- Corrigido para checar se o uso é 3
item:transform(19218)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, 3) -- Finaliza a missão
return true
end
end

if math.random(100) > 60 then
player:teleportTo(Position.getFreePosition(area[1], area[2]))
end

return toPosition:sendMagicEffect(12)
end

for itemId, info in pairs(transformTo) do
spikeTasksStone:id(itemId)
local itemIds = {19207, 19216}

for _, id in ipairs(itemIds) do
spikeTasksStone:id(id)
end
spikeTasksStone:id(21568)

spikeTasksStone:register()
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local summon = { "Spider", "Larva", "Scarab", "Tarantula" }

local spikeTasksNests = Action()
function spikeTasksNests.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if table.contains({ -1, 8 }, player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Main)) then
if table.contains({ -1, 5 }, player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Main)) then
return false
end

Expand All @@ -14,7 +14,7 @@ function spikeTasksNests.onUse(player, item, fromPosition, target, toPosition, i
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Nest_Main, sum)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have destroyed a monster nest.")

if sum == 8 then
if sum == 5 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Report the task to Gnombold.")
end

Expand Down
12 changes: 12 additions & 0 deletions data-otservbr-global/startup/tables/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,26 @@ ItemAction = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 10 } },
},
[4233] = {
itemId = 19387,
itemPos = { { x = 32240, y = 32621, z = 10 } },
},
[4234] = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 11 } },
},
[4235] = {
itemId = 19387,
itemPos = { { x = 32226, y = 32598, z = 11 } },
},
[4236] = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 12 } },
},
[4237] = {
itemId = 19387,
itemPos = { { x = 32238, y = 32623, z = 12 } },
},
[4238] = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 13 } },
Expand Down

0 comments on commit c790f50

Please sign in to comment.