Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #545 from kaincenteno/blue-mage-transformations-quest
Browse files Browse the repository at this point in the history
Blue Mage Transformations quest + other 3 armor pieces
  • Loading branch information
ibm2431 authored May 12, 2020
2 parents a96c492 + 1f500fc commit 26e04af
Show file tree
Hide file tree
Showing 13 changed files with 336 additions and 49 deletions.
31 changes: 31 additions & 0 deletions scripts/globals/mobskills/reprobation.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---------------------------------------------
-- Reprobation
--
-- Description: Dispels all buffs from targets in area of effect, including food.
-- Type: Enfeebling
-- Utsusemi/Blink absorb: Dispels shadows
-- Range: Area of Effect
-- Notes:
---------------------------------------------
require("scripts/globals/monstertpmoves")
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/msg")
---------------------------------------------

function onMobSkillCheck(target,mob,skill)
return 0
end

function onMobWeaponSkill(target, mob, skill)
local dispel = target:dispelAllStatusEffect(bit.bor(tpz.effectFlag.DISPELABLE, tpz.effectFlag.FOOD))
local msg = tpz.msg.basic.SKILL_NO_EFFECT

if dispel > 0 then
msg = tpz.msg.basic.DISAPPEAR_NUM
end

skill:setMsg(msg)

return dispel
end
2 changes: 1 addition & 1 deletion scripts/globals/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ tpz.quest.id =
ROCK_BOTTOM = 20,
BEGINNINGS = 21, -- + --
OMENS = 22, -- + --
TRANSFORMATIONS = 23,
TRANSFORMATIONS = 23, -- + --
EQUIPPED_FOR_ALL_OCCASIONS = 24, -- + --
NAVIGATING_THE_UNFRIENDLY_SEAS = 25, -- + --
AGAINST_ALL_ODDS = 26,
Expand Down
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 @@ -21,6 +21,7 @@ zones[tpz.zone.AHT_URHGAN_WHITEGATE] =
HOMEPOINT_SET = 1366, -- Home point set!
IMAGE_SUPPORT_ACTIVE = 1405, -- You have to wait a bit longer before asking for synthesis image support again.
IMAGE_SUPPORT = 1407, -- Your [fishing/woodworking/smithing/goldsmithing/clothcraft/leatherworking/bonecraft/alchemy/cooking] skills went up [a little/ever so slightly/ever so slightly].
GATE_IS_FIRMLY_CLOSED = 1424, -- The gate is firmly closed...
ITEM_OBTAINEDX = 1497, -- You obtain <item>!
RUNIC_PORTAL = 4584, -- You cannot use the runic portal without the Empire's authorization.
UGRIHD_PURCHASE_DIALOGUE = 4645, -- Salaheem's Sentinels values your contribution to the success of the company. Please come again!
Expand Down
57 changes: 33 additions & 24 deletions scripts/zones/Aht_Urhgan_Whitegate/npcs/Imperial_Whitegate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,41 @@ function onTrade(player,npc,trade)
end

function onTrigger(player,npc)
if player:getEquipID(tpz.slot.MAIN) == 0 and player:getEquipID(tpz.slot.SUB) == 0 then
if player:getCurrentMission(TOAU) == tpz.mission.id.toau.GUESTS_OF_THE_EMPIRE and player:getCharVar("AhtUrganStatus") == 1 and
doRoyalPalaceArmorCheck(player) == true then
player:startEvent(3078,0,1,0,0,0,0,0,1,0)
elseif player:getCurrentMission(TOAU) == tpz.mission.id.toau.SEAL_OF_THE_SERPENT then
player:startEvent(3111)
elseif player:getCurrentMission(TOAU) == tpz.mission.id.toau.IMPERIAL_CORONATION and
doRoyalPalaceArmorCheck(player) == true then
player:startEvent(3140,tpz.besieged.getMercenaryRank(player),player:getTitle(),0,0,0,0,0,0,0)
elseif player:getCurrentMission(TOAU) >= tpz.mission.id.toau.IMPERIAL_CORONATION and
doRoyalPalaceArmorCheck(player) == true then
local ring = player:getCharVar("TOAU_RINGTIME")
local standard = player:hasItem(129)
local noWeapons = player:getEquipID(tpz.slot.MAIN) == 0 and player:getEquipID(tpz.slot.SUB) == 0
if player:getCurrentMission(TOAU) == tpz.mission.id.toau.GUESTS_OF_THE_EMPIRE and player:getCharVar("AhtUrganStatus") == 1 and
doRoyalPalaceArmorCheck(player) and noWeapons then
player:startEvent(3078,0,1,0,0,0,0,0,1,0)
elseif player:getCurrentMission(TOAU) == tpz.mission.id.toau.SEAL_OF_THE_SERPENT and noWeapons then
player:startEvent(3111)
elseif player:getCurrentMission(TOAU) == tpz.mission.id.toau.IMPERIAL_CORONATION and
doRoyalPalaceArmorCheck(player) and noWeapons then
player:startEvent(3140,tpz.besieged.getMercenaryRank(player),player:getTitle(),0,0,0,0,0,0,0)
elseif player:getCurrentMission(TOAU) >= tpz.mission.id.toau.IMPERIAL_CORONATION and
doRoyalPalaceArmorCheck(player) and noWeapons then
local ring = player:getCharVar("TOAU_RINGTIME")
local standard = player:hasItem(129)

