Skip to content

Commit

Permalink
Spike Task Quests - Tasks 80+
Browse files Browse the repository at this point in the history
  • Loading branch information
htc16 committed Sep 4, 2024
1 parent 907b736 commit 186c8c7
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 51 deletions.
17 changes: 9 additions & 8 deletions data-otservbr-global/npc/gnomargery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ local function creatureSayCallback(npc, creature, type, message)
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main) == 4 then
npcHandler:say("You have done well. Here, take your reward.", npc, creature)
player:addFamePoint()
player:addExperience(1589, true)
player:addExperience(3500, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Deliver the four parcels to some of our far away outposts in the caverns.", npc, creature)
end
Expand All @@ -107,9 +107,9 @@ local function creatureSayCallback(npc, creature, type, message)
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Undercover_Main) == 3 then
npcHandler:say("You have done well. Here, take your reward.", npc, creature)
player:addFamePoint()
player:addExperience(1589, true)
player:addExperience(3500, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Undercover_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Undercover_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Undercover_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Get three reports from our undercover agents posing as monsters in the caves around us.", npc, creature)
end
Expand All @@ -119,9 +119,9 @@ local function creatureSayCallback(npc, creature, type, message)
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Lava_Main) == 1 then
npcHandler:say("You have done well. Here, take your reward.", npc, creature)
player:addFamePoint()
player:addExperience(1589, true)
player:addExperience(3500, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Lava_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Lava_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Lava_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Use the gnomish temperature measurement device to locate the hottest spot at the lava pools in the cave.", npc, creature)
end
Expand All @@ -131,9 +131,9 @@ local function creatureSayCallback(npc, creature, type, message)
elseif player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Kill_Main) == 7 then
npcHandler:say("You have done well. Here, take your reward.", npc, creature)
player:addFamePoint()
player:addExperience(1589, true)
player:addExperience(3500, true)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Kill_Main, -1)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Kill_Daily, 86400)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Kill_Daily, os.time() + 72000)
else
npcHandler:say("Gnowful! Just go out to the caves and kill at least seven drillworms.", npc, creature)
end
Expand Down Expand Up @@ -272,6 +272,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
96 changes: 53 additions & 43 deletions data-otservbr-global/npc/gnome_trooper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ npcConfig.flags = {
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

local response = {
[0] = "It's a pipe! What can be more relaxing for a gnome than to smoke his pipe after a day of duty at the front. At least it's a chance to do something really dangerous after all!",
[1] = "Ah, a letter from home! Oh - I had no idea she felt that way! This is most interesting!",
[2] = "It's a model of the gnomebase Alpha! For self-assembly! With toothpicks...! Yeeaah...! I guess.",
[3] = "A medal of honour! At last they saw my true worth!",
}

if not DELIVERED_PARCELS then
DELIVERED_PARCELS = {}
end
npcType.onAppear = function(npc, creature)
npcHandler:onAppear(npc, creature)
end
Expand All @@ -56,43 +46,63 @@ npcType.onThink = function(npc, interval)
npcHandler:onThink(npc, interval)
end

if not DELIVERED_PARCELS then
DELIVERED_PARCELS = {}
end

local response = {
[0] = "It's a pipe! What can be more relaxing for a gnome than to smoke his pipe after a day of duty at the front. At least it's a chance to do something really dangerous after all!",
[1] = "Ah, a letter from home! Oh - I had no idea she felt that way! This is most interesting!",
[2] = "It's a model of the gnomebase Alpha! For self-assembly! With toothpicks...! Yeeaah...! I guess.",
[3] = "A medal of honour! At last they saw my true worth!",
}

local function greetCallback(npc, creature)
local player = Player(creature)
local playerId = player:getId()

if table.contains({ -1, 4 }, player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main)) then
return false
end
if table.contains(DELIVERED_PARCELS[player:getGuid()], npc:getId()) then
return false
end
return true
local player = Player(creature)
local playerId = player:getId()

-- Inicializa a tabela se ela for nil
if not DELIVERED_PARCELS[player:getGuid()] then
DELIVERED_PARCELS[player:getGuid()] = {}
end

if table.contains({ -1, 4 }, player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main)) then
return false
end
if table.contains(DELIVERED_PARCELS[player:getGuid()], npc:getId()) then
return false
end

npcHandler:setMessage(MESSAGE_GREET, "Do you have something to deliver?")

return true
end

local function creatureSayCallback(npc, creature, type, message)
local player = Player(creature)
local status = player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main)

if not DELIVERED_PARCELS[player:getGuid()] then
DELIVERED_PARCELS[player:getGuid()] = {}
end

if MsgContains(message, "something") and not table.contains({ -1, 4 }, status) then
if table.contains(DELIVERED_PARCELS[player:getGuid()], npc:getId()) then
return true
end

if not player:removeItem(19219, 1) then
npcHandler:say("But you don't have it...", npc, creature)
return npcHandler:removeInteraction(npc, creature)
end

npcHandler:say(response[player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main)], npc, creature)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main, status + 1)
table.insert(DELIVERED_PARCELS[player:getGuid()], npc:getId())
npcHandler:removeInteraction(npc, creature)
end
return true
local player = Player(creature)
local status = player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main)

-- Inicializa a tabela se ela for nil
if not DELIVERED_PARCELS[player:getGuid()] then
DELIVERED_PARCELS[player:getGuid()] = {}
end

if MsgContains(message, "something") and not table.contains({ -1, 4 }, status) then
if table.contains(DELIVERED_PARCELS[player:getGuid()], npc:getId()) then
return true
end

if not player:removeItem(19219, 1) then
npcHandler:say("But you don't have it...", npc, creature)
return npcHandler:removeInteraction(npc, creature)
end

npcHandler:say(response[player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main)], npc, creature)
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Lower_Parcel_Main, status + 1)
table.insert(DELIVERED_PARCELS[player:getGuid()], npc:getId())
npcHandler:removeInteraction(npc, creature)
end
return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
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 @@ -261,14 +261,26 @@ ItemAction = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 13 } },
},
[4239] = {
itemId = 19387,
itemPos = { { x = 32244, y = 32620, z = 13 } },
},
[4240] = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 14 } },
},
[4241] = {
itemId = 19387,
itemPos = { { x = 32244, y = 32587, z = 14 } },
},
[4242] = {
itemId = 19387,
itemPos = { { x = 32234, y = 32604, z = 15 } },
},
[4243] = {
itemId = 19387,
itemPos = { { x = 32223, y = 32606, z = 15 } },
},
-- The Gravedigger of Drefia Quest
[4530] = {
itemId = 1949,
Expand Down

0 comments on commit 186c8c7

Please sign in to comment.