mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
General cleanup work
This commit is contained in:
parent
1a18f1a9ce
commit
b571be8b6f
28 changed files with 172 additions and 175 deletions
|
@ -190,9 +190,7 @@ namespace Sapphire::Network::Packets
|
||||||
LandPriceUpdate = 0x0224, // updated 4.4
|
LandPriceUpdate = 0x0224, // updated 4.4
|
||||||
LandInfoSign = 0x0225, // updated 4.4
|
LandInfoSign = 0x0225, // updated 4.4
|
||||||
LandRename = 0x0226, // updated 4.4
|
LandRename = 0x0226, // updated 4.4
|
||||||
|
|
||||||
HousingEstateGreeting = 0x0227, // updated 4.4
|
HousingEstateGreeting = 0x0227, // updated 4.4
|
||||||
|
|
||||||
HousingUpdateLandFlagsSlot = 0x0228, // updated 4.4
|
HousingUpdateLandFlagsSlot = 0x0228, // updated 4.4
|
||||||
HousingLandFlags = 0x0229, // updated 4.4
|
HousingLandFlags = 0x0229, // updated 4.4
|
||||||
HousingShowEstateGuestAccess = 0x022A, // updated 4.4
|
HousingShowEstateGuestAccess = 0x022A, // updated 4.4
|
||||||
|
@ -200,7 +198,6 @@ namespace Sapphire::Network::Packets
|
||||||
LandSetYardInitialize = 0x022C, // updated 4.4
|
LandSetYardInitialize = 0x022C, // updated 4.4
|
||||||
|
|
||||||
HousingWardInfo = 0x022F, // updated 4.4
|
HousingWardInfo = 0x022F, // updated 4.4
|
||||||
|
|
||||||
YardObjectMove = 0x0230, // updated 4.4
|
YardObjectMove = 0x0230, // updated 4.4
|
||||||
|
|
||||||
SharedEstateSettingsResponse = 0x023C, // updated 4.4
|
SharedEstateSettingsResponse = 0x023C, // updated 4.4
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "UtilMath.h"
|
#include "UtilMath.h"
|
||||||
|
|
||||||
float Sapphire::Math::Util::distanceSq( float x, float y, float z, float x1, float y1, float z1 )
|
float Sapphire::Util::distanceSq( float x, float y, float z, float x1, float y1, float z1 )
|
||||||
{
|
{
|
||||||
float deltaX = x - x1;
|
float deltaX = x - x1;
|
||||||
float deltaY = y - y1;
|
float deltaY = y - y1;
|
||||||
|
@ -10,24 +10,24 @@ float Sapphire::Math::Util::distanceSq( float x, float y, float z, float x1, flo
|
||||||
return ( deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ );
|
return ( deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ );
|
||||||
}
|
}
|
||||||
|
|
||||||
float Sapphire::Math::Util::distance( float x, float y, float z, float x1, float y1, float z1 )
|
float Sapphire::Util::distance( float x, float y, float z, float x1, float y1, float z1 )
|
||||||
{
|
{
|
||||||
return sqrtf( distanceSq( x, y, z, x1, y1, z1 ) );
|
return sqrtf( distanceSq( x, y, z, x1, y1, z1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
float Sapphire::Math::Util::distance2DSq( float x, float y, float x1, float y1 )
|
float Sapphire::Util::distance2DSq( float x, float y, float x1, float y1 )
|
||||||
{
|
{
|
||||||
float deltaX = x - x1;
|
float deltaX = x - x1;
|
||||||
float deltaY = y - y1;
|
float deltaY = y - y1;
|
||||||
return ( deltaX * deltaX + deltaY * deltaY );
|
return ( deltaX * deltaX + deltaY * deltaY );
|
||||||
}
|
}
|
||||||
|
|
||||||
float Sapphire::Math::Util::distance2D( float x, float y, float x1, float y1 )
|
float Sapphire::Util::distance2D( float x, float y, float x1, float y1 )
|
||||||
{
|
{
|
||||||
return sqrtf( distance2DSq( x, y, x1, y1 ) );
|
return sqrtf( distance2DSq( x, y, x1, y1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
float Sapphire::Math::Util::calcAngTo( float x, float y, float x1, float y1 )
|
float Sapphire::Util::calcAngTo( float x, float y, float x1, float y1 )
|
||||||
{
|
{
|
||||||
float dx = x - x1;
|
float dx = x - x1;
|
||||||
float dy = y - y1;
|
float dy = y - y1;
|
||||||
|
@ -41,7 +41,7 @@ float Sapphire::Math::Util::calcAngTo( float x, float y, float x1, float y1 )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Sapphire::Math::Util::calcAngFrom( float x, float y, float x1, float y1 )
|
float Sapphire::Util::calcAngFrom( float x, float y, float x1, float y1 )
|
||||||
{
|
{
|
||||||
float dx = x - x1;
|
float dx = x - x1;
|
||||||
float dy = y - y1;
|
float dy = y - y1;
|
||||||
|
@ -55,17 +55,17 @@ float Sapphire::Math::Util::calcAngFrom( float x, float y, float x1, float y1 )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Sapphire::Math::Util::floatToUInt16( float val )
|
uint16_t Sapphire::Util::floatToUInt16( float val )
|
||||||
{
|
{
|
||||||
return static_cast< uint16_t >( 0x8000 + val * 32.767f );
|
return static_cast< uint16_t >( 0x8000 + val * 32.767f );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Sapphire::Math::Util::floatToUInt16Rot( float val )
|
uint16_t Sapphire::Util::floatToUInt16Rot( float val )
|
||||||
{
|
{
|
||||||
return static_cast< uint16_t >( 0x8000 * ( ( val + PI ) ) / PI );
|
return static_cast< uint16_t >( 0x8000 * ( ( val + PI ) ) / PI );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Sapphire::Math::Util::floatToUInt8Rot( float val )
|
uint8_t Sapphire::Util::floatToUInt8Rot( float val )
|
||||||
{
|
{
|
||||||
return static_cast< uint8_t >( 0x80 * ( ( val + PI ) ) / PI );
|
return static_cast< uint8_t >( 0x80 * ( ( val + PI ) ) / PI );
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#define PI 3.14159265358979323846f
|
#define PI 3.14159265358979323846f
|
||||||
|
|
||||||
namespace Sapphire::Math::Util
|
namespace Sapphire::Util
|
||||||
{
|
{
|
||||||
|
|
||||||
float distanceSq( float x, float y, float z, float x1, float y1, float z1 );
|
float distanceSq( float x, float y, float z, float x1, float y1, float z1 );
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return LandPurchaseResult::ERR_INTERNAL;
|
||||||
};
|
};
|
||||||
|
|
||||||
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||||
|
|
|
@ -129,8 +129,8 @@ std::set< Sapphire::Entity::ActorPtr > ActionCollision::getActorsHitFromAction(
|
||||||
bool
|
bool
|
||||||
ActionCollision::radiusCollision( FFXIVARR_POSITION3 actorPosition, FFXIVARR_POSITION3 aoePosition, uint16_t radius )
|
ActionCollision::radiusCollision( FFXIVARR_POSITION3 actorPosition, FFXIVARR_POSITION3 aoePosition, uint16_t radius )
|
||||||
{
|
{
|
||||||
return Sapphire::Math::Util::distance( actorPosition.x, actorPosition.y, actorPosition.z,
|
return Sapphire::Util::distance( actorPosition.x, actorPosition.y, actorPosition.z,
|
||||||
aoePosition.x, aoePosition.y, aoePosition.z ) <= radius;
|
aoePosition.x, aoePosition.y, aoePosition.z ) <= radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActionCollision::boxCollision( FFXIVARR_POSITION3 actorPosition, FFXIVARR_POSITION3 aoePosition, uint16_t width,
|
bool ActionCollision::boxCollision( FFXIVARR_POSITION3 actorPosition, FFXIVARR_POSITION3 aoePosition, uint16_t width,
|
||||||
|
|
|
@ -75,7 +75,7 @@ void Sapphire::Action::ActionMount::onFinish()
|
||||||
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
|
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
|
||||||
|
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 4 );
|
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 4 );
|
||||||
effectPacket->setRotation( Math::Util::floatToUInt16Rot( pPlayer->getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( pPlayer->getRot() ) );
|
||||||
|
|
||||||
Server::EffectEntry effectEntry{};
|
Server::EffectEntry effectEntry{};
|
||||||
effectEntry.effectType = ActionEffectType::Mount;
|
effectEntry.effectType = ActionEffectType::Mount;
|
||||||
|
|
|
@ -87,7 +87,7 @@ void Sapphire::Action::ActionTeleport::onFinish()
|
||||||
pPlayer->setZoningType( ZoneingType::Teleport );
|
pPlayer->setZoningType( ZoneingType::Teleport );
|
||||||
|
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 5 );
|
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 5 );
|
||||||
effectPacket->setRotation( Math::Util::floatToUInt16Rot( pPlayer->getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( pPlayer->getRot() ) );
|
||||||
|
|
||||||
|
|
||||||
pPlayer->sendToInRangeSet( effectPacket, true );
|
pPlayer->sendToInRangeSet( effectPacket, true );
|
||||||
|
|
|
@ -73,7 +73,7 @@ void Sapphire::Action::EventItemAction::onFinish()
|
||||||
{
|
{
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( m_pSource->getId(), m_additional, m_id );
|
auto effectPacket = std::make_shared< Server::EffectPacket >( m_pSource->getId(), m_additional, m_id );
|
||||||
effectPacket->setAnimationId( 1 );
|
effectPacket->setAnimationId( 1 );
|
||||||
effectPacket->setRotation( Math::Util::floatToUInt16Rot( m_pSource->getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( m_pSource->getRot() ) );
|
||||||
|
|
||||||
m_pSource->getAsPlayer()->unsetStateFlag( Common::PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->unsetStateFlag( Common::PlayerStateFlag::Casting );
|
||||||
m_pSource->sendToInRangeSet( effectPacket, true );
|
m_pSource->sendToInRangeSet( effectPacket, true );
|
||||||
|
|
|
@ -268,12 +268,8 @@ Sapphire::Entity::ActorPtr Sapphire::Entity::Actor::getClosestActor()
|
||||||
|
|
||||||
for( const auto& pCurAct : m_inRangeActor )
|
for( const auto& pCurAct : m_inRangeActor )
|
||||||
{
|
{
|
||||||
float distance = Math::Util::distance( getPos().x,
|
float distance = Util::distance( getPos().x, getPos().y, getPos().z,
|
||||||
getPos().y,
|
pCurAct->getPos().x, pCurAct->getPos().y, pCurAct->getPos().z );
|
||||||
getPos().z,
|
|
||||||
pCurAct->getPos().x,
|
|
||||||
pCurAct->getPos().y,
|
|
||||||
pCurAct->getPos().z );
|
|
||||||
|
|
||||||
if( distance < minDistance )
|
if( distance < minDistance )
|
||||||
{
|
{
|
||||||
|
|
|
@ -239,7 +239,7 @@ position
|
||||||
bool Sapphire::Entity::Chara::face( const Common::FFXIVARR_POSITION3& p )
|
bool Sapphire::Entity::Chara::face( const Common::FFXIVARR_POSITION3& p )
|
||||||
{
|
{
|
||||||
float oldRot = getRot();
|
float oldRot = getRot();
|
||||||
float rot = Math::Util::calcAngFrom( getPos().x, getPos().z, p.x, p.z );
|
float rot = Util::calcAngFrom( getPos().x, getPos().z, p.x, p.z );
|
||||||
float newRot = PI - rot + ( PI / 2 );
|
float newRot = PI - rot + ( PI / 2 );
|
||||||
|
|
||||||
m_pCell = nullptr;
|
m_pCell = nullptr;
|
||||||
|
@ -403,7 +403,7 @@ void Sapphire::Entity::Chara::autoAttack( CharaPtr pTarget )
|
||||||
uint32_t variation = static_cast< uint32_t >( 0 + rand() % 4 );
|
uint32_t variation = static_cast< uint32_t >( 0 + rand() % 4 );
|
||||||
|
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 0x336 );
|
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 0x336 );
|
||||||
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
||||||
|
|
||||||
Server::EffectEntry effectEntry{};
|
Server::EffectEntry effectEntry{};
|
||||||
effectEntry.value = damage;
|
effectEntry.value = damage;
|
||||||
|
@ -443,7 +443,7 @@ void Sapphire::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionI
|
||||||
// Prepare packet. This is seemingly common for all packets in the action handler.
|
// Prepare packet. This is seemingly common for all packets in the action handler.
|
||||||
|
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), target.getId(), actionId );
|
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), target.getId(), actionId );
|
||||||
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
||||||
|
|
||||||
// Todo: for each actor, calculate how much damage the calculated value should deal to them - 2-step damage calc. we only have 1-step
|
// Todo: for each actor, calculate how much damage the calculated value should deal to them - 2-step damage calc. we only have 1-step
|
||||||
switch( type )
|
switch( type )
|
||||||
|
|
|
@ -137,7 +137,7 @@ void Sapphire::Entity::EventObject::spawn( Sapphire::Entity::PlayerPtr pTarget )
|
||||||
eobjStatePacket->data().scale = getScale();
|
eobjStatePacket->data().scale = getScale();
|
||||||
eobjStatePacket->data().actorId = getId();
|
eobjStatePacket->data().actorId = getId();
|
||||||
eobjStatePacket->data().housingLink = getHousingLink();
|
eobjStatePacket->data().housingLink = getHousingLink();
|
||||||
eobjStatePacket->data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
eobjStatePacket->data().rotation = Util::floatToUInt16Rot( getRot() );
|
||||||
pTarget->queuePacket( eobjStatePacket );
|
pTarget->queuePacket( eobjStatePacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ void Sapphire::Entity::Player::update( int64_t currTime )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto setActorPosPacket = makeZonePacket< FFXIVIpcActorSetPos >( getId() );
|
auto setActorPosPacket = makeZonePacket< FFXIVIpcActorSetPos >( getId() );
|
||||||
setActorPosPacket->data().r16 = Math::Util::floatToUInt16Rot( m_queuedZoneing->m_targetRotation );
|
setActorPosPacket->data().r16 = Util::floatToUInt16Rot( m_queuedZoneing->m_targetRotation );
|
||||||
setActorPosPacket->data().waitForLoad = 0x04;
|
setActorPosPacket->data().waitForLoad = 0x04;
|
||||||
setActorPosPacket->data().x = targetPos.x;
|
setActorPosPacket->data().x = targetPos.x;
|
||||||
setActorPosPacket->data().y = targetPos.y;
|
setActorPosPacket->data().y = targetPos.y;
|
||||||
|
@ -1064,8 +1064,8 @@ void Sapphire::Entity::Player::update( int64_t currTime )
|
||||||
range = 25;
|
range = 25;
|
||||||
|
|
||||||
|
|
||||||
if( Math::Util::distance( getPos().x, getPos().y, getPos().z,
|
if( Util::distance( getPos().x, getPos().y, getPos().z,
|
||||||
actor->getPos().x, actor->getPos().y, actor->getPos().z ) <= range )
|
actor->getPos().x, actor->getPos().y, actor->getPos().z ) <= range )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( ( currTime - m_lastAttack ) > mainWeap->getDelay() )
|
if( ( currTime - m_lastAttack ) > mainWeap->getDelay() )
|
||||||
|
@ -1438,7 +1438,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
||||||
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
|
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
|
||||||
{
|
{
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 8 );
|
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 8 );
|
||||||
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
||||||
|
|
||||||
Server::EffectEntry entry;
|
Server::EffectEntry entry;
|
||||||
entry.value = damage;
|
entry.value = damage;
|
||||||
|
@ -1452,7 +1452,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
|
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
|
||||||
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
||||||
|
|
||||||
Server::EffectEntry entry;
|
Server::EffectEntry entry;
|
||||||
entry.value = damage;
|
entry.value = damage;
|
||||||
|
|
|
@ -666,7 +666,7 @@ void Sapphire::DebugCommandHandler::nudge( char* data, Entity::Player& player, s
|
||||||
setActorPosPacket->data().x = player.getPos().x;
|
setActorPosPacket->data().x = player.getPos().x;
|
||||||
setActorPosPacket->data().y = player.getPos().y;
|
setActorPosPacket->data().y = player.getPos().y;
|
||||||
setActorPosPacket->data().z = player.getPos().z;
|
setActorPosPacket->data().z = player.getPos().z;
|
||||||
setActorPosPacket->data().r16 = Math::Util::floatToUInt16Rot( player.getRot() );
|
setActorPosPacket->data().r16 = Util::floatToUInt16Rot( player.getRot() );
|
||||||
player.queuePacket( setActorPosPacket );
|
player.queuePacket( setActorPosPacket );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,8 @@ x ## Ptr make_ ## x( Args &&...args ) { \
|
||||||
return std::make_shared< x >( std::forward< Args >( args ) ... ); }\
|
return std::make_shared< x >( std::forward< Args >( args ) ... ); }\
|
||||||
typedef std::vector< x > x ## PtrList;
|
typedef std::vector< x > x ## PtrList;
|
||||||
|
|
||||||
namespace Sapphire {
|
namespace Sapphire
|
||||||
|
{
|
||||||
TYPE_FORWARD( Cell );
|
TYPE_FORWARD( Cell );
|
||||||
TYPE_FORWARD( Zone );
|
TYPE_FORWARD( Zone );
|
||||||
TYPE_FORWARD( HousingZone );
|
TYPE_FORWARD( HousingZone );
|
||||||
|
@ -27,6 +28,7 @@ TYPE_FORWARD( ItemContainer );
|
||||||
TYPE_FORWARD( Session );
|
TYPE_FORWARD( Session );
|
||||||
TYPE_FORWARD( ZonePosition );
|
TYPE_FORWARD( ZonePosition );
|
||||||
TYPE_FORWARD( Land )
|
TYPE_FORWARD( Land )
|
||||||
|
TYPE_FORWARD( Linkshell )
|
||||||
|
|
||||||
namespace World::Territory::Housing
|
namespace World::Territory::Housing
|
||||||
{
|
{
|
||||||
|
@ -38,12 +40,14 @@ namespace World::Manager
|
||||||
TYPE_FORWARD( HousingMgr );
|
TYPE_FORWARD( HousingMgr );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace StatusEffect {
|
namespace StatusEffect
|
||||||
|
{
|
||||||
TYPE_FORWARD( StatusEffect );
|
TYPE_FORWARD( StatusEffect );
|
||||||
TYPE_FORWARD( StatusEffectContainer );
|
TYPE_FORWARD( StatusEffectContainer );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Entity {
|
namespace Entity
|
||||||
|
{
|
||||||
TYPE_FORWARD( Actor );
|
TYPE_FORWARD( Actor );
|
||||||
TYPE_FORWARD( Chara );
|
TYPE_FORWARD( Chara );
|
||||||
TYPE_FORWARD( Player );
|
TYPE_FORWARD( Player );
|
||||||
|
@ -52,12 +56,14 @@ TYPE_FORWARD( BNpcTemplate );
|
||||||
TYPE_FORWARD( BNpc );
|
TYPE_FORWARD( BNpc );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Event {
|
namespace Event
|
||||||
|
{
|
||||||
TYPE_FORWARD( Director );
|
TYPE_FORWARD( Director );
|
||||||
TYPE_FORWARD( EventHandler );
|
TYPE_FORWARD( EventHandler );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Action {
|
namespace Action
|
||||||
|
{
|
||||||
TYPE_FORWARD( Action );
|
TYPE_FORWARD( Action );
|
||||||
TYPE_FORWARD( ActionTeleport );
|
TYPE_FORWARD( ActionTeleport );
|
||||||
TYPE_FORWARD( ActionCast );
|
TYPE_FORWARD( ActionCast );
|
||||||
|
@ -66,7 +72,8 @@ TYPE_FORWARD( EventAction );
|
||||||
TYPE_FORWARD( EventItemAction );
|
TYPE_FORWARD( EventItemAction );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Network {
|
namespace Network
|
||||||
|
{
|
||||||
TYPE_FORWARD( Hive );
|
TYPE_FORWARD( Hive );
|
||||||
TYPE_FORWARD( Acceptor );
|
TYPE_FORWARD( Acceptor );
|
||||||
TYPE_FORWARD( Connection );
|
TYPE_FORWARD( Connection );
|
||||||
|
@ -74,17 +81,20 @@ TYPE_FORWARD( GameConnection );
|
||||||
TYPE_FORWARD( SessionConnection );
|
TYPE_FORWARD( SessionConnection );
|
||||||
TYPE_FORWARD( CustomMsgClientConnection );
|
TYPE_FORWARD( CustomMsgClientConnection );
|
||||||
|
|
||||||
namespace Packets {
|
namespace Packets
|
||||||
|
{
|
||||||
TYPE_FORWARD( GamePacket );
|
TYPE_FORWARD( GamePacket );
|
||||||
TYPE_FORWARD( FFXIVPacketBase );
|
TYPE_FORWARD( FFXIVPacketBase );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ContentFinder {
|
namespace ContentFinder
|
||||||
|
{
|
||||||
TYPE_FORWARD( ContentFinder );
|
TYPE_FORWARD( ContentFinder );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Scripting {
|
namespace Scripting
|
||||||
|
{
|
||||||
class NativeScriptMgr;
|
class NativeScriptMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "Linkshell.h"
|
#include "Linkshell.h"
|
||||||
|
|
||||||
|
|
||||||
Sapphire::Linkshell::Linkshell( uint64_t id,
|
Sapphire::Linkshell::Linkshell( uint64_t id,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
uint64_t masterId,
|
uint64_t masterId,
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Database/DatabaseDef.h>
|
#include <Database/DatabaseDef.h>
|
||||||
|
|
||||||
#include "Linkshell.h"
|
#include "Linkshell/Linkshell.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include "LinkshellMgr.h"
|
#include "LinkshellMgr.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
extern Sapphire::Framework g_fw;
|
||||||
|
|
||||||
Sapphire::LinkshellMgr::LinkshellMgr()
|
Sapphire::World::Manager::LinkshellMgr::LinkshellMgr()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::LinkshellMgr::loadLinkshells()
|
bool Sapphire::World::Manager::LinkshellMgr::loadLinkshells()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto res = pDb->query( "SELECT LinkshellId, MasterCharacterId, CharacterIdList, "
|
auto res = pDb->query( "SELECT LinkshellId, MasterCharacterId, CharacterIdList, "
|
||||||
|
@ -61,7 +60,7 @@ bool Sapphire::LinkshellMgr::loadLinkshells()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::LinkshellPtr Sapphire::LinkshellMgr::getLinkshellByName( const std::string& name )
|
Sapphire::LinkshellPtr Sapphire::World::Manager::LinkshellMgr::getLinkshellByName( const std::string& name )
|
||||||
{
|
{
|
||||||
auto it = m_linkshellNameMap.find( name );
|
auto it = m_linkshellNameMap.find( name );
|
||||||
if( it == m_linkshellNameMap.end() )
|
if( it == m_linkshellNameMap.end() )
|
||||||
|
@ -70,7 +69,7 @@ Sapphire::LinkshellPtr Sapphire::LinkshellMgr::getLinkshellByName( const std::st
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::LinkshellPtr Sapphire::LinkshellMgr::getLinkshellById( uint64_t lsId )
|
Sapphire::LinkshellPtr Sapphire::World::Manager::LinkshellMgr::getLinkshellById( uint64_t lsId )
|
||||||
{
|
{
|
||||||
auto it = m_linkshellIdMap.find( lsId );
|
auto it = m_linkshellIdMap.find( lsId );
|
||||||
if( it == m_linkshellIdMap.end() )
|
if( it == m_linkshellIdMap.end() )
|
|
@ -1,14 +1,12 @@
|
||||||
#ifndef CORE_LINKSHELLMGR_H
|
#ifndef SAPPHIRE_LINKSHELLMGR_H
|
||||||
#define CORE_LINKSHELLMGR_H
|
#define SAPPHIRE_LINKSHELLMGR_H
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
class Linkshell;
|
|
||||||
|
|
||||||
using LinkshellPtr = std::shared_ptr< Linkshell >;
|
|
||||||
|
|
||||||
class LinkshellMgr
|
class LinkshellMgr
|
||||||
{
|
{
|
||||||
|
@ -27,4 +25,4 @@ namespace Sapphire
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif //CORE_LINKSHELLMGR_H
|
#endif //SAPPHIRE_LINKSHELLMGR_H
|
|
@ -297,7 +297,8 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInt
|
||||||
auto housingMgr = g_fw.get< Manager::HousingMgr >();
|
auto housingMgr = g_fw.get< Manager::HousingMgr >();
|
||||||
|
|
||||||
auto parentZone = std::dynamic_pointer_cast< HousingZone >(
|
auto parentZone = std::dynamic_pointer_cast< HousingZone >(
|
||||||
getZoneByLandSetId( housingMgr->toLandSetId( landIdent.territoryTypeId, landIdent.wardNum ) ) );
|
getZoneByLandSetId( housingMgr->toLandSetId( static_cast< uint16_t >( landIdent.territoryTypeId ),
|
||||||
|
static_cast< uint8_t >( landIdent.wardNum ) ) ) );
|
||||||
|
|
||||||
if( !parentZone )
|
if( !parentZone )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -29,14 +29,14 @@ namespace Sapphire::Network::Packets::Server
|
||||||
void initialize( Entity::Chara& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 )
|
void initialize( Entity::Chara& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 )
|
||||||
{
|
{
|
||||||
|
|
||||||
m_data.rotation = Math::Util::floatToUInt8Rot( actor.getRot() );
|
m_data.rotation = Util::floatToUInt8Rot( actor.getRot() );
|
||||||
m_data.unknown_1 = unk1;
|
m_data.unknown_1 = unk1;
|
||||||
m_data.unknown_2 = unk2;
|
m_data.unknown_2 = unk2;
|
||||||
m_data.unknown_3 = unk3;
|
m_data.unknown_3 = unk3;
|
||||||
m_data.unknown_4 = unk4;
|
m_data.unknown_4 = unk4;
|
||||||
m_data.posX = Math::Util::floatToUInt16( actor.getPos().x );
|
m_data.posX = Util::floatToUInt16( actor.getPos().x );
|
||||||
m_data.posY = Math::Util::floatToUInt16( actor.getPos().y );
|
m_data.posY = Util::floatToUInt16( actor.getPos().y );
|
||||||
m_data.posZ = Math::Util::floatToUInt16( actor.getPos().z );
|
m_data.posZ = Util::floatToUInt16( actor.getPos().z );
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace Sapphire::Network::Packets::Server
|
||||||
m_data.pos.x = bnpc.getPos().x;
|
m_data.pos.x = bnpc.getPos().x;
|
||||||
m_data.pos.y = bnpc.getPos().y;
|
m_data.pos.y = bnpc.getPos().y;
|
||||||
m_data.pos.z = bnpc.getPos().z;
|
m_data.pos.z = bnpc.getPos().z;
|
||||||
m_data.rotation = Math::Util::floatToUInt16Rot( bnpc.getRot() );
|
m_data.rotation = Util::floatToUInt16Rot( bnpc.getRot() );
|
||||||
|
|
||||||
m_data.enemyType = bnpc.getEnemyType();
|
m_data.enemyType = bnpc.getEnemyType();
|
||||||
m_data.mainWeaponModel = bnpc.getWeaponMain();
|
m_data.mainWeaponModel = bnpc.getWeaponMain();
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace Sapphire::Network::Packets::Server
|
||||||
m_data.pos.x = player.getPos().x;
|
m_data.pos.x = player.getPos().x;
|
||||||
m_data.pos.y = player.getPos().y;
|
m_data.pos.y = player.getPos().y;
|
||||||
m_data.pos.z = player.getPos().z;
|
m_data.pos.z = player.getPos().z;
|
||||||
m_data.rotation = Math::Util::floatToUInt16Rot( player.getRot() );
|
m_data.rotation = Util::floatToUInt16Rot( player.getRot() );
|
||||||
|
|
||||||
|
|
||||||
m_data.title = player.getTitle();
|
m_data.title = player.getTitle();
|
||||||
|
|
|
@ -121,7 +121,7 @@ void Sapphire::Scripting::ScriptMgr::watchDirectories()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set< std::string >& files,
|
bool Sapphire::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set< std::string >& files,
|
||||||
const std::string& ext )
|
const std::string& ext )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
|
@ -190,19 +190,17 @@ bool Sapphire::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t ac
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId & 0xFFFF0000 );
|
script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId & 0xFFFF0000 );
|
||||||
if( !script )
|
if( !script )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
script->onTalk( eventId, player, actorId );
|
script->onTalk( eventId, player, actorId );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::onEnterTerritory( Entity::Player& player, uint32_t eventId,
|
bool Sapphire::Scripting::ScriptMgr::onEnterTerritory( Entity::Player& player, uint32_t eventId,
|
||||||
uint16_t param1, uint16_t param2 )
|
uint16_t param1, uint16_t param2 )
|
||||||
{
|
{
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||||
if( !script )
|
if( !script )
|
||||||
|
@ -212,7 +210,7 @@ bool Sapphire::Scripting::ScriptMgr::onEnterTerritory( Entity::Player& player, u
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
bool Sapphire::Scripting::ScriptMgr::onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
||||||
float x, float y, float z )
|
float x, float y, float z )
|
||||||
{
|
{
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||||
if( !script )
|
if( !script )
|
||||||
|
@ -222,7 +220,7 @@ bool Sapphire::Scripting::ScriptMgr::onWithinRange( Entity::Player& player, uint
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
bool Sapphire::Scripting::ScriptMgr::onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1,
|
||||||
float x, float y, float z )
|
float x, float y, float z )
|
||||||
{
|
{
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||||
if( !script )
|
if( !script )
|
||||||
|
@ -232,7 +230,7 @@ bool Sapphire::Scripting::ScriptMgr::onOutsideRange( Entity::Player& player, uin
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::onEmote( Entity::Player& player, uint64_t actorId,
|
bool Sapphire::Scripting::ScriptMgr::onEmote( Entity::Player& player, uint64_t actorId,
|
||||||
uint32_t eventId, uint8_t emoteId )
|
uint32_t eventId, uint8_t emoteId )
|
||||||
{
|
{
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||||
if( !script )
|
if( !script )
|
||||||
|
@ -242,15 +240,15 @@ bool Sapphire::Scripting::ScriptMgr::onEmote( Entity::Player& player, uint64_t a
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::onEventHandlerReturn( Entity::Player& player, uint32_t eventId,
|
bool Sapphire::Scripting::ScriptMgr::onEventHandlerReturn( Entity::Player& player, uint32_t eventId,
|
||||||
uint16_t subEvent, uint16_t param1, uint16_t param2,
|
uint16_t subEvent, uint16_t param1, uint16_t param2,
|
||||||
uint16_t param3 )
|
uint16_t param3 )
|
||||||
{
|
{
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId,
|
bool Sapphire::Scripting::ScriptMgr::onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId,
|
||||||
uint16_t subEvent, uint16_t param, uint32_t catalogId )
|
uint16_t subEvent, uint16_t param, uint32_t catalogId )
|
||||||
{
|
{
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||||
if( script )
|
if( script )
|
||||||
|
@ -263,7 +261,7 @@ bool Sapphire::Scripting::ScriptMgr::onEventHandlerTradeReturn( Entity::Player&
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::onEventItem( Entity::Player& player, uint32_t eventItemId,
|
bool Sapphire::Scripting::ScriptMgr::onEventItem( Entity::Player& player, uint32_t eventItemId,
|
||||||
uint32_t eventId, uint32_t castTime, uint64_t targetId )
|
uint32_t eventId, uint32_t castTime, uint64_t targetId )
|
||||||
{
|
{
|
||||||
std::string eventName = "onEventItem";
|
std::string eventName = "onEventItem";
|
||||||
std::string objName = Event::getEventName( eventId );
|
std::string objName = Event::getEventName( eventId );
|
||||||
|
@ -402,7 +400,7 @@ bool Sapphire::Scripting::ScriptMgr::onInstanceUpdate( InstanceContentPtr instan
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Scripting::ScriptMgr::onInstanceEnterTerritory( InstanceContentPtr instance, Entity::Player& player,
|
bool Sapphire::Scripting::ScriptMgr::onInstanceEnterTerritory( InstanceContentPtr instance, Entity::Player& player,
|
||||||
uint32_t eventId, uint16_t param1, uint16_t param2 )
|
uint32_t eventId, uint16_t param1, uint16_t param2 )
|
||||||
{
|
{
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::InstanceContentScript >( instance->getDirectorId() );
|
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::InstanceContentScript >( instance->getDirectorId() );
|
||||||
if( script )
|
if( script )
|
||||||
|
|
|
@ -22,9 +22,10 @@
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
|
|
||||||
#include "Manager/TerritoryMgr.h"
|
#include "Manager/TerritoryMgr.h"
|
||||||
|
#include "Manager/LinkshellMgr.h"
|
||||||
|
|
||||||
#include "Script/ScriptMgr.h"
|
#include "Script/ScriptMgr.h"
|
||||||
#include "Linkshell/LinkshellMgr.h"
|
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
extern Sapphire::Framework g_fw;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Housing::HousingInteriorTerritory::~HousingInteriorTerritory()
|
||||||
|
|
||||||
bool Housing::HousingInteriorTerritory::init()
|
bool Housing::HousingInteriorTerritory::init()
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Housing::HousingInteriorTerritory::onPlayerZoneIn( Entity::Player& player )
|
void Housing::HousingInteriorTerritory::onPlayerZoneIn( Entity::Player& player )
|
||||||
|
|
|
@ -296,7 +296,7 @@ void Sapphire::Land::update( uint32_t currTime )
|
||||||
if( m_nextDrop < currTime && m_minPrice < m_currentPrice )
|
if( m_nextDrop < currTime && m_minPrice < m_currentPrice )
|
||||||
{
|
{
|
||||||
m_nextDrop = currTime + 21600;
|
m_nextDrop = currTime + 21600;
|
||||||
m_currentPrice = ( m_currentPrice / 100 ) * 99.58;
|
m_currentPrice = static_cast< uint32_t >( ( m_currentPrice / 100 ) * 99.58f );
|
||||||
updateLandDb();
|
updateLandDb();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,8 @@ Sapphire::Zone::Zone() :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Zone::Zone( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName, const std::string& placeName ) :
|
Sapphire::Zone::Zone( uint16_t territoryTypeId, uint32_t guId,
|
||||||
|
const std::string& internalName, const std::string& placeName ) :
|
||||||
m_currentWeather( Weather::FairSkies ),
|
m_currentWeather( Weather::FairSkies ),
|
||||||
m_nextEObjId( 0x400D0000 )
|
m_nextEObjId( 0x400D0000 )
|
||||||
{
|
{
|
||||||
|
@ -278,7 +279,7 @@ void Sapphire::Zone::removeActor( Entity::ActorPtr pActor )
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||||
Network::Packets::FFXIVPacketBasePtr pPacketEntry )
|
Network::Packets::FFXIVPacketBasePtr pPacketEntry )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||||
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
||||||
|
@ -288,12 +289,8 @@ void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t
|
||||||
for( auto entry : m_playerMap )
|
for( auto entry : m_playerMap )
|
||||||
{
|
{
|
||||||
auto player = entry.second;
|
auto player = entry.second;
|
||||||
float distance = Math::Util::distance( sourcePlayer.getPos().x,
|
float distance = Util::distance( sourcePlayer.getPos().x, sourcePlayer.getPos().y, sourcePlayer.getPos().z,
|
||||||
sourcePlayer.getPos().y,
|
player->getPos().x, player->getPos().y, player->getPos().z );
|
||||||
sourcePlayer.getPos().z,
|
|
||||||
player->getPos().x,
|
|
||||||
player->getPos().y,
|
|
||||||
player->getPos().z );
|
|
||||||
|
|
||||||
if( ( distance < range ) && sourcePlayer.getId() != player->getId() )
|
if( ( distance < range ) && sourcePlayer.getId() != player->getId() )
|
||||||
{
|
{
|
||||||
|
@ -307,8 +304,8 @@ void Sapphire::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Zone::queuePacketForZone( Entity::Player& sourcePlayer,
|
void Sapphire::Zone::queuePacketForZone( Entity::Player& sourcePlayer,
|
||||||
Network::Packets::FFXIVPacketBasePtr pPacketEntry,
|
Network::Packets::FFXIVPacketBasePtr pPacketEntry,
|
||||||
bool forSelf )
|
bool forSelf )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||||
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
||||||
|
@ -648,8 +645,8 @@ void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
|
||||||
if( !pCurAct || pCurAct == pActor )
|
if( !pCurAct || pCurAct == pActor )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float distance = Math::Util::distance( pCurAct->getPos().x, pCurAct->getPos().y, pCurAct->getPos().z,
|
float distance = Util::distance( pCurAct->getPos().x, pCurAct->getPos().y, pCurAct->getPos().z,
|
||||||
pActor->getPos().x, pActor->getPos().y, pActor->getPos().z );
|
pActor->getPos().x, pActor->getPos().y, pActor->getPos().z );
|
||||||
|
|
||||||
bool isInRange = ( fRange == 0.0f || distance <= fRange );
|
bool isInRange = ( fRange == 0.0f || distance <= fRange );
|
||||||
bool isInRangeSet = pActor->isInRangeSet( pCurAct );
|
bool isInRangeSet = pActor->isInRangeSet( pCurAct );
|
||||||
|
@ -750,8 +747,8 @@ uint32_t Sapphire::Zone::getNextEObjId()
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Entity::EventObjectPtr Sapphire::Zone::registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
|
Sapphire::Entity::EventObjectPtr Sapphire::Zone::registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
|
||||||
uint8_t state, FFXIVARR_POSITION3 pos, float scale,
|
uint8_t state, FFXIVARR_POSITION3 pos, float scale,
|
||||||
float rotation )
|
float rotation )
|
||||||
{
|
{
|
||||||
auto eObj = Entity::make_EventObject( getNextEObjId(), objectId, mapLink, state, pos, rotation, name );
|
auto eObj = Entity::make_EventObject( getNextEObjId(), objectId, mapLink, state, pos, rotation, name );
|
||||||
eObj->setScale( scale );
|
eObj->setScale( scale );
|
||||||
|
|
|
@ -19,136 +19,136 @@
|
||||||
namespace Sapphire
|
namespace Sapphire
|
||||||
{
|
{
|
||||||
|
|
||||||
class Session;
|
class Session;
|
||||||
|
|
||||||
class ZonePosition;
|
class ZonePosition;
|
||||||
|
|
||||||
using SessionSet = std::set< SessionPtr >;
|
using SessionSet = std::set< SessionPtr >;
|
||||||
using FestivalPair = std::pair< uint16_t, uint16_t >;
|
using FestivalPair = std::pair< uint16_t, uint16_t >;
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
struct InstanceContent;
|
struct InstanceContent;
|
||||||
struct TerritoryType;
|
struct TerritoryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Zone : public CellHandler< Cell >, public std::enable_shared_from_this< Zone >
|
class Zone : public CellHandler< Cell >, public std::enable_shared_from_this< Zone >
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
uint32_t m_territoryTypeId;
|
uint32_t m_territoryTypeId;
|
||||||
uint32_t m_guId;
|
uint32_t m_guId;
|
||||||
|
|
||||||
std::string m_placeName;
|
std::string m_placeName;
|
||||||
std::string m_internalName;
|
std::string m_internalName;
|
||||||
|
|
||||||
std::unordered_map< int32_t, Entity::PlayerPtr > m_playerMap;
|
std::unordered_map< int32_t, Entity::PlayerPtr > m_playerMap;
|
||||||
std::unordered_map< int32_t, Entity::BNpcPtr > m_bNpcMap;
|
std::unordered_map< int32_t, Entity::BNpcPtr > m_bNpcMap;
|
||||||
std::unordered_map< int32_t, Entity::EventObjectPtr > m_eventObjects;
|
std::unordered_map< int32_t, Entity::EventObjectPtr > m_eventObjects;
|
||||||
|
|
||||||
SessionSet m_sessionSet;
|
SessionSet m_sessionSet;
|
||||||
|
|
||||||
Common::Weather m_currentWeather;
|
Common::Weather m_currentWeather;
|
||||||
Common::Weather m_weatherOverride;
|
Common::Weather m_weatherOverride;
|
||||||
|
|
||||||
uint64_t m_lastMobUpdate;
|
uint64_t m_lastMobUpdate;
|
||||||
|
|
||||||
FestivalPair m_currentFestival;
|
FestivalPair m_currentFestival;
|
||||||
|
|
||||||
std::shared_ptr< Data::TerritoryType > m_territoryTypeInfo;
|
std::shared_ptr< Data::TerritoryType > m_territoryTypeInfo;
|
||||||
|
|
||||||
std::map< uint8_t, int32_t > m_weatherRateMap;
|
std::map< uint8_t, int32_t > m_weatherRateMap;
|
||||||
|
|
||||||
uint32_t m_nextEObjId;
|
uint32_t m_nextEObjId;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Zone();
|
Zone();
|
||||||
|
|
||||||
Zone( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName, const std::string& placeName );
|
Zone( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName, const std::string& placeName );
|
||||||
|
|
||||||
virtual ~Zone();
|
virtual ~Zone();
|
||||||
|
|
||||||
/*! overrides the zone's weather, set to 0 to unlock */
|
/*! overrides the zone's weather, set to 0 to unlock */
|
||||||
void setWeatherOverride( Common::Weather weather );
|
void setWeatherOverride( Common::Weather weather );
|
||||||
|
|
||||||
Common::Weather getCurrentWeather() const;
|
Common::Weather getCurrentWeather() const;
|
||||||
|
|
||||||
const FestivalPair& getCurrentFestival() const;
|
const FestivalPair& getCurrentFestival() const;
|
||||||
|
|
||||||
void setCurrentFestival( uint16_t festivalId, uint16_t additionalFestivalId = 0 );
|
void setCurrentFestival( uint16_t festivalId, uint16_t additionalFestivalId = 0 );
|
||||||
|
|
||||||
virtual bool init();
|
virtual bool init();
|
||||||
|
|
||||||
virtual void loadCellCache();
|
virtual void loadCellCache();
|
||||||
|
|
||||||
virtual uint32_t getTerritoryTypeId() const;
|
virtual uint32_t getTerritoryTypeId() const;
|
||||||
|
|
||||||
virtual void onBeforePlayerZoneIn( Entity::Player& player ) {};
|
virtual void onBeforePlayerZoneIn( Entity::Player& player ) {};
|
||||||
|
|
||||||
virtual void onPlayerZoneIn( Entity::Player& player );
|
virtual void onPlayerZoneIn( Entity::Player& player );
|
||||||
|
|
||||||
virtual void onFinishLoading( Entity::Player& player );
|
virtual void onFinishLoading( Entity::Player& player );
|
||||||
|
|
||||||
virtual void onInitDirector( Entity::Player& player );
|
virtual void onInitDirector( Entity::Player& player );
|
||||||
|
|
||||||
virtual void onDirectorSync( Entity::Player& player ) {};
|
virtual void onDirectorSync( Entity::Player& player ) {};
|
||||||
|
|
||||||
virtual void onLeaveTerritory( Entity::Player& player );
|
virtual void onLeaveTerritory( Entity::Player& player );
|
||||||
|
|
||||||
virtual void onUpdate( uint32_t currTime );
|
virtual void onUpdate( uint32_t currTime );
|
||||||
|
|
||||||
virtual void onRegisterEObj( Entity::EventObjectPtr object ) {};
|
virtual void onRegisterEObj( Entity::EventObjectPtr object ) {};
|
||||||
|
|
||||||
virtual void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
virtual void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 );
|
||||||
|
|
||||||
Common::Weather getNextWeather();
|
Common::Weather getNextWeather();
|
||||||
|
|
||||||
void pushActor( Entity::ActorPtr pActor );
|
void pushActor( Entity::ActorPtr pActor );
|
||||||
|
|
||||||
void removeActor( Entity::ActorPtr pActor );
|
void removeActor( Entity::ActorPtr pActor );
|
||||||
|
|
||||||
void updateActorPosition( Entity::Actor& pActor );
|
void updateActorPosition( Entity::Actor& pActor );
|
||||||
|
|
||||||
bool isCellActive( uint32_t x, uint32_t y );
|
bool isCellActive( uint32_t x, uint32_t y );
|
||||||
|
|
||||||
void updateCellActivity( uint32_t x, uint32_t y, int32_t radius );
|
void updateCellActivity( uint32_t x, uint32_t y, int32_t radius );
|
||||||
|
|
||||||
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
||||||
|
|
||||||
void queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
void queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||||
Network::Packets::FFXIVPacketBasePtr pPacketEntry );
|
Network::Packets::FFXIVPacketBasePtr pPacketEntry );
|
||||||
|
|
||||||
void queuePacketForZone( Entity::Player& sourcePlayer, Network::Packets::FFXIVPacketBasePtr pPacketEntry,
|
void queuePacketForZone( Entity::Player& sourcePlayer, Network::Packets::FFXIVPacketBasePtr pPacketEntry,
|
||||||
bool forSelf = false );
|
bool forSelf = false );
|
||||||
|
|
||||||
uint32_t getGuId() const;
|
uint32_t getGuId() const;
|
||||||
|
|
||||||
uint32_t getNextEObjId();
|
uint32_t getNextEObjId();
|
||||||
|
|
||||||
const std::string& getName() const;
|
const std::string& getName() const;
|
||||||
|
|
||||||
const std::string& getInternalName() const;
|
const std::string& getInternalName() const;
|
||||||
|
|
||||||
std::size_t getPopCount() const;
|
std::size_t getPopCount() const;
|
||||||
|
|
||||||
void loadWeatherRates();
|
void loadWeatherRates();
|
||||||
|
|
||||||
bool checkWeather();
|
bool checkWeather();
|
||||||
//void updateBnpcs( int64_t tickCount );
|
//void updateBnpcs( int64_t tickCount );
|
||||||
|
|
||||||
bool update( uint32_t currTime );
|
bool update( uint32_t currTime );
|
||||||
|
|
||||||
void updateSessions( bool changedWeather );
|
void updateSessions( bool changedWeather );
|
||||||
|
|
||||||
Entity::EventObjectPtr registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
|
Entity::EventObjectPtr registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
|
||||||
uint8_t state, Common::FFXIVARR_POSITION3 pos, float scale, float rotation );
|
uint8_t state, Common::FFXIVARR_POSITION3 pos, float scale, float rotation );
|
||||||
|
|
||||||
void registerEObj( Entity::EventObjectPtr object );
|
void registerEObj( Entity::EventObjectPtr object );
|
||||||
|
|
||||||
Entity::EventObjectPtr getEObj( uint32_t objId );
|
Entity::EventObjectPtr getEObj( uint32_t objId );
|
||||||
|
|
||||||
InstanceContentPtr getAsInstanceContent();
|
InstanceContentPtr getAsInstanceContent();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "Script/ScriptMgr.h"
|
#include "Script/ScriptMgr.h"
|
||||||
#include <Database/ZoneDbConnection.h>
|
#include <Database/ZoneDbConnection.h>
|
||||||
#include <Database/DbWorkerPool.h>
|
#include <Database/DbWorkerPool.h>
|
||||||
#include "Linkshell/LinkshellMgr.h"
|
#include "Manager/LinkshellMgr.h"
|
||||||
#include "Manager/TerritoryMgr.h"
|
#include "Manager/TerritoryMgr.h"
|
||||||
#include "Manager/HousingMgr.h"
|
#include "Manager/HousingMgr.h"
|
||||||
#include "DebugCommand/DebugCommandHandler.h"
|
#include "DebugCommand/DebugCommandHandler.h"
|
||||||
|
@ -28,13 +28,13 @@ bool setupFramework()
|
||||||
auto pExdData = std::make_shared< Data::ExdDataGenerated >();
|
auto pExdData = std::make_shared< Data::ExdDataGenerated >();
|
||||||
auto pScript = std::make_shared< Scripting::ScriptMgr >();
|
auto pScript = std::make_shared< Scripting::ScriptMgr >();
|
||||||
auto pDb = std::make_shared< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = std::make_shared< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pLsMgr = std::make_shared< LinkshellMgr >();
|
|
||||||
auto pHousingMgr = std::make_shared< Manager::HousingMgr >();
|
|
||||||
auto pTeriMgr = std::make_shared< Manager::TerritoryMgr >();
|
|
||||||
auto pDebugCom = std::make_shared< DebugCommandHandler >();
|
auto pDebugCom = std::make_shared< DebugCommandHandler >();
|
||||||
auto pConfig = std::make_shared< ConfigMgr >();
|
auto pConfig = std::make_shared< ConfigMgr >();
|
||||||
auto pPlayerMgr = std::make_shared< Manager::PlayerMgr >();
|
auto pPlayerMgr = std::make_shared< Manager::PlayerMgr >();
|
||||||
auto pShopMgr = std::make_shared< Manager::ShopMgr >();
|
auto pShopMgr = std::make_shared< Manager::ShopMgr >();
|
||||||
|
auto pLsMgr = std::make_shared< Manager::LinkshellMgr >();
|
||||||
|
auto pTeriMgr = std::make_shared< Manager::TerritoryMgr >();
|
||||||
|
auto pHousingMgr = std::make_shared< Manager::HousingMgr >();
|
||||||
|
|
||||||
pLogger->setLogPath( "log/SapphireZone" );
|
pLogger->setLogPath( "log/SapphireZone" );
|
||||||
pLogger->init();
|
pLogger->init();
|
||||||
|
@ -44,7 +44,7 @@ bool setupFramework()
|
||||||
g_fw.set< Data::ExdDataGenerated >( pExdData );
|
g_fw.set< Data::ExdDataGenerated >( pExdData );
|
||||||
g_fw.set< Scripting::ScriptMgr >( pScript );
|
g_fw.set< Scripting::ScriptMgr >( pScript );
|
||||||
g_fw.set< Db::DbWorkerPool< Db::ZoneDbConnection > >( pDb );
|
g_fw.set< Db::DbWorkerPool< Db::ZoneDbConnection > >( pDb );
|
||||||
g_fw.set< LinkshellMgr >( pLsMgr );
|
g_fw.set< Manager::LinkshellMgr >( pLsMgr );
|
||||||
g_fw.set< Manager::HousingMgr >( pHousingMgr );
|
g_fw.set< Manager::HousingMgr >( pHousingMgr );
|
||||||
g_fw.set< Manager::TerritoryMgr >( pTeriMgr );
|
g_fw.set< Manager::TerritoryMgr >( pTeriMgr );
|
||||||
g_fw.set< DebugCommandHandler >( pDebugCom );
|
g_fw.set< DebugCommandHandler >( pDebugCom );
|
||||||
|
|
Loading…
Add table
Reference in a new issue