From 9255ca75a22dbfbbe94e245f40f71ff0b5da2c3e Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Mon, 2 Dec 2019 18:01:26 -0500 Subject: [PATCH 1/9] shared darter hate for party/alliance members wiki link referenced in header comment. video demo: https://www.youtube.com/watch?v=yChnPS02kJs&feature=youtu.be --- scripts/zones/Dragons_Aery/mobs/Darter.lua | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/zones/Dragons_Aery/mobs/Darter.lua diff --git a/scripts/zones/Dragons_Aery/mobs/Darter.lua b/scripts/zones/Dragons_Aery/mobs/Darter.lua new file mode 100644 index 00000000000..b08d4459a2d --- /dev/null +++ b/scripts/zones/Dragons_Aery/mobs/Darter.lua @@ -0,0 +1,36 @@ +----------------------------------- +-- Area: Dragons Aery +-- Darter +-- https://ffxiclopedia.fandom.com/wiki/Darter +-- "Be careful to not attack the Darters in the Dragon's Aery. Every alliance member will generate enmity towards them." +----------------------------------- +local ID = require("scripts/zones/Dragons_Aery/IDs") +require("scripts/globals/settings") +require("scripts/globals/status") +----------------------------------- + +function onMobEngaged(mob, targ) + print("darter engaged!") + + local targPlayer = nil + + if targ:isPC() then + targPlayer = targ + elseif targ:isPet() and (targ:getMaster()):isPC() then + targPlayer = targ:getMaster() + else + return + end + + party = targPlayer:getAlliance() + + for _,member in ipairs(party) do + if member:getID() ~= targPlayer:getID() then + mob:setCE(member, 1) + else + mob:setCE(member, 2) -- more enmity to main target, else links onto main target will disperse randomly among party members upon engaging the main target + end + end + + return +end From 47ef8eec10f8560aefabf405873fb16427af5592 Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Mon, 2 Dec 2019 18:05:05 -0500 Subject: [PATCH 2/9] Update Darter.lua --- scripts/zones/Dragons_Aery/mobs/Darter.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/zones/Dragons_Aery/mobs/Darter.lua b/scripts/zones/Dragons_Aery/mobs/Darter.lua index b08d4459a2d..2f931533736 100644 --- a/scripts/zones/Dragons_Aery/mobs/Darter.lua +++ b/scripts/zones/Dragons_Aery/mobs/Darter.lua @@ -10,8 +10,6 @@ require("scripts/globals/status") ----------------------------------- function onMobEngaged(mob, targ) - print("darter engaged!") - local targPlayer = nil if targ:isPC() then From 7f101c6dd51fa25c8e53998b1112b329c71d3b54 Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Fri, 13 Dec 2019 03:58:59 -0500 Subject: [PATCH 3/9] Add files via upload --- scripts/zones/Uleguerand_Range/IDs.lua | 3 +++ scripts/zones/Uleguerand_Range/Zone.lua | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/zones/Uleguerand_Range/IDs.lua b/scripts/zones/Uleguerand_Range/IDs.lua index 4a293334ded..cebe8f711b2 100644 --- a/scripts/zones/Uleguerand_Range/IDs.lua +++ b/scripts/zones/Uleguerand_Range/IDs.lua @@ -44,10 +44,13 @@ zones[dsp.zone.ULEGUERAND_RANGE] = }, JORMUNGAND = 16797969, GEUSH_URVAN = 16798078, + WHITE_CONEY = 16798079, + BLACK_CONEY = 16798080, }, npc = { WATERFALL = 16798112, + RABBIT_FOOTPRINT = 16798100, }, } diff --git a/scripts/zones/Uleguerand_Range/Zone.lua b/scripts/zones/Uleguerand_Range/Zone.lua index 25c3d8bfb91..a4784378bc8 100644 --- a/scripts/zones/Uleguerand_Range/Zone.lua +++ b/scripts/zones/Uleguerand_Range/Zone.lua @@ -12,8 +12,9 @@ require("scripts/globals/zone"); ----------------------------------- function onInitialize(zone) - UpdateNMSpawnPoint(ID.mob.JORMUNGAND); - GetMobByID(ID.mob.JORMUNGAND):setRespawnTime(math.random(86400, 259200)); + UpdateNMSpawnPoint(ID.mob.JORMUNGAND) + GetMobByID(ID.mob.JORMUNGAND):setRespawnTime(math.random(86400, 259200)) + GetNPCByID(ID.npc.RABBIT_FOOTPRINT):addPeriodicTrigger(0,16,0) -- 16 vanadiel minutes roughly equals 38.4 earth seconds end; function onConquestUpdate(zone, updatetype) From 8d85a8a3be6feab2b623d70f7c1efd998805f267 Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Fri, 13 Dec 2019 09:28:45 -0500 Subject: [PATCH 4/9] Delete Darter.lua --- scripts/zones/Dragons_Aery/mobs/Darter.lua | 34 ---------------------- 1 file changed, 34 deletions(-) delete mode 100644 scripts/zones/Dragons_Aery/mobs/Darter.lua diff --git a/scripts/zones/Dragons_Aery/mobs/Darter.lua b/scripts/zones/Dragons_Aery/mobs/Darter.lua deleted file mode 100644 index 2f931533736..00000000000 --- a/scripts/zones/Dragons_Aery/mobs/Darter.lua +++ /dev/null @@ -1,34 +0,0 @@ ------------------------------------ --- Area: Dragons Aery --- Darter --- https://ffxiclopedia.fandom.com/wiki/Darter --- "Be careful to not attack the Darters in the Dragon's Aery. Every alliance member will generate enmity towards them." ------------------------------------ -local ID = require("scripts/zones/Dragons_Aery/IDs") -require("scripts/globals/settings") -require("scripts/globals/status") ------------------------------------ - -function onMobEngaged(mob, targ) - local targPlayer = nil - - if targ:isPC() then - targPlayer = targ - elseif targ:isPet() and (targ:getMaster()):isPC() then - targPlayer = targ:getMaster() - else - return - end - - party = targPlayer:getAlliance() - - for _,member in ipairs(party) do - if member:getID() ~= targPlayer:getID() then - mob:setCE(member, 1) - else - mob:setCE(member, 2) -- more enmity to main target, else links onto main target will disperse randomly among party members upon engaging the main target - end - end - - return -end From 3fcf09738a577aa87a90fb94c262fc5bf9d0a691 Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Fri, 13 Dec 2019 09:29:38 -0500 Subject: [PATCH 5/9] Delete IDs.lua --- scripts/zones/Uleguerand_Range/IDs.lua | 57 -------------------------- 1 file changed, 57 deletions(-) delete mode 100644 scripts/zones/Uleguerand_Range/IDs.lua diff --git a/scripts/zones/Uleguerand_Range/IDs.lua b/scripts/zones/Uleguerand_Range/IDs.lua deleted file mode 100644 index cebe8f711b2..00000000000 --- a/scripts/zones/Uleguerand_Range/IDs.lua +++ /dev/null @@ -1,57 +0,0 @@ ------------------------------------ --- Area: Uleguerand_Range ------------------------------------ -require("scripts/globals/zone") ------------------------------------ - -zones = zones or {} - -zones[dsp.zone.ULEGUERAND_RANGE] = -{ - text = - { - NOTHING_HAPPENS = 119, -- Nothing happens... - ITEM_CANNOT_BE_OBTAINED = 6395, -- You cannot obtain the . Come back after sorting your inventory. - ITEM_OBTAINED = 6401, -- Obtained: . - GIL_OBTAINED = 6402, -- Obtained gil. - KEYITEM_OBTAINED = 6404, -- Obtained key item: . - NOTHING_OUT_OF_ORDINARY = 6415, -- There is nothing out of the ordinary here. - CONQUEST_BASE = 7062, -- Tallying conquest results... - SOMETHING_GLITTERING = 7333, -- You see something glittering beneath the surface of the ice. - WHAT_LIES_BENEATH = 7334, -- There are many cold scattered around the area. Could someone be trying to melt the ice to retrieve what lies beneath? - SOMETHING_GLITTERING_BUT= 7335, -- You see something glittering below the surface here, but the ice encases it completely. - HOMEPOINT_SET = 8327, -- Home point set! - }, - mob = - { - SKVADER_PH = - { - [16797769] = 16797770, - }, - MAGNOTAUR_PH = - { - [16797966] = 16797968, - [16797967] = 16797968, - }, - BONNACON_PH = - { - [16798050] = 16798056, -- -623.154 -40.604 -51.621 - [16798051] = 16798056, -- -587.026 -40.994 -22.551 - [16798052] = 16798056, -- -513.416 -40.490 -43.706 - [16798053] = 16798056, -- -553.844 -38.958 -53.864 - [16798054] = 16798056, -- -631.268 -40.257 0.709 - [16798055] = 16798056, -- -513.999 -40.541 -34.928 - }, - JORMUNGAND = 16797969, - GEUSH_URVAN = 16798078, - WHITE_CONEY = 16798079, - BLACK_CONEY = 16798080, - }, - npc = - { - WATERFALL = 16798112, - RABBIT_FOOTPRINT = 16798100, - }, -} - -return zones[dsp.zone.ULEGUERAND_RANGE] From 0833f37bf4a8da163971dff73d77d7203ee6bf6a Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Fri, 13 Dec 2019 09:29:45 -0500 Subject: [PATCH 6/9] Delete Zone.lua --- scripts/zones/Uleguerand_Range/Zone.lua | 58 ------------------------- 1 file changed, 58 deletions(-) delete mode 100644 scripts/zones/Uleguerand_Range/Zone.lua diff --git a/scripts/zones/Uleguerand_Range/Zone.lua b/scripts/zones/Uleguerand_Range/Zone.lua deleted file mode 100644 index a4784378bc8..00000000000 --- a/scripts/zones/Uleguerand_Range/Zone.lua +++ /dev/null @@ -1,58 +0,0 @@ ------------------------------------ --- --- Zone: Uleguerand_Range (5) --- ------------------------------------ -local ID = require("scripts/zones/Uleguerand_Range/IDs"); -require("scripts/globals/conquest"); -require("scripts/globals/missions"); -require("scripts/globals/weather"); -require("scripts/globals/status"); -require("scripts/globals/zone"); ------------------------------------ - -function onInitialize(zone) - UpdateNMSpawnPoint(ID.mob.JORMUNGAND) - GetMobByID(ID.mob.JORMUNGAND):setRespawnTime(math.random(86400, 259200)) - GetNPCByID(ID.npc.RABBIT_FOOTPRINT):addPeriodicTrigger(0,16,0) -- 16 vanadiel minutes roughly equals 38.4 earth seconds -end; - -function onConquestUpdate(zone, updatetype) - dsp.conq.onConquestUpdate(zone, updatetype) -end; - -function onZoneIn(player,prevZone) - local cs = -1; - if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then - player:setPos(363.025,16,-60,12); - end - if (player:getCurrentMission(COP) == DAWN and player:getVar("COP_louverance_story")== 1 ) then - cs=17; - end - return cs; -end; - -function onRegionEnter(player,region) -end; - -function onEventUpdate(player,csid,option) -end; - -function onEventFinish(player,csid,option) - if (csid == 17) then - player:setVar("COP_louverance_story",2); - end -end; - -function onZoneWeatherChange(weather) - local waterfall = GetNPCByID(ID.npc.WATERFALL); - if (weather == dsp.weather.SNOW or weather == dsp.weather.BLIZZARDS) then - if (waterfall:getAnimation() ~= dsp.anim.CLOSE_DOOR) then - waterfall:setAnimation(dsp.anim.CLOSE_DOOR); - end - else - if (waterfall:getAnimation() ~= dsp.anim.OPEN_DOOR) then - waterfall:setAnimation(dsp.anim.OPEN_DOOR); - end - end -end; From bbea357be617b54a0e7383f8377f75e93f97b32b Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Fri, 13 Dec 2019 09:30:08 -0500 Subject: [PATCH 7/9] Add files via upload --- scripts/zones/Uleguerand_Range/IDs.lua | 54 +++++++++++++++++++++++ scripts/zones/Uleguerand_Range/Zone.lua | 57 +++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 scripts/zones/Uleguerand_Range/IDs.lua create mode 100644 scripts/zones/Uleguerand_Range/Zone.lua diff --git a/scripts/zones/Uleguerand_Range/IDs.lua b/scripts/zones/Uleguerand_Range/IDs.lua new file mode 100644 index 00000000000..4a293334ded --- /dev/null +++ b/scripts/zones/Uleguerand_Range/IDs.lua @@ -0,0 +1,54 @@ +----------------------------------- +-- Area: Uleguerand_Range +----------------------------------- +require("scripts/globals/zone") +----------------------------------- + +zones = zones or {} + +zones[dsp.zone.ULEGUERAND_RANGE] = +{ + text = + { + NOTHING_HAPPENS = 119, -- Nothing happens... + ITEM_CANNOT_BE_OBTAINED = 6395, -- You cannot obtain the . Come back after sorting your inventory. + ITEM_OBTAINED = 6401, -- Obtained: . + GIL_OBTAINED = 6402, -- Obtained gil. + KEYITEM_OBTAINED = 6404, -- Obtained key item: . + NOTHING_OUT_OF_ORDINARY = 6415, -- There is nothing out of the ordinary here. + CONQUEST_BASE = 7062, -- Tallying conquest results... + SOMETHING_GLITTERING = 7333, -- You see something glittering beneath the surface of the ice. + WHAT_LIES_BENEATH = 7334, -- There are many cold scattered around the area. Could someone be trying to melt the ice to retrieve what lies beneath? + SOMETHING_GLITTERING_BUT= 7335, -- You see something glittering below the surface here, but the ice encases it completely. + HOMEPOINT_SET = 8327, -- Home point set! + }, + mob = + { + SKVADER_PH = + { + [16797769] = 16797770, + }, + MAGNOTAUR_PH = + { + [16797966] = 16797968, + [16797967] = 16797968, + }, + BONNACON_PH = + { + [16798050] = 16798056, -- -623.154 -40.604 -51.621 + [16798051] = 16798056, -- -587.026 -40.994 -22.551 + [16798052] = 16798056, -- -513.416 -40.490 -43.706 + [16798053] = 16798056, -- -553.844 -38.958 -53.864 + [16798054] = 16798056, -- -631.268 -40.257 0.709 + [16798055] = 16798056, -- -513.999 -40.541 -34.928 + }, + JORMUNGAND = 16797969, + GEUSH_URVAN = 16798078, + }, + npc = + { + WATERFALL = 16798112, + }, +} + +return zones[dsp.zone.ULEGUERAND_RANGE] diff --git a/scripts/zones/Uleguerand_Range/Zone.lua b/scripts/zones/Uleguerand_Range/Zone.lua new file mode 100644 index 00000000000..7758c3a482c --- /dev/null +++ b/scripts/zones/Uleguerand_Range/Zone.lua @@ -0,0 +1,57 @@ +----------------------------------- +-- +-- Zone: Uleguerand_Range (5) +-- +----------------------------------- +local ID = require("scripts/zones/Uleguerand_Range/IDs"); +require("scripts/globals/conquest"); +require("scripts/globals/missions"); +require("scripts/globals/weather"); +require("scripts/globals/status"); +require("scripts/globals/zone"); +----------------------------------- + +function onInitialize(zone) + UpdateNMSpawnPoint(ID.mob.JORMUNGAND); + GetMobByID(ID.mob.JORMUNGAND):setRespawnTime(math.random(86400, 259200)); +end; + +function onConquestUpdate(zone, updatetype) + dsp.conq.onConquestUpdate(zone, updatetype) +end; + +function onZoneIn(player,prevZone) + local cs = -1; + if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos(363.025,16,-60,12); + end + if (player:getCurrentMission(COP) == dsp.mission.id.cop.DAWN and player:getCharVar("COP_louverance_story")== 1 ) then + cs=17; + end + return cs; +end; + +function onRegionEnter(player,region) +end; + +function onEventUpdate(player,csid,option) +end; + +function onEventFinish(player,csid,option) + if (csid == 17) then + player:setCharVar("COP_louverance_story",2); + end +end; + +function onZoneWeatherChange(weather) + local waterfall = GetNPCByID(ID.npc.WATERFALL); + if (weather == dsp.weather.SNOW or weather == dsp.weather.BLIZZARDS) then + if (waterfall:getAnimation() ~= dsp.anim.CLOSE_DOOR) then + waterfall:setAnimation(dsp.anim.CLOSE_DOOR); + end + else + if (waterfall:getAnimation() ~= dsp.anim.OPEN_DOOR) then + waterfall:setAnimation(dsp.anim.OPEN_DOOR); + end + end +end; From aa7c95c30790872f46cac0dd1e52ea1378a531c1 Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Mon, 16 Dec 2019 15:50:24 -0500 Subject: [PATCH 8/9] Update player_controller.cpp entry point for RA state, disallow RA if resting/synthing/sitting --- src/map/ai/controllers/player_controller.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/map/ai/controllers/player_controller.cpp b/src/map/ai/controllers/player_controller.cpp index 864e213d55a..b43d1b96033 100644 --- a/src/map/ai/controllers/player_controller.cpp +++ b/src/map/ai/controllers/player_controller.cpp @@ -122,7 +122,12 @@ bool CPlayerController::Ability(uint16 targid, uint16 abilityid) bool CPlayerController::RangedAttack(uint16 targid) { auto PChar = static_cast(POwner); - if (PChar->PAI->CanChangeState()) + uint8 anim = PChar->animation; + if (anim != ANIMATION_NONE && anim != ANIMATION_ATTACK) + { + PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 0, MSGBASIC_CANNOT_PERFORM_ACTION)); + } + else if (PChar->PAI->CanChangeState()) { return PChar->PAI->Internal_RangedAttack(targid); } From 24e4e2bfc7f06f8d77354e2c915e3df67b3382b4 Mon Sep 17 00:00:00 2001 From: Caelic <36283957+Caelic@users.noreply.github.com> Date: Mon, 16 Dec 2019 15:53:44 -0500 Subject: [PATCH 9/9] Update range_state.cpp completion check for RA, disallow completion of the RA if the player has started resting/synthing/sitting during their aiming --- src/map/ai/states/range_state.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/map/ai/states/range_state.cpp b/src/map/ai/states/range_state.cpp index fa4501c80c0..5510c64f636 100644 --- a/src/map/ai/states/range_state.cpp +++ b/src/map/ai/states/range_state.cpp @@ -191,6 +191,12 @@ bool CRangeState::CanUseRangedAttack(CBattleEntity* PTarget) m_errorMsg = std::make_unique(m_PEntity, PTarget, 0, 0, MSGBASIC_CANNOT_PERFORM_ACTION); return false; } + uint8 anim = m_PEntity->animation; + if (anim != ANIMATION_NONE && anim != ANIMATION_ATTACK) + { + m_errorMsg = std::make_unique(m_PEntity, PTarget, 0, 0, MSGBASIC_CANNOT_PERFORM_ACTION); + return false; + } return true; }