1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 00:27:44 +00:00

refactoring various files

This commit is contained in:
Mordred 2017-11-28 00:09:36 +01:00
parent ce9b8579a1
commit 5f5ce9970b
14 changed files with 119 additions and 182 deletions

View file

@ -38,8 +38,8 @@ Core::Entity::BattleNpc::~BattleNpc()
}
Core::Entity::BattleNpc::BattleNpc( uint32_t modelId, uint32_t nameid, const Common::FFXIVARR_POSITION3& spawnPos,
uint32_t sizeId, uint32_t type, uint32_t level, uint32_t behaviour,
Core::Entity::BattleNpc::BattleNpc( uint16_t modelId, uint16_t nameid, const Common::FFXIVARR_POSITION3& spawnPos,
uint16_t bnpcBaseId, uint32_t type, uint8_t level, uint8_t behaviour,
uint32_t mobType )
{
BattleNpc::m_nextID++;
@ -52,7 +52,7 @@ Core::Entity::BattleNpc::BattleNpc( uint32_t modelId, uint32_t nameid, const Com
m_objKind = ObjKind::BattleNpc;
m_mode = MODE_IDLE;
m_targetId = INVALID_GAME_OBJECT_ID;
m_targetId = static_cast< uint64_t >( INVALID_GAME_OBJECT_ID );
m_maxHp = 150;
m_maxMp = 100;
@ -66,14 +66,14 @@ Core::Entity::BattleNpc::BattleNpc( uint32_t modelId, uint32_t nameid, const Com
m_currentStance = Stance::Passive;
m_class = ClassJob::Gladiator;
m_level = level > 0 ? level : 70;
m_level = level > uint8_t{0} ? level : uint8_t{70};
m_modelId = modelId;
m_nameId = nameid;
m_behavior = behaviour;
m_bnpcBaseId = sizeId;
m_bnpcBaseId = bnpcBaseId;
m_status = ActorStatus::Idle;
@ -189,7 +189,7 @@ uint8_t Core::Entity::BattleNpc::getbehavior() const
void Core::Entity::BattleNpc::hateListAdd( Core::Entity::ActorPtr pActor, int32_t hateAmount )
{
HateListEntry* hateEntry = new HateListEntry();
auto hateEntry = new HateListEntry();
hateEntry->m_hateAmount = hateAmount;
hateEntry->m_pActor = pActor;
@ -253,7 +253,7 @@ bool Core::Entity::BattleNpc::moveTo( Common::FFXIVARR_POSITION3& pos )
return true;
float rot = Math::Util::calcAngFrom( getPos().x, getPos().z, pos.x, pos.z );
float newRot = PI - rot + (PI / 2);
float newRot = PI - rot + ( PI / 2 );
face( pos );
float angle = Math::Util::calcAngFrom( getPos().x, getPos().z, pos.x, pos.z ) + PI;
@ -262,7 +262,7 @@ bool Core::Entity::BattleNpc::moveTo( Common::FFXIVARR_POSITION3& pos )
float y = ( getPos().y + pos.y ) * 0.5f; // fake value while there is no collision
float z = static_cast< float >( sinf( angle ) * 1.1f );
Common::FFXIVARR_POSITION3 newPos;
Common::FFXIVARR_POSITION3 newPos{};
newPos.x = getPos().x + x;
newPos.y = y;
@ -270,13 +270,11 @@ bool Core::Entity::BattleNpc::moveTo( Common::FFXIVARR_POSITION3& pos )
setPosition( newPos );
Common::FFXIVARR_POSITION3 tmpPos;
Common::FFXIVARR_POSITION3 tmpPos{};
tmpPos.x = getPos().x + x;
tmpPos.y = y;
tmpPos.z = getPos().z + z;
angle = angle * 2;
setPosition( tmpPos );
setRotation(newRot);
@ -384,7 +382,7 @@ void Core::Entity::BattleNpc::hateListUpdate( Core::Entity::ActorPtr pActor, int
}
}
HateListEntry* hateEntry = new HateListEntry();
auto hateEntry = new HateListEntry();
hateEntry->m_hateAmount = hateAmount;
hateEntry->m_pActor = pActor;
m_hateList.insert( hateEntry );
@ -427,7 +425,7 @@ void Core::Entity::BattleNpc::onDeath()
if( pHateEntry->m_pActor->isPlayer() ) // && pHateEntry->m_hateAmount >= plsBeHatedThisMuchAtLeast )
{
uint8_t level = pHateEntry->m_pActor->getLevel();
auto levelDiff = (int)this->m_level - (int)level;
auto levelDiff = static_cast< int32_t >( this->m_level ) - level;
auto cappedLevelDiff = Math::Util::clamp( levelDiff, 1, 6 );
auto expNeeded = g_exdData.m_paramGrowthInfoMap[m_level + cappedLevelDiff - 1].needed_exp;
@ -449,7 +447,7 @@ void Core::Entity::BattleNpc::onDeath()
// todo: this is actually retarded, we need real rand()
srand( static_cast< unsigned int> ( time( NULL ) ) );
srand( static_cast< uint32_t > ( time( nullptr ) ) );
auto pPlayer = pHateEntry->m_pActor->getAsPlayer();
pPlayer->gainExp( exp );
@ -517,7 +515,7 @@ void Core::Entity::BattleNpc::update( int64_t currTime )
{
ActorPtr pClosestActor = getClosestActor();
if( ( pClosestActor != nullptr ) && pClosestActor->isAlive() )
if( pClosestActor && pClosestActor->isAlive() )
{
distance = Math::Util::distance( getPos().x, getPos().y, getPos().z,
pClosestActor->getPos().x,
@ -543,9 +541,9 @@ void Core::Entity::BattleNpc::update( int64_t currTime )
if( pClosestActor != nullptr )
{
distance = Math::Util::distance( getPos().x, getPos().y, getPos().z,
pClosestActor->getPos().x,
pClosestActor->getPos().y,
pClosestActor->getPos().z );
pClosestActor->getPos().x,
pClosestActor->getPos().y,
pClosestActor->getPos().z );
if( distance > 4 )
moveTo( pClosestActor->getPos() );

View file

@ -27,7 +27,8 @@ public:
BattleNpc();
~BattleNpc();
BattleNpc( uint32_t modelId, uint32_t nameid, const Common::FFXIVARR_POSITION3& spawnPos, uint32_t sizeId = 0, uint32_t type = 2, uint32_t level = 0, uint32_t behaviour = 1, uint32_t mobType = 0 );
BattleNpc( uint16_t modelId, uint16_t nameid, const Common::FFXIVARR_POSITION3& spawnPos, uint16_t bnpcBaseId = 0,
uint32_t type = 2, uint8_t level = 0, uint8_t behaviour = 1, uint32_t mobType = 0 );
//BattleNpc( uint32_t modelId,
// uint32_t nameId,

View file

@ -895,9 +895,7 @@ Core::Entity::ActorPtr Core::Entity::Player::lookupTargetById( uint64_t targetId
for( auto actor : inRange )
{
if( actor->getId() == targetId )
{
targetActor = actor;
}
}
return targetActor;
}
@ -1209,26 +1207,27 @@ void Core::Entity::Player::queuePacket( Core::Network::Packets::GamePacketPtr pP
{
auto pSession = g_serverZone.getSession( m_id );
if( pSession )
{
auto pZoneCon = pSession->getZoneConnection();
if( !pSession )
return;
auto pZoneCon = pSession->getZoneConnection();
if( pZoneCon )
pZoneCon->queueOutPacket( pPacket );
if( pZoneCon )
pZoneCon->queueOutPacket( pPacket );
}
}
void Core::Entity::Player::queueChatPacket( Core::Network::Packets::GamePacketPtr pPacket )
{
auto pSession = g_serverZone.getSession( m_id );
if( pSession )
{
auto pChatCon = pSession->getChatConnection();
if( !pSession )
return;
if( pChatCon )
pChatCon->queueOutPacket( pPacket );
}
auto pChatCon = pSession->getChatConnection();
if( pChatCon )
pChatCon->queueOutPacket( pPacket );
}
bool Core::Entity::Player::isLoadingComplete() const
@ -1460,7 +1459,8 @@ void Core::Entity::Player::mount( uint32_t id )
void Core::Entity::Player::dismount()
{
sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle )), true );
sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus,
static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle )), true );
sendToInRangeSet( ActorControlPacket143( getId(), ActorControlType::Dismount, 1 ), true );
m_mount = 0;
}
@ -1473,7 +1473,8 @@ uint8_t Core::Entity::Player::getCurrentMount() const
void Core::Entity::Player::autoAttack( ActorPtr pTarget )
{
auto mainWeap = m_pInventory->getItemAt(Inventory::GearSet0, Inventory::EquipSlot::MainHand);
auto mainWeap = m_pInventory->getItemAt( Inventory::GearSet0,
Inventory::EquipSlot::MainHand );
pTarget->onActionHostile( shared_from_this() );
//uint64_t tick = Util::getTimeMs();
@ -1482,9 +1483,9 @@ void Core::Entity::Player::autoAttack( ActorPtr pTarget )
uint32_t damage = static_cast< uint32_t >( mainWeap->getAutoAttackDmg() );
uint32_t variation = 0 + rand() % 3;
if ( getClass() == ClassJob::Machinist||
getClass() == ClassJob::Bard ||
getClass() == ClassJob::Archer )
if( getClass() == ClassJob::Machinist ||
getClass() == ClassJob::Bard ||
getClass() == ClassJob::Archer )
{
ZoneChannelPacket< FFXIVIpcEffect > effectPacket(getId());
effectPacket.data().targetId = pTarget->getId();
@ -1510,7 +1511,7 @@ void Core::Entity::Player::autoAttack( ActorPtr pTarget )
ZoneChannelPacket< FFXIVIpcEffect > effectPacket(getId());
effectPacket.data().targetId = pTarget->getId();
effectPacket.data().actionAnimationId = 7;
// effectPacket.data().unknown_2 = variation;
// effectPacket.data().unknown_2 = variation;
effectPacket.data().numEffects = 1;
effectPacket.data().unknown_61 = 1;
effectPacket.data().unknown_62 = 1;
@ -1549,7 +1550,7 @@ uint32_t Core::Entity::Player::getCFPenaltyMinutes() const
auto endTimestamp = getCFPenaltyTimestamp();
// check if penalty timestamp already passed current time
if (currentTimestamp > endTimestamp)
if( currentTimestamp > endTimestamp )
return 0;
auto deltaTime = endTimestamp - currentTimestamp;
@ -1559,7 +1560,7 @@ uint32_t Core::Entity::Player::getCFPenaltyMinutes() const
void Core::Entity::Player::setCFPenaltyMinutes( uint32_t minutes )
{
auto currentTimestamp = Core::Util::getTimeSeconds();
setCFPenaltyTimestamp(static_cast< uint32_t >( currentTimestamp + minutes * 60 ));
setCFPenaltyTimestamp( static_cast< uint32_t >( currentTimestamp + minutes * 60 ) );
}
uint8_t Core::Entity::Player::getOpeningSequence() const

View file

@ -215,7 +215,7 @@ public:
/*! get the current system hand model */
uint64_t getModelSystemWeapon() const;
/*! return a const pointer to the model array */
const uint32_t * getModelArray() const;
const uint32_t* getModelArray() const;
/*! return the equipment model in a specified equipment slot */
uint32_t getModelForSlot( Inventory::EquipSlot slot );
/*! set the equipment model in a specified equipment slot */
@ -254,13 +254,13 @@ public:
/*! change class or job to given class / job */
void setClassJob( Core::Common::ClassJob classJob );
/*! returns a pointer to the class array */
uint16_t * getClassArray();
uint16_t* getClassArray();
/*! returns a const pointer to the class array */
const uint16_t * getClassArray() const;
const uint16_t* getClassArray() const;
/*! returns a pointer to the exp array */
uint32_t * getExpArray();
uint32_t* getExpArray();
/*! returns a const pointer to the exp array */
const uint32_t * getExpArray() const;
const uint32_t* getExpArray() const;
// Base Look / Stats / Params
//////////////////////////////////////////////////////////////////////////////////////////////////////
@ -283,7 +283,7 @@ public:
/*! return the grand company */
uint8_t getGc() const;
/*! return the grand company rank */
const uint8_t * getGcRankArray() const;
const uint8_t* getGcRankArray() const;
/*! set look at index */
void setLookAt( uint8_t index, uint8_t value );
/*! set the voice Id */
@ -293,7 +293,7 @@ public:
/*! set the grand company rank */
void setGcRankAt( uint8_t index, uint8_t rank );
/*! return a const pointer to the look array */
const uint8_t * getLookArray() const;
const uint8_t* getLookArray() const;
/*! returns true if the player is currently in combat */
bool isInCombat() const;
/*! sets players combat state */
@ -329,7 +329,7 @@ public:
/*! prepares zoning / fades out the screen */
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 );
/*! get player's title list (available titles) */
uint8_t * getTitleList();
uint8_t* getTitleList();
/*! get player's active title */
uint16_t getTitle() const;
/*! add title to player title list */
@ -360,7 +360,7 @@ public:
/*! return a const pointer to the aetheryte unlock bitmask array */
int8_t getAetheryteMaskAt( uint8_t index ) const;
/*! return a pointer to the aetheryte unlock bitmask array */
uint8_t * getAetheryteArray();
uint8_t* getAetheryteArray();
/*! set homepoint */
void setHomepoint( uint8_t aetheryteId );
/*! get homepoint */
@ -368,13 +368,13 @@ public:
/*! discover subarea subid fo map map_id, also send udpate packet */
void discover( int16_t map_id, int16_t sub_id );
/*! return a pointer to the discovery bitmask array */
uint8_t * getDiscoveryBitmask();
uint8_t* getDiscoveryBitmask();
/*! helper/debug function to reset all discovered areas */
void resetDiscovery();
/*! get a pointer to the howto bitmask array */
uint8_t * getHowToArray();
uint8_t* getHowToArray();
/*! get a const pointer to the howto bitmask array */
const uint8_t * getHowToArray() const;
const uint8_t* getHowToArray() const;
/*! update bitmask for how-to's seen */
void updateHowtosSeen( uint32_t howToId );
/*! learn an action / update the unlock bitmask. */
@ -384,9 +384,9 @@ public:
/*! check if an action is already unlocked in the bitmask. */
bool isActionLearned( uint8_t actionId ) const;
/*! return a const pointer to the unlock bitmask array */
const uint8_t * getUnlockBitmask() const;
const uint8_t* getUnlockBitmask() const;
/*! return a const pointer to the orchestrion bitmask array */
const uint8_t * getOrchestrionBitmask() const;
const uint8_t* getOrchestrionBitmask() const;
// Spawn handling
@ -522,7 +522,6 @@ public:
void setEorzeaTimeOffset( uint64_t timestamp );
// Database
void updateDbAllQuests() const;
void deleteQuest( uint16_t questId ) const;

View file

@ -69,9 +69,9 @@ void Core::Entity::Player::removeEvent( uint32_t eventId )
void Core::Entity::Player::checkEvent( uint32_t eventId )
{
auto pEvent = getEvent( eventId );
if( pEvent )
if( !pEvent->hasPlayedScene() )
eventFinish( eventId, 1 );
if( pEvent && !pEvent->hasPlayedScene() )
eventFinish( eventId, 1 );
}
@ -282,7 +282,8 @@ void Core::Entity::Player::eventItemActionStart( uint32_t eventId,
void Core::Entity::Player::onLogin()
{
for( auto& child : g_serverZone.getConfig()->getChild( "Settings.Parameters.MotDArray" ) ) {
for( auto& child : g_serverZone.getConfig()->getChild( "Settings.Parameters.MotDArray" ) )
{
sendNotice( child.second.data() );
}
}

View file

@ -195,9 +195,7 @@ bool Core::Entity::Player::tryAddItem( uint16_t catalogId, uint32_t quantity )
for( uint16_t i = 0; i < 4; i++ )
{
if( m_pInventory->addItem( i, -1, catalogId, quantity ) != -1 )
{
return true;
}
}
return false;
}

View file

@ -45,7 +45,7 @@ void Core::Entity::Player::removeQuest( uint16_t questId )
{
ZoneChannelPacket< FFXIVIpcQuestUpdate > questUpdatePacket( getId() );
questUpdatePacket.data().slot = idx;
questUpdatePacket.data().slot = static_cast< uint8_t >( idx );
questUpdatePacket.data().questInfo.c.questId = 0;
questUpdatePacket.data().questInfo.c.sequence = 0xFF;
queuePacket( questUpdatePacket );
@ -62,7 +62,7 @@ void Core::Entity::Player::removeQuest( uint16_t questId )
m_questTracking[ii] = -1;
}
boost::shared_ptr<QuestActive> pQuest = m_activeQuests[idx];
boost::shared_ptr< QuestActive > pQuest = m_activeQuests[idx];
m_activeQuests[idx].reset();
m_questIdToQuestIdx.erase( questId );
@ -1023,6 +1023,7 @@ bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optional
auto paramGrowth = g_exdData.m_paramGrowthInfoMap[questInfo->quest_level];
// TODO: use the correct formula, this one is wrong
uint32_t exp = ( questInfo->reward_exp_factor * paramGrowth.quest_exp_mod * ( 45 + 5 * questInfo->quest_level) ) / 100;
exp = exp + ( questInfo->reward_exp_factor / 100 ) * 10000;

View file

@ -126,7 +126,7 @@ void Core::Network::GameConnection::OnRecv( std::vector< uint8_t > & buffer )
{
// This is assumed packet always start with valid FFXIVARR_PACKET_HEADER for now.
Packets::FFXIVARR_PACKET_HEADER packetHeader;
Packets::FFXIVARR_PACKET_HEADER packetHeader{};
const auto headerResult = Packets::getHeader(buffer, 0, packetHeader);
if (headerResult == Incomplete)
@ -271,7 +271,7 @@ void Core::Network::GameConnection::processInQueue()
// handle the incoming game packets
while( auto pPacket = m_inQueue.pop() )
{
handlePacket(pPacket);
handlePacket( pPacket );
}
}
@ -338,7 +338,7 @@ void Core::Network::GameConnection::injectPacket( const std::string& packetpath,
fclose( fp );
// cycle through the packet entries and queue each one
for( int32_t k = 0x18; k < size;)
for( int32_t k = 0x18; k < size; )
{
uint32_t tmpId = pPlayer->getId();
// replace ids in the entryheader if needed
@ -361,7 +361,7 @@ void Core::Network::GameConnection::injectPacket( const std::string& packetpath,
}
void Core::Network::GameConnection::handlePackets( const Core::Network::Packets::FFXIVARR_PACKET_HEADER& ipcHeader,
const std::vector<Core::Network::Packets::FFXIVARR_PACKET_RAW>& packetData )
const std::vector< Core::Network::Packets::FFXIVARR_PACKET_RAW >& packetData )
{
// if a session is set, update the last time it recieved a game packet
if( m_pSession )
@ -369,8 +369,6 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
for( auto inPacket : packetData )
{
switch( inPacket.segHdr.type )
{
case 1:
@ -459,58 +457,5 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
}
}
//// try to retrieve the session for this id
//auto session = g_serverZone.getSession( inPacket.segHdr.source_actor );
//auto pCon = boost::static_pointer_cast< GameConnection, Connection >( shared_from_this() );
//// check if this is a zoning notification
//if( *reinterpret_cast< uint16_t* >( &inPacket.data[2] ) == 0x9999 )
//{
// // if we already have a session in this connection, reload the player
// if( session )
// g_serverZone.updateSession( inPacket.segHdr.source_actor );
// else
// {
// // if not, create a new session
// g_serverZone.createSession( inPacket.segHdr.source_actor );
// session = g_serverZone.getSession( inPacket.segHdr.source_actor );
// }
// // set the zoneingType for the player so the correct animation can be played
// auto pPlayer = session->getPlayer();
// ZoneingType zoneType = static_cast< ZoneingType >( *reinterpret_cast< uint16_t* >( &inPacket.data[18] ) );
// switch( zoneType )
// {
// case ZoneingType::Teleport:
// pPlayer->setTeleporting( true );
// break;
// case ZoneingType::Return:
// pPlayer->setReturning( true );
// break;
// default:
// break;
// }
// // place this connection in the session
// session->setZoneConnection( pCon );
// // actually perform the zoning
// session->getPlayer()->setZone( *reinterpret_cast< uint16_t* >( &inPacket.data[16] ) );
//}
//else
//{
// if( !session )
// {
// g_serverZone.createSession( inPacket.segHdr.source_actor );
// session = g_serverZone.getSession( inPacket.segHdr.source_actor );
// session->setZoneConnection( pCon );
// }
// queueInPacket( GamePacketPtr( new GamePacket( inPacket ) ) );
//}
//// if not set, set the session for this connection
//if( !m_pSession && session )
// m_pSession = session;
}
}

View file

@ -66,7 +66,7 @@ public:
void OnError( const boost::system::error_code & error ) override;
void handlePackets( const Packets::FFXIVARR_PACKET_HEADER& ipcHeader,
const std::vector<Packets::FFXIVARR_PACKET_RAW>& packetData );
const std::vector< Packets::FFXIVARR_PACKET_RAW >& packetData );
void queueInPacket( Packets::GamePacketPtr inPacket );
void queueOutPacket( Packets::GamePacketPtr outPacket );

View file

@ -52,7 +52,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
uint64_t param1 = inPacket.getValAt< uint64_t >( 0x24 );
uint32_t param11 = inPacket.getValAt< uint32_t >( 0x24 );
uint32_t param12 = inPacket.getValAt< uint32_t >( 0x28 );
uint32_t param2 = inPacket.getValAt< uint32_t >( 0x2c );
uint32_t param2 = inPacket.getValAt< uint32_t >( 0x2C );
uint64_t param3 = inPacket.getValAt< uint64_t >( 0x38 );
g_log.debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " +
@ -115,7 +115,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
}
case 0x69: // Cancel cast
{
if( pPlayer->getCurrentAction() != nullptr )
if( pPlayer->getCurrentAction() )
pPlayer->getCurrentAction()->setInterrupted();
break;
}
@ -190,8 +190,6 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
break;
case ZoneingType::FadeIn:
break;
default:
break;
}
pPlayer->setZoningType( Common::ZoneingType::None );
@ -216,7 +214,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
pow( fromAetheryte->map_coord_y - targetAetheryte->map_coord_y, 2 ) ) / 2 ) + 100 );
// cap at 999 gil
cost = cost > 999 ? 999 : cost;
cost = cost > uint16_t{999} ? uint16_t{999} : cost;
bool insufficientGil = pPlayer->getCurrency( Inventory::CurrencyType::Gil ) < cost;
// todo: figure out what param1 really does

