Skip to content

Commit e952955

Browse files
committed
make work with LSB
1 parent 56e9d31 commit e952955

File tree

14 files changed

+93
-130
lines changed

14 files changed

+93
-130
lines changed

Diff for: scripts/globals/dark_rider.lua

+52-59
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
1-
require('scripts/globals/zone')
2-
require('scripts/globals/keyitems')
3-
require('scripts/globals/npc_util')
1+
-----------------------------------
2+
-- Warhorse Hoofprint global file
3+
-----------------------------------
44

5-
darkRider = {}
6-
darkRider.MAX_HOOFPRINTS_PER_DAY = 2
5+
-----------------------------------
6+
local bhaflauID = zones[xi.zone.BHAFLAU_THICKETS]
7+
local caedarvaID = zones[xi.zone.CAEDARVA_MIRE]
8+
local mountID = zones[xi.zone.MOUNT_ZHAYOLM]
9+
local wajaomID = zones[xi.zone.WAJAOM_WOODLANDS]
10+
-----------------------------------
11+
12+
xi = xi or {}
13+
xi.darkRider = {}
14+
xi.darkRider.MAX_HOOFPRINTS_PER_DAY = 2
715

816
local hoofprintIds = {
9-
[dsp.zone.WAJAOM_WOODLANDS] = {
10-
16986599,
11-
16986600,
12-
16986601,
17+
[xi.zone.WAJAOM_WOODLANDS] = {
18+
wajaomID.npc.HOOFPRINT,
19+
wajaomID.npc.HOOFPRINT + 1,
20+
wajaomID.npc.HOOFPRINT + 2,
1321
},
14-
[dsp.zone.BHAFLAU_THICKETS] = {
15-
16990560,
16-
16990561,
17-
16990562,
22+
[xi.zone.BHAFLAU_THICKETS] = {
23+
bhaflauID.npc.HOOFPRINT,
24+
bhaflauID.npc.HOOFPRINT + 1,
25+
bhaflauID.npc.HOOFPRINT + 2,
1826
},
19-
[dsp.zone.MOUNT_ZHAYOLM] = {
20-
17027510,
21-
17027511,
22-
17027512,
27+
[xi.zone.MOUNT_ZHAYOLM] = {
28+
mountID.npc.HOOFPRINT,
29+
mountID.npc.HOOFPRINT + 1,
30+
mountID.npc.HOOFPRINT + 2,
2331
},
24-
[dsp.zone.CAEDARVA_MIRE] = {
25-
17101242,
26-
17101243,
27-
17101244,
32+
[xi.zone.CAEDARVA_MIRE] = {
33+
caedarvaID.npc.HOOFPRINT,
34+
caedarvaID.npc.HOOFPRINT + 1,
35+
caedarvaID.npc.HOOFPRINT + 2,
2836
},
2937
}
3038

3139
local hoofprintPositions = {
32-
[dsp.zone.WAJAOM_WOODLANDS] = {
40+
[xi.zone.WAJAOM_WOODLANDS] = {
3341
{ 400, -24, 2 }, -- K-9
3442
{ 345, -18, -41 }, -- J-9 E edge
3543
{ 221, -18, -63 }, -- J-9 W edge
@@ -52,7 +60,7 @@ local hoofprintPositions = {
5260
{ -360, -32, 680 }, -- F-5 behind tower
5361
{ 105, -26, 320 }, -- I-7
5462
},
55-
[dsp.zone.BHAFLAU_THICKETS] = {
63+
[xi.zone.BHAFLAU_THICKETS] = {
5664
{ 447, -18, 266 }, -- I-8
5765
{ 425, -20.25, 239 }, -- I-9
5866
{ 298, -8.5, 211 }, -- H-8 center of open area
@@ -66,7 +74,7 @@ local hoofprintPositions = {
6674
{ 336, -18, 380 }, -- H-7 SE corner
6775
{ 379, -17, 380 }, -- I-7 in tunnel
6876
},
69-
[dsp.zone.MOUNT_ZHAYOLM] = {
77+
[xi.zone.MOUNT_ZHAYOLM] = {
7078
{ -401, -14.5, 374 }, -- D/E-6
7179
{ -458, -13, 357 }, -- D-6
7280
{ -350, -14, 330 }, -- E-6 near manhole cover
@@ -76,7 +84,7 @@ local hoofprintPositions = {
7684
{ 598, -14, -4 }, -- K-8
7785
{ 762, -14.5, -55 }, -- L-8
7886
},
79-
[dsp.zone.CAEDARVA_MIRE] = {
87+
[xi.zone.CAEDARVA_MIRE] = {
8088
{ -600, 4.5, -100 }, -- G-9 (2nd map)
8189
{ 212, 0, -533 }, -- I-9
8290
{ 280, -16, -357 }, -- J-8
@@ -90,14 +98,11 @@ local hoofprintPositions = {
9098

9199
local hoofprintZones = {}
92100
for zoneId, _ in pairs(hoofprintPositions) do
93-
hoofprintZones[#hoofprintZones+1] = zoneId
101+
hoofprintZones[#hoofprintZones + 1] = zoneId
94102
end
95103

96-
darkRider.zone = {}
97-
98104
-- Adds hoofprints if the current zone is the one picked for that day
99-
function darkRider.zone.addHoofprints(zone)
100-
105+
xi.darkRider.addHoofprints = function(zone)
101106
-- We need a random number that's the same across servers,
102107
-- so we add a bunch of vanadiel time values, which will be the same across servers, but should
103108
-- result in a seemingly "random" area and positions each time when combined with the modulo operator.
@@ -113,70 +118,58 @@ function darkRider.zone.addHoofprints(zone)
113118
local possiblePositions = utils.shuffle(hoofprintPositions[zone:getID()])
114119
local possibleHoofprintIds = hoofprintIds[zone:getID()]
115120

116-
local daysSinceEpoch = VanadielDaySinceEpoch()
117-
local currentHoofprintCount = zone:getLocalVar("HoofprintCount")
121+
local daysSinceEpoch = VanadielUniqueDay()
122+
local currentHoofprintCount = zone:getLocalVar('HoofprintCount')
118123

119-
local hoofprintsToAdd = math.fmod(fakeRandomNum, darkRider.MAX_HOOFPRINTS_PER_DAY) + 1
124+
local hoofprintsToAdd = math.fmod(fakeRandomNum, xi.darkRider.MAX_HOOFPRINTS_PER_DAY) + 1
120125

121126
for i = 1, #possibleHoofprintIds do
122127
if hoofprintsToAdd <= 0 then
123128
break
124129
end
125130

126131
local hoofprint = GetNPCByID(possibleHoofprintIds[i])
127-
if hoofprint ~= nil and hoofprint:getStatus() ~= dsp.status.NORMAL then
132+
if hoofprint ~= nil and hoofprint:getStatus() ~= xi.status.NORMAL then
128133
hoofprint:setPos(possiblePositions[i])
129-
hoofprint:setStatus(dsp.status.NORMAL)
130-
hoofprint:untargetable(false)
131-
hoofprint:setLocalVar("DaysSinceEpoch", daysSinceEpoch)
134+
hoofprint:setStatus(xi.status.NORMAL)
135+
hoofprint:setLocalVar('DaysSinceEpoch', daysSinceEpoch)
132136
currentHoofprintCount = currentHoofprintCount + 1
133137
hoofprintsToAdd = hoofprintsToAdd - 1
134138
else
135-
printf("Did not find hoofprint with ID: %d", possibleHoofprintIds[i])
139+
printf('Did not find hoofprint with ID: %d', possibleHoofprintIds[i])
136140
end
137141
end
138142

139-
zone:setLocalVar("HoofprintCount", currentHoofprintCount)
143+
zone:setLocalVar('HoofprintCount', currentHoofprintCount)
140144
end
141145

142146
-- Remove hoofprints at 06:00 from previous day
143-
function darkRider.zone.onGameHour(zone)
147+
xi.darkRider.onGameHour = function(zone)
144148
if VanadielHour() ~= 6 then
145149
return
146150
end
147151

148-
local hoofprintCount = zone:getLocalVar("HoofprintCount")
152+
local hoofprintCount = zone:getLocalVar('HoofprintCount')
149153
if hoofprintCount == 0 then
150154
return
151155
end
152156

153-
local daysSinceEpoch = VanadielDaySinceEpoch()
157+
local daysSinceEpoch = VanadielUniqueDay()
154158
local possibleHoofprintIds = hoofprintIds[zone:getID()]
155159
for i = 1, #possibleHoofprintIds do
156160
local hoofprint = GetNPCByID(possibleHoofprintIds[i])
157161

158162
-- Hide hoofprint if it was shown in a previous day
159-
if hoofprint ~= nil and
160-
hoofprint:getStatus() == dsp.status.NORMAL and
161-
hoofprint:getLocalVar("DaysSinceEpoch") < daysSinceEpoch
163+
if
164+
hoofprint ~= nil and
165+
hoofprint:getStatus() == xi.status.NORMAL and
166+
hoofprint:getLocalVar('DaysSinceEpoch') < daysSinceEpoch
162167
then
163-
hoofprint:setStatus(dsp.status.DISAPPEAR)
164-
hoofprint:untargetable(true)
168+
hoofprint:setStatus(xi.status.DISAPPEAR)
165169
hoofprint:resetLocalVars()
166170
hoofprintCount = hoofprintCount - 1
167171
end
168172
end
169173

170-
zone:setLocalVar("HoofprintCount", hoofprintCount)
171-
end
172-
173-
174-
function darkRider.hoofprintTrigger(player, npc)
175-
if not player:hasKeyItem(dsp.ki.SP_WILDCAT_BADGE) then
176-
if player:hasKeyItem(dsp.ki.DARK_RIDER_HOOFPRINT) or player:getVar("[Assault]SP") == 0 then
177-
return
178-
end
179-
180-
npcUtil.giveKeyItem(player, dsp.ki.DARK_RIDER_HOOFPRINT)
181-
end
174+
zone:setLocalVar('HoofprintCount', hoofprintCount)
182175
end

Diff for: scripts/zones/Bhaflau_Thickets/IDs.lua

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ zones[xi.zone.BHAFLAU_THICKETS] =
5555
npc =
5656
{
5757
HARVESTING = GetTableOfIDs('Harvesting_Point'),
58+
HOOFPRINT = GetFirstID('Warhorse_Hoofprint'),
5859
},
5960
}
6061

Diff for: scripts/zones/Bhaflau_Thickets/Zone.lua

+5-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ zoneObject.onInitialize = function(zone)
1111
GetMobByID(ID.mob.HARVESTMAN):setRespawnTime(math.random(900, 10800))
1212

1313
xi.helm.initZone(zone, xi.helmType.HARVESTING)
14-
darkRider.zone.addHoofprints(zone)
14+
xi.darkRider.addHoofprints(zone)
1515
end
1616

1717
zoneObject.onZoneIn = function(player, prevZone)
@@ -38,12 +38,11 @@ zoneObject.afterZoneIn = function(player)
3838
end
3939

4040
zoneObject.onGameHour = function(zone)
41-
updateZoneDigItems(zone)
42-
darkRider.zone.onGameHour(zone)
43-
end
41+
xi.darkRider.onGameHour(zone)
4442

45-
zoneObjectonGameDay = function(zone)
46-
darkRider.zone.addHoofprints(zone)
43+
if VanadielHour() == 0 then
44+
xi.darkRider.addHoofprints(zone)
45+
end
4746
end
4847

4948
zoneObject.onEventUpdate = function(player, csid, option, npc)

Diff for: scripts/zones/Bhaflau_Thickets/npcs/Warhorse_Hoofprint.lua

-9
This file was deleted.

Diff for: scripts/zones/Caedarva_Mire/IDs.lua

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ zones[xi.zone.CAEDARVA_MIRE] =
6969
LOGGING = GetTableOfIDs('Logging_Point'),
7070
RUNIC_PORTAL_AZOUPH = GetFirstID('Runic_Portal_Azouph'),
7171
RUNIC_PORTAL_DVUCCA = GetFirstID('Runic_Portal_Dvucca'),
72+
HOOFPRINT = GetFirstID('Warhorse_Hoofprint'),
7273
},
7374
}
7475

Diff for: scripts/zones/Caedarva_Mire/Zone.lua

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ zoneObject.onInitialize = function(zone)
1212
GetMobByID(ID.mob.KHIMAIRA):setRespawnTime(math.random(12, 36) * 3600) -- 12 to 36 hours after maintenance, in 1-hour increments
1313

1414
xi.helm.initZone(zone, xi.helmType.LOGGING)
15-
darkRider.zone.addHoofprints(zone)
15+
xi.darkRider.addHoofprints(zone)
1616
end
1717

1818
zoneObject.onZoneIn = function(player, prevZone)
@@ -47,12 +47,12 @@ end
4747
zoneObject.onTriggerAreaEnter = function(player, triggerArea)
4848
end
4949

50-
zoneObject.onGameDay = function(zone)
51-
darkRider.zone.addHoofprints(zone)
52-
end
53-
5450
zoneObject.onGameHour = function(zone)
55-
darkRider.zone.onGameHour(zone)
51+
xi.darkRider.onGameHour(zone)
52+
53+
if VanadielHour() == 0 then
54+
xi.darkRider.addHoofprints(zone)
55+
end
5656
end
5757

5858
zoneObject.onEventUpdate = function(player, csid, option, npc)

Diff for: scripts/zones/Caedarva_Mire/npcs/Warhorse_Hoofprint.lua

-9
This file was deleted.

Diff for: scripts/zones/Mount_Zhayolm/IDs.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ zones[xi.zone.MOUNT_ZHAYOLM] =
5555
},
5656
npc =
5757
{
58-
MINING = GetTableOfIDs('Mining_Point'),
58+
MINING = GetTableOfIDs('Mining_Point'),
59+
HOOFPRINT = GetFirstID('Warhorse_Hoofprint'),
5960
},
6061
}
6162

Diff for: scripts/zones/Mount_Zhayolm/Zone.lua

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ zoneObject.onInitialize = function(zone)
1010
GetMobByID(ID.mob.CERBERUS):setRespawnTime(math.random(12, 36) * 3600)
1111

1212
xi.helm.initZone(zone, xi.helmType.MINING)
13-
darkRider.zone.addHoofprints(zone)
13+
xi.darkRider.addHoofprints(zone)
1414
end
1515

1616
zoneObject.onZoneIn = function(player, prevZone)
@@ -37,13 +37,16 @@ end
3737
zoneObject.onTriggerAreaEnter = function(player, triggerArea)
3838
end
3939

40-
zoneObject.onGameDay = function(zone)
40+
zoneObject.onGameDay = function()
4141
xi.apkallu.updateHate(xi.zone.MOUNT_ZHAYOLM, -3)
42-
darkRider.zone.addHoofprints(zone)
4342
end
4443

4544
zoneObject.onGameHour = function(zone)
46-
darkRider.zone.onGameHour(zone)
45+
xi.darkRider.onGameHour(zone)
46+
47+
if VanadielHour() == 0 then
48+
xi.darkRider.addHoofprints(zone)
49+
end
4750
end
4851

4952
zoneObject.onEventUpdate = function(player, csid, option, npc)

Diff for: scripts/zones/Mount_Zhayolm/npcs/Warhorse_Hoofprint.lua

-9
This file was deleted.

Diff for: scripts/zones/Wajaom_Woodlands/IDs.lua

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ zones[xi.zone.WAJAOM_WOODLANDS] =
5050
npc =
5151
{
5252
HARVESTING = GetTableOfIDs('Harvesting_Point'),
53+
HOOFPRINT = GetFirstID('Warhorse_Hoofprint'),
5354
},
5455
}
5556

Diff for: scripts/zones/Wajaom_Woodlands/Zone.lua

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local zoneObject = {}
77
zoneObject.onInitialize = function(zone)
88
xi.helm.initZone(zone, xi.helmType.HARVESTING)
99
xi.chocobo.initZone(zone)
10-
darkRider.zone.addHoofprints(zone)
10+
xi.darkRider.addHoofprints(zone)
1111
end
1212

1313
zoneObject.onZoneIn = function(player, prevZone)
@@ -27,12 +27,12 @@ end
2727
zoneObject.onTriggerAreaEnter = function(player, triggerArea)
2828
end
2929

30-
zoneObject.onGameDay = function(zone)
31-
darkRider.zone.addHoofprints(zone)
32-
end
33-
3430
zoneObject.onGameHour = function(zone)
35-
darkRider.zone.onGameHour(zone)
31+
xi.darkRider.onGameHour(zone)
32+
33+
if VanadielHour() == 0 then
34+
xi.darkRider.addHoofprints(zone)
35+
end
3636
end
3737

3838
zoneObject.onEventUpdate = function(player, csid, option, npc)

Diff for: scripts/zones/Wajaom_Woodlands/npcs/Warhorse_Hoofprint.lua

-9
This file was deleted.

0 commit comments

Comments
 (0)