Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quest][Assault] Promotion Chief Sergeant #6884

Open
wants to merge 1 commit into
base: base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/globals/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ xi.quest.id =
PROMOTION_CORPORAL = 93,
PROMOTION_SERGEANT = 94, -- + Converted
PROMOTION_SERGEANT_MAJOR = 95, -- + Converted
PROMOTION_CHIEF_SERGEANT = 96,
PROMOTION_CHIEF_SERGEANT = 96, -- + Converted
PROMOTION_SECOND_LIEUTENANT = 97,
PROMOTION_FIRST_LIEUTENANT = 98,
PROMOTION_CAPTAIN = 99,
Expand Down
293 changes: 293 additions & 0 deletions scripts/quests/ahtUrhgan/Promotion_Chief_Sergeant.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
-----------------------------------
-- Promotion: Chief Sergeant
-- Logid: 6 Questid: 96
-- Abquhbah: !pos 35 -6 -58 50
-- Hagakoff: !pos 82 0 -74 50
-- Mushroom Patch:
--[[
[1] = !pos 123 37 6 68
[2] = !pos -359 15 -425 68
[3] = !pos -208 9 143 68
[4] = !pos 117 37 -46 68
[5] = !pos -221 9 141 68
[6] = !pos -345 15 -442 68
]]
-----------------------------------
local aydeewaID = zones[xi.zone.AYDEEWA_SUBTERRANE]
local whitegateID = zones[xi.zone.AHT_URHGAN_WHITEGATE]
-----------------------------------

local quest = Quest:new(xi.questLog.AHT_URHGAN, xi.quest.id.ahtUrhgan.PROMOTION_CHIEF_SERGEANT)
local patchStage =
{
NONE = 0,
HARVESTED = 1,
PLANTED = 2,
PICKED = 3,
}
local triggerPatch = function(player, npc)
--[[
notes: dont have KI and havent plated, recieve KI - cs 14
place you have picked from - cs 15
have KI and wasnt place you picked it, lose KI - 19, option 0
place you have plated but not ready yet - cs 20
place you placed and ready to harvest - cs 21 {[0] = amount, [3] = bonus mushroom} option = amount recieved
if no KI and already harvested the area - cs 18
have KI and cant get KI from - cs 16
]]

local mushroomPatchOffset = npc:getID() - aydeewaID.npc.MUSHROOM_PATCH
local patch = 'MPatch'..mushroomPatchOffset
local mushroomVar = quest:getVar(player, patch)
local result = quest:messageSpecial(aydeewaID.text.NOTHING_OUT_OF_ORDINARY)
local time = VanadielHour()

-- Dont have KI have not picked or planted at patch
if
not player:hasKeyItem(xi.ki.SCOURSHROOM) and
mushroomVar == patchStage.NONE
then
return quest:progressEvent(14)

-- Section you have already Picked from
elseif mushroomVar == patchStage.HARVESTED then
return quest:progressEvent(15)

-- Section Planting if have KI and has not yet been touched
elseif
player:hasKeyItem(xi.ki.SCOURSHROOM) and
mushroomVar == patchStage.NONE
then
return quest:progressEvent(19)

-- planted a mushroom
elseif mushroomVar == patchStage.PLANTED then
-- Ready to harvest
if
quest:getVar(player, 'MPatch_Time') <= VanadielUniqueDay() and
not player:needToZone()
then
local timeBonus = 1
local bonus = math.random(100) > 75 and 5 or 0
if time > 4 and time < 6 and math.random(100) > 50 then
timeBonus = 2
end

return quest:progressEvent(21, { [0] = timeBonus, [3] = bonus })
-- Not ready to harvest
else
return quest:progressEvent(20)
end

-- Picked already
elseif mushroomVar == patchStage.PICKED then
return quest:progressEvent(18)

-- player has KI and has not been harvested already
elseif
player:hasKeyItem(xi.ki.SCOURSHROOM) and
mushroomVar == patchStage.NONE
then
return quest:progressEvent(16)
end

return result
end

local unsetPatches = function(player)
for i = 0, 5 do
local patch = 'MPatch'..i
local patchTime = 'MPatch_Time'..i
quest:setVar(player, patch, 0)
quest:setVar(player, patchTime, 0)
end
end

quest.reward =
{
item = xi.item.IMPERIAL_MYTHRIL_PIECE,
keyItem = xi.ki.CS_WILDCAT_BADGE,
title = xi.title.CHIEF_SERGEANT,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:getVar('AssaultPromotion') >= 25 and
player:getQuestStatus(xi.questLog.AHT_URHGAN, xi.quest.id.ahtUrhgan.PROMOTION_SERGEANT_MAJOR) == xi.questStatus.QUEST_COMPLETED
end,

[xi.zone.AHT_URHGAN_WHITEGATE] =
{
['Abquhbah'] = quest:progressEvent(5060),

onEventFinish =
{
[5060] = function(player, csid, option, npc)
quest:begin(player)
end,
},
},
},
{
-- Started quest has a reminder, trigger Hagakoff to progress
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED and
vars.Prog == 0
end,

[xi.zone.AHT_URHGAN_WHITEGATE] =
{
['Abquhbah'] = quest:progressEvent(5062):oncePerZone(),

['Hagakoff'] = quest:progressEvent(5067),

onEventFinish =
{
[5067] = function(player, csid, option, npc)
quest:setVar(player, 'Prog', 1)
end,
},
},
},
{
-- Talked to Hagakoff and told to go back to Abquhbah
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED and
vars.Prog == 1
end,

[xi.zone.AHT_URHGAN_WHITEGATE] =
{
['Abquhbah'] = quest:progressEvent(5068),

onEventFinish =
{
[5068] = function(player, csid, option, npc)
quest:setVar(player, 'Prog', 2)
end,
},
},
},
{
-- Talked to Abquhbah and told to go back to Hagakoff again
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED and
vars.Prog == 2
end,

[xi.zone.AHT_URHGAN_WHITEGATE] =
{
['Abquhbah'] = quest:progressEvent(5069):oncePerZone(),

['Hagakoff'] = quest:progressEvent(5063),

onEventFinish =
{
[5063] = function(player, csid, option, npc)
quest:setVar(player, 'Prog', 3)
end,
},
},
},
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED and
vars.Prog == 3
end,

[xi.zone.AYDEEWA_SUBTERRANE] =
{
['Mushroom_Patch'] =
{
onTrigger = function(player, npc)
return triggerPatch(player, npc)
end,
},

onEventFinish =
{
[14] = function(player, csid, option, npc)
local mushroomPatchOffset = npc:getID() - aydeewaID.npc.MUSHROOM_PATCH

quest:setVar(player, 'MPatch'..mushroomPatchOffset, patchStage.HARVESTED)
player:addKeyItem(xi.ki.SCOURSHROOM)
end,

[19] = function(player, csid, option, npc)
if option == 0 then
local mushroomPatchOffset = npc:getID() - aydeewaID.npc.MUSHROOM_PATCH

quest:setVar(player, 'MPatch'..mushroomPatchOffset, patchStage.PLANTED)
quest:setVar(player, 'MPatch_Time'..mushroomPatchOffset, VanadielUniqueDay() + 1)
player:needToZone(true)
player:delKeyItem(xi.ki.SCOURSHROOM)
end
end,

[21] = function(player, csid, option, npc)
if option ~= 100 then
local mushrooms = quest:getVar(player, 'Option')
local mushroomPatchOffset = npc:getID() - aydeewaID.npc.MUSHROOM_PATCH
local amount = option + mushrooms

if amount > 5 then
quest:messageSpecial(aydeewaID.text.NO_MORE_SPROUTS)
quest:messageSpecial(aydeewaID.text.NO_MORE_SPROUTS + 1, 0, 5)
end

quest:setVar(player, 'MPatch'..mushroomPatchOffset, patchStage.PICKED)
quest:setVar(player, 'Option', utils.clamp(amount, 1, 5))
end
end,
},
},

