Skip to content

Commit

Permalink
Merge pull request #6879 from KnowOne134/hoof_prints
Browse files Browse the repository at this point in the history
[Assault] Warhorse Hoofprints
  • Loading branch information
claywar authored Feb 6, 2025
2 parents 2ed11eb + 5ca8029 commit e039aea
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 14 deletions.
172 changes: 172 additions & 0 deletions scripts/globals/dark_rider.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
-----------------------------------
-- Warhorse Hoofprint global file
-----------------------------------
local bhaflauID = zones[xi.zone.BHAFLAU_THICKETS]
local caedarvaID = zones[xi.zone.CAEDARVA_MIRE]
local mountID = zones[xi.zone.MOUNT_ZHAYOLM]
local wajaomID = zones[xi.zone.WAJAOM_WOODLANDS]
-----------------------------------

xi = xi or {}
xi.darkRider = {}
xi.darkRider.MAX_HOOFPRINTS_PER_DAY = 2

local hoofprintIds = {
[xi.zone.WAJAOM_WOODLANDS] = {
wajaomID.npc.HOOFPRINT,
wajaomID.npc.HOOFPRINT + 1,
wajaomID.npc.HOOFPRINT + 2,
},
[xi.zone.BHAFLAU_THICKETS] = {
bhaflauID.npc.HOOFPRINT,
bhaflauID.npc.HOOFPRINT + 1,
bhaflauID.npc.HOOFPRINT + 2,
},
[xi.zone.MOUNT_ZHAYOLM] = {
mountID.npc.HOOFPRINT,
mountID.npc.HOOFPRINT + 1,
mountID.npc.HOOFPRINT + 2,
},
[xi.zone.CAEDARVA_MIRE] = {
caedarvaID.npc.HOOFPRINT,
caedarvaID.npc.HOOFPRINT + 1,
caedarvaID.npc.HOOFPRINT + 2,
},
}

local hoofprintPositions = {
[xi.zone.WAJAOM_WOODLANDS] = {
{ 400, -24, 2 }, -- K-9
{ 345, -18, -41 }, -- J-9 E edge
{ 221, -18, -63 }, -- J-9 W edge
{ 217, -17.5, -140 }, -- J-10
{ 185, -20.25, -200 }, -- I-10 E edge
{ 121, -16, -241 }, -- I-10 S edge
{ 0, -18, -265 }, -- H-10 S edge
{ -80, -18, -546 }, -- H-12
{ -175, -20.25, -562 }, -- G-12
{ -378, -9, -580 }, -- F-12 S edge
{ -625, -19, -345 }, -- D-11
{ -642, -16, -160 }, -- D-10
{ -532, -8.5, -64 }, -- E-9
{ -500, -18, 176 }, -- E-8
{ -400, -24, 281 }, -- F-7
{ -400, -24, 281 }, -- F-7
{ -237, -24, 403 }, -- G-6 NE
{ -258, -25.5, 497 }, -- G-6 N
{ -302, -26, 580 }, -- F-5 SE corner
{ -360, -32, 680 }, -- F-5 behind tower
{ 105, -26, 320 }, -- I-7
},
[xi.zone.BHAFLAU_THICKETS] = {
{ 447, -18, 266 }, -- I-8
{ 425, -20.25, 239 }, -- I-9
{ 298, -8.5, 211 }, -- H-8 center of open area
{ 338, -10, 255 }, -- H-8 E tunnel
{ 160, -16, 319 }, -- G-8
{ 20, -18.675, 240 }, -- F-8
{ 283, -23.75, 431 }, -- H-7 center
{ 240, -32, 480 }, -- H-7 NW
{ 185, -34, 514 }, -- G-7 top NE corner
{ 61, -34, 545 }, -- G-6 SW corner
{ 336, -18, 380 }, -- H-7 SE corner
{ 379, -17, 380 }, -- I-7 in tunnel
},
[xi.zone.MOUNT_ZHAYOLM] = {
{ -401, -14.5, 374 }, -- D/E-6
{ -458, -13, 357 }, -- D-6
{ -350, -14, 330 }, -- E-6 near manhole cover
{ -401, -14.5, 372 }, -- E-6 tip of protruding wall
{ 161, -14, -206 }, -- H-9 (near the Pugils to the south)
{ 278, -18, -294 }, -- I-10 (on the mound with the Eruca)
{ 598, -14, -4 }, -- K-8
{ 762, -14.5, -55 }, -- L-8
},
[xi.zone.CAEDARVA_MIRE] = {
{ -600, 4.5, -100 }, -- G-9 (2nd map)
{ 212, 0, -533 }, -- I-9
{ 280, -16, -357 }, -- J-8
{ 300, -15, -354 }, -- J-8 in north pool
{ 400, -7.5, -260 }, -- J-8 N at imp camp
{ 415, -10, -180 }, -- J-7
{ 160, -8, -320 }, -- I-8
},
}

