diff --git a/scripts/zones/Misareaux_Coast/IDs.lua b/scripts/zones/Misareaux_Coast/IDs.lua index f2fc66bb150..06c7db3e8f7 100644 --- a/scripts/zones/Misareaux_Coast/IDs.lua +++ b/scripts/zones/Misareaux_Coast/IDs.lua @@ -20,6 +20,11 @@ zones[tpz.zone.MISAREAUX_COAST] = CONQUEST_BASE = 7171, -- Tallying conquest results... DOOR_CLOSED = 7347, -- The door is locked tight. LOGGING_IS_POSSIBLE_HERE = 7601, -- Logging is possible here if you have . + NOTHING_HERE_YET = 7660; -- There is nothing here yet. Check again in the morning. + ALREADY_BAITED = 7661; -- The trap already contains . + APPEARS_TO_BE_TRAP = 7662; -- There appears to be some kind of trap here. Bits of fish are lying around the area. + DID_NOT_CATCH_ANYTHING = 7663; -- You did not catch anything. + PUT_IN_TRAP = 7664; -- You put in the trap. COMMON_SENSE_SURVIVAL = 8635, -- 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. HOMEPOINT_SET = 8858, -- Home point set! }, @@ -32,6 +37,8 @@ zones[tpz.zone.MISAREAUX_COAST] = PM6_2_MOB_OFFSET = 16879893, BOGGELMANN = 16879897, GRATION = 16879899, + ZIPHIUS = 16879900, + }, npc = { @@ -44,6 +51,7 @@ zones[tpz.zone.MISAREAUX_COAST] = 16879976, 16879977, }, + ZIPHIUS_QM_BASE = 16879919, }, } diff --git a/scripts/zones/Misareaux_Coast/Zone.lua b/scripts/zones/Misareaux_Coast/Zone.lua index bbcc828c7dd..6b471ed7ae0 100644 --- a/scripts/zones/Misareaux_Coast/Zone.lua +++ b/scripts/zones/Misareaux_Coast/Zone.lua @@ -3,32 +3,41 @@ -- Zone: Misareaux_Coast (25) -- ----------------------------------- -local ID = require("scripts/zones/Misareaux_Coast/IDs") require("scripts/globals/conquest") require("scripts/globals/helm") +local ID = require("scripts/zones/Misareaux_Coast/IDs") +local MISAREAUX_COAST = require("scripts/zones/Misareaux_Coast/globals") ----------------------------------- function onInitialize(zone) tpz.helm.initZone(zone, tpz.helm.type.LOGGING) -end; + MISAREAUX_COAST.ziphiusHandleQM() +end function onConquestUpdate(zone, updatetype) tpz.conq.onConquestUpdate(zone, updatetype) -end; +end function onZoneIn(player,prevZone) - local cs = -1; - if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then - player:setPos(567.624,-20,280.775,120); + local cs = -1 + if player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0 then + player:setPos(567.624, -20, 280.775, 120) end - return cs; -end; + return cs +end function onRegionEnter(player,region) -end; +end + +function onGameHour(zone) + local vHour = VanadielHour() + if vHour >= 22 or vHour <= 7 then + MISAREAUX_COAST.ziphiusHandleQM() + end +end function onEventUpdate(player,csid,option) -end; +end function onEventFinish(player,csid,option) -end; +end diff --git a/scripts/zones/Misareaux_Coast/globals.lua b/scripts/zones/Misareaux_Coast/globals.lua new file mode 100644 index 00000000000..63e627ab793 --- /dev/null +++ b/scripts/zones/Misareaux_Coast/globals.lua @@ -0,0 +1,80 @@ +----------------------------------- +-- Zone: Misareaux_Coast (25) +-- Desc: this file contains functions that are shared by multiple luas in this zone's directory +----------------------------------- +local ID = require("scripts/zones/Misareaux_Coast/IDs") +require("scripts/globals/npc_util") +----------------------------------- + +local MISAREAUX_COAST = { + ------------------------------------------ + -- Handle spawn/despawn for Ziphius NM QMs + ------------------------------------------ + ziphiusHandleQM = function() + local vHour = VanadielHour() + if vHour >= 7 and vHour < 22 then -- Despawn traps for Ziphius + for i = ID.npc.ZIPHIUS_QM_BASE, ID.npc.ZIPHIUS_QM_BASE+5 do + GetNPCByID(i):setStatus(tpz.status.DISAPPEAR) + GetNPCByID(i):resetLocalVars() + end + elseif vHour >= 22 or vHour < 4 then -- Spawn traps for Ziphius + local random = GetNPCByID(ID.npc.ZIPHIUS_QM_BASE + math.random(0, 5)) + if random:getStatus() == tpz.status.DISAPPEAR then + random:setLocalVar("[Ziphius]Spawn", 1) + end + for i = ID.npc.ZIPHIUS_QM_BASE, ID.npc.ZIPHIUS_QM_BASE+5 do + GetNPCByID(i):setStatus(tpz.status.NORMAL) + end + elseif vHour == 4 then -- Despawn non-baited traps + for i = ID.npc.ZIPHIUS_QM_BASE, ID.npc.ZIPHIUS_QM_BASE+5 do + if GetNPCByID(i):getLocalVar("[Ziphius]Baited") == 0 then + GetNPCByID(i):setStatus(tpz.status.DISAPPEAR) + end + end + end + end, + ------------------------------------ + -- Trade function for Ziphius NM QMs + ------------------------------------ + ziphiusOnTrade = function(player, npc, trade) + local baited = npc:getLocalVar("[Ziphius]Baited") == 1 + if not baited and npcUtil.tradeHas(trade, 16994) then -- Trade Slice of Carp + npc:setLocalVar("[Ziphius]Bait"..player:getName(), 1) + npc:setLocalVar("[Ziphius]Baited", 1) + player:confirmTrade() + player:messageSpecial(ID.text.PUT_IN_TRAP, 16994) + end + end, + ------------------------------------ + -- Spawn function for Ziphius NM QMs + ------------------------------------ + ziphiusOnTrigger = function(player, npc) + local baited = npc:getLocalVar("[Ziphius]Baited") == 1 + local baitedByPlayer = npc:getLocalVar("[Ziphius]Bait"..player:getName()) == 1 + local vHour = VanadielHour() + if vHour >= 22 or vHour < 4 then + if not baited then + player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP) + elseif baited and baitedByPlayer then + player:messageSpecial(ID.text.NOTHING_HERE_YET) + else + player:messageSpecial(ID.text.ALREADY_BAITED, 16994) + end + elseif vHour >= 4 and vHour < 7 then + if baitedByPlayer then + if npc:getLocalVar("[Ziphius]Spawn") == 1 then + npc:resetLocalVars() + npc:setStatus(tpz.status.DISAPPEAR) + SpawnMob(ID.mob.ZIPHIUS):updateClaim(player) + GetMobByID(ID.mob.ZIPHIUS):setPos(npc:getXPos(), npc:getYPos(), npc:getZPos()-1) + else + player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING) + end + else + player:messageSpecial(ID.text.ALREADY_BAITED, 16994) + end + end + end, +} + +return MISAREAUX_COAST \ No newline at end of file diff --git a/scripts/zones/Misareaux_Coast/npcs/qm2.lua b/scripts/zones/Misareaux_Coast/npcs/qm2.lua new file mode 100644 index 00000000000..4c5d1d7fb79 --- /dev/null +++ b/scripts/zones/Misareaux_Coast/npcs/qm2.lua @@ -0,0 +1,14 @@ +----------------------------------- +-- Area: Misareaux_Coast +-- NPC: ??? (Spawn Ziphius) +-- !pos 76 -16 534 25 +----------------------------------- +local MISAREAUX_COAST = require("scripts/zones/Misareaux_Coast/globals") + +function onTrade(player,npc,trade) + MISAREAUX_COAST.ziphiusOnTrade(player, npc, trade) +end + +function onTrigger(player,npc) + MISAREAUX_COAST.ziphiusOnTrigger(player, npc) +end \ No newline at end of file diff --git a/scripts/zones/Misareaux_Coast/npcs/qm3.lua b/scripts/zones/Misareaux_Coast/npcs/qm3.lua new file mode 100644 index 00000000000..b8552d379a8 --- /dev/null +++ b/scripts/zones/Misareaux_Coast/npcs/qm3.lua @@ -0,0 +1,14 @@ +----------------------------------- +-- Area: Misareaux_Coast +-- NPC: ??? (Spawn Ziphius) +-- !pos 102.5 -16 525 25 +----------------------------------- +local MISAREAUX_COAST = require("scripts/zones/Misareaux_Coast/globals") + +function onTrade(player,npc,trade) + MISAREAUX_COAST.ziphiusOnTrade(player, npc, trade) +end + +function onTrigger(player,npc) + MISAREAUX_COAST.ziphiusOnTrigger(player, npc) +end \ No newline at end of file diff --git a/scripts/zones/Misareaux_Coast/npcs/qm4.lua b/scripts/zones/Misareaux_Coast/npcs/qm4.lua new file mode 100644 index 00000000000..4f086374ed1 --- /dev/null +++ b/scripts/zones/Misareaux_Coast/npcs/qm4.lua @@ -0,0 +1,14 @@ +----------------------------------- +-- Area: Misareaux_Coast +-- NPC: ??? (Spawn Ziphius) +-- !pos 144.5 -16 520 25 +----------------------------------- +local MISAREAUX_COAST = require("scripts/zones/Misareaux_Coast/globals") + +function onTrade(player,npc,trade) + MISAREAUX_COAST.ziphiusOnTrade(player, npc, trade) +end + +function onTrigger(player,npc) + MISAREAUX_COAST.ziphiusOnTrigger(player, npc) +end \ No newline at end of file diff --git a/scripts/zones/Misareaux_Coast/npcs/qm5.lua b/scripts/zones/Misareaux_Coast/npcs/qm5.lua new file mode 100644 index 00000000000..2cfe0d7907c --- /dev/null +++ b/scripts/zones/Misareaux_Coast/npcs/qm5.lua @@ -0,0 +1,14 @@ +----------------------------------- +-- Area: Misareaux_Coast +-- NPC: ??? (Spawn Ziphius) +-- !pos 184.5 -16 517.5 25 +----------------------------------- +local MISAREAUX_COAST = require("scripts/zones/Misareaux_Coast/globals") + +function onTrade(player,npc,trade) + MISAREAUX_COAST.ziphiusOnTrade(player, npc, trade) +end + +function onTrigger(player,npc) + MISAREAUX_COAST.ziphiusOnTrigger(player, npc) +end \ No newline at end of file diff --git a/scripts/zones/Misareaux_Coast/npcs/qm6.lua b/scripts/zones/Misareaux_Coast/npcs/qm6.lua new file mode 100644 index 00000000000..7d33ab8f4b9 --- /dev/null +++ b/scripts/zones/Misareaux_Coast/npcs/qm6.lua @@ -0,0 +1,14 @@ +----------------------------------- +-- Area: Misareaux_Coast +-- NPC: ??? (Spawn Ziphius) +-- !pos 207 -16 479 25 +----------------------------------- +local MISAREAUX_COAST = require("scripts/zones/Misareaux_Coast/globals") + +function onTrade(player,npc,trade) + MISAREAUX_COAST.ziphiusOnTrade(player, npc, trade) +end + +function onTrigger(player,npc) + MISAREAUX_COAST.ziphiusOnTrigger(player, npc) +end \ No newline at end of file diff --git a/scripts/zones/Misareaux_Coast/npcs/qm7.lua b/scripts/zones/Misareaux_Coast/npcs/qm7.lua new file mode 100644 index 00000000000..030a69d5e7c --- /dev/null +++ b/scripts/zones/Misareaux_Coast/npcs/qm7.lua @@ -0,0 +1,14 @@ +----------------------------------- +-- Area: Misareaux_Coast +-- NPC: ??? (Spawn Ziphius) +-- !pos 253 -16 411.5 25 +----------------------------------- +local MISAREAUX_COAST = require("scripts/zones/Misareaux_Coast/globals") + +function onTrade(player,npc,trade) + MISAREAUX_COAST.ziphiusOnTrade(player, npc, trade) +end + +function onTrigger(player,npc) + MISAREAUX_COAST.ziphiusOnTrigger(player, npc) +end \ No newline at end of file