2018-01-09 23:50:54 +01:00
|
|
|
#ifndef _EVENT_H
|
|
|
|
#define _EVENT_H
|
|
|
|
|
2018-09-09 23:56:22 +02:00
|
|
|
#include "ForwardsZone.h"
|
2018-01-09 23:50:54 +01:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
namespace Sapphire::Event
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
struct SceneResult
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2018-11-25 23:20:56 +11:00
|
|
|
uint64_t actorId;
|
2018-10-28 21:53:21 +01:00
|
|
|
uint32_t eventId;
|
|
|
|
uint16_t param1;
|
|
|
|
uint16_t param2;
|
|
|
|
uint16_t param3;
|
|
|
|
uint16_t param4;
|
2018-08-29 21:40:59 +02:00
|
|
|
};
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
class EventHandler
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2018-10-28 21:53:21 +01:00
|
|
|
public:
|
|
|
|
enum EventType : uint8_t
|
|
|
|
{
|
|
|
|
Talk = 1,
|
|
|
|
Emote = 2,
|
|
|
|
DistanceBelow = 3,
|
|
|
|
DistanceOver = 4,
|
|
|
|
BattleReward = 5,
|
|
|
|
Craft = 6,
|
|
|
|
Nest = 7,
|
|
|
|
Item = 8,
|
|
|
|
Drop = 9,
|
|
|
|
WithinRange = 10,
|
|
|
|
OutsideRange = 11,
|
|
|
|
GameStart = 12,
|
|
|
|
GameProgress = 13,
|
|
|
|
EnterTerritory = 15,
|
|
|
|
GameComeBack = 17,
|
|
|
|
ActionResult = 18,
|
|
|
|
MateriaCraft = 19,
|
|
|
|
Fishing = 20,
|
|
|
|
UI = 21,
|
|
|
|
Housing = 22,
|
|
|
|
Say = 23,
|
|
|
|
TableGame = 24,
|
|
|
|
};
|
|
|
|
|
2020-05-11 06:43:07 +09:00
|
|
|
enum class EventHandlerType : uint16_t
|
2018-10-28 21:53:21 +01:00
|
|
|
{
|
|
|
|
Quest = 0x0001,
|
|
|
|
Warp = 0x0002,
|
2019-07-14 17:26:13 +10:00
|
|
|
GatheringPoint = 0x0003, // Came up in the client with "Begin" unsure that means
|
2018-10-28 21:53:21 +01:00
|
|
|
Shop = 0x0004,
|
|
|
|
Aetheryte = 0x0005,
|
|
|
|
GuildLeveAssignment = 0x0006,
|
|
|
|
DefaultTalk = 0x0009,
|
2022-02-18 00:03:04 +01:00
|
|
|
Crafting = 0x000A,
|
2018-10-28 21:53:21 +01:00
|
|
|
CustomTalk = 0x000B,
|
|
|
|
CompanyLeveOfficer = 0x000C,
|
2020-05-11 12:12:12 -07:00
|
|
|
Array = 0x000D,
|
2018-10-28 21:53:21 +01:00
|
|
|
CraftLeve = 0x000E,
|
|
|
|
GimmickAccessor = 0x000F,
|
|
|
|
GimmickBill = 0x0010,
|
|
|
|
GimmickRect = 0x0011,
|
|
|
|
ChocoboTaxiStand = 0x0012,
|
|
|
|
Opening = 0x0013,
|
|
|
|
ExitRange = 0x0014,
|
2022-02-18 00:03:04 +01:00
|
|
|
Fish = 0x0015,
|
2018-10-28 21:53:21 +01:00
|
|
|
GCShop = 0x0016,
|
|
|
|
GuildOrderGuide = 0x0017,
|
|
|
|
GuildOrderOfficer = 0x0018,
|
|
|
|
ContentNpc = 0x0019,
|
|
|
|
Story = 0x001A,
|
|
|
|
SpecialShop = 0x001B,
|
|
|
|
BahamutGuide = 0x001C,
|
2020-05-11 12:12:12 -07:00
|
|
|
InstanceContentGuide = 0x001D,
|
2018-11-21 10:27:52 +11:00
|
|
|
HousingAethernet = 0x001E,
|
2022-02-18 00:03:04 +01:00
|
|
|
SwitchTalk = 0x001F,
|
|
|
|
Adventure = 0x0020,
|
|
|
|
DailyQuestSupply = 0x0021,
|
2021-08-30 10:16:05 +02:00
|
|
|
TripleTriad = 0x0023,
|
|
|
|
PreHandler = 0x0036,
|
2018-10-28 21:53:21 +01:00
|
|
|
ICDirector = 0x8003,
|
2021-08-16 17:18:29 +09:00
|
|
|
PublicContentDirector = 0x8004,
|
2019-03-31 23:45:03 +02:00
|
|
|
QuestBattleDirector = 0x8006,
|
2018-10-28 21:53:21 +01:00
|
|
|
};
|
|
|
|
|
2021-09-08 11:25:16 +02:00
|
|
|
enum class QuestAvailability : uint8_t
|
2021-09-07 16:50:13 +02:00
|
|
|
{
|
|
|
|
Invisible,
|
|
|
|
Available,
|
|
|
|
Locked
|
|
|
|
};
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
using SceneReturnCallback = std::function< void( Entity::Player&, const SceneResult& ) >;
|
|
|
|
using SceneChainCallback = std::function< void( Entity::Player& ) >;
|
2018-11-19 23:52:35 +01:00
|
|
|
using EventFinishCallback = std::function< void( Entity::Player&, uint64_t ) >;
|
2018-10-28 21:53:21 +01:00
|
|
|
|
2019-03-14 14:08:21 +01:00
|
|
|
EventHandler( uint64_t actorId, uint32_t eventId, EventType eventType, uint32_t eventParam );
|
2018-10-28 21:53:21 +01:00
|
|
|
|
|
|
|
~EventHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t getActorId() const;
|
|
|
|
|
|
|
|
uint32_t getId() const;
|
|
|
|
|
|
|
|
uint16_t getType() const;
|
|
|
|
|
|
|
|
uint16_t getEntryId() const;
|
|
|
|
|
|
|
|
uint8_t getEventType() const;
|
|
|
|
|
|
|
|
uint32_t getEventParam() const;
|
|
|
|
|
|
|
|
bool hasPlayedScene() const;
|
|
|
|
|
|
|
|
void setPlayedScene( bool playedScene );
|
|
|
|
|
|
|
|
SceneReturnCallback getEventReturnCallback() const;
|
|
|
|
|
|
|
|
void setEventReturnCallback( SceneReturnCallback callback );
|
|
|
|
|
|
|
|
SceneChainCallback getSceneChainCallback() const;
|
|
|
|
|
|
|
|
void setSceneChainCallback( SceneChainCallback callback );
|
|
|
|
|
2018-11-19 23:52:35 +01:00
|
|
|
EventFinishCallback getEventFinishCallback() const;
|
|
|
|
|
|
|
|
void setEventFinishCallback( EventFinishCallback callback );
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool hasNestedEvent() const;
|
|
|
|
|
|
|
|
void removeNestedEvent();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
uint64_t m_actorId;
|
|
|
|
uint32_t m_eventId;
|
|
|
|
uint16_t m_entryId;
|
|
|
|
uint16_t m_type;
|
|
|
|
uint8_t m_eventType;
|
|
|
|
uint32_t m_eventParam;
|
|
|
|
EventHandlerPtr m_pNestedEvent;
|
|
|
|
bool m_playedScene;
|
|
|
|
SceneReturnCallback m_returnCallback;
|
|
|
|
SceneChainCallback m_chainCallback;
|
2018-11-19 23:52:35 +01:00
|
|
|
EventFinishCallback m_finishCallback;
|
2018-10-28 21:53:21 +01:00
|
|
|
};
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-01-09 23:50:54 +01:00
|
|
|
}
|
|
|
|
#endif
|