mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/Spells: implement SMSG_MOUNT_RESULT and use it for transformed mounting cases (#24404)
This commit is contained in:
@@ -6516,4 +6516,19 @@ enum class GameError : uint32
|
||||
ERR_NOT_IN_PET_BATTLE = 1047,
|
||||
};
|
||||
|
||||
enum class MountResult : uint32
|
||||
{
|
||||
InvalidMountee = 0,
|
||||
TooFarAway = 1,
|
||||
AlreadyMounted = 2,
|
||||
NotMountable = 3,
|
||||
NotYourPet = 4,
|
||||
Other = 5,
|
||||
Looting = 6,
|
||||
RaceCantMount = 7,
|
||||
Shapeshifted = 8,
|
||||
ForcedDismount = 9,
|
||||
Ok = 10 // never sent
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -960,3 +960,10 @@ WorldPacket const* WorldPackets::Spells::CustomLoadScreen::Write()
|
||||
_worldPacket << uint32(LoadingScreenID);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Spells::MountResult::Write()
|
||||
{
|
||||
_worldPacket << int32(Result);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -999,6 +999,16 @@ namespace WorldPackets
|
||||
uint32 TeleportSpellID;
|
||||
uint32 LoadingScreenID;
|
||||
};
|
||||
|
||||
class MountResult final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
MountResult() : ServerPacket(SMSG_MOUNT_RESULT, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Result = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1465,7 +1465,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MODIFY_PARTY_RANGE, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOTD, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOUNT_EQUIPMENT_APPLY_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOUNT_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOUNT_RESULT, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_APPLY_MOVEMENT_FORCE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_DISABLE_COLLISION, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_DISABLE_DOUBLE_JUMP, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
|
||||
@@ -3952,6 +3952,23 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint32 sp
|
||||
caster->GetSession()->SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
void Spell::SendMountResult(MountResult result)
|
||||
{
|
||||
if (result == MountResult::Ok)
|
||||
return;
|
||||
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* caster = m_caster->ToPlayer();
|
||||
if (caster->IsLoading()) // don't send mount results at loading time
|
||||
return;
|
||||
|
||||
WorldPackets::Spells::MountResult packet;
|
||||
packet.Result = AsUnderlyingType(result);
|
||||
caster->SendDirectMessage(packet.Write());
|
||||
}
|
||||
|
||||
void Spell::SendSpellStart()
|
||||
{
|
||||
if (!IsNeedSendToClient())
|
||||
@@ -5712,7 +5729,10 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
|
||||
return SPELL_FAILED_NO_MOUNTS_ALLOWED;
|
||||
|
||||
if (m_caster->IsInDisallowedMountForm())
|
||||
return SPELL_FAILED_NOT_SHAPESHIFT;
|
||||
{
|
||||
SendMountResult(MountResult::Shapeshifted); // mount result gets sent before the cast result
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -576,6 +576,7 @@ class TC_GAME_API Spell
|
||||
static void SendCastResult(Player* caster, SpellInfo const* spellInfo, uint32 spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE, uint32* param1 = nullptr, uint32* param2 = nullptr);
|
||||
void SendCastResult(SpellCastResult result, uint32* param1 = nullptr, uint32* param2 = nullptr) const;
|
||||
void SendPetCastResult(SpellCastResult result, uint32* param1 = nullptr, uint32* param2 = nullptr) const;
|
||||
void SendMountResult(MountResult result);
|
||||
void SendSpellStart();
|
||||
void SendSpellGo();
|
||||
void SendSpellCooldown();
|
||||
|
||||
Reference in New Issue
Block a user