Skip to content

Commit

Permalink
[Lua, Fishing, Quest] The Sand Charm converted to IF format (#6393)
Browse files Browse the repository at this point in the history
* The Sand Charm added

* Added some more flavor text, tagged quests as converted
  • Loading branch information
Flibe-XI authored Nov 14, 2024
1 parent 77c1e5d commit 1591312
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 34 deletions.
6 changes: 3 additions & 3 deletions scripts/globals/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ xi.quest.id =
THE_CLUE = 5, -- + Converted
THE_BASICS = 6, -- + Converted
ORLANDO_S_ANTIQUES = 7, -- +
THE_SAND_CHARM = 8, -- +
THE_SAND_CHARM = 8, -- + Converted
A_POTTER_S_PREFERENCE = 9, -- +
THE_OLD_LADY = 10, -- +
FISHERMAN_S_HEART = 11,
Expand All @@ -488,8 +488,8 @@ xi.quest.id =
ONLY_THE_BEST = 18, -- +
AN_EXPLORER_S_FOOTSTEPS = 19, -- +
CARGO = 20, -- +
THE_GIFT = 21, -- +
THE_REAL_GIFT = 22, -- +
THE_GIFT = 21, -- + Converted
THE_REAL_GIFT = 22, -- + Converted
THE_RESCUE = 23, -- +
ELDER_MEMORIES = 24, -- +
TEST_MY_METTLE = 25, -- + Converted
Expand Down
144 changes: 144 additions & 0 deletions scripts/quests/otherAreas/The_Sand_Charm.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
-----------------------------------
-- The Sand Charm
-----------------------------------
-- Log ID: 4, Quest ID: 8
-- !addquest 4 8
-- Blandine : !pos 23 -7 41 249
-- Zexu : !pos 31.511 -9.001 23.496 249
-- Celestina : !pos -37.624 -16.050 75.681 249
-----------------------------------

local quest = Quest:new(xi.questLog.OTHER_AREAS, xi.quest.id.otherAreas.THE_SAND_CHARM)

quest.reward =
{
exp = 2000,
gil = 2000,
ki = xi.ki.MAP_OF_BOSTAUNIEUX_OUBLIETTE,
fameArea = xi.fameArea.WINDURST,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:getFameLevel(xi.fameArea.WINDURST) >= 4 and
xi.settings.map.FISHING_ENABLE == true
end,

[xi.zone.MHAURA] =
{
['Blandine'] =
{
onTrigger = function(player, npc)
local xPos = player:getXPos()
local zPos = player:getZPos()

-- Cutscenes won't start in the docking area. Must be on town side.
if zPos <= 29 or zPos >= 38 or xPos <= 16 or xPos >= 32 then
if quest:getVar(player, 'Prog') == 0 then
return quest:progressEvent(125) -- I know he's out there
elseif quest:getVar(player, 'Prog') == 2 then
return quest:progressEvent(124) -- Celestina doesn't want to hear it anymore
end
end
end,
},

['Zexu'] =
{
onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') == 1 then
return quest:progressEvent(123) -- Word is, pirates got 'im
end
end,
},

['Celestina'] =
{
onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') == 3 then
return quest:progressEvent(126, xi.item.SAND_CHARM) -- Go get back the sand charm
end
end,
},

onEventFinish =
{
[123] = function(player, csid, option, npc)
quest:setVar(player, 'Prog', 2)
end,

[124] = function(player, csid, option, npc)
quest:setVar(player, 'Prog', 3)
end,

[125] = function(player, csid, option, npc)
quest:setVar(player, 'Prog', 1)
end,

[126] = function(player, csid, option, npc)
quest:begin(player)
end,
},
},
},

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

[xi.zone.MHAURA] =
{
['Celestina'] =
{
onTrade = function(player, npc, trade)
if npcUtil.tradeHas(trade, xi.item.SAND_CHARM) then
return quest:progressEvent(127, 0, xi.item.SAND_CHARM) -- hes dead, but he'll be back soon I'm sure
end
end,
},

onEventFinish =
{
[127] = function(player, csid, option, npc)
if quest:complete(player) then
player:tradeComplete()
player:setCharVar('SmallDialogByBlandine', 1)
end
end,
},
},
},

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

[xi.zone.MHAURA] =
{
['Blandine'] =
{
onTrigger = function(player, npc)
if player:getCharVar('SmallDialogByBlandine') == 1 then
return quest:progressEvent(128) -- I stand here and pray for sailors now
else
return quest:event(129):replaceDefault() -- May the sea be kind...
end
end,
},

onEventFinish =
{
[128] = function(player, csid, option, npc)
player:setCharVar('SmallDialogByBlandine', 0)
end,
},
},
},
}

return quest
2 changes: 2 additions & 0 deletions scripts/zones/Mhaura/DefaultActions.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
return {
['Amalanbraux'] = { event = 700 },
['Blandine'] = { event = 122 },
['Galdo'] = { event = 650 },
['Hagain'] = { event = 10002 },
['Itzha_Delavhitta'] = { event = 900 },
Expand All @@ -13,5 +14,6 @@ return {
['Rycharde'] = { event = 69 },
['Take'] = { event = 59 },
['Tonasav'] = { event = 372 },
['Zexu'] = { event = 121 },
['Zhon_Kihshimo'] = { event = 25 },
}
26 changes: 3 additions & 23 deletions scripts/zones/Mhaura/npcs/Celestina.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,18 @@
local entity = {}

entity.onTrade = function(player, npc, trade)
if player:getQuestStatus(xi.questLog.OTHER_AREAS, xi.quest.id.otherAreas.THE_SAND_CHARM) == xi.questStatus.QUEST_ACCEPTED then
if npcUtil.tradeHasExactly(trade, xi.item.SAND_CHARM) then
player:startEvent(127, 0, xi.item.SAND_CHARM) -- Finish quest 'The Sand Charm'
end
end
end

entity.onTrigger = function(player, npc)
if player:getCharVar('theSandCharmVar') == 3 then
player:startEvent(126, xi.item.SAND_CHARM) -- During quest 'The Sand Charm' - 3rd dialog
else
local guildSkillId = xi.skill.GOLDSMITHING
local stock = xi.shop.generalGuildStock[guildSkillId]
xi.shop.generalGuild(player, stock, guildSkillId)
end
local guildSkillId = xi.skill.GOLDSMITHING
local stock = xi.shop.generalGuildStock[guildSkillId]
xi.shop.generalGuild(player, stock, guildSkillId)
end

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

entity.onEventFinish = function(player, csid, option, npc)
if csid == 126 and option == 70 then
player:setCharVar('theSandCharmVar', 4)
elseif csid == 127 then
player:confirmTrade()
npcUtil.completeQuest(player, xi.questLog.OTHER_AREAS, xi.quest.id.otherAreas.THE_SAND_CHARM, {
ki = xi.ki.MAP_OF_BOSTAUNIEUX_OUBLIETTE,
fameArea = xi.fameArea.WINDURST,
var = 'theSandCharmVar'
})
player:setCharVar('SmallDialogByBlandine', 1)
end
end

return entity
8 changes: 0 additions & 8 deletions scripts/zones/Mhaura/npcs/Zexu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,12 @@ entity.onTrade = function(player, npc, trade)
end

entity.onTrigger = function(player, npc)
if player:getCharVar('theSandCharmVar') == 1 then
player:startEvent(123) -- During quest "The Sand Charm" - 1st dialog
else
player:startEvent(121) -- Standard dialog
end
end

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

entity.onEventFinish = function(player, csid, option, npc)
if csid == 123 then
player:setCharVar('theSandCharmVar', 2)
end
end

return entity

0 comments on commit 1591312

Please sign in to comment.