mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
Questbattle fail can be triggerd using a command and will remove you from the battle
This commit is contained in:
parent
921bad031d
commit
28f47643aa
3 changed files with 24 additions and 5 deletions
|
@ -490,6 +490,9 @@ bool Sapphire::Entity::Player::exitInstance()
|
|||
auto pZone = getCurrentZone();
|
||||
auto pInstance = pZone->getAsInstanceContent();
|
||||
|
||||
resetHp();
|
||||
resetMp();
|
||||
|
||||
// check if housing zone
|
||||
if( pTeriMgr->isHousingTerritory( m_prevTerritoryTypeId ) )
|
||||
{
|
||||
|
|
|
@ -93,12 +93,14 @@ void Sapphire::QuestBattle::onEnterSceneFinish( Entity::Player& player )
|
|||
|
||||
void Sapphire::QuestBattle::onUpdate( uint64_t tickCount )
|
||||
{
|
||||
if( !m_pPlayer )
|
||||
return;
|
||||
|
||||
switch( m_state )
|
||||
{
|
||||
case Created:
|
||||
{
|
||||
if( !m_pPlayer )
|
||||
return;
|
||||
|
||||
|
||||
if( !m_pPlayer->isLoadingComplete() ||
|
||||
!m_pPlayer->isDirectorInitialized() ||
|
||||
|
@ -131,7 +133,20 @@ void Sapphire::QuestBattle::onUpdate( uint64_t tickCount )
|
|||
break;
|
||||
|
||||
case DutyFailed:
|
||||
setSequence( 0xFE );
|
||||
{
|
||||
if( getSequence() != 0xFE )
|
||||
{
|
||||
setSequence( 0xFE );
|
||||
m_instanceFailTime = tickCount;
|
||||
}
|
||||
|
||||
if( ( static_cast< int64_t >( tickCount ) - static_cast< int64_t >( m_instanceFailTime ) ) > 6000 )
|
||||
{
|
||||
m_pPlayer->exitInstance();
|
||||
m_pPlayer.reset();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
|
@ -349,7 +364,7 @@ void Sapphire::QuestBattle::success()
|
|||
|
||||
void Sapphire::QuestBattle::fail()
|
||||
{
|
||||
|
||||
m_state = DutyFailed;
|
||||
}
|
||||
|
||||
uint32_t Sapphire::QuestBattle::getQuestId() const
|
||||
|
|
|
@ -84,8 +84,9 @@ namespace Sapphire
|
|||
uint32_t m_questBattleId;
|
||||
Event::Director::DirectorState m_state;
|
||||
|
||||
int64_t m_instanceExpireTime;
|
||||
uint64_t m_instanceExpireTime;
|
||||
uint64_t m_instanceCommenceTime;
|
||||
uint64_t m_instanceFailTime;
|
||||
|
||||
std::map< std::string, Entity::EventObjectPtr > m_eventObjectMap;
|
||||
std::unordered_map< uint32_t, Entity::EventObjectPtr > m_eventIdToObjectMap;
|
||||
|
|
Loading…
Add table
Reference in a new issue