From 188d80d2ecd882285ab67bfc5128fc51a2009804 Mon Sep 17 00:00:00 2001 From: Mordred Date: Mon, 20 Feb 2023 11:24:02 +0100 Subject: [PATCH] Alot more cleanups in various areas. --- src/scripts/action/common/ActionTeleport5.cpp | 2 - .../quest/subquest/limsa/SubSea001.cpp | 3 +- src/world/Action/EffectBuilder.cpp | 11 ++--- src/world/Actor/BNpc.cpp | 4 +- src/world/Actor/Player.cpp | 44 ++++--------------- src/world/Actor/Player.h | 13 +----- src/world/Manager/ActionMgr.h | 6 +-- src/world/Manager/BlacklistMgr.cpp | 8 ++-- src/world/Manager/DebugCommandMgr.cpp | 4 +- src/world/Manager/FriendListMgr.cpp | 10 ++--- src/world/Manager/WarpMgr.cpp | 19 ++++++-- src/world/Manager/WarpMgr.h | 11 +++++ .../Network/Handlers/CommonListHandler.cpp | 2 +- .../Network/Handlers/GMCommandHandlers.cpp | 16 +++---- .../Network/PacketWrappers/EffectPacket.h | 10 +++-- .../Network/PacketWrappers/EffectPacket1.h | 7 ++- .../PacketWrappers/PlayerSpawnPacket.h | 2 +- src/world/Territory/HousingZone.cpp | 9 ++-- src/world/Territory/Territory.cpp | 1 - 19 files changed, 77 insertions(+), 105 deletions(-) diff --git a/src/scripts/action/common/ActionTeleport5.cpp b/src/scripts/action/common/ActionTeleport5.cpp index 155c680e..8f6d8d93 100644 --- a/src/scripts/action/common/ActionTeleport5.cpp +++ b/src/scripts/action/common/ActionTeleport5.cpp @@ -32,8 +32,6 @@ public: pPlayer->removeCurrency( Common::CurrencyType::Gil, teleportQuery.cost ); - pPlayer->setZoningType( Common::ZoningType::Teleport ); - warpMgr().requestPlayerTeleport( *pPlayer, teleportQuery.targetAetheryte, 1 ); pPlayer->clearTeleportQuery(); diff --git a/src/scripts/quest/subquest/limsa/SubSea001.cpp b/src/scripts/quest/subquest/limsa/SubSea001.cpp index e17dc0a9..57ce53de 100644 --- a/src/scripts/quest/subquest/limsa/SubSea001.cpp +++ b/src/scripts/quest/subquest/limsa/SubSea001.cpp @@ -217,8 +217,7 @@ private: if( result.getResult( 0 ) == 1 ) { quest.setSeq( Seq2 ); - player.changePosition( 10, 21, 13, -2 ); - warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, Territorytype0 ); + warpMgr().requestMoveTerritoryType( player, Common::WarpType::WARP_TYPE_NORMAL, Territorytype0, { 10, 21, 13 }, -2.f ); } } else diff --git a/src/world/Action/EffectBuilder.cpp b/src/world/Action/EffectBuilder.cpp index fb70309d..e6ec4027 100644 --- a/src/world/Action/EffectBuilder.cpp +++ b/src/world/Action/EffectBuilder.cpp @@ -112,11 +112,6 @@ void EffectBuilder::buildAndSendPackets( const std::vector< Entity::CharaPtr >& Logger::debug( "EffectBuilder result: " ); Logger::debug( "Targets afflicted: {}", targetList.size() ); - auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); - auto zone = teriMgr.getTerritoryByTypeId( m_sourceChara->getTerritoryTypeId() ); - - auto globalSequence = zone ? zone->getNextEffectResultId() : 0; - do // we want to send at least one packet even nothing is hit so other players can see { auto packet = buildNextEffectPacket( targetList ); @@ -136,7 +131,8 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( const s { auto effectPacket = std::make_shared< EffectPacket >( m_sourceChara->getId(), m_actionId ); effectPacket->setRotation( Common::Util::floatToUInt16Rot( m_sourceChara->getRot() ) ); - effectPacket->setSequence( resultId, m_sequence ); + effectPacket->setRequestId( m_sequence ); + effectPacket->setResultId( resultId ); effectPacket->setTargetActor( targetList[ 0 ]->getId() ); uint8_t targetIndex = 0; @@ -184,7 +180,8 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( const s auto effectPacket = std::make_shared< EffectPacket1 >( m_sourceChara->getId(), targetList[ 0 ]->getId(), m_actionId ); effectPacket->setRotation( Common::Util::floatToUInt16Rot( m_sourceChara->getRot() ) ); - effectPacket->setSequence( resultId, m_sequence ); + effectPacket->setRequestId( m_sequence ); + effectPacket->setResultId( resultId ); for( auto it = m_actorEffectsMap.begin(); it != m_actorEffectsMap.end(); ) { diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index 7f59cdca..bcac24fe 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -993,12 +993,10 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget ) Common::CalcResultParam effectEntry{}; effectEntry.Value = static_cast< int16_t >( damage.first ); effectEntry.Type = ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP; - //effectEntry.Flag = 128; effectEntry.Arg0 = 3; effectEntry.Arg1 = 7; - //effectEntry.Arg2 = 0x71; auto resultId = pZone->getNextEffectResultId(); - effectPacket->setSequence( resultId ); + effectPacket->setResultId( resultId ); effectPacket->addTargetEffect( effectEntry ); server().queueForPlayers( getInRangePlayerIds(), effectPacket ); diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 73233cda..0f7617d3 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -3,8 +3,6 @@ #include #include #include -#include -#include #include #include @@ -14,7 +12,6 @@ #include "Player.h" #include "BNpc.h" -#include "Manager/HousingMgr.h" #include "Manager/TerritoryMgr.h" #include "Manager/RNGMgr.h" #include "Manager/PlayerMgr.h" @@ -23,18 +20,15 @@ #include "Manager/FreeCompanyMgr.h" #include "Manager/MapMgr.h" #include "Manager/MgrUtil.h" +#include "Manager/ActionMgr.h" -#include "Territory/Territory.h" #include "Territory/InstanceContent.h" -#include "Territory/InstanceObjectCache.h" -#include "Territory/Land.h" #include "Network/GameConnection.h" #include "Network/PacketContainer.h" #include "Network/CommonActorControl.h" #include "Network/PacketWrappers/ActorControlPacket.h" #include "Network/PacketWrappers/ActorControlSelfPacket.h" -#include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/PlayerSpawnPacket.h" #include "Network/PacketWrappers/EffectPacket1.h" @@ -76,7 +70,6 @@ Player::Player() : m_lastActionTick( 0 ), m_bInCombat( false ), m_bLoadingComplete( false ), - m_zoningType( Common::ZoningType::None ), m_bAutoattack( false ), m_markedForRemoval( false ), m_mount( 0 ), @@ -409,18 +402,12 @@ void Player::sendStats() bool Player::exitInstance() { - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto& warpMgr = Common::Service< WarpMgr >::ref(); resetHp(); resetMp(); - m_pos = m_prevPos; - m_rot = m_prevRot; - m_territoryTypeId = m_prevTerritoryTypeId; - m_territoryId = m_prevTerritoryId; - - warpMgr.requestMoveTerritory( *this, WarpType::WARP_TYPE_CONTENT_END_RETURN, m_prevTerritoryId, m_prevPos, m_prevRot ); + warpMgr.requestMoveTerritory( *this, WarpType::WARP_TYPE_CONTENT_END_RETURN, getPrevTerritoryId(), getPrevPos(), getPrevRot() ); return true; } @@ -572,13 +559,6 @@ void Player::resetDiscovery() memset( m_discovery.data(), 0, m_discovery.size() ); } -void Player::changePosition( float x, float y, float z, float o ) -{ - auto& warpMgr = Common::Service< WarpMgr >::ref(); - Common::FFXIVARR_POSITION3 pos{ x, y, z }; - warpMgr.requestWarp( *this, Common::WARP_TYPE_NORMAL, pos, getRot() ); -} - void Player::setRewardFlag( Common::UnlockEntry unlockId ) { uint16_t index; @@ -1072,16 +1052,6 @@ void Player::setLoadingComplete( bool bComplete ) m_bLoadingComplete = bComplete; } -ZoningType Player::getZoningType() const -{ - return m_zoningType; -} - -void Player::setZoningType( Common::ZoningType zoneingType ) -{ - m_zoningType = zoneingType; -} - void Player::setSearchInfo( uint8_t selectRegion, uint8_t selectClass, const char* searchMessage ) { m_searchSelectRegion = selectRegion; @@ -1296,17 +1266,19 @@ uint32_t Player::getPersistentEmote() const void Player::autoAttack( CharaPtr pTarget ) { auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); + auto& actionMgr = Common::Service< World::Manager::ActionMgr >::ref(); + auto& exdData = Common::Service< Data::ExdData >::ref(); auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() ); auto mainWeap = getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand ); pTarget->onActionHostile( getAsChara() ); - //uint64_t tick = Util::getTimeMs(); - //srand(static_cast< uint32_t >(tick)); auto& RNGMgr = Common::Service< World::Manager::RNGMgr >::ref(); auto variation = static_cast< uint32_t >( RNGMgr.getRandGenerator< float >( 0, 3 ).next() ); + //actionMgr.handleTargetedPlayerAction( *this, 7, exdData.getRow< Excel::Action >( 7 ), pTarget->getId(), 0 ); + auto damage = Math::CalcStats::calcAutoAttackDamage( *this ); auto effectPacket = std::make_shared< EffectPacket1 >( getId(), pTarget->getId(), 7 ); @@ -1840,7 +1812,7 @@ void Player::setPartyId( uint64_t partyId ) m_partyId = partyId; } -Player::FriendListIDVec& Player::getFriendListID() +Player::FriendListIDVec& Player::getFriendListId() { return m_friendList; } @@ -1850,7 +1822,7 @@ Player::FriendListDataVec& Player::getFriendListData() return m_friendInviteList; } -Player::FriendListIDVec& Player::getBlacklistID() +Player::FriendListIDVec& Player::getBlacklistId() { return m_blacklist; } diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 8db015d5..bfeae63a 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -310,9 +310,6 @@ namespace Sapphire::Entity void updatePrevTerritory(); - /*! change position, sends update too */ - void changePosition( float x, float y, float z, float o ); - /*! return the characterId */ uint64_t getCharacterId() const; @@ -598,10 +595,6 @@ namespace Sapphire::Entity /*! set the loading complete bool */ void setLoadingComplete( bool bComplete ); - Common::ZoningType getZoningType() const; - - void setZoningType( Common::ZoningType zoneingType ); - void setSearchInfo( uint8_t selectRegion, uint8_t selectClass, const char* searchMessage ); const char* getSearchMessage() const; @@ -812,10 +805,10 @@ namespace Sapphire::Entity uint64_t getPartyId() const; void setPartyId( uint64_t partyId ); - FriendListIDVec& getFriendListID(); + FriendListIDVec& getFriendListId(); FriendListDataVec& getFriendListData(); - BlacklistIDVec& getBlacklistID(); + BlacklistIDVec& getBlacklistId(); uint64_t m_lastMoveTime{}; uint8_t m_lastMoveflag{}; @@ -940,8 +933,6 @@ namespace Sapphire::Entity bool m_bIsConnected; - Common::ZoningType m_zoningType; - bool m_bNewAdventurer{}; uint64_t m_onlineStatus; uint64_t m_onlineStatusCustom; diff --git a/src/world/Manager/ActionMgr.h b/src/world/Manager/ActionMgr.h index 5a6de33d..3f336b36 100644 --- a/src/world/Manager/ActionMgr.h +++ b/src/world/Manager/ActionMgr.h @@ -22,16 +22,14 @@ namespace Sapphire::World::Manager bool cacheActionLut(); - void handleItemManipulationAction( Entity::Player& player, uint32_t actionId, - Excel::ExcelStructPtr< Excel::Action > actionData, uint16_t sequence ); + void handleItemManipulationAction( Entity::Player& player, uint32_t actionId, Excel::ExcelStructPtr< Excel::Action > actionData, uint16_t sequence ); void handleTargetedPlayerAction( Entity::Player& player, uint32_t actionId, std::shared_ptr< Excel::ExcelStruct< Excel::Action > > actionData, uint64_t targetId, uint16_t sequence ); void handlePlacedPlayerAction( Entity::Player& player, uint32_t actionId, std::shared_ptr< Excel::ExcelStruct< Excel::Action > > actionData, Common::FFXIVARR_POSITION3 pos, uint16_t sequence ); - void handleItemAction( Entity::Player& player, uint32_t itemId, - std::shared_ptr< Excel::ExcelStruct< Excel::ItemAction > > itemActionData, + void handleItemAction( Entity::Player& player, uint32_t itemId, std::shared_ptr< Excel::ExcelStruct< Excel::ItemAction > > itemActionData, uint16_t itemSourceSlot, uint16_t itemSourceContainer ); void handleEventItemAction( Entity::Player& player, uint32_t itemId, diff --git a/src/world/Manager/BlacklistMgr.cpp b/src/world/Manager/BlacklistMgr.cpp index 5356d3bb..b53d5b51 100644 --- a/src/world/Manager/BlacklistMgr.cpp +++ b/src/world/Manager/BlacklistMgr.cpp @@ -59,7 +59,7 @@ bool BlacklistMgr::onAddCharacter( Entity::Player& source, const std::string& ta } // add target ID to blacklist - auto& sourceBL = source.getBlacklistID(); + auto& sourceBL = source.getBlacklistId(); sourceBL[sourceIdx] = target.getCharacterId(); source.updateDbBlacklist(); @@ -100,7 +100,7 @@ bool BlacklistMgr::onRemoveCharacter( Entity::Player& source, const std::string& } // set target slot to 0 - auto& sourceBL = source.getBlacklistID(); + auto& sourceBL = source.getBlacklistId(); sourceBL[sourceIdx] = 0; source.updateDbBlacklist(); @@ -124,7 +124,7 @@ bool BlacklistMgr::onGetBlacklistPage( Entity::Player& source, uint8_t key, uint // get array offset/last page sent from client packet auto offset = nextIdx; - auto& idVec = source.getBlacklistID(); + auto& idVec = source.getBlacklistId(); for( size_t i = offset; i < offset + itemsPerPage; ++i ) { @@ -172,7 +172,7 @@ bool BlacklistMgr::isBlacklisted( Entity::Player& source, const Entity::Player& ptrdiff_t BlacklistMgr::getEntryIndex( Entity::Player& source, uint64_t characterId ) const { - auto& sourceBL = source.getBlacklistID(); + auto& sourceBL = source.getBlacklistId(); auto sourceBlIt = std::find( std::begin( sourceBL ), std::end( sourceBL ), characterId ); // not found diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index b7ba56f0..e181b659 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -541,9 +541,7 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr< entry.Arg0 = static_cast< uint8_t >( Common::ActionHitSeverityType::NormalDamage ); effectPacket->addTargetEffect( entry, static_cast< uint64_t >( player.getId() ) ); - - auto sequence = pCurrentZone->getNextEffectResultId(); - effectPacket->setSequence( sequence ); + effectPacket->setResultId( pCurrentZone->getNextEffectResultId() ); server().queueForPlayer( player.getCharacterId(), effectPacket ); } diff --git a/src/world/Manager/FriendListMgr.cpp b/src/world/Manager/FriendListMgr.cpp index ddf9b989..6ef5ba9b 100644 --- a/src/world/Manager/FriendListMgr.cpp +++ b/src/world/Manager/FriendListMgr.cpp @@ -10,8 +10,8 @@ using namespace Sapphire::World::Manager; bool FriendListMgr::onInviteCreate( Entity::Player& source, Entity::Player& target ) { - auto& sourceFL = source.getFriendListID(); - auto& targetFL = target.getFriendListID(); + auto& sourceFL = source.getFriendListId(); + auto& targetFL = target.getFriendListId(); // check if player already has been invited or friends if( isFriend( source, target ) ) @@ -96,8 +96,8 @@ bool FriendListMgr::onInviteDecline( Entity::Player& source, Entity::Player& tar return false; } - auto& sourceFL = source.getFriendListID(); - auto& targetFL = target.getFriendListID(); + auto& sourceFL = source.getFriendListId(); + auto& targetFL = target.getFriendListId(); auto& sourceFLData = source.getFriendListData(); auto& targetFLData = target.getFriendListData(); @@ -149,7 +149,7 @@ bool FriendListMgr::isFriend( Entity::Player& source, Entity::Player& target ) c ptrdiff_t FriendListMgr::getEntryIndex( Entity::Player& source, uint64_t characterId ) const { - auto& sourceFL = source.getFriendListID(); + auto& sourceFL = source.getFriendListId(); auto sourceInvIt = std::find( std::begin( sourceFL ), std::end( sourceFL ), characterId ); // not found diff --git a/src/world/Manager/WarpMgr.cpp b/src/world/Manager/WarpMgr.cpp index 0c892b69..0cf71428 100644 --- a/src/world/Manager/WarpMgr.cpp +++ b/src/world/Manager/WarpMgr.cpp @@ -71,6 +71,21 @@ void WarpMgr::requestMoveTerritoryType( Entity::Player& player, Common::WarpType requestMoveTerritory( player, warpType, pTeri->getGuId() ); } +void WarpMgr::requestMoveTerritoryType( Entity::Player& player, Common::WarpType warpType, uint32_t targetTerritoryTypeId, + Common::FFXIVARR_POSITION3 targetPos, float targetRot ) +{ + auto& teriMgr = Common::Service< TerritoryMgr >::ref(); + + auto pTeri = teriMgr.getTerritoryByTypeId( targetTerritoryTypeId ); + if( !pTeri ) + { + Logger::error( "Unable to find target territory instance for type {}", targetTerritoryTypeId ); + return; + } + + requestMoveTerritory( player, warpType, pTeri->getGuId(), player.getPos(), player.getRot() ); +} + void WarpMgr::requestWarp( Entity::Player& player, Common::WarpType warpType, Common::FFXIVARR_POSITION3 targetPos, float targetRot ) { m_entityIdToWarpInfoMap[ player.getId() ] = { 0, warpType, targetPos, targetRot }; @@ -114,7 +129,6 @@ void WarpMgr::finishWarp( Entity::Player& player ) auto zoneInPacket = makeActorControlSelf( player.getId(), Appear, warpFinishAnim, raiseAnim, 0, 0 ); auto setStatusPacket = makeActorControl( player.getId(), SetStatus, static_cast< uint8_t >( Common::ActorStatus::Idle ) ); - player.setZoningType( Common::ZoningType::None ); if( !player.getGmInvis() ) server().queueForPlayers( player.getInRangePlayerIds(), zoneInPacket ); @@ -173,17 +187,14 @@ void WarpMgr::requestPlayerTeleport( Entity::Player& player, uint16_t aetheryteI if( teleportType == 1 || teleportType == 2 ) // teleport { warpType = WarpType::WARP_TYPE_TELEPO; - player.setZoningType( Common::ZoningType::Teleport ); } else if( teleportType == 3 ) // return { warpType = WarpType::WARP_TYPE_EXIT_RANGE; - player.setZoningType( Common::ZoningType::Return ); } else if( teleportType == 4 ) // return dead { warpType = WarpType::WARP_TYPE_EXIT_RANGE; - player.setZoningType( Common::ZoningType::ReturnDead ); } if( sameTerritory ) diff --git a/src/world/Manager/WarpMgr.h b/src/world/Manager/WarpMgr.h index 0805e9c8..30dd4c30 100644 --- a/src/world/Manager/WarpMgr.h +++ b/src/world/Manager/WarpMgr.h @@ -32,6 +32,17 @@ namespace Sapphire::World::Manager /// void requestMoveTerritory( Entity::Player& player, Common::WarpType warpType, uint32_t targetTerritoryId, Common::FFXIVARR_POSITION3 targetPos, float targetRot ); + /// + /// request to move a player to specified territory type and position, with given WarpType + /// + /// + /// + /// + /// + /// + void requestMoveTerritoryType( Entity::Player& player, Common::WarpType warpType, uint32_t targetTerritoryId, Common::FFXIVARR_POSITION3 targetPos, float targetRot ); + + /// /// request to move a player to specified territory guid with given WarpType, position will be the same as before diff --git a/src/world/Network/Handlers/CommonListHandler.cpp b/src/world/Network/Handlers/CommonListHandler.cpp index a1390f24..38642be4 100644 --- a/src/world/Network/Handlers/CommonListHandler.cpp +++ b/src/world/Network/Handlers/CommonListHandler.cpp @@ -195,7 +195,7 @@ void Sapphire::Network::GameConnection::getCommonlistHandler( const Packets::FFX } else if( data.ListType == 0x0b ) { // friend list - auto& friendList = player.getFriendListID(); + auto& friendList = player.getFriendListId(); auto& friendListData = player.getFriendListData(); std::vector< Common::HierarchyData > hierarchyData( friendListData.begin(), friendListData.end() ); diff --git a/src/world/Network/Handlers/GMCommandHandlers.cpp b/src/world/Network/Handlers/GMCommandHandlers.cpp index 2b496db8..e08c8c6e 100644 --- a/src/world/Network/Handlers/GMCommandHandlers.cpp +++ b/src/world/Network/Handlers/GMCommandHandlers.cpp @@ -89,6 +89,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); auto& exdData = Common::Service< Data::ExdData >::ref(); + auto& warpMgr = Common::Service< World::Manager::WarpMgr >::ref(); const auto packet = ZoneChannelPacket< FFXIVIpcGmCommand >( inPacket ); const auto commandId = packet.data().Id; @@ -201,11 +202,11 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR { auto& warpMgr = Common::Service< WarpMgr >::ref(); warpMgr.requestMoveTerritory( *targetPlayer, WarpType::WARP_TYPE_GM, - player.getTerritoryId(), { player.getPos().x, player.getPos().y, player.getPos().z }, - player.getRot() ); + player.getTerritoryId(), player.getPos(), player.getRot() ); } else - targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() ); + warpMgr.requestMoveTerritory( *targetPlayer, Common::WarpType::WARP_TYPE_NORMAL, player.getTerritoryId(), + player.getPos(), player.getRot() ); PlayerMgr::sendServerNotice( player, "Calling {0}", targetPlayer->getName() ); break; } @@ -578,13 +579,10 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR } case GmCommand::Jump: { - + // todo - what was the intention here? auto inRange = player.getInRangeActors(); - - player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z, - targetActor->getRot() ); - - PlayerMgr::sendServerNotice( player, "Jumping to {0} in range.", targetPlayer->getName()); + warpMgr.requestWarp( player, WarpType::WARP_TYPE_GM, targetActor->getPos(), targetActor->getRot() ); + PlayerMgr::sendServerNotice( player, "Jumping to {0} in range.", targetPlayer->getName() ); break; } diff --git a/src/world/Network/PacketWrappers/EffectPacket.h b/src/world/Network/PacketWrappers/EffectPacket.h index dfb8314b..4e418f3c 100644 --- a/src/world/Network/PacketWrappers/EffectPacket.h +++ b/src/world/Network/PacketWrappers/EffectPacket.h @@ -85,10 +85,14 @@ namespace Sapphire::Network::Packets::WorldPackets::Server FFXIVPacketBase::setTargetActor( targetId ); } - void setSequence( uint32_t sequence, uint16_t sourceSequence = 0 ) + void setRequestId( uint16_t requestId ) { - m_data.RequestId = static_cast< uint32_t >( sourceSequence ); - m_data.ResultId = static_cast< uint32_t>( sequence ); + m_data.RequestId = static_cast< uint32_t >( requestId ); + } + + void setResultId( uint32_t resultId ) + { + m_data.ResultId = static_cast< uint32_t >( resultId ); } private: uint8_t m_targetEffectCount{ 0 }; diff --git a/src/world/Network/PacketWrappers/EffectPacket1.h b/src/world/Network/PacketWrappers/EffectPacket1.h index 5b81ba61..5534aa4f 100644 --- a/src/world/Network/PacketWrappers/EffectPacket1.h +++ b/src/world/Network/PacketWrappers/EffectPacket1.h @@ -68,15 +68,14 @@ namespace Sapphire::Network::Packets::WorldPackets::Server FFXIVPacketBase::setTargetActor( targetId ); } - void setSequence( uint32_t sequence, uint16_t sourceSequence = 0 ) + void setRequestId( uint16_t requestId ) { - m_data.RequestId = static_cast< uint32_t >( sourceSequence ); - m_data.ResultId = static_cast< uint32_t>( sequence ); + m_data.RequestId = static_cast< uint32_t >( requestId ); } void setResultId( uint32_t resultId ) { - m_data.ResultId = static_cast< uint32_t>( resultId ); + m_data.ResultId = static_cast< uint32_t >( resultId ); } private: diff --git a/src/world/Network/PacketWrappers/PlayerSpawnPacket.h b/src/world/Network/PacketWrappers/PlayerSpawnPacket.h index ef29a7f0..6192a274 100644 --- a/src/world/Network/PacketWrappers/PlayerSpawnPacket.h +++ b/src/world/Network/PacketWrappers/PlayerSpawnPacket.h @@ -110,7 +110,7 @@ namespace Sapphire::Network::Packets::WorldPackets::Server m_data.ActiveType = player.getStance(); m_data.Flag = 0; - if( player.getZoningType() != Common::ZoningType::None || player.getGmInvis() ) + if( player.getGmInvis() ) { m_data.Flag |= static_cast< uint16_t >( Common::DisplayFlags::Invisible ); } diff --git a/src/world/Territory/HousingZone.cpp b/src/world/Territory/HousingZone.cpp index cbd48154..b5fe523c 100644 --- a/src/world/Territory/HousingZone.cpp +++ b/src/world/Territory/HousingZone.cpp @@ -156,8 +156,7 @@ bool Sapphire::HousingZone::isPlayerSubInstance( Entity::Player& player ) void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player ) { auto& server = Common::Service< World::WorldServer >::ref(); - Logger::debug( "HousingZone::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}", - getGuId(), getTerritoryTypeId(), player.getId() ); + Logger::debug( "HousingZone::onPlayerZoneIn: Territory#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() ); auto isInSubdivision = isPlayerSubInstance( player ); @@ -185,8 +184,8 @@ void Sapphire::HousingZone::sendLandSet( Entity::Player& player ) auto landsetInitializePacket = makeZonePacket< FFXIVIpcHouseList >( player.getId() ); landsetInitializePacket->data().LandSetId.wardNum = m_wardNum; - landsetInitializePacket->data().LandSetId.landId = m_landSetId; - landsetInitializePacket->data().LandSetId.territoryTypeId = m_territoryTypeId; + landsetInitializePacket->data().LandSetId.landId = static_cast< uint16_t >( m_landSetId ); + landsetInitializePacket->data().LandSetId.territoryTypeId = static_cast< uint16_t >( m_territoryTypeId ); landsetInitializePacket->data().LandSetId.worldId = server.getWorldId(); auto isInSubdivision = isPlayerSubInstance( player ); @@ -337,7 +336,7 @@ void Sapphire::HousingZone::removeEstateEntranceEObj( uint16_t landId ) auto land = getLand( landId ); assert( land ); - for( auto entry : m_eventObjects ) + for( const auto& entry : m_eventObjects ) { auto eObj = entry.second; if( eObj->getHousingLink() == static_cast< uint32_t >( landId ) << 8 ) diff --git a/src/world/Territory/Territory.cpp b/src/world/Territory/Territory.cpp index a579e975..82f86010 100644 --- a/src/world/Territory/Territory.cpp +++ b/src/world/Territory/Territory.cpp @@ -882,7 +882,6 @@ void Territory::addEffectResult( World::Action::EffectResultPtr result ) } void Territory::processEffectResults( uint64_t tickCount ) - { // todo: move this to generic territory/instance delay wrapper cause it might be useful scheduling other things for( auto it = m_effectResults.begin(); it != m_effectResults.end(); )