Skip to content

Commit 9fb5aeb

Browse files
committed
Use GetFirstID() method for Nyzul npcs
1 parent c6779d7 commit 9fb5aeb

File tree

7 files changed

+79
-86
lines changed

7 files changed

+79
-86
lines changed

scripts/globals/nyzul.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ xi.nyzul.handleAppraisalItem = function(player, npc)
248248
local instance = npc:getInstance()
249249
local chars = instance:getChars()
250250

251-
for _, cofferID in ipairs(ID.npc.TREASURE_COFFER) do
251+
for cofferID = ID.npc.TREASURE_COFFER_OFFSET, ID.npc.TREASURE_COFFER_OFFSET + 2 do
252252
if npc:getID() == cofferID and npc:getLocalVar('opened') == 0 then
253253
-- Appraisal Items
254254
local mobOffset = npc:getLocalVar('appraisalItem') - (ID.mob.NM_OFFSET - xi.appraisal.origin.NYZUL_BAT_EYE) -- Bat Eye mobId - Appraisal mob value.
@@ -433,7 +433,7 @@ xi.nyzul.tempBoxFinish = function(player, csid, option, npc)
433433
end
434434

435435
xi.nyzul.clearChests = function(instance)
436-
for _, cofferID in ipairs(ID.npc.TREASURE_COFFER) do
436+
for cofferID = ID.npc.TREASURE_COFFER_OFFSET, ID.npc.TREASURE_COFFER_OFFSET + 2 do
437437
local coffer = GetNPCByID(cofferID, instance)
438438

439439
if coffer and coffer:getStatus() ~= xi.status.DISAPPEAR then
@@ -444,7 +444,7 @@ xi.nyzul.clearChests = function(instance)
444444
end
445445

446446
if xi.settings.main.ENABLE_NYZUL_CASKETS then
447-
for _, casketID in ipairs(ID.npc.TREASURE_CASKET) do
447+
for casketID = ID.npc.TREASURE_CASKET_OFFSET, ID.npc.TREASURE_CASKET_OFFSET + 3 do
448448
local casket = GetNPCByID(casketID, instance)
449449

450450
if casket and casket:getStatus() ~= xi.status.DISAPPEAR then
@@ -566,7 +566,7 @@ xi.nyzul.eliminateAllKill = function(mob)
566566
end
567567

568568
xi.nyzul.activateRuneOfTransfer = function(instance)
569-
for _, runeID in pairs(ID.npc.RUNE_OF_TRANSFER) do
569+
for runeID = ID.npc.RUNE_OF_TRANSFER_OFFSET, ID.npc.RUNE_OF_TRANSFER_OFFSET + 1 do
570570
if GetNPCByID(runeID, instance):getStatus() == xi.status.NORMAL then
571571
GetNPCByID(runeID, instance):setAnimationSub(1)
572572

@@ -613,7 +613,7 @@ xi.nyzul.spawnChest = function(mob, player)
613613
then
614614
xi.nyzul.vigilWeaponDrop(player, mob)
615615

616-
for _, cofferID in ipairs(ID.npc.TREASURE_COFFER) do
616+
for cofferID = ID.npc.TREASURE_COFFER_OFFSET, ID.npc.TREASURE_COFFER_OFFSET + 2 do
617617
local coffer = GetNPCByID(cofferID, instance)
618618

619619
if coffer and coffer:getStatus() == xi.status.DISAPPEAR then
@@ -633,7 +633,7 @@ xi.nyzul.spawnChest = function(mob, player)
633633
xi.settings.main.ENABLE_NYZUL_CASKETS
634634
then
635635
if math.random(1, 100) <= 6 then
636-
for _, casketID in ipairs(ID.npc.TREASURE_CASKET) do
636+
for casketID = ID.npc.TREASURE_CASKET_OFFSET, ID.npc.TREASURE_CASKET_OFFSET + 3 do
637637
local casket = GetNPCByID(casketID, instance)
638638

639639
if casket and casket:getStatus() == xi.status.DISAPPEAR then

scripts/zones/Nyzul_Isle/IDs.lua

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -156,40 +156,30 @@ zones[xi.zone.NYZUL_ISLE] =
156156

