From 996bd5e9d359d57f8ab03ec431a538788645e248 Mon Sep 17 00:00:00 2001 From: jamesbradleym Date: Fri, 17 May 2024 20:29:41 -0400 Subject: [PATCH] implement quest Better the Demon You Know Co-authored-by: jamesbradleym Co-authored-by: dallano --- scripts/actions/mobskills/Substitute.lua | 89 +++++++++++ scripts/enum/item.lua | 2 + .../otherAreas/Better_the_Demon_You_Know.lua | 147 ++++++++++++++++++ .../Castle_Zvahl_Baileys/DefaultActions.lua | 5 + scripts/zones/Castle_Zvahl_Baileys/IDs.lua | 21 ++- .../mobs/Marquis_Andrealphus.lua | 37 +++++ sql/mob_groups.sql | 6 +- sql/mob_pools.sql | 2 +- sql/mob_skills.sql | 2 +- sql/mob_spawn_points.sql | 10 +- sql/npc_list.sql | 2 +- 11 files changed, 304 insertions(+), 19 deletions(-) create mode 100644 scripts/actions/mobskills/Substitute.lua create mode 100644 scripts/quests/otherAreas/Better_the_Demon_You_Know.lua create mode 100644 scripts/zones/Castle_Zvahl_Baileys/DefaultActions.lua create mode 100644 scripts/zones/Castle_Zvahl_Baileys/mobs/Marquis_Andrealphus.lua diff --git a/scripts/actions/mobskills/Substitute.lua b/scripts/actions/mobskills/Substitute.lua new file mode 100644 index 00000000000..afd0ef67a86 --- /dev/null +++ b/scripts/actions/mobskills/Substitute.lua @@ -0,0 +1,89 @@ +----------------------------------- +-- Substitute +-- Dummy ability used several mobs. +-- +-- Marquis Andrealphus: +-- Uses this ability to warp target player +-- out of the zone +-- +-- BCNM: Die by the Sword +-- Mobs use this ability to switch animation +-- ID as well as physical resistances +----------------------------------- +require("scripts/globals/mobskills") +----------------------------------- +local mobskillObject = {} + +local resistances = +{ + xi.mod.SLASH_SDT, + xi.mod.PIERCE_SDT, + xi.mod.IMPACT_SDT, + xi.mod.HTH_SDT, +} + +mobskillObject.onMobSkillCheck = function(target, mob, skill) + return 0 +end + +mobskillObject.onMobWeaponSkill = function(target, mob, skill) + -- Marquis Andrealphus + if mob:getPool() == 2571 then + local party = target:getParty() + local control = false + + -- Ability is only used when there is another party + -- member in the party, or party size > 1 + if mob:getPool() == 2571 then + if #party > 1 then + for _, v in ipairs(target:getParty()) do + if v:getZone() == target:getZone() then + control = true + end + end + else + control = true + end + end + + if control then + mob:timer(1000, function(mobArg) + mobArg:injectActionPacket(target:getID(), 4, 261, 0, 0, 0, 10, 1) + mobArg:timer(3000, function(mobArg1) + xi.teleport.escape(target) + end) + end) + end + + -- Die by the Sword BCNM + else + local oldAnim = mob:getAnimationSub() + local newAnim = oldAnim + + while newAnim == oldAnim do + newAnim = math.random(1,3) + end + + mob:setAnimationSub(newAnim) + + for i = 1, 4 do + if i == newAnim then + mob:setMod(resistances[i], 1000) + else + mob:setMod(resistances[i], -2500) + end + end + + if newAnim == 3 then + mob:setMod(resistances[4], 1000) + else + mob:setMod(resistances[4], -2500) + end + + end + + skill:setMsg(xi.msg.basic.NONE) + return 0 +end + +return mobskillObject diff --git a/scripts/enum/item.lua b/scripts/enum/item.lua index 424d56d8f22..65228488d18 100644 --- a/scripts/enum/item.lua +++ b/scripts/enum/item.lua @@ -860,6 +860,7 @@ xi.item = SQUARE_OF_BUGARD_LEATHER = 1637, MOBLIN_MASK = 1638, BOTTLE_OF_RICE_VINEGAR = 1652, + DEMON_PEN = 1653, IGNEOUS_ROCK = 1654, SEALION_CREST_KEY = 1658, CORAL_CREST_KEY = 1659, @@ -6026,6 +6027,7 @@ xi.item = OPTICAL_NEEDLE = 18175, NAZAR_BONJUK = 18176, KAKANPU = 18177, + GOBLIN_GRENADE = 18180, CRUDE_ARROW = 18181, CRUDE_ARROW_P1 = 18182, CRUDE_ARROW_P2 = 18183, diff --git a/scripts/quests/otherAreas/Better_the_Demon_You_Know.lua b/scripts/quests/otherAreas/Better_the_Demon_You_Know.lua new file mode 100644 index 00000000000..0d30e16dd3d --- /dev/null +++ b/scripts/quests/otherAreas/Better_the_Demon_You_Know.lua @@ -0,0 +1,147 @@ +----------------------------------- +-- Better the Demon you Know +----------------------------------- +-- Log ID: 4, Quest ID: 105 +-- Koblakiq !pos -64 21 -117 11 +-- qm_demon_you_know !pos 20 -24 15 161 +----------------------------------- +local castleZvahlBaileysID = zones[xi.zone.CASTLE_ZVAHL_BAILEYS] +----------------------------------- +local quest = Quest:new(xi.questLog.OTHER_AREAS, xi.quest.id.otherAreas.BETTER_THE_DEMON_YOU_KNOW) + +quest.reward = +{ + item = xi.item.GOBLIN_GRENADE, + title = xi.title.APOSTATE_FOR_HIRE +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:hasCompletedQuest(xi.questLog.OTHER_AREAS, xi.quest.id.otherAreas.FOR_THE_BIRDS) and + not quest:getMustZone(player) + end, + + [xi.zone.OLDTON_MOVALPOLOS] = + { + ['Koblakiq'] = quest:progressEvent(20, { [1] = xi.item.DEMON_PEN }), + + onEventFinish = + { + [20] = function(player, csid, option, npc) + quest:begin(player) + end, + }, + }, + }, + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.OLDTON_MOVALPOLOS] = + { + ['Koblakiq'] = + { + onTrigger = function(player, npc) + local prog = quest:getVar(player, 'Prog') + + if prog == 0 then + return quest:progressEvent(21, { [1] = xi.item.DEMON_PEN }) -- Additional Dialogue + elseif quest:getVar(player, 'Wait') > os.time() then + return quest:progressEvent(23) + elseif + prog == 1 and + quest:getVar(player, 'Wait') < os.time() + then + return quest:progressEvent(24) + elseif prog == 2 then + return quest:progressEvent(25) + elseif player:hasKeyItem(xi.ki.ZEELOZOKS_EARPLUG) then + return quest:progressEvent(26) + end + end, + + onTrade = function(player, npc, trade) + if + quest:getVar(player, 'Prog') == 0 and + npcUtil.tradeHasExactly(trade, { xi.item.DEMON_PEN }) + then + return quest:progressEvent(22) + end + end, + }, + + onEventFinish = + { + [22] = function(player, csid, option, npc) + player:tradeComplete() + quest:setVar(player, 'Wait', os.time() + 60) -- midnight for era, 1 min for retail + quest:setVar(player, 'Prog', 1) + end, + + [24] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 2) + end, + + [26] = function(player, csid, option, npc) + if quest:complete(player) then + player:delKeyItem(xi.ki.ZEELOZOKS_EARPLUG) + end + end, + }, + }, + + [xi.zone.CASTLE_ZVAHL_BAILEYS] = + { + ['qm_demon_you_know'] = + { + onTrigger = function(player, npc) + local mobs = + { + castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET, + castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET + 1, + castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET + 2, + castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET + 3, + castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET + 4, + } + + if + quest:getVar(player, 'Prog') == 2 and + npcUtil.popFromQM(player, npc, mobs, { claim = true, hide = 0, }) + then + player:messageSpecial(castleZvahlBaileysID.text.MOBLIN_EARPLUG) + return quest:message(castleZvahlBaileysID.text.MINIONS_ATTACK) + + elseif quest:getVar(player, 'Prog') == 3 and not player:hasKeyItem(xi.ki.ZEELOZOKS_EARPLUG) then + player:addKeyItem(xi.ki.ZEELOZOKS_EARPLUG) + return quest:messageSpecial(castleZvahlBaileysID.text.KEYITEM_OBTAINED, xi.ki.ZEELOZOKS_EARPLUG) + end + end, + }, + + ['Marquis_Andrealphus'] = + { + onMobDeath = function(mob, player, isKiller, firstCall) + if quest:getVar(player, 'Prog') == 2 then + quest:setVar(player, 'Prog', 3) + end + end, + }, + }, + }, + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_COMPLETED + end, + + [xi.zone.OLDTON_MOVALPOLOS] = + { + ['Koblakiq'] = quest:event(27):replaceDefault(), + }, + }, +} + +return quest diff --git a/scripts/zones/Castle_Zvahl_Baileys/DefaultActions.lua b/scripts/zones/Castle_Zvahl_Baileys/DefaultActions.lua new file mode 100644 index 00000000000..d519c986f44 --- /dev/null +++ b/scripts/zones/Castle_Zvahl_Baileys/DefaultActions.lua @@ -0,0 +1,5 @@ +local ID = zones[xi.zone.CASTLE_ZVAHL_BAILEYS] + +return { + ['qm_demon_you_know'] = { messageSpecial = ID.text.YOU_FIND_NOTHING }, +} diff --git a/scripts/zones/Castle_Zvahl_Baileys/IDs.lua b/scripts/zones/Castle_Zvahl_Baileys/IDs.lua index d67dcf6a0d6..c0c6b943601 100644 --- a/scripts/zones/Castle_Zvahl_Baileys/IDs.lua +++ b/scripts/zones/Castle_Zvahl_Baileys/IDs.lua @@ -20,18 +20,23 @@ zones[xi.zone.CASTLE_ZVAHL_BAILEYS] = LOGIN_NUMBER = 7162, -- In celebration of your most recent login (login no. ), we have provided you with points! You currently have a total of points. MEMBERS_LEVELS_ARE_RESTRICTED = 7182, -- Your party is unable to participate because certain members' levels are restricted. CHEST_UNLOCKED = 7238, -- You unlock the chest! + MOBLIN_EARPLUG = 7564, -- You see a moblin earplug on the ground. Could Zeelok have met his end here? + MINIONS_ATTACK = 7565, -- Marquis Andrealphus and his minions attack! + YOU_FIND_NOTHING = 7566, -- You find nothing. + BEGONE = 7567, -- Insolent adventurer! Begone from these halls! COMMON_SENSE_SURVIVAL = 7613, -- It appears that you have arrived at a new survival guide provided by the Adventurers' Mutual Aid Network. Common sense dictates that you should now be able to teleport here from similar tomes throughout the world. }, mob = { - MARQUIS_SABNOCK = GetFirstID('Marquis_Sabnock'), - LIKHO = GetFirstID('Likho'), - MARQUIS_ALLOCEN = GetFirstID('Marquis_Allocen'), - MARQUIS_AMON = GetFirstID('Marquis_Amon'), - DUKE_HABORYM = GetFirstID('Duke_Haborym'), - GRAND_DUKE_BATYM = GetFirstID('Grand_Duke_Batym'), - DARK_SPARK = GetFirstID('Dark_Spark'), - MIMIC = GetFirstID('Mimic'), + MARQUIS_SABNOCK = GetFirstID('Marquis_Sabnock'), + LIKHO = GetFirstID('Likho'), + MARQUIS_ALLOCEN = GetFirstID('Marquis_Allocen'), + MARQUIS_AMON = GetFirstID('Marquis_Amon'), + DUKE_HABORYM = GetFirstID('Duke_Haborym'), + GRAND_DUKE_BATYM = GetFirstID('Grand_Duke_Batym'), + DARK_SPARK = GetFirstID('Dark_Spark'), + MIMIC = GetFirstID('Mimic'), + DEMON_YOU_KNOW_OFFSET = GetFirstID('Marquis_Andrealphus'), }, npc = { diff --git a/scripts/zones/Castle_Zvahl_Baileys/mobs/Marquis_Andrealphus.lua b/scripts/zones/Castle_Zvahl_Baileys/mobs/Marquis_Andrealphus.lua new file mode 100644 index 00000000000..b3d3f90ff3b --- /dev/null +++ b/scripts/zones/Castle_Zvahl_Baileys/mobs/Marquis_Andrealphus.lua @@ -0,0 +1,37 @@ +----------------------------------- +-- Area: Castle Zvahl Baileys +-- NM: Marquis Andrealphus +-- Quest: Better the Demon you Know +----------------------------------- +local ID = zones[xi.zone.CASTLE_ZVAHL_BAILEYS] +----------------------------------- +local entity = {} + +entity.onMobEngaged = function(mob) + -- Blood Weapon Timer + mob:setLocalVar("timer", os.time() + 180) +end + +entity.onMobFight = function(mob, target) + if mob:getLocalVar("timer") < os.time() then + mob:setLocalVar("timer", os.time() + 180) + mob:useMobAbility(695) + end + + -- Escape player with hate out of zone + if mob:getHPP() < 75 and mob:getLocalVar("hpControl1") == 0 then + mob:showText(mob, ID.text.BEGONE) + mob:setLocalVar("hpControl1", 1) + mob:useMobAbility(307, target) + + elseif mob:getHPP() < 25 and mob:getLocalVar("hpControl2") == 0 then + mob:showText(mob, ID.text.BEGONE) + mob:setLocalVar("hpControl2", 1) + mob:useMobAbility(307, target) + end +end + +entity.onMobDeath = function(mob, player, optParams) +end + +return entity diff --git a/sql/mob_groups.sql b/sql/mob_groups.sql index bdfd8271d20..8e614faa173 100644 --- a/sql/mob_groups.sql +++ b/sql/mob_groups.sql @@ -11036,9 +11036,9 @@ INSERT INTO `mob_groups` VALUES (46,1786,161,'Grand_Duke_Batym',0,128,1213,0,0,7 INSERT INTO `mob_groups` VALUES (47,993,161,'Demons_Avatar',0,128,0,0,0,52,54,0); INSERT INTO `mob_groups` VALUES (48,917,161,'Dark_Spark',0,128,0,8500,0,55,55,0); INSERT INTO `mob_groups` VALUES (49,2664,161,'Mimic',0,128,1683,0,0,64,66,0); -INSERT INTO `mob_groups` VALUES (50,2571,161,'Marquis_Andrealphus',0,128,0,0,0,76,76,0); -INSERT INTO `mob_groups` VALUES (51,982,161,'Demon_Banneret',0,128,0,0,0,61,61,0); -INSERT INTO `mob_groups` VALUES (52,992,161,'Demon_Secretary',0,128,0,0,0,61,61,0); +INSERT INTO `mob_groups` VALUES (50,2571,161,'Marquis_Andrealphus',0,128,0,0,0,76,76,0); -- era HP: 4000, minlvl: 52, maxlvl: 52 +INSERT INTO `mob_groups` VALUES (51,982,161,'Demon_Banneret',0,128,0,0,0,61,61,0); -- era HP: 1000, minlvl: 48, maxlvl: 49 +INSERT INTO `mob_groups` VALUES (52,992,161,'Demon_Secretary',0,128,0,0,0,61,61,0); -- era HP: 1000, minlvl: 48, maxlvl: 49 INSERT INTO `mob_groups` VALUES (53,994,161,'Demons_Elemental',0,128,623,0,0,43,45,0); INSERT INTO `mob_groups` VALUES (54,994,161,'Demons_Elemental',0,128,623,0,0,60,64,0); diff --git a/sql/mob_pools.sql b/sql/mob_pools.sql index ada4b335d71..f5e6ae6dc56 100644 --- a/sql/mob_pools.sql +++ b/sql/mob_pools.sql @@ -2624,7 +2624,7 @@ INSERT INTO `mob_pools` VALUES (2567,'Maritime_Peiste','Maritime_Peiste',192,0x0 INSERT INTO `mob_pools` VALUES (2568,'Marquis_Allocen','Marquis_Allocen',358,0x0000E60200000000000000000000000000000000,1,1,4,240,100,0,1,0,1,2,0,0,247,135,0,0,0,0,0,358,358); INSERT INTO `mob_pools` VALUES (2569,'Marquis_Amon','Marquis_Amon',358,0x0000E90200000000000000000000000000000000,4,4,10,240,100,0,1,0,1,2,0,0,325,135,0,0,2,0,0,358,358); INSERT INTO `mob_pools` VALUES (2570,'Marquis_Andras','Marquis_Andras',358,0x0000EB0200000000000000000000000000000000,9,9,6,240,100,0,1,1,1,2,0,32,139,159,0,0,0,0,0,358,358); -INSERT INTO `mob_pools` VALUES (2571,'Marquis_Andrealphus','Marquis_Andrealphus',358,0x0000E50200000000000000000000000000000000,8,8,5,240,100,0,1,0,1,2,0,0,0,3,0,0,5,0,0,358,358); +INSERT INTO `mob_pools` VALUES (2571,'Marquis_Andrealphus','Marquis_Andrealphus',358,0x0000E50200000000000000000000000000000000,8,8,5,240,100,0,1,0,1,2,87,0,0,6,0,0,5,0,0,358,358); INSERT INTO `mob_pools` VALUES (2572,'Marquis_Cimeries','Marquis_Cimeries',358,0x0000EB0200000000000000000000000000000000,11,11,6,240,100,0,1,1,1,2,0,32,20,159,0,0,0,0,0,358,358); INSERT INTO `mob_pools` VALUES (2573,'Marquis_Decarabia','Marquis_Decarabia',358,0x0000F40200000000000000000000000000000000,10,10,9,240,100,0,1,1,1,2,0,32,139,159,0,0,6,0,0,358,358); INSERT INTO `mob_pools` VALUES (2574,'Marquis_Forneus','Marquis_Forneus',358,0x0000F00200000000000000000000000000000000,8,8,7,240,100,0,1,1,1,2,55,32,0,1181,0,0,301,0,0,358,358); diff --git a/sql/mob_skills.sql b/sql/mob_skills.sql index a4b6fc5381a..f3df5c7c0f1 100644 --- a/sql/mob_skills.sql +++ b/sql/mob_skills.sql @@ -320,7 +320,7 @@ INSERT INTO `mob_skills` VALUES (302,46,'wild_oats',0,7.0,2000,1500,4,0,0,0,0,0, INSERT INTO `mob_skills` VALUES (304,48,'photosynthesis',0,7.0,2000,1500,1,0,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (305,49,'leaf_dagger',0,7.0,2000,1500,4,0,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (306,50,'scream',1,15.0,2000,1500,4,0,0,0,0,0,0); --- INSERT INTO `mob_skills` VALUES (307,439,'substitute',0,7.0,2000,1500,4,0,0,0,0,0,0); +INSERT INTO `mob_skills` VALUES (307,439,'substitute',0,40.0,2000,0,4,0,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (308,52,'frogkick',0,7.0,2000,1500,4,0,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (309,53,'spore',0,7.0,2000,1500,4,0,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (310,54,'queasyshroom',0,7.0,2000,1500,4,0,0,0,0,0,0); diff --git a/sql/mob_spawn_points.sql b/sql/mob_spawn_points.sql index a99a0d91eeb..069d58065f1 100644 --- a/sql/mob_spawn_points.sql +++ b/sql/mob_spawn_points.sql @@ -57650,11 +57650,11 @@ INSERT INTO `mob_spawn_points` VALUES (17436962,'Stygian_Demon','Stygian Demon', INSERT INTO `mob_spawn_points` VALUES (17436963,'Demons_Elemental','Demon\'s Elemental',18,1.000,1.000,1.000,0); INSERT INTO `mob_spawn_points` VALUES (17436964,'Dark_Spark','Dark Spark',48,62.000,-24.000,19.000,10); INSERT INTO `mob_spawn_points` VALUES (17436965,'Mimic','Mimic',49,189.783,20.290,20.761,77); -INSERT INTO `mob_spawn_points` VALUES (17436966,'Marquis_Andrealphus','Marquis Andrealphus',50,0.000,0.000,0.000,0); -INSERT INTO `mob_spawn_points` VALUES (17436967,'Demon_Banneret','Demon Banneret',51,0.000,0.000,0.000,0); -INSERT INTO `mob_spawn_points` VALUES (17436968,'Demon_Secretary','Demon Secretary',52,0.000,0.000,0.000,127); -INSERT INTO `mob_spawn_points` VALUES (17436969,'Demon_Banneret','Demon Banneret',51,0.000,0.000,0.000,0); -INSERT INTO `mob_spawn_points` VALUES (17436970,'Demon_Secretary','Demon Secretary',52,0.000,0.000,0.000,0); +INSERT INTO `mob_spawn_points` VALUES (17436966,'Marquis_Andrealphus','Marquis Andrealphus',50,-15.500,-24.000,20.000,250); +INSERT INTO `mob_spawn_points` VALUES (17436967,'Demon_Banneret','Demon Banneret',51,19.340,-24.000,10.500,200); +INSERT INTO `mob_spawn_points` VALUES (17436968,'Demon_Secretary','Demon Secretary',52,19.340,-24.000,15.500,200); +INSERT INTO `mob_spawn_points` VALUES (17436969,'Demon_Banneret','Demon Banneret',51,19.340,-24.000,24.50,60); +INSERT INTO `mob_spawn_points` VALUES (17436970,'Demon_Secretary','Demon Secretary',52,19.340,-24.000,29.50,60); -- ------------------------------------------------------------ -- Castle Zvahl Keep (Zone 162) diff --git a/sql/npc_list.sql b/sql/npc_list.sql index a3a06792622..cc08a49aeb7 100644 --- a/sql/npc_list.sql +++ b/sql/npc_list.sql @@ -19771,7 +19771,7 @@ INSERT INTO `npc_list` VALUES (17436998,'Treasure_Chest','Treasure Chest',189,11 INSERT INTO `npc_list` VALUES (17436999,'Treasure_Coffer','Treasure Coffer',126,-72.899,0.137,19.549,6,40,40,0,0,0,0,3,0x0000C10300000000000000000000000000000000,0,NULL,0); INSERT INTO `npc_list` VALUES (17437000,'Switchstix','Switchstix',36,386.091,-12.000,-17.399,24,40,40,0,0,0,0,27,0x0000550000000000000000000000000000000000,0,NULL,1); INSERT INTO `npc_list` VALUES (17437001,'qm1','???',0,0.000,0.000,0.000,0,40,40,0,0,0,2,2051,0x0000320000000000000000000000000000000000,0,NULL,0); -INSERT INTO `npc_list` VALUES (17437002,'qm2','???',213,19.400,-24.141,19.185,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,NULL,0); +INSERT INTO `npc_list` VALUES (17437002,'qm_demon_you_know','???',213,19.400,-24.141,19.185,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,NULL,0); INSERT INTO `npc_list` VALUES (17437003,'Ramblix','Ramblix',158,377.847,-12.166,-25.548,0,40,40,0,0,0,6,27,0x0000550000000000000000000000000000000000,0,NULL,1); INSERT INTO `npc_list` VALUES (17437004,'Goblin_Footprint','Goblin Footprint',158,377.847,-12.166,-25.548,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,NULL,0); INSERT INTO `npc_list` VALUES (17437005,'blank','',0,0.000,0.000,0.000,0,50,50,0,0,0,2,2051,0x0000340000000000000000000000000000000000,0,NULL,1);