diff --git a/deps/datReaderPs3/Exd/Structs.h b/deps/datReaderPs3/Exd/Structs.h index 03a46f7a..8602ce38 100644 --- a/deps/datReaderPs3/Exd/Structs.h +++ b/deps/datReaderPs3/Exd/Structs.h @@ -653,8 +653,8 @@ namespace Component::Excel::Ps3 struct Aetheryte { AetheryteTextStruct Text; + uint32_t EventHandler; uint32_t PopRange[4]; - int32_t EventHandler; uint16_t TelepoName; uint16_t TransferName; uint16_t TerritoryType; diff --git a/src/common/Common.h b/src/common/Common.h index 5a6efcdc..64f66173 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -506,7 +506,13 @@ namespace Sapphire::Common Return = 1, Teleport = 4, GearSets = 6, + MateriaMelding = 11, + AdvancedMateriaMelding = 12, + MateriaAssimilating = 13, + Dye = 14, + Glamour = 15, HuntingLog = 21, + Desynth = 95 }; enum ContainerType : uint16_t diff --git a/src/common/Network/CommonActorControl.h b/src/common/Network/CommonActorControl.h index 638d6415..dd40b518 100644 --- a/src/common/Network/CommonActorControl.h +++ b/src/common/Network/CommonActorControl.h @@ -64,7 +64,7 @@ namespace Sapphire::Network::ActorControl SpawnEffect = 0x25, ToggleInvisible = 0x26, - ToggleActionUnlock = 0x29, + SetSystemActionUnlocked = 0x29, UpdateUiExp = 0x2B, SetFallDamage = 0x2D, diff --git a/src/common/Network/PacketDef/ServerIpcs.h b/src/common/Network/PacketDef/ServerIpcs.h index cffd73c1..29424c3e 100644 --- a/src/common/Network/PacketDef/ServerIpcs.h +++ b/src/common/Network/PacketDef/ServerIpcs.h @@ -45,6 +45,8 @@ namespace Sapphire::Network::Packets RegionInfo = 0x0069, MoveTerritory = 0x006A, + MoveInstance = 0x006B, + SetPSNId = 0x0073, SetBillingTime = 0x0075, @@ -387,7 +389,6 @@ namespace Sapphire::Network::Packets NpcSpawn = 0x00B3, // updated 5.21 hotfix InventoryActionAck = 0x01B2, // updated 5.21 hotfix UpdateInventorySlot = 0x0213, // updated 5.21 hotfix - PrepareZoning = 0x00B6, // updated 5.21 hotfix }; } diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index 0047e6c4..1430bdd5 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1664,6 +1664,17 @@ namespace Sapphire::Network::Packets::WorldPackets::Server char worldName[32]; }; + struct FFXIVIpcMoveInstance : FFXIVIpcBasePacket< MoveInstance > + { + uint64_t characterId; + uint32_t entityId; + uint16_t worldId; + uint16_t worldId1; + uint64_t unknown1; + uint64_t unknown2; + //TODO... TO BE MAPPED + }; + /** * */ @@ -1690,23 +1701,6 @@ namespace Sapphire::Network::Packets::WorldPackets::Server struct DailyQuest dailyQuestArray[6]; }; - /** - * Structural representation of the packet sent by the server - * prepare zoning, showing screenmessage - */ - struct FFXIVIpcPrepareZoning : FFXIVIpcBasePacket< PrepareZoning > - { - uint32_t logMessage; - uint16_t targetZone; - uint16_t animation; - uint8_t param4; - uint8_t hideChar; - uint8_t fadeOut; - uint8_t param7; - uint8_t fadeOutTime; - uint8_t unknown; // this changes whether or not the destination zone's name displays during the loading screen. Seems to always be 9 (=hidden) when going to an instance and certain zones, 0 otherwise. - uint16_t padding; - }; /** * Structural representation of the packet sent by the server diff --git a/src/common/Util/UtilMath.cpp b/src/common/Util/UtilMath.cpp index b2255bac..6a162d64 100644 --- a/src/common/Util/UtilMath.cpp +++ b/src/common/Util/UtilMath.cpp @@ -139,7 +139,7 @@ float Util::trunc( float value, uint8_t digitsToRemain ) if( digitsToRemain == 0 ) return std::floor( value ); - float factor = std::pow( 10, digitsToRemain ); + auto factor = static_cast< float >( std::pow( 10.f, digitsToRemain ) ); return std::floor( value * factor ) / factor; } diff --git a/src/scripts/common/aethernet/Aetheryte.cpp b/src/scripts/common/aethernet/Aetheryte.cpp index 43739430..e6828929 100644 --- a/src/scripts/common/aethernet/Aetheryte.cpp +++ b/src/scripts/common/aethernet/Aetheryte.cpp @@ -101,7 +101,7 @@ public: else { eventMgr().sendEventNotice( player, eventId, 0, 1, 1, 0 ); - player.learnAction( Common::UnlockEntry::Teleport ); + player.setSystemActionUnlocked( Common::UnlockEntry::Teleport ); } }, []( Entity::Player& player, uint32_t eventId, uint64_t additional ) diff --git a/src/scripts/quest/ManFst002.cpp b/src/scripts/quest/ManFst002.cpp index 08eff52f..96efe03b 100644 --- a/src/scripts/quest/ManFst002.cpp +++ b/src/scripts/quest/ManFst002.cpp @@ -201,7 +201,7 @@ public: { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); + player.setSystemActionUnlocked( Common::UnlockEntry::Return ); Scene00051( quest, player ); }; diff --git a/src/scripts/quest/ManFst003.cpp b/src/scripts/quest/ManFst003.cpp index c38ec9ed..68d3ad16 100644 --- a/src/scripts/quest/ManFst003.cpp +++ b/src/scripts/quest/ManFst003.cpp @@ -79,7 +79,7 @@ public: { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); + player.setSystemActionUnlocked( Common::UnlockEntry::Return ); Scene00051( quest, player ); }, nullptr, quest.getId() ); diff --git a/src/scripts/quest/ManFst004.cpp b/src/scripts/quest/ManFst004.cpp index bab3cedd..0f1086c6 100644 --- a/src/scripts/quest/ManFst004.cpp +++ b/src/scripts/quest/ManFst004.cpp @@ -82,7 +82,7 @@ public: { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); + player.setSystemActionUnlocked( Common::UnlockEntry::Return ); Scene00051( quest, player ); }, nullptr, quest.getId() ); diff --git a/src/scripts/quest/ManSea001.cpp b/src/scripts/quest/ManSea001.cpp index 710c845e..749960a1 100644 --- a/src/scripts/quest/ManSea001.cpp +++ b/src/scripts/quest/ManSea001.cpp @@ -91,7 +91,7 @@ private: if( !pQuest ) return; pQuest->setSeq( SEQ_FINISH ); - player.prepareZoning( player.getTerritoryTypeId(), true, 1, 0 ); + //player.prepareZoning( player.getTerritoryTypeId(), true, 1, 0 ); player.changePosition( 9, 40, 14, 2 ); } } ); diff --git a/src/scripts/quest/ManSea002.cpp b/src/scripts/quest/ManSea002.cpp index a960b0b7..207f1570 100644 --- a/src/scripts/quest/ManSea002.cpp +++ b/src/scripts/quest/ManSea002.cpp @@ -58,7 +58,7 @@ public: { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); + player.setSystemActionUnlocked( Common::UnlockEntry::Return ); Scene00002( player ); }, nullptr, getId() ); diff --git a/src/scripts/quest/ManSea003.cpp b/src/scripts/quest/ManSea003.cpp index ef598e34..a8fd5d8c 100644 --- a/src/scripts/quest/ManSea003.cpp +++ b/src/scripts/quest/ManSea003.cpp @@ -72,7 +72,7 @@ public: { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); + player.setSystemActionUnlocked( Common::UnlockEntry::Return ); Scene00002( player ); }, nullptr, getId() ); diff --git a/src/scripts/quest/ManWil002.cpp b/src/scripts/quest/ManWil002.cpp index 0b2b4728..53fc973e 100644 --- a/src/scripts/quest/ManWil002.cpp +++ b/src/scripts/quest/ManWil002.cpp @@ -90,7 +90,7 @@ public: { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); + player.setSystemActionUnlocked( Common::UnlockEntry::Return ); Scene00001( quest, player ); }, nullptr, getId() ); diff --git a/src/scripts/quest/ManWil003.cpp b/src/scripts/quest/ManWil003.cpp index 8bc1ecbb..c9ac7123 100644 --- a/src/scripts/quest/ManWil003.cpp +++ b/src/scripts/quest/ManWil003.cpp @@ -90,7 +90,7 @@ public: { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); + player.setSystemActionUnlocked( Common::UnlockEntry::Return ); Scene00001( player ); }, nullptr, getId() ); diff --git a/src/scripts/quest/ManWil004.cpp b/src/scripts/quest/ManWil004.cpp index 45cb045d..78b8d22c 100644 --- a/src/scripts/quest/ManWil004.cpp +++ b/src/scripts/quest/ManWil004.cpp @@ -90,7 +90,7 @@ public: { eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 ); player.registerAetheryte( 2 ); - player.learnAction( Common::UnlockEntry::Return ); + player.setSystemActionUnlocked( Common::UnlockEntry::Return ); Scene00001( player ); }, nullptr, getId() ); diff --git a/src/scripts/quest/classquest/ARC/ClsArc000.cpp b/src/scripts/quest/classquest/ARC/ClsArc000.cpp index 2f2e8892..9a75c32c 100644 --- a/src/scripts/quest/classquest/ARC/ClsArc000.cpp +++ b/src/scripts/quest/classquest/ARC/ClsArc000.cpp @@ -205,7 +205,7 @@ private: if( result.getResult( 0 ) == 1 ) { - player.learnAction( Sapphire::Common::UnlockEntry::HuntingLog ); + player.setSystemActionUnlocked( Sapphire::Common::UnlockEntry::HuntingLog ); player.finishQuest( getId(), result.getResult( 1 ) ); } } diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index df0bab07..c127e727 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -240,7 +240,7 @@ bool Action::Action::update() player->setLastActionTick( tickCount ); uint32_t delayMs = 100 - lastTickMs; - castTime = ( m_castTimeMs + delayMs ); //subtract 500ms before the client begin to request actions while casting + castTime = ( m_castTimeMs + delayMs ); m_castTimeRestMs = static_cast< uint64_t >( m_castTimeMs ) - std::difftime( static_cast< time_t >( tickCount ), static_cast< time_t >( m_startTime ) ); } @@ -253,7 +253,7 @@ bool Action::Action::update() if( m_pTarget == nullptr && m_targetId != 0 ) { // try to search for the target actor - for( auto actor : m_pSource->getInRangeActors( true ) ) + for( const auto& actor : m_pSource->getInRangeActors( true ) ) { if( actor->getId() == m_targetId ) { @@ -263,15 +263,12 @@ bool Action::Action::update() } } - if( m_pTarget != nullptr ) + if( m_pTarget != nullptr && !m_pTarget->isAlive() ) { - if( !m_pTarget->isAlive() ) - { - // interrupt the cast if target died - setInterrupted( Common::ActionInterruptType::RegularInterrupt ); - interrupt(); - return true; - } + // interrupt the cast if target died + setInterrupted( Common::ActionInterruptType::RegularInterrupt ); + interrupt(); + return true; } return false; diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index e53d7fb8..726dbc7e 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -317,16 +317,6 @@ void Sapphire::Entity::Player::removeOnlineStatus( const std::vector< Common::On Service< World::Manager::PlayerMgr >::ref().onOnlineStatusChanged( *this, false ); } -void Sapphire::Entity::Player::prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime, uint16_t animation ) -{ - auto preparePacket = makeZonePacket< FFXIVIpcPrepareZoning >( getId() ); - preparePacket->data().targetZone = targetZone; - preparePacket->data().fadeOutTime = fadeOutTime; - preparePacket->data().animation = animation; - preparePacket->data().fadeOut = static_cast< uint8_t >( fadeOut ? 1 : 0 ); - queuePacket( preparePacket ); -} - void Sapphire::Entity::Player::calculateStats() { uint8_t tribe = getLookAt( Common::CharaLook::Tribe ); @@ -456,19 +446,22 @@ void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type ) // TODO: this should be simplified and a type created in server_common/common.h. if( type == 1 ) // teleport { - prepareZoning( data.TerritoryType, true, 1, 0 ); // TODO: Really? + //prepareZoning( data.TerritoryType, true, 1, 0 ); // TODO: Really? + sendToInRangeSet( makeActorControl( getId(), WarpStart, Common::WarpType::WARP_TYPE_TELEPO ), true ); sendToInRangeSet( makeActorControl( getId(), ActorDespawnEffect, 0x04 ) ); setZoningType( Common::ZoneingType::Teleport ); } else if( type == 2 ) // aethernet { - prepareZoning( data.TerritoryType, true, 1, 112 ); + //prepareZoning( data.TerritoryType, true, 1, 112 ); + sendToInRangeSet( makeActorControl( getId(), WarpStart, Common::WarpType::WARP_TYPE_TELEPO ), true ); sendToInRangeSet( makeActorControl( getId(), ActorDespawnEffect, 0x04 ) ); setZoningType( Common::ZoneingType::Teleport ); } else if( type == 3 ) // return { - prepareZoning( data.TerritoryType, true, 1, 111 ); + //prepareZoning( data.TerritoryType, true, 1, 111 ); + sendToInRangeSet( makeActorControl( getId(), WarpStart, Common::WarpType::WARP_TYPE_HOME_POINT ), true ); sendToInRangeSet( makeActorControl( getId(), ActorDespawnEffect, 0x03 ) ); setZoningType( Common::ZoneingType::Return ); } @@ -479,7 +472,6 @@ void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type ) void Sapphire::Entity::Player::forceZoneing( uint32_t zoneId ) { m_queuedZoneing = std::make_shared< QueuedZoning >( zoneId, getPos(), Util::getTimeMs(), 0.f ); - //performZoning( zoneId, Common::ZoneingType::None, getPos() ); } void Sapphire::Entity::Player::returnToHomepoint() @@ -507,18 +499,6 @@ void Sapphire::Entity::Player::setZone( uint32_t zoneId ) } } -bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId ) -{ - m_onEnterEventDone = false; - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); - - auto instance = teriMgr.getTerritoryByGuId( instanceContentId ); - if( !instance ) - return false; - - return setInstance( instance ); -} - bool Sapphire::Entity::Player::setInstance( const TerritoryPtr& instance ) { m_onEnterEventDone = false; @@ -752,7 +732,7 @@ void Sapphire::Entity::Player::changePosition( float x, float y, float z, float m_queuedZoneing = std::make_shared< QueuedZoning >( getTerritoryTypeId(), pos, Util::getTimeMs(), o ); } -void Sapphire::Entity::Player::learnAction( Common::UnlockEntry unlockId ) +void Sapphire::Entity::Player::setSystemActionUnlocked( Common::UnlockEntry unlockId ) { uint16_t index; uint8_t value; @@ -761,7 +741,7 @@ void Sapphire::Entity::Player::learnAction( Common::UnlockEntry unlockId ) m_unlocks[ index ] |= value; - queuePacket( makeActorControlSelf( getId(), ToggleActionUnlock, unlock, 1 ) ); + queuePacket( makeActorControlSelf( getId(), SetSystemActionUnlocked, unlock, 1 ) ); } void Sapphire::Entity::Player::learnSong( uint8_t songId, uint32_t itemId ) @@ -1700,11 +1680,9 @@ void Sapphire::Entity::Player::sendTitleList() queuePacket( titleListPacket ); } -void -Sapphire::Entity::Player::sendZoneInPackets( uint32_t param1, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, - bool shouldSetStatus = false ) +void Sapphire::Entity::Player::sendZoneInPackets( uint32_t param1, bool shouldSetStatus = false ) { - auto zoneInPacket = makeActorControlSelf( getId(), Appear, param1, param2, param3, param4 ); + auto zoneInPacket = makeActorControlSelf( getId(), Appear, param1, 0, 0, 0 ); auto SetStatusPacket = makeActorControl( getId(), SetStatus, static_cast< uint8_t >( Common::ActorStatus::Idle ) ); if( !getGmInvis() ) @@ -1728,7 +1706,7 @@ void Sapphire::Entity::Player::finishZoning() break; case ZoneingType::Teleport: - sendZoneInPackets( 0x01, 0, 0, 110 ); + sendZoneInPackets( 0x01 ); break; case ZoneingType::Return: @@ -1739,10 +1717,10 @@ void Sapphire::Entity::Player::finishZoning() resetHp(); resetMp(); setStatus( Common::ActorStatus::Idle ); - sendZoneInPackets( 0x01, 0x01, 0, 111, true ); + sendZoneInPackets( 0x01, true ); } else - sendZoneInPackets( 0x01, 0x00, 0, 111 ); + sendZoneInPackets( 0x01 ); } break; diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 12dec010..0f1d2a2c 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -305,9 +305,6 @@ namespace Sapphire::Entity /*! sets the players zone, initiating a zoning process */ void setZone( uint32_t zoneId ); - /*! sets the players instance & initiates zoning process */ - bool setInstance( uint32_t instanceContentId ); - /*! sets the players instance & initiates zoning process */ bool setInstance( const TerritoryPtr& instance ); @@ -378,9 +375,6 @@ namespace Sapphire::Entity void setDyeingInfo( uint32_t itemToDyeContainer, uint32_t itemToDyeSlot, uint32_t dyeBagContainer, uint32_t dyeBagSlot ); void dyeItemFromDyeingInfo(); - /*! prepares zoning / fades out the screen */ - void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime = 0, uint16_t animation = 0 ); - /*! get player's title list (available titles) */ TitleList& getTitleList(); @@ -465,7 +459,7 @@ namespace Sapphire::Entity void updateHowtosSeen( uint32_t howToId ); /*! learn an action / update the unlock bitmask. */ - void learnAction( Common::UnlockEntry unlockId ); + void setSystemActionUnlocked( Common::UnlockEntry unlockId ); /*! learn a song / update the unlock bitmask. */ void learnSong( uint8_t songId, uint32_t itemId ); @@ -598,7 +592,7 @@ namespace Sapphire::Entity /*! return true if the player is marked for zoning */ bool isMarkedForZoning() const; - void sendZoneInPackets( uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, bool pSetStatus ); + void sendZoneInPackets( uint32_t param1, bool pSetStatus ); void finishZoning(); diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 145075fb..a2e8a8d0 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -472,6 +472,47 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player& pSession->getZoneConnection()->queueOutPacket( actorControl ); + /*sscanf(params.c_str(), "%x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId); + + Network::Packets::Server::ServerNoticePacket noticePacket( player, "Injecting ACTOR_CONTROL " + std::to_string( opcode ) ); + + player.queuePacket( noticePacket ); + + Network::Packets::Server::ActorControlSelfPacket controlPacket( player, opcode, + param1, param2, param3, param4, param5, param6, playerId ); + player.queuePacket( controlPacket );*/ + + } + else if( subCommand == "actrls" ) + { + + // temporary research packet + + uint32_t opcode; + uint32_t param1; + uint32_t param2; + uint32_t param3; + uint32_t param4; + uint32_t param5; + uint32_t param6; + uint32_t playerId; + + sscanf( params.c_str(), "%x %x %x %x %x %x %x %x", &opcode, &playerId, ¶m1, + ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 ); + + PlayerMgr::sendServerNotice( player, "Injecting ACTOR_CONTROL {0}", opcode ); + + auto actorControl = makeZonePacket< FFXIVIpcActorControlSelf >( playerId, playerId ); + actorControl->data().category = static_cast< uint16_t >( opcode ); + actorControl->data().param1 = param1; + actorControl->data().param2 = param2; + actorControl->data().param3 = param3; + actorControl->data().param4 = param4; + actorControl->data().param5 = param5; + actorControl->data().param6 = param6; + pSession->getZoneConnection()->queueOutPacket( actorControl ); + + /*sscanf(params.c_str(), "%x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId); Network::Packets::Server::ServerNoticePacket noticePacket( player, "Injecting ACTOR_CONTROL " + std::to_string( opcode ) ); @@ -488,7 +529,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player& uint32_t id; sscanf( params.c_str(), "%d", &id ); - player.learnAction( static_cast< Common::UnlockEntry >( id ) ); + player.setSystemActionUnlocked( static_cast< Common::UnlockEntry >( id ) ); } else if ( subCommand == "effect") { diff --git a/src/world/Manager/EventMgr.cpp b/src/world/Manager/EventMgr.cpp index 2afd9eb8..e3ec0ce3 100644 --- a/src/world/Manager/EventMgr.cpp +++ b/src/world/Manager/EventMgr.cpp @@ -73,7 +73,7 @@ std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId ) case Event::EventHandler::EventHandlerType::Aetheryte: { auto aetherInfo = exdData.getRow< Component::Excel::Aetheryte >( eventId & 0xFFFF ); - if( !aetherInfo->data().Telepo ) + if( aetherInfo->data().Telepo ) return "Aetheryte"; return "Aethernet"; } diff --git a/src/world/Network/Handlers/GMCommandHandlers.cpp b/src/world/Network/Handlers/GMCommandHandlers.cpp index 0da7c4f6..c4dc09ab 100644 --- a/src/world/Network/Handlers/GMCommandHandlers.cpp +++ b/src/world/Network/Handlers/GMCommandHandlers.cpp @@ -86,6 +86,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR auto& server = Common::Service< World::WorldServer >::ref(); auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); + auto& exdData = Common::Service< Data::ExdData >::ref(); const auto packet = ZoneChannelPacket< FFXIVIpcGmCommand >( inPacket ); const auto commandId = packet.data().Id; @@ -508,8 +509,6 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR bool doTeleport = false; uint16_t teleport; - - auto& exdData = Common::Service< Data::ExdData >::ref(); auto idList = exdData.getIdList< Component::Excel::Aetheryte >(); for( auto i : idList ) @@ -517,19 +516,15 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR auto data = exdData.getRow< Component::Excel::Aetheryte >( i ); if( !data ) - { continue; + + if( data->data().TerritoryType == param1 && data->data().Telepo ) + { + doTeleport = true; + teleport = static_cast< uint16_t >( i ); + break; } - if( data->data().TerritoryType == param1 ) - { - //if( data->data().Telepo ) - { - doTeleport = true; - teleport = static_cast< uint16_t >( i ); - break; - } - } } if( doTeleport ) { @@ -646,7 +641,7 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX targetPlayer->resetHp(); targetPlayer->resetMp(); targetPlayer->setStatus( Common::ActorStatus::Idle ); - targetPlayer->sendZoneInPackets( 0x01, 0x01, 0, 113, true ); + targetPlayer->sendZoneInPackets( 0x01, true ); targetPlayer->sendToInRangeSet( makeActorControlSelf( player.getId(), Appear, 0x01, 0x01, 0, 113 ), true ); @@ -658,7 +653,6 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX } case GmCommand::Jump: { - player.prepareZoning( targetPlayer->getTerritoryTypeId(), true, 1, 0 ); if( pPlayerTerri->getAsInstanceContent() ) { player.exitInstance(); @@ -671,11 +665,11 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX { // Not sure if GMs actually get bound to an instance they jump to on retail. It's mostly here to avoid a crash for now pInstanceContent->bindPlayer( player.getId() ); + player.setInstance( pInstanceContent ); } - player.setInstance( targetPlayer->getTerritoryId() ); } player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z, targetActor->getRot() ); - player.sendZoneInPackets( 0x00, 0x00, 0, 0, false ); + player.sendZoneInPackets( 0x00, false ); PlayerMgr::sendServerNotice( player, "Jumping to {0}", targetPlayer->getName() ); break; } @@ -687,17 +681,16 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX PlayerMgr::sendUrgent( player, "You are unable to call a player while bound to a battle instance." ); return; } - targetPlayer->prepareZoning( player.getTerritoryTypeId(), true, 1, 0 ); if( pTargetActorTerri->getAsInstanceContent() ) { targetPlayer->exitInstance(); } if( targetPlayer->getTerritoryId() != player.getTerritoryId() ) { - targetPlayer->setInstance( player.getTerritoryId() ); + targetPlayer->setInstance( pTargetActorTerri->getAsInstanceContent() ); } targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() ); - targetPlayer->sendZoneInPackets( 0x00, 0x00, 0, 0, false ); + targetPlayer->sendZoneInPackets( 0x00, false ); PlayerMgr::sendServerNotice( player, "Calling {0}", targetPlayer->getName() ); break; } diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 5918d588..3047a94d 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -340,7 +340,8 @@ void Sapphire::Network::GameConnection::zoneJumpHandler( const Packets::FFXIVARR pPopRange->header.transform.rotation.z, rotation ); - server.queueForPlayer( player.getCharacterId(), makeActorControlSelf( player.getId(), WarpStart, 0x03, player.getId(), 0x01, targetZone ) ); + server.queueForPlayer( player.getCharacterId(), makeActorControlSelf( player.getId(), WarpStart, + Common::WarpType::WARP_TYPE_EXIT_RANGE, player.getId(), 0x01, targetZone ) ); auto moveTerritoryPacket = makeZonePacket< FFXIVIpcMoveTerritory >( player.getId() ); moveTerritoryPacket->data().index = -1; diff --git a/src/world/WorldServer.cpp b/src/world/WorldServer.cpp index 62a0900d..fd8a3bdb 100644 --- a/src/world/WorldServer.cpp +++ b/src/world/WorldServer.cpp @@ -148,17 +148,6 @@ void Sapphire::World::WorldServer::run( int32_t argc, char* argv[] ) } Common::Service< Data::ExdData >::set( pExdData ); - - auto idList = pExdData->getIdList< Component::Excel::Aetheryte >(); - - for( auto id : idList ) - { - auto aetherInfo = pExdData->getRow< Component::Excel::Aetheryte >( id ); - - Logger::info( "id: {0} bool: {1}, padd: {2}", id, aetherInfo->data().Telepo, aetherInfo->data().padding1 ); - } - - auto pDb = std::make_shared< Db::DbWorkerPool< Db::ZoneDbConnection > >(); Sapphire::Db::DbLoader loader; loader.addDb( *pDb, m_config.global.database );