mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-06-08 08:57:45 +00:00
sendToInRangeSet removed
This commit is contained in:
parent
8a419398b2
commit
f91494fa7b
10 changed files with 65 additions and 110 deletions
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <Logging/Logger.h>
|
||||
#include <Manager/TerritoryMgr.h>
|
||||
#include <Manager/MgrUtil.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include <Manager/TaskMgr.h>
|
||||
|
@ -20,6 +21,7 @@
|
|||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World::Action;
|
||||
using namespace Sapphire::World::Manager;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::WorldPackets::Server;
|
||||
|
||||
|
@ -118,7 +120,7 @@ void EffectBuilder::buildAndSendPackets( const std::vector< Entity::CharaPtr >&
|
|||
do // we want to send at least one packet even nothing is hit so other players can see
|
||||
{
|
||||
auto packet = buildNextEffectPacket( targetList );
|
||||
m_sourceChara->sendToInRangeSet( packet, true );
|
||||
server().queueForPlayers( m_sourceChara->getInRangePlayerIds( true ), packet );
|
||||
}
|
||||
while( !m_actorEffectsMap.empty() );
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#include <Manager/PlayerMgr.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <Manager/MgrUtil.h>
|
||||
|
||||
#include <Network/PacketWrappers/ActorControlPacket.h>
|
||||
#include <Network/PacketWrappers/ActorControlSelfPacket.h>
|
||||
#include <Network/CommonActorControl.h>
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
|||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World;
|
||||
using namespace Sapphire::World::Manager;
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
@ -58,12 +59,13 @@ void Action::EventAction::start()
|
|||
{
|
||||
auto pPlayer = m_pSource->getAsPlayer();
|
||||
|
||||
m_pSource->sendToInRangeSet( control, true );
|
||||
server().queueForPlayers( m_pSource->getInRangePlayerIds( true ), control );
|
||||
|
||||
if( pPlayer->hasStateFlag( PlayerStateFlag::InNpcEvent ) )
|
||||
Service< World::Manager::PlayerMgr >::ref().onUnsetStateFlag( *pPlayer, PlayerStateFlag::InNpcEvent );
|
||||
}
|
||||
else
|
||||
m_pSource->sendToInRangeSet( control );
|
||||
server().queueForPlayers( m_pSource->getInRangePlayerIds(), control );
|
||||
}
|
||||
|
||||
void Action::EventAction::execute()
|
||||
|
@ -91,10 +93,10 @@ void Action::EventAction::execute()
|
|||
if( m_pSource->isPlayer() )
|
||||
{
|
||||
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied2 );
|
||||
m_pSource->sendToInRangeSet( control, true );
|
||||
server().queueForPlayers( m_pSource->getInRangePlayerIds( true ), control );
|
||||
}
|
||||
else
|
||||
m_pSource->sendToInRangeSet( control );
|
||||
server().queueForPlayers( m_pSource->getInRangePlayerIds(), control );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
|
@ -119,17 +121,13 @@ void Action::EventAction::interrupt()
|
|||
|
||||
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::NoCombat );
|
||||
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
|
||||
m_pSource->sendToInRangeSet( control );
|
||||
m_pSource->sendToInRangeSet( control1 );
|
||||
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
server.queueForPlayer( m_pSource->getAsPlayer()->getCharacterId(), { control1, control } );
|
||||
server().queueForPlayers( m_pSource->getInRangePlayerIds( true ), control );
|
||||
server().queueForPlayers( m_pSource->getInRangePlayerIds( true ), control1 );
|
||||
|
||||
eventMgr.eventFinish( *m_pSource->getAsPlayer(), m_eventId, 1 );
|
||||
|
||||
}
|
||||
else
|
||||
m_pSource->sendToInRangeSet( control );
|
||||
server().queueForPlayers( m_pSource->getInRangePlayerIds(), control );
|
||||
|
||||
if( m_onActionInterruptClb )
|
||||
m_onActionInterruptClb( *m_pSource->getAsPlayer(), m_eventId, m_additional );
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
#include "Chara.h"
|
||||
#include "Player.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Manager/MgrUtil.h"
|
||||
#include "Common.h"
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::World::Manager;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::WorldPackets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
@ -285,10 +287,10 @@ void Sapphire::Entity::Chara::die()
|
|||
bool selfNeedsUpdate = isPlayer();
|
||||
|
||||
FFXIVPacketBasePtr packet = makeActorControl( m_id, SetStatus, static_cast< uint8_t >( ActorStatus::Dead ) );
|
||||
sendToInRangeSet( packet, selfNeedsUpdate );
|
||||
server().queueForPlayers( getInRangePlayerIds( selfNeedsUpdate ), packet );
|
||||
|
||||
FFXIVPacketBasePtr packet1 = makeActorControl( m_id, DeathAnimation, 0, 0, 0, 0 );
|
||||
sendToInRangeSet( packet1, selfNeedsUpdate );
|
||||
server().queueForPlayers( getInRangePlayerIds( selfNeedsUpdate ), packet1 );
|
||||
|
||||
}
|
||||
|
||||
|
@ -320,7 +322,7 @@ void Sapphire::Entity::Chara::setStance( Stance stance )
|
|||
m_currentStance = stance;
|
||||
|
||||
FFXIVPacketBasePtr packet = makeActorControl( m_id, ToggleWeapon, stance, 1 );
|
||||
sendToInRangeSet( packet );
|
||||
server().queueForPlayers( getInRangePlayerIds(), packet );
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -365,7 +367,7 @@ void Sapphire::Entity::Chara::changeTarget( uint64_t targetId )
|
|||
{
|
||||
setTargetId( targetId );
|
||||
FFXIVPacketBasePtr packet = makeActorControlTarget( m_id, SetTarget, 0, 0, 0, 0, targetId );
|
||||
sendToInRangeSet( packet );
|
||||
server().queueForPlayers( getInRangePlayerIds(), packet );
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -450,7 +452,7 @@ so players can have their own version and we can abolish the param.
|
|||
void Sapphire::Entity::Chara::sendStatusUpdate()
|
||||
{
|
||||
FFXIVPacketBasePtr packet = std::make_shared< UpdateHpMpTpPacket >( *this );
|
||||
sendToInRangeSet( packet );
|
||||
server().queueForPlayers( getInRangePlayerIds(), packet );
|
||||
}
|
||||
|
||||
/*! \return ActionPtr of the currently registered action, or nullptr */
|
||||
|
@ -497,7 +499,7 @@ void Sapphire::Entity::Chara::autoAttack( CharaPtr pTarget )
|
|||
effectEntry.Arg2 = 0x71;
|
||||
effectPacket->addTargetEffect( effectEntry );
|
||||
|
||||
sendToInRangeSet( effectPacket );
|
||||
server().queueForPlayers( getInRangePlayerIds(), effectPacket );
|
||||
|
||||
pTarget->takeDamage( damage );
|
||||
}
|
||||
|
@ -545,7 +547,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
|||
status.Slot = static_cast< uint8_t >( nextSlot );
|
||||
status.SystemParam = static_cast< int16_t >( pEffect->getParam() );
|
||||
|
||||
sendToInRangeSet( statusEffectAdd, isPlayer() );
|
||||
server().queueForPlayers( getInRangePlayerIds( isPlayer() ), statusEffectAdd );
|
||||
}
|
||||
|
||||
/*! \param StatusEffectPtr to be applied to the actor */
|
||||
|
@ -610,7 +612,7 @@ void Sapphire::Entity::Chara::removeStatusEffect( uint8_t effectSlotId )
|
|||
auto pEffect = pEffectIt->second;
|
||||
pEffect->removeStatus();
|
||||
|
||||
sendToInRangeSet( makeActorControl( getId(), StatusEffectLose, pEffect->getId() ), isPlayer() );
|
||||
server().queueForPlayers( getInRangePlayerIds( isPlayer() ), makeActorControl( getId(), StatusEffectLose, pEffect->getId() ) );
|
||||
|
||||
m_statusEffectMap.erase( effectSlotId );
|
||||
|
||||
|
@ -659,8 +661,7 @@ void Sapphire::Entity::Chara::sendStatusEffectUpdate()
|
|||
slot++;
|
||||
}
|
||||
|
||||
sendToInRangeSet( statusEffectList, isPlayer() );
|
||||
|
||||
server().queueForPlayers( getInRangePlayerIds( isPlayer() ), statusEffectList );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Chara::updateStatusEffects()
|
||||
|
@ -818,14 +819,16 @@ void Sapphire::Entity::Chara::onTick()
|
|||
if( thisTickDmg != 0 )
|
||||
{
|
||||
takeDamage( thisTickDmg );
|
||||
sendToInRangeSet( makeActorControl( getId(), HPFloatingText, 0,
|
||||
static_cast< uint8_t >( ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP), thisTickDmg ), true );
|
||||
server().queueForPlayers( getInRangePlayerIds( isPlayer() ), makeActorControl( getId(), HPFloatingText, 0,
|
||||
static_cast< uint8_t >( ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP ),
|
||||
thisTickDmg ) );
|
||||
}
|
||||
|
||||
if( thisTickHeal != 0 )
|
||||
{
|
||||
heal( thisTickHeal );
|
||||
sendToInRangeSet( makeActorControl( getId(), HPFloatingText, 0,
|
||||
static_cast< uint8_t >( ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP ), thisTickHeal ), true );
|
||||
server().queueForPlayers( getInRangePlayerIds( isPlayer() ), makeActorControl( getId(), HPFloatingText, 0,
|
||||
static_cast< uint8_t >( ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP ),
|
||||
thisTickHeal ) );
|
||||
}
|
||||
}
|
|
@ -17,9 +17,11 @@
|
|||
#include "WorldServer.h"
|
||||
#include "Session.h"
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Manager/MgrUtil.h"
|
||||
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::World::Manager;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::WorldPackets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
@ -91,13 +93,8 @@ void Sapphire::Entity::EventObject::setState( uint8_t state )
|
|||
|
||||
void Sapphire::Entity::EventObject::setAnimationFlag( uint32_t flag, uint32_t animationFlag )
|
||||
{
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
|
||||
for( const auto& player : m_inRangePlayers )
|
||||
{
|
||||
auto pSession = server.getSession( player->getCharacterId() );
|
||||
pSession->getZoneConnection()->queueOutPacket( makeActorControl( getId(), EObjAnimation, flag, animationFlag ) );
|
||||
}
|
||||
server().queueForPlayer( player->getCharacterId(), makeActorControl( getId(), EObjAnimation, flag, animationFlag ) );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::EventObject::setHousingLink( uint32_t housingLink )
|
||||
|
|
|
@ -296,35 +296,6 @@ void Sapphire::Entity::GameObject::clearInRangeSet()
|
|||
m_inRangeBNpc.clear();
|
||||
}
|
||||
|
||||
/*!
|
||||
Send a packet to all players in range, potentially to self if set and is player
|
||||
|
||||
\param GamePacketPtr to send
|
||||
\param bool should be send to self?
|
||||
*/
|
||||
void Sapphire::Entity::GameObject::sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf )
|
||||
{
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
|
||||
if( bToSelf && isPlayer() )
|
||||
{
|
||||
server.queueForPlayer( getAsPlayer()->getCharacterId(), pPacket );
|
||||
}
|
||||
|
||||
if( m_inRangePlayers.empty() )
|
||||
return;
|
||||
|
||||
pPacket->setSourceActor( m_id );
|
||||
|
||||
for( const auto& pCurAct : m_inRangePlayers )
|
||||
{
|
||||
assert( pCurAct );
|
||||
// it might be that the player DC'd in which case the session would be invalid
|
||||
// TODO: copy packet to a new unique_ptr then move ownership
|
||||
server.queueForPlayer( pCurAct->getCharacterId(), pPacket );
|
||||
}
|
||||
}
|
||||
|
||||
/*! \return list of actors currently in range */
|
||||
std::set< Sapphire::Entity::GameObjectPtr > Sapphire::Entity::GameObject::getInRangeActors( bool includeSelf )
|
||||
{
|
||||
|
|
|
@ -93,8 +93,6 @@ namespace Sapphire::Entity
|
|||
|
||||
CharaPtr getClosestChara();
|
||||
|
||||
void sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf = false );
|
||||
|
||||
// add an actor to in range set
|
||||
void addInRangeActor( GameObjectPtr pActor );
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "Manager/WarpMgr.h"
|
||||
#include "Manager/LinkshellMgr.h"
|
||||
#include "Manager/RNGMgr.h"
|
||||
#include "Manager/MgrUtil.h"
|
||||
|
||||
#include "Event/EventDefs.h"
|
||||
#include "ContentFinder/ContentFinder.h"
|
||||
|
@ -384,8 +385,6 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr<
|
|||
|
||||
void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
auto pSession = server.getSession( player.getCharacterId() );
|
||||
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||
|
||||
|
@ -466,7 +465,7 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr<
|
|||
actorControl->data().param2 = param2;
|
||||
actorControl->data().param3 = param3;
|
||||
actorControl->data().param4 = param4;
|
||||
player.sendToInRangeSet( actorControl, true );
|
||||
server().queueForPlayers( player.getInRangePlayerIds( true ), actorControl );
|
||||
|
||||
|
||||
/*sscanf(params.c_str(), "%x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId);
|
||||
|
@ -507,8 +506,7 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr<
|
|||
actorControl->data().param4 = param4;
|
||||
actorControl->data().param5 = param5;
|
||||
actorControl->data().param6 = param6;
|
||||
pSession->getZoneConnection()->queueOutPacket( actorControl );
|
||||
|
||||
server().queueForPlayer( player.getCharacterId(), actorControl );
|
||||
|
||||
/*sscanf(params.c_str(), "%x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId);
|
||||
|
||||
|
@ -550,7 +548,7 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr<
|
|||
// effectPacket->setAnimationId( param1 );
|
||||
// effectPacket->setEffectFlags( 0 );
|
||||
|
||||
pSession->getZoneConnection()->queueOutPacket( effectPacket );
|
||||
server().queueForPlayer( player.getCharacterId(), effectPacket );
|
||||
}
|
||||
else if( subCommand == "achvGeneral" )
|
||||
{
|
||||
|
@ -681,9 +679,6 @@ void DebugCommandMgr::replay( char* data, Entity::Player& player, std::shared_pt
|
|||
|
||||
void DebugCommandMgr::nudge( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
||||
{
|
||||
auto& server = Sapphire::Common::Service< Sapphire::World::WorldServer >::ref();
|
||||
auto pSession = server.getSession( player.getCharacterId() );
|
||||
|
||||
std::string subCommand;
|
||||
|
||||
// check if the command has parameters
|
||||
|
@ -724,7 +719,7 @@ void DebugCommandMgr::nudge( char* data, Entity::Player& player, std::shared_ptr
|
|||
setActorPosPacket->data().y = player.getPos().y;
|
||||
setActorPosPacket->data().z = player.getPos().z;
|
||||
setActorPosPacket->data().Dir = Common::Util::floatToUInt16Rot( player.getRot() );
|
||||
pSession->getZoneConnection()->queueOutPacket( setActorPosPacket );
|
||||
server().queueForPlayer( player.getCharacterId(), setActorPosPacket );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ void MapMgr::sendPackets( Entity::Player& player, EventSet& mapData, UpdateMode
|
|||
if( mapData.size() <= 2 )
|
||||
{
|
||||
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapMarker2 >( player.getId() );
|
||||
mapUpdatePacket->data().numOfMarkers = mapData.size();
|
||||
mapUpdatePacket->data().numOfMarkers = static_cast< uint8_t >( mapData.size() );
|
||||
|
||||
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().layoutIds, mapUpdatePacket->data().handlerIds );
|
||||
|
||||
|
@ -615,7 +615,7 @@ void MapMgr::sendPackets( Entity::Player& player, EventSet& mapData, UpdateMode
|
|||
else if( mapData.size() <= 4 )
|
||||
{
|
||||
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapMarker4 >( player.getId() );
|
||||
mapUpdatePacket->data().numOfMarkers = mapData.size();
|
||||
mapUpdatePacket->data().numOfMarkers = static_cast< uint8_t >( mapData.size() );
|
||||
|
||||
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().layoutIds, mapUpdatePacket->data().handlerIds );
|
||||
|
||||
|
@ -624,7 +624,7 @@ void MapMgr::sendPackets( Entity::Player& player, EventSet& mapData, UpdateMode
|
|||
else if( mapData.size() <= 8 )
|
||||
{
|
||||
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapMarker8 >( player.getId() );
|
||||
mapUpdatePacket->data().numOfMarkers = mapData.size();
|
||||
mapUpdatePacket->data().numOfMarkers = static_cast< uint8_t >( mapData.size() );
|
||||
|
||||
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().layoutIds, mapUpdatePacket->data().handlerIds );
|
||||
|
||||
|
@ -633,7 +633,7 @@ void MapMgr::sendPackets( Entity::Player& player, EventSet& mapData, UpdateMode
|
|||
else if( mapData.size() <= 16 )
|
||||
{
|
||||
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapMarker16 >( player.getId() );
|
||||
mapUpdatePacket->data().numOfMarkers = mapData.size();
|
||||
mapUpdatePacket->data().numOfMarkers = static_cast< uint8_t >( mapData.size() );
|
||||
|
||||
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().layoutIds, mapUpdatePacket->data().handlerIds );
|
||||
|
||||
|
@ -642,7 +642,7 @@ void MapMgr::sendPackets( Entity::Player& player, EventSet& mapData, UpdateMode
|
|||
else if( mapData.size() <= 32 )
|
||||
{
|
||||
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapMarker32 >( player.getId() );
|
||||
mapUpdatePacket->data().numOfMarkers = mapData.size();
|
||||
mapUpdatePacket->data().numOfMarkers = static_cast< uint8_t >( mapData.size() );
|
||||
|
||||
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().layoutIds, mapUpdatePacket->data().handlerIds );
|
||||
|
||||
|
@ -651,7 +651,7 @@ void MapMgr::sendPackets( Entity::Player& player, EventSet& mapData, UpdateMode
|
|||
else if( mapData.size() <= 64 )
|
||||
{
|
||||
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapMarker64 >( player.getId() );
|
||||
mapUpdatePacket->data().numOfMarkers = mapData.size();
|
||||
mapUpdatePacket->data().numOfMarkers = static_cast< uint8_t >( mapData.size() );
|
||||
|
||||
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().layoutIds, mapUpdatePacket->data().handlerIds );
|
||||
|
||||
|
@ -660,7 +660,7 @@ void MapMgr::sendPackets( Entity::Player& player, EventSet& mapData, UpdateMode
|
|||
else if( mapData.size() <= 128 )
|
||||
{
|
||||
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapMarker128 >( player.getId() );
|
||||
mapUpdatePacket->data().numOfMarkers = mapData.size();
|
||||
mapUpdatePacket->data().numOfMarkers = static_cast< uint8_t >( mapData.size() );
|
||||
|
||||
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().layoutIds, mapUpdatePacket->data().handlerIds );
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "WorldServer.h"
|
||||
#include "Session.h"
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Manager/MgrUtil.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
using namespace Sapphire::World::Manager;
|
||||
|
@ -61,16 +62,12 @@ bool MarketMgr::init()
|
|||
|
||||
void MarketMgr::requestItemListingInfo( Entity::Player& player, uint32_t catalogId, uint32_t requestId )
|
||||
{
|
||||
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
auto pSession = server.getSession( player.getCharacterId() );
|
||||
|
||||
auto countPkt = makeZonePacket< FFFXIVIpcItemSearchResult >( player.getId() );
|
||||
countPkt->data().Count = 1 << 8;
|
||||
countPkt->data().CatalogID = catalogId;
|
||||
countPkt->data().Result = requestId;
|
||||
|
||||
pSession->getZoneConnection()->queueOutPacket( countPkt );
|
||||
server().queueForPlayer( player.getCharacterId(), countPkt );
|
||||
|
||||
auto historyPkt = makeZonePacket< FFXIVIpcGetItemHistoryResult >( player.getId() );
|
||||
historyPkt->data().CatalogID = catalogId;
|
||||
|
@ -90,16 +87,13 @@ void MarketMgr::requestItemListingInfo( Entity::Player& player, uint32_t catalog
|
|||
strcpy( listing.BuyCharacterName, name.c_str() );
|
||||
}
|
||||
|
||||
pSession->getZoneConnection()->queueOutPacket( historyPkt );
|
||||
server().queueForPlayer( player.getCharacterId(), historyPkt );
|
||||
}
|
||||
|
||||
|
||||
void MarketMgr::searchMarketboard( Entity::Player& player, uint8_t itemSearchCategory, uint8_t maxEquipLevel, uint8_t classJob,
|
||||
const std::string_view& searchStr, uint32_t requestId, uint32_t startIdx )
|
||||
{
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
auto pSession = server.getSession( player.getCharacterId() );
|
||||
|
||||
ItemSearchResultList resultList;
|
||||
findItems( searchStr, itemSearchCategory, maxEquipLevel, classJob, resultList );
|
||||
|
||||
|
@ -130,7 +124,7 @@ void MarketMgr::searchMarketboard( Entity::Player& player, uint8_t itemSearchCat
|
|||
else
|
||||
resultPkt->data().NextIndex = startIdx + 20;
|
||||
|
||||
pSession->getZoneConnection()->queueOutPacket( resultPkt );
|
||||
server().queueForPlayer( player.getCharacterId(), resultPkt );
|
||||
}
|
||||
|
||||
void MarketMgr::requestItemListings( Sapphire::Entity::Player& player, uint16_t catalogId )
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
#include "Action/Action.h"
|
||||
|
||||
|
||||
#include "Session.h"
|
||||
#include "WorldServer.h"
|
||||
#include "Forwards.h"
|
||||
#include <Service.h>
|
||||
#include <Manager/TerritoryMgr.h>
|
||||
#include <Manager/PlayerMgr.h>
|
||||
#include <Manager/RNGMgr.h>
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
@ -404,7 +404,6 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
{
|
||||
|
||||
const auto packet = ZoneChannelPacket< FFXIVIpcClientTrigger >( inPacket );
|
||||
auto& server = Service< World::WorldServer >::ref();
|
||||
auto& teriMgr = Service< World::Manager::TerritoryMgr >::ref();
|
||||
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||
|
||||
|
@ -433,9 +432,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
player.setStance( Stance::Passive );
|
||||
player.setAutoattack( false );
|
||||
}
|
||||
|
||||
player.sendToInRangeSet( makeActorControl( player.getId(), 0, param11, 1 ) );
|
||||
|
||||
server().queueForPlayers( player.getInRangePlayerIds(), makeActorControl( player.getId(), 0, param11, 1 ) );
|
||||
break;
|
||||
}
|
||||
case PacketCommand::AUTO_ATTACK: // Toggle auto-attack
|
||||
|
@ -448,7 +445,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
else
|
||||
player.setAutoattack( false );
|
||||
|
||||
player.sendToInRangeSet( makeActorControl( player.getId(), 1, param11, 1 ) );
|
||||
server().queueForPlayers( player.getInRangePlayerIds(), makeActorControl( player.getId(), 1, param11, 1 ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -517,7 +514,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
}
|
||||
case PacketCommand::SET_CUTSCENE:
|
||||
{
|
||||
server.queueForPlayer( player.getCharacterId(), makeActorControl( player.getId(), ActorControlType::SetCutsceneFlag, param11, 1 ) );
|
||||
server().queueForPlayer( player.getCharacterId(), makeActorControl( player.getId(), ActorControlType::SetCutsceneFlag, param11, 1 ) );
|
||||
break;
|
||||
}
|
||||
case PacketCommand::EMOTE: // emote
|
||||
|
@ -532,7 +529,8 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
if( !emoteData )
|
||||
return;
|
||||
|
||||
player.sendToInRangeSet( makeActorControlTarget( player.getId(), ActorControlType::Emote, emoteId, 0, isSilent ? 1 : 0, 0, targetId ) );
|
||||
server().queueForPlayers( player.getInRangePlayerIds(),
|
||||
makeActorControlTarget( player.getId(), ActorControlType::Emote, emoteId, 0, isSilent ? 1 : 0, 0, targetId ) );
|
||||
|
||||
bool isPersistent = emoteData->data().Mode != 0;
|
||||
|
||||
|
@ -543,9 +541,9 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
player.setPersistentEmote( emoteData->data().Mode );
|
||||
player.setStatus( ActorStatus::EmoteMode );
|
||||
|
||||
player.sendToInRangeSet( makeActorControl( player.getId(), ActorControlType::SetStatus,
|
||||
static_cast< uint8_t >( ActorStatus::EmoteMode ),
|
||||
emoteData->data().IsEndEmoteMode ? 1 : 0 ), true );
|
||||
server().queueForPlayers( player.getInRangePlayerIds( true ), makeActorControl( player.getId(), ActorControlType::SetStatus,
|
||||
static_cast< uint8_t >( ActorStatus::EmoteMode ),
|
||||
emoteData->data().IsEndEmoteMode ? 1 : 0 ) );
|
||||
}
|
||||
|
||||
if( emoteData->data().IsAvailableWhenDrawn )
|
||||
|
@ -557,7 +555,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
}
|
||||
case PacketCommand::EMOTE_CANCEL: // emote
|
||||
{
|
||||
player.sendToInRangeSet( makeActorControl( player.getId(), ActorControlType::EmoteInterrupt ) );
|
||||
server().queueForPlayers( player.getInRangePlayerIds(), makeActorControl( player.getId(), ActorControlType::EmoteInterrupt ) );
|
||||
break;
|
||||
}
|
||||
case PacketCommand::EMOTE_MODE_CANCEL:
|
||||
|
@ -565,13 +563,12 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
if( player.getPersistentEmote() > 0 )
|
||||
{
|
||||
auto movePacket = std::make_shared< MoveActorPacket >( player, player.getRot(), 2, 0, 0, 0x5A / 4 );
|
||||
player.sendToInRangeSet( movePacket );
|
||||
|
||||
player.setPersistentEmote( 0 );
|
||||
player.sendToInRangeSet( makeActorControl( player.getId(), ActorControlType::EmoteModeInterrupt ) );
|
||||
player.setStatus( ActorStatus::Idle );
|
||||
|
||||
player.sendToInRangeSet( makeActorControl( player.getId(), SetStatus, static_cast< uint8_t >( ActorStatus::Idle ) ) );
|
||||
server().queueForPlayers( player.getInRangePlayerIds(), movePacket );
|
||||
server().queueForPlayers( player.getInRangePlayerIds(), makeActorControl( player.getId(), ActorControlType::EmoteModeInterrupt ) );
|
||||
server().queueForPlayers( player.getInRangePlayerIds(), makeActorControl( player.getId(), SetStatus, static_cast< uint8_t >( ActorStatus::Idle ) ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -580,7 +577,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
{
|
||||
player.setPose( static_cast< uint8_t >( param12 ) );
|
||||
auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 );
|
||||
player.sendToInRangeSet( pSetStatusPacket, true );
|
||||
server().queueForPlayers( player.getInRangePlayerIds( true ), pSetStatusPacket );
|
||||
break;
|
||||
}
|
||||
case PacketCommand::POSE_EMOTE_CANCEL: // cancel pose
|
||||
|
@ -684,7 +681,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
player.setActiveLand( static_cast< uint8_t >( param11 ), hZone->getWardNum() );
|
||||
|
||||
auto pShowBuildPresetUIPacket = makeActorControl( player.getId(), ShowBuildPresetUI, param11 );
|
||||
server.queueForPlayer( player.getCharacterId(), pShowBuildPresetUIPacket );
|
||||
server().queueForPlayer( player.getCharacterId(), pShowBuildPresetUIPacket );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -765,7 +762,7 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
|||
uint8_t plot = ( param12 & 0xFF );
|
||||
auto pShowHousingItemUIPacket = makeActorControl( player.getId(), ShowHousingItemUI, 0, plot );
|
||||
|
||||
server.queueForPlayer( player.getCharacterId(), pShowHousingItemUIPacket );
|
||||
server().queueForPlayer( player.getCharacterId(), pShowHousingItemUIPacket );
|
||||
|
||||
//TODO: show item housing container
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue