Skip to content

Commit

Permalink
Convert Scattered into Shadow to IF
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbradleym committed Oct 22, 2024
1 parent e42ac25 commit 0e8ae00
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 85 deletions.
2 changes: 1 addition & 1 deletion scripts/globals/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ xi.quest.id =
BORGHERTZ_S_CALLING_HANDS = 58, -- +
AXE_THE_COMPETITION = 59, -- + Converted
WINGS_OF_GOLD = 60, -- ± Converted
SCATTERED_INTO_SHADOW = 61, -- ±
SCATTERED_INTO_SHADOW = 61, -- ± Converted
A_NEW_DAWN = 62,
PAINFUL_MEMORY = 63, -- +
THE_REQUIEM = 64, -- +
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/treasure.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ xi.treasure.treasureInfo =
{
test = function(player)
return player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW) == xi.questStatus.QUEST_ACCEPTED and
player:getCharVar('scatIntoShadowCS') == 1 and not player:hasItem(xi.item.BEAST_COLLAR)
player:getCharVar('Quest[3][61]Prog') == 4 and not player:hasItem(xi.item.BEAST_COLLAR)
end,

code = function(player)
Expand Down
211 changes: 211 additions & 0 deletions scripts/quests/jeuno/Scattered_into_Shadow.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
-----------------------------------
-- Scattered into the Shadow
-----------------------------------
-- Log ID: 3, Quest ID: 61
-- Brutus !pos -55 8 95 244
-- Underground Pool Offset !pos 10 0 250 151
-- Castle_Oztroja Chest !pos 7 -16 -193 151
-- Tebhi !pos -136 24 -21 151
-----------------------------------
local upperJeunoID = zones[xi.zone.UPPER_JEUNO]
local feiyinID = zones[xi.zone.FEIYIN]
local castleOzID = zones[xi.zone.CASTLE_OZTROJA]
-----------------------------------
local quest = Quest:new(xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW)

quest.reward =
{
fame = 30,
fameArea = xi.fameArea.JEUNO,
item = xi.item.BEAST_GAITERS,
}

local function beginQuest(player)
quest:begin(player)
player:addKeyItem(xi.ki.AQUAFLORA1)
player:addKeyItem(xi.ki.AQUAFLORA2)
player:addKeyItem(xi.ki.AQUAFLORA3)
end

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:hasCompletedQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.WINGS_OF_GOLD) and
player:getMainLvl() >= xi.settings.main.AF2_QUEST_LEVEL and
player:getMainJob() == xi.job.BST
end,

[xi.zone.UPPER_JEUNO] =
{
['Brutus'] =
{
onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') == 1 then
return quest:progressEvent(143) -- (Short dialog)
else
return quest:progressEvent(141) -- (Long dialog)
end
end,
},

onEventFinish =
{
[143] = function(player, csid, option, npc)
if option == 1 then
beginQuest(player)
player:messageSpecial(upperJeunoID.text.YOU_ARE_GIVEN_THREE_SPRIGS, xi.ki.AQUAFLORA1)
end
end,

[141] = function(player, csid, option, npc)
if option == 1 then
beginQuest(player)
player:messageSpecial(upperJeunoID.text.YOU_ARE_GIVEN_THREE_SPRIGS, xi.ki.AQUAFLORA1)
else
quest:setVar(player, 'Prog', 1)
end
end,
},
},
},

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

[xi.zone.FEIYIN] =
{
['Underground_Pool'] =
{
onTrigger = function(player, npc)
local offset = npc:getID() - feiyinID.npc.UNDERGROUND_POOL_OFFSET

if
offset == 0 and
player:hasKeyItem(xi.ki.AQUAFLORA2)
then
return quest:progressEvent(20)
elseif
offset == 1 and
quest:getVar(player, 'Prog') == 2
then
return quest:progressEvent(18)
elseif
offset == 1 and
player:hasKeyItem(xi.ki.AQUAFLORA3) and
npcUtil.popFromQM(player, npc, feiyinID.mob.DABOTZS_GHOST, { claim = true, hide = 0 })
then
return quest:noAction()
elseif
offset == 2 and
player:hasKeyItem(xi.ki.AQUAFLORA1)
then
return quest:progressEvent(21)
end
end,
},

['Dabotzs_Ghost'] =
{
onMobDeath = function(mob, player, optParams)
if player:hasKeyItem(xi.ki.AQUAFLORA3) then
quest:setVar(player, 'Prog', 2)
end
end,
},

onEventFinish =
{
[18] = function(player, csid, option, npc)
player:delKeyItem(xi.ki.AQUAFLORA3)
quest:setVar(player, 'Prog', 3)
end,

[20] = function(player, csid, option, npc)
player:delKeyItem(xi.ki.AQUAFLORA2)
end,

[21] = function(player, csid, option, npc)
player:delKeyItem(xi.ki.AQUAFLORA1)
end,
},
},

