Skip to content

Commit

Permalink
Implement You Call That a Knife Quest
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbradleym committed Oct 19, 2024
1 parent e42ac25 commit af73a26
Show file tree
Hide file tree
Showing 15 changed files with 282 additions and 18 deletions.
2 changes: 2 additions & 0 deletions scripts/enum/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ xi.item =
JUDGMENT_KEY = 1142,
CURSED_KEY = 1143,
JAR_OF_RAFFLESIA_NECTAR = 1144,
TONBERRY_BOARD = 1145,
SLAB_OF_ELSHIMO_MARBLE = 1146,
ROCK_OF_ANCIENT_SALT = 1147,
SHOALWEED = 1148,
Expand Down Expand Up @@ -2156,6 +2157,7 @@ xi.item =
EMPEROR_ROE = 4275,
TONOSAMA_RICE_BALL = 4277,
FOREST_CARP = 4289,
SANDFISH = 4291,
FLASK_OF_ORANGE_AU_LAIT = 4299,
FLASK_OF_APPLE_AU_LAIT = 4300,
FLASK_OF_PEAR_AU_LAIT = 4301,
Expand Down
6 changes: 6 additions & 0 deletions scripts/globals/npc_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,12 @@ function npcUtil.tradeSetInList(trade, itemList)
return false
end

function npcUtil.confirmTradedItems(trade)
for i = 0, 7 do
trade:confirmSlot(i)
end
end

-----------------------------------
-- UpdateNPCSpawnPoint
-----------------------------------
Expand Down
201 changes: 201 additions & 0 deletions scripts/quests/outlands/You_Call_That_a_Knife.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
-----------------------------------
-- You Call That a Knife
-----------------------------------
-- Log ID: 5, Quest ID: 6
-- Mhebi Juhbily : !pos 40 -11 -159 250
-- Vah Keshura : !pos 30 -8.5 -105 250
-- Chef Nonberry : !pos -136 0.0 -91 159
-- Pula Rhatti : !pos -18.5 -4 -38 250
-----------------------------------
local templeID = zones[xi.zone.TEMPLE_OF_UGGALEPIH]
-----------------------------------

---@type TQuest
local quest = Quest:new(xi.questLog.OUTLANDS, xi.quest.id.outlands.YOU_CALL_THAT_A_KNIFE)

local cookMobs = {
templeID.mob.COOK_OFFSET,
templeID.mob.COOK_OFFSET + 1,
templeID.mob.COOK_OFFSET + 2,
templeID.mob.COOK_OFFSET + 3
}

quest.reward =
{
fame = 75,
fameArea = xi.fameArea.WINDURST,
gil = 7200,
title = xi.title.YA_DONE_GOOD
}

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

[xi.zone.KAZHAM] =
{
['Mhebi_Juhbily'] =
{
onTrade = function(player, npc, trade)
if
quest:getVar(player, 'Prog') == 0 and
npcUtil.tradeHasExactly(trade, { xi.item.SANDFISH })
then
return quest:progressEvent(127, 0, xi.item.SANDFISH)
end
end,

onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') == 1 then
return quest:event(318)
end
end
},

['Pula_Rhatti'] = quest:event(269, 0, xi.item.SANDFISH):replaceDefault(),

['_6y9'] =
{
onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') == 1 then
return quest:progressEvent(128)
end
end
},

onEventFinish =
{
[127] = function(player, csid, option, npc)
if option == 511 then
quest:setVar(player, 'Prog', 1)
player:confirmTrade()
end
end,

[128] = function(player, csid, option, npc)
if option == 1 then
quest:begin(player)
end
end,
},
},
},

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED and
not player:hasKeyItem(xi.ki.NONBERRYS_KNIFE)
end,

