Skip to content

Commit d04b0c1

Browse files
committed
[lua] [sql] ENM When Hell Freezes Over
[lua] [sql] ENM When Hell Freezes
1 parent 6a7b3f5 commit d04b0c1

7 files changed

Lines changed: 207 additions & 22 deletions

File tree

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
-----------------------------------
2+
-- When Hell Freezes Over
3+
-- Bearclaw Pinnacle ENM (Zephyr Fan)
4+
-- !addkeyitem ZEPHYR_FAN
5+
-----------------------------------
6+
local bearclawID = zones[xi.zone.BEARCLAW_PINNACLE]
7+
8+
local content = Battlefield:new({
9+
zoneId = xi.zone.BEARCLAW_PINNACLE,
10+
battlefieldId = xi.battlefield.id.WHEN_HELL_FREEZES_OVER,
11+
maxPlayers = 18,
12+
levelCap = 75,
13+
timeLimit = utils.minutes(15),
14+
index = 2,
15+
entryNpc = 'Wind_Pillar_3',
16+
exitNpc = 'Wind_Pillar_Exit',
17+
requiredKeyItems = { xi.ki.ZEPHYR_FAN, message = bearclawID.text.ZEPHYR_RIPS },
18+
grantXP = 3000,
19+
})
20+
21+
-- Spawning function for this battlefield. Spawns a wave of 1-3 Snow Devils of either all BLM or all WAR
22+
23+
local function spawnSnowDevils(battlefield)
24+
local base = bearclawID.mob.SNOW_DEVIL + (battlefield:getArea() - 1) * 8
25+
local offset = math.random(0, 1) * 3
26+
local count = math.random(0, 2)
27+
28+
for i = 0, count do
29+
local id = base + offset + i
30+
local mob = GetMobByID(id)
31+
32+
if mob then
33+
mob:spawn()
34+
local players = battlefield:getPlayers()
35+
local wave = battlefield:getLocalVar('wave')
36+
if wave >= 1 then
37+
for _, player in pairs(players) do
38+
if player:isAlive() then
39+
mob:updateEnmity(player)
40+
break
41+
end
42+
end
43+
end
44+
end
45+
end
46+
end
47+
48+
-- Defines the monsters contained within this battlefield and defines a custom win condition. (4 waves completed)
49+
-- We set all mobs spawned to false, and handle the wave spawning logic in onBattlefieldTick.
50+
-- Any logic for spawning monsters in waves should be handled outside of content.groups to avoid them passing through initialization.
51+
52+
content.groups = {
53+
{
54+
mobs = { 'Snow_Devil_war', 'Snow_Devil_blm' },
55+
spawned = false,
56+
57+
allDeath = function(battlefield, mob)
58+
local wave = battlefield:getLocalVar('wave') + 1
59+
if wave > 4 then
60+
content:handleAllMonstersDefeated(battlefield, mob)
61+
else
62+
battlefield:setLocalVar('wave', wave)
63+
battlefield:setLocalVar('nextWaveDelay', GetSystemTime() + 5)
64+
end
65+
end,
66+
},
67+
}
68+
69+
-- Handles wave spawning and delays
70+
-- We call back Battlefield.onBattlefieldTick(self, battlefield, tick) to preserve the base functionality. (Many things will break without doing this)
71+
72+
function content:onBattlefieldTick(battlefield, tick)
73+
Battlefield.onBattlefieldTick(self, battlefield, tick)
74+
75+
local now = GetSystemTime()
76+
local wave = battlefield:getLocalVar('wave')
77+
local delay = battlefield:getLocalVar('nextWaveDelay')
78+
79+
-- Initial wave spawn
80+
if wave == 0 then
81+
spawnSnowDevils(battlefield)
82+
battlefield:setLocalVar('wave', 1)
83+
battlefield:setLocalVar('nextWaveDelay', 0)
84+
return
85+
end
86+
87+
-- Spawns next wave after a 20 second delay
88+
if delay > 0 and now >= delay then
89+
battlefield:setLocalVar('nextWaveDelay', 0)
90+
spawnSnowDevils(battlefield)
91+
end
92+
end
93+
94+
content.loot = {
95+
{
96+
{ itemId = xi.item.NONE, weight = 950 },
97+
{ itemId = xi.item.CLOUD_EVOKER, weight = 50 },
98+
},
99+
100+
{
101+
{ itemId = xi.item.NONE, weight = 250 },
102+
{ itemId = xi.item.SQUARE_OF_GALATEIA, weight = 350 },
103+
{ itemId = xi.item.SQUARE_OF_KEJUSU_SATIN, weight = 200 },
104+
{ itemId = xi.item.POT_OF_VIRIDIAN_URUSHI, weight = 200 },
105+
},
106+
107+
{
108+
quantity = 2,
109+
{ itemId = xi.item.NONE, weight = 250 },
110+
{ itemId = xi.item.MARTIAL_GUN, weight = 125 },
111+
{ itemId = xi.item.MARTIAL_BHUJ, weight = 125 },
112+
{ itemId = xi.item.MARTIAL_STAFF, weight = 125 },
113+
{ itemId = xi.item.HEXEREI_CAPE, weight = 125 },
114+
{ itemId = xi.item.SETTLERS_CAPE, weight = 125 },
115+
{ itemId = xi.item.SCROLL_OF_RAISE_III, weight = 125 },
116+
},
117+
}
118+
119+
return content:register()