157157
npc =
158158
{
159-
TREASURE_COFFER =
160-
{
161-
17092611, 17092612, 17092614
162-
},
163-
164-
TREASURE_CASKET =
165-
{
166-
17092609, 17092610, 17092613, 17092620
167-
},
168-
169-
RUNE_OF_TRANSFER =
170-
{
171-
17093330, 17093331
172-
},
173-
174159
-- Nyzul Isle Investigation
175-
DOOR_OFFSET = GetFirstID('_253'),
176-
RUNE_TRANSFER_START = GetFirstID('Rune_of_Transfer_Start'),
177-
RUNIC_LAMP_OFFSET = GetFirstID('Runic_Lamp'),
178-
VENDING_BOX = GetFirstID('Vending_Box'),
160+
DOOR_OFFSET = GetFirstID('_253'),
161+
RUNE_OF_TRANSFER_OFFSET = GetFirstID('Rune_of_Transfer'),
162+
RUNE_OF_TRANSFER_ENTRANCE = GetFirstID('Rune_of_Transfer_Start'),
163+
RUNIC_LAMP_OFFSET = GetFirstID('Runic_Lamp'),
164+
TREASURE_CASKET_OFFSET = GetFirstID('Armoury_Crate_Casket'),
165+
TREASURE_COFFER_OFFSET = GetFirstID('Armoury_Crate_Coffer'),
166+
VENDING_BOX = GetFirstID('Vending_Box'),
179167

180168
-- Other instances
181-
WEATHER = 17093424,
182-
QM1 = 17093473,
183-
BLANK1 = 17093474,
184-
BLANK2 = 17093475,
185-
BLANK3 = 17093476,
186-
NASHMEIRA1 = 17093477,
187-
NASHMEIRA2 = 17093478,
188-
RAZFAHD = 17093479,
189-
CSNPC1 = 17093480,
190-
GHATSAD = 17093481,
191-
ALEXANDER = 17093482,
192-
CSNPC2 = 17093483,
169+
WEATHER = GetFirstID('_k5y'), -- Unused?
170+
171+
-- This NPCs aren't even enabled in the sql (pos 0, 0, 0). Leaving them here for now.
172+
-- QM1 = GetFirstID('17093473'),
173+
-- BLANK1 = GetFirstID('17093474'),
174+
-- BLANK2 = GetFirstID('17093475'),
175+
-- BLANK3 = GetFirstID('17093476'),
176+
-- NASHMEIRA1 = GetFirstID('17093477'),
177+
-- NASHMEIRA2 = GetFirstID('17093478'),
178+
-- RAZFAHD = GetFirstID('17093479'),
179+
-- CSNPC1 = GetFirstID('17093480'),
180+
-- GHATSAD = GetFirstID('17093481'),
181+
-- ALEXANDER = GetFirstID('17093482'),
182+
-- CSNPC2 = GetFirstID('17093483'),
193183
}
194184
}
195185

scripts/zones/Nyzul_Isle/instances/nyzul_isle_investigation.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ local function pickSetPoint(instance)
2323
instance:setStage(xi.nyzul.objective.FREE_FLOOR)
2424
instance:setLocalVar('freeFloor', 1)
2525

