mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-30 05:07:46 +00:00
Merge branch 'actor_rewrite' of https://github.com/SapphireMordred/Sapphire into actor_rewrite
This commit is contained in:
commit
e6e3e92742
8 changed files with 57 additions and 18 deletions
|
@ -557,7 +557,7 @@ namespace Common {
|
||||||
SetTitle = 0x1F4,
|
SetTitle = 0x1F4,
|
||||||
|
|
||||||
SetStatusIcon = 0x1F8,
|
SetStatusIcon = 0x1F8,
|
||||||
|
LimitBreakGauge = 0x1F9, // Max level, amount, build type (chop sound), lb type(0=pve lb 1=pvp lb)
|
||||||
SetHomepoint = 0x1FB,
|
SetHomepoint = 0x1FB,
|
||||||
SetFavorite = 0x1FC,
|
SetFavorite = 0x1FC,
|
||||||
LearnTeleport = 0x1FD,
|
LearnTeleport = 0x1FD,
|
||||||
|
@ -585,7 +585,20 @@ namespace Common {
|
||||||
DisableCurrentFestival = 0x386,
|
DisableCurrentFestival = 0x386,
|
||||||
|
|
||||||
ToggleOrchestrionUnlock = 0x396,
|
ToggleOrchestrionUnlock = 0x396,
|
||||||
Dismount = 0x3a0
|
Dismount = 0x3A0,
|
||||||
|
|
||||||
|
// PvP Duel
|
||||||
|
SetPvPState = 0x5E0, // param3 must be 6 to engage a duel (hardcoded in the client)
|
||||||
|
EndDuelSession = 0x5E1, // because someone went oob?
|
||||||
|
StartDuelCountdown = 0x5E2, // begins a countdown; also does some duel bgm thing.
|
||||||
|
StartDuel = 0x5E3, // actually all it does is set the challenger actor id;
|
||||||
|
DuelResultScreen = 0x5E4, // win/lose thing, also reset a target id just like what EndDuelSession does.
|
||||||
|
|
||||||
|
// Duty Action
|
||||||
|
SetDutyActionId = 0x5E8, // ContentExAction
|
||||||
|
SetDutyActionHud = 0x5E9, // disable/enable
|
||||||
|
SetDutyActionActive = 0x5EA,
|
||||||
|
SetDutyActionRemaining = 0x5EB,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum struct ChatType : uint16_t
|
enum struct ChatType : uint16_t
|
||||||
|
|
|
@ -164,6 +164,7 @@ namespace Packets {
|
||||||
PrepareZoning = 0x027C, // updated 4.2
|
PrepareZoning = 0x027C, // updated 4.2
|
||||||
ActorGauge = 0x027D, // updated 4.2
|
ActorGauge = 0x027D, // updated 4.2
|
||||||
|
|
||||||
|
DuelChallenge = 0x0277, // 4.2; this is the responsible for opening an ui
|
||||||
PerformNote = 0x0286, // updated 4.2
|
PerformNote = 0x0286, // updated 4.2
|
||||||
|
|
||||||
// Unknown IPC types that still need to be sent
|
// Unknown IPC types that still need to be sent
|
||||||
|
|
|
@ -1363,6 +1363,18 @@ struct FFXIVIpcObjectDespawn : FFXIVIpcBasePacket<ObjectDespawn>
|
||||||
uint8_t padding[7];
|
uint8_t padding[7];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcDuelChallenge : FFXIVIpcBasePacket<DuelChallenge>
|
||||||
|
{
|
||||||
|
uint8_t otherClassJobId;
|
||||||
|
uint8_t otherLevel; // class job level
|
||||||
|
uint8_t challengeByYou; // 0 if the other challenges you, 1 if you challenges the other.
|
||||||
|
uint8_t otherItemLevel;
|
||||||
|
|
||||||
|
uint32_t otherActorId;
|
||||||
|
|
||||||
|
char otherName[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
} /* Server */
|
} /* Server */
|
||||||
} /* Packets */
|
} /* Packets */
|
||||||
|
|
|
@ -103,6 +103,10 @@ enum ClientTrigger
|
||||||
CompanionActionUnlock = 0x6A6,
|
CompanionActionUnlock = 0x6A6,
|
||||||
|
|
||||||
OpenPerformInstrumentUI = 0x71C,
|
OpenPerformInstrumentUI = 0x71C,
|
||||||
|
|
||||||
|
OpenDuelUI = 0x898, // Open a duel ui
|
||||||
|
DuelRequestResult = 0x899, // either accept/reject
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& inPacket,
|
void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& inPacket,
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
#include "Actor/Chara.h"
|
#include "Actor/Chara.h"
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
#include "Zone.h"
|
#include "Zone.h"
|
||||||
|
#include <Logging/Logger.h>
|
||||||
|
|
||||||
|
#include "Framework.h"
|
||||||
|
extern Core::Framework g_fw;
|
||||||
|
|
||||||
// TODO: the entire zone / areahandling is a bit outdated ( in parts i used this for the 1.0 iteration )
|
// TODO: the entire zone / areahandling is a bit outdated ( in parts i used this for the 1.0 iteration )
|
||||||
// likely this could be greatly improved or redone
|
// likely this could be greatly improved or redone
|
||||||
|
@ -32,6 +36,8 @@ void Core::Cell::init( uint32_t x, uint32_t y, ZonePtr pZone )
|
||||||
|
|
||||||
void Core::Cell::addActor( Entity::ActorPtr pAct )
|
void Core::Cell::addActor( Entity::ActorPtr pAct )
|
||||||
{
|
{
|
||||||
|
auto pLog = g_fw.get< Core::Logger >();
|
||||||
|
pLog->debug( "Adding actor to cell in " + this->m_pZone->getName() );
|
||||||
if( pAct->isPlayer() )
|
if( pAct->isPlayer() )
|
||||||
++m_playerCount;
|
++m_playerCount;
|
||||||
|
|
||||||
|
@ -40,6 +46,8 @@ void Core::Cell::addActor( Entity::ActorPtr pAct )
|
||||||
|
|
||||||
void Core::Cell::removeActor( Entity::ActorPtr pAct )
|
void Core::Cell::removeActor( Entity::ActorPtr pAct )
|
||||||
{
|
{
|
||||||
|
auto pLog = g_fw.get< Core::Logger >();
|
||||||
|
pLog->debug( "Removing actor from cell in " + this->m_pZone->getName() );
|
||||||
if( pAct->isPlayer() )
|
if( pAct->isPlayer() )
|
||||||
--m_playerCount;
|
--m_playerCount;
|
||||||
|
|
||||||
|
|
|
@ -107,17 +107,13 @@ void Core::InstanceContent::onUpdate( uint32_t currTime )
|
||||||
if( m_boundPlayerIds.size() == 0 )
|
if( m_boundPlayerIds.size() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( const auto playerId : m_boundPlayerIds )
|
for( auto playerId : m_boundPlayerIds )
|
||||||
{
|
{
|
||||||
auto it = m_playerMap.find( playerId );
|
auto it = m_playerMap.find( playerId );
|
||||||
if( it == m_playerMap.end() )
|
if( it == m_playerMap.end() )
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
for( const auto& playerIt : m_playerMap )
|
|
||||||
{
|
|
||||||
const auto& player = playerIt.second;
|
|
||||||
|
|
||||||
|
auto player = it->second;
|
||||||
if( !player->isLoadingComplete() ||
|
if( !player->isLoadingComplete() ||
|
||||||
!player->isDirectorInitialized() ||
|
!player->isDirectorInitialized() ||
|
||||||
!player->isOnEnterEventDone() ||
|
!player->isOnEnterEventDone() ||
|
||||||
|
|
|
@ -314,6 +314,7 @@ Core::TerritoryMgr::InstanceIdList Core::TerritoryMgr::getInstanceContentIdList(
|
||||||
bool Core::TerritoryMgr::movePlayer( uint32_t territoryId, Core::Entity::PlayerPtr pPlayer )
|
bool Core::TerritoryMgr::movePlayer( uint32_t territoryId, Core::Entity::PlayerPtr pPlayer )
|
||||||
{
|
{
|
||||||
auto pZone = getZoneByTerriId( territoryId );
|
auto pZone = getZoneByTerriId( territoryId );
|
||||||
|
assert( pZone );
|
||||||
return movePlayer( pZone, pPlayer );
|
return movePlayer( pZone, pPlayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,8 +334,8 @@ bool Core::TerritoryMgr::movePlayer( ZonePtr pZone, Core::Entity::PlayerPtr pPla
|
||||||
// mark character as zoning in progress
|
// mark character as zoning in progress
|
||||||
pPlayer->setLoadingComplete( false );
|
pPlayer->setLoadingComplete( false );
|
||||||
|
|
||||||
if( pPlayer->getLastPing() != 0 )
|
//if( pPlayer->getLastPing() != 0 )
|
||||||
pPlayer->getCurrentZone()->removeActor( pPlayer );
|
// pPlayer->getCurrentZone()->removeActor( pPlayer );
|
||||||
|
|
||||||
pPlayer->setCurrentZone( pZone );
|
pPlayer->setCurrentZone( pZone );
|
||||||
pZone->pushActor( pPlayer );
|
pZone->pushActor( pPlayer );
|
||||||
|
|
|
@ -225,20 +225,21 @@ void Core::Zone::pushActor( Entity::ActorPtr pActor )
|
||||||
|
|
||||||
void Core::Zone::removeActor( Entity::ActorPtr pActor )
|
void Core::Zone::removeActor( Entity::ActorPtr pActor )
|
||||||
{
|
{
|
||||||
|
float mx = pActor->getPos().x;
|
||||||
|
float my = pActor->getPos().z;
|
||||||
|
uint32_t cx = getPosX( mx );
|
||||||
|
uint32_t cy = getPosY( my );
|
||||||
|
|
||||||
auto pCell = pActor->getCellPtr();
|
Cell* pCell = getCellPtr(cx, cy);
|
||||||
if( pCell )
|
if( pCell && pCell->hasActor( pActor ) )
|
||||||
{
|
|
||||||
pCell->removeActor( pActor );
|
pCell->removeActor( pActor );
|
||||||
pCell = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pActor->isPlayer() )
|
if( pActor->isPlayer() )
|
||||||
{
|
{
|
||||||
|
|
||||||
// If it's a player and he's inside boundaries - update his nearby cells
|
// If it's a player and he's inside boundaries - update his nearby cells
|
||||||
if( pActor->getPos().x <= _maxX && pActor->getPos().x >= _minX &&
|
if( pActor->getPos().x <= _maxX && pActor->getPos().x >= _minX &&
|
||||||
pActor->getPos().z <= _maxY && pActor->getPos().z >= _minY )
|
pActor->getPos().z <= _maxY && pActor->getPos().z >= _minY )
|
||||||
{
|
{
|
||||||
uint32_t x = getPosX( pActor->getPos().x );
|
uint32_t x = getPosX( pActor->getPos().x );
|
||||||
uint32_t y = getPosY( pActor->getPos().z );
|
uint32_t y = getPosY( pActor->getPos().z );
|
||||||
|
@ -416,8 +417,7 @@ void Core::Zone::updateSessions( bool changedWeather )
|
||||||
// this session is not linked to this area anymore, remove it from zone session list
|
// this session is not linked to this area anymore, remove it from zone session list
|
||||||
if( ( !pPlayer->getCurrentZone() ) || ( pPlayer->getCurrentZone() != shared_from_this() ) )
|
if( ( !pPlayer->getCurrentZone() ) || ( pPlayer->getCurrentZone() != shared_from_this() ) )
|
||||||
{
|
{
|
||||||
if( pPlayer->getCellPtr() )
|
removeActor( pSession->getPlayer() );
|
||||||
removeActor( pSession->getPlayer() );
|
|
||||||
|
|
||||||
it = m_sessionSet.erase(it );
|
it = m_sessionSet.erase(it );
|
||||||
continue;
|
continue;
|
||||||
|
@ -539,7 +539,11 @@ void Core::Zone::updateActorPosition( Entity::Actor &actor )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( pOldCell )
|
if( pOldCell )
|
||||||
|
{
|
||||||
|
auto pLog = g_fw.get< Logger >();
|
||||||
|
pLog->debug( std::string( __FUNCTION__ ) + " -> removeActor() ...moving cell..." );
|
||||||
pOldCell->removeActor( actor.shared_from_this() );
|
pOldCell->removeActor( actor.shared_from_this() );
|
||||||
|
}
|
||||||
|
|
||||||
pCell->addActor( actor.shared_from_this() );
|
pCell->addActor( actor.shared_from_this() );
|
||||||
actor.setCell( pCell );
|
actor.setCell( pCell );
|
||||||
|
|
Loading…
Add table
Reference in a new issue