From 46a994b1f00472a39bf2ca7e2cd47b391e2bf8b0 Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Sun, 11 May 2025 20:41:41 +0200 Subject: [PATCH 1/3] Add Friar Immunities and gil --- scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua b/scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua index e364d289e47..1290b28eb97 100644 --- a/scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua +++ b/scripts/zones/Den_of_Rancor/mobs/Friar_Rush.lua @@ -5,6 +5,14 @@ ---@type TMobEntity local entity = {} +entity.onMobInitialize = function(mob) + mob:setMobMod(xi.mobMod.GIL_MIN, 9000) + mob:setMobMod(xi.mobMod.GIL_MAX, 9000) + mob:addImmunity(xi.immunity.SILENCE) + mob:addImmunity(xi.immunity.LIGHT_SLEEP) + mob:addImmunity(xi.immunity.DARK_SLEEP) +end + entity.onMobDeath = function(mob, player, optParams) xi.hunts.checkHunt(mob, player, 394) end From 98a84c833c27f2088f830c64de44a591691a64ef Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Mon, 12 May 2025 00:11:55 +0200 Subject: [PATCH 2/3] Add immunities and revise mission and quest interactions --- .../missions/rotz/05_Headstone_Pilgrimage.lua | 84 ++++++++++--------- .../mobs/Axesarion_the_Wanderer.lua | 7 +- .../mobs/Doomed_Pilgrims.lua | 3 + scripts/zones/Yuhtunga_Jungle/mobs/Carthi.lua | 3 + scripts/zones/Yuhtunga_Jungle/mobs/Tipha.lua | 3 + 5 files changed, 58 insertions(+), 42 deletions(-) diff --git a/scripts/missions/rotz/05_Headstone_Pilgrimage.lua b/scripts/missions/rotz/05_Headstone_Pilgrimage.lua index e3afa284c64..fb24ceaacd3 100644 --- a/scripts/missions/rotz/05_Headstone_Pilgrimage.lua +++ b/scripts/missions/rotz/05_Headstone_Pilgrimage.lua @@ -23,6 +23,8 @@ local yuhtungaJungleID = zones[xi.zone.YUHTUNGA_JUNGLE] local sanctuaryOfZitahID = zones[xi.zone.THE_SANCTUARY_OF_ZITAH] ----------------------------------- +-- TODO: Cerment headstones have a distance check + local mission = Mission:new(xi.mission.log_id.ZILART, xi.mission.id.zilart.HEADSTONE_PILGRIMAGE) mission.reward = @@ -113,21 +115,22 @@ mission.sections = ['Cermet_Headstone'] = { onTrigger = function(player, npc) - if - player:hasKeyItem(xi.ki.WIND_FRAGMENT) and - not player:hasCompletedQuest(xi.questLog.OUTLANDS, xi.quest.id.outlands.WANDERING_SOULS) - then - player:messageName(capeTerigganID.text.ALREADY_OBTAINED_FRAG, nil, xi.ki.WIND_FRAGMENT) - - return mission:noAction() - elseif os.time() >= npc:getLocalVar('cooldown') then - if not GetMobByID(capeTerigganID.mob.AXESARION_THE_WANDERER):isSpawned() then - return mission:progressEvent(200, xi.ki.WIND_FRAGMENT) - else - return mission:messageSpecial(capeTerigganID.text.SOMETHING_BETTER) + if player:hasKeyItem(xi.ki.WIND_FRAGMENT) then + -- If the quest isn't completed, it's accepted by force, and we use quest trigger. + if player:hasCompletedQuest(xi.questLog.OUTLANDS, xi.quest.id.outlands.WANDERING_SOULS) then + player:messageName(capeTerigganID.text.ALREADY_OBTAINED_FRAG, nil, xi.ki.WIND_FRAGMENT) + return mission:noAction() end else - return mission:progressEvent(201, xi.ki.WIND_FRAGMENT) + if os.time() >= npc:getLocalVar('cooldown') then + if not GetMobByID(capeTerigganID.mob.AXESARION_THE_WANDERER):isSpawned() then + return mission:progressEvent(200, xi.ki.WIND_FRAGMENT) + else + return mission:messageSpecial(capeTerigganID.text.SOMETHING_BETTER) + end + else + return mission:progressEvent(201, xi.ki.WIND_FRAGMENT) -- Gives KI. Starts quest. + end end end, }, @@ -231,21 +234,22 @@ mission.sections = ['Cermet_Headstone'] = { onTrigger = function(player, npc) - if - player:hasKeyItem(xi.ki.LIGHT_FRAGMENT) and - not player:hasCompletedQuest(xi.questLog.OUTLANDS, xi.quest.id.outlands.SOUL_SEARCHING) - then - player:messageName(sanctuaryOfZitahID.text.ALREADY_OBTAINED_FRAG, nil, xi.ki.LIGHT_FRAGMENT) - - return mission:noAction() - elseif os.time() >= npc:getLocalVar('cooldown') then - if not GetMobByID(sanctuaryOfZitahID.mob.DOOMED_PILGRIMS):isSpawned() then - return mission:progressEvent(200, xi.ki.LIGHT_FRAGMENT) - else - return mission:messageSpecial(sanctuaryOfZitahID.text.SOMETHING_BETTER) + if player:hasKeyItem(xi.ki.LIGHT_FRAGMENT) then + -- If the quest isn't completed, it's accepted and we use quest trigger. + if player:hasCompletedQuest(xi.questLog.OUTLANDS, xi.quest.id.outlands.SOUL_SEARCHING) then + player:messageName(sanctuaryOfZitahID.text.ALREADY_OBTAINED_FRAG, nil, xi.ki.LIGHT_FRAGMENT) + return mission:noAction() end else - return mission:progressEvent(201, xi.ki.LIGHT_FRAGMENT) + if os.time() >= npc:getLocalVar('cooldown') then + if not GetMobByID(sanctuaryOfZitahID.mob.DOOMED_PILGRIMS):isSpawned() then + return mission:progressEvent(200, xi.ki.LIGHT_FRAGMENT) + else + return mission:messageSpecial(sanctuaryOfZitahID.text.SOMETHING_BETTER) + end + else + return mission:progressEvent(201, xi.ki.LIGHT_FRAGMENT) -- Gives KI. Starts quest. + end end end, }, @@ -313,20 +317,24 @@ mission.sections = { onTrigger = function(player, npc) if player:hasKeyItem(xi.ki.FIRE_FRAGMENT) then - player:messageName(yuhtungaJungleID.text.ALREADY_OBTAINED_FRAG, nil, xi.ki.FIRE_FRAGMENT) - - return mission:noAction() - elseif os.time() >= npc:getLocalVar('cooldown') then - if - not GetMobByID(yuhtungaJungleID.mob.TIPHA):isSpawned() and - not GetMobByID(yuhtungaJungleID.mob.CARTHI):isSpawned() - then - return mission:progressEvent(200, xi.ki.FIRE_FRAGMENT) - else - return mission:messageSpecial(yuhtungaJungleID.text.SOMETHING_BETTER) + -- If the quest isn't completed, it's accepted and we use quest trigger. + if player:hasCompletedQuest(xi.questLog.OUTLANDS, xi.quest.id.outlands.WRATH_OF_THE_OPO_OPOS) then + player:messageName(yuhtungaJungleID.text.ALREADY_OBTAINED_FRAG, nil, xi.ki.FIRE_FRAGMENT) + return mission:noAction() end else - return mission:progressEvent(201, xi.ki.FIRE_FRAGMENT) + if os.time() >= npc:getLocalVar('cooldown') then + if + not GetMobByID(yuhtungaJungleID.mob.TIPHA):isSpawned() and + not GetMobByID(yuhtungaJungleID.mob.CARTHI):isSpawned() + then + return mission:progressEvent(200, xi.ki.FIRE_FRAGMENT) + else + return mission:messageSpecial(yuhtungaJungleID.text.SOMETHING_BETTER) + end + else + return mission:progressEvent(201, xi.ki.FIRE_FRAGMENT) -- Gives KI. Starts quest. + end end end, }, diff --git a/scripts/zones/Cape_Teriggan/mobs/Axesarion_the_Wanderer.lua b/scripts/zones/Cape_Teriggan/mobs/Axesarion_the_Wanderer.lua index 0566f793876..7bd1dc7a8e1 100644 --- a/scripts/zones/Cape_Teriggan/mobs/Axesarion_the_Wanderer.lua +++ b/scripts/zones/Cape_Teriggan/mobs/Axesarion_the_Wanderer.lua @@ -8,11 +8,10 @@ local ID = zones[xi.zone.CAPE_TERIGGAN] local entity = {} entity.onMobInitialize = function(mob) - mob:setMobMod(xi.mobMod.IDLE_DESPAWN, 300) -end - -entity.onMobSpawn = function(mob) + mob:addImmunity(xi.immunity.SILENCE) mob:addImmunity(xi.immunity.STUN) + -- Dark sleep isnt an immunity, its a resistance rank 11 resist. It can potentially be immunobroken. + mob:setMobMod(xi.mobMod.IDLE_DESPAWN, 300) end entity.onMobDisengage = function(mob) diff --git a/scripts/zones/The_Sanctuary_of_ZiTah/mobs/Doomed_Pilgrims.lua b/scripts/zones/The_Sanctuary_of_ZiTah/mobs/Doomed_Pilgrims.lua index 52e523976f7..0a7650ef761 100644 --- a/scripts/zones/The_Sanctuary_of_ZiTah/mobs/Doomed_Pilgrims.lua +++ b/scripts/zones/The_Sanctuary_of_ZiTah/mobs/Doomed_Pilgrims.lua @@ -8,6 +8,9 @@ local ID = zones[xi.zone.THE_SANCTUARY_OF_ZITAH] local entity = {} entity.onMobInitialize = function(mob) + mob:addImmunity(xi.immunity.SILENCE) + mob:addImmunity(xi.immunity.LIGHT_SLEEP) + mob:addImmunity(xi.immunity.DARK_SLEEP) mob:setMobMod(xi.mobMod.IDLE_DESPAWN, 300) end diff --git a/scripts/zones/Yuhtunga_Jungle/mobs/Carthi.lua b/scripts/zones/Yuhtunga_Jungle/mobs/Carthi.lua index 8524fa234e5..30ab8ad32ce 100644 --- a/scripts/zones/Yuhtunga_Jungle/mobs/Carthi.lua +++ b/scripts/zones/Yuhtunga_Jungle/mobs/Carthi.lua @@ -8,6 +8,9 @@ local ID = zones[xi.zone.YUHTUNGA_JUNGLE] local entity = {} entity.onMobInitialize = function(mob) + mob:addImmunity(xi.immunity.SILENCE) + mob:addImmunity(xi.immunity.LIGHT_SLEEP) + mob:addImmunity(xi.immunity.DARK_SLEEP) mob:setMobMod(xi.mobMod.IDLE_DESPAWN, 300) end diff --git a/scripts/zones/Yuhtunga_Jungle/mobs/Tipha.lua b/scripts/zones/Yuhtunga_Jungle/mobs/Tipha.lua index 30a80bcbdeb..9c4926bf653 100644 --- a/scripts/zones/Yuhtunga_Jungle/mobs/Tipha.lua +++ b/scripts/zones/Yuhtunga_Jungle/mobs/Tipha.lua @@ -8,6 +8,9 @@ local ID = zones[xi.zone.YUHTUNGA_JUNGLE] local entity = {} entity.onMobInitialize = function(mob) + mob:addImmunity(xi.immunity.SILENCE) + mob:addImmunity(xi.immunity.LIGHT_SLEEP) + mob:addImmunity(xi.immunity.DARK_SLEEP) mob:setMobMod(xi.mobMod.IDLE_DESPAWN, 300) end From 01fc59200560fdbe957ce490adb72687c9aee15a Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Mon, 12 May 2025 01:25:35 +0200 Subject: [PATCH 3/3] Add missing event and prevent unwanted item behavior --- scripts/quests/outlands/Open_Sesame.lua | 28 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/quests/outlands/Open_Sesame.lua b/scripts/quests/outlands/Open_Sesame.lua index 23aedc7ca2f..d95ec1adc55 100644 --- a/scripts/quests/outlands/Open_Sesame.lua +++ b/scripts/quests/outlands/Open_Sesame.lua @@ -14,11 +14,11 @@ quest.reward = keyItem = xi.ki.LOADSTONE, } -local tradeItems = +local tradeOptions = { - { xi.item.METEORITE, 1 }, - { xi.item.SOIL_GEM, 1 }, - { xi.item.SOIL_GEODE, 12 }, + [1] = { xi.item.METEORITE, 1 }, + [2] = { xi.item.SOIL_GEM, 1 }, + [3] = { xi.item.SOIL_GEODE, 12 }, } quest.sections = @@ -53,8 +53,11 @@ quest.sections = ['Lokpix'] = { onTrade = function(player, npc, trade) - for _, tradeOption in ipairs(tradeItems) do - if npcUtil.tradeHasExactly(trade, { tradeOption, { xi.item.TREMORSTONE, 1 } }) then + for i = 1, #tradeOptions do + if + trade:getItemQty(tradeOptions[i][1]) == tradeOptions[i][2] and + trade:getItemQty(xi.item.TREMORSTONE) == 1 + then return quest:progressEvent(22) end end @@ -71,12 +74,23 @@ quest.sections = { [22] = function(player, csid, option, npc) if quest:complete(player) then - player:confirmTrade() + player:tradeComplete() end end, }, }, }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_COMPLETED + end, + + [xi.zone.EASTERN_ALTEPA_DESERT] = + { + ['Lokpix'] = quest:event(24):replaceDefault() + }, + }, } return quest