26-
GetNPCByID(ID.npc.RUNE_TRANSFER_START, instance):timer(9000,
26+
GetNPCByID(ID.npc.RUNE_OF_TRANSFER_ENTRANCE, instance):timer(9000,
2727
function(m)
2828
local currentInstance = m:getInstance()
2929
currentInstance:setProgress(15)
@@ -54,7 +54,7 @@ local function pickSetPoint(instance)
5454
local posX = layoutPoint[1] local posY = layoutPoint[2] local posZ = layoutPoint[3]
5555

5656
-- Set Rune of Transfer to Point
57-
for _, npcID in pairs(ID.npc.RUNE_OF_TRANSFER) do
57+
for npcID = ID.npc.RUNE_OF_TRANSFER_OFFSET, ID.npc.RUNE_OF_TRANSFER_OFFSET + 1 do
5858
local runeOfTransfer = GetNPCByID(npcID, instance)
5959

6060
if

scripts/zones/Nyzul_Isle/npcs/Armoury_Crate.lua

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-----------------------------------
2+
-- Area: Nyzul_Isle
3+
-----------------------------------
4+
---@type TNpcEntity
5+
local entity = {}
6+
7+
entity.onTrigger = function(player, npc)
8+
xi.nyzul.tempBoxTrigger(player, npc)
9+
end
10+
11+
entity.onEventFinish = function(player, csid, option, npc)
12+
xi.nyzul.tempBoxFinish(player, csid, option, npc)
13+
end
14+
15+
return entity
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-----------------------------------
2+
-- Area: Nyzul_Isle
3+
-----------------------------------
4+
---@type TNpcEntity
5+
local entity = {}
6+
7+
entity.onTrigger = function(player, npc)
8+
xi.nyzul.handleAppraisalItem(player, npc)
9+
end
10+
11+
entity.onEventFinish = function(player, csid, option, npc)
12+
xi.nyzul.tempBoxFinish(player, csid, option, npc)
13+
end
14+
15+
return entity

sql/npc_list.sql

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7586,26 +7586,26 @@ INSERT INTO `npc_list` VALUES (17089422,'NPC[389]','',0,339.998,11.998,-166.498,
75867586
-- Nyzul Isle (Zone 77)
75877587
-- ------------------------------------------------------------
75887588

7589-
INSERT INTO `npc_list` VALUES (17092609,'Armoury_Crate','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C60300000000000000000000000000000000,0,'TOAU',1);
7590-
INSERT INTO `npc_list` VALUES (17092610,'Armoury_Crate','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C60300000000000000000000000000000000,0,'TOAU',1);
7591-
INSERT INTO `npc_list` VALUES (17092611,'Armoury_Crate','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C50300000000000000000000000000000000,0,'TOAU',1);
7592-
INSERT INTO `npc_list` VALUES (17092612,'Armoury_Crate','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C50300000000000000000000000000000000,0,'TOAU',1);
7593-
INSERT INTO `npc_list` VALUES (17092613,'Armoury_Crate','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C60300000000000000000000000000000000,0,'TOAU',1);
7594-
INSERT INTO `npc_list` VALUES (17092614,'Armoury_Crate','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C50300000000000000000000000000000000,0,'TOAU',1);
7595-
INSERT INTO `npc_list` VALUES (17092615,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7596-
INSERT INTO `npc_list` VALUES (17092616,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7597-
INSERT INTO `npc_list` VALUES (17092617,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7598-
INSERT INTO `npc_list` VALUES (17092618,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7599-
INSERT INTO `npc_list` VALUES (17092619,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7600-
INSERT INTO `npc_list` VALUES (17092620,'Armoury_Crate','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C60300000000000000000000000000000000,0,'TOAU',1);
7601-
INSERT INTO `npc_list` VALUES (17092621,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7602-
INSERT INTO `npc_list` VALUES (17092622,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7603-
INSERT INTO `npc_list` VALUES (17092623,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7604-
INSERT INTO `npc_list` VALUES (17092624,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7605-
INSERT INTO `npc_list` VALUES (17092625,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7606-
INSERT INTO `npc_list` VALUES (17092626,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7607-
INSERT INTO `npc_list` VALUES (17092627,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7608-
INSERT INTO `npc_list` VALUES (17092628,'Armoury_Crate','Armoury Crate',0,0.000,0.000,0.000,0,40,40,0,0,0,6,3,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7589+
INSERT INTO `npc_list` VALUES (17092609,'Armoury_Crate_Casket','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C60300000000000000000000000000000000,0,'TOAU',1);
7590+
INSERT INTO `npc_list` VALUES (17092610,'Armoury_Crate_Casket','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C60300000000000000000000000000000000,0,'TOAU',1);
7591+
INSERT INTO `npc_list` VALUES (17092611,'Armoury_Crate_Casket','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C60300000000000000000000000000000000,0,'TOAU',1);
7592+
INSERT INTO `npc_list` VALUES (17092612,'Armoury_Crate_Casket','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C60300000000000000000000000000000000,0,'TOAU',1);
7593+
INSERT INTO `npc_list` VALUES (17092613,'Armoury_Crate_Coffer','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C50300000000000000000000000000000000,0,'TOAU',1);
7594+
INSERT INTO `npc_list` VALUES (17092614,'Armoury_Crate_Coffer','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C50300000000000000000000000000000000,0,'TOAU',1);
7595+
INSERT INTO `npc_list` VALUES (17092615,'Armoury_Crate_Coffer','Armoury Crate',0,1.000,1.000,1.000,7,50,50,0,0,4,0,1155,0x0000C50300000000000000000000000000000000,0,'TOAU',1);
7596+
INSERT INTO `npc_list` VALUES (17092616,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7597+
INSERT INTO `npc_list` VALUES (17092617,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7598+
INSERT INTO `npc_list` VALUES (17092618,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7599+
INSERT INTO `npc_list` VALUES (17092619,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7600+
INSERT INTO `npc_list` VALUES (17092620,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7601+
INSERT INTO `npc_list` VALUES (17092621,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7602+
INSERT INTO `npc_list` VALUES (17092622,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7603+
INSERT INTO `npc_list` VALUES (17092623,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7604+
INSERT INTO `npc_list` VALUES (17092624,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7605+
INSERT INTO `npc_list` VALUES (17092625,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7606+
INSERT INTO `npc_list` VALUES (17092626,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7607+
INSERT INTO `npc_list` VALUES (17092627,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
7608+
INSERT INTO `npc_list` VALUES (17092628,'Armoury_Crate_Unused','Armoury Crate',0,0.000,0.000,0.000,7,50,50,0,0,4,0,1155,0x0000320000000000000000000000000000000000,0,'TOAU',1);
76097609
-- 17092629-17093131: Nyzul Isle Mobs
76107610
-- 17093134-17093151: TOAU BCNM Mobs
76117611
-- 17093152-17093317: Heroine's Holdfast Mobs + Area Bosses (Princesses)

0 commit comments

Comments
 (0)