1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-11 21:17:45 +00:00
sapphire/src/world/Event/Director.h

136 lines
2.9 KiB
C
Raw Normal View History

#pragma once
2018-01-09 23:50:54 +01:00
2018-03-06 22:22:19 +01:00
#include <Common.h>
2018-01-09 23:50:54 +01:00
#include "ForwardsZone.h"
2018-01-09 23:50:54 +01:00
namespace Sapphire::Event
2018-01-09 23:50:54 +01:00
{
2018-10-28 21:53:21 +01:00
/*!
\class Director
\brief Base class for all Directors implements sequence and variables
2018-10-28 21:53:21 +01:00
*/
2018-10-28 21:53:21 +01:00
class Director
{
2018-10-28 21:53:21 +01:00
public:
enum DirectorType
{
BattleLeve = 0x8001,
GatheringLeve = 0x8002,
InstanceContent = 0x8003, // used for dungeons/raids
PublicContent = 0x8004,
QuestBattle = 0x8006,
CompanyLeve = 0x8007,
TreasureHunt = 0x8009,
2018-10-28 21:53:21 +01:00
GoldSaucer = 0x800A,
CompanyCraftDirector = 0x800B,
2018-10-28 21:53:21 +01:00
DpsChallange = 0x800D,
Fate = 0x801A
2019-03-31 01:39:49 +01:00
};
enum DirectorSetupFlags : uint8_t
{
ClearTodo = 0x01,
Unknown02 = 0x02,
Unknown04 = 0x04,
Unknown08 = 0x08,
Unknown10 = 0x10,
Unknown20 = 0x20, //Do some chat msg
Unknown40 = 0x40,
Unknown80 = 0x80,
};
enum DirectorSceneId : uint8_t
{
Opening = 0x01,
Enter = 0x02,
Reset = 0x03,
Cutscene = 0x04,
Failed = 0x05,
Complete = 0x06
};
2019-03-31 01:39:49 +01:00
enum DirectorState
{
Created,
DutyReset,
DutyInProgress,
DutyFinished,
DutyFailed
2018-10-28 21:53:21 +01:00
};
Director( DirectorType type, uint16_t contentId );
2018-10-28 21:53:21 +01:00
uint32_t getDirectorId() const;
uint16_t getContextId() const;
2018-10-28 21:53:21 +01:00
DirectorType getType() const;
2018-10-28 21:53:21 +01:00
uint8_t getSequence() const;
uint8_t getFlags() const;
2018-10-28 21:53:21 +01:00
void sendDirectorInit( Entity::Player& player ) const;
2018-10-28 21:53:21 +01:00
void sendDirectorClear( Entity::Player& player ) const;
2018-10-28 21:53:21 +01:00
void sendDirectorVars( Entity::Player& player ) const;
2018-10-28 21:53:21 +01:00
void setDirectorSequence( uint8_t value );
void setDirectorFlags( uint8_t value );
/*!
* @brief Sets a value of a director var
* @param index of var to set
* @param value to set
*/
void setDirectorVar( uint8_t index, uint8_t value );
/*!
* @brief Sets a value of a director var
* @param index of var to set
* @param value to set left shifted. Just first 4 bits. Discards last bits
* @param value to set right shifted. Just first 4 bits. Discards last bits
*/
void setDirectorVar( uint8_t index, uint8_t valueLeft, uint8_t valueRight );
/*!
* @brief Gets a value of a director var
* @param index of var to get
* @return 8 bits of selected index
*/
uint8_t getDirectorVar( uint8_t index );
/*!
* @brief Gets a value of a director var in 4 bits
* @param index of var to get
* @param shiftLeft if true, last 4 bits otherwise first 4 bits
* @return 4 bits of selected index
*/
uint8_t getDirectorVar( uint8_t index, bool shiftLeft );
2018-10-28 21:53:21 +01:00
private:
/*! Id of the content of the director */
uint16_t m_contextId;
2018-10-28 21:53:21 +01:00
/*! DirectorType | ContentId */
uint32_t m_directorId;
2018-10-28 21:53:21 +01:00
/*! currect sequence */
uint8_t m_sequence;
/*! current flags */
uint8_t m_flags;
uint8_t m_vars[ 10 ];
2018-10-28 21:53:21 +01:00
/*! type of the director */
DirectorType m_type;
};
2018-01-09 23:50:54 +01:00
}