diff --git a/scripts/enum/item.lua b/scripts/enum/item.lua index 43574872fc2..3f919ea59e1 100644 --- a/scripts/enum/item.lua +++ b/scripts/enum/item.lua @@ -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, diff --git a/scripts/quests/bastok/Chips.lua b/scripts/quests/bastok/Chips.lua new file mode 100644 index 00000000000..308d4f1db95 --- /dev/null +++ b/scripts/quests/bastok/Chips.lua @@ -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