[xi.zone.KAZHAM] =
{
['Mhebi_Juhbily'] = quest:event(129):replaceDefault(),

['Pula_Rhatti'] = quest:event(269, 0, xi.item.SANDFISH):replaceDefault(),

['Vah_Keshura'] =
{
onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') == 1 then
return quest:progressEvent(130)
else
return quest:event(131):replaceDefault()
end
end,
},

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

[xi.zone.TEMPLE_OF_UGGALEPIH] =
{
['Chef_Nonberry'] =
{
onTrade = function(player, npc, trade)
if npcUtil.tradeHasExactly(trade, { xi.item.TONBERRY_BOARD }) then
return quest:progressEvent(27)
else
npcUtil.confirmTradedItems(trade) -- Take all items traded
return quest:progressEvent(28)
end
end,
},

onEventFinish =
{
[27] = function(player, csid, option, npc)
player:confirmTrade()
npcUtil.giveKeyItem(player, xi.ki.NONBERRYS_KNIFE)
end,

[28] = function(player, csid, option, npc)
player:confirmTrade()
if
os.time() >= npc:getLocalVar('cooldown') and
npcUtil.popFromQM(player, npc, cookMobs, { claim = true, hide = 0 }) then
npc:setLocalVar('cooldown', os.time() + 600) -- 10 minutes between repops
end
end,
},
},
},

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED and
player:hasKeyItem(xi.ki.NONBERRYS_KNIFE)
end,

[xi.zone.KAZHAM] =
{
['Mhebi_Juhbily'] = quest:progressEvent(133),

['Vah_Keshura'] = quest:event(132):replaceDefault(),

onEventFinish =
{
[133] = function(player, csid, option, npc)
if quest:complete(player) then
player:delKeyItem(xi.ki.NONBERRYS_KNIFE)
quest:setMustZone(player)
end
end
},
},
},

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

[xi.zone.KAZHAM] =
{
['Mhebi_Juhbily'] = quest:event(134):replaceDefault(),
},
},

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_COMPLETED and
not quest:getMustZone(player)
end,

[xi.zone.KAZHAM] =
{
['Mhebi_Juhbily'] = quest:event(135):replaceDefault(),
},
},
}

return quest
3 changes: 3 additions & 0 deletions scripts/zones/Kazham/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ return {
['Dodmos'] = { event = 275 },
['Hari_Pakhroib'] = { event = 84 },
['Jakoh_Wahcondalo'] = { event = 113 },
['Mhebi_Juhbily'] = { event = 125 },
['_6y9'] = { event = 126 },
['Vah_Keshura'] = { event = 124 },
['Vanono'] = { event = 262 },
}
1 change: 0 additions & 1 deletion scripts/zones/Kazham/npcs/Mhebi_Juhbily.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ entity.onTrade = function(player, npc, trade)
end

entity.onTrigger = function(player, npc)
player:startEvent(125)
end

entity.onEventUpdate = function(player, csid, option, npc)
Expand Down
2 changes: 0 additions & 2 deletions scripts/zones/Kazham/npcs/Vah_Keshura.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ end
entity.onTrigger = function(player, npc)
if player:getCharVar('BathedInScent') == 1 then
player:startEvent(187) -- scent from Blue Rafflesias
else
player:startEvent(124)
end
end

Expand Down
13 changes: 7 additions & 6 deletions scripts/zones/Temple_of_Uggalepih/DefaultActions.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
local ID = zones[xi.zone.TEMPLE_OF_UGGALEPIH]

return {
['_4fx'] = { messageSpecial = ID.text.DOOR_LOCKED },
['qm9'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm11'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm12'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm13'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm16'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['_4fx'] = { messageSpecial = ID.text.DOOR_LOCKED },
['Chef_Nonberry'] = { text = ID.text.NOTHING_I_CANT_CUT },
['qm9'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm11'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm12'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm13'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm16'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
}
3 changes: 3 additions & 0 deletions scripts/zones/Temple_of_Uggalepih/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ zones[xi.zone.TEMPLE_OF_UGGALEPIH] =
HATE_RESET = 7441, -- The built-up hate has been cleansed...!
DOOR_SHUT = 7443, -- The door is firmly shut.
NO_HATE = 7444, -- You have no built-up hate to cleanse.
NOTHING_I_CANT_CUT = 7448, -- Nothing... Nothing... Nothing I can't cut... Nothing...
BEGINS_TO_QUIVER = 7458, -- The <keyitem> begins to quiver!
SOME_SORT_OF_CEREMONY = 7460, -- Some sort of ceremony was performed here...
NM_OFFSET = 7510, -- It looks like some sort of device. A thin thread leads down to the floor...
Expand Down Expand Up @@ -67,6 +68,7 @@ zones[xi.zone.TEMPLE_OF_UGGALEPIH] =
CRIMSON_TOOTHED_PAWBERRY = GetFirstID('Crimson-toothed_Pawberry'),
SACRIFICIAL_GOBLET = GetFirstID('Sacrificial_Goblet'),
YALLERY_BROWN = GetFirstID('Yallery_Brown'),
COOK_OFFSET = GetFirstID('Cook_Solberry')
},
npc =
{
Expand All @@ -75,6 +77,7 @@ zones[xi.zone.TEMPLE_OF_UGGALEPIH] =
TEMPLE_GUARDIAN_DOOR = GetFirstID('_mf1'),
DOOR_TO_RANCOR = GetFirstID('_mfb'),
TREASURE_COFFER = GetFirstID('Treasure_Coffer'),
CHEF_NONBERRY = GetFirstID('Chef_Nonberry')
},
}

