F4MP/tiltedcode/Code/server/Services/MagicService.h
Jous99 37b16f1547 code upload
codigo original de f4mp y tilted para referencias
2026-01-06 18:45:00 +01:00

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;
};