1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 16:57:47 +00:00

Return implemented

This commit is contained in:
amibu 2017-08-10 16:31:48 +02:00
parent 78252ae96d
commit 32357ba812
6 changed files with 29 additions and 5 deletions

View file

@ -0,0 +1,18 @@
// Skill Name: Sprint
// Skill ID: 3
class skillDef_6Def
{
def skillDef_6Def()
{
}
def onFinish( player, target )
{
player.returnToHomepoint();
}
};
GLOBAL skillDef_6 = skillDef_6Def();

View file

@ -84,7 +84,7 @@ void Core::GameCommandHandler::execCommand( char * data, Core::Entity::PlayerPtr
if( it == m_commandMap.end() )
// no command found, do something... or not
g_log.error( "[" + std::to_string( pPlayer->getId() ) + "] " + "Command not found" );
pPlayer->sendUrgent( "Command not found." );
// TODO Notify the client of the failed command
else
{
@ -249,8 +249,6 @@ void Core::GameCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer
sscanf( params.c_str(), "%d", &id );
g_log.debug( std::to_string( pPlayer->getLevelForClass( static_cast<Core::Common::ClassJob> ( id ) ) ) );
if( pPlayer->getLevelForClass( static_cast<Core::Common::ClassJob> ( id ) ) == 0 )
{
pPlayer->setLevelForClass( 1, static_cast<Core::Common::ClassJob> ( id ) );

View file

@ -842,8 +842,7 @@ void Core::Network::GameConnection::actionHandler( Core::Network::Packets::GameP
}
case 0xC8: // return dead
{
pPlayer->setZoningType( Common::ZoneingType::Return );
pPlayer->teleport( pPlayer->getHomepoint(), 3 );
pPlayer->returnToHomepoint();
break;
}
case 0xC9: // Finish zoning

View file

@ -341,6 +341,12 @@ void Core::Entity::Player::forceZoneing( uint32_t zoneId )
//performZoning( zoneId, Common::ZoneingType::None, getPos() );
}
void Core::Entity::Player::returnToHomepoint()
{
setZoningType( Common::ZoneingType::Return );
teleport( getHomepoint(), 3 );
}
void Core::Entity::Player::setZone( uint32_t zoneId )
{
auto pPlayer = getAsPlayer();

View file

@ -302,6 +302,8 @@ public:
void setZone( uint32_t zoneId );
void forceZoneing( uint32_t zoneId );
/*! return player to preset homepoint */
void returnToHomepoint();
/*! change position, sends update too */
void changePosition( float x, float y, float z, float o );
/*! return the contentId */

View file

@ -48,6 +48,7 @@ int Core::Scripting::ScriptManager::init()
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::learnAction ), "learnAction" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getHomepoint ), "getHomepoint" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setHomepoint ), "setHomepoint" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::returnToHomepoint ), "returnToHomepoint" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::teleport ), "teleport" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::prepareZoning ), "prepareZoning" );