Expand Down
13 changes: 13 additions & 0 deletions scripts/zones/Temple_of_Uggalepih/mobs/Cook_Fulberry.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-----------------------------------
-- Area: Temple of Uggalepih
-- NM: Cook Fulberry
-----------------------------------
mixins = { require('scripts/mixins/job_special') }
-----------------------------------
---@type TMobEntity
local entity = {}

entity.onMobSpawn = function(mob)
end

return entity
13 changes: 13 additions & 0 deletions scripts/zones/Temple_of_Uggalepih/mobs/Cook_Minberry.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-----------------------------------
-- Area: Temple of Uggalepih
-- NM: Cook Minberry
-----------------------------------
mixins = { require('scripts/mixins/job_special') }
-----------------------------------
---@type TMobEntity
local entity = {}

entity.onMobSpawn = function(mob)
end

return entity
13 changes: 13 additions & 0 deletions scripts/zones/Temple_of_Uggalepih/mobs/Cook_Nalberry.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-----------------------------------
-- Area: Temple of Uggalepih
-- NM: Cook Nalberry
-----------------------------------
mixins = { require('scripts/mixins/job_special') }
-----------------------------------
---@type TMobEntity
local entity = {}

entity.onMobSpawn = function(mob)
end

return entity
13 changes: 13 additions & 0 deletions scripts/zones/Temple_of_Uggalepih/mobs/Cook_Solberry.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-----------------------------------
-- Area: Temple of Uggalepih
-- NM: Cook Solberry
-----------------------------------
mixins = { require('scripts/mixins/job_special') }
-----------------------------------
---@type TMobEntity
local entity = {}

entity.onMobSpawn = function(mob)
end

return entity
1 change: 0 additions & 1 deletion scripts/zones/Temple_of_Uggalepih/npcs/Chef_Nonberry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ entity.onTrade = function(player, npc, trade)
end

entity.onTrigger = function(player, npc)
player:startEvent(27)
end

