From 1c436c35d3e3c64e13aea20de022f7984d43520a Mon Sep 17 00:00:00 2001 From: Sargonnas Date: Thu, 8 Jan 2026 10:45:24 -0500 Subject: [PATCH] Dosetsu Tree Retail Behavior updated Dosetsu Tree behaviors to match retail captured packet data. --- scripts/zones/Qufim_Island/IDs.lua | 5 +- scripts/zones/Qufim_Island/Zone.lua | 29 ++++++++++ .../zones/Qufim_Island/mobs/Dosetsu_Tree.lua | 54 +++++++++++++++++++ sql/mob_groups.sql | 2 +- 4 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 scripts/zones/Qufim_Island/mobs/Dosetsu_Tree.lua diff --git a/scripts/zones/Qufim_Island/IDs.lua b/scripts/zones/Qufim_Island/IDs.lua index 7b9a8377e53..b81d4707ea7 100644 --- a/scripts/zones/Qufim_Island/IDs.lua +++ b/scripts/zones/Qufim_Island/IDs.lua @@ -48,10 +48,11 @@ zones[xi.zone.QUFIM_ISLAND] = }, mob = { + DOSETSU_TREE = GetFirstID('Dosetsu_Tree'), + KRAKEN_NM = GetTableOfIDs('Kraken')[3], + OPHIOTAURUS = GetFirstID('Ophiotaurus'), SLIPPERY_SUCKER = GetFirstID('Slippery_Sucker'), TRICKSTER_KINETIX = GetFirstID('Trickster_Kinetix'), - OPHIOTAURUS = GetFirstID('Ophiotaurus'), - KRAKEN_NM = GetTableOfIDs('Kraken')[3], }, npc = { diff --git a/scripts/zones/Qufim_Island/Zone.lua b/scripts/zones/Qufim_Island/Zone.lua index db063765eef..c1e99d17636 100644 --- a/scripts/zones/Qufim_Island/Zone.lua +++ b/scripts/zones/Qufim_Island/Zone.lua @@ -1,6 +1,8 @@ ----------------------------------- -- Zone: Qufim_Island (126) ----------------------------------- +local ID = zones[xi.zone.QUFIM_ISLAND] +----------------------------------- ---@type TZone local zoneObject = {} @@ -35,4 +37,31 @@ end zoneObject.onEventFinish = function(player, csid, option, npc) end +zoneObject.onZoneWeatherChange = function(weather) + -- NM Dosetsu Tree only spawns during thunder weather + local dosetsuTree = GetMobByID(ID.mob.DOSETSU_TREE) + + if not dosetsuTree then + return + end + + if weather == xi.weather.THUNDER or weather == xi.weather.THUNDERSTORMS then + -- Spawn if respawn is up + if + not dosetsuTree:isSpawned() and + GetSystemTime() > dosetsuTree:getLocalVar('respawn') + then + xi.mob.updateNMSpawnPoint(dosetsuTree) + SpawnMob(ID.mob.DOSETSU_TREE) + end + else + if + dosetsuTree:isSpawned() and + not dosetsuTree:isEngaged() + then + DespawnMob(ID.mob.DOSETSU_TREE) + end + end +end + return zoneObject diff --git a/scripts/zones/Qufim_Island/mobs/Dosetsu_Tree.lua b/scripts/zones/Qufim_Island/mobs/Dosetsu_Tree.lua new file mode 100644 index 00000000000..c05950bc4c6 --- /dev/null +++ b/scripts/zones/Qufim_Island/mobs/Dosetsu_Tree.lua @@ -0,0 +1,54 @@ +----------------------------------- +-- Area: Qufim Island +-- NM: Dosetsu Tree +-- Only spawns during thunder weather +-- Level: 38-40 Treant NM +----------------------------------- +---@type TMobEntity +local entity = {} + +-- Spawn points in F-8/G-9 area +entity.spawnPoints = +{ + { x = -240.000, y = -20.795, z = 37.000 }, -- Original database point (F-8 area) + { x = -161.386, y = -20.190, z = 69.814 }, -- From packet capture (G-9 area) +} + +entity.onMobInitialize = function(mob) + mob:addImmunity(xi.immunity.SILENCE) + mob:addImmunity(xi.immunity.PARALYZE) + mob:addImmunity(xi.immunity.LIGHT_SLEEP) + mob:addImmunity(xi.immunity.DARK_SLEEP) +end + +entity.onMobSpawn = function(mob) + mob:setMobMod(xi.mobMod.NO_MOVE, 1) +end + +entity.onMobEngage = function(mob, target) + mob:setMobMod(xi.mobMod.NO_MOVE, 0) +end + +entity.onMobRoam = function(mob) + -- Re-root the mob once it returns to spawn point + if utils.distanceWithin(mob:getPos(), mob:getSpawnPos(), 2, false) then + mob:setMobMod(xi.mobMod.NO_MOVE, 1) + end +end + +entity.onMobDisengage = function(mob) + local weather = mob:getWeather() + if + weather ~= xi.weather.THUNDER and + weather ~= xi.weather.THUNDERSTORMS + then + DespawnMob(mob:getID()) + end +end + +entity.onMobDespawn = function(mob) + local respawn = math.random(3600, 7200) -- 1-2 hours during thunder weather + mob:setLocalVar('respawn', GetSystemTime() + respawn) +end + +return entity diff --git a/sql/mob_groups.sql b/sql/mob_groups.sql index 3f8e4dac5a9..78fd123aa32 100644 --- a/sql/mob_groups.sql +++ b/sql/mob_groups.sql @@ -9444,7 +9444,7 @@ INSERT INTO `mob_groups` VALUES (44,1536,126,'Giant_Ranger_G',0,128,3226,0,0,30, INSERT INTO `mob_groups` VALUES (45,1530,126,'Giant_Hunter_G',0,128,3226,0,0,30,35,0); INSERT INTO `mob_groups` VALUES (46,2012,126,'Hunting_Chief',0,128,3226,0,0,35,35,0); -INSERT INTO `mob_groups` VALUES (47,1093,126,'Dosetsu_Tree',75600,0,693,0,0,35,36,0); +INSERT INTO `mob_groups` VALUES (47,1093,126,'Dosetsu_Tree',0,128,693,0,0,38,40,0); INSERT INTO `mob_groups` VALUES (48,2079,126,'Ingaevon',0,128,0,0,0,53,55,0); INSERT INTO `mob_groups` VALUES (49,2496,126,'Malefic_Fencer',0,128,0,0,0,32,32,0); INSERT INTO `mob_groups` VALUES (50,3531,126,'Seed_Mandragora',0,128,0,0,0,32,32,0);