Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Impliment Ziphus spawn #571

Merged
merged 5 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/zones/Misareaux_Coast/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ zones[tpz.zone.MISAREAUX_COAST] =
BOGGELMANN = 16879897,
GRATION = 16879899,
ZIPHIUS = 16879900,
ZIPHIUS_QM_BASE = 16879919,

},
npc =
{
Expand All @@ -50,6 +50,7 @@ zones[tpz.zone.MISAREAUX_COAST] =
16879976,
16879977,
},
ZIPHIUS_QM_BASE = 16879919,
},
}

Expand Down
5 changes: 2 additions & 3 deletions scripts/zones/Misareaux_Coast/Zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function onRegionEnter(player,region)
end

function onGameHour(zone)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local ZIPHIUS_QM_BASE = 16879919
cocosolos marked this conversation as resolved.
Show resolved Hide resolved
if (VanadielHour() == 22) then -- Spawn traps for Ziphius
cocosolos marked this conversation as resolved.
Show resolved Hide resolved
for i = ZIPHIUS_QM_BASE, ZIPHIUS_QM_BASE+5, 1 do
Expand All @@ -37,11 +36,11 @@ function onGameHour(zone)
elseif (VanadielHour() == 7) then -- Despawn traps for Ziphius
for i = ZIPHIUS_QM_BASE, ZIPHIUS_QM_BASE+5, 1 do
GetNPCByID(i):setStatus(tpz.status.DISAPPEAR)
GetNPCByID(i):setLocalVar("[Ziphius]Bait Trap", 0)
end
SetServerVariable("[Ziphius]Bait Trap", 0)
elseif (VanadielHour() == 4) then -- Despawn non-baited traps
for i = ZIPHIUS_QM_BASE, ZIPHIUS_QM_BASE+5, 1 do
if (bit.band(baited, bit.lshift(1, (i - ZIPHIUS_QM_BASE))) == 0) then
if (GetNPCByID(i):getLocalVar("[Ziphius]Bait Trap") == 0) then
GetNPCByID(i):setStatus(tpz.status.DISAPPEAR)
end
end
Expand Down
42 changes: 16 additions & 26 deletions scripts/zones/Misareaux_Coast/npcs/qm2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,48 @@

require("scripts/globals/npc_util")
local ID = require("scripts/zones/Misareaux_Coast/IDs")
local ZIPHIUS_QM_BASE = 16879919
local ZIPHIUS = 16879900

function onTrade(player,npc,trade)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

-- Trade Slice of Carp
if (npcUtil.tradeHas(trade, 16994) and bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
baited = bit.bor(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE)))
player:tradeComplete()
if (npcUtil.tradeHas(trade, 16994) and baited == 0) then
npc:setLocalVar("[Ziphius]Bait Trap", 1)
cocosolos marked this conversation as resolved.
Show resolved Hide resolved
player:confirmTrade()
player:messageSpecial(ID.text.PUT_IN_TRAP, 16994)
SetServerVariable("[Ziphius]Bait Trap", baited)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
end

function onTrigger(player,npc)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

if (VanadielHour() >= 22 or VanadielHour() < 4) then
if (bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
if (baited == 0) then
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
elseif (VanadielHour() >= 4 and VanadielHour() < 7) then
if (bit.band(baited, bit.lshift(1, 6)) == 0) then
if (math.random(1,1000) <= 176) then
SpawnMob(ZIPHIUS):updateClaim(player)
GetMobByID(ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
if (baited == 1) then
cocosolos marked this conversation as resolved.
Show resolved Hide resolved
if (math.random(1,1000) <= 1000) then
cocosolos marked this conversation as resolved.
Show resolved Hide resolved
SpawnMob(ID.mob.ZIPHIUS):updateClaim(player)
GetMobByID(ID.mob.ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
npc:setStatus(tpz.status.DISAPPEAR)
for i = 6, 11, 1 do
baited = bit.bor(baited, bit.lshift(1, i))
SetServerVariable("[Ziphius]Bait Trap", baited)
end
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
end
baited = bit.bor(baited, bit.lshift(1, 6))
SetServerVariable("[Ziphius]Bait Trap", baited)
npc:setLocalVar("[Ziphius]Bait Trap", 0)
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
end
end
end

function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid)
-- printf("RESULT: %u",option)

end

function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid)
-- printf("RESULT: %u",option)

end
38 changes: 14 additions & 24 deletions scripts/zones/Misareaux_Coast/npcs/qm3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,48 @@

require("scripts/globals/npc_util")
local ID = require("scripts/zones/Misareaux_Coast/IDs")
local ZIPHIUS_QM_BASE = 16879919
local ZIPHIUS = 16879900

function onTrade(player,npc,trade)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

-- Trade Slice of Carp
if (npcUtil.tradeHas(trade, 16994) and bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
baited = bit.bor(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE)))
player:tradeComplete()
if (npcUtil.tradeHas(trade, 16994) and baited == 0) then
npc:setLocalVar("[Ziphius]Bait Trap", 1)
player:confirmTrade()
player:messageSpecial(ID.text.PUT_IN_TRAP, 16994)
SetServerVariable("[Ziphius]Bait Trap", baited)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
end