entity.onEventUpdate = function(player, csid, option, npc)
Expand Down
8 changes: 4 additions & 4 deletions sql/mob_pools.sql
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,10 @@ INSERT INTO `mob_pools` VALUES (780,'Contantican_Ranger','Contantican_Ranger',25
INSERT INTO `mob_pools` VALUES (781,'Contantican_Warrior','Contantican_Warrior',25,0x0000F10400000000000000000000000000000000,1,1,5,265,100,0,1,0,1,2,0,0,0,3,0,0,0,0,0,25,25);
INSERT INTO `mob_pools` VALUES (782,'Contemplator','Contemplator',241,0x0000680400000000000000000000000000000000,1,1,7,240,100,0,1,1,0,16,0,0,432,129,0,0,0,0,0,706,241);
INSERT INTO `mob_pools` VALUES (783,'Cookieduster_Lipiroon','Cookieduster_Lipiroon',199,0x0000C70600000000000000000000000000000000,6,6,2,240,100,0,0,0,0,2,6406,32,0,0,0,0,0,0,0,199,199);
INSERT INTO `mob_pools` VALUES (784,'Cook_Fulberry','Cook_Fulberry',243,0x0000D70400000000000000000000000000000000,15,15,6,240,100,0,1,0,1,0,0,0,0,3,0,0,0,0,0,243,243);
INSERT INTO `mob_pools` VALUES (785,'Cook_Minberry','Cook_Minberry',243,0x0000DE0400000000000000000000000000000000,13,13,2,240,100,0,1,0,1,0,0,0,0,3,0,0,7,0,0,243,243);
INSERT INTO `mob_pools` VALUES (786,'Cook_Nalberry','Cook_Nalberry',243,0x0000E20400000000000000000000000000000000,6,6,2,240,100,0,1,0,1,0,0,0,0,3,0,0,0,0,0,243,243);
INSERT INTO `mob_pools` VALUES (787,'Cook_Solberry','Cook_Solberry',243,0x0000E30400000000000000000000000000000000,4,4,9,240,100,0,1,0,1,0,0,0,0,3,0,0,2,0,0,243,243);
INSERT INTO `mob_pools` VALUES (784,'Cook_Fulberry','Cook_Fulberry',243,0x0000D70400000000000000000000000000000000,15,15,6,240,100,0,1,0,2,0,0,0,0,3,0,0,0,0,0,243,243);
INSERT INTO `mob_pools` VALUES (785,'Cook_Minberry','Cook_Minberry',243,0x0000DE0400000000000000000000000000000000,13,13,2,240,100,0,1,0,2,0,0,0,0,3,0,0,7,0,0,243,243);
INSERT INTO `mob_pools` VALUES (786,'Cook_Nalberry','Cook_Nalberry',243,0x0000E20400000000000000000000000000000000,6,6,2,240,100,0,1,0,1,2,0,0,0,3,0,0,0,0,0,243,243);
INSERT INTO `mob_pools` VALUES (787,'Cook_Solberry','Cook_Solberry',243,0x0000E30400000000000000000000000000000000,4,4,9,240,100,0,1,0,1,2,0,0,0,3,0,0,2,0,0,243,243);
INSERT INTO `mob_pools` VALUES (788,'Coo_Keja_the_Unseen','Coo_Keja_the_Unseen',360,0x00004C0200000000000000000000000000000000,13,13,2,240,100,0,1,0,1,2,0,32,0,157,0,0,7,0,0,360,360);
INSERT INTO `mob_pools` VALUES (789,'Coppercap','Coppercap',116,0x0000C90800000000000000000000000000000000,1,1,11,240,100,0,0,0,1,0,0,0,532,129,0,0,0,0,0,116,116);
INSERT INTO `mob_pools` VALUES (790,'Copper_Beetle','Copper_Beetle',49,0x0000980100000000000000000000000000000000,7,7,8,240,100,0,0,0,1,0,0,0,396,129,0,0,0,0,0,49,49);
Expand Down
8 changes: 4 additions & 4 deletions sql/mob_spawn_points.sql
Original file line number Diff line number Diff line change
Expand Up @@ -56543,10 +56543,10 @@ INSERT INTO `mob_spawn_points` VALUES (17428485,'Bouncing_Ball','Bouncing Ball',

INSERT INTO `mob_spawn_points` VALUES (17428486,'Bonze_Marberry','Bonze Marberry',4,340.103,-0.001,222.666,127);
INSERT INTO `mob_spawn_points` VALUES (17428487,'Trompe_LOeil','Trompe L\'Oeil',5,80.031,-0.500,-38.824,197);
INSERT INTO `mob_spawn_points` VALUES (17428488,'Cook_Solberry','Cook Solberry',6,0.000,0.000,0.000,0);
INSERT INTO `mob_spawn_points` VALUES (17428489,'Cook_Nalberry','Cook Nalberry',7,0.000,0.000,0.000,0);
INSERT INTO `mob_spawn_points` VALUES (17428490,'Cook_Minberry','Cook Minberry',8,0.000,0.000,0.000,64);
INSERT INTO `mob_spawn_points` VALUES (17428491,'Cook_Fulberry','Cook Fulberry',9,0.000,0.000,0.000,0);
INSERT INTO `mob_spawn_points` VALUES (17428488,'Cook_Solberry','Cook Solberry',6,-144.0,0.000,-97.0,231);
INSERT INTO `mob_spawn_points` VALUES (17428489,'Cook_Nalberry','Cook Nalberry',7,-130.0,0.000,-101.0,186);
INSERT INTO `mob_spawn_points` VALUES (17428490,'Cook_Minberry','Cook Minberry',8,-142.0,0.000,-101.0,234);
INSERT INTO `mob_spawn_points` VALUES (17428491,'Cook_Fulberry','Cook Fulberry',9,-132.0,0.000,-97.0,123);
INSERT INTO `mob_spawn_points` VALUES (17428492,'Tonberrys_Elemental','Tonberry\'s Elemental',10,1.000,1.000,1.000,0);
INSERT INTO `mob_spawn_points` VALUES (17428493,'Tonberrys_Avatar','Tonberry\'s Avatar',11,0.000,0.000,0.000,127);
INSERT INTO `mob_spawn_points` VALUES (17428494,'Temple_Guardian','Temple Guardian',12,-64.472,-0.023,-102.889,191);
Expand Down

0 comments on commit af73a26

Please sign in to comment.