This repository has been archived by the owner on Dec 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #571 from hooksta4/Ziphius
Implement Ziphus spawn
- Loading branch information
Showing
9 changed files
with
192 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |