2021-01-18 12:48:07 -05:00
|
|
|
-----------------------------------
|
2021-04-01 15:10:15 -04:00
|
|
|
-- xi.effect.MOUNTED
|
2021-01-18 12:48:07 -05:00
|
|
|
-----------------------------------
|
2024-08-24 21:26:29 -04:00
|
|
|
---@type TEffect
|
2022-10-06 17:22:04 +03:00
|
|
|
local effectObject = {}
|
2017-04-02 03:08:30 -04:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectGain = function(target, effect)
|
2025-07-17 00:14:39 -06:00
|
|
|
local mountId = effect:getPower()
|
2022-01-11 19:53:51 +02:00
|
|
|
-- Retail sends a music change packet (packet ID 0x5F) in both cases.
|
2018-03-14 18:07:45 -04:00
|
|
|
|
2025-11-04 09:56:29 -07:00
|
|
|
local animation = xi.animation.NONE
|
|
|
|
|
|
2025-07-17 00:14:39 -06:00
|
|
|
if
|
|
|
|
|
mountId == xi.mount.CHOCOBO or
|
|
|
|
|
mountId == xi.mount.NOBLE_CHOCOBO
|
|
|
|
|
then
|
2022-12-03 23:45:13 +00:00
|
|
|
target:changeMusic(4, 212)
|
2025-11-04 09:56:29 -07:00
|
|
|
animation = xi.anim.CHOCOBO
|
2017-04-02 03:08:30 -04:00
|
|
|
else
|
2022-12-03 23:45:13 +00:00
|
|
|
target:changeMusic(4, 84)
|
2025-11-04 09:56:29 -07:00
|
|
|
animation = xi.anim.MOUNT
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if not target:isInEvent() then
|
|
|
|
|
target:setAnimation(animation)
|
2017-04-02 03:08:30 -04:00
|
|
|
end
|
2025-11-11 22:59:31 -07:00
|
|
|
|
|
|
|
|
-- Chocobo and mounts uncharm current pet
|
|
|
|
|
local pet = target:getPet()
|
|
|
|
|
if pet ~= nil and pet:isCharmed() then
|
|
|
|
|
target:despawnPet()
|
|
|
|
|
end
|
2018-08-07 19:36:44 -04:00
|
|
|
end
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectTick = function(target, effect)
|
2018-08-07 19:36:44 -04:00
|
|
|
end
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectLose = function(target, effect)
|
2025-11-04 09:56:29 -07:00
|
|
|
if not target:isInEvent() then -- Paranoia safety check
|
|
|
|
|
target:setAnimation(xi.anim.NONE)
|
|
|
|
|
end
|
2025-01-08 12:37:59 -07:00
|
|
|
|
|
|
|
|
-- Remove CharVars from player participating in chocobo riding game
|
|
|
|
|
if target:isPC() then
|
|
|
|
|
xi.chocoboGame.dismountChoco(target)
|
|
|
|
|
end
|
2020-03-19 18:41:42 -07:00
|
|
|
end
|
2021-01-07 03:22:42 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
return effectObject
|