feat: add incoming messages to bot

This commit is contained in:
k0t9i
2023-02-09 18:30:07 +04:00
parent 130cdc6bca
commit eefb5d40ae
27 changed files with 25280 additions and 111 deletions

View File

@@ -0,0 +1,62 @@
#pragma once
#include <memory>
namespace L2Bot::Domain::Serializers
{
class IncomingMessage
{
public:
enum class Type
{
none,
invalidate,
move,
acquireTarget,
attack,
pickup,
useSkill,
useItem,
toggleSoulshot,
sit,
stand
};
const Type GetType() const
{
return m_Type;
}
template <typename T>
const auto GetContent() const
{
return std::static_pointer_cast<T>(m_Content);
}
template <typename T>
const T GetRawContent() const
{
return *std::static_pointer_cast<T>(m_Content).get();
}
IncomingMessage(Type type, std::shared_ptr<void> content) :
m_Type(type),
m_Content(content)
{
}
IncomingMessage(Type type) :
m_Type(type)
{
}
IncomingMessage() = default;
virtual ~IncomingMessage() = default;
private:
Type m_Type = Type::none;
std::shared_ptr<void> m_Content;
};
}