Skip to content

Commit

Permalink
[QUEST]Sandoria Teleport Scroll Quest to IF
Browse files Browse the repository at this point in the history
[QUEST]Sandoria Teleport Scroll Quest to IF

[QUEST]Sandoria Teleport Scroll Quest to IF

Converts Healing the Land and Sorcery of the North to Interaction Framework.
  • Loading branch information
hooksta4 committed Sep 2, 2024
1 parent 27dddda commit 4320a47
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 91 deletions.
100 changes: 100 additions & 0 deletions scripts/quests/sandoria/Healing_The_Land.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
-----------------------------------
-- Healing the Land
-----------------------------------
-- !addquest 0 82
-- Eperdur: !pos 129 -6 96 231
-- qm3: !pos -168 1 311 196
-----------------------------------
local gugsenMinesID = zones[xi.zone.GUSGEN_MINES]
-----------------------------------

local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND)

quest.reward =
{
fame = 30,
fameArea = xi.fameArea.SANDORIA,
item = xi.item.SCROLL_OF_TELEPORT_HOLLA,
title = xi.title.PILGRIM_TO_HOLLA,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:getFameLevel(xi.fameArea.SANDORIA) >= 4 and
player:getMainLvl() >= 10
end,

[xi.zone.NORTHERN_SAN_DORIA] =
{
['Eperdur'] = quest:progressEvent(681),

onEventFinish =
{
[681] = function(player, csid, option, npc)
quest:begin(player)
npcUtil.giveKeyItem(player, xi.ki.SEAL_OF_BANISHING)
end,
},
},
},

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED
end,

[xi.zone.NORTHERN_SAN_DORIA] =
{
['Eperdur'] =
{
onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) then
return quest:event(682)
elseif not player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) then
return quest:progressEvent(683)
end
end,
},

onEventFinish =
{
[683] = function(player, csid, option, npc)
quest:complete(player)
xi.quest.setMustZone(player, xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH)
end,
},
},

[xi.zone.GUSGEN_MINES] =
{
['qm3'] =
{
onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) then
player:delKeyItem(xi.ki.SEAL_OF_BANISHING)
return quest:messageSpecial(gugsenMinesID.text.FOUND_LOCATION_SEAL, xi.ki.SEAL_OF_BANISHING)
elseif not player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) then
player:messageSpecial(gugsenMinesID.text.IS_ON_THIS_SEAL, xi.ki.SEAL_OF_BANISHING)
return quest:noAction()
end
end,
},
},
},

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_COMPLETED
end,

[xi.zone.NORTHERN_SAN_DORIA] =
{
['Eperdur'] = quest:event(684):replaceDefault(),
},
},
}

return quest
67 changes: 67 additions & 0 deletions scripts/quests/sandoria/Sorcery_of_the_North.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
-----------------------------------
-- Sorcery of the North
-----------------------------------
-- !addquest 0 83
-- Eperdur: !pos 129 -6 96 231
-----------------------------------

local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH)

quest.reward =
{
fame = 30,
fameArea = xi.fameArea.SANDORIA,
item = xi.item.SCROLL_OF_TELEPORT_VAHZL,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:hasCompletedQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND) and
not quest:getMustZone(player)
end,

[xi.zone.NORTHERN_SAN_DORIA] =
{
['Eperdur'] = quest:progressEvent(685),

onEventFinish =
{
[685] = function(player, csid, option, npc)
quest:begin(player)
end,
},
},
},

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED
end,

[xi.zone.NORTHERN_SAN_DORIA] =
{
['Eperdur'] =
{
onTrigger = function(player, npc)
if not player:hasKeyItem(xi.ki.FEIYIN_MAGIC_TOME) then
return quest:event(686)
else
return quest:progressEvent(687)
end
end,
},

onEventFinish =
{
[687] = function(player, csid, option, npc)
quest:complete(player)
end,
},
},
},
}

return quest
1 change: 1 addition & 0 deletions scripts/zones/Gusgen_Mines/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ local ID = zones[xi.zone.GUSGEN_MINES]

return {
['qm2'] = { messageSpecial = ID.text.SEE_MONSTER_TRACKS },
['qm3'] = { messageSpecial = ID.text.LETTERS_IS_WRITTEN_HERE },
['qm4'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
}
19 changes: 1 addition & 18 deletions scripts/zones/Gusgen_Mines/npcs/qm3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,13 @@
-- Involved In Quest: Healing the Land
-- !pos -168 1 311 196
-----------------------------------
local ID = zones[xi.zone.GUSGEN_MINES]
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrade = function(player, npc, trade)
end

entity.onTrigger = function(player, npc)
local healingTheLand = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND)