local hoofprintZones = {}
for zoneId, _ in pairs(hoofprintPositions) do
hoofprintZones[#hoofprintZones + 1] = zoneId
end

-- Adds hoofprints if the current zone is the one picked for that day
xi.darkRider.addHoofprints = function(zone)
-- We need a random number that's the same across servers,
-- so we add a bunch of vanadiel time values, which will be the same across servers, but should
-- result in a seemingly "random" area and positions each time when combined with the modulo operator.
local fakeRandomNum = VanadielMoonPhase() + VanadielDayElement() + VanadielDayOfTheMonth() + VanadielDayOfTheYear()

local areaIndex = math.fmod(fakeRandomNum, #hoofprintZones) + 1
local pickedZoneId = hoofprintZones[areaIndex]

if pickedZoneId ~= zone:getID() then
return
end

local possiblePositions = utils.shuffle(hoofprintPositions[zone:getID()])
local possibleHoofprintIds = hoofprintIds[zone:getID()]

local daysSinceEpoch = VanadielUniqueDay()
local currentHoofprintCount = zone:getLocalVar('HoofprintCount')

local hoofprintsToAdd = math.fmod(fakeRandomNum, xi.darkRider.MAX_HOOFPRINTS_PER_DAY) + 1

for i = 1, #possibleHoofprintIds do
if hoofprintsToAdd <= 0 then
break
end

local hoofprint = GetNPCByID(possibleHoofprintIds[i])
if hoofprint ~= nil and hoofprint:getStatus() ~= xi.status.NORMAL then
hoofprint:setPos(possiblePositions[i])
hoofprint:setStatus(xi.status.NORMAL)
hoofprint:setLocalVar('DaysSinceEpoch', daysSinceEpoch)
currentHoofprintCount = currentHoofprintCount + 1
hoofprintsToAdd = hoofprintsToAdd - 1
else
printf('Did not find hoofprint with ID: %d', possibleHoofprintIds[i])
end
end

zone:setLocalVar('HoofprintCount', currentHoofprintCount)
end

-- Remove hoofprints at 06:00 from previous day
xi.darkRider.onGameHour = function(zone)
if VanadielHour() ~= 6 then
return
end

local hoofprintCount = zone:getLocalVar('HoofprintCount')
if hoofprintCount == 0 then
return
end

local daysSinceEpoch = VanadielUniqueDay()
local possibleHoofprintIds = hoofprintIds[zone:getID()]
for i = 1, #possibleHoofprintIds do
local hoofprint = GetNPCByID(possibleHoofprintIds[i])

-- Hide hoofprint if it was shown in a previous day
if
hoofprint ~= nil and
hoofprint:getStatus() == xi.status.NORMAL and
hoofprint:getLocalVar('DaysSinceEpoch') < daysSinceEpoch
then
hoofprint:setStatus(xi.status.DISAPPEAR)
hoofprint:resetLocalVars()
hoofprintCount = hoofprintCount - 1
end
end

zone:setLocalVar('HoofprintCount', hoofprintCount)
end
1 change: 1 addition & 0 deletions scripts/zones/Bhaflau_Thickets/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ zones[xi.zone.BHAFLAU_THICKETS] =
npc =
{
HARVESTING = GetTableOfIDs('Harvesting_Point'),
HOOFPRINT = GetFirstID('Warhorse_Hoofprint'),
},
}

Expand Down
8 changes: 7 additions & 1 deletion scripts/zones/Bhaflau_Thickets/Zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ zoneObject.onInitialize = function(zone)
GetMobByID(ID.mob.HARVESTMAN):setRespawnTime(math.random(900, 10800))

xi.helm.initZone(zone, xi.helmType.HARVESTING)
xi.darkRider.addHoofprints(zone)
end

zoneObject.onZoneIn = function(player, prevZone)
Expand All @@ -36,7 +37,12 @@ zoneObject.afterZoneIn = function(player)
player:entityVisualPacket('2pb1')
end

zoneObject.onTriggerAreaEnter = function(player, triggerArea)
zoneObject.onGameHour = function(zone)
xi.darkRider.onGameHour(zone)

if VanadielHour() == 0 then
xi.darkRider.addHoofprints(zone)
end
end

zoneObject.onEventUpdate = function(player, csid, option, npc)
Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Caedarva_Mire/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ zones[xi.zone.CAEDARVA_MIRE] =
},
npc =
{
HOOFPRINT = GetFirstID('Warhorse_Hoofprint'),
LOGGING = GetTableOfIDs('Logging_Point'),
RUNIC_PORTAL_AZOUPH = GetFirstID('Runic_Portal_Azouph'),
RUNIC_PORTAL_DVUCCA = GetFirstID('Runic_Portal_Dvucca'),
Expand Down
9 changes: 9 additions & 0 deletions scripts/zones/Caedarva_Mire/Zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ zoneObject.onInitialize = function(zone)
GetMobByID(ID.mob.KHIMAIRA):setRespawnTime(math.random(12, 36) * 3600) -- 12 to 36 hours after maintenance, in 1-hour increments

xi.helm.initZone(zone, xi.helmType.LOGGING)
xi.darkRider.addHoofprints(zone)
end

zoneObject.onZoneIn = function(player, prevZone)
Expand Down Expand Up @@ -46,6 +47,14 @@ end
zoneObject.onTriggerAreaEnter = function(player, triggerArea)
end

zoneObject.onGameHour = function(zone)
xi.darkRider.onGameHour(zone)

if VanadielHour() == 0 then
xi.darkRider.addHoofprints(zone)
end
end

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

Expand Down
3 changes: 2 additions & 1 deletion scripts/zones/Mount_Zhayolm/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ zones[xi.zone.MOUNT_ZHAYOLM] =
},
npc =
{
MINING = GetTableOfIDs('Mining_Point'),
HOOFPRINT = GetFirstID('Warhorse_Hoofprint'),
MINING = GetTableOfIDs('Mining_Point'),
},
}