scripts/zones/Bearclaw_Pinnacle/IDs.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ zones[xi.zone.BEARCLAW_PINNACLE] =
3434
},
3535
mob =
3636
{
37+
SNOW_DEVIL = GetFirstID('Snow_Devil_war'),
3738
SNOLL_TZAR_OFFSET = GetFirstID('Snoll_Tzar'),
3839
},
3940
npc =
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
-----------------------------------
2+
-- Area: Bearclaw Pinnacle
3+
-- Mob: Snow Devil (BLM)
4+
-- ENM: When Hell Freezes Over
5+
-----------------------------------
6+
local bearclawID = zones[xi.zone.BEARCLAW_PINNACLE]
7+
8+
---@type TMobEntity
9+
local entity = {}
10+
11+
entity.onMobInitialize = function(mob)
12+
mob:addImmunity(xi.immunity.PARALYZE)
13+
mob:setMobMod(xi.mobMod.MAGIC_COOL, 30)
14+
end
15+
16+
entity.onMobSpawn = function(mob)
17+
mob:setMobMod(xi.mobMod.SIGHT_RANGE, 60)
18+
mob:setMobMod(xi.mobMod.SOUND_RANGE, 60)
19+
mob:setMobMod(xi.mobMod.NO_STANDBACK, 1)
20+
mob:setMod(xi.mod.REGAIN, 50)
21+
mob:setMod(xi.mod.DESPAWN_TIME_REDUCTION, 15)
22+
end
23+
24+
entity.onMobMagicPrepare = function(mob, target, spellId)
25+
local spellList =
26+
{
27+
xi.magic.spell.ICE_THRENODY,
28+
xi.magic.spell.BLIZZARD_IV,
29+
xi.magic.spell.BLIZZAGA_III,
30+
}
31+
return spellList[math.random(1, #spellList)]
32+
end
33+
34+
entity.onMobDeath = function(mob, player, optParams)
35+
end
36+
37+
return entity
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-----------------------------------
2+
-- Area: Bearclaw Pinnacle
3+
-- Mob: Snow Devil (WAR)
4+
-- ENM: When Hell Freezes Over
5+
-----------------------------------
6+
mixins = { require('scripts/mixins/job_special') }
7+
-----------------------------------
8+
local bearclawID = zones[xi.zone.BEARCLAW_PINNACLE]
9+
10+
---@type TMobEntity
11+
local entity = {}
12+
13+
entity.onMobInitialize = function(mob)
14+
mob:addImmunity(xi.immunity.PARALYZE)
15+
end
16+
17+
entity.onMobSpawn = function(mob)
18+
mob:setMobMod(xi.mobMod.SIGHT_RANGE, 60)
19+
mob:setMobMod(xi.mobMod.SOUND_RANGE, 60)
20+
mob:setMod(xi.mod.DESPAWN_TIME_REDUCTION, 15)
21+
mob:setMod(xi.mod.REGAIN, 50)
22+
end
23+
24+
return entity

sql/mob_groups.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ INSERT INTO `mob_groups` VALUES (55,6812,5,'Little_Wingman',0,128,0,0,0,0,0,0);
270270
INSERT INTO `mob_groups` VALUES (1,3684,6,'Snoll_Tzar',0,128,0,7000,0,65,66,0);
271271
INSERT INTO `mob_groups` VALUES (2,384,6,'Bearclaw_Rabbit',0,128,0,0,0,75,75,0);
272272
INSERT INTO `mob_groups` VALUES (3,383,6,'Bearclaw_Leveret',0,128,0,0,0,75,75,0);
273-
INSERT INTO `mob_groups` VALUES (4,3687,6,'Snow_Devil',0,128,0,0,0,75,75,0);
273+
INSERT INTO `mob_groups` VALUES (4,7100,6,'Snow_Devil_war',0,128,0,2000,0,78,78,0);
274+
INSERT INTO `mob_groups` VALUES (9,7099,6,'Snow_Devil_blm',0,128,0,2000,4000,78,78,0);
274275
INSERT INTO `mob_groups` VALUES (5,1190,6,'Eldertaur',0,128,0,4500,0,75,75,0);
275276
INSERT INTO `mob_groups` VALUES (6,2668,6,'Mindertaur',0,128,0,4500,0,75,75,0);
276277
INSERT INTO `mob_groups` VALUES (7,196,6,'Apis',0,128,0,13000,0,81,81,0);

sql/mob_pools.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ CREATE TABLE `mob_pools` (
4646
PRIMARY KEY (`poolid`)
4747
) ENGINE=Aria TRANSACTIONAL=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COLLATE=utf8mb4_general_ci;
4848
/*!40101 SET character_set_client = @saved_cs_client */;
49-
5049
--
5150
-- Dumping data for table `mob_pools`
5251
--
@@ -3741,7 +3740,7 @@ INSERT INTO `mob_pools` VALUES (3683,'Snoll','Snoll',232,0x000016010000000000000
37413740
INSERT INTO `mob_pools` VALUES (3684,'Snoll_Tzar','Snoll_Tzar',232,0x00001B0100000000000000000000000000000000,1,1,7,240,100,0,1,1,0,18,6144,0,639,135,0,0,0,0,0,1164,232);
37423741
INSERT INTO `mob_pools` VALUES (3685,'Snowball','Snowball',232,0x0000160100000000000000000000000000000000,1,1,7,240,100,0,1,0,0,0,0,0,237,643,0,0,0,0,0,232,232);
37433742
INSERT INTO `mob_pools` VALUES (3686,'Snowflake','Snowflake',232,0x0000160100000000000000000000000000000000,1,1,11,240,100,0,1,0,0,0,0,0,0,131,8,0,0,0,0,232,232);
3744-
INSERT INTO `mob_pools` VALUES (3687,'Snow_Devil','Snow_Devil',232,0x0000160100000000000000000000000000000000,1,4,7,240,100,0,1,1,1,16,0,0,1309,133,0,0,0,0,0,232,232);
3743+
37453744
INSERT INTO `mob_pools` VALUES (3688,'Snow_Gigas','Snow_Gigas',126,0x0000C50200000000000000000000000000000000,2,2,1,480,100,0,1,0,1,0,0,0,4143,131,0,0,0,0,0,126,126);
37463745
INSERT INTO `mob_pools` VALUES (3689,'Snow_Lizard','Snow_Lizard',97,0x0000490100000000000000000000000000000000,1,1,7,240,100,0,0,0,1,0,0,0,239,131,0,0,0,0,0,97,97);
37473746
INSERT INTO `mob_pools` VALUES (3690,'Snow_Maiden','Snow_Maiden',232,0x0000160100000000000000000000000000000000,1,1,7,240,100,0,1,0,0,2,0,0,0,645,0,0,0,0,0,232,232);
@@ -7185,7 +7184,11 @@ INSERT INTO `mob_pools` VALUES (7096,'Awzdei_Left','Awzdei',272,0x00008504000000
71857184
INSERT INTO `mob_pools` VALUES (7097,'Awzdei_Fast','Awzdei',272,0x0000850400000000000000000000000000000000,7,7,7,240,100,0,1,1,0,0,0,0,0,1155,4,0,0,0,0,272,272);
71867185
INSERT INTO `mob_pools` VALUES (7098,'Awzdei_LeftFast','Awzdei',272,0x0000850400000000000000000000000000000000,7,7,7,240,100,0,1,1,0,0,0,0,0,1155,4,0,0,0,0,272,272);
71877186

7188-
-- Unused 7095
7187+
-- When Hell Freezes Over (BLM)
7188+
INSERT INTO `mob_pools` VALUES (7099,'Snow_Devil_blm','Snow_Devil',232,0x0000160100000000000000000000000000000000,4,10,7,240,100,0,1,1,1,16,0,0,1309,133,0,0,2,0,0,232,232);
7189+
INSERT INTO `mob_pools` VALUES (7100,'Snow_Devil_war','Snow_Devil',232,0x0000160100000000000000000000000000000000,1,1,7,240,100,0,1,1,1,16,0,0,1309,133,0,0,0,0,0,232,232);
7190+
7191+
-- 1 Unused space at 3687 or fresh blocks at 7101.
71897192

71907193
-- Jug pet pools (skipped to allow keeping them sequential)
71917194
INSERT INTO `mob_pools` VALUES (7500,'Pet_Sweet_Caroline','Pet_Sweet_Caroline',178,0x00008E0B00000000000000000000000000000000,2,2,1,480,100,0,0,0,0,8,0,32,605,129,0,0,0,0,0,766,178);

sql/mob_spawn_points.sql

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,24 +1198,24 @@ INSERT INTO `mob_spawn_points` VALUES (16801814,0,'Bearclaw_Leveret','Bearclaw L
11981198
INSERT INTO `mob_spawn_points` VALUES (16801815,0,'Bearclaw_Leveret','Bearclaw Leveret',3,-620.835,-0.322,164.710,200);
11991199

12001200
-- When Hell Freezes Over
1201-
INSERT INTO `mob_spawn_points` VALUES (16801818,0,'Snow_Devil','Snow Devil',4,-462.692,0.250,880.938,91);
1202-
INSERT INTO `mob_spawn_points` VALUES (16801819,0,'Snow_Devil','Snow Devil',4,-453.162,-0.507,830.879,28);
1203-
INSERT INTO `mob_spawn_points` VALUES (16801820,0,'Snow_Devil','Snow Devil',4,-435.474,-0.752,834.031,249);
1204-
INSERT INTO `mob_spawn_points` VALUES (16801821,0,'Snow_Devil','Snow Devil',4,-460.852,0.250,882.456,141);
1205-
INSERT INTO `mob_spawn_points` VALUES (16801822,0,'Snow_Devil','Snow Devil',4,-463.816,0.265,887.357,231);
1206-
INSERT INTO `mob_spawn_points` VALUES (16801823,0,'Snow_Devil','Snow Devil',4,-475.098,0.178,891.279,74);
1207-
INSERT INTO `mob_spawn_points` VALUES (16801826,0,'Snow_Devil','Snow Devil',4,-221.810,0.022,476.879,91);
1208-
INSERT INTO `mob_spawn_points` VALUES (16801827,0,'Snow_Devil','Snow Devil',4,-216.136,-0.276,433.651,28);
1209-
INSERT INTO `mob_spawn_points` VALUES (16801828,0,'Snow_Devil','Snow Devil',4,-214.199,-0.365,432.397,249);
1210-
INSERT INTO `mob_spawn_points` VALUES (16801829,0,'Snow_Devil','Snow Devil',4,-219.970,0.022,478.397,141);
1211-
INSERT INTO `mob_spawn_points` VALUES (16801830,0,'Snow_Devil','Snow Devil',4,-218.011,-0.086,472.772,231);
1212-
INSERT INTO `mob_spawn_points` VALUES (16801831,0,'Snow_Devil','Snow Devil',4,-234.216,-0.050,487.220,74);
1213-
INSERT INTO `mob_spawn_points` VALUES (16801834,0,'Snow_Devil','Snow Devil',4,-622.142,0.001,197.206,91);
1214-
INSERT INTO `mob_spawn_points` VALUES (16801835,0,'Snow_Devil','Snow Devil',4,-612.612,-0.756,147.147,28);
1215-
INSERT INTO `mob_spawn_points` VALUES (16801836,0,'Snow_Devil','Snow Devil',4,-594.924,-1.001,150.299,249);
1216-
INSERT INTO `mob_spawn_points` VALUES (16801837,0,'Snow_Devil','Snow Devil',4,-620.302,0.001,198.724,141);
1217-
INSERT INTO `mob_spawn_points` VALUES (16801838,0,'Snow_Devil','Snow Devil',4,-623.266,0.016,203.625,231);
1218-
INSERT INTO `mob_spawn_points` VALUES (16801839,0,'Snow_Devil','Snow Devil',4,-634.548,-0.071,207.547,74);
1201+
INSERT INTO `mob_spawn_points` VALUES (16801818,0,'Snow_Devil_war','Snow Devil',4,-465.000,0.000,903.000,64);
1202+
INSERT INTO `mob_spawn_points` VALUES (16801819,0,'Snow_Devil_war','Snow Devil',4,-460.000,0.000,903.000,64);
1203+
INSERT INTO `mob_spawn_points` VALUES (16801820,0,'Snow_Devil_war','Snow Devil',4,-455.000,0.000,903.000,64);
1204+
INSERT INTO `mob_spawn_points` VALUES (16801821,0,'Snow_Devil_blm','Snow Devil',9,-465.000,0.000,903.000,64);
1205+
INSERT INTO `mob_spawn_points` VALUES (16801822,0,'Snow_Devil_blm','Snow Devil',9,-460.000,0.000,903.000,64);
1206+
INSERT INTO `mob_spawn_points` VALUES (16801823,0,'Snow_Devil_blm','Snow Devil',9,-455.000,0.000,903.000,64);
1207+
INSERT INTO `mob_spawn_points` VALUES (16801826,0,'Snow_Devil_war','Snow Devil',4,-226.000,0.000,498.000,64);
1208+
INSERT INTO `mob_spawn_points` VALUES (16801827,0,'Snow_Devil_war','Snow Devil',4,-221.000,0.000,498.000,64);
1209+
INSERT INTO `mob_spawn_points` VALUES (16801828,0,'Snow_Devil_war','Snow Devil',4,-216.000,0.000,498.000,64);
1210+
INSERT INTO `mob_spawn_points` VALUES (16801829,0,'Snow_Devil_blm','Snow Devil',9,-226.000,0.000,498.000,64);
1211+
INSERT INTO `mob_spawn_points` VALUES (16801830,0,'Snow_Devil_blm','Snow Devil',9,-221.000,0.000,498.000,64);
1212+
INSERT INTO `mob_spawn_points` VALUES (16801831,0,'Snow_Devil_blm','Snow Devil',9,-216.000,0.000,498.000,64);
1213+
INSERT INTO `mob_spawn_points` VALUES (16801834,0,'Snow_Devil_war','Snow Devil',4,-625.000,0.000,219.000,64);
1214+
INSERT INTO `mob_spawn_points` VALUES (16801835,0,'Snow_Devil_war','Snow Devil',4,-620.000,0.000,219.000,64);
1215+
INSERT INTO `mob_spawn_points` VALUES (16801836,0,'Snow_Devil_war','Snow Devil',4,-615.000,0.000,219.000,64);
1216+
INSERT INTO `mob_spawn_points` VALUES (16801837,0,'Snow_Devil_blm','Snow Devil',9,-625.000,0.000,219.000,64);
1217+
INSERT INTO `mob_spawn_points` VALUES (16801838,0,'Snow_Devil_blm','Snow Devil',9,-620.000,0.000,219.000,64);
1218+
INSERT INTO `mob_spawn_points` VALUES (16801839,0,'Snow_Devil_blm','Snow Devil',9,-615.000,0.000,219.000,64);
12191219

12201220
-- Brothers
12211221
INSERT INTO `mob_spawn_points` VALUES (16801841,0,'Eldertaur','Eldertaur',5,-464.000,0.602,902.000,64);

0 commit comments

Comments
 (0)