1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

Merge branch 'develop' into opcode_update

This commit is contained in:
Adam 2020-01-02 14:21:39 +11:00 committed by GitHub
commit 6af408a24d
13 changed files with 166 additions and 166 deletions

View file

@ -206,7 +206,7 @@ bool Action::Action::update()
uint64_t tickCount = Common::Util::getTimeMs(); uint64_t tickCount = Common::Util::getTimeMs();
if( !hasCastTime() || std::difftime( tickCount, m_startTime ) > m_castTimeMs ) if( !hasCastTime() || std::difftime( static_cast< time_t >( tickCount ), static_cast< time_t >( m_startTime ) ) > m_castTimeMs )
{ {
execute(); execute();
return true; return true;
@ -257,7 +257,7 @@ void Action::Action::start()
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
// check the lut too and see if we have something usable, otherwise cancel the cast // check the lut too and see if we have something usable, otherwise cancel the cast
if( !pScriptMgr->onStart( *this ) && !ActionLut::validEntryExists( getId() ) ) if( !pScriptMgr->onStart( *this ) && !ActionLut::validEntryExists( static_cast< uint16_t >( getId() ) ) )
{ {
// script not implemented and insufficient lut data (no potencies) // script not implemented and insufficient lut data (no potencies)
interrupt(); interrupt();
@ -392,7 +392,7 @@ void Action::Action::buildEffects()
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
if( !pScriptMgr->onExecute( *this ) && !ActionLut::validEntryExists( getId() ) ) if( !pScriptMgr->onExecute( *this ) && !ActionLut::validEntryExists( static_cast< uint16_t >( getId() ) ) )
{ {
if( auto player = m_pSource->getAsPlayer() ) if( auto player = m_pSource->getAsPlayer() )
{ {
@ -405,7 +405,7 @@ void Action::Action::buildEffects()
if( m_hitActors.empty() ) if( m_hitActors.empty() )
return; return;
auto lutEntry = ActionLut::getEntry( getId() ); auto lutEntry = ActionLut::getEntry( static_cast< uint16_t >( getId() ) );
// no script exists but we have a valid lut entry // no script exists but we have a valid lut entry
if( auto player = getSourceChara()->getAsPlayer() ) if( auto player = getSourceChara()->getAsPlayer() )
@ -545,11 +545,11 @@ bool Action::Action::primaryCostCheck( bool subtractCosts )
auto cost = m_primaryCost * 100; auto cost = m_primaryCost * 100;
if( curMp < cost ) if( curMp < static_cast< uint32_t >( cost ) )
return false; return false;
if( subtractCosts ) if( subtractCosts )
m_pSource->setMp( curMp - cost ); m_pSource->setMp( curMp - static_cast< uint32_t >( cost ) );
return true; return true;
} }

View file

@ -301,7 +301,7 @@ Sapphire::Entity::CharaPtr Sapphire::Entity::BNpc::hateListGetHighest()
void Sapphire::Entity::BNpc::hateListAdd( Sapphire::Entity::CharaPtr pChara, int32_t hateAmount ) void Sapphire::Entity::BNpc::hateListAdd( Sapphire::Entity::CharaPtr pChara, int32_t hateAmount )
{ {
auto hateEntry = std::make_shared< HateListEntry >(); auto hateEntry = std::make_shared< HateListEntry >();
hateEntry->m_hateAmount = hateAmount; hateEntry->m_hateAmount = static_cast< uint32_t >( hateAmount );
hateEntry->m_pChara = pChara; hateEntry->m_pChara = pChara;
m_hateList.insert( hateEntry ); m_hateList.insert( hateEntry );
@ -318,13 +318,13 @@ void Sapphire::Entity::BNpc::hateListUpdate( Sapphire::Entity::CharaPtr pChara,
{ {
if( listEntry->m_pChara == pChara ) if( listEntry->m_pChara == pChara )
{ {
listEntry->m_hateAmount += hateAmount; listEntry->m_hateAmount += static_cast< uint32_t >( hateAmount );
return; return;
} }
} }
auto hateEntry = std::make_shared< HateListEntry >(); auto hateEntry = std::make_shared< HateListEntry >();
hateEntry->m_hateAmount = hateAmount; hateEntry->m_hateAmount = static_cast< uint32_t >( hateAmount );
hateEntry->m_pChara = pChara; hateEntry->m_pChara = pChara;
m_hateList.insert( hateEntry ); m_hateList.insert( hateEntry );
} }
@ -590,7 +590,7 @@ void Sapphire::Entity::BNpc::onDeath()
// TODO: handle drops // TODO: handle drops
auto pPlayer = pHateEntry->m_pChara->getAsPlayer(); auto pPlayer = pHateEntry->m_pChara->getAsPlayer();
if( pPlayer ) if( pPlayer )
pPlayer->onMobKill( m_bNpcNameId ); pPlayer->onMobKill( static_cast< uint16_t >( m_bNpcNameId ) );
} }
hateListClear(); hateListClear();
} }
@ -654,7 +654,7 @@ void Sapphire::Entity::BNpc::setOwner( Sapphire::Entity::CharaPtr m_pChara )
{ {
auto setOwnerPacket = makeZonePacket< FFXIVIpcActorOwner >( getId() ); auto setOwnerPacket = makeZonePacket< FFXIVIpcActorOwner >( getId() );
setOwnerPacket->data().type = 0x01; setOwnerPacket->data().type = 0x01;
setOwnerPacket->data().actorId = INVALID_GAME_OBJECT_ID; setOwnerPacket->data().actorId = static_cast< uint32_t >( INVALID_GAME_OBJECT_ID );
sendToInRangeSet( setOwnerPacket ); sendToInRangeSet( setOwnerPacket );
} }
} }
@ -697,7 +697,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 ); auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) ); effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
Common::EffectEntry effectEntry{}; Common::EffectEntry effectEntry{};
effectEntry.value = damage; effectEntry.value = static_cast< int16_t >( damage );
effectEntry.effectType = ActionEffectType::Damage; effectEntry.effectType = ActionEffectType::Damage;
effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage; effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage;
effectEntry.param = 0x71; effectEntry.param = 0x71;
@ -705,7 +705,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
sendToInRangeSet( effectPacket ); sendToInRangeSet( effectPacket );
pTarget->takeDamage( damage ); pTarget->takeDamage( static_cast< uint16_t >( damage ) );
} }
} }
@ -731,13 +731,13 @@ void Sapphire::Entity::BNpc::calculateStats()
m_baseStats.determination = static_cast< uint32_t >( base ); m_baseStats.determination = static_cast< uint32_t >( base );
m_baseStats.pie = static_cast< uint32_t >( base ); m_baseStats.pie = static_cast< uint32_t >( base );
m_baseStats.skillSpeed = paramGrowthInfo->baseSpeed; m_baseStats.skillSpeed = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.spellSpeed = paramGrowthInfo->baseSpeed; m_baseStats.spellSpeed = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.accuracy = paramGrowthInfo->baseSpeed; m_baseStats.accuracy = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.critHitRate = paramGrowthInfo->baseSpeed; m_baseStats.critHitRate = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.attackPotMagic = paramGrowthInfo->baseSpeed; m_baseStats.attackPotMagic = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.healingPotMagic = paramGrowthInfo->baseSpeed; m_baseStats.healingPotMagic = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.tenacity = paramGrowthInfo->baseSpeed; m_baseStats.tenacity = static_cast< uint32_t >( paramGrowthInfo->baseSpeed );
m_baseStats.attack = m_baseStats.str; m_baseStats.attack = m_baseStats.str;
m_baseStats.attackPotMagic = m_baseStats.inte; m_baseStats.attackPotMagic = m_baseStats.inte;