local ringParam = 0
local ringParam = 0

if ring == 0 then
ringParam = 1
end
if ring == 0 then
ringParam = 1
end

local standardParam = 0
local standardParam = 0

if standard == false then
standardParam = 1
end
if standard == false then
standardParam = 1
end

if ringParam > 0 or standardParam > 0 then
player:startEvent(3155,standardParam,ringParam,0,0,0,0,0,0,0)
end
if ringParam > 0 or standardParam > 0 then
player:startEvent(3155,standardParam,ringParam,0,0,0,0,0,0,0)
end

-- TRANSFORMATIONS
elseif player:getCharVar("TransformationsProgress") == 1 then
player:startEvent(722)
else
player:messageSpecial(ID.text.GATE_IS_FIRMLY_CLOSED)
end
end

Expand Down Expand Up @@ -85,5 +90,9 @@ function onEventFinish(player,csid,option)
player:setCharVar("TOAU_RINGRECV", 0)
elseif csid == 3155 and option == 6 then
npcUtil.giveItem(player,129)
elseif csid == 722 then
player:addQuest(AHT_URHGAN, tpz.quest.id.ahtUrhgan.TRANSFORMATIONS)
player:setCharVar("TransformationsProgress", 2)
player:setCharVar("[BLUAF]Remaining", 7) -- Player can now craft BLU armor
end
end
144 changes: 138 additions & 6 deletions scripts/zones/Aht_Urhgan_Whitegate/npcs/Lathuya.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-----------------------------------
-----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Lathuya
-- Standard Info NPC
Expand All @@ -9,37 +9,142 @@ require("scripts/globals/quests")
require("scripts/globals/npc_util")
-----------------------------------

local craftingItems = {
[1] = -- magus bazubands
{
materials = {754, 828, 879, 4158},
currency = 2186,
currencyAmt = 2,
result = 14928
},
[2] = -- magus shalwar
{
materials = {761, 828, 2175, 2340},
currency = 2186,
currencyAmt = 2,
result = 15600
},
[3] = -- magus jubbah
{
materials = {828, 2229, 2288, 2340},
currency = 2186,
currencyAmt = 4,
result = 14521
}
}

function onTrade(player, npc, trade)
local remainingBLUAF = player:getCharVar("[BLUAF]Remaining") -- Bitmask of AF the player has NOT crafted
if remainingBLUAF >= 1 then
local craftingStage = player:getCharVar("[BLUAF]CraftingStage")
local totalCraftedPieces = 3 - player:countMaskBits(remainingBLUAF)
local AFoffset = 8 * totalCraftedPieces

local item = craftingItems[player:getCharVar("[BLUAF]Current")]
if item then
if craftingStage == 0 and npcUtil.tradeHasExactly(trade, item.materials) then
player:startEvent(732 + AFoffset, item.result, item.currency, item.currencyAmt)
elseif craftingStage == 1 and npcUtil.tradeHasExactly(trade, {{item.currency, item.currencyAmt}}) then
player:startEvent(734 + AFoffset, 0, item.currency, item.currencyAmt)
end
end
end
end

function onTrigger(player, npc)
local omensProgress = player:getCharVar("OmensProgress")
local omens = player:getQuestStatus(AHT_URHGAN, tpz.quest.id.ahtUrhgan.OMENS)
local transformations = player:getQuestStatus(AHT_URHGAN, tpz.quest.id.ahtUrhgan.TRANSFORMATIONS)

-- OMENS
if omens >= QUEST_ACCEPTED then
if omens == QUEST_ACCEPTED then
if omensProgress == 3 then
player:startEvent(714) -- Tells Master location
elseif omensProgress == 4 then
player:startEvent(715) -- Reminder of master location
elseif omensProgress == 5 then
player:startEvent(716) -- Master spoken to
elseif omens == QUEST_COMPLETED then
player:startEvent(771) -- Default dialog
end

-- DEFAULT DIALOG
-- CRAFTING OTHER 3 BLUE MAGE ARMOR PIECES
elseif transformations >= QUEST_ACCEPTED then
local remainingBLUAF = player:getCharVar("[BLUAF]Remaining") -- Bitmask of AF the player has NOT crafted
local totalCraftedPieces = 3 - player:countMaskBits(remainingBLUAF)
local currentTask = player:getCharVar("[BLUAF]Current")
local craftingStage = player:getCharVar("[BLUAF]CraftingStage")
local AFoffset = 8 * totalCraftedPieces

