mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 07:37: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:
parent
7dd5d73f5a
commit
a59b3185e3
3 changed files with 34 additions and 47 deletions
|
@ -29,18 +29,19 @@ public:
|
|||
}
|
||||
else if( param1 == 512 ) // aethernet access
|
||||
{
|
||||
if( param2 == 2 ) // register favored destination
|
||||
{
|
||||
|
||||
}
|
||||
else if( param2 == 0xC3E1 ) // register free destination
|
||||
{
|
||||
|
||||
}
|
||||
else if( param2 == 4 )
|
||||
if( param2 == 4 )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
},
|
||||
[] ( Entity::Player& ply, uint32_t evntId, uint64_t additional )
|
||||
[] ( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||
{}, 0 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
|
||||
#include <cinttypes>
|
||||
|
||||
using DebugCommandPtr = boost::shared_ptr< DebugCommand >;
|
||||
|
||||
extern Core::Scripting::ScriptManager g_scriptMgr;
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
extern Core::Logger g_log;
|
||||
|
@ -121,7 +119,7 @@ void Core::DebugCommandHandler::execCommand( char * data, Entity::Player& player
|
|||
// 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:" );
|
||||
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 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 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 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() );
|
||||
if( pSession )
|
||||
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() );
|
||||
if( pSession )
|
||||
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;
|
||||
|
||||
|
@ -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( "Compiled: " __DATE__ " " __TIME__ );
|
||||
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();
|
||||
}
|
||||
|
||||
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 params = "";
|
||||
|
|
|
@ -113,19 +113,21 @@ bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t ac
|
|||
% static_cast< uint64_t >( eventId & 0xFFFFFFF ) ) + ")" );
|
||||
|
||||
uint16_t eventType = eventId >> 16;
|
||||
uint32_t scriptId = eventId;
|
||||
|
||||
// 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 )
|
||||
{
|
||||
auto aetherInfo = g_exdData.getAetheryteInfo( eventId & 0xFFFF );
|
||||
auto scriptId = 0x50000;
|
||||
scriptId = 0x50000;
|
||||
if( !aetherInfo->isAetheryte )
|
||||
scriptId = 0x50001;
|
||||
}
|
||||
|
||||
auto script = m_nativeScriptHandler->getQuestScript( scriptId );
|
||||
if( !script )
|
||||
return false;
|
||||
auto script = m_nativeScriptHandler->getQuestScript( scriptId );
|
||||
if( script )
|
||||
{
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
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
|
||||
{
|
||||
auto script = m_nativeScriptHandler->getQuestScript( eventId );
|
||||
if( script )
|
||||
if ( eventType == Common::EventType::Quest )
|
||||
{
|
||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
||||
|
||||
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 );
|
||||
if ( questInfo )
|
||||
{
|
||||
auto questInfo = g_exdData.getQuestInfo( eventId );
|
||||
if ( questInfo )
|
||||
{
|
||||
player.sendUrgent( "Quest not implemented: " + questInfo->name );
|
||||
player.sendUrgent( "Quest not implemented: " + questInfo->name );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue