mirror of
https://github.com/Jous99/F4MP.git
synced 2026-01-12 17:10:54 +01:00
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <Events/PacketEvent.h>
|
|
#include <Messages/RemoveSpellRequest.h>
|
|
|
|
struct World;
|
|
struct SpellCastRequest;
|
|
struct InterruptCastRequest;
|
|
struct AddTargetRequest;
|
|
|
|
/**
|
|
* @brief Relays spell casting and magic effects.
|
|
*/
|
|
struct MagicService
|
|
{
|
|
MagicService(World& aWorld, entt::dispatcher& aDispatcher) noexcept;
|
|
~MagicService() noexcept = default;
|
|
|
|
TP_NOCOPYMOVE(MagicService);
|
|
|
|
protected:
|
|
/**
|
|
* @brief Relays spell cast messages to other clients.
|
|
*/
|
|
void OnSpellCastRequest(const PacketEvent<SpellCastRequest>& acMessage) const noexcept;
|
|
/**
|
|
* @brief Relays spell interrupt messages to other clients.
|
|
*/
|
|
void OnInterruptCastRequest(const PacketEvent<InterruptCastRequest>& acMessage) const noexcept;
|
|
/**
|
|
* @brief Relays magic effect messages to other clients.
|
|
*/
|
|
void OnAddTargetRequest(const PacketEvent<AddTargetRequest>& acMessage) const noexcept;
|
|
/**
|
|
* @brief Relays spell removal messages to other clients.
|
|
*/
|
|
void OnRemoveSpellRequest(const PacketEvent<RemoveSpellRequest>& acMessage) const noexcept;
|
|
|
|
|
|
private:
|
|
World& m_world;
|
|
|
|
entt::scoped_connection m_spellCastConnection;
|
|
entt::scoped_connection m_interruptCastConnection;
|
|
entt::scoped_connection m_addTargetConnection;
|
|
entt::scoped_connection m_removeSpellConnection;
|
|
};
|