function onTrigger(player,npc)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

if (VanadielHour() >= 22 or VanadielHour() < 4) then
if (bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
if (baited == 0) then
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
elseif (VanadielHour() >= 4 and VanadielHour() < 7) then
if (bit.band(baited, bit.lshift(1, 7)) == 0) then
if (baited == 1) then
if (math.random(1,1000) <= 176) then
SpawnMob(ZIPHIUS):updateClaim(player)
GetMobByID(ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
SpawnMob(ID.mob.ZIPHIUS):updateClaim(player)
GetMobByID(ID.mob.ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
npc:setStatus(tpz.status.DISAPPEAR)
for i = 6, 11, 1 do
baited = bit.bor(baited, bit.lshift(1, i))
SetServerVariable("[Ziphius]Bait Trap", baited)
end
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
end
baited = bit.bor(baited, bit.lshift(1, 7))
SetServerVariable("[Ziphius]Bait Trap", baited)
npc:setLocalVar("[Ziphius]Bait Trap", 0)
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
end
end
end

function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid)
-- printf("RESULT: %u",option)

end

function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid)
-- printf("RESULT: %u",option)

end
40 changes: 20 additions & 20 deletions scripts/zones/Misareaux_Coast/npcs/qm4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,48 @@

require("scripts/globals/npc_util")
local ID = require("scripts/zones/Misareaux_Coast/IDs")
local ZIPHIUS_QM_BASE = 16879919
local ZIPHIUS = 16879900

function onTrade(player,npc,trade)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

-- Trade Slice of Carp
if (npcUtil.tradeHas(trade, 16994) and bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
baited = bit.bor(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE)))
player:tradeComplete()
if (npcUtil.tradeHas(trade, 16994) and baited == 0) then
npc:setLocalVar("[Ziphius]Bait Trap", 1)
player:confirmTrade()
player:messageSpecial(ID.text.PUT_IN_TRAP, 16994)
SetServerVariable("[Ziphius]Bait Trap", baited)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
end

function onTrigger(player,npc)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

