Skip to content

Commit

Permalink
Quest Warding Vampires to IF
Browse files Browse the repository at this point in the history
  • Loading branch information
KnowOne134 committed Feb 24, 2025
1 parent ce0aad9 commit 4dd5b9e
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 42 deletions.
2 changes: 1 addition & 1 deletion scripts/globals/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ xi.quest.id =
THE_COMPETITION = 76, -- ±
STARTING_A_FLAME = 77, -- ±
FEAR_OF_THE_DARK = 78, -- + Converted
WARDING_VAMPIRES = 79, -- +
WARDING_VAMPIRES = 79, -- + Converted
SLEEPLESS_NIGHTS = 80, -- ±
LUFETS_LAKE_SALT = 81, -- ±
HEALING_THE_LAND = 82, -- ±
Expand Down
87 changes: 87 additions & 0 deletions scripts/quests/sandoria/Warding_Vampires.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
-----------------------------------
-- Warding Vampires
-----------------------------------
-- Log ID: 0, Quest ID: 79
-----------------------------------
-- Maloquedil : !pos 35 0.1 60 231
-----------------------------------

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

quest.reward =
{
title = xi.title.VAMPIRE_HUNTER_DMINUS,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE
end,

[xi.zone.NORTHERN_SAN_DORIA] =
{
['Maloquedil'] =
{
onTrigger = function(player, npc)
if player:getFameLevel(xi.fameArea.SANDORIA) >= 3 then
return quest:progressEvent(24)
else
return quest:event(21)
end
end,
},

onEventFinish =
{
[24] = function(player, csid, option, npc)
if option == 1 then
quest:begin(player)
end
end,
},
},
},
{
check = function(player, status, vars)
return status ~= xi.questStatus.QUEST_AVAILABLE
end,

[xi.zone.NORTHERN_SAN_DORIA] =
{
['Maloquedil'] =
{
onTrade = function(player, npc, trade)
if npcUtil.tradeHas(trade, { { xi.item.BULB_OF_SHAMAN_GARLIC, 2 } }) then
return quest:progressEvent(23)
end
end,

onTrigger = function(player, npc)
if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) == xi.questStatus.QUEST_ACCEPTED then
return quest:event(22)
else
return quest:event(24, { [7] = 1 })
end
end,
},

onEventFinish =
{
[23] = function(player, csid, option, npc)
if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) == xi.questStatus.QUEST_ACCEPTED then
quest:complete(player)
else
player:addFame(xi.quest.fame_area.SANDORIA, 5)
end

npcUtil.giveCurrency(player, 'gil', 900)
player:confirmTrade()
end,
},
},
},
}

return quest
44 changes: 3 additions & 41 deletions scripts/zones/Northern_San_dOria/npcs/Maloquedil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,17 @@
---@type TNpcEntity
local entity = {}

entity.onTrade = function(player, npc, trade)
if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) ~= xi.questStatus.QUEST_AVAILABLE then
if
trade:hasItemQty(xi.item.BULB_OF_SHAMAN_GARLIC, 2) and
trade:getItemCount() == 2
then
player:startEvent(23)
end
end
end

entity.onTrigger = function(player, npc)
local warding = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES)
local wildcatSandy = player:getCharVar('WildcatSandy')

if
if
player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.LURE_OF_THE_WILDCAT) == xi.questStatus.QUEST_ACCEPTED and
not utils.mask.getBit(wildcatSandy, 7)
not utils.mask.getBit(player:getCharVar('WildcatSandy'), 7)
then
player:startEvent(807)
elseif
warding == xi.questStatus.QUEST_AVAILABLE and
player:getFameLevel(xi.fameArea.SANDORIA) >= 3
then
-- Quest available for fame superior or equal to 3
player:startEvent(24)
elseif warding == xi.questStatus.QUEST_ACCEPTED then --Quest accepted, and he just tell me where to get item.
player:startEvent(22)
elseif warding == xi.questStatus.QUEST_COMPLETED then --Since the quest is repeatable, he tells me where to find (again) the items.
player:startEvent(22)
else
player:startEvent(21)
end
end

entity.onEventFinish = function(player, csid, option, npc)
if csid == 24 and option == 1 then
player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES)
elseif csid == 23 then
player:tradeComplete()
player:addTitle(xi.title.VAMPIRE_HUNTER_D_MINUS)
npcUtil.giveCurrency(player, 'gil', 900)
if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) == xi.questStatus.QUEST_ACCEPTED then
player:addFame(xi.fameArea.SANDORIA, 30)
player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES)
else
player:addFame(xi.fameArea.SANDORIA, 5)
end
elseif csid == 807 then
if csid == 807 then
player:setCharVar('WildcatSandy', utils.mask.setBit(player:getCharVar('WildcatSandy'), 7, true))
end
end
Expand Down

0 comments on commit 4dd5b9e

Please sign in to comment.