[xi.zone.AHT_URHGAN_WHITEGATE] =
{
['Abquhbah'] =
{
onTrigger = function(player, npc)
local mushrooms = quest:getVar(player, 'Option')
local polished = quest:getVar(player, 'Stage')

if mushrooms > 0 then
return quest:progressEvent(5061, { [0] = polished, [1] = mushrooms })
end
end,
},

onEventFinish =
{
[5061] = function(player, csid, option, npc)
if option < 11 then
local polished = quest:getVar(player, 'Stage')

quest:setVar(player, 'Stage', quest:getVar(player, 'Option') + polished)
quest:setVar(player, 'Option', 0)
unsetPatches(player)
elseif option >= 20 then
if option >= 30 and player:getFreeSlotsCount() < 2 then
quest:messageSpecial(whitegateID.text.ITEM_CANNOT_BE_OBTAINED + 4)
return
end

if quest:complete(player) then
if option >= 30 then
npcUtil.giveItem(player, xi.item.IMPERIAL_GOLD_PIECE)
end

player:setCharVar('AssaultPromotion', 0)
player:messageSpecial(whitegateID.text.PROMOTION_CHIEF_SERGEANT)
player:delKeyItem(xi.ki.SCOURSHROOM)
end
end
end,
},
},
},
}

return quest
1 change: 1 addition & 0 deletions scripts/zones/Aht_Urhgan_Whitegate/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ zones[xi.zone.AHT_URHGAN_WHITEGATE] =
AUTOMATON_ATTACHMENT_UNLOCK = 9668, -- You can now equip your automaton with <item>.
SANCTION = 9821, -- You have received the Empire's Sanction.
ZASSHAL_DIALOG = 11024, -- 'ang about. Looks like the permit you got was the last one I 'ad, so it might take me a bit o' time to scrounge up some more. 'ere, don't gimme that look. I'll be restocked before you know it.
PROMOTION_CHIEF_SERGEANT = 12354, -- <player> has been promoted to Chief Sergeant!
RETRIEVE_DIALOG_ID = 13543, -- You retrieve <item> from the porter moogle's care.
COMMON_SENSE_SURVIVAL = 14334, -- It appears that you have arrived at a new survival guide provided by the Adventurers' Mutual Aid Network. Common sense dictates that you should now be able to teleport here from similar tomes throughout the world.
},
Expand Down
7 changes: 4 additions & 3 deletions scripts/zones/Aydeewa_Subterrane/DefaultActions.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
local ID = zones[xi.zone.AYDEEWA_SUBTERRANE]

return {
['blank_omens'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm9'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm10'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['blank_omens'] = { special = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm9'] = { special = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm10'] = { special = ID.text.NOTHING_OUT_OF_ORDINARY },
['Mushroom_Patch'] = { special = ID.text.NOTHING_OUT_OF_ORDINARY },
}
4 changes: 3 additions & 1 deletion scripts/zones/Aydeewa_Subterrane/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ zones[xi.zone.AYDEEWA_SUBTERRANE] =
MEMBERS_LEVELS_ARE_RESTRICTED = 7023, -- Your party is unable to participate because certain members' levels are restricted.
FISHING_MESSAGE_OFFSET = 7061, -- You can't fish here.
MINING_IS_POSSIBLE_HERE = 7332, -- Mining is possible here if you have <item>.
NO_MORE_SPROUTS = 7711, -- However, you cannot carry any more sprouts.
SENSE_OMINOUS_PRESENCE = 8012, -- You sense an ominous presence...
BLOOD_STAINS = 8018, -- The ground is smeared with bloodstains...
DRAWS_NEAR = 8043, -- Something draws near!
Expand All @@ -29,12 +30,13 @@ zones[xi.zone.AYDEEWA_SUBTERRANE] =
mob =
{
BLUESTREAK_GYUGYUROON = GetFirstID('Bluestreak_Gyugyuroon'),
CHIGRE = GetFirstID('Chigre'),
NOSFERATU = GetFirstID('Nosferatu'),
PANDEMONIUM_WARDEN = GetFirstID('Pandemonium_Warden'), -- 2 Copies: +0, +1
CHIGRE = GetFirstID('Chigre'),
},
npc =
{
MUSHROOM_PATCH = GetFirstID('Mushroom_Patch')
},
}

Expand Down