if (VanadielHour() >= 22 or VanadielHour() < 4) then
if (bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
if (baited == 0) then
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
elseif (VanadielHour() >= 4 and VanadielHour() < 7) then
if (bit.band(baited, bit.lshift(1, 8)) == 0) then
if (baited == 1) then
if (math.random(1,1000) <= 176) then
SpawnMob(ZIPHIUS):updateClaim(player)
GetMobByID(ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
SpawnMob(ID.mob.ZIPHIUS):updateClaim(player)
GetMobByID(ID.mob.ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
npc:setStatus(tpz.status.DISAPPEAR)
for i = 6, 11, 1 do
baited = bit.bor(baited, bit.lshift(1, i))
SetServerVariable("[Ziphius]Bait Trap", baited)
end
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
end
baited = bit.bor(baited, bit.lshift(1, 8))
SetServerVariable("[Ziphius]Bait Trap", baited)
npc:setLocalVar("[Ziphius]Bait Trap", 0)
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
end
end
end

function onEventUpdate(player,csid,option)

end

function onEventFinish(player,csid,option)

end
40 changes: 20 additions & 20 deletions scripts/zones/Misareaux_Coast/npcs/qm5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,48 @@

require("scripts/globals/npc_util")
local ID = require("scripts/zones/Misareaux_Coast/IDs")
local ZIPHIUS_QM_BASE = 16879919
local ZIPHIUS = 16879900

function onTrade(player,npc,trade)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

-- Trade Slice of Carp
if (npcUtil.tradeHas(trade, 16994) and bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
baited = bit.bor(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE)))
player:tradeComplete()
if (npcUtil.tradeHas(trade, 16994) and baited == 0) then
npc:setLocalVar("[Ziphius]Bait Trap", 1)
player:confirmTrade()
player:messageSpecial(ID.text.PUT_IN_TRAP, 16994)
SetServerVariable("[Ziphius]Bait Trap", baited)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
end

function onTrigger(player,npc)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

if (VanadielHour() >= 22 or VanadielHour() < 4) then
if (bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
if (baited == 0) then
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
elseif (VanadielHour() >= 4 and VanadielHour() < 7) then
if (bit.band(baited, bit.lshift(1, 9)) == 0) then
if (baited == 1) then
if (math.random(1,1000) <= 176) then
SpawnMob(ZIPHIUS):updateClaim(player)
GetMobByID(ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
SpawnMob(ID.mob.ZIPHIUS):updateClaim(player)
GetMobByID(ID.mob.ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
npc:setStatus(tpz.status.DISAPPEAR)
for i = 6, 11, 1 do
baited = bit.bor(baited, bit.lshift(1, i))
SetServerVariable("[Ziphius]Bait Trap", baited)
end
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
end
baited = bit.bor(baited, bit.lshift(1, 9))
SetServerVariable("[Ziphius]Bait Trap", baited)
npc:setLocalVar("[Ziphius]Bait Trap", 0)
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
end
end
end

function onEventUpdate(player,csid,option)

end

function onEventFinish(player,csid,option)

end
40 changes: 20 additions & 20 deletions scripts/zones/Misareaux_Coast/npcs/qm6.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,48 @@

require("scripts/globals/npc_util")
local ID = require("scripts/zones/Misareaux_Coast/IDs")
local ZIPHIUS_QM_BASE = 16879919
local ZIPHIUS = 16879900

function onTrade(player,npc,trade)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

-- Trade Slice of Carp
if (npcUtil.tradeHas(trade, 16994) and bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
baited = bit.bor(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE)))
player:tradeComplete()
if (npcUtil.tradeHas(trade, 16994) and baited == 0) then
npc:setLocalVar("[Ziphius]Bait Trap", 1)
player:confirmTrade()
player:messageSpecial(ID.text.PUT_IN_TRAP, 16994)
SetServerVariable("[Ziphius]Bait Trap", baited)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
end

function onTrigger(player,npc)
local baited = GetServerVariable("[Ziphius]Bait Trap")
local baited = npc:getLocalVar("[Ziphius]Bait Trap")

if (VanadielHour() >= 22 or VanadielHour() < 4) then
if (bit.band(baited, bit.lshift(1, (npc:getID() - ZIPHIUS_QM_BASE))) == 0) then
if (baited == 0) then
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
else
player:messageSpecial(ID.text.NOTHING_HERE_YET)
end
elseif (VanadielHour() >= 4 and VanadielHour() < 7) then
if (bit.band(baited, bit.lshift(1, 10)) == 0) then
if (baited == 1) then
if (math.random(1,1000) <= 176) then
SpawnMob(ZIPHIUS):updateClaim(player)
GetMobByID(ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
SpawnMob(ID.mob.ZIPHIUS):updateClaim(player)
GetMobByID(ID.mob.ZIPHIUS):setPos(npc:getXPos(),npc:getYPos(),npc:getZPos()-1)
npc:setStatus(tpz.status.DISAPPEAR)
for i = 6, 11, 1 do
baited = bit.bor(baited, bit.lshift(1, i))
SetServerVariable("[Ziphius]Bait Trap", baited)
end
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
end
baited = bit.bor(baited, bit.lshift(1, 10))
SetServerVariable("[Ziphius]Bait Trap", baited)
npc:setLocalVar("[Ziphius]Bait Trap", 0)
else
player:messageSpecial(ID.text.DID_NOT_CATCH_ANYTHING)
player:messageSpecial(ID.text.APPEARS_TO_BE_TRAP)
end
end
end

function onEventUpdate(player,csid,option)

end

function onEventFinish(player,csid,option)

end
Loading