Expand Down
9 changes: 9 additions & 0 deletions scripts/zones/Mount_Zhayolm/Zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ zoneObject.onInitialize = function(zone)
GetMobByID(ID.mob.CERBERUS):setRespawnTime(math.random(12, 36) * 3600)

xi.helm.initZone(zone, xi.helmType.MINING)
xi.darkRider.addHoofprints(zone)
end

zoneObject.onZoneIn = function(player, prevZone)
Expand Down Expand Up @@ -40,6 +41,14 @@ zoneObject.onGameDay = function()
xi.apkallu.updateHate(xi.zone.MOUNT_ZHAYOLM, -3)
end

zoneObject.onGameHour = function(zone)
xi.darkRider.onGameHour(zone)

if VanadielHour() == 0 then
xi.darkRider.addHoofprints(zone)
end
end

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

Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Wajaom_Woodlands/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ zones[xi.zone.WAJAOM_WOODLANDS] =
npc =
{
HARVESTING = GetTableOfIDs('Harvesting_Point'),
HOOFPRINT = GetFirstID('Warhorse_Hoofprint'),
},
}

Expand Down
9 changes: 9 additions & 0 deletions scripts/zones/Wajaom_Woodlands/Zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local zoneObject = {}
zoneObject.onInitialize = function(zone)
xi.helm.initZone(zone, xi.helmType.HARVESTING)
xi.chocobo.initZone(zone)
xi.darkRider.addHoofprints(zone)
end

zoneObject.onZoneIn = function(player, prevZone)
Expand All @@ -26,6 +27,14 @@ end
zoneObject.onTriggerAreaEnter = function(player, triggerArea)
end

zoneObject.onGameHour = function(zone)
xi.darkRider.onGameHour(zone)

if VanadielHour() == 0 then
xi.darkRider.addHoofprints(zone)
end
end

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