View file

@ -245,14 +245,14 @@ void Sapphire::Entity::Chara::setMp( uint32_t mp )
/*! \param gp amount to set*/ /*! \param gp amount to set*/
void Sapphire::Entity::Chara::setGp( uint32_t gp ) void Sapphire::Entity::Chara::setGp( uint32_t gp )
{ {
m_gp = gp; m_gp = static_cast< uint16_t >( gp );
sendStatusUpdate(); sendStatusUpdate();
} }
/*! \param tp amount to set*/ /*! \param tp amount to set*/
void Sapphire::Entity::Chara::setTp( uint32_t tp ) void Sapphire::Entity::Chara::setTp( uint32_t tp )
{ {
m_tp = tp; m_tp = static_cast< uint16_t >( tp );
sendStatusUpdate(); sendStatusUpdate();
} }
@ -316,7 +316,7 @@ bool Sapphire::Entity::Chara::face( const Common::FFXIVARR_POSITION3& p )
setRot( newRot ); setRot( newRot );
return oldRot != newRot; return ( fabs( oldRot - newRot ) <= std::numeric_limits< float >::epsilon() * fmax( fabs( oldRot ), fabs( newRot ) ) );
} }
/*! /*!
@ -354,14 +354,14 @@ bool Sapphire::Entity::Chara::checkAction()
void Sapphire::Entity::Chara::update( uint64_t tickCount ) void Sapphire::Entity::Chara::update( uint64_t tickCount )
{ {
if( std::difftime( tickCount, m_lastTickTime ) > 3000 ) if( std::difftime( static_cast< time_t >( tickCount ), m_lastTickTime ) > 3000 )
{ {
onTick(); onTick();
m_lastTickTime = tickCount; m_lastTickTime = static_cast< time_t >( tickCount );
} }
m_lastUpdate = tickCount; m_lastUpdate = static_cast< time_t >( tickCount );
} }
/*! /*!
@ -494,7 +494,7 @@ void Sapphire::Entity::Chara::autoAttack( CharaPtr pTarget )
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 ); auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) ); effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
Common::EffectEntry effectEntry{}; Common::EffectEntry effectEntry{};
effectEntry.value = damage; effectEntry.value = static_cast< int16_t >( damage );
effectEntry.effectType = ActionEffectType::Damage; effectEntry.effectType = ActionEffectType::Damage;
effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage; effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage;
effectEntry.param = 0x71; effectEntry.param = 0x71;
@ -522,10 +522,10 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
statusEffectAdd->data().actor_id = pEffect->getTargetActorId(); statusEffectAdd->data().actor_id = pEffect->getTargetActorId();
statusEffectAdd->data().current_hp = getHp(); statusEffectAdd->data().current_hp = getHp();
statusEffectAdd->data().current_mp = getMp(); statusEffectAdd->data().current_mp = static_cast< uint16_t >( getMp() );
//statusEffectAdd->data().current_tp = getTp(); //statusEffectAdd->data().current_tp = getTp();
statusEffectAdd->data().max_hp = getMaxHp(); statusEffectAdd->data().max_hp = getMaxHp();
statusEffectAdd->data().max_mp = getMaxMp(); statusEffectAdd->data().max_mp = static_cast< uint16_t >( getMaxMp() );
//statusEffectAdd->data().max_something = 1; //statusEffectAdd->data().max_something = 1;
//statusEffectAdd->data().unknown2 = 28; //statusEffectAdd->data().unknown2 = 28;
statusEffectAdd->data().classId = static_cast< uint8_t >(getClass()); statusEffectAdd->data().classId = static_cast< uint8_t >(getClass());
@ -535,8 +535,8 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
status.sourceActorId = pEffect->getSrcActorId(); status.sourceActorId = pEffect->getSrcActorId();
status.duration = static_cast< float >( pEffect->getDuration() ) / 1000; status.duration = static_cast< float >( pEffect->getDuration() ) / 1000;
status.id = pEffect->getId(); status.id = static_cast< uint16_t >( pEffect->getId() );
status.index = nextSlot; status.index = static_cast< uint8_t >( nextSlot );
status.param = pEffect->getParam(); status.param = pEffect->getParam();
sendToInRangeSet( statusEffectAdd, isPlayer() ); sendToInRangeSet( statusEffectAdd, isPlayer() );
@ -570,7 +570,7 @@ int8_t Sapphire::Entity::Chara::getStatusEffectFreeSlot()
if( m_statusEffectFreeSlotQueue.empty() ) if( m_statusEffectFreeSlotQueue.empty() )
return freeEffectSlot; return freeEffectSlot;
freeEffectSlot = m_statusEffectFreeSlotQueue.front(); freeEffectSlot = static_cast< int8_t >( m_statusEffectFreeSlotQueue.front() );
m_statusEffectFreeSlotQueue.pop(); m_statusEffectFreeSlotQueue.pop();
return freeEffectSlot; return freeEffectSlot;

View file

@ -200,7 +200,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
int32_t aetheryteId; int32_t aetheryteId;
sscanf( params.c_str(), "%i", &aetheryteId ); sscanf( params.c_str(), "%i", &aetheryteId );
player.teleport( aetheryteId ); player.teleport( static_cast< uint16_t >( aetheryteId ) );
} }
else if( ( subCommand == "discovery" ) && ( params != "" ) ) else if( ( subCommand == "discovery" ) && ( params != "" ) )
{ {
@ -209,8 +209,8 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
sscanf( params.c_str(), "%i %i", &map_id, &discover_id ); sscanf( params.c_str(), "%i %i", &map_id, &discover_id );
auto discoveryPacket = makeZonePacket< FFXIVIpcDiscovery >( player.getId() ); auto discoveryPacket = makeZonePacket< FFXIVIpcDiscovery >( player.getId() );
discoveryPacket->data().map_id = map_id; discoveryPacket->data().map_id = static_cast< uint32_t >( map_id );
discoveryPacket->data().map_part_id = discover_id; discoveryPacket->data().map_part_id = static_cast< uint32_t >( discover_id );
player.queuePacket( discoveryPacket ); player.queuePacket( discoveryPacket );
} }
@ -258,7 +258,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
int32_t minutes; int32_t minutes;
sscanf( params.c_str(), "%d", &minutes ); sscanf( params.c_str(), "%d", &minutes );
player.setCFPenaltyMinutes( minutes ); player.setCFPenaltyMinutes( static_cast< uint32_t >( minutes ) );
} }
else if( subCommand == "eorzeatime" ) else if( subCommand == "eorzeatime" )
{ {
@ -274,7 +274,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
player.dismount(); player.dismount();
player.mount( id ); player.mount( static_cast< uint32_t >( id ) );
} }
else if( subCommand == "msqguide" ) else if( subCommand == "msqguide" )
{ {
@ -282,7 +282,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerProgress >( player.getId() ); auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerProgress >( player.getId() );
msqPacket->data().id = id; msqPacket->data().id = static_cast< uint32_t >( id );
player.queuePacket( msqPacket ); player.queuePacket( msqPacket );
player.sendDebug( "MSQ Guide updated " ); player.sendDebug( "MSQ Guide updated " );
@ -293,7 +293,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerComplete >( player.getId() ); auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerComplete >( player.getId() );
msqPacket->data().id = id; msqPacket->data().id = static_cast< uint32_t >( id );
player.queuePacket( msqPacket ); player.queuePacket( msqPacket );
player.sendDebug( "MSQ Guide updated " ); player.sendDebug( "MSQ Guide updated " );
@ -434,7 +434,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
uint32_t titleId; uint32_t titleId;
sscanf( params.c_str(), "%u", &titleId ); sscanf( params.c_str(), "%u", &titleId );
player.addTitle( titleId ); player.addTitle( static_cast< uint16_t >( titleId ) );
player.sendNotice( "Added title (id#{0})", titleId ); player.sendNotice( "Added title (id#{0})", titleId );
} }
else if( subCommand == "bnpc" ) else if( subCommand == "bnpc" )
@ -495,13 +495,13 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
player.sendNotice( "Injecting ACTOR_CONTROL {0}", opcode ); player.sendNotice( "Injecting ACTOR_CONTROL {0}", opcode );
auto actorControl = makeZonePacket< FFXIVIpcActorControlSelf >( playerId, player.getId() ); auto actorControl = makeZonePacket< FFXIVIpcActorControlSelf >( playerId, player.getId() );
actorControl->data().category = opcode; actorControl->data().category = static_cast< uint16_t >( opcode );
actorControl->data().param1 = param1; actorControl->data().param1 = static_cast< uint16_t >( param1 );
actorControl->data().param2 = param2; actorControl->data().param2 = static_cast< uint16_t >( param2 );
actorControl->data().param3 = param3; actorControl->data().param3 = static_cast< uint16_t >( param3 );
actorControl->data().param4 = param4; actorControl->data().param4 = static_cast< uint16_t >( param4 );
actorControl->data().param5 = param5; actorControl->data().param5 = static_cast< uint16_t >( param5 );
actorControl->data().param6 = param6; actorControl->data().param6 = static_cast< uint16_t >( param6 );
player.queuePacket( actorControl ); player.queuePacket( actorControl );
@ -521,7 +521,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
uint32_t id; uint32_t id;
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
player.learnAction( id ); player.learnAction( static_cast< uint16_t >( id ) );
} }
else if ( subCommand == "effect") else if ( subCommand == "effect")
{ {
@ -532,7 +532,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
effectPacket->setRotation( Common::Util::floatToUInt16Rot( player.getRot() ) ); effectPacket->setRotation( Common::Util::floatToUInt16Rot( player.getRot() ) );
Common::EffectEntry entry{}; Common::EffectEntry entry{};
entry.value = param1; entry.value = static_cast< int16_t >( param1 );
entry.effectType = Common::ActionEffectType::Damage; entry.effectType = Common::ActionEffectType::Damage;
entry.hitSeverity = Common::ActionHitSeverityType::NormalDamage; entry.hitSeverity = Common::ActionHitSeverityType::NormalDamage;

View file

@ -159,7 +159,7 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
continue; continue;
} }
container->second->setItem( slot, item ); container->second->setItem( static_cast< uint8_t >( slot ), item );
itemCount++; itemCount++;
} }
@ -182,7 +182,7 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
// land stuff // land stuff
entry.m_landSetId = res->getUInt64( "LandSetId" ); entry.m_landSetId = res->getUInt64( "LandSetId" );
entry.m_landId = res->getUInt( "LandId" ); entry.m_landId = static_cast< uint16_t >( res->getUInt( "LandId" ) );
entry.m_type = static_cast< Common::LandType >( res->getUInt( "Type" ) ); entry.m_type = static_cast< Common::LandType >( res->getUInt( "Type" ) );
entry.m_size = static_cast< Common::HouseSize >( res->getUInt8( "Size" ) ); entry.m_size = static_cast< Common::HouseSize >( res->getUInt8( "Size" ) );
@ -233,9 +233,9 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
// setup containers // setup containers
// todo: this is pretty garbage // todo: this is pretty garbage
Common::LandIdent ident; Common::LandIdent ident;
ident.territoryTypeId = entry.m_landSetId >> 16; ident.territoryTypeId = static_cast< int16_t >( entry.m_landSetId >> 16 );
ident.wardNum = entry.m_landSetId & 0xFFFF; ident.wardNum = static_cast< int16_t >( entry.m_landSetId & 0xFFFF );
ident.landId = entry.m_landId; ident.landId = static_cast< int16_t >( entry.m_landId );
ident.worldId = 67; ident.worldId = 67;
auto& containers = getEstateInventory( ident ); auto& containers = getEstateInventory( ident );
@ -305,20 +305,20 @@ Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32
if( !hZone ) if( !hZone )
return nullptr; return nullptr;
return hZone->getLand( res->getUInt( 2 ) ); return hZone->getLand( static_cast< uint8_t >( res->getUInt( 2 ) ) );
} }
void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident )
{ {
player.setActiveLand( ident.landId, ident.wardNum ); player.setActiveLand( static_cast< uint8_t >( ident.landId ), static_cast< uint8_t >( ident.wardNum ) );
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -335,7 +335,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl
std::strcpy( landInfoSignPacket->data().estateGreeting, house->getHouseGreeting().c_str() ); std::strcpy( landInfoSignPacket->data().estateGreeting, house->getHouseGreeting().c_str() );
} }
uint32_t playerId = land->getOwnerId(); uint32_t playerId = static_cast< uint32_t >( land->getOwnerId() );
std::string playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( playerId ); std::string playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( playerId );
memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() ); memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
@ -345,15 +345,15 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl
void Sapphire::World::Manager::HousingMgr::sendLandSignFree( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::sendLandSignFree( Entity::Player& player, const Common::LandIdent ident )
{ {
player.setActiveLand( ident.landId, ident.wardNum ); player.setActiveLand( static_cast< uint8_t >( ident.landId ), static_cast< uint8_t >( ident.wardNum ) );
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
auto plotPricePacket = makeZonePacket< Server::FFXIVIpcLandPriceUpdate >( player.getId() ); auto plotPricePacket = makeZonePacket< Server::FFXIVIpcLandPriceUpdate >( player.getId() );
plotPricePacket->data().price = land->getCurrentPrice(); plotPricePacket->data().price = land->getCurrentPrice();
plotPricePacket->data().timeLeft = land->getDevaluationTime(); plotPricePacket->data().timeLeft = land->getDevaluationTime();
@ -471,7 +471,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
auto wardInfoPacket = makeZonePacket< Server::FFXIVIpcHousingWardInfo >( player.getId() ); auto wardInfoPacket = makeZonePacket< Server::FFXIVIpcHousingWardInfo >( player.getId() );
wardInfoPacket->data().landIdent.wardNum = wardId; wardInfoPacket->data().landIdent.wardNum = wardId;
wardInfoPacket->data().landIdent.territoryTypeId = territoryTypeId; wardInfoPacket->data().landIdent.territoryTypeId = static_cast< int16_t >( territoryTypeId );
// todo: properly get worldId // todo: properly get worldId
wardInfoPacket->data().landIdent.worldId = 67; wardInfoPacket->data().landIdent.worldId = 67;
@ -509,7 +509,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned; entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
auto owner = land->getOwnerId(); auto owner = land->getOwnerId();
auto playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( owner ); auto playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( static_cast< uint32_t >( owner ) );
memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() ); memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() );
break; break;
@ -524,13 +524,13 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
void Sapphire::World::Manager::HousingMgr::sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -630,9 +630,9 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
if( item.second == 0 ) if( item.second == 0 )
continue; continue;
auto pItem = invMgr->createItem( player, item.second ); auto pItem = invMgr->createItem( player, static_cast< uint32_t >( item.second ) );
container->setItem( item.first, pItem ); container->setItem( static_cast< uint8_t >( item.first ), pItem );
} }
invMgr->saveHousingContainer( land->getLandIdent(), container ); invMgr->saveHousingContainer( land->getLandIdent(), container );
@ -701,7 +701,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
// start house built event // start house built event
// CmnDefHousingBuildHouse_00149 // CmnDefHousingBuildHouse_00149
player.eventStart( player.getId(), 0x000B0095, Event::EventHandler::EventType::Housing, 1, 1 ); player.eventStart( player.getId(), 0x000B0095, Event::EventHandler::EventType::Housing, 1, 1 );
player.playScene( 0x000B0095, 0, SET_BASE | HIDE_HOTBAR , 0, 1, plotNum, nullptr ); player.playScene( 0x000B0095, 0, static_cast< uint32_t >( SET_BASE | HIDE_HOTBAR ) , 0, 1, plotNum, nullptr );
player.setLandFlags( LandFlagsSlot::Private, EstateBuilt, ident ); player.setLandFlags( LandFlagsSlot::Private, EstateBuilt, ident );
player.sendLandFlagsSlot( LandFlagsSlot::Private ); player.sendLandFlagsSlot( LandFlagsSlot::Private );
@ -711,13 +711,13 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
auto house = land->getHouse(); auto house = land->getHouse();
if( !house ) if( !house )
@ -733,13 +733,13 @@ void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player&
void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Player& player, const Common::LandIdent ident )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -757,13 +757,13 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Pl
void Sapphire::World::Manager::HousingMgr::updateEstateGreeting( Entity::Player& player, const Common::LandIdent ident, const std::string& greeting ) void Sapphire::World::Manager::HousingMgr::updateEstateGreeting( Entity::Player& player, const Common::LandIdent ident, const std::string& greeting )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto zone = getHousingZoneByLandSetId( landSetId ); auto zone = getHousingZoneByLandSetId( landSetId );
if( !zone ) if( !zone )
return; return;
auto land = zone->getLand( ident.landId ); auto land = zone->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -782,7 +782,7 @@ void Sapphire::World::Manager::HousingMgr::updateEstateGreeting( Entity::Player&
void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity::Player& player, const Common::LandIdent ident ) void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity::Player& player, const Common::LandIdent ident )
{ {
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto hZone = getHousingZoneByLandSetId( landSetId ); auto hZone = getHousingZoneByLandSetId( landSetId );
if( !hZone ) if( !hZone )
@ -804,13 +804,13 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity:
Sapphire::Common::LandIdent Sapphire::World::Manager::HousingMgr::clientTriggerParamsToLandIdent( uint32_t param11, uint32_t param12, bool use16bits ) const Sapphire::Common::LandIdent Sapphire::World::Manager::HousingMgr::clientTriggerParamsToLandIdent( uint32_t param11, uint32_t param12, bool use16bits ) const
{ {
Common::LandIdent ident; Common::LandIdent ident;
ident.worldId = param11 >> 16; ident.worldId = static_cast< int16_t >( param11 >> 16 );
ident.territoryTypeId = param11 & 0xFFFF; ident.territoryTypeId = static_cast< int16_t >( param11 & 0xFFFF );
if( use16bits ) if( use16bits )
{ {
ident.wardNum = param12 >> 16; ident.wardNum = static_cast< int16_t >( param12 >> 16 );
ident.landId = param12 & 0xFFFF; ident.landId = static_cast< int16_t >( param12 & 0xFFFF );
} }
else else
{ {
@ -837,13 +837,13 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
auto ident = internalZone->getLandIdent(); auto ident = internalZone->getLandIdent();
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto exteriorZone = getHousingZoneByLandSetId( landSetId ); auto exteriorZone = getHousingZoneByLandSetId( landSetId );
if( !exteriorZone ) if( !exteriorZone )
return; return;
targetLand = exteriorZone->getLand( ident.landId ); targetLand = exteriorZone->getLand( static_cast< uint8_t >( ident.landId ) );
} }
else else
{ {
@ -974,7 +974,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
// inside housing territory // inside housing territory
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) ) if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
{ {
land = zone->getLand( landId ); land = zone->getLand( static_cast< uint8_t >( landId ) );
isOutside = true; isOutside = true;
} }
@ -985,9 +985,9 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
// todo: this whole process is retarded and needs to be fixed // todo: this whole process is retarded and needs to be fixed
// perhaps maintain a list of estates by ident inside housingmgr? // perhaps maintain a list of estates by ident inside housingmgr?
auto ident = zone->getLandIdent(); auto ident = zone->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
} }
// wtf? // wtf?
else else
@ -1047,7 +1047,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) ) if( auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
{ {
land = zone->getLand( landId ); land = zone->getLand( static_cast< uint8_t >( landId ) );
isOutside = true; isOutside = true;
} }
else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >(
@ -1056,9 +1056,9 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
// todo: this whole process is retarded and needs to be fixed // todo: this whole process is retarded and needs to be fixed
// perhaps maintain a list of estates by ident inside housingmgr? // perhaps maintain a list of estates by ident inside housingmgr?
auto ident = zone->getLandIdent(); auto ident = zone->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
} }
if( !hasPermission( player, *land, 0 ) ) if( !hasPermission( player, *land, 0 ) )
@ -1080,7 +1080,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
if( !item ) if( !item )
return; return;
container->setItem( freeSlot, item ); container->setItem( static_cast< uint8_t >( freeSlot ), item );
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
invMgr->saveHousingContainer( ident, container ); invMgr->saveHousingContainer( ident, container );
} }
@ -1103,7 +1103,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity
if( !item ) if( !item )
return; return;
container->setItem( freeSlot, item ); container->setItem( static_cast< uint8_t >( freeSlot ), item );
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
invMgr->saveHousingContainer( ident, container ); invMgr->saveHousingContainer( ident, container );
} }
@ -1125,7 +1125,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
return false; return false;
// add item to inv // add item to inv
container->setItem( freeSlot, item ); container->setItem( static_cast< uint8_t >( freeSlot ), item );
// we need to save the item again as removing it from the container on the player will remove it from charaglobalitem // we need to save the item again as removing it from the container on the player will remove it from charaglobalitem
// todo: this needs to be handled a bit better as it might be possible to overwrite another item that is created in the meantime // todo: this needs to be handled a bit better as it might be possible to overwrite another item that is created in the meantime
@ -1139,7 +1139,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ); auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
assert( zone ); assert( zone );
zone->spawnYardObject( ident.landId, freeSlot, *item ); zone->spawnYardObject( static_cast< uint8_t >( ident.landId ), static_cast< uint16_t >( freeSlot ), *item );
return true; return true;
} }
@ -1173,7 +1173,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
} }
// have a free slot // have a free slot
container->setItem( freeSlot, item ); container->setItem( static_cast< uint8_t >( freeSlot ), item );
// resend container // resend container
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
@ -1183,7 +1183,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() ); auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
assert( zone ); assert( zone );
zone->spawnHousingObject( containerIdx, freeSlot, containerId, item ); zone->spawnHousingObject( containerIdx, static_cast< uint16_t >( freeSlot ), containerId, item );
return true; return true;
} }
@ -1235,8 +1235,8 @@ void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& p
Common::LandIdent ident, uint8_t slot, Common::LandIdent ident, uint8_t slot,
Common::FFXIVARR_POSITION3 pos, float rot ) Common::FFXIVARR_POSITION3 pos, float rot )
{ {
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -1282,7 +1282,7 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
auto container = it->second; auto container = it->second;
auto item = std::dynamic_pointer_cast< Inventory::HousingItem >( container->getItem( slotIdx ) ); auto item = std::dynamic_pointer_cast< Inventory::HousingItem >( container->getItem( static_cast< uint8_t >( slotIdx ) ) );
if( !item ) if( !item )
return false; return false;
@ -1293,10 +1293,10 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();
invMgr->updateHousingItemPosition( item ); invMgr->updateHousingItemPosition( item );
terri.updateHousingObjectPosition( player, slot, item->getPos(), item->getRot() ); terri.updateHousingObjectPosition( player, slot, item->getPos(), static_cast< uint16_t >( item->getRot() ) );
// send confirmation to player // send confirmation to player
uint32_t param1 = ( ident.landId << 16 ) | containerId; uint32_t param1 = static_cast< uint32_t >( ( ident.landId << 16 ) | containerId );
player.queuePacket( player.queuePacket(
Server::makeActorControlSelf( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slotIdx ) ); Server::makeActorControlSelf( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slotIdx ) );
@ -1309,7 +1309,7 @@ bool Sapphire::World::Manager::HousingMgr::moveExternalItem( Entity::Player& pla
Sapphire::HousingZone& terri, Common::FFXIVARR_POSITION3 pos, Sapphire::HousingZone& terri, Common::FFXIVARR_POSITION3 pos,
float rot ) float rot )
{ {
auto land = terri.getLand( ident.landId ); auto land = terri.getLand( static_cast< uint8_t >( ident.landId ) );
if( !hasPermission( player, *land, 0 ) ) if( !hasPermission( player, *land, 0 ) )
return false; return false;
@ -1331,9 +1331,9 @@ bool Sapphire::World::Manager::HousingMgr::moveExternalItem( Entity::Player& pla
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();
invMgr->updateHousingItemPosition( item ); invMgr->updateHousingItemPosition( item );
terri.updateYardObjectPos( player, slot, ident.landId, *item ); terri.updateYardObjectPos( player, slot, static_cast< uint16_t >( ident.landId ), *item );
uint32_t param1 = ( ident.landId << 16 ) | InventoryType::HousingExteriorPlacedItems; uint32_t param1 = static_cast< uint32_t >( ( ident.landId << 16 ) | InventoryType::HousingExteriorPlacedItems );
player.queuePacket( Server::makeActorControlSelf( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slot ) ); player.queuePacket( Server::makeActorControlSelf( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slot ) );
@ -1348,8 +1348,8 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
player.getCurrentTerritory() ) ) player.getCurrentTerritory() ) )
{ {
auto ident = terri->getLandIdent(); auto ident = terri->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;
@ -1361,7 +1361,7 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
} }
else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) ) else if( auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() ) )
{ {
auto land = terri->getLand( plot ); auto land = terri->getLand( static_cast< uint8_t >( plot ) );
if( !land ) if( !land )
return; return;
@ -1406,7 +1406,7 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
auto container = it->second; auto container = it->second;
auto item = std::dynamic_pointer_cast< Inventory::HousingItem >( container->getItem( slotId ) ); auto item = std::dynamic_pointer_cast< Inventory::HousingItem >( container->getItem( static_cast< uint8_t >( slotId ) ) );
if( !item ) if( !item )
return false; return false;
@ -1420,7 +1420,7 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();
// remove it from housing inventory // remove it from housing inventory
container->removeItem( slotId ); container->removeItem( static_cast< uint8_t >( slotId ) );
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
invMgr->removeHousingItemPosition( *item ); invMgr->removeHousingItemPosition( *item );
invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId ); invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId );
@ -1441,12 +1441,12 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();
container->removeItem( slotId ); container->removeItem( static_cast< uint8_t >( slotId ) );
invMgr->sendInventoryContainer( player, container ); invMgr->sendInventoryContainer( player, container );
invMgr->removeHousingItemPosition( *item ); invMgr->removeHousingItemPosition( *item );
invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId ); invMgr->removeItemFromHousingContainer( terri.getLandIdent(), containerId, slotId );
freeContainer->setItem( slotId, item ); freeContainer->setItem( static_cast< uint8_t >( slotId ), item );
invMgr->sendInventoryContainer( player, freeContainer ); invMgr->sendInventoryContainer( player, freeContainer );
invMgr->saveHousingContainer( terri.getLandIdent(), freeContainer ); invMgr->saveHousingContainer( terri.getLandIdent(), freeContainer );
} }
@ -1455,7 +1455,7 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
if( containerIdx != -1 ) if( containerIdx != -1 )
{ {
auto arraySlot = ( containerIdx * 50 ) + slotId; auto arraySlot = ( containerIdx * 50 ) + slotId;
terri.removeHousingObject( arraySlot ); terri.removeHousingObject( static_cast< uint16_t >( arraySlot ) );
} }
return true; return true;
@ -1494,7 +1494,7 @@ bool Sapphire::World::Manager::HousingMgr::removeExternalItem( Entity::Player& p
invMgr->removeItemFromHousingContainer( land.getLandIdent(), sourceContainer->getId(), slotId ); invMgr->removeItemFromHousingContainer( land.getLandIdent(), sourceContainer->getId(), slotId );
invMgr->removeHousingItemPosition( *item ); invMgr->removeHousingItemPosition( *item );
storeroomContainer->setItem( freeSlot, item ); storeroomContainer->setItem( static_cast< uint8_t >( freeSlot ), item );
invMgr->sendInventoryContainer( player, storeroomContainer ); invMgr->sendInventoryContainer( player, storeroomContainer );
invMgr->saveHousingContainer( land.getLandIdent(), storeroomContainer ); invMgr->saveHousingContainer( land.getLandIdent(), storeroomContainer );
} }
@ -1515,7 +1515,7 @@ bool Sapphire::World::Manager::HousingMgr::removeExternalItem( Entity::Player& p
} }
if( shouldDespawnItem ) if( shouldDespawnItem )
terri.despawnYardObject( land.getLandIdent().landId, slotId ); terri.despawnYardObject( static_cast< uint16_t >( land.getLandIdent().landId ), slotId );
return true; return true;
} }
@ -1552,7 +1552,7 @@ void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::E
if( !terri ) if( !terri )
return; return;
auto land = terri->getLand( plot ); auto land = terri->getLand( static_cast< uint8_t >( plot ) );
if( !land ) if( !land )
return; return;
@ -1580,8 +1580,8 @@ void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::E
return; return;
auto ident = terri->getLandIdent(); auto ident = terri->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
auto land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId ); auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
if( !land ) if( !land )
return; return;

View file

@ -154,7 +154,7 @@ uint32_t CalcStats::calculateMaxHp( PlayerPtr pPlayer, Sapphire::FrameworkPtr pF
auto vitMod = pPlayer->getBonusStat( Common::BaseParam::Vitality ); auto vitMod = pPlayer->getBonusStat( Common::BaseParam::Vitality );
float baseStat = calculateBaseStat( *pPlayer ); float baseStat = calculateBaseStat( *pPlayer );
uint16_t vitStat = pPlayer->getStats().vit + static_cast< uint16_t >( vitMod ); uint16_t vitStat = static_cast< uint16_t >( pPlayer->getStats().vit ) + static_cast< uint16_t >( vitMod );
uint16_t hpMod = paramGrowthInfo->hpModifier; uint16_t hpMod = paramGrowthInfo->hpModifier;
uint16_t jobModHp = classInfo->modifierHitPoints; uint16_t jobModHp = classInfo->modifierHitPoints;
float approxBaseHp = 0.0f; // Read above float approxBaseHp = 0.0f; // Read above
@ -483,7 +483,7 @@ float CalcStats::calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_
// D = ⌊ f(pot) × f(wd) × f(ap) × f(det) × f(tnc) × traits ⌋ // D = ⌊ f(pot) × f(wd) × f(ap) × f(det) × f(tnc) × traits ⌋
// × f(chr) ⌋ × f(dhr) ⌋ × rand[ 0.95, 1.05 ] ⌋ buff_1 ⌋ × buff_1 ⌋ × buff... ⌋ // × f(chr) ⌋ × f(dhr) ⌋ × rand[ 0.95, 1.05 ] ⌋ buff_1 ⌋ × buff_1 ⌋ × buff... ⌋
auto pot = potency( ptc ); auto pot = potency( static_cast< uint16_t >( ptc ) );
auto wd = weaponDamage( chara, wepDmg ); auto wd = weaponDamage( chara, wepDmg );
auto ap = getPrimaryAttackPower( chara ); auto ap = getPrimaryAttackPower( chara );
auto det = determination( chara ); auto det = determination( chara );

View file

@ -224,7 +224,7 @@ void Sapphire::Network::GameConnection::handleZonePacket( Sapphire::Network::Pac
Logger::debug( "[{0}] Undefined World IPC : Unknown ( {1:04X} )", m_pSession->getId(), opcode ); Logger::debug( "[{0}] Undefined World IPC : Unknown ( {1:04X} )", m_pSession->getId(), opcode );
Logger::debug( "Dump:\n{0}", Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ), Logger::debug( "Dump:\n{0}", Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ),
pPacket.segHdr.size ) ); static_cast< uint16_t >( pPacket.segHdr.size) ) );
} }
} }
@ -392,7 +392,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
{ {
case SEGMENTTYPE_SESSIONINIT: case SEGMENTTYPE_SESSIONINIT:
{ {
char* id = ( char* ) &( inPacket.data[ 4 ] ); char* id = reinterpret_cast< char* >( &( inPacket.data[ 4 ] ) );
uint32_t playerId = std::stoul( id ); uint32_t playerId = std::stoul( id );
auto pCon = std::static_pointer_cast< GameConnection, Connection >( shared_from_this() ); auto pCon = std::static_pointer_cast< GameConnection, Connection >( shared_from_this() );
@ -423,15 +423,15 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
m_pSession = session; m_pSession = session;
auto pe = std::make_shared< FFXIVRawPacket >( 0x07, 0x18, 0, 0 ); auto pe = std::make_shared< FFXIVRawPacket >( 0x07, 0x18, 0, 0 );
*( unsigned int* ) ( &pe->data()[ 0 ] ) = 0xE0037603; *reinterpret_cast< unsigned int* >( &pe->data()[ 0 ] ) = 0xE0037603;
*( unsigned int* ) ( &pe->data()[ 4 ] ) = Common::Util::getTimeSeconds(); *reinterpret_cast< unsigned int* >( &pe->data()[ 4 ] ) = Common::Util::getTimeSeconds();
sendSinglePacket( pe ); sendSinglePacket( pe );
// main connection, assinging it to the session // main connection, assinging it to the session
if( ipcHeader.connectionType == ConnectionType::Zone ) if( ipcHeader.connectionType == ConnectionType::Zone )
{ {
auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 ); auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
*( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId; *reinterpret_cast< unsigned int* >( &pe1->data()[ 0 ] ) = playerId;
sendSinglePacket( pe1 ); sendSinglePacket( pe1 );
Logger::info( "[{0}] Setting session for world connection", id ); Logger::info( "[{0}] Setting session for world connection", id );
session->setZoneConnection( pCon ); session->setZoneConnection( pCon );
@ -440,11 +440,11 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
else if( ipcHeader.connectionType == ConnectionType::Chat ) else if( ipcHeader.connectionType == ConnectionType::Chat )
{ {
auto pe2 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 ); auto pe2 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
*( unsigned int* ) ( &pe2->data()[ 0 ] ) = playerId; *reinterpret_cast< unsigned int* >( &pe2->data()[ 0 ] ) = playerId;
sendSinglePacket( pe2 ); sendSinglePacket( pe2 );
auto pe3 = std::make_shared< FFXIVRawPacket >( 0x03, 0x28, playerId, playerId ); auto pe3 = std::make_shared< FFXIVRawPacket >( 0x03, 0x28, playerId, playerId );
*( unsigned short* ) ( &pe3->data()[ 2 ] ) = 0x02; *reinterpret_cast< unsigned short* >( &pe3->data()[ 2 ] ) = 0x02;
sendSinglePacket( pe3 ); sendSinglePacket( pe3 );
Logger::info( "[{0}] Setting session for chat connection", id ); Logger::info( "[{0}] Setting session for chat connection", id );
@ -461,12 +461,12 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
} }
case SEGMENTTYPE_KEEPALIVE: // keep alive case SEGMENTTYPE_KEEPALIVE: // keep alive
{ {
uint32_t id = *( uint32_t* ) &inPacket.data[ 0 ]; uint32_t id = *reinterpret_cast< uint32_t* >( &inPacket.data[ 0 ] );
uint32_t timeStamp = *( uint32_t* ) &inPacket.data[ 4 ]; uint32_t timeStamp = *reinterpret_cast< uint32_t* >( &inPacket.data[ 4 ] );
auto pe4 = std::make_shared< FFXIVRawPacket >( 0x08, 0x18, 0, 0 ); auto pe4 = std::make_shared< FFXIVRawPacket >( 0x08, 0x18, 0, 0 );
*( unsigned int* ) ( &pe4->data()[ 0 ] ) = id; *reinterpret_cast< unsigned int* >( &pe4->data()[ 0 ] ) = id;
*( unsigned int* ) ( &pe4->data()[ 4 ] ) = timeStamp; *reinterpret_cast< unsigned int* >( &pe4->data()[ 4 ] ) = timeStamp;
sendSinglePacket( pe4 ); sendSinglePacket( pe4 );
break; break;

View file

@ -32,7 +32,7 @@ void Sapphire::Network::GameConnection::cfDutyInfoRequest( FrameworkPtr pFw,
// cap it since it's uint8_t in packets // cap it since it's uint8_t in packets
penaltyMinutes = 255; penaltyMinutes = 255;
} }
dutyInfoPacket->data().penaltyTime = penaltyMinutes; dutyInfoPacket->data().penaltyTime = static_cast< uint8_t >( penaltyMinutes );
queueOutPacket( dutyInfoPacket ); queueOutPacket( dutyInfoPacket );
auto inNeedsPacket = makeZonePacket< FFXIVIpcCFPlayerInNeed >( player.getId() ); auto inNeedsPacket = makeZonePacket< FFXIVIpcCFPlayerInNeed >( player.getId() );
@ -62,7 +62,7 @@ void Sapphire::Network::GameConnection::cfRegisterDuty( FrameworkPtr pFw,
} }
// todo: rand bias problem, will do for now tho // todo: rand bias problem, will do for now tho
auto index = std::rand() % selectedContent.size(); auto index = static_cast< uint32_t >( std::rand() ) % selectedContent.size();
auto contentId = selectedContent.at( index ); auto contentId = selectedContent.at( index );
player.sendDebug( "Duty register request for contentid#{0}", contentId ); player.sendDebug( "Duty register request for contentid#{0}", contentId );

View file

@ -127,7 +127,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
} }
case ClientTriggerType::SpawnCompanionReq: case ClientTriggerType::SpawnCompanionReq:
{ {
player.spawnCompanion( param1 ); player.spawnCompanion( static_cast< uint16_t >( param1 ) );
break; break;
} }
case ClientTriggerType::RemoveStatusEffect: // Remove status (clicking it off) case ClientTriggerType::RemoveStatusEffect: // Remove status (clicking it off)
@ -236,14 +236,14 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
case ClientTriggerType::PoseChange: // change pose case ClientTriggerType::PoseChange: // change pose
case ClientTriggerType::PoseReapply: // reapply pose case ClientTriggerType::PoseReapply: // reapply pose
{ {
player.setPose( param12 ); player.setPose( static_cast< uint8_t >( param12 ) );
auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 ); auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 );
player.sendToInRangeSet( pSetStatusPacket, true ); player.sendToInRangeSet( pSetStatusPacket, true );
break; break;
} }
case ClientTriggerType::PoseCancel: // cancel pose case ClientTriggerType::PoseCancel: // cancel pose
{ {
player.setPose( param12 ); player.setPose( static_cast< uint8_t >( param12 ) );
auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 ); auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 );
player.sendToInRangeSet( pSetStatusPacket, true ); player.sendToInRangeSet( pSetStatusPacket, true );
break; break;
@ -273,7 +273,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
case ClientTriggerType::Teleport: // Teleport case ClientTriggerType::Teleport: // Teleport
{ {
player.teleportQuery( param11 ); player.teleportQuery( static_cast< uint16_t >( param11 ) );
break; break;
} }
case ClientTriggerType::DyeItem: // Dye item case ClientTriggerType::DyeItem: // Dye item
@ -317,7 +317,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
if (!hZone) if (!hZone)
return; return;
player.setActiveLand( param11, hZone->getWardNum() ); player.setActiveLand( static_cast< uint8_t >( param11 ), hZone->getWardNum() );
auto pShowBuildPresetUIPacket = makeActorControl( player.getId(), ShowBuildPresetUI, param11 ); auto pShowBuildPresetUIPacket = makeActorControl( player.getId(), ShowBuildPresetUI, param11 );
player.queuePacket( pShowBuildPresetUIPacket ); player.queuePacket( pShowBuildPresetUIPacket );
@ -348,7 +348,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
if( !pHousingMgr ) if( !pHousingMgr )
break; break;
pHousingMgr->sendWardLandInfo( player, param12, param11 ); pHousingMgr->sendWardLandInfo( player, static_cast< uint8_t >( param12 ), static_cast< uint8_t >( param11 ) );
break; break;
} }
@ -462,7 +462,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
auto sendToStoreroom = ( param4 >> 16 ) != 0; auto sendToStoreroom = ( param4 >> 16 ) != 0;
//player, plot, containerId, slot, sendToStoreroom //player, plot, containerId, slot, sendToStoreroom
housingMgr->reqRemoveHousingItem( player, param12, param2, slot, sendToStoreroom ); housingMgr->reqRemoveHousingItem( player, static_cast< uint16_t >( param12 ), static_cast< uint16_t >( param2 ), static_cast< uint8_t >( slot ), sendToStoreroom );
break; break;
} }
@ -470,7 +470,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
{ {
auto housingMgr = m_pFw->get< HousingMgr >(); auto housingMgr = m_pFw->get< HousingMgr >();
housingMgr->reqEstateExteriorRemodel( player, param11 ); housingMgr->reqEstateExteriorRemodel( player, static_cast< uint16_t >( param11 ) );
break; break;
} }

View file

@ -130,13 +130,13 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
{ {
case GmCommand::Lv: case GmCommand::Lv:
{ {
targetPlayer->setLevel( param1 ); targetPlayer->setLevel( static_cast< uint8_t >( param1 ) );
player.sendNotice( "Level for {0} was set to {1}", targetPlayer->getName(), param1 ); player.sendNotice( "Level for {0} was set to {1}", targetPlayer->getName(), param1 );
break; break;
} }
case GmCommand::Race: case GmCommand::Race:
{ {
targetPlayer->setLookAt( CharaLook::Race, param1 ); targetPlayer->setLookAt( CharaLook::Race, static_cast< uint8_t >( param1 ) );
player.sendNotice( "Race for {0} was set to {1}", targetPlayer->getName(), param1 ); player.sendNotice( "Race for {0} was set to {1}", targetPlayer->getName(), param1 );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors(); auto inRange = targetPlayer->getInRangeActors();
@ -152,7 +152,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
case GmCommand::Tribe: case GmCommand::Tribe:
{ {
targetPlayer->setLookAt( CharaLook::Tribe, param1 ); targetPlayer->setLookAt( CharaLook::Tribe, static_cast< uint8_t >( param1 ) );
player.sendNotice( "Tribe for {0} was set to ", targetPlayer->getName(), param1 ); player.sendNotice( "Tribe for {0} was set to ", targetPlayer->getName(), param1 );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors(); auto inRange = targetPlayer->getInRangeActors();
@ -168,7 +168,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
case GmCommand::Sex: case GmCommand::Sex:
{ {
targetPlayer->setLookAt( CharaLook::Gender, param1 ); targetPlayer->setLookAt( CharaLook::Gender, static_cast< uint8_t >( param1 ) );
player.sendNotice( "Sex for {0} was set to ", targetPlayer->getName(), param1 ); player.sendNotice( "Sex for {0} was set to ", targetPlayer->getName(), param1 );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetActor->getInRangeActors(); auto inRange = targetActor->getInRangeActors();
@ -325,7 +325,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
else else
{ {
targetActor->getAsPlayer()->learnSong( param2, 0 ); targetActor->getAsPlayer()->learnSong( static_cast< uint8_t >( param2 ), 0 );
player.sendNotice( "Song {0} for {1} was turned on.", param2, targetPlayer->getName() ); player.sendNotice( "Song {0} for {1} was turned on.", param2, targetPlayer->getName() );
} }
} }
@ -374,27 +374,27 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
case GmCommand::QuestAccept: case GmCommand::QuestAccept:
{ {
targetPlayer->updateQuest( param1, 1 ); targetPlayer->updateQuest( static_cast< uint16_t >( param1 ), 1 );
break; break;
} }
case GmCommand::QuestCancel: case GmCommand::QuestCancel:
{ {
targetPlayer->removeQuest( param1 ); targetPlayer->removeQuest( static_cast< uint16_t >( param1 ) );
break; break;
} }
case GmCommand::QuestComplete: case GmCommand::QuestComplete:
{ {
targetPlayer->finishQuest( param1 ); targetPlayer->finishQuest( static_cast< uint16_t >( param1 ) );
break; break;
} }
case GmCommand::QuestIncomplete: case GmCommand::QuestIncomplete:
{ {
targetPlayer->unfinishQuest( param1 ); targetPlayer->unfinishQuest( static_cast< uint16_t >( param1 ) );
break; break;
} }
case GmCommand::QuestSequence: case GmCommand::QuestSequence:
{ {
targetPlayer->updateQuest( param1, param2 ); targetPlayer->updateQuest( static_cast< uint16_t >( param1 ), static_cast< uint8_t >( param2 ) );
break; break;
} }
case GmCommand::GC: case GmCommand::GC:
@ -405,7 +405,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
return; return;
} }
targetPlayer->setGc( param1 ); targetPlayer->setGc( static_cast< uint8_t >( param1 ) );
// if we're changing them to a GC, check if they have a rank and if not, set it to the lowest rank // if we're changing them to a GC, check if they have a rank and if not, set it to the lowest rank
if( param1 > 0 ) if( param1 > 0 )
@ -413,7 +413,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
auto gcRankIdx = static_cast< uint8_t >( param1 ) - 1; auto gcRankIdx = static_cast< uint8_t >( param1 ) - 1;
if( targetPlayer->getGcRankArray()[ gcRankIdx ] == 0 ) if( targetPlayer->getGcRankArray()[ gcRankIdx ] == 0 )
{ {
player.setGcRankAt( gcRankIdx, 1 ); player.setGcRankAt( static_cast< uint8_t >( gcRankIdx ), 1 );
} }
} }
@ -430,7 +430,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
return; return;
} }
targetPlayer->setGcRankAt( gcId, param1 ); targetPlayer->setGcRankAt( static_cast< uint8_t >( gcId ), static_cast< uint8_t >( param1 ) );
player.sendNotice( "GC Rank for {0} for GC {1} was set to {2}", targetPlayer->getName(), targetPlayer->getGc(), player.sendNotice( "GC Rank for {0} for GC {1} was set to {2}", targetPlayer->getName(), targetPlayer->getGc(),
targetPlayer->getGcRankArray()[ targetPlayer->getGc() - 1 ] ); targetPlayer->getGcRankArray()[ targetPlayer->getGc() - 1 ] );
break; break;
@ -448,7 +448,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
} }
else else
{ {
targetActor->getAsPlayer()->registerAetheryte( param2 ); targetActor->getAsPlayer()->registerAetheryte( static_cast< uint8_t >( param2 ) );
player.sendNotice( "Aetheryte {0} for {1} was turned on.", param2, targetPlayer->getName() ); player.sendNotice( "Aetheryte {0} for {1} was turned on.", param2, targetPlayer->getName() );
} }
} }
@ -521,7 +521,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
if( data->isAetheryte ) if( data->isAetheryte )
{ {
doTeleport = true; doTeleport = true;
teleport = i; teleport = static_cast< uint16_t >( i );
break; break;
} }
} }
@ -533,7 +533,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
else else
{ {
targetPlayer->setPos( targetPlayer->getPos() ); targetPlayer->setPos( targetPlayer->getPos() );
targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 ); targetPlayer->performZoning( static_cast< uint16_t >( param1 ), targetPlayer->getPos(), 0 );
} }
player.sendNotice( "{0} was warped to zone {1}", targetPlayer->getName(), param1, pZone->getName() ); player.sendNotice( "{0} was warped to zone {1}", targetPlayer->getName(), param1, pZone->getName() );

View file

@ -25,8 +25,8 @@ Sapphire::Cell::~Cell()
void Sapphire::Cell::init( uint32_t x, uint32_t y, TerritoryPtr pZone ) void Sapphire::Cell::init( uint32_t x, uint32_t y, TerritoryPtr pZone )
{ {
m_pZone = pZone; m_pZone = pZone;
m_posX = x; m_posX = static_cast< uint16_t >( x );
m_posY = y; m_posY = static_cast< uint16_t >( y );
m_actors.clear(); m_actors.clear();
} }

View file

@ -34,7 +34,7 @@ void Sapphire::House::updateHouseDb()
auto stmt = pDB->getPreparedStatement( Db::HOUSING_HOUSE_UP ); auto stmt = pDB->getPreparedStatement( Db::HOUSING_HOUSE_UP );
stmt->setUInt( 6, m_houseId ); stmt->setUInt( 6, m_houseId );
stmt->setInt64( 1, m_buildTime ); stmt->setInt64( 1, static_cast< int64_t >( m_buildTime ) );
stmt->setBool( 2, m_hasAetheryte ); stmt->setBool( 2, m_hasAetheryte );
stmt->setString( 3, m_estateComment ); stmt->setString( 3, m_estateComment );

View file

@ -63,8 +63,8 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone
indoorInitPacket->data().u3 = 0; indoorInitPacket->data().u3 = 0;
indoorInitPacket->data().u4 = 0; indoorInitPacket->data().u4 = 0;
auto landSetId = pHousingMgr->toLandSetId( m_landIdent.territoryTypeId, m_landIdent.wardNum ); auto landSetId = pHousingMgr->toLandSetId( static_cast< uint16_t >( m_landIdent.territoryTypeId ), static_cast< uint8_t >( m_landIdent.wardNum ) );
auto pLand = pHousingMgr->getHousingZoneByLandSetId( landSetId )->getLand( m_landIdent.landId ); auto pLand = pHousingMgr->getHousingZoneByLandSetId( landSetId )->getLand( static_cast< uint8_t >( m_landIdent.landId ) );
auto pHouse = pLand->getHouse(); auto pHouse = pLand->getHouse();
for( auto i = 0; i < 10; i++ ) for( auto i = 0; i < 10; i++ )
@ -154,7 +154,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousin
auto obj = housingMgr->getYardObjectForItem( housingItem ); auto obj = housingMgr->getYardObjectForItem( housingItem );
m_housingObjects[ offset ] = obj; m_housingObjects[static_cast< size_t >( offset ) ] = obj;
} }
containerIdx++; containerIdx++;
@ -171,14 +171,14 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::spawnHousing
auto offset = ( containerIdx * 50 ) + slot; auto offset = ( containerIdx * 50 ) + slot;
auto obj = housingMgr->getYardObjectForItem( item ); auto obj = housingMgr->getYardObjectForItem( item );
m_housingObjects[ offset ] = obj; m_housingObjects[ static_cast< size_t >( offset ) ] = obj;
for( const auto& player : m_playerMap ) for( const auto& player : m_playerMap )
{ {
auto objectSpawnPkt = makeZonePacket< Server::FFXIVIpcHousingInternalObjectSpawn >( player.second->getId() ); auto objectSpawnPkt = makeZonePacket< Server::FFXIVIpcHousingInternalObjectSpawn >( player.second->getId() );
objectSpawnPkt->data().containerId = containerType; objectSpawnPkt->data().containerId = containerType;
objectSpawnPkt->data().containerOffset = slot; objectSpawnPkt->data().containerOffset = static_cast< uint8_t >( slot );
objectSpawnPkt->data().object.itemId = item->getAdditionalData() & 0xFFFF; objectSpawnPkt->data().object.itemId = item->getAdditionalData() & 0xFFFF;
objectSpawnPkt->data().object.rotation = item->getRot(); objectSpawnPkt->data().object.rotation = item->getRot();
@ -207,7 +207,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousin
auto moveObjPkt = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() ); auto moveObjPkt = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() );
moveObjPkt->data().itemRotation = obj.rotation; moveObjPkt->data().itemRotation = static_cast< uint16_t >( obj.rotation );
moveObjPkt->data().pos = obj.pos; moveObjPkt->data().pos = obj.pos;
// todo: how does this work when an item is in a slot >50 or u8 max? my guess is landid is the container index, but not sure... // todo: how does this work when an item is in a slot >50 or u8 max? my guess is landid is the container index, but not sure...