From 570823166bb31c5ab81a8b5341da5a45bccffe71 Mon Sep 17 00:00:00 2001 From: Dantestyle Date: Mon, 30 Jul 2018 23:26:27 +0200 Subject: [PATCH] [Commands] QuestBitFlags Debug command --- .../DebugCommand/DebugCommandHandler.cpp | 97 ++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp index f80a0926..4d6f433a 100644 --- a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp @@ -159,7 +159,6 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost: pLog->debug( "[" + std::to_string( player.getId() ) + "] " + "subCommand " + subCommand + " params: " + params ); - if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) ) { int32_t posX; @@ -321,6 +320,102 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost: { pTerriMgr->disableCurrentFestival(); } + else if ( subCommand == "BitFlag8" ) + { + uint16_t questId; + uint8_t questBit; + sscanf( params.c_str(), "%hu %hhu", &questId, &questBit ); + + if ( player.hasQuest( questId ) ) + { + if ( !questBit == 0 || !questId == 0 ) + player.setQuestBitFlag8( questId, questBit, true ); + else + player.sendDebug( "Params are not correct" ); + } + else + player.sendDebug( "Player doesn't have the quest with ID: " + std::to_string( questId ) ); + } + else if ( subCommand == "BitFlag16" ) + { + uint16_t questId; + uint8_t questBit; + sscanf( params.c_str(), "%hu %hhu", &questId, &questBit ); + + if( player.hasQuest( questId ) ) + { + if( !questBit == 0 || !questId == 0 ) + player.setQuestBitFlag16( questId, questBit, true ); + else + player.sendDebug( "Params are not correct" ); + } + else + player.sendDebug( "Player doesn't have the quest with ID: " + std::to_string( questId ) ); + } + else if ( subCommand == "BitFlag24" ) + { + uint16_t questId; + uint8_t questBit; + sscanf( params.c_str(), "%hu %hhu", &questId, &questBit ); + + if( player.hasQuest( questId ) ) + { + if( !questBit == 0 || !questId == 0 ) + player.setQuestBitFlag24( questId, questBit, true ); + else + player.sendDebug( "Params are not correct" ); + } + else + player.sendDebug( "Player doesn't have the quest with ID: " + std::to_string( questId ) ); + } + else if ( subCommand == "BitFlag32" ) + { + uint16_t questId; + uint8_t questBit; + sscanf( params.c_str(), "%hu %hhu", &questId, &questBit ); + + if( player.hasQuest( questId ) ) + { + if( !questBit == 0 || !questId == 0 ) + player.setQuestBitFlag32( questId, questBit, true ); + else + player.sendDebug( "Params are not correct" ); + } + else + player.sendDebug( "Player doesn't have the quest with ID: " + std::to_string( questId ) ); + } + else if ( subCommand == "BitFlag40" ) + { + uint16_t questId; + uint8_t questBit; + sscanf( params.c_str(), "%hu %hhu", &questId, &questBit ); + + if( player.hasQuest( questId ) ) + { + if( !questBit == 0 || !questId == 0 ) + player.setQuestBitFlag40( questId, questBit, true ); + else + player.sendDebug( "Params are not correct" ); + } + else + player.sendDebug( "Player doesn't have the quest with ID: " + std::to_string( questId ) ); + } + else if ( subCommand == "BitFlag48" ) + { + uint16_t questId; + uint8_t questBit; + sscanf( params.c_str(), "%hu %hhu", &questId, &questBit ); + + if( player.hasQuest( questId ) ) + { + if( !questBit == 0 || !questId == 0 ) + player.setQuestBitFlag48( questId, questBit, true ); + else + player.sendDebug( "Params are not correct" ); + } + else + player.sendDebug( "Player doesn't have the quest with ID: " + std::to_string( questId ) ); + } else { player.sendUrgent( subCommand + " is not a valid SET command." );