1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 05:57:45 +00:00

More overall cleanup and warning reductions

This commit is contained in:
Mordred 2023-01-17 11:27:25 +01:00
parent 207f44294b
commit a02e58fd35
16 changed files with 57 additions and 97 deletions

View file

@ -42,7 +42,7 @@ using namespace Sapphire::World;
Action::Action::Action() = default; Action::Action::Action() = default;
Action::Action::~Action() = default; Action::Action::~Action() = default;
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence) : Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence ) :
Action( std::move( caster ), actionId, sequence, nullptr ) Action( std::move( caster ), actionId, sequence, nullptr )
{ {
} }

View file

@ -78,8 +78,8 @@ DebugCommandMgr::DebugCommandMgr()
// clear all loaded commands // clear all loaded commands
DebugCommandMgr::~DebugCommandMgr() DebugCommandMgr::~DebugCommandMgr()
{ {
for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it ) for( auto & it : m_commandMap )
( *it ).second.reset(); it.second.reset();
} }
// add a command set to the register map // add a command set to the register map
@ -99,7 +99,7 @@ void DebugCommandMgr::execCommand( char* data, Entity::Player& player )
// check if the command has parameters // check if the command has parameters
std::string tmpCommand = std::string( data ); std::string tmpCommand = std::string( data );
std::size_t pos = tmpCommand.find_first_of( " " ); std::size_t pos = tmpCommand.find_first_of( ' ' );
if( pos != std::string::npos ) if( pos != std::string::npos )
// command has parameters, grab the first part // command has parameters, grab the first part
@ -139,7 +139,7 @@ void DebugCommandMgr::execCommand( char* data, Entity::Player& player )
void DebugCommandMgr::help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ) void DebugCommandMgr::help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{ {
PlayerMgr::sendDebug( player, "Registered debug commands:" ); PlayerMgr::sendDebug( player, "Registered debug commands:" );
for( auto cmd : m_commandMap ) for( const auto& cmd : m_commandMap )
{ {
if( player.getGmRank() >= cmd.second->m_gmLevel ) if( player.getGmRank() >= cmd.second->m_gmLevel )
{ {
@ -156,13 +156,13 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr<
auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() ); auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref(); auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
std::string subCommand = ""; std::string subCommand;
std::string params = ""; std::string params;
// check if the command has parameters // check if the command has parameters
std::string tmpCommand = std::string( data + command->getName().length() + 1 ); std::string tmpCommand = std::string( data + command->getName().length() + 1 );
std::size_t pos = tmpCommand.find_first_of( " " ); std::size_t pos = tmpCommand.find_first_of( ' ' );
if( pos != std::string::npos ) if( pos != std::string::npos )
// command has parameters, grab the first part // command has parameters, grab the first part
@ -176,7 +176,7 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr<
Logger::debug( "[{0}] subCommand: {1} params: {1}", player.getId(), subCommand, params ); Logger::debug( "[{0}] subCommand: {1} params: {1}", player.getId(), subCommand, params );
if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) ) if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( !params.empty() ) )
{ {
int32_t posX; int32_t posX;
int32_t posY; int32_t posY;
@ -206,14 +206,14 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr<
pSession->getZoneConnection()->queueOutPacket( setActorPosPacket ); pSession->getZoneConnection()->queueOutPacket( setActorPosPacket );
} }
else if( ( subCommand == "tele" ) && ( params != "" ) ) else if( ( subCommand == "tele" ) && ( !params.empty() ) )
{ {
int32_t aetheryteId; int32_t aetheryteId;
sscanf( params.c_str(), "%i", &aetheryteId ); sscanf( params.c_str(), "%i", &aetheryteId );
player.teleport( static_cast< uint16_t >( aetheryteId ) ); player.teleport( static_cast< uint16_t >( aetheryteId ) );
} }
else if( ( subCommand == "discovery" ) && ( params != "" ) ) else if( ( subCommand == "discovery" ) && ( !params.empty() ) )
{ {
int32_t map_id; int32_t map_id;
int32_t discover_id; int32_t discover_id;
@ -392,12 +392,12 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr<
auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() ); auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );
std::string subCommand; std::string subCommand;
std::string params = ""; std::string params;
// check if the command has parameters // check if the command has parameters
std::string tmpCommand = std::string( data + command->getName().length() + 1 ); std::string tmpCommand = std::string( data + command->getName().length() + 1 );
std::size_t pos = tmpCommand.find_first_of( " " ); std::size_t pos = tmpCommand.find_first_of( ' ' );
if( pos != std::string::npos ) if( pos != std::string::npos )
// command has parameters, grab the first part // command has parameters, grab the first part
@ -566,12 +566,12 @@ void DebugCommandMgr::get( char* data, Entity::Player& player, std::shared_ptr<
{ {
auto& exdData = Common::Service< Data::ExdData >::ref(); auto& exdData = Common::Service< Data::ExdData >::ref();
std::string subCommand; std::string subCommand;
std::string params = ""; std::string params;
// check if the command has parameters // check if the command has parameters
std::string tmpCommand = std::string( data + command->getName().length() + 1 ); std::string tmpCommand = std::string( data + command->getName().length() + 1 );
std::size_t pos = tmpCommand.find_first_of( " " ); std::size_t pos = tmpCommand.find_first_of( ' ' );
if( pos != std::string::npos ) if( pos != std::string::npos )
// command has parameters, grab the first part // command has parameters, grab the first part
@ -624,12 +624,12 @@ void DebugCommandMgr::replay( char* data, Entity::Player& player, std::shared_pt
auto& server = Common::Service< World::WorldServer >::ref(); auto& server = Common::Service< World::WorldServer >::ref();
std::string subCommand; std::string subCommand;
std::string params = ""; std::string params;
// check if the command has parameters // check if the command has parameters
std::string tmpCommand = std::string( data + command->getName().length() + 1 ); std::string tmpCommand = std::string( data + command->getName().length() + 1 );
std::size_t pos = tmpCommand.find_first_of( " " ); std::size_t pos = tmpCommand.find_first_of( ' ' );
if( pos != std::string::npos ) if( pos != std::string::npos )
// command has parameters, grab the first part // command has parameters, grab the first part
@ -681,7 +681,7 @@ void DebugCommandMgr::nudge( char* data, Entity::Player& player, std::shared_ptr
// check if the command has parameters // check if the command has parameters
std::string tmpCommand = std::string( data + command->getName().length() + 1 ); std::string tmpCommand = std::string( data + command->getName().length() + 1 );
std::size_t spos = tmpCommand.find_first_of( " " ); std::size_t spos = tmpCommand.find_first_of( ' ' );
auto& pos = player.getPos(); auto& pos = player.getPos();
@ -733,12 +733,12 @@ void DebugCommandMgr::script( char* data, Entity::Player& player, std::shared_pt
{ {
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref(); auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
std::string subCommand; std::string subCommand;
std::string params = ""; std::string params;
// check if the command has parameters // check if the command has parameters
std::string tmpCommand = std::string( data + command->getName().length() + 1 ); std::string tmpCommand = std::string( data + command->getName().length() + 1 );
std::size_t pos = tmpCommand.find_first_of( " " ); std::size_t pos = tmpCommand.find_first_of( ' ' );
if( pos != std::string::npos ) if( pos != std::string::npos )
// command has parameters, grab the first part // command has parameters, grab the first part
@ -775,9 +775,8 @@ void DebugCommandMgr::script( char* data, Entity::Player& player, std::shared_pt
{ {
PlayerMgr::sendDebug( player, "Found {0} scripts", scripts.size() ); PlayerMgr::sendDebug( player, "Found {0} scripts", scripts.size() );
for( auto it = scripts.begin(); it != scripts.end(); ++it ) for( auto script : scripts )
{ {
auto script = *it;
PlayerMgr::sendDebug( player, " - '{0}', num scripts: {1}", script->library_name, script->scripts.size() ); PlayerMgr::sendDebug( player, " - '{0}', num scripts: {1}", script->library_name, script->scripts.size() );
} }
} }
@ -1411,7 +1410,7 @@ void DebugCommandMgr::easyWarp( char* data, Sapphire::Entity::Player& player, st
// check if the command has parameters // check if the command has parameters
std::string tmpCommand = std::string( data + command->getName().length() + 1 ); std::string tmpCommand = std::string( data + command->getName().length() + 1 );
std::size_t pos = tmpCommand.find_first_of( " " ); std::size_t pos = tmpCommand.find_first_of( ' ' );
if( pos != std::string::npos ) if( pos != std::string::npos )
// command has parameters, grab the first part // command has parameters, grab the first part

View file

@ -6,7 +6,6 @@
#include "PlayerMgr.h" #include "PlayerMgr.h"
#include "ShopMgr.h" #include "ShopMgr.h"
#include "Event/EventHandler.h" #include "Event/EventHandler.h"
#include "Event/Director.h"
#include "Event/EventDefs.h" #include "Event/EventDefs.h"
#include <Exd/ExdData.h> #include <Exd/ExdData.h>
@ -14,8 +13,6 @@
#include <datReader/DatCategories/bg/lgb.h> #include <datReader/DatCategories/bg/lgb.h>
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
#include "Network/PacketWrappers/ActorControlPacket.h"
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/EventStartPacket.h" #include "Network/PacketWrappers/EventStartPacket.h"
#include "Network/PacketWrappers/EventPlayPacket.h" #include "Network/PacketWrappers/EventPlayPacket.h"
@ -26,7 +23,6 @@
#include "Territory/Territory.h" #include "Territory/Territory.h"
#include "Territory/InstanceContent.h" #include "Territory/InstanceContent.h"
#include "Territory/QuestBattle.h"
#include "Action/EventAction.h" #include "Action/EventAction.h"
#include "WorldServer.h" #include "WorldServer.h"
@ -53,7 +49,7 @@ std::string EventMgr::getEventName( uint32_t eventId )
return unknown + "Quest"; return unknown + "Quest";
std::string name = questInfo->getString( questInfo->data().Text.Name ); std::string name = questInfo->getString( questInfo->data().Text.Name );
std::size_t pos = name.find_first_of( "_" ); std::size_t pos = name.find_first_of( '_' );
return name.substr( 0, pos ); return name.substr( 0, pos );
} }
@ -64,7 +60,7 @@ std::string EventMgr::getEventName( uint32_t eventId )
return unknown + "CustomTalk"; return unknown + "CustomTalk";
std::string name = customTalkInfo->getString( customTalkInfo->data().Text.Name ); std::string name = customTalkInfo->getString( customTalkInfo->data().Text.Name );
std::size_t pos = name.find_first_of( "_" ); std::size_t pos = name.find_first_of( '_' );
return name.substr( 0, pos ); return name.substr( 0, pos );
} }
@ -557,11 +553,11 @@ void EventMgr::playGilShop( Entity::Player& player, uint32_t eventId, uint32_t f
params[ 1 ] = static_cast< uint32_t >( params.size() - 3 ); //new max item size params[ 1 ] = static_cast< uint32_t >( params.size() - 3 ); //new max item size
auto& exdData = Common::Service< Data::ExdData >::ref(); auto& exdData = Common::Service< Data::ExdData >::ref();
for( auto it = player.getSoldItems()->cbegin(); it != player.getSoldItems()->cend(); ++it ) for( auto it : *player.getSoldItems() )
{ {
auto item = exdData.getRow< Excel::Item >( it->first ); auto item = exdData.getRow< Excel::Item >( it.first );
params.push_back( it->first ); //itemCatalogId params.push_back( it.first ); //itemCatalogId
params.push_back( it->second ); //stack params.push_back( it.second ); //stack
params.push_back( item->data().Price ); //price params.push_back( item->data().Price ); //price
params.push_back( 0 );//flag isHQ params.push_back( 0 );//flag isHQ
params.push_back( 0 );//numOfMateria params.push_back( 0 );//numOfMateria

View file

@ -1,8 +1,5 @@
#include <algorithm>
#include <iterator> #include <iterator>
#include <Logging/Logger.h>
#include <Service.h>
#include <Util/Util.h> #include <Util/Util.h>
#include "Actor/Player.h" #include "Actor/Player.h"

View file

@ -19,12 +19,9 @@
#include "Event/EventDefs.h" #include "Event/EventDefs.h"
#include "TerritoryMgr.h" #include "TerritoryMgr.h"
#include "Territory/Territory.h"
#include "Territory/HousingZone.h" #include "Territory/HousingZone.h"
#include "Territory/Housing/HousingInteriorTerritory.h" #include "Territory/Housing/HousingInteriorTerritory.h"
#include "HousingMgr.h"
#include "EventMgr.h" #include "EventMgr.h"
#include "TerritoryMgr.h"
#include "Territory/Land.h" #include "Territory/Land.h"
#include "WorldServer.h" #include "WorldServer.h"
#include "Territory/House.h" #include "Territory/House.h"
@ -245,7 +242,7 @@ void HousingMgr::initLandCache()
auto& containers = getEstateInventory( ident ); auto& containers = getEstateInventory( ident );
auto makeContainer = [ &containers, this ]( Common::InventoryType type, uint16_t size ) auto makeContainer = [ &containers ]( Common::InventoryType type, uint16_t size )
{ {
containers[ type ] = make_ItemContainer( type, size, "houseiteminventory", false, false ); containers[ type ] = make_ItemContainer( type, size, "houseiteminventory", false, false );
}; };
@ -649,15 +646,15 @@ bool HousingMgr::initHouseModels( Entity::Player& player, LandPtr land, uint32_t
{ {
auto& container = houseInventory[ destContainer.first ]; auto& container = houseInventory[ destContainer.first ];
for( auto& item : destContainer.second ) for( auto& itemIt : destContainer.second )
{ {
// small houses attic is just 0, ignore them // small houses attic is just 0, ignore them
if( item.second == 0 ) if( itemIt.second == 0 )
continue; continue;
auto pItem = invMgr.createItem( player, static_cast< uint32_t >( item.second ) ); auto pItem = invMgr.createItem( player, static_cast< uint32_t >( itemIt.second ) );
container->setItem( static_cast< uint8_t >( item.first ), pItem ); container->setItem( static_cast< uint8_t >( itemIt.first ), pItem );
} }
invMgr.saveHousingContainer( land->getLandIdent(), container ); invMgr.saveHousingContainer( land->getLandIdent(), container );
@ -880,7 +877,6 @@ void HousingMgr::sendEstateInventory( Entity::Player& player, uint16_t inventory
auto ident = internalZone->getLandIdent(); auto ident = internalZone->getLandIdent();
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum );
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
@ -1028,7 +1024,6 @@ void HousingMgr::reqPlaceHousingItem( Entity::Player& player, uint16_t landId, u
auto ident = zone->getLandIdent(); auto ident = zone->getLandIdent();
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum );
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
@ -1104,7 +1099,6 @@ void HousingMgr::reqPlaceItemInStore( Entity::Player& player, uint16_t landId, u
auto ident = zone->getLandIdent(); auto ident = zone->getLandIdent();
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum );
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
@ -1232,7 +1226,7 @@ bool HousingMgr::placeInteriorItem( Entity::Player& player, Inventory::HousingIt
invMgr.saveHousingContainer( ident, container ); invMgr.saveHousingContainer( ident, container );
invMgr.updateHousingItemPosition( item ); invMgr.updateHousingItemPosition( item );
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ); zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone );
assert( zone ); assert( zone );
zone->spawnHousingObject( containerIdx, static_cast< uint16_t >( freeSlot ), containerId, item ); zone->spawnHousingObject( containerIdx, static_cast< uint16_t >( freeSlot ), containerId, item );
@ -1410,7 +1404,6 @@ void HousingMgr::reqRemoveHousingItem( Entity::Player& player, uint16_t plot, ui
auto ident = terri->getLandIdent(); auto ident = terri->getLandIdent();
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum );
auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );

View file

@ -30,18 +30,18 @@ void InventoryMgr::sendInventoryContainer( Entity::Player& player, ItemContainer
auto sequence = player.getNextInventorySequence(); auto sequence = player.getNextInventorySequence();
auto pMap = container->getItemMap(); auto pMap = container->getItemMap();
for( auto itM = pMap.begin(); itM != pMap.end(); ++itM ) for( auto & itM : pMap )
{ {
if( !itM->second ) if( !itM.second )
return; return;
if( container->getId() == Common::InventoryType::Currency || container->getId() == Common::InventoryType::Crystal ) if( container->getId() == Common::InventoryType::Currency || container->getId() == Common::InventoryType::Crystal )
{ {
auto currencyInfoPacket = makeZonePacket< FFXIVIpcGilItem >( player.getId() ); auto currencyInfoPacket = makeZonePacket< FFXIVIpcGilItem >( player.getId() );
currencyInfoPacket->data().contextId = sequence; currencyInfoPacket->data().contextId = sequence;
currencyInfoPacket->data().item.catalogId = itM->second->getId(); currencyInfoPacket->data().item.catalogId = itM.second->getId();
currencyInfoPacket->data().item.subquarity = 1; currencyInfoPacket->data().item.subquarity = 1;
currencyInfoPacket->data().item.stack = itM->second->getStackSize(); currencyInfoPacket->data().item.stack = itM.second->getStackSize();
currencyInfoPacket->data().item.storageId = container->getId(); currencyInfoPacket->data().item.storageId = container->getId();
currencyInfoPacket->data().item.containerIndex = 0; currencyInfoPacket->data().item.containerIndex = 0;
@ -52,15 +52,15 @@ void InventoryMgr::sendInventoryContainer( Entity::Player& player, ItemContainer
auto itemInfoPacket = makeZonePacket< FFXIVIpcNormalItem >( player.getId() ); auto itemInfoPacket = makeZonePacket< FFXIVIpcNormalItem >( player.getId() );
itemInfoPacket->data().contextId = sequence; itemInfoPacket->data().contextId = sequence;
itemInfoPacket->data().item.storageId = container->getId(); itemInfoPacket->data().item.storageId = container->getId();
itemInfoPacket->data().item.containerIndex = itM->first; itemInfoPacket->data().item.containerIndex = itM.first;
itemInfoPacket->data().item.stack = itM->second->getStackSize(); itemInfoPacket->data().item.stack = itM.second->getStackSize();
itemInfoPacket->data().item.catalogId = itM->second->getId(); itemInfoPacket->data().item.catalogId = itM.second->getId();
itemInfoPacket->data().item.durability = itM->second->getDurability(); itemInfoPacket->data().item.durability = itM.second->getDurability();
// itemInfoPacket->data().spiritBond = itM->second->getSpiritbond(); // itemInfoPacket->data().spiritBond = itM->second->getSpiritbond();
// itemInfoPacket->data().reservedFlag = itM->second->getReservedFlag(); // itemInfoPacket->data().reservedFlag = itM->second->getReservedFlag();
// todo: not sure if correct flag? // todo: not sure if correct flag?
itemInfoPacket->data().item.flags = static_cast< uint8_t >( itM->second->isHq() ? 1 : 0 ); itemInfoPacket->data().item.flags = static_cast< uint8_t >( itM.second->isHq() ? 1 : 0 );
itemInfoPacket->data().item.stain = itM->second->getStain(); itemInfoPacket->data().item.stain = static_cast< uint8_t >( itM.second->getStain() );
server.queueForPlayer( player.getCharacterId(), itemInfoPacket ); server.queueForPlayer( player.getCharacterId(), itemInfoPacket );
} }

View file

@ -1,11 +1,9 @@
#include "ItemMgr.h" #include "ItemMgr.h"
#include "Inventory/ItemContainer.h"
#include "Inventory/Item.h" #include "Inventory/Item.h"
#include <Network/CommonActorControl.h> #include <Network/CommonActorControl.h>
#include <Exd/ExdData.h> #include <Exd/ExdData.h>
#include <Logging/Logger.h>
#include <Database/DatabaseDef.h> #include <Database/DatabaseDef.h>
#include <Service.h> #include <Service.h>
@ -180,7 +178,7 @@ Common::ContainerType ItemMgr::getContainerType( uint32_t containerId )
uint32_t ItemMgr::getNextUId() uint32_t ItemMgr::getNextUId()
{ {
uint32_t charId = 0; uint32_t charId;
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref(); auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
auto pQR = db.query( "SELECT MAX(ItemId) FROM charaglobalitem" ); auto pQR = db.query( "SELECT MAX(ItemId) FROM charaglobalitem" );

View file

@ -1,14 +1,11 @@
#include <algorithm>
#include <iterator> #include <iterator>
#include <Common.h> #include <Common.h>
#include <Exd/ExdData.h> #include <Exd/ExdData.h>
#include <Util/Util.h>
#include <Service.h> #include <Service.h>
#include <Logging/Logger.h> #include <Logging/Logger.h>
#include <Database/DatabaseDef.h> #include <Database/DatabaseDef.h>
#include <Service.h>
#include <Manager/ChatChannelMgr.h> #include <Manager/ChatChannelMgr.h>
#include <Network/GamePacket.h> #include <Network/GamePacket.h>
@ -20,7 +17,6 @@
#include "WorldServer.h" #include "WorldServer.h"
#include <Network/GameConnection.h> #include <Network/GameConnection.h>
#include <Network/GamePacket.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h> #include <Network/PacketDef/Zone/ServerZoneDef.h>
#include <Network/PacketWrappers/LinkshellResultPacket.h> #include <Network/PacketWrappers/LinkshellResultPacket.h>
#include <Network/PacketDef/ClientIpcs.h> #include <Network/PacketDef/ClientIpcs.h>
@ -48,7 +44,7 @@ bool LinkshellMgr::loadLinkshells()
auto func = []( std::set< uint64_t >& outList, std::vector< char >& inData ) auto func = []( std::set< uint64_t >& outList, std::vector< char >& inData )
{ {
if( inData.size() ) if( !inData.empty() )
{ {
size_t entryCount = inData.size() / 8; size_t entryCount = inData.size() / 8;
std::vector< uint64_t > list( entryCount ); std::vector< uint64_t > list( entryCount );
@ -128,7 +124,7 @@ void LinkshellMgr::writeLinkshell( uint64_t lsId )
query->setBinary( 3, leaderBin ); query->setBinary( 3, leaderBin );
query->setBinary( 4, inviteBin ); query->setBinary( 4, inviteBin );
query->setUInt64( 5, ls->getMasterId() ); query->setUInt64( 5, ls->getMasterId() );
query->setInt64( 6, lsId ); query->setInt64( 6, static_cast< int64_t >( lsId ) );
db.execute( query ); db.execute( query );
} }
@ -227,7 +223,7 @@ void LinkshellMgr::finishLinkshellAction( const std::string& name, uint32_t resu
} }
const std::vector< LinkshellPtr > LinkshellMgr::getPlayerLinkshells( Entity::Player& player ) const std::vector< LinkshellPtr > LinkshellMgr::getPlayerLinkshells( Entity::Player& player ) const
{ {
std::vector< LinkshellPtr > lsVec; std::vector< LinkshellPtr > lsVec;
@ -321,7 +317,7 @@ void LinkshellMgr::sendLinkshellList( Entity::Player& player )
for( int i = 0; i < lsVec.size(); ++i ) for( int i = 0; i < lsVec.size(); ++i )
{ {
auto pLs = lsVec[ i ]; auto pLs = lsVec[ i ];
uint32_t hierarchy = 0; uint32_t hierarchy;
if( pLs->getMasterId() == player.getCharacterId() ) if( pLs->getMasterId() == player.getCharacterId() )
hierarchy = Common::Ls::LinkshellHierarchy::Master << 8; hierarchy = Common::Ls::LinkshellHierarchy::Master << 8;
@ -486,8 +482,6 @@ void LinkshellMgr::changeMaster( Entity::Player &sourcePlayer, Entity::Player &n
bool LinkshellMgr::renameLinkshell( uint64_t linkshellId, const std::string &name, Entity::Player &player ) bool LinkshellMgr::renameLinkshell( uint64_t linkshellId, const std::string &name, Entity::Player &player )
{ {
auto& server = Common::Service< World::WorldServer >::ref();
auto lsPtr = getLinkshellById( linkshellId ); auto lsPtr = getLinkshellById( linkshellId );
if( !lsPtr ) if( !lsPtr )

View file

@ -51,7 +51,7 @@ namespace Sapphire::World::Manager
void sendLinkshellList( Entity::Player& player ); void sendLinkshellList( Entity::Player& player );
// get all linkshells associated with player // get all linkshells associated with player
const std::vector< LinkshellPtr > getPlayerLinkshells( Entity::Player& player ) const; std::vector< LinkshellPtr > getPlayerLinkshells( Entity::Player& player ) const;
LinkshellPtr getLinkshellById( uint64_t lsId ); LinkshellPtr getLinkshellById( uint64_t lsId );

View file

@ -1,9 +1,5 @@
#include "MarketMgr.h" #include "MarketMgr.h"
#include <Exd/ExdData.h>
#include <Logging/Logger.h>
#include <Network/CommonNetwork.h>
#include <Network/GamePacket.h> #include <Network/GamePacket.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h> #include <Network/PacketDef/Zone/ServerZoneDef.h>

View file

@ -1,6 +1,5 @@
#include <Common.h> #include <Common.h>
#include <Exd/ExdData.h> #include <Exd/ExdData.h>
#include <Util/Util.h>
#include <Service.h> #include <Service.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h> #include <Network/PacketDef/Zone/ServerZoneDef.h>
@ -365,7 +364,7 @@ void PartyMgr::sendPartyUpdate( Party& party )
if( !classJob ) if( !classJob )
continue; continue;
ZoneProtoDownPartyMember memberEntry; ZoneProtoDownPartyMember memberEntry{};
memberEntry.ParentEntityId = Common::INVALID_GAME_OBJECT_ID; memberEntry.ParentEntityId = Common::INVALID_GAME_OBJECT_ID;
memberEntry.PetEntityId = Common::INVALID_GAME_OBJECT_ID; memberEntry.PetEntityId = Common::INVALID_GAME_OBJECT_ID;

View file

@ -7,7 +7,6 @@
#include <Territory/Territory.h> #include <Territory/Territory.h>
#include <Manager/TerritoryMgr.h> #include <Manager/TerritoryMgr.h>
#include <Manager/HousingMgr.h>
#include "Script/ScriptMgr.h" #include "Script/ScriptMgr.h"
#include "WorldServer.h" #include "WorldServer.h"
@ -23,14 +22,12 @@
#include <Network/PacketWrappers/ModelEquipPacket.h> #include <Network/PacketWrappers/ModelEquipPacket.h>
#include <Network/PacketWrappers/PlayerStateFlagsPacket.h> #include <Network/PacketWrappers/PlayerStateFlagsPacket.h>
#include <Network/PacketWrappers/UpdateHpMpTpPacket.h> #include <Network/PacketWrappers/UpdateHpMpTpPacket.h>
#include "Network/PacketWrappers/PlayerSetupPacket.h"
#include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ChatPacket.h" #include "Network/PacketWrappers/ChatPacket.h"
#include "Network/PacketWrappers/HudParamPacket.h" #include "Network/PacketWrappers/HudParamPacket.h"
#include <Actor/Player.h> #include <Actor/Player.h>
#include <Actor/BNpc.h> #include <Actor/BNpc.h>
#include "Territory/InstanceObjectCache.h"
using namespace Sapphire; using namespace Sapphire;
using namespace Sapphire::World::Manager; using namespace Sapphire::World::Manager;
@ -61,7 +58,6 @@ void PlayerMgr::onOnlineStatusChanged( Entity::Player& player, bool updateProfil
void PlayerMgr::onEquipDisplayFlagsChanged( Entity::Player& player ) void PlayerMgr::onEquipDisplayFlagsChanged( Entity::Player& player )
{ {
auto& server = Common::Service< World::WorldServer >::ref();
auto paramPacket = makeZonePacket< FFXIVIpcConfig >( player.getId() ); auto paramPacket = makeZonePacket< FFXIVIpcConfig >( player.getId() );
paramPacket->data().flag = player.getEquipDisplayFlags(); paramPacket->data().flag = player.getEquipDisplayFlags();
player.sendToInRangeSet( paramPacket, true ); player.sendToInRangeSet( paramPacket, true );
@ -80,6 +76,7 @@ void PlayerMgr::onSendStateFlags( Entity::Player& player, bool updateInRange )
void PlayerMgr::onSendStats( Entity::Player& player ) void PlayerMgr::onSendStats( Entity::Player& player )
{ {
std::array< uint32_t, 50 > statParams; std::array< uint32_t, 50 > statParams;
std::fill( std::begin( statParams ), std::end( statParams ), 0 );
auto& exd = Common::Service< Data::ExdData >::ref(); auto& exd = Common::Service< Data::ExdData >::ref();

View file

@ -1,12 +1,10 @@
#include <Common.h> #include <Common.h>
#include <Exd/ExdData.h> #include <Exd/ExdData.h>
#include <Util/Util.h>
#include <Service.h> #include <Service.h>
#include "WorldServer.h" #include "WorldServer.h"
#include <Network/PacketDef/Zone/ServerZoneDef.h> #include <Network/PacketDef/Zone/ServerZoneDef.h>
#include <Exd/ExdData.h>
#include <Network/PacketContainer.h> #include <Network/PacketContainer.h>
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
@ -60,7 +58,6 @@ void QuestMgr::onRemoveQuest( Entity::Player &player, uint8_t questIndex )
bool QuestMgr::giveQuestRewards( Entity::Player& player, uint16_t questId, uint32_t optionalChoice ) bool QuestMgr::giveQuestRewards( Entity::Player& player, uint16_t questId, uint32_t optionalChoice )
{ {
auto& exdData = Common::Service< Data::ExdData >::ref(); auto& exdData = Common::Service< Data::ExdData >::ref();
uint32_t playerLevel = player.getLevel();
auto questInfo = exdData.getRow< Excel::Quest >( static_cast< uint32_t >( Event::EventHandler::EventHandlerType::Quest ) << 16 | questId ); auto questInfo = exdData.getRow< Excel::Quest >( static_cast< uint32_t >( Event::EventHandler::EventHandlerType::Quest ) << 16 | questId );
if( !questInfo ) if( !questInfo )

View file

@ -54,7 +54,6 @@ uint32_t ShopMgr::getShopItemPrices( uint32_t shopId, uint8_t index )
return getShopItemPrices( shopId, index ); return getShopItemPrices( shopId, index );
} }
return 0;
} }
bool ShopMgr::purchaseGilShopItem( Entity::Player& player, uint32_t shopId, uint16_t itemId, uint32_t quantity ) bool ShopMgr::purchaseGilShopItem( Entity::Player& player, uint32_t shopId, uint16_t itemId, uint32_t quantity )

View file

@ -10,7 +10,6 @@
#include "Actor/Player.h" #include "Actor/Player.h"
#include "Territory/Territory.h"
#include "Territory/InstanceContent.h" #include "Territory/InstanceContent.h"
#include "Territory/QuestBattle.h" #include "Territory/QuestBattle.h"
#include "TerritoryMgr.h" #include "TerritoryMgr.h"
@ -519,9 +518,9 @@ void TerritoryMgr::updateTerritoryInstances( uint64_t tickCount )
} }
// remove internal house zones with nobody in them // remove internal house zones with nobody in them
for( auto it = m_questBattleIdToInstanceMap.begin(); it != m_questBattleIdToInstanceMap.end(); ++it ) for( auto & it : m_questBattleIdToInstanceMap )
{ {
for( auto inIt = it->second.begin(); inIt != it->second.end(); ) for( auto inIt = it.second.begin(); inIt != it.second.end(); )
{ {
auto zone = std::dynamic_pointer_cast< QuestBattle >( inIt->second ); auto zone = std::dynamic_pointer_cast< QuestBattle >( inIt->second );
if( !zone ) if( !zone )
@ -545,9 +544,9 @@ void TerritoryMgr::updateTerritoryInstances( uint64_t tickCount )
} }
for( auto it = m_instanceContentIdToInstanceMap.begin(); it != m_instanceContentIdToInstanceMap.end(); ++it ) for( auto& it : m_instanceContentIdToInstanceMap )
{ {
for( auto inIt = it->second.begin(); inIt != it->second.end(); ) for( auto inIt = it.second.begin(); inIt != it.second.end(); )
{ {
auto zone = std::dynamic_pointer_cast< InstanceContent >( inIt->second ); auto zone = std::dynamic_pointer_cast< InstanceContent >( inIt->second );
if( !zone ) if( !zone )
@ -668,7 +667,7 @@ void TerritoryMgr::createAndJoinQuestBattle( Entity::Player& player, uint16_t qu
bool TerritoryMgr::joinWorld( Entity::Player& player ) bool TerritoryMgr::joinWorld( Entity::Player& player )
{ {
TerritoryPtr pCurrZone = nullptr; TerritoryPtr pCurrZone;
auto territoryTypeId = player.getTerritoryTypeId(); auto territoryTypeId = player.getTerritoryTypeId();

View file

@ -1,4 +1,3 @@
#include <Logging/Logger.h>
#include <Service.h> #include <Service.h>
#include "TaskMgr.h" #include "TaskMgr.h"
@ -13,7 +12,6 @@
#include "Territory/Territory.h" #include "Territory/Territory.h"
#include "Network/PacketWrappers/ActorControlSelfPacket.h" #include "Network/PacketWrappers/ActorControlSelfPacket.h"
#include "Network/PacketWrappers/ActorControlPacket.h" #include "Network/PacketWrappers/ActorControlPacket.h"
#include "Network/PacketWrappers/WarpPacket.h"
#include "Actor/Player.h" #include "Actor/Player.h"
using namespace Sapphire::World::Manager; using namespace Sapphire::World::Manager;
@ -98,8 +96,6 @@ void WarpMgr::finishWarp( Entity::Player& player )
void WarpMgr::requestWarp( Entity::Player& player, Common::WarpType warpType, Common::FFXIVARR_POSITION3 targetPos, float targetRot ) void WarpMgr::requestWarp( Entity::Player& player, Common::WarpType warpType, Common::FFXIVARR_POSITION3 targetPos, float targetRot )
{ {
m_entityIdToWarpInfoMap[ player.getId() ] = { 0, warpType, targetPos, targetRot }; m_entityIdToWarpInfoMap[ player.getId() ] = { 0, warpType, targetPos, targetRot };
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
auto& server = Common::Service< WorldServer >::ref();
player.sendToInRangeSet( makeActorControl( player.getId(), WarpStart, warpType, 1, 0, player.getTerritoryTypeId(), 1 ), true ); player.sendToInRangeSet( makeActorControl( player.getId(), WarpStart, warpType, 1, 0, player.getTerritoryTypeId(), 1 ), true );
player.sendToInRangeSet( makeActorControl( player.getId(), ActorDespawnEffect, warpType ) ); player.sendToInRangeSet( makeActorControl( player.getId(), ActorDespawnEffect, warpType ) );