View file

@ -39,59 +39,59 @@ using namespace Core::Network::Packets::Server;
void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer )
{
uint32_t seq = inPacket.getValAt< uint32_t >( 0x20 );
uint8_t action = inPacket.getValAt< uint8_t >( 0x24 );
uint8_t fromSlot = inPacket.getValAt< uint8_t >( 0x30 );
uint8_t toSlot = inPacket.getValAt< uint8_t >( 0x44 );
uint16_t fromContainer = inPacket.getValAt< uint16_t >( 0x2C );
uint16_t toContainer = inPacket.getValAt< uint16_t >( 0x40 );
uint32_t seq = inPacket.getValAt< uint32_t >( 0x20 );
uint8_t action = inPacket.getValAt< uint8_t >( 0x24 );
uint8_t fromSlot = inPacket.getValAt< uint8_t >( 0x30 );
uint8_t toSlot = inPacket.getValAt< uint8_t >( 0x44 );
uint16_t fromContainer = inPacket.getValAt< uint16_t >( 0x2C );
uint16_t toContainer = inPacket.getValAt< uint16_t >( 0x40 );
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( pPlayer->getId() );
ackPacket.data().sequence = seq;
ackPacket.data().type = 7;
pPlayer->queuePacket( ackPacket );
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( pPlayer->getId() );
ackPacket.data().sequence = seq;
ackPacket.data().type = 7;
pPlayer->queuePacket( ackPacket );
g_log.debug( inPacket.toString() );
g_log.debug( "InventoryAction: " + std::to_string( action ) );
g_log.debug( inPacket.toString() );
g_log.debug( "InventoryAction: " + std::to_string( action ) );
// TODO: other inventory operations need to be implemented
switch( action )
{
// TODO: other inventory operations need to be implemented
switch( action )
{
case 0x07: // discard item action
{
pPlayer->getInventory()->discardItem( fromContainer, fromSlot );
}
break;
case 0x07: // discard item action
{
pPlayer->getInventory()->discardItem( fromContainer, fromSlot );
}
break;
case 0x08: // move item action
{
pPlayer->getInventory()->moveItem( fromContainer, fromSlot, toContainer, toSlot );
}
break;
case 0x08: // move item action
{
pPlayer->getInventory()->moveItem( fromContainer, fromSlot, toContainer, toSlot );
}
break;
case 0x09: // swap item action
{
pPlayer->getInventory()->swapItem( fromContainer, fromSlot, toContainer, toSlot );
}
break;
case 0x09: // swap item action
{
pPlayer->getInventory()->swapItem( fromContainer, fromSlot, toContainer, toSlot );
}
break;
case 0x0C: // merge stack action
{
case 0x0C: // merge stack action
{
}
break;
}
break;
case 0x0A: // split stack action
{
case 0x0A: // split stack action
{
}
break;
}
break;
default:
default:
break;
break;
}
}
}

