Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion scripts/zones/Halvung/IDs.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-----------------------------------
zones = zones or {}
Expand All @@ -19,6 +19,8 @@ zones[xi.zone.HALVUNG] =
KEY_BREAKS = 7379, -- The <item> breaks!
PARTY_MEMBERS_HAVE_FALLEN = 7803, -- All party members have fallen in battle. Now leaving the battlefield.
THE_PARTY_WILL_BE_REMOVED = 7810, -- If all party members' HP are still zero after # minute[/s], the party will be removed from the battlefield.
BEGINS_PUSHING_THE_LEVER = 7928, -- <player> begins pushing the lever!
RELEASES_THE_LEVER = 7931, -- <player> releases the lever.
WIDE_TRENCH = 7934, -- There is a wide trench around the gate here. There are three keyholes of differing sizes inside the trench.
MINING_IS_POSSIBLE_HERE = 7957, -- Mining is possible here if you have <item>.
BLUE_FLAMES = 8004, -- You can see blue flames flickering from a hole in the ground here...
Expand Down
45 changes: 45 additions & 0 deletions scripts/zones/Halvung/globals.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-----------------------------------
-- Zone: Halvung (62)
-- Desc: this file contains functions that are shared by multiple luas in this zone's directory
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
-----------------------------------

local halvungGlobal = {}

halvungGlobal.playersRequiredPerDoor =
{
[ID.npc.LEVER_AB_DOOR] = 6,
[ID.npc.LEVER_CD_DOOR] = 6,
[ID.npc.LEVER_EF_DOOR] = 6,
[ID.npc.LEVER_GH_DOOR] = 6,
[ID.npc.LEVER_IJ_DOOR] = 6,
}

-- used for when a player triggers an Operating Lever
halvungGlobal.operatingLeverOnTrigger = function(player, npc, doorNpcId)
-- Check if door is open first
-- Cap what happens when door is open
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(doorNpcId):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
npc:messageName(ID.text.BEGINS_PUSHING_THE_LEVER, player)
player:startEvent(100)
-- if both levers work together - set this on the Door
npc:setLocalVar('playerCount', npc:getLocalVar('playerCount') + 1)
end
end

-- used for when an Operating Lever event completes
halvungGlobal.operatingLeverOnEventFinish = function(player, csid, option, npc, doorNpcId)
-- How does this work for multiple events firing at once?
if npc:getLocalVar('playerCount') > halvungGlobal.playersRequiredPerDoor[doorNpcId] then
GetNPCByID(doorNpcId):openDoor(30)
end

npc:messageName(ID.text.RELEASES_THE_LEVER, player)
npc:setLocalVar('playerCount', npc:getLocalVar('playerCount') - 1)
end

return halvungGlobal
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_A.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever A
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_AB_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_AB_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_AB_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_B.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever B
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_AB_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_AB_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_AB_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_C.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever C
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_CD_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_CD_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_CD_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_D.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever D
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_CD_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_CD_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_CD_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_E.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever E
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_EF_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_EF_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_EF_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_F.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever F
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_EF_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_EF_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_EF_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_G.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever G
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_GH_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_GH_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_GH_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_H.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever H
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_GH_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_GH_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_GH_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_I.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever I
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_IJ_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_IJ_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_IJ_DOOR)
end

return entity
14 changes: 7 additions & 7 deletions scripts/zones/Halvung/npcs/Operating_Lever_J.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-----------------------------------
-----------------------------------
-- Area: Halvung
-- NPC: Operating Lever J
-- TODO: more than 5/6 people still need verification as no sites show this requirment?
-----------------------------------
local ID = zones[xi.zone.HALVUNG]
local halvungGlobal = require('scripts/zones/Halvung/globals')
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:hasKeyItem(xi.ki.BRACELET_OF_VERVE) then
GetNPCByID(ID.npc.LEVER_IJ_DOOR):openDoor(30)
player:messageSpecial(ID.text.LIFT_LEVER)
else
player:startEvent(100)
end
halvungGlobal.operatingLeverOnTrigger(player, npc, ID.npc.LEVER_IJ_DOOR)
end

entity.onEventFinish = function(player, csid, option, npc)
halvungGlobal.operatingLeverOnEventFinish(player, csid, option, npc, ID.npc.LEVER_IJ_DOOR)
end

return entity
Loading