Expand Down
24 changes: 12 additions & 12 deletions sql/npc_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4632,9 +4632,9 @@ INSERT INTO `npc_list` VALUES (16982653,'qm','???',0,0.000,0.000,0.000,0,50,50,0
INSERT INTO `npc_list` VALUES (16986598,'NPC[1e6]','NPC',0,0.000,0.000,0.000,0,50,50,0,0,0,2,3,0x0000320000000000000000000000000000000000,0,NULL,1);
INSERT INTO `npc_list` VALUES (16986599,'NPC[1e7]','NPC',0,0.000,0.000,0.000,0,50,50,0,0,0,2,3,0x0000320000000000000000000000000000000000,0,NULL,1);
INSERT INTO `npc_list` VALUES (16986600,'Peculiar_Bud','Peculiar Bud',0,-485.000,-28.000,-744.000,8,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (16986601,'Warhorse_Hoofprint','Warhorse Hoofprint',0,0.000,0.000,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (16986602,'Warhorse_Hoofprint','Warhorse Hoofprint',0,0.000,0.000,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (16986603,'Warhorse_Hoofprint','Warhorse Hoofprint',0,0.000,0.000,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (16986601,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (16986602,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (16986603,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (16986604,'NPC[1ec]','NPC',0,0.000,0.000,0.000,0,50,50,0,0,0,2,3,0x0000320000000000000000000000000000000000,0,NULL,1);
INSERT INTO `npc_list` VALUES (16986605,'qm1','???',252,-695.558,-7.500,-126.721,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',0);
INSERT INTO `npc_list` VALUES (16986606,'qm2','???',187,257.462,-23.433,120.741,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',0);
Expand Down Expand Up @@ -4866,9 +4866,9 @@ INSERT INTO `npc_list` VALUES (16986829,'Ethereal_Junction','Ethereal Junction',
-- Bhaflau Thickets (Zone 52)
-- ------------------------------------------------------------

INSERT INTO `npc_list` VALUES (16990593,'Warhorse_Hoofprint','Warhorse Hoofprint',0,130.335,-35.292,498.318,6,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (16990594,'Warhorse_Hoofprint','Warhorse Hoofprint',0,58.927,-34.997,580.882,7,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (16990595,'Warhorse_Hoofprint','Warhorse Hoofprint',0,257.156,-27.492,449.737,7,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (16990593,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (16990594,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (16990595,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (16990596,'qm1','???',104,331.456,-10.000,182.845,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',0);
INSERT INTO `npc_list` VALUES (16990597,'qm4','???',192,460.166,-14.926,256.214,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',0);
INSERT INTO `npc_list` VALUES (16990598,'Achieve_Master','Achieve Master',0,0.000,0.000,0.000,0,50,50,0,0,0,2,3,0x0000320000000000000000000000000000000000,0,'SOA',0);
Expand Down Expand Up @@ -5679,9 +5679,9 @@ INSERT INTO `npc_list` VALUES (17023067,'_1o3','FX_TEST_1o3',0,17.971,-24.021,3.
-- -----------------------------------------------------------

INSERT INTO `npc_list` VALUES (17027510,'Peculiar_Seed','Peculiar Seed',0,858.000,-15.000,223.000,6,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17027511,'Warhorse_Hoofprint','Warhorse Hoofprint',0,0.000,0.000,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17027512,'Warhorse_Hoofprint','Warhorse Hoofprint',0,0.000,0.000,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17027513,'Warhorse_Hoofprint','Warhorse Hoofprint',0,0.000,0.000,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17027511,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (17027512,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (17027513,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
-- 17027514 gap
INSERT INTO `npc_list` VALUES (17027515,'qm1','???',162,402.600,-27.513,121.544,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',0);
INSERT INTO `npc_list` VALUES (17027516,'qm2','???',238,501.415,-8.768,52.986,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',0);
Expand Down Expand Up @@ -7869,9 +7869,9 @@ INSERT INTO `npc_list` VALUES (17097374,'4','4',128,5.604,0.000,47.149,0,40,40,0
-- ------------------------------------------------------------

INSERT INTO `npc_list` VALUES (17101287,'Peculiar_Plant','Peculiar Plant',0,0.000,0.000,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17101288,'Warhorse_Hoofprint','Warhorse Hoofprint',0,420.568,-19.807,-85.785,7,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17101289,'Warhorse_Hoofprint','Warhorse Hoofprint',0,397.899,-8.557,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17101290,'Warhorse_Hoofprint','Warhorse Hoofprint',0,389.040,-17.686,0.000,0,40,40,0,0,0,2,3,0x0000340000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17101288,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (17101289,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (17101290,'Warhorse_Hoofprint','Warhorse Hoofprint',0,1.000,0.000,0.000,7,40,40,0,0,32,2,27,0x0000340000000000000000000000000000000000,32,'TOAU',1);
INSERT INTO `npc_list` VALUES (17101291,'NPC[1C7]','',0,0.000,0.000,0.000,0,40,40,0,0,0,2,1,0x0000320000000000000000000000000000000000,0,'TOAU',1);
INSERT INTO `npc_list` VALUES (17101292,'qm1','???',0,417.795,-19.631,-74.338,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',0);
INSERT INTO `npc_list` VALUES (17101293,'qm2','???',0,-771.466,-11.750,322.087,1,40,40,0,0,0,0,3,0x0000340000000000000000000000000000000000,0,'TOAU',0);
Expand Down

0 comments on commit e039aea

Please sign in to comment.