[xi.zone.CASTLE_OZTROJA] =
{
['Tebhi'] =
{
onTrade = function(player, npc, trade)
if
npc:getStatus() == xi.status.NORMAL and
npcUtil.tradeHasExactly(trade, xi.item.BEAST_COLLAR)
then
player:tradeComplete()
quest:setVar(player, 'Prog', 5)
npc:setStatus(xi.status.DISAPPEAR)
npc:updateNPCHideTime(900) -- Tebhi disappears for 15min
return quest:messageSpecial(castleOzID.text.TEBHI_ACCEPTS, xi.item.BEAST_COLLAR)
end
end,
},
},

[xi.zone.UPPER_JEUNO] =
{
['Brutus'] =
{
onTrigger = function(player, npc)
if
player:hasKeyItem(xi.ki.AQUAFLORA1) or
player:hasKeyItem(xi.ki.AQUAFLORA2) or
player:hasKeyItem(xi.ki.AQUAFLORA3)
then
return quest:event(142)
elseif quest:getVar(player, 'Prog') == 3 then
return quest:progressEvent(144)
elseif quest:getVar(player, 'Prog') == 4 then
return quest:event(149)
elseif quest:getVar(player, 'Prog') == 5 then
return quest:progressEvent(135)
end
end,
},

['Osker'] =
{
onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') == 4 then
return quest:event(145)
end
end,
},

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

[144] = function(player, csid, option, npc)
quest:setVar(player, 'Prog', 4)
end,
},
},
},

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

[xi.zone.UPPER_JEUNO] =
{
['Brutus'] = quest:event(151):importantOnce(),
},
},
}

return quest
1 change: 1 addition & 0 deletions scripts/zones/Castle_Oztroja/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ zones[xi.zone.CASTLE_OZTROJA] =
MEMBERS_LEVELS_ARE_RESTRICTED = 7208, -- Your party is unable to participate because certain members' levels are restricted.
FISHING_MESSAGE_OFFSET = 7268, -- You can't fish here.
CHEST_UNLOCKED = 7439, -- You unlock the chest!
TEBHI_ACCEPTS = 7450, -- Tebhi happily accepts the <item> and leaves.
YAGUDO_AVATAR_ENGAGE = 7460, -- Kahk-ka-ka... You filthy, dim-witted heretics! You have damned yourselves by coming here.
YAGUDO_AVATAR_DEATH = 7461, -- Our lord, Tzee Xicu the Manifest! Even should our bodies be crushed and broken, may our souls endure into eternity...
YAGUDO_KING_ENGAGE = 7462, -- You are not here as sacrifices, are you? Could you possibly be committing this affront in the face of a deity? Very well, I will personally mete out your divine punishment, kyah!
Expand Down
23 changes: 15 additions & 8 deletions scripts/zones/Castle_Oztroja/npcs/Tebhi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@
---@type TNpcEntity
local entity = {}

local pathNodes =
{
{ x = -136.0000, y = 24.2500, z = -21.0000 },
{ x = -140.0788, y = 24.2500, z = -25.9524 },
{ x = -140.1171, y = 24.2500, z = -37.6438 },
{ x = -140.1195, y = 24.2500, z = -45.9640 },
{ x = -140.1225, y = 24.2500, z = -55.6002 },
}

entity.onSpawn = function(npc)
npc:initNpcAi()
npc:setPos(xi.path.first(pathNodes))
npc:pathThrough(pathNodes, xi.path.flag.PATROL)
end

entity.onTrade = function(player, npc, trade)
if
trade:hasItemQty(xi.item.BEAST_COLLAR, 1) and
trade:getItemCount() == 1
then
player:tradeComplete()
-- TODO: Tebhi disappears for 15min
player:setCharVar('scatIntoShadowCS', 2)
end
end

entity.onTrigger = function(player, npc)
Expand Down
3 changes: 0 additions & 3 deletions scripts/zones/FeiYin/mobs/Dabotzs_Ghost.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
local entity = {}

entity.onMobDeath = function(mob, player, optParams)
if player:hasKeyItem(xi.ki.AQUAFLORA3) then
player:setCharVar('DabotzKilled', 1)
end
end

return entity
31 changes: 0 additions & 31 deletions scripts/zones/FeiYin/npcs/Underground_Pool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,19 @@
-- Offset 1 (F-5) !pos -168 0 247 204
-- Offset 2 (H-8) !pos 7 0 32 204
-----------------------------------
local ID = zones[xi.zone.FEIYIN]
-----------------------------------
---@type TNpcEntity
local entity = {}

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

