Skip to content

Commit

Permalink
Quest Fit for a Prince
Browse files Browse the repository at this point in the history
  • Loading branch information
KnowOne134 committed Feb 1, 2025
1 parent 3c288b3 commit 9c60e33
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 1 deletion.
2 changes: 2 additions & 0 deletions scripts/enum/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5059,6 +5059,8 @@ xi.item =
COBRA_UNIT_HARNESS = 14590,
COBRA_UNIT_ROBE = 14591,
EVOKERS_RING = 14625,
CASTORS_RING = 14628,
POLLUXS_RING = 14629,
DARK_RING = 14644,
TELLURIC_RING = 14649,
MARKSMANS_RING = 14650,
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ xi.quest.id =
ESCORT_FOR_HIRE = 103,
A_DISCERNING_EYE = 104,
A_TIMELY_VISIT = 105,
FIT_FOR_A_PRINCE = 106,
FIT_FOR_A_PRINCE = 106, -- - Converted
TRIAL_SIZE_TRIAL_BY_ICE = 107, -- +
SIGNED_IN_BLOOD = 108, -- + Converted
TEA_WITH_A_TONBERRY = 109, -- + Converted
Expand Down
149 changes: 149 additions & 0 deletions scripts/quests/sandoria/Fit_for_a_Prince.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
-----------------------------------
-- Fit for a Prince
-----------------------------------
-- Log ID: 0, Quest ID: 106
-----------------------------------
-- Halver : !pos 2 0 2 233
-----------------------------------
local ID = zones[xi.zone.CHATEAU_DORAGUILLE]
-----------------------------------

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

local list =
{
xi.race.HUME_F, xi.race.ELVAAN_F, xi.race.TARU_F, xi.race.MITHRA
}

local checkForMatch = function(player, race, face)
local party = player:getParty()

for _, entity in pairs(party) do
if entity:getRace() == race and entity:getFace() == face then
entity:addTitle(xi.title.CONSORT_CANDIDATE)
return true
end
end

return false
end

quest.reward =
{
item = { xi.item.CASTORS_RING, xi.item.POLLUXS_RING },
title = xi.title.ROYAL_WEDDING_PLANNER,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:getFameLevel(xi.fameArea.SANDORIA) >= 3 and
vars.Wait < VanadielUniqueDay()
end,

[xi.zone.CHATEAU_DORAGUILLE] =
{
['Halver'] =
{
onTrigger = function(player, npc)
local race = quest:getVar(player, 'Prog')
local face = quest:getVar(player, 'Option')
if race == 0 then
-- Remove your race from list if you are female
local newList = {}
for i = 1, #list do
local playerRace = player:getRace()
if playerRace ~= list[i] then
table.insert(newList, list[i])
end
end

local newRace = newList[math.random(1, #newList)]
local newFace = math.random(0, 15)
local firstTime = quest:getVar(player, 'Wait') > 0 and 1 or 0
quest:setVar(player, 'Prog', newRace)
quest:setVar(player, 'Option', newFace)
return quest:event(65, { [0] = newRace, [1] = newFace, [7] = firstTime })
else
return quest:event(65, { [0] = race, [1] = face, [7] = 1 })
end
end,
},

onEventFinish =
{
[65] = 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.CHATEAU_DORAGUILLE] =
{
['Halver'] =
{
onTrigger = function(player, npc)
local party = player:getParty()
local race = quest:getVar(player, 'Prog')
local face = quest:getVar(player, 'Option')

if #party == 2 and checkForMatch(player, race, face) then
return quest:progressEvent(66, { [0] = race, [1] = face })
else
return quest:event(67, { [0] = race, [1] = face })
end
end,
},

onEventUpdate =
{
[66] = function(player, csid, option)
if option == 0 then
-- Some reason only works if the initators charID is lower than the matching charID
-- reguardless of party order.
-- Bits 3 and 4 seem to be the factor in determining who is shown as initiator and match in retail
-- but on private servers changing that for the higher ordered charID if in party changes the entire
-- CS into a mix of this quest and another.
local party = player:getParty()
local members = #party == 2 and 0 or 1

-- player:updateEvent(0, 0, 1, 1, 0, 0, 1, members)

player:updateEvent(0, 0, 0, 1, 0, 0, 1, members)
end
end,
},

onEventFinish =
{
[66] = function(player, csid, option, npc)
if option == 1 then
quest:complete(player)
end
end,

[67] = function(player, csid, option, npc)
-- Cancel Quest, set wait time to restart to next day
if option == 1 then
quest:setVar(player, 'Prog', 0)
quest:setVar(player, 'Option', 0)
quest:setVar(player, 'Wait', VanadielUniqueDay())
player:delQuest(xi.quest.Sandoria.FIT_FOR_A_PRINCE)
player:messageSpecial(ID.text.FIT_CANCELED)
end
end,
},
},
},
}

return quest
1 change: 1 addition & 0 deletions scripts/zones/Chateau_dOraguille/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ zones[xi.zone.CHATEAU_DORAGUILLE] =
HIS_MAJESTY_AWAITS = 7280, -- Go, <name>. His Majesty awaits!
HEIR_TO_LIGHT_EXTRA = 7806, -- <name>! I never doubted your ability on the front line. We are truly in your debt. Proceed to the Audience Chamber. His Highness awaits!
SAVAGE_BLADE_LEARNED = 7956, -- You have learned the weapon skill Savage Blade!
FIT_CANCELED = 8125, -- The quest “Fit for a Prince” has been canceled.
CELEBRATORY_GOODS = 8468, -- An assortment of celebratory goods is available for purchase.
},
mob =
Expand Down

0 comments on commit 9c60e33

Please sign in to comment.