diff --git a/.gitignore b/.gitignore index 052e2908..97aa43f5 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,6 @@ src/libraries/external/boost_* # sapphire version src/servers/Server_Common/Version\.cpp + +# edit and continue files +/enc_temp_folder \ No newline at end of file diff --git a/bin/config/settings_zone.xml b/bin/config/settings_zone.xml index 2b0a3a4a..2d04d270 100644 --- a/bin/config/settings_zone.xml +++ b/bin/config/settings_zone.xml @@ -23,6 +23,6 @@ <<<Welcome to Sapphire>>> This is a very good server You can change these messages by editing MotDArray in config/settings_zone.xml - + diff --git a/bin/web/assets/css/global.css b/bin/web/assets/css/global.css index 5a9c8375..290a0199 100644 --- a/bin/web/assets/css/global.css +++ b/bin/web/assets/css/global.css @@ -7,6 +7,7 @@ body { font-size: 12px; line-height: 14px; height: 100%; + overflow: hidden; } .contentContainer{ @@ -137,3 +138,26 @@ p.pageSubTitle{ margin:0 auto; } +.commit-history { + padding-left: 20px; +} + +.commit-history li a { + color: #fff; +} + +.commit-history li a:hover { + color: #bbb; +} + +.s-left-half { + overflow-y: auto; +} + +.s-link-badge { + font-size: 15px; +} + +h2 { + font-size: 19px; +} \ No newline at end of file diff --git a/bin/web/createUser.html b/bin/web/createUser.html index 9666e35f..fe9398e0 100644 --- a/bin/web/createUser.html +++ b/bin/web/createUser.html @@ -48,10 +48,10 @@
diff --git a/bin/web/login.html b/bin/web/login.html index 97f15031..24a0d591 100644 --- a/bin/web/login.html +++ b/bin/web/login.html @@ -2,12 +2,12 @@ - - - Sapphire - Login - - - + + + Sapphire - Login + + + - +
+
+ + + - + \ No newline at end of file diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 760de187..ebf42d84 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -8,11 +8,19 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") - - # edit and continue + if(CMAKE_BUILD_TYPE STREQUAL "Debug") - message(STATUS "Disabling /SAFESEH") + # disabling SAFESEH + message(STATUS "Disabling Safe Exception Handlers..") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") + + # edit and continue + message(STATUS "Enabling Edit and Continue..") + add_definitions(/ZI) + + # incremental linking + message(STATUS "Enabling Incremental Linking..") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL") endif() endif() diff --git a/sql/infolinkshell.sql b/sql/infolinkshell.sql index 66e7b224..a9e54d6c 100644 --- a/sql/infolinkshell.sql +++ b/sql/infolinkshell.sql @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `infolinkshell`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `infolinkshell` ( - `LinkshellId` int(20) NOT NULL AUTO_INCREMENT, + `LinkshellId` bigint(20) NOT NULL AUTO_INCREMENT, `MasterCharacterId` int(20) DEFAULT NULL, `CharacterIdList` blob, `LinkshellName` varchar(32) DEFAULT NULL, diff --git a/src/servers/Server_Common/Crypt/base64.cpp b/src/servers/Server_Common/Crypt/base64.cpp index 3ad4db0d..8037dec4 100644 --- a/src/servers/Server_Common/Crypt/base64.cpp +++ b/src/servers/Server_Common/Crypt/base64.cpp @@ -93,7 +93,7 @@ std::string Core::Util::base64_decode( std::string const& encoded_string ) { char_array_4[i++] = encoded_string[in_]; in_++; if( i == 4 ) { for( i = 0; i < 4; i++ ) - char_array_4[i] = base64_chars.find( char_array_4[i] ); + char_array_4[i] = static_cast< uint8_t >( base64_chars.find( char_array_4[i] ) ); char_array_3[0] = ( char_array_4[0] << 2 ) + ( ( char_array_4[1] & 0x30 ) >> 4 ); char_array_3[1] = ( ( char_array_4[1] & 0xf ) << 4 ) + ( ( char_array_4[2] & 0x3c ) >> 2 ); @@ -110,7 +110,7 @@ std::string Core::Util::base64_decode( std::string const& encoded_string ) { char_array_4[j] = 0; for( j = 0; j < 4; j++ ) - char_array_4[j] = base64_chars.find( char_array_4[j] ); + char_array_4[j] = static_cast< uint8_t >( base64_chars.find( char_array_4[j] ) ); char_array_3[0] = ( char_array_4[0] << 2 ) + ( ( char_array_4[1] & 0x30 ) >> 4 ); char_array_3[1] = ( ( char_array_4[1] & 0xf ) << 4 ) + ( ( char_array_4[2] & 0x3c ) >> 2 ); diff --git a/src/servers/Server_Common/Exd/ExdData.cpp b/src/servers/Server_Common/Exd/ExdData.cpp index f7822502..9ac2197a 100644 --- a/src/servers/Server_Common/Exd/ExdData.cpp +++ b/src/servers/Server_Common/Exd/ExdData.cpp @@ -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 }; diff --git a/src/servers/Server_Lobby/CMakeLists.txt b/src/servers/Server_Lobby/CMakeLists.txt index b705f393..57e57488 100644 --- a/src/servers/Server_Lobby/CMakeLists.txt +++ b/src/servers/Server_Lobby/CMakeLists.txt @@ -20,11 +20,6 @@ set_target_properties(server_lobby PROPERTIES RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/" ) -if(MSVC) - message(STATUS "Enabling Edit and Continue..") - set_property(TARGET server_lobby APPEND_STRING PROPERTY COMPILE_FLAGS " /INCREMENTAL /ZI") -endif() - if (UNIX) target_link_libraries(server_lobby Common xivdat pthread mysqlclient dl z) else() diff --git a/src/servers/Server_Lobby/client_http.hpp b/src/servers/Server_Lobby/client_http.hpp index c7b9137b..656b8d01 100644 --- a/src/servers/Server_Lobby/client_http.hpp +++ b/src/servers/Server_Lobby/client_http.hpp @@ -266,7 +266,7 @@ namespace SimpleWeb { if( content_length>num_additional_bytes ) { auto timer = get_timeout_timer(); boost::asio::async_read( *socket, response->content_buffer, - boost::asio::transfer_exactly( content_length - num_additional_bytes ), + boost::asio::transfer_exactly( static_cast< size_t >( content_length - num_additional_bytes ) ), [this, timer]( const boost::system::error_code& ec, size_t /*bytes_transferred*/ ) { if( timer ) timer->cancel(); @@ -307,7 +307,7 @@ namespace SimpleWeb { line.pop_back(); std::streamsize length = stol( line, 0, 16 ); - auto num_additional_bytes = static_cast( response->content_buffer.size() - bytes_transferred ); + auto num_additional_bytes = response->content_buffer.size() - bytes_transferred; auto post_process = [this, &response, &streambuf, length] { std::ostream stream( &streambuf ); @@ -332,7 +332,7 @@ namespace SimpleWeb { if( ( 2 + length )>num_additional_bytes ) { auto timer = get_timeout_timer(); boost::asio::async_read( *socket, response->content_buffer, - boost::asio::transfer_exactly( 2 + length - num_additional_bytes ), + boost::asio::transfer_exactly( static_cast< size_t >( 2 + length - num_additional_bytes ) ), [this, post_process, timer]( const boost::system::error_code& ec, size_t /*bytes_transferred*/ ) { if( timer ) timer->cancel(); diff --git a/src/servers/Server_REST/CMakeLists.txt b/src/servers/Server_REST/CMakeLists.txt index 1b54bf9e..59de42a2 100644 --- a/src/servers/Server_REST/CMakeLists.txt +++ b/src/servers/Server_REST/CMakeLists.txt @@ -19,11 +19,6 @@ set_target_properties(server_rest PROPERTIES RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/" ) -if(MSVC) - message(STATUS "Enabling Edit and Continue..") - set_property(TARGET server_rest APPEND_STRING PROPERTY COMPILE_FLAGS " /INCREMENTAL /ZI") -endif() - if (UNIX) target_link_libraries (server_rest Common xivdat pthread mysqlclient dl z) else() diff --git a/src/servers/Server_REST/main.cpp b/src/servers/Server_REST/main.cpp index 7173db63..a883a2d1 100644 --- a/src/servers/Server_REST/main.cpp +++ b/src/servers/Server_REST/main.cpp @@ -149,7 +149,7 @@ bool loadSettings( int32_t argc, char* argv[] ) params.port = m_pConfig->getValue< uint16_t >( "Settings.General.Mysql.Port", 3306 ); params.username = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Username", "root" ); - server.config.port = std::stoul( m_pConfig->getValue( "Settings.General.HttpPort", "80" ) ); + server.config.port = static_cast< unsigned short >( std::stoul( m_pConfig->getValue( "Settings.General.HttpPort", "80" ) ) ); if( !g_database.initialize( params ) ) { @@ -597,7 +597,7 @@ int main(int argc, char* argv[]) auto path = boost::filesystem::canonical( web_root_path / "news.xml" ); //Check if path is within web_root_path if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) || - !equal( web_root_path.begin(), web_root_path.end(), path.begin() ) ) + !std::equal( web_root_path.begin(), web_root_path.end(), path.begin(), path.end() ) ) throw invalid_argument( "path must be within root path" ); if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) ) throw invalid_argument( "file does not exist" ); @@ -638,7 +638,7 @@ int main(int argc, char* argv[]) auto path = boost::filesystem::canonical( web_root_path / "headlines.xml" ); //Check if path is within web_root_path if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) || - !equal( web_root_path.begin(), web_root_path.end(), path.begin() ) ) + !std::equal( web_root_path.begin(), web_root_path.end(), path.begin(), path.end() ) ) throw invalid_argument( "path must be within root path" ); if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) ) throw invalid_argument( "file does not exist" ); @@ -683,7 +683,7 @@ int main(int argc, char* argv[]) auto path = boost::filesystem::canonical( web_root_path / request->path ); //Check if path is within web_root_path if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) || - !equal( web_root_path.begin(), web_root_path.end(), path.begin() ) ) + !std::equal( web_root_path.begin(), web_root_path.end(), path.begin(), path.end() ) ) throw invalid_argument( "path must be within root path" ); if( boost::filesystem::is_directory( path ) ) path /= "index.html"; @@ -709,7 +709,7 @@ int main(int argc, char* argv[]) else throw invalid_argument( "could not read file" ); } - catch( const exception &e ) + catch( const exception & ) { string content = "Path not found: " + request->path; *response << "HTTP/1.1 400 Bad Request\r\nContent-Length: " << content.length() << "\r\n\r\n" << content; diff --git a/src/servers/Server_REST/server_http.hpp b/src/servers/Server_REST/server_http.hpp index 82ee541a..b8e8e8a9 100644 --- a/src/servers/Server_REST/server_http.hpp +++ b/src/servers/Server_REST/server_http.hpp @@ -273,7 +273,7 @@ namespace SimpleWeb { try { content_length=stoull(it->second); } - catch(const std::exception &e) { + catch( const std::exception & ) { if(on_error) on_error(request, boost::system::error_code(boost::system::errc::protocol_error, boost::system::generic_category())); return; @@ -282,7 +282,7 @@ namespace SimpleWeb { //Set timeout on the following boost::asio::async-read or write function auto timer=this->get_timeout_timer(socket, config.timeout_content); boost::asio::async_read(*socket, request->streambuf, - boost::asio::transfer_exactly(content_length-num_additional_bytes), + boost::asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)), [this, socket, request, timer] (const boost::system::error_code& ec, size_t /*bytes_transferred*/) { if(timer) @@ -388,7 +388,7 @@ namespace SimpleWeb { try { http_version=stof(request->http_version); } - catch(const std::exception &e){ + catch( const std::exception & ){ if(on_error) on_error(request, boost::system::error_code(boost::system::errc::protocol_error, boost::system::generic_category())); return; @@ -410,7 +410,7 @@ namespace SimpleWeb { try { resource_function(response, request); } - catch(const std::exception &e) { + catch( const std::exception & ) { if(on_error) on_error(request, boost::system::error_code(boost::system::errc::operation_canceled, boost::system::generic_category())); return; diff --git a/src/servers/Server_Zone/Actor/Actor.cpp b/src/servers/Server_Zone/Actor/Actor.cpp index 33f20c6b..4c3addc8 100644 --- a/src/servers/Server_Zone/Actor/Actor.cpp +++ b/src/servers/Server_Zone/Actor/Actor.cpp @@ -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; diff --git a/src/servers/Server_Zone/Actor/BattleNpc.cpp b/src/servers/Server_Zone/Actor/BattleNpc.cpp index d8f098e9..6e64015a 100644 --- a/src/servers/Server_Zone/Actor/BattleNpc.cpp +++ b/src/servers/Server_Zone/Actor/BattleNpc.cpp @@ -451,7 +451,7 @@ void Core::Entity::BattleNpc::onDeath() // todo: this is actually retarded, we need real rand() - srand( time( NULL ) ); + srand( static_cast< unsigned int> ( time( NULL ) ) ); auto pPlayer = pHateEntry->m_pActor->getAsPlayer(); pPlayer->gainExp( exp ); diff --git a/src/servers/Server_Zone/Actor/CalcBattle.cpp b/src/servers/Server_Zone/Actor/CalcBattle.cpp index 5bc0d252..ce2e3a84 100644 --- a/src/servers/Server_Zone/Actor/CalcBattle.cpp +++ b/src/servers/Server_Zone/Actor/CalcBattle.cpp @@ -38,7 +38,7 @@ float CalcBattle::calculateBaseStat( PlayerPtr pPlayer ) // SB Base Stat Formula (Aligned) if ( level > 60 ) { - base = ( ( ( level == 61 ) ? 224 : 220 ) + ( level - 61 ) * 8); + base = static_cast< float >( ( ( ( level == 61 ) ? 224 : 220 ) + ( level - 61 ) * 8) ); } // HW Base Stat Formula (Aligned) else if ( level > 50 ) @@ -77,7 +77,7 @@ uint32_t CalcBattle::calculateMaxHp( PlayerPtr pPlayer ) // These values are not precise. if ( level >= 60 ) - approxBaseHp = 2600 + ( level - 60 ) * 100; + approxBaseHp = static_cast< float >( 2600 + ( level - 60 ) * 100 ); else if ( level >= 50 ) approxBaseHp = 1700 + ( ( level - 50 ) * ( 1700 * 1.04325f ) ); else diff --git a/src/servers/Server_Zone/Actor/Player.cpp b/src/servers/Server_Zone/Actor/Player.cpp index 39d5d709..349fc15e 100644 --- a/src/servers/Server_Zone/Actor/Player.cpp +++ b/src/servers/Server_Zone/Actor/Player.cpp @@ -345,7 +345,7 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type ) void Core::Entity::Player::forceZoneing( uint32_t zoneId ) { - m_queuedZoneing = boost::make_shared< QueuedZoning >( zoneId, getPos(), Util::getTimeMs(), 0 ); + m_queuedZoneing = boost::make_shared< QueuedZoning >( zoneId, getPos(), Util::getTimeMs(), 0.f ); //performZoning( zoneId, Common::ZoneingType::None, getPos() ); } diff --git a/src/servers/Server_Zone/Actor/Player.h b/src/servers/Server_Zone/Actor/Player.h index 95fd1b89..7b08e911 100644 --- a/src/servers/Server_Zone/Actor/Player.h +++ b/src/servers/Server_Zone/Actor/Player.h @@ -197,9 +197,9 @@ public: // Inventory / Item / Currency ////////////////////////////////////////////////////////////////////////////////////////////////////// /*! add an item to the first free slot in one of the 4 main containers */ - bool tryAddItem( uint16_t catalogId, uint16_t quantity ); + bool tryAddItem( uint16_t catalogId, uint32_t quantity ); /*! add an item to a given container */ - bool addItem( uint16_t containerId, uint16_t catalogId, uint16_t quantity ); + bool addItem( uint16_t containerId, uint16_t catalogId, uint32_t quantity ); /*! equip an item to a specified slot */ void equipItem( Inventory::EquipSlot equipSlotId, ItemPtr pItem, bool sendModel ); /*! remove an item from an equipment slot */ diff --git a/src/servers/Server_Zone/Actor/PlayerInventory.cpp b/src/servers/Server_Zone/Actor/PlayerInventory.cpp index b5380d82..acc6632c 100644 --- a/src/servers/Server_Zone/Actor/PlayerInventory.cpp +++ b/src/servers/Server_Zone/Actor/PlayerInventory.cpp @@ -189,10 +189,10 @@ void Core::Entity::Player::removeCrystal( uint8_t type, uint32_t amount ) queuePacket( invUpPacket ); } -bool Core::Entity::Player::tryAddItem( uint16_t catalogId, uint16_t quantity ) +bool Core::Entity::Player::tryAddItem( uint16_t catalogId, uint32_t quantity ) { - for( uint8_t i = 0; i < 4; i++ ) + for( uint16_t i = 0; i < 4; i++ ) { if( m_pInventory->addItem( i, -1, catalogId, quantity ) != -1 ) { @@ -202,7 +202,7 @@ bool Core::Entity::Player::tryAddItem( uint16_t catalogId, uint16_t quantity ) return false; } -bool Core::Entity::Player::addItem( uint16_t containerId, uint16_t catalogId, uint16_t quantity ) +bool Core::Entity::Player::addItem( uint16_t containerId, uint16_t catalogId, uint32_t quantity ) { if( m_pInventory->addItem( containerId, -1, catalogId, quantity ) != -1 ) return true; diff --git a/src/servers/Server_Zone/Actor/PlayerQuest.cpp b/src/servers/Server_Zone/Actor/PlayerQuest.cpp index 668460a7..579a0fe1 100644 --- a/src/servers/Server_Zone/Actor/PlayerQuest.cpp +++ b/src/servers/Server_Zone/Actor/PlayerQuest.cpp @@ -74,7 +74,7 @@ bool Core::Entity::Player::loadActiveQuests() void Core::Entity::Player::finishQuest( uint16_t questId ) { - int16_t idx = getQuestIndex( questId ); + auto idx = static_cast< uint8_t >( getQuestIndex( questId ) ); if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) ) { @@ -123,7 +123,7 @@ void Core::Entity::Player::unfinishQuest( uint16_t questId ) void Core::Entity::Player::removeQuest( uint16_t questId ) { - int16_t idx = getQuestIndex( questId ); + auto idx = static_cast< uint8_t >( getQuestIndex( questId ) ); if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) ) { @@ -978,7 +978,7 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence ) if( hasQuest( questId ) ) { GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() ); - int16_t index = getQuestIndex( questId ); + auto index = static_cast< uint8_t >( getQuestIndex( questId ) ); auto pNewQuest = m_activeQuests[index]; pe_qa.data().slot = index; pNewQuest->c.sequence = sequence; @@ -1038,7 +1038,7 @@ void Core::Entity::Player::sendQuestTracker() if( m_questTracking[ii] >= 0 ) { trackerPacket.data().entry[ii].active = 1; - trackerPacket.data().entry[ii].questIndex = m_questTracking[ii]; + trackerPacket.data().entry[ii].questIndex = static_cast< uint8_t >( m_questTracking[ii] ); } } queuePacket( trackerPacket ); @@ -1147,7 +1147,7 @@ bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optional exp = questInfo->reward_exp_factor; - uint16_t rewardItemCount = questInfo->reward_item.size(); + auto rewardItemCount = questInfo->reward_item.size(); uint16_t optionalItemCount = questInfo->reward_item_optional.size() > 0 ? 1 : 0; uint32_t gilReward = questInfo->reward_gil; diff --git a/src/servers/Server_Zone/CMakeLists.txt b/src/servers/Server_Zone/CMakeLists.txt index a0455608..50a34131 100644 --- a/src/servers/Server_Zone/CMakeLists.txt +++ b/src/servers/Server_Zone/CMakeLists.txt @@ -35,11 +35,6 @@ set_target_properties(server_zone PROPERTIES RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/" ) -if(MSVC) - message(STATUS "Enabling Edit and Continue..") - set_property(TARGET server_zone APPEND_STRING PROPERTY COMPILE_FLAGS " /INCREMENTAL /ZI") -endif() - if (UNIX) target_link_libraries ( server_zone Common xivdat pthread mysqlclient dl z ) else() diff --git a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp index c1f8f2f7..0284a1e9 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp @@ -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 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( ); +} diff --git a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h index 12ff13b3..17dc3258 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.h @@ -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 command ); + // command handler callbacks void set( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr command ); void get( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr command ); @@ -39,6 +42,9 @@ public: void nudge( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr command ); void serverInfo( char * data, Entity::PlayerPtr pPlayer, boost::shared_ptr command ); + void unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr command ); + void targetInfo( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr command ); + }; } diff --git a/src/servers/Server_Zone/Inventory/Inventory.cpp b/src/servers/Server_Zone/Inventory/Inventory.cpp index 2b552583..2a859076 100644 --- a/src/servers/Server_Zone/Inventory/Inventory.cpp +++ b/src/servers/Server_Zone/Inventory/Inventory.cpp @@ -108,7 +108,7 @@ Core::Inventory::InvSlotPairVec Core::Inventory::getSlotsOfItemsInInventory( uin for( auto item : inv->getItemMap() ) { if( item.second && item.second->getId() == catalogId ) - outVec.push_back( std::make_pair( i, item.first ) ); + outVec.push_back( std::make_pair( i, static_cast< int8_t >( item.first ) ) ); } } return outVec; @@ -118,7 +118,7 @@ Core::Inventory::InvSlotPair Core::Inventory::getFreeBagSlot() { for( auto i : { Bag0, Bag1, Bag2, Bag3 } ) { - int16_t freeSlot = m_inventoryMap[i]->getFreeSlot(); + auto freeSlot = static_cast< int8_t >( m_inventoryMap[i]->getFreeSlot() ); if( freeSlot != -1 ) return std::make_pair( i, freeSlot ); @@ -457,7 +457,7 @@ int16_t Core::Inventory::addItem( uint16_t inventoryId, int8_t slotId, uint32_t return -1; } - int16_t rSlotId = -1; + int8_t rSlotId = -1; //if( itemInfo->stack_size > 1 ) //{ diff --git a/src/servers/Server_Zone/Linkshell/LinkshellMgr.cpp b/src/servers/Server_Zone/Linkshell/LinkshellMgr.cpp index 077f42d0..ffcfc9af 100644 --- a/src/servers/Server_Zone/Linkshell/LinkshellMgr.cpp +++ b/src/servers/Server_Zone/Linkshell/LinkshellMgr.cpp @@ -29,7 +29,7 @@ bool Core::LinkshellMgr::loadLinkshells() do { - uint32_t linkshellId = field[0].get< uint32_t >(); + uint64_t linkshellId = field[0].get< uint64_t >(); uint32_t masterId = field[1].get< uint32_t >(); std::string name = field[3].getString(); diff --git a/src/servers/Server_Zone/Linkshell/LinkshellMgr.h b/src/servers/Server_Zone/Linkshell/LinkshellMgr.h index d5083506..8237bb55 100644 --- a/src/servers/Server_Zone/Linkshell/LinkshellMgr.h +++ b/src/servers/Server_Zone/Linkshell/LinkshellMgr.h @@ -12,7 +12,7 @@ typedef boost::shared_ptr< Linkshell > LinkshellPtr; class LinkshellMgr { private: - std::map< uint32_t, LinkshellPtr > m_linkshellIdMap; + std::map< uint64_t, LinkshellPtr > m_linkshellIdMap; std::map< std::string, LinkshellPtr > m_linkshellNameMap; LinkshellPtr getLinkshellByName( const std::string& name ); diff --git a/src/servers/Server_Zone/Network/Handlers/ActionHandler.cpp b/src/servers/Server_Zone/Network/Handlers/ActionHandler.cpp index 9a6dcd6a..492eaae6 100644 --- a/src/servers/Server_Zone/Network/Handlers/ActionHandler.cpp +++ b/src/servers/Server_Zone/Network/Handlers/ActionHandler.cpp @@ -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 @@ -216,8 +216,8 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in auto fromAetheryte = g_exdData.getAetheryteInfo( g_exdData.m_zoneInfoMap[pPlayer->getZoneId()].aetheryte_index ); // calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets - auto cost = ( sqrt( pow( fromAetheryte->map_coord_x - targetAetheryte->map_coord_x, 2 ) + - pow( fromAetheryte->map_coord_y - targetAetheryte->map_coord_y, 2 ) ) / 2 ) + 100; + auto cost = static_cast< uint16_t > ( ( sqrt( pow( fromAetheryte->map_coord_x - targetAetheryte->map_coord_x, 2 ) + + pow( fromAetheryte->map_coord_y - targetAetheryte->map_coord_y, 2 ) ) / 2 ) + 100 ); // cap at 999 gil cost = cost > 999 ? 999 : cost; diff --git a/src/servers/Server_Zone/Network/Handlers/EventHandlers.cpp b/src/servers/Server_Zone/Network/Handlers/EventHandlers.cpp index d310ffc4..e8c8ced0 100644 --- a/src/servers/Server_Zone/Network/Handlers/EventHandlers.cpp +++ b/src/servers/Server_Zone/Network/Handlers/EventHandlers.cpp @@ -141,7 +141,7 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP GamePacketNew< FFXIVIpcEventLinkshell, ServerZoneIpcType > linkshellEvent( pPlayer->getId() ); linkshellEvent.data().eventId = eventId; - linkshellEvent.data().scene = subEvent; + linkshellEvent.data().scene = static_cast< uint8_t >(subEvent); linkshellEvent.data().param3 = 1; linkshellEvent.data().unknown1 = 0x15a; pPlayer->queuePacket( linkshellEvent ); diff --git a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp index cae64bc6..3d79409e 100644 --- a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp @@ -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; } diff --git a/src/servers/Server_Zone/Script/ScriptManager.cpp b/src/servers/Server_Zone/Script/ScriptManager.cpp index 61c331bd..bc42558c 100644 --- a/src/servers/Server_Zone/Script/ScriptManager.cpp +++ b/src/servers/Server_Zone/Script/ScriptManager.cpp @@ -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; diff --git a/src/servers/Server_Zone/Script/ScriptManagerInit.cpp b/src/servers/Server_Zone/Script/ScriptManagerInit.cpp index d36a7dbe..55c2135f 100644 --- a/src/servers/Server_Zone/Script/ScriptManagerInit.cpp +++ b/src/servers/Server_Zone/Script/ScriptManagerInit.cpp @@ -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" ); diff --git a/src/tools/exd_common_gen/CMakeLists.txt b/src/tools/exd_common_gen/CMakeLists.txt index 2d5839d9..986a5342 100644 --- a/src/tools/exd_common_gen/CMakeLists.txt +++ b/src/tools/exd_common_gen/CMakeLists.txt @@ -27,6 +27,9 @@ if (UNIX) target_link_libraries (exd_common_gen Common xivdat pthread mysqlclient dl z) else() target_link_libraries (exd_common_gen Common xivdat libmysql zlib1) + + # ignore unchecked iterators warnings from msvc + add_definitions(-D_SCL_SECURE_NO_WARNINGS) endif() target_link_libraries(exd_common_gen ${Boost_LIBRARIES} ${Boost_LIBRARIES}) diff --git a/src/tools/pcb_reader/main.cpp b/src/tools/pcb_reader/main.cpp index 7125efd6..647d08e5 100644 --- a/src/tools/pcb_reader/main.cpp +++ b/src/tools/pcb_reader/main.cpp @@ -258,12 +258,16 @@ int main( int argc, char* argv[] ) } return false; }; - auto pushVerts = [&]( const PCB_FILE& pcb_file, const std::string& name, const vec3* scale = nullptr, const vec3* rotation = nullptr, const vec3* translation = nullptr ) + auto pushVerts = [&]( const PCB_FILE& pcb_file, const std::string& name, + const vec3* scale = nullptr, + const vec3* rotation = nullptr, + const vec3* translation = nullptr, + const SGB_MODEL_ENTRY* pSgbEntry = nullptr) { char name2[0x100]; memset( name2, 0, 0x100 ); sprintf( &name2[0], "%s_%u", &name[0], objCount[name]++ ); - //fprintf( fp_out, "o %s\n", &name2[0] ); + fprintf( fp_out, "o %s\n", &name2[0] ); uint32_t groupCount = 0; for( const auto &entry : pcb_file.entries ) @@ -274,6 +278,20 @@ int main( int argc, char* argv[] ) auto makeTranslation = [&]( vec3& v ) { + if( pSgbEntry ) + { + v.x *= pSgbEntry->header.scale.x; + v.y *= pSgbEntry->header.scale.y; + v.z *= pSgbEntry->header.scale.z; + + v = v * matrix4::rotateX( pSgbEntry->header.rotation.x ); + v = v * matrix4::rotateY( pSgbEntry->header.rotation.y ); + v = v * matrix4::rotateZ( pSgbEntry->header.rotation.z ); + + v.x += pSgbEntry->header.translation.x; + v.y += pSgbEntry->header.translation.y; + v.z += pSgbEntry->header.translation.z; + } if( scale ) { v.x *= scale->x; @@ -338,7 +356,7 @@ int main( int argc, char* argv[] ) totalGroups++; for( const auto& pEntry : group.entries ) { - LGB_GIMMICK_ENTRY* pGimmick = dynamic_cast( pEntry.get() ); + auto pGimmick = dynamic_cast( pEntry.get() ); auto pBgParts = dynamic_cast( pEntry.get() ); std::string fileName( "" ); @@ -346,7 +364,7 @@ int main( int argc, char* argv[] ) totalGroupEntries++; // write files - auto writeOutput = [&]( const std::string& fileName, const vec3* scale, const vec3* rotation, const vec3* translation ) -> bool + auto writeOutput = [&]( const std::string& fileName, const vec3* scale, const vec3* rotation, const vec3* translation, const SGB_MODEL_ENTRY* pModel = nullptr) -> bool { { const auto& it = pcbFiles.find( fileName ); @@ -361,7 +379,7 @@ int main( int argc, char* argv[] ) if( it != pcbFiles.end() ) { const auto& pcb_file = it->second; - pushVerts( pcb_file, fileName, scale, rotation, translation ); + pushVerts( pcb_file, fileName, scale, rotation, translation, pModel ); } return true; }; @@ -369,14 +387,7 @@ int main( int argc, char* argv[] ) if( pBgParts ) { fileName = pBgParts->collisionFileName; - - if( !writeOutput( fileName, &pBgParts->header.scale, &pBgParts->header.rotation, &pBgParts->header.translation ) ) - { - fileName = pBgParts->modelFileName; - boost::replace_all( fileName, "bgparts", "collision" ); - boost::replace_all( fileName, ".mdl", ".pcb" ); - writeOutput( fileName, &pBgParts->header.scale, &pBgParts->header.rotation, &pBgParts->header.translation ); - } + writeOutput( fileName, &pBgParts->header.scale, &pBgParts->header.rotation, &pBgParts->header.translation ); } // gimmick entry @@ -401,13 +412,7 @@ int main( int argc, char* argv[] ) { auto pModel = dynamic_cast( pEntry.get() ); fileName = pModel->collisionFileName; - if( !writeOutput( fileName, &pGimmick->header.scale, &pGimmick->header.rotation, &pGimmick->header.translation ) ) - { - fileName = pModel->modelFileName; - boost::replace_all( fileName, "bgparts", "collision" ); - boost::replace_all( fileName, ".mdl", ".pcb" ); - writeOutput( fileName, &pGimmick->header.scale, &pGimmick->header.rotation, &pGimmick->header.translation ); - } + writeOutput( fileName, &pGimmick->header.scale, &pGimmick->header.rotation, &pGimmick->header.translation, pModel ); } } }