1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-24 21:57:44 +00:00

Merge pull request #149 from GokuWeedLord/feature/debugfixes

misc bugfixes and improvements
This commit is contained in:
Mordred 2017-10-21 16:51:23 +02:00 committed by GitHub
commit 013a875a8d
9 changed files with 44 additions and 13 deletions

3
.gitignore vendored
View file

@ -104,3 +104,6 @@ src/libraries/external/boost_*
# sapphire version
src/servers/Server_Common/Version\.cpp
# edit and continue files
/enc_temp_folder

View file

@ -88,7 +88,7 @@ bool Core::Data::ExdData::loadZoneInfo()
uint16_t weather_rate = getField< uint16_t >( fields, 10 ) > 75 ? 0 : getField< uint16_t >( fields, 10 );
auto weatherRateFields = weatherRate.get_row( weather_rate );
int32_t aetheryte_index = getField< int32_t >( fields, 20 );
int32_t aetheryte_index = getField< int32_t >( fields, 23 );
ZoneInfo info{ 0 };

View file

@ -685,7 +685,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint32_t actionId, u
case ActionEffectType::Damage:
{
effectPacket.data().effects[0].value = param1;
effectPacket.data().effects[0].value = static_cast< uint16_t >( param1 );
effectPacket.data().effects[0].effectType = ActionEffectType::Damage;
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::NormalDamage;
effectPacket.data().effects[0].unknown_3 = 7;

View file

@ -44,12 +44,13 @@ Core::DebugCommandHandler::DebugCommandHandler()
registerCommand( "set", &DebugCommandHandler::set, "Loads and injects a premade Packet.", 1 );
registerCommand( "get", &DebugCommandHandler::get, "Loads and injects a premade Packet.", 1 );
registerCommand( "add", &DebugCommandHandler::add, "Loads and injects a premade Packet.", 1 );
registerCommand( "inject", &DebugCommandHandler::injectPacket, "Loads and injects a premade Packet.", 1 );
registerCommand( "injectc", &DebugCommandHandler::injectChatPacket, "Loads and injects a premade Packet.", 1 );
registerCommand( "script_reload", &DebugCommandHandler::scriptReload, "Loads and injects a premade Packet.", 1 );
registerCommand( "inject", &DebugCommandHandler::injectPacket, "Loads and injects a premade packet.", 1 );
registerCommand( "injectc", &DebugCommandHandler::injectChatPacket, "Loads and injects a premade chat packet.", 1 );
registerCommand( "script_reload", &DebugCommandHandler::scriptReload, "Reload all server scripts", 1 );
registerCommand( "nudge", &DebugCommandHandler::nudge, "Nudges you forward/up/down", 1 );
registerCommand( "info", &DebugCommandHandler::serverInfo, "Send server info", 0 );
registerCommand( "unlock", &DebugCommandHandler::unlockCharacter, "Unlock character", 1 );
registerCommand( "help", &DebugCommandHandler::help, "Shows registered commands", 0 );
}
// clear all loaded commands
@ -121,6 +122,18 @@ void Core::DebugCommandHandler::scriptReload( char * data, Core::Entity::PlayerP
pPlayer->sendDebug( "Scripts reloaded." );
}
void Core::DebugCommandHandler::help( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
{
pPlayer->sendDebug( "Registered debug commands:" );
for ( auto cmd : m_commandMap )
{
if ( pPlayer->getGmRank( ) >= cmd.second->m_gmLevel )
{
pPlayer->sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText( ) );
}
}
}
void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlayer, boost::shared_ptr<Core::DebugCommand> command )
{
std::string subCommand = "";
@ -502,3 +515,8 @@ void Core::DebugCommandHandler::serverInfo( char * data, Core::Entity::PlayerPtr
pPlayer->sendDebug( "Compiled: " __DATE__ " " __TIME__ );
pPlayer->sendDebug( "Sessions: " + std::to_string( g_serverZone.getSessionCount() ) );
}
void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
{
pPlayer->unlock( );
}

View file

@ -27,6 +27,9 @@ public:
// execute command if registered
void execCommand( char * data, Entity::PlayerPtr pPlayer );
// help command
void help( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
// command handler callbacks
void set( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void get( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
@ -39,6 +42,9 @@ public:
void nudge( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void serverInfo( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
void targetInfo( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr<DebugCommand> command );
};
}

View file

@ -125,7 +125,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
}
case 0x12E: // Set player title
{
pPlayer->setTitle( param1 );
pPlayer->setTitle( static_cast< uint16_t >( param1 ) );
break;
}
case 0x12F: // Get title list

View file

@ -282,13 +282,16 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
}
case GmCommand::Teri:
{
if( param1 < 128 )
pPlayer->sendUrgent( "Zone ID out of range." );
auto zoneInfo = g_zoneMgr.getZone( param1 );
if ( !zoneInfo )
{
pPlayer->sendUrgent( "Invalid zone " + std::to_string( param1 ) );
}
else
{
targetPlayer->setPosition( targetPlayer->getPos() );
targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 );
pPlayer->sendNotice( targetPlayer->getName() + " was warped to Zone " + std::to_string( param1 ) );
pPlayer->sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName( ) + ")" );
}
break;
}

View file

@ -91,7 +91,7 @@ bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, ui
std::string objName = Event::getEventName( eventId );
pPlayer->sendDebug("Actor: " +
std::to_string( actorId ) +
std::to_string( actorId ) + " -> " + std::to_string( Core::Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ) ) +
" \neventId: " +
std::to_string( eventId ) +
" (0x" + boost::str( boost::format( "%|08X|" )
@ -114,18 +114,18 @@ bool Core::Scripting::ScriptManager::onTalk( Core::Entity::PlayerPtr pPlayer, ui
}
catch( std::exception& e )
{
pPlayer->sendDebug( e.what( ) );
if( eventType == Common::EventType::Quest )
{
auto questInfo = g_exdData.getQuestInfo( eventId );
if( questInfo )
{
pPlayer->sendDebug( "Quest not implemented: " + questInfo->name + "\n" + e.what() );
pPlayer->sendUrgent( "Quest not implemented: " + questInfo->name );
return false;
}
}
pPlayer->sendDebug( e.what() );
return false;
}
return true;

View file

@ -52,6 +52,7 @@ int Core::Scripting::ScriptManager::init()
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" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::isInCombat ), "isInCombat" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getCurrency ), "getCurrency" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::addCurrency ), "addCurrency" );