1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 23:27:45 +00:00

Object despawning added

This commit is contained in:
Mordred 2018-03-01 23:17:35 +01:00
parent 40fccfb481
commit 78d660a1ce
4 changed files with 14 additions and 4 deletions

View file

@ -104,6 +104,7 @@ namespace Packets {
ActorCast = 0x0162, // updated 4.2
HateList = 0x0165, // updated 4.2
ObjectSpawn = 0x0167, // updated 4.2
ObjectDespawn = 0x0168, // updated 4.2
UpdateClassInfo = 0x0169, // updated 4.2
InitUI = 0x016B, // updated 4.2

View file

@ -414,8 +414,7 @@ struct FFXIVIpcPlayerSpawn : FFXIVIpcBasePacket<PlayerSpawn>
*/
struct FFXIVIpcNpcSpawn : FFXIVIpcBasePacket<NpcSpawn>
{
uint16_t title;
uint16_t u1b;
uint32_t mapLinkId; // needs to be existing in the map, mob will snap to it
uint8_t u2b;
uint8_t u2ab;
uint8_t gmRank;
@ -1339,6 +1338,12 @@ struct FFXIVIpcObjectSpawn : FFXIVIpcBasePacket<ObjectSpawn>
int16_t unknown;
};
struct FFXIVIpcObjectDespawn : FFXIVIpcBasePacket<ObjectDespawn>
{
uint8_t spawnIndex;
uint8_t padding[7];
};
} /* Server */
} /* Packets */

View file

@ -120,7 +120,7 @@ void Core::Entity::EventObject::despawn( Core::Entity::PlayerPtr pTarget )
{
g_log.debug( "despawn eobj: " + std::to_string( getId() ) );
pTarget->freeObjSpawnIndexForActorId( getId( ));
pTarget->freeObjSpawnIndexForActorId( getId( ) );
}
const std::string& Core::Entity::EventObject::getName() const

View file

@ -1655,7 +1655,11 @@ void Core::Entity::Player::resetObjSpawnIndex()
void Core::Entity::Player::freeObjSpawnIndexForActorId( uint32_t actorId )
{
m_objSpawnIndexAllocator.freeUsedSpawnIndex( actorId );
auto spawnId = m_objSpawnIndexAllocator.freeUsedSpawnIndex( actorId );
ZoneChannelPacket< FFXIVIpcObjectDespawn > freeObjectSpawnPacket( getId() );
freeObjectSpawnPacket.data().spawnIndex = spawnId;
queuePacket( freeObjectSpawnPacket );
}
bool Core::Entity::Player::isObjSpawnIndexValid( uint8_t index )