1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 06:47:45 +00:00
sapphire/src/servers/sapphire_zone/Zone/InstanceContent.h

102 lines
3.2 KiB
C
Raw Normal View History

#ifndef SAPPHIRE_INSTANCECONTENT_H
#define SAPPHIRE_INSTANCECONTENT_H
#include "Zone.h"
#include "Event/Director.h"
#include "Forwards.h"
namespace Core
{
namespace Data
{
struct InstanceContent;
}
class InstanceContent : public Event::Director, public Zone
{
public:
2018-01-28 22:36:43 +01:00
enum InstanceContentState
{
Created,
DutyReset,
DutyInProgress,
2018-01-28 22:36:43 +01:00
DutyFinished
};
InstanceContent( boost::shared_ptr< Core::Data::InstanceContent > instanceConfiguration,
uint32_t guId,
const std::string& internalName,
2018-01-29 19:41:41 +01:00
const std::string& contentName,
uint32_t instanceContentId );
virtual ~InstanceContent();
bool init() override;
2018-03-05 14:35:03 +01:00
void onBeforePlayerZoneIn( Entity::Player& player ) override;
void onPlayerZoneIn( Entity::Player& player ) override;
void onLeaveTerritory( Entity::Player& player ) override;
void onFinishLoading( Entity::Player& player ) override;
void onInitDirector( Entity::Player& player ) override;
void onSomeDirectorEvent( Entity::Player& player ) override;
void onUpdate( uint32_t currTime ) override;
void onTalk( Entity::Player& player, uint32_t eventId, uint64_t actorId );
2018-03-05 22:10:14 +11:00
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override;
void onRegisterEObj( Entity::EventObjectPtr object ) override;
void setVar( uint8_t index, uint8_t value );
void setSequence( uint8_t value );
void setBranch( uint8_t value );
2018-03-10 00:06:44 +09:00
void startQte();
void startEventCutscene();
void endEventCutscene();
2018-03-15 20:48:35 +11:00
/*! set the current bgm index (inside bgm.exd) */
void setCurrentBGM( uint16_t bgmId );
/*! set the current bgm for a specific player */
void setPlayerBGM( Entity::Player& player, uint16_t bgmId );
2018-03-15 20:48:35 +11:00
/*! get the currently playing bgm index */
uint16_t getCurrentBGM() const;
bool hasPlayerPreviouslySpawned( Entity::Player& player ) const;
InstanceContentState getState() const;
boost::shared_ptr< Core::Data::InstanceContent > getInstanceConfiguration() const;
2018-01-29 19:41:41 +01:00
uint32_t getInstanceContentId() const;
2018-01-29 20:40:32 +11:00
Entity::EventObjectPtr getEObjByName( const std::string& name );
2018-03-15 23:37:21 +01:00
/*! binds a player to the instance */
bool bindPlayer( uint32_t playerId );
/*! removes bind of player from the instance */
void unbindPlayer( uint32_t playerId );
/*! return true if the player is bound to the instance */
bool isPlayerBound( uint32_t playerId ) const;
2018-03-06 18:00:57 +11:00
/*! number of milliseconds after all players are ready for the instance to commence (spawn circle removed) */
const uint32_t instanceStartDelay = 1250;
2018-03-15 23:37:21 +01:00
private:
boost::shared_ptr< Core::Data::InstanceContent > m_instanceConfiguration;
2018-01-29 20:40:32 +11:00
uint32_t m_instanceContentId;
2018-01-29 19:41:41 +01:00
InstanceContentState m_state;
2018-03-15 20:48:35 +11:00
uint16_t m_currentBgm;
int64_t m_instanceExpireTime;
2018-03-06 13:33:10 +11:00
int64_t m_instanceCommenceTime;
Entity::EventObjectPtr m_pEntranceEObj;
std::map< std::string, Entity::EventObjectPtr > m_eventObjectMap;
std::unordered_map< uint32_t, Entity::EventObjectPtr > m_eventIdToObjectMap;
std::set< uint32_t > m_spawnedPlayers;
2018-03-15 23:37:21 +01:00
// the players which are bound to the instance, regardless of inside or offline
std::set< uint32_t > m_boundPlayerIds;
};
}
#endif //SAPPHIRE_INSTANCECONTENT_H