1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 22:17:45 +00:00
This commit is contained in:
Maru 2017-10-24 16:01:04 -02:00
commit 7b7038bac2
34 changed files with 202 additions and 131 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

@ -23,6 +23,6 @@
<MotD>&lt;&lt;&lt;Welcome to Sapphire&gt;&gt;&gt;</MotD>
<MotD>This is a very good server</MotD>
<MotD>You can change these messages by editing MotDArray in config/settings_zone.xml</MotD>
</MotdArray>
</MotDArray>
</Parameters>
</Settings>

View file

@ -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;
}

View file

@ -48,10 +48,10 @@
<body scroll="no">
<div class="s-full-split s-left-half col-xs-7">
<div class="clearfix s-link-badge-wrapper">
<a href="https://discord.gg/KfrZCkx" target="_blank" class="s-link-badge s-link-badge-discord col-xs-5">
<a href="https://discord.gg/KfrZCkx" class="s-link-badge s-link-badge-discord col-xs-5">
Join us on Discord!
</a>
<a href="https://github.com/SapphireMordred/Sapphire" target="_blank" class="s-link-badge s-link-badge-github col-xs-5 pull-left">
<a href="https://github.com/SapphireMordred/Sapphire" class="s-link-badge s-link-badge-github col-xs-5 pull-left">
Our Github repository
</a>
</div>

View file

@ -2,12 +2,12 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sapphire - Login</title>
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/styles.css">
<link rel="stylesheet" href="assets/css/global.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sapphire - Login</title>
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/styles.css">
<link rel="stylesheet" href="assets/css/global.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
<script>
function doLogin(){
@ -51,14 +51,17 @@
<body scroll="no">
<div class="s-full-split s-left-half col-xs-7">
<div class="clearfix s-link-badge-wrapper">
<a href="https://discord.gg/KfrZCkx" target="_blank" class="s-link-badge s-link-badge-discord col-xs-5">
<a href="https://discord.gg/KfrZCkx" class="s-link-badge s-link-badge-discord col-xs-5">
Join us on Discord!
</a>
<a href="https://github.com/SapphireMordred/Sapphire" target="_blank" class="s-link-badge s-link-badge-github col-xs-5 pull-left">
<a href="https://github.com/SapphireMordred/Sapphire" class="s-link-badge s-link-badge-github col-xs-5 pull-left">
Our Github repository
</a>
</div>
<h2>Github stuff here soon!</h2>
<h2>Recent Activity</h2>
<ul id="commit-log" class="commit-history">
</ul>
</div>
<div class="s-full-split s-right-half col-xs-5">
<div class="s-logo">
@ -66,41 +69,53 @@
</div>
<div class="s-login-box col-xs-12">
<div class="s-login-box-form">
<h1 class="text-center s-login-call">Login to Account</h1>
<div class="input-control">
<label class="s-login-input-wrapper">
Username
<input type="text" name="username" autofocus>
</label>
</div>
<div class="input-control">
<label class="s-login-input-wrapper">
Password
<input type="password" name="password">
</label>
</div>
<button class="btn btn-default s-login-btn pull-right" id="submitButton" onclick="doLogin()">Login</button>
<p id="Error" class="s-error-text"></p>
</div>
<a class="btn btn-default s-acc-btn" href="createUser.html">Create Account</a>
</div>
<div class="s-gears">
<img class="s-gears" src="assets/img/graffletopia-gears.png" alt="">
</div>
<h1 class="text-center s-login-call">Login to Account</h1>
<div class="input-control">
<label class="s-login-input-wrapper">
Username
<input type="text" name="username" autofocus>
</label>
</div>
<div class="input-control">
<label class="s-login-input-wrapper">
Password
<input type="password" name="password">
</label>
</div>
<button class="btn btn-default s-login-btn pull-right" id="submitButton" onclick="doLogin()">Login</button>
<p id="Error" class="s-error-text"></p>
</div>
<a class="btn btn-default s-acc-btn" href="createUser.html">Create Account</a>
</div>
<div class="s-gears">
<img class="s-gears" src="assets/img/graffletopia-gears.png" alt="">
</div>
</div>
<div id="TopDiv"></div>
<div class="container"></div>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<div id="TopDiv"></div>
<div class="container"></div>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script> // Run only after jq and bootstrap have finished loading
<script>
fetch( "https://api.github.com/repos/SapphireMordred/Sapphire/events" ).then( function( resp ) {
return resp.json();
}).then( function( data ) {
data = data.filter( function( e ) {
return e.type == "PushEvent";
});
// Work around non-HTML5 compliant IE autofocus
$(function() {
$('[autofocus]:not(:focus)').eq(0).focus();
let commitContainer = document.getElementById( 'commit-log' );
for ( var evnt of data ) {
for ( var commit of evnt.payload.commits ) {
let e = document.createElement( 'li' );
e.innerHTML = '<a href="https://github.com/SapphireMordred/Sapphire/commit/' + commit.sha + '">' + commit.message + '</a>';
commitContainer.appendChild( e );
}
}
});
</script>
</script>
</body>
</html>

View file

@ -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()

View file

@ -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,

View file

@ -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 );

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

@ -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()

View file

@ -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<std::streamsize>( 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();

View file

@ -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()

View file

@ -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<std::string>( "Settings.General.HttpPort", "80" ) );
server.config.port = static_cast< unsigned short >( std::stoul( m_pConfig->getValue<std::string>( "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;

View file

@ -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;

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

@ -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 );

View file

@ -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

View file

@ -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() );
}

View file

@ -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 */

View file

@ -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;

View file

@ -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;

View file

@ -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()

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

@ -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 )
//{

View file

@ -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();

View file

@ -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 );

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
@ -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;

View file

@ -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 );

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" );

View file

@ -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})

View file

@ -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<LGB_GIMMICK_ENTRY*>( pEntry.get() );
auto pGimmick = dynamic_cast<LGB_GIMMICK_ENTRY*>( pEntry.get() );
auto pBgParts = dynamic_cast<LGB_BGPARTS_ENTRY*>( 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<SGB_MODEL_ENTRY*>( 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 );
}
}
}