if
healingTheLand == xi.questStatus.QUEST_ACCEPTED and
player:hasKeyItem(xi.ki.SEAL_OF_BANISHING)
then
player:delKeyItem(xi.ki.SEAL_OF_BANISHING)
player:messageSpecial(ID.text.FOUND_LOCATION_SEAL, xi.ki.SEAL_OF_BANISHING)
elseif
healingTheLand == xi.questStatus.QUEST_ACCEPTED and
not player:hasKeyItem(xi.ki.SEAL_OF_BANISHING)
then
player:messageSpecial(ID.text.IS_ON_THIS_SEAL, xi.ki.SEAL_OF_BANISHING)
else
player:messageSpecial(ID.text.LETTERS_IS_WRITTEN_HERE)
end
end

entity.onEventUpdate = function(player, csid, option, npc)
Expand Down
75 changes: 2 additions & 73 deletions scripts/zones/Northern_San_dOria/npcs/Eperdur.lua
Original file line number Diff line number Diff line change
@@ -1,93 +1,22 @@
-----------------------------------
-- Area: Northern San d'Oria
-- NPC: Eperdur
-- NPC: Eperdur
-- Starts and Finishes Quest: Healing the Land,
-- !pos 129 -6 96 231
-----------------------------------
local ID = zones[xi.zone.NORTHERN_SAN_DORIA]
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrade = function(player, npc, trade)
end

entity.onTrigger = function(player, npc)
local healingTheLand = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND)
local sorceryOfTheNorth = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH)

if
healingTheLand == xi.questStatus.QUEST_AVAILABLE and
player:getFameLevel(xi.fameArea.SANDORIA) >= 4 and
player:getMainLvl() >= 10
then
player:startEvent(681) -- Start quest "Healing the Land"
elseif
healingTheLand == xi.questStatus.QUEST_ACCEPTED and
player:hasKeyItem(xi.ki.SEAL_OF_BANISHING)
then
player:startEvent(682) -- During quest "Healing the Land"
elseif
healingTheLand == xi.questStatus.QUEST_ACCEPTED and
not player:hasKeyItem(xi.ki.SEAL_OF_BANISHING)
then
player:startEvent(683) -- Finish quest "Healing the Land"
elseif
healingTheLand == xi.questStatus.QUEST_COMPLETED and
sorceryOfTheNorth == xi.questStatus.QUEST_AVAILABLE and
player:needToZone()
then
player:startEvent(684) -- New standard dialog after "Healing the Land"
elseif
healingTheLand == xi.questStatus.QUEST_COMPLETED and
sorceryOfTheNorth == xi.questStatus.QUEST_AVAILABLE and
not player:needToZone()
then
player:startEvent(685) -- Start quest "Sorcery of the North"
elseif
sorceryOfTheNorth == xi.questStatus.QUEST_ACCEPTED and
not player:hasKeyItem(xi.ki.FEIYIN_MAGIC_TOME)
then
player:startEvent(686) -- During quest "Sorcery of the North"
elseif
sorceryOfTheNorth == xi.questStatus.QUEST_ACCEPTED and
player:hasKeyItem(xi.ki.FEIYIN_MAGIC_TOME)
then
player:startEvent(687) -- Finish quest "Sorcery of the North"
end
end

entity.onEventUpdate = function(player, csid, option, npc)
end

entity.onEventFinish = function(player, csid, option, npc)
if csid == 681 and option == 0 then
player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND)
player:addKeyItem(xi.ki.SEAL_OF_BANISHING)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, xi.ki.SEAL_OF_BANISHING)
elseif csid == 683 then
if player:getFreeSlotsCount() == 0 then
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, xi.item.SCROLL_OF_TELEPORT_HOLLA)
else
player:addTitle(xi.title.PILGRIM_TO_HOLLA)
player:addItem(xi.item.SCROLL_OF_TELEPORT_HOLLA)
player:messageSpecial(ID.text.ITEM_OBTAINED, xi.item.SCROLL_OF_TELEPORT_HOLLA) -- Scroll of Teleport-Holla
player:needToZone(true)
player:addFame(xi.fameArea.SANDORIA, 30)
player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND)
end
elseif csid == 685 and option == 0 then
player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH)
elseif csid == 687 then
if player:getFreeSlotsCount() == 0 then
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, xi.item.SCROLL_OF_TELEPORT_VAHZL)
else
player:delKeyItem(xi.ki.FEIYIN_MAGIC_TOME)
player:addItem(xi.item.SCROLL_OF_TELEPORT_VAHZL)
player:messageSpecial(ID.text.ITEM_OBTAINED, xi.item.SCROLL_OF_TELEPORT_VAHZL) -- Scroll of Teleport-Vahzl
player:addFame(xi.fameArea.SANDORIA, 30)
player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH)
end
end
end

return entity

0 comments on commit 4320a47

Please sign in to comment.