entity.onTrigger = function(player, npc)
local offset = npc:getID() - ID.npc.UNDERGROUND_POOL_OFFSET

if player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW) == xi.questStatus.QUEST_ACCEPTED then
if offset == 0 and player:hasKeyItem(xi.ki.AQUAFLORA2) then
player:startEvent(20)
elseif offset == 1 and player:getCharVar('DabotzKilled') == 1 then
player:startEvent(18)
elseif
offset == 1 and
player:hasKeyItem(xi.ki.AQUAFLORA3) and
not GetMobByID(ID.mob.DABOTZS_GHOST):isSpawned()
then
SpawnMob(ID.mob.DABOTZS_GHOST):updateClaim(player)
elseif offset == 2 and player:hasKeyItem(xi.ki.AQUAFLORA1) then
player:startEvent(21)
else
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
end
else
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
end
end

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

entity.onEventFinish = function(player, csid, option, npc)
if csid == 18 then
player:delKeyItem(xi.ki.AQUAFLORA3)
player:setCharVar('DabotzKilled', 0)
elseif csid == 21 then
player:delKeyItem(xi.ki.AQUAFLORA1)
elseif csid == 20 then
player:delKeyItem(xi.ki.AQUAFLORA2)
end
end

return entity
1 change: 1 addition & 0 deletions scripts/zones/Upper_Jeuno/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ zones[xi.zone.UPPER_JEUNO] =
IT_READS_STAFF_ONLY = 6999, -- It reads, Staff Only.
LEILLAINE_SHOP_DIALOG = 7022, -- Hello. Are you feeling all right?
YOU_CAN_NOW_BECOME_A_BEASTMASTER = 7202, -- You can now become a beastmaster.
YOU_ARE_GIVEN_THREE_SPRIGS = 7729, -- You are given three sprigs of <item>.
CONQUEST = 7758, -- You've earned conquest points!
ITEM_DELIVERY_DIALOG = 8091, -- Delivering goods to residences everywhere!
DECIMATION_LEARNED = 8214, -- You have learned the weapon skill Decimation!
Expand Down
42 changes: 1 addition & 41 deletions scripts/zones/Upper_Jeuno/npcs/Brutus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,11 @@ end
entity.onTrigger = function(player, npc)
local wingsOfGold = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.WINGS_OF_GOLD)
local scatteredIntoShadow = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW)
local scatteredIntoShadowStat = player:getCharVar('scatIntoShadowCS')

local mLvl = player:getMainLvl()
local mJob = player:getMainJob()

-- SCATTERED INTO SHADOW
if
wingsOfGold == xi.questStatus.QUEST_COMPLETED and
scatteredIntoShadow == xi.questStatus.QUEST_AVAILABLE and
mJob == xi.job.BST and
mLvl >= xi.settings.main.AF2_QUEST_LEVEL
then
if player:getCharVar('scatIntoShadow_shortCS') == 1 then
player:startEvent(143)
else
player:setCharVar('scatIntoShadow_shortCS', 1)
player:startEvent(141)
end
elseif scatteredIntoShadow == xi.questStatus.QUEST_ACCEPTED then
if
player:hasKeyItem(xi.ki.AQUAFLORA1) or
player:hasKeyItem(xi.ki.AQUAFLORA2) or
player:hasKeyItem(xi.ki.AQUAFLORA3)
then
player:startEvent(142)
elseif scatteredIntoShadowStat == 0 then
player:startEvent(144)
elseif scatteredIntoShadowStat == 1 then
player:startEvent(149)
elseif scatteredIntoShadowStat == 2 then
player:startEvent(135)
end

-- STANDARD DIALOGS
elseif scatteredIntoShadow == xi.questStatus.QUEST_COMPLETED then
if scatteredIntoShadow == xi.questStatus.QUEST_COMPLETED then
player:startEvent(151)
elseif wingsOfGold == xi.questStatus.QUEST_COMPLETED then
player:startEvent(134)
Expand All @@ -57,16 +27,6 @@ entity.onTrigger = function(player, npc)
end

entity.onEventFinish = function(player, csid, option, npc)
-- SCATTERED INTO SHADOW
if (csid == 141 or csid == 143) and option == 1 then
player:addQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW)
player:setCharVar('scatIntoShadow_shortCS', 0)
npcUtil.giveKeyItem(player, { xi.ki.AQUAFLORA1, xi.ki.AQUAFLORA2, xi.ki.AQUAFLORA3 })
elseif csid == 144 then
player:setCharVar('scatIntoShadowCS', 1)
elseif csid == 135 then
npcUtil.completeQuest(player, xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW, { item = 14097, fame = 40, var = 'scatIntoShadowCS' })
end
end

return entity

0 comments on commit 0e8ae00

Please sign in to comment.