2019-03-31 01:39:49 +01:00
|
|
|
#ifndef SAPPHIRE_QUESTBATTLE_H
|
|
|
|
#define SAPPHIRE_QUESTBATTLE_H
|
|
|
|
|
|
|
|
#include "Zone.h"
|
|
|
|
#include "Event/Director.h"
|
|
|
|
#include "Forwards.h"
|
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
namespace Sapphire::Data
|
|
|
|
{
|
2019-03-31 01:39:49 +01:00
|
|
|
struct QuestBattle;
|
|
|
|
}
|
2019-03-31 11:27:11 +02:00
|
|
|
|
|
|
|
namespace Sapphire
|
2019-03-31 01:39:49 +01:00
|
|
|
{
|
2019-03-31 11:27:11 +02:00
|
|
|
class QuestBattle : public Event::Director, public Zone
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QuestBattle( std::shared_ptr< Sapphire::Data::QuestBattle > pBattleDetails,
|
|
|
|
uint16_t territoryType,
|
|
|
|
uint32_t guId,
|
|
|
|
const std::string& internalName,
|
|
|
|
const std::string& contentName,
|
|
|
|
uint32_t questBattleId,
|
|
|
|
FrameworkPtr pFw );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
virtual ~QuestBattle();
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
bool init() override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onBeforePlayerZoneIn( Entity::Player& player ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onPlayerZoneIn( Entity::Player& player ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onLeaveTerritory( Entity::Player& player ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onFinishLoading( Entity::Player& player ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onInitDirector( Entity::Player& player ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onDirectorSync( Entity::Player& player ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onUpdate( uint32_t currTime ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onTalk( Entity::Player& player, uint32_t eventId, uint64_t actorId );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void onRegisterEObj( Entity::EventObjectPtr object ) override;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void setVar( uint8_t index, uint8_t value );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void setSequence( uint8_t value );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void setBranch( uint8_t value );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void startQte();
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void startEventCutscene();
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void endEventCutscene();
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
void clearDirector( Entity::Player& player );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
/*! set the current bgm index (inside bgm.exd) */
|
|
|
|
void setCurrentBGM( uint16_t bgmId );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
/*! set the current bgm for a specific player */
|
|
|
|
void setPlayerBGM( Entity::Player& player, uint16_t bgmId );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
/*! get the currently playing bgm index */
|
|
|
|
uint16_t getCurrentBGM() const;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
Event::Director::DirectorState getState() const;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
std::shared_ptr< Sapphire::Data::QuestBattle > getQuestBattleDetails() const;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
uint32_t getQuestBattleId() const;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
Entity::EventObjectPtr getEObjByName( const std::string& name );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
/*! binds a player to the instance */
|
|
|
|
bool bindPlayer( uint32_t playerId );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
/*! removes bind of player from the instance */
|
|
|
|
void unbindPlayer( uint32_t playerId );
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
/*! return true if the player is bound to the instance */
|
|
|
|
bool isPlayerBound( uint32_t playerId ) const;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
/*! number of milliseconds after all players are ready for the instance to commence (spawn circle removed) */
|
|
|
|
const uint32_t instanceStartDelay = 1250;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
private:
|
|
|
|
std::shared_ptr< Sapphire::Data::QuestBattle > m_pBattleDetails;
|
|
|
|
uint32_t m_questBattleId;
|
|
|
|
Event::Director::DirectorState m_state;
|
|
|
|
uint16_t m_currentBgm;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
int64_t m_instanceExpireTime;
|
|
|
|
uint64_t m_instanceCommenceTime;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 11:27:11 +02:00
|
|
|
std::map< std::string, Entity::EventObjectPtr > m_eventObjectMap;
|
|
|
|
std::unordered_map< uint32_t, Entity::EventObjectPtr > m_eventIdToObjectMap;
|
|
|
|
std::set< uint32_t > m_spawnedPlayers;
|
2019-03-31 01:39:49 +01:00
|
|
|
|
2019-03-31 23:45:03 +02:00
|
|
|
uint32_t m_boundPlayerId;
|
2019-03-31 11:27:11 +02:00
|
|
|
};
|
2019-03-31 01:39:49 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|