1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 23:27:45 +00:00

cleanup aetheryte code, refactor aetheryte/aethernet scriptid

also revert changes in regards to debugcommandptr, out of scope of this PR
This commit is contained in:
GokuWeedLord 2017-12-12 20:28:57 +11:00
parent 7dd5d73f5a
commit a59b3185e3
3 changed files with 34 additions and 47 deletions

View file

@ -29,18 +29,19 @@ public:
} }
else if( param1 == 512 ) // aethernet access else if( param1 == 512 ) // aethernet access
{ {
if( param2 == 2 ) // register favored destination if( param2 == 4 )
{
}
else if( param2 == 0xC3E1 ) // register free destination
{
}
else if( param2 == 4 )
{ {
player.teleport( param3, 2 ); player.teleport( param3, 2 );
} }
else if( param2 == 2 ) // register favored destination
{
}
// else if( param2 == 0xC3E1 ) // register free destination
// {
//
// }
} }
} ); } );
} }
@ -60,7 +61,7 @@ public:
player.learnAction( ACTION_TELEPORT ); player.learnAction( ACTION_TELEPORT );
} }
}, },
[] ( Entity::Player& ply, uint32_t evntId, uint64_t additional ) [] ( Entity::Player& player, uint32_t eventId, uint64_t additional )
{}, 0 ); {}, 0 );
} }
} }

View file

@ -36,8 +36,6 @@
#include <cinttypes> #include <cinttypes>
using DebugCommandPtr = boost::shared_ptr< DebugCommand >;
extern Core::Scripting::ScriptManager g_scriptMgr; extern Core::Scripting::ScriptManager g_scriptMgr;
extern Core::Data::ExdData g_exdData; extern Core::Data::ExdData g_exdData;
extern Core::Logger g_log; extern Core::Logger g_log;
@ -121,7 +119,7 @@ void Core::DebugCommandHandler::execCommand( char * data, Entity::Player& player
// Definition of the commands // Definition of the commands
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
void Core::DebugCommandHandler::help( char* data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::help( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
player.sendDebug( "Registered debug commands:" ); player.sendDebug( "Registered debug commands:" );
for ( auto cmd : m_commandMap ) for ( auto cmd : m_commandMap )
@ -133,7 +131,7 @@ void Core::DebugCommandHandler::help( char* data, Entity::Player& player, DebugC
} }
} }
void Core::DebugCommandHandler::set( char * data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
std::string subCommand = ""; std::string subCommand = "";
std::string params = ""; std::string params = "";
@ -285,7 +283,7 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, DebugC
} }
void Core::DebugCommandHandler::add( char * data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
std::string subCommand; std::string subCommand;
std::string params = ""; std::string params = "";
@ -402,7 +400,7 @@ void Core::DebugCommandHandler::add( char * data, Entity::Player& player, DebugC
} }
void Core::DebugCommandHandler::get( char * data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::get( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
std::string subCommand; std::string subCommand;
std::string params = ""; std::string params = "";
@ -446,21 +444,21 @@ void Core::DebugCommandHandler::get( char * data, Entity::Player& player, DebugC
} }
void Core::DebugCommandHandler::injectPacket( char * data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::injectPacket( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
auto pSession = g_serverZone.getSession( player.getId() ); auto pSession = g_serverZone.getSession( player.getId() );
if( pSession ) if( pSession )
pSession->getZoneConnection()->injectPacket( data + 7, player ); pSession->getZoneConnection()->injectPacket( data + 7, player );
} }
void Core::DebugCommandHandler::injectChatPacket( char * data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::injectChatPacket( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
auto pSession = g_serverZone.getSession( player.getId() ); auto pSession = g_serverZone.getSession( player.getId() );
if( pSession ) if( pSession )
pSession->getChatConnection()->injectPacket( data + 8, player ); pSession->getChatConnection()->injectPacket( data + 8, player );
} }
void Core::DebugCommandHandler::nudge( char * data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::nudge( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
std::string subCommand; std::string subCommand;
@ -507,19 +505,19 @@ void Core::DebugCommandHandler::nudge( char * data, Entity::Player& player, Debu
} }
} }
void Core::DebugCommandHandler::serverInfo( char * data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::serverInfo( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
player.sendDebug( "SapphireServer " + Version::VERSION + "\nRev: " + Version::GIT_HASH ); player.sendDebug( "SapphireServer " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ ); player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
player.sendDebug( "Sessions: " + std::to_string( g_serverZone.getSessionCount() ) ); player.sendDebug( "Sessions: " + std::to_string( g_serverZone.getSessionCount() ) );
} }
void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::Player& player, DebugCommandPtr command ) void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
{ {
player.unlock(); player.unlock();
} }
void Core::DebugCommandHandler::script( char* data, Entity::Player &player, DebugCommandPtr command ) void Core::DebugCommandHandler::script( char* data, Entity::Player &player, boost::shared_ptr< DebugCommand > command )
{ {
std::string subCommand; std::string subCommand;
std::string params = ""; std::string params = "";

View file

@ -113,19 +113,21 @@ bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t ac
% static_cast< uint64_t >( eventId & 0xFFFFFFF ) ) + ")" ); % static_cast< uint64_t >( eventId & 0xFFFFFFF ) ) + ")" );
uint16_t eventType = eventId >> 16; uint16_t eventType = eventId >> 16;
uint32_t scriptId = eventId;
// aethernet/aetherytes need to be handled separately // aethernet/aetherytes need to be handled separately
// todo: probably a nicer way to do this would be to switch the param for getQuestScript
if( eventType == Common::EventType::Aetheryte ) if( eventType == Common::EventType::Aetheryte )
{ {
auto aetherInfo = g_exdData.getAetheryteInfo( eventId & 0xFFFF ); auto aetherInfo = g_exdData.getAetheryteInfo( eventId & 0xFFFF );
auto scriptId = 0x50000; scriptId = 0x50000;
if( !aetherInfo->isAetheryte ) if( !aetherInfo->isAetheryte )
scriptId = 0x50001; scriptId = 0x50001;
}
auto script = m_nativeScriptHandler->getQuestScript( scriptId ); auto script = m_nativeScriptHandler->getQuestScript( scriptId );
if( !script ) if( script )
return false; {
player.sendDebug( "Calling: " + objName + "." + eventName );
player.eventStart( actorId, eventId, Event::Event::Talk, 0, 0 ); player.eventStart( actorId, eventId, Event::Event::Talk, 0, 0 );
@ -135,31 +137,17 @@ bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t ac
} }
else else
{ {
auto script = m_nativeScriptHandler->getQuestScript( eventId ); if ( eventType == Common::EventType::Quest )
if( script )
{ {
player.sendDebug( "Calling: " + objName + "." + eventName ); auto questInfo = g_exdData.getQuestInfo( eventId );
if ( questInfo )
player.eventStart( actorId, eventId, Event::Event::Talk, 0, 0 );
script->onTalk( eventId, player, actorId );
player.checkEvent( eventId );
}
else
{
if ( eventType == Common::EventType::Quest )
{ {
auto questInfo = g_exdData.getQuestInfo( eventId ); player.sendUrgent( "Quest not implemented: " + questInfo->name );
if ( questInfo )
{
player.sendUrgent( "Quest not implemented: " + questInfo->name );
}
} }
return false;
} }
return false;
} }
return true; return true;