diff options
| author | Shauren <shauren.trinity@gmail.com> | 2024-04-06 20:50:59 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2024-04-06 20:50:59 +0200 |
| commit | b265c49977235dea5e7e69d7b6fb93f4943bf87a (patch) | |
| tree | b7912d3874436ff841dbb672e0495dc9d4c71b5b /src/server/game/Entities/Player | |
| parent | 49cf605ef158cffe047d13b14920e47d4568e62f (diff) | |
Core/Scripts: Integrate new ActionResultSetter with movement generators and spells
Diffstat (limited to 'src/server/game/Entities/Player')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 16 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 10 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 59c2f990f6a..a59c6b47328 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -22501,7 +22501,7 @@ UF::PVPInfo const* Player::GetPvpInfoForBracket(int8 bracket) const } bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= nullptr*/, uint32 spellid /*= 0*/, uint32 preferredMountDisplay /*= 0*/, - Optional<float> speed /*= {}*/) + Optional<float> speed /*= {}*/, Optional<Scripting::v2::ActionResultSetter<MovementStopReason>> const& scriptResult /*= {}*/) { if (nodes.size() < 2) { @@ -22681,18 +22681,19 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc ModifyMoney(-int64(firstcost)); UpdateCriteria(CriteriaType::MoneySpentOnTaxis, firstcost); GetSession()->SendActivateTaxiReply(ERR_TAXIOK); - StartTaxiMovement(mount_display_id, sourcepath, 0, speed); + StartTaxiMovement(mount_display_id, sourcepath, 0, speed, Optional<Scripting::v2::ActionResultSetter<MovementStopReason>>(scriptResult)); } return true; } -bool Player::ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid /*= 0*/, Optional<float> speed /*= {}*/) +bool Player::ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid /*= 0*/, Optional<float> speed /*= {}*/, + Optional<Scripting::v2::ActionResultSetter<MovementStopReason>> const& scriptResult /*= {}*/) { TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(taxi_path_id); if (!entry) return false; - return ActivateTaxiPathTo({ { entry->FromTaxiNode, entry->ToTaxiNode } }, nullptr, spellid, 0, speed); + return ActivateTaxiPathTo({ { entry->FromTaxiNode, entry->ToTaxiNode } }, nullptr, spellid, 0, speed, scriptResult); } void Player::FinishTaxiFlight() @@ -22758,10 +22759,11 @@ void Player::ContinueTaxiFlight() } } - StartTaxiMovement(mountDisplayId, path, startNode, {}); + StartTaxiMovement(mountDisplayId, path, startNode, {}, {}); } -void Player::StartTaxiMovement(uint32 mountDisplayId, uint32 path, uint32 pathNode, Optional<float> speed) +void Player::StartTaxiMovement(uint32 mountDisplayId, uint32 path, uint32 pathNode, Optional<float> speed, + Optional<Scripting::v2::ActionResultSetter<MovementStopReason>>&& scriptResult) { // remove fake death RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::Interacting); @@ -22769,7 +22771,7 @@ void Player::StartTaxiMovement(uint32 mountDisplayId, uint32 path, uint32 pathNo if (mountDisplayId) Mount(mountDisplayId); - GetMotionMaster()->MoveTaxiFlight(path, pathNode, speed); + GetMotionMaster()->MoveTaxiFlight(path, pathNode, speed, std::move(scriptResult)); } void Player::InitDataForForm(bool reapplyMods) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index e4b62c7bafc..9e28636a07f 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -103,6 +103,7 @@ enum InventoryType : uint8; enum ItemClass : uint8; enum LootError : uint8; enum LootType : uint8; +enum class MovementStopReason : uint8; enum PlayerRestState : uint8; enum class PlayerCreateMode : int8; enum RestTypes : uint8; @@ -1164,12 +1165,15 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player> PlayerTaxi m_taxi; void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), GetLevel()); } - bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 0, uint32 preferredMountDisplay = 0, Optional<float> speed = {}); - bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0, Optional<float> speed = {}); + bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 0, uint32 preferredMountDisplay = 0, Optional<float> speed = {}, + Optional<Scripting::v2::ActionResultSetter<MovementStopReason>> const& scriptResult = {}); + bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0, Optional<float> speed = {}, + Optional<Scripting::v2::ActionResultSetter<MovementStopReason>> const& scriptResult = {}); void FinishTaxiFlight(); void CleanupAfterTaxiFlight(); void ContinueTaxiFlight(); - void StartTaxiMovement(uint32 mountDisplayId, uint32 path, uint32 pathNode, Optional<float> speed); + void StartTaxiMovement(uint32 mountDisplayId, uint32 path, uint32 pathNode, Optional<float> speed, + Optional<Scripting::v2::ActionResultSetter<MovementStopReason>>&& scriptResult); bool IsDeveloper() const { return HasPlayerFlag(PLAYER_FLAGS_DEVELOPER); } void SetDeveloper(bool on) { if (on) SetPlayerFlag(PLAYER_FLAGS_DEVELOPER); else RemovePlayerFlag(PLAYER_FLAGS_DEVELOPER); } |