View file

@ -300,7 +300,7 @@ void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket&
auto pLine = g_zoneMgr.getZonePosition( zoneLineId );
Common::FFXIVARR_POSITION3 targetPos;
Common::FFXIVARR_POSITION3 targetPos{};
uint32_t targetZone;
float rotation = 0.0f;

View file

@ -46,7 +46,7 @@ Zone::Zone()
, m_layoutId( 0 )
, m_bPrivate( false )
, m_type( Common::RegionType::normal )
, m_currentWeather( static_cast<uint8_t>( Common::Weather::FairSkies ) )
, m_currentWeather( static_cast< uint8_t >( Common::Weather::FairSkies ) )
, m_weatherOverride( 0 )
, m_lastMobUpdate( 0 )
{
@ -54,7 +54,7 @@ Zone::Zone()
Zone::Zone( uint16_t zoneId, uint32_t layoutId, std::string name, std::string interName, bool bPrivate = false )
: m_type( Common::RegionType::normal )
, m_currentWeather( static_cast<uint8_t>( Common::Weather::FairSkies ) )
, m_currentWeather( static_cast< uint8_t >( Common::Weather::FairSkies ) )
{
m_layoutId = layoutId;
@ -197,8 +197,8 @@ void Zone::loadCellCache()
for( auto entry : cache )
{
// get cell position
uint32_t cellX = CellHandler<ZoneMgr>::getPosX( entry->getPos().x );
uint32_t cellY = CellHandler<ZoneMgr>::getPosY( entry->getPos().z );
uint32_t cellX = CellHandler< ZoneMgr >::getPosX( entry->getPos().x );
uint32_t cellY = CellHandler< ZoneMgr >::getPosY( entry->getPos().z );
// find the right cell, create it if not existing yet
if( m_pCellCache[cellX] == nullptr )
@ -314,7 +314,6 @@ void Zone::pushActor( Entity::ActorPtr pActor )
void Zone::removeActor( Entity::ActorPtr pActor )
{
if( pActor->m_pCell )
{
pActor->m_pCell->removeActor( pActor );

View file

@ -14,13 +14,9 @@ extern Core::Data::ExdData g_exdData;
namespace Core {
ZoneMgr::ZoneMgr()
{
}
ZoneMgr::ZoneMgr() = default;
ZoneMgr::~ZoneMgr()
{
}
ZoneMgr::~ZoneMgr() = default;
void ZoneMgr::loadZonePositionMap()
{