1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-04 09:47:46 +00:00

director sequence/branch setters & debug command

This commit is contained in:
Adam 2018-02-28 22:25:11 +11:00
parent e0f0414a75
commit 841e292e9b
5 changed files with 62 additions and 5 deletions

View file

@ -709,15 +709,13 @@ void Core::DebugCommandHandler::instance( char* data, Entity::Player &player, bo
} }
else if( subCommand == "set" ) else if( subCommand == "set" )
{ {
uint32_t instanceId;
uint32_t index; uint32_t index;
uint32_t value; uint32_t value;
sscanf( params.c_str(), "%d %d %d", &instanceId, &index, &value ); sscanf( params.c_str(), "%d %d", &index, &value );
auto pInstance = g_territoryMgr.getInstanceZonePtr( instanceId ); auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !pInstance ) if( !instance )
return; return;
auto instance = boost::dynamic_pointer_cast< InstanceContent >( pInstance );
instance->setVar( static_cast< uint8_t >( index ), static_cast< uint8_t >( value ) ); instance->setVar( static_cast< uint8_t >( index ), static_cast< uint8_t >( value ) );
} }
@ -738,6 +736,30 @@ void Core::DebugCommandHandler::instance( char* data, Entity::Player &player, bo
obj->setState( state ); obj->setState( state );
} }
else if( subCommand == "seq" )
{
uint8_t seq;
sscanf( params.c_str(), "%hhu", &seq );
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
instance->setSequence( seq );
}
else if( subCommand == "branch" )
{
uint8_t branch;
sscanf( params.c_str(), "%hhu", &branch );
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
instance->setBranch( branch );
}
else if( subCommand == "festival" ) else if( subCommand == "festival" )
{ {
uint32_t festivalId; uint32_t festivalId;

View file

@ -168,3 +168,13 @@ void Core::Event::Director::setDirectorUI8JH( uint8_t value )
{ {
m_unionData.ui8lh.UI8JH = value; m_unionData.ui8lh.UI8JH = value;
} }
void Core::Event::Director::setDirectorBranch( uint8_t value )
{
m_branch = value;
}
void Core::Event::Director::setDirectorSequence( uint8_t value )
{
m_sequence = value;
}

View file

@ -72,6 +72,9 @@ public:
void setDirectorUI8JL( uint8_t value ); void setDirectorUI8JL( uint8_t value );
void setDirectorUI8JH( uint8_t value ); void setDirectorUI8JH( uint8_t value );
void setDirectorSequence( uint8_t value );
void setDirectorBranch( uint8_t value );
private: private:
/*! Id of the content of the director */ /*! Id of the content of the director */
uint16_t m_contentId; uint16_t m_contentId;

View file

@ -227,6 +227,26 @@ void Core::InstanceContent::setVar( uint8_t index, uint8_t value )
} }
} }
void Core::InstanceContent::setSequence( uint8_t value )
{
setDirectorSequence( value );
for( const auto &playerIt : m_playerMap )
{
sendDirectorVars( *playerIt.second );
}
}
void Core::InstanceContent::setBranch( uint8_t value )
{
setDirectorBranch( value );
for( const auto &playerIt : m_playerMap )
{
sendDirectorVars( *playerIt.second );
}
}
void Core::InstanceContent::onRegisterEObj( Entity::EventObjectPtr object ) void Core::InstanceContent::onRegisterEObj( Entity::EventObjectPtr object )
{ {
if( object->getName() != "none" ) if( object->getName() != "none" )

View file

@ -41,6 +41,8 @@ public:
void onRegisterEObj( Entity::EventObjectPtr object ) override; void onRegisterEObj( Entity::EventObjectPtr object ) override;
void setVar( uint8_t index, uint8_t value ); void setVar( uint8_t index, uint8_t value );
void setSequence( uint8_t value );
void setBranch( uint8_t value );
boost::shared_ptr< Core::Data::InstanceContent > getInstanceContentInfo() const; boost::shared_ptr< Core::Data::InstanceContent > getInstanceContentInfo() const;