Skip to content

Commit

Permalink
move teamworks quests to IF
Browse files Browse the repository at this point in the history
  • Loading branch information
KnowOne134 committed Feb 18, 2025
1 parent 4d923a7 commit 9b51fb6
Show file tree
Hide file tree
Showing 6 changed files with 395 additions and 206 deletions.
6 changes: 3 additions & 3 deletions scripts/globals/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ xi.quest.id =
THE_GENERALS_SECRET = 60, -- ± Converted
THE_RUMOR = 61, -- ±
HER_MAJESTYS_GARDEN = 62, -- +
INTRODUCTION_TO_TEAMWORK = 63,
INTERMEDIATE_TEAMWORK = 64,
ADVANCED_TEAMWORK = 65,
INTRODUCTION_TO_TEAMWORK = 63, -- + Converted
INTERMEDIATE_TEAMWORK = 64, -- + Converted
ADVANCED_TEAMWORK = 65, -- + Converted
GRIMY_SIGNPOSTS = 66, -- +
A_JOB_FOR_THE_CONSORTIUM = 67,
TROUBLE_AT_THE_SLUICE = 68, -- +
Expand Down
131 changes: 131 additions & 0 deletions scripts/quests/sandoria/Advanced_Teamwork.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
-----------------------------------
-- Advanced Teamwork
-----------------------------------
-- Log ID: 0, Quest ID: 65
-----------------------------------
-- Vilatroire : !pos -260 -70 423 100
-----------------------------------

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

quest.reward =
{
item = xi.item.HORN_RING,
fame = 80,
title = xi.title.FIRST_RATE_ORGANIZER,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.INTERMEDIATE_TEAMWORK) == xi.questStatus.QUEST_COMPLETED
end,

[xi.zone.WEST_RONFAURE] =
{
['Vilatroire'] =
{
onTrigger = function(player, npc)
if
player:getFameLevel(xi.fameArea.SANDORIA) >= 4 and
player:getMainLvl() >= 10
then
return quest:progressEvent(131)
else
return quest:event(130):replaceDefault()
end
end,
},

onEventFinish =
{
[131] = function(player, csid, option, npc)
if option == 1 then
quest:begin(player)
end
end,
},
},
},
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED
end,

[xi.zone.WEST_RONFAURE] =
{
['Vilatroire'] =
{
onTrigger = function(player, npc)
local party = player:getParty()

if #party > 1 then
return quest:progressEvent(129, { [1] = 3 })
end
end,
},

onEventUpdate =
{
[129] = function(player, csid, option, npc)
local partySizeRequirement = 2
local party = player:getParty()
local partySameJobCount = 0

if #party >= partySizeRequirement then
for key, member in pairs(party) do
if
member:getZoneID() ~= player:getZoneID() or
member:checkDistance(player) > 15
then
player:updateEvent(1)
return
else
if player:getMainJob() == member:getMainJob() then
partySameJobCount = partySameJobCount + 1
end
end
end
else
player:updateEvent(1)
return
end

if partySameJobCount == partySizeRequirement then
quest:setLocalVar(player, 'Prog', 1)
player:updateEvent(15, 3)
return
else
player:updateEvent(5, 3)
return
end
end,
},

onEventFinish =
{
[129] = function(player, csid, option, npc)
if option == 0 and quest:getLocalVar(player, 'Prog') == 1 then
if quest:complete(player) then
quest:setLocalVar(player, 'Prog', 0)
end
end
end,
},
},
},
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_COMPLETED
end,

[xi.zone.WEST_RONFAURE] =
{
['Vilatroire'] = quest:event(130),
},
},
}

return quest
141 changes: 141 additions & 0 deletions scripts/quests/sandoria/Intermediate_Teamwork.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
-----------------------------------
-- Intermediate Teamwork
-----------------------------------
-- Log ID: 0, Quest ID: 64
-----------------------------------
-- Vilatroire : !pos -260 -70 423 100
-----------------------------------

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

quest.reward =
{
item = xi.item.SCROLL_OF_MAGES_BALLAD,
fame = 80,
title = xi.title.SECOND_RATE_ORGANIZER,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.INTRODUCTION_TO_TEAMWORK) == xi.questStatus.QUEST_COMPLETED
end,

[xi.zone.WEST_RONFAURE] =
{
['Vilatroire'] =
{
onTrigger = function(player, npc)
if
player:getFameLevel(xi.fameArea.SANDORIA) >= 3 and
player:getMainLvl() >= 10
then
return quest:progressEvent(133)
else
return quest:event(132):replaceDefault()
end
end,
},

onEventFinish =
{
[133] = function(player, csid, option, npc)
if option == 1 then
quest:begin(player)
end
end,
},
},
},
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED
end,

[xi.zone.WEST_RONFAURE] =
{
['Vilatroire'] =
{
onTrigger = function(player, npc)
local party = player:getParty()

if #party > 1 then
return quest:progressEvent(129, { [1] = 2 })
end
end,
},

onEventUpdate =
{
[129] = function(player, csid, option, npc)
local partySizeRequirement = 2
local party = player:getParty()
local partySameRaceCount = 0

if #party >= partySizeRequirement then
for key, member in pairs(party) do
if
member:getZoneID() ~= player:getZoneID() or
member:checkDistance(player) > 15
then
player:updateEvent(1)
return
else
local pRace = player:getRace()
local mRace = member:getRace()

if
(pRace == xi.race.HUME_M or pRace == xi.race.HUME_F) and
(mRace == xi.race.HUME_M or mRace == xi.race.HUME_F)
then
partySameRaceCount = partySameRaceCount + 1
elseif
(pRace == xi.race.ELVAAN_M or pRace == xi.race.ELVAAN_F) and
(mRace == xi.race.ELVAAN_M or mRace == xi.race.ELVAAN_F)
then
partySameRaceCount = partySameRaceCount + 1
elseif
(pRace == xi.race.TARU_M or pRace == xi.race.TARU_F) and
(mRace == xi.race.TARU_M or mRace == xi.race.TARU_F)
then
partySameRaceCount = partySameRaceCount + 1
elseif pRace == xi.race.GALKA and mRace == xi.race.GALKA then
partySameRaceCount = partySameRaceCount + 1
elseif pRace == xi.race.MITHRA and mRace == xi.race.MITHRA then
partySameRaceCount = partySameRaceCount + 1
end
end
end
else
player:updateEvent(1)
return
end

if partySameRaceCount >= partySizeRequirement then
quest:setLocalVar(player, 'Prog', 1)
player:updateEvent(15, 2)
return
else
player:updateEvent(4, 2)
return
end
end,
},

onEventFinish =
{
[129] = function(player, csid, option, npc)
if option == 0 and quest:getLocalVar(player, 'Prog') == 1 then
if quest:complete(player) then
quest:setLocalVar(player, 'Prog', 0)
end
end
end,
},
},
},
}

return quest
Loading

0 comments on commit 9b51fb6

Please sign in to comment.