Skip to content

Commit

Permalink
[Quest]Chips Implementation
Browse files Browse the repository at this point in the history
[Quest]Chips Implementation
  • Loading branch information
hooksta4 committed May 29, 2024
1 parent f9fefeb commit a93b0d3
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/enum/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2432,6 +2432,7 @@ xi.item =
BOTTLE_OF_TERROANIMA = 5263,
MISTMELT = 5265,
CHUNK_OF_SHUMEYO_SALT = 5267,
CCB_POLYMER_PUMP = 5268,
OLD_BULLET_BOX = 5284,
TOOLBAG_UCHITAKE = 5308,
TOOLBAG_TSURARA = 5309,
Expand Down
123 changes: 123 additions & 0 deletions scripts/quests/bastok/Chips.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
-----------------------------------
-- Chips
-----------------------------------
-- Log ID: 1, Quest ID: 82
-- NPC: Ghebi Damomohe !pos 17.05 -0.11 -5.53 245
-- NPC: Cid !pos -12.53 -10.98 1.09 237
-----------------------------------
local metalworksID = zones[xi.zone.METALWORKS]
-----------------------------------

local quest = Quest:new(xi.questLog.BASTOK, xi.quest.id.bastok.CHIPS)

local chips =
{
xi.item.CARMINE_CHIP,
xi.item.CYAN_CHIP,
xi.item.GRAY_CHIP,
}

quest.reward =
{
item = xi.item.CCB_POLYMER_PUMP,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
(player:getCurrentMission(xi.mission.log_id.COP) >= xi.mission.id.cop.ONE_TO_BE_FEARED or
xi.mission.getVar(player, xi.mission.log_id.COP, xi.mission.id.cop.ONE_TO_BE_FEARED, 'Status') == 1) and
not quest:getMustZone(player)
end,

[xi.zone.LOWER_JEUNO] =
{
['Ghebi_Damomohe'] = quest:progressEvent(169),

onEventFinish =
{
[169] = function(player, csid, option, npc)
if option == 0 then
quest:begin(player)
else
quest:setMustZone(player)
end
end,
},
},
},

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

[xi.zone.METALWORKS] =
{
['Cid'] =
{
onTrade = function(player, npc, trade)
if
npcUtil.tradeHasExactly(trade, chips) and
not player:hasItem(xi.item.CCB_POLYMER_PUMP)
then
return quest:progressEvent(883)
elseif
player:hasItem(xi.item.CCB_POLYMER_PUMP) or
player:getFreeSlotsCount() == 0
then
return quest:messageSpecial(metalworksID.text.FULL_INVENTORY_AFTER_TRADE, xi.item.CCB_POLYMER_PUMP)
end
end,
},

onEventFinish =
{
[883] = function(player, csid, option, npc)
if quest:complete(player) then
player:confirmTrade()
end
end,
},
},
},

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

[xi.zone.METALWORKS] =
{
['Cid'] =
{
onTrade = function(player, npc, trade)
if
npcUtil.tradeHasExactly(trade, chips) and
not player:hasItem(xi.item.CCB_POLYMER_PUMP)
then
return quest:progressEvent(884)
elseif
player:hasItem(xi.item.CCB_POLYMER_PUMP) or
player:getFreeSlotsCount() == 0
then
return quest:messageSpecial(metalworksID.text.FULL_INVENTORY_AFTER_TRADE, xi.item.CCB_POLYMER_PUMP)
end
end,
},

onEventFinish =
{
[884] = function(player, csid, option, npc)
if npcUtil.giveItem(player, xi.item.CCB_POLYMER_PUMP) then
player:confirmTrade()
end
end,
},
},
},
}

return quest

0 comments on commit a93b0d3

Please sign in to comment.