if currentTask == 0 and totalCraftedPieces ~= 3 then
if vanaDay() > player:getCharVar("[BLUAF]RestingDay") then
if totalCraftedPieces == 2 then
currentTask = math.floor(remainingBLUAF / 2) + 1
player:startEvent(746, 0, 0, 0, 0, 0, 0, 0, currentTask)
else
-- Will prompt for choosing which armor to work on
player:startEvent(730 + AFoffset, 7 - player:getCharVar("[BLUAF]Remaining"))
end
else
player:startEvent(737 + (AFoffset - 8)) -- Asleep message, wait until 1 day passes
end
elseif currentTask > 0 then
local pickupReady = vanaDay() > player:getCharVar("[BLUAF]PaymentDay")
local item = craftingItems[currentTask]
if craftingStage == 0 then
player:startEvent(731 + AFoffset, 0, item.currency, item.currencyAmt)
elseif craftingStage == 1 then
player:startEvent(733 + AFoffset, item.result, item.currency, item.currencyAmt)
elseif craftingStage == 2 and not pickupReady then
player:startEvent(735 + AFoffset)
elseif craftingStage == 2 and pickupReady then
player:startEvent(736 + AFoffset, item.result)
end
elseif totalCraftedPieces == 3 then
player:startEvent(753) -- Dialogue after crafting all BLU AF
end

elseif omens == QUEST_COMPLETED then
player:startEvent(718)
else
player:startEvent(770)
player:startEvent(770) -- Default dialogue
end
end

function onEventUpdate(player, csid, option)
local remainingBLUAF = player:getCharVar("[BLUAF]Remaining") -- Bitmask of AF the player has NOT crafted
local totalCraftedPieces = 3 - player:countMaskBits(remainingBLUAF)
local AFoffset = 8 * totalCraftedPieces

if csid == 730 + AFoffset then
if option >= 2 and option <= 9 then
local currentTask = player:getCharVar("[BLUAF]Current")
local updateType = option % 3
if updateType == 2 then
-- Choosing a piece
local piece = math.floor(option / 4) + 1
local pieceMask = math.pow(2, (piece - 1))
-- Make sure the player isn't trying to cheat somehow
if bit.band(pieceMask, player:getCharVar("[BLUAF]Remaining")) > 0 then
player:setCharVar("[BLUAF]Current", piece)
local item = craftingItems[piece]
player:updateEvent(0, unpack(item.materials))
end
else
-- Needs payment
local item = craftingItems[currentTask]
player:updateEvent(0, item.currency, item.currencyAmt)
end
end
end
end

function onEventFinish(player, csid, option)
local omensProgress = player:getCharVar("OmensProgress")

local remainingBLUAF = player:getCharVar("[BLUAF]Remaining") -- Bitmask of AF the player has NOT crafted
local totalCraftedPieces = 3 - player:countMaskBits(remainingBLUAF)
local currentTask = player:getCharVar("[BLUAF]Current")
local AFoffset = 8 * totalCraftedPieces

-- OMENS
if csid == 714 and omensProgress == 3 then
player:setCharVar("OmensProgress", 4)
Expand All @@ -50,5 +155,32 @@ function onEventFinish(player, csid, option)
var = { OmensProgress }
})
player:delKeyItem(tpz.ki.SEALED_IMMORTAL_ENVELOPE)

-- BLU AF CRAFTING
elseif csid == 732 + AFoffset then
player:setCharVar("[BLUAF]CraftingStage", 1)
player:confirmTrade()
elseif csid == 734 + AFoffset then
player:confirmTrade()
player:setCharVar("[BLUAF]CraftingStage", 2)
player:setCharVar("[BLUAF]PaymentDay", vanaDay())
npcUtil.giveKeyItem(player, tpz.ki.MAGUS_ORDER_SLIP)
elseif csid == 736 + AFoffset then
if npcUtil.giveItem(player, craftingItems[currentTask].result) then
remainingBLUAF = remainingBLUAF - math.pow(2, (currentTask - 1))
player:setCharVar("[BLUAF]Remaining", remainingBLUAF)
player:setCharVar("[BLUAF]PaymentDay", 0)
player:setCharVar("[BLUAF]CraftingStage", 0)
player:setCharVar("[BLUAF]Current", 0)

if player:getCharVar("[BLUAF]Remaining") == 0 then
-- Player is finished with Lathuya
player:setCharVar("[BLUAF]RestingDay", 0)
else
player:setCharVar("[BLUAF]RestingDay", vanaDay())
end

player:delKeyItem(tpz.ki.MAGUS_ORDER_SLIP)
end
end
end
Loading

0 comments on commit 26e04af

Please sign in to comment.