mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 22:37:45 +00:00
make cf choose a random instance, fix territorymgr spawning event instances
This commit is contained in:
parent
7cc60a1463
commit
39df53f7d0
3 changed files with 44 additions and 24 deletions
|
@ -6,7 +6,7 @@
|
|||
#include <Exd/ExdDataGenerated.h>
|
||||
|
||||
#include "Zone/TerritoryMgr.h"
|
||||
#include "Zone/Zone.h"
|
||||
#include "Zone/InstanceContent.h"
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
|
@ -54,19 +54,25 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& i
|
|||
{
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
// TODO use for loop for this
|
||||
auto contentId1 = inPacket.getValAt< uint16_t >( 0x2E );
|
||||
auto contentId2 = inPacket.getValAt< uint16_t >( 0x30 );
|
||||
auto contentId3 = inPacket.getValAt< uint16_t >( 0x32 );
|
||||
auto contentId4 = inPacket.getValAt< uint16_t >( 0x34 );
|
||||
auto contentId5 = inPacket.getValAt< uint16_t >( 0x36 );
|
||||
|
||||
player.sendDebug( "Duty register request");
|
||||
player.sendDebug( "ContentId1: " + std::to_string( contentId1 ) );
|
||||
player.sendDebug( "ContentId2: " + std::to_string( contentId2 ) );
|
||||
player.sendDebug( "ContentId3: " + std::to_string( contentId3 ) );
|
||||
player.sendDebug( "ContentId4: " + std::to_string( contentId4 ) );
|
||||
player.sendDebug( "ContentId5: " + std::to_string( contentId5 ) );
|
||||
std::vector< uint16_t > selectedContent;
|
||||
|
||||
for( uint32_t offset = 0x2E; offset <= 0x36; offset += 0x2 )
|
||||
{
|
||||
auto id = inPacket.getValAt< uint16_t >( offset );
|
||||
if( id == 0 )
|
||||
break;
|
||||
|
||||
player.sendDebug( "got contentId: " + std::to_string( id ) );
|
||||
|
||||
selectedContent.push_back( id );
|
||||
}
|
||||
|
||||
// todo: rand bias problem, will do for now tho
|
||||
auto index = std::rand() % selectedContent.size();
|
||||
auto contentId = selectedContent.at( index );
|
||||
|
||||
player.sendDebug( "Duty register request for contentid: " + std::to_string( contentId ) );
|
||||
|
||||
// let's cancel it because otherwise you can't register it again
|
||||
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( player.getId() );
|
||||
|
@ -74,7 +80,7 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& i
|
|||
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
|
||||
queueOutPacket( cfCancelPacket );
|
||||
|
||||
auto cfCondition = pExdData->get< Core::Data::ContentFinderCondition >( contentId1 );
|
||||
auto cfCondition = pExdData->get< Core::Data::ContentFinderCondition >( contentId );
|
||||
if( !cfCondition )
|
||||
return;
|
||||
|
||||
|
@ -82,6 +88,9 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& i
|
|||
if( !instance )
|
||||
return;
|
||||
|
||||
auto pInstance = instance->getAsInstanceContent();
|
||||
pInstance->bindPlayer( player.getId() );
|
||||
|
||||
player.sendDebug( "Created instance with id: " + std::to_string( instance->getGuId() ) );
|
||||
|
||||
player.setInstance( instance );
|
||||
|
@ -90,6 +99,11 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& i
|
|||
void Core::Network::GameConnection::cfRegisterRoulette( const Packets::GamePacket& inPacket,
|
||||
Entity::Player& player)
|
||||
{
|
||||
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( player.getId() );
|
||||
cfCancelPacket.data().state1 = 3;
|
||||
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
|
||||
queueOutPacket( cfCancelPacket );
|
||||
|
||||
player.sendDebug( "Roulette register" );
|
||||
}
|
||||
|
||||
|
|
|
@ -70,15 +70,18 @@ bool Core::TerritoryMgr::isInstanceContentTerritory( uint32_t territoryTypeId )
|
|||
if( !pTeri )
|
||||
return false;
|
||||
|
||||
return pTeri->territoryIntendedUse == TerritoryIntendedUse::AllianceRaid ||
|
||||
pTeri->territoryIntendedUse == TerritoryIntendedUse::BeforeTrialDung ||
|
||||
pTeri->territoryIntendedUse == TerritoryIntendedUse::Trial ||
|
||||
pTeri->territoryIntendedUse == TerritoryIntendedUse::Dungeon ||
|
||||
pTeri->territoryIntendedUse == TerritoryIntendedUse::OpenWorldInstanceBattle ||
|
||||
pTeri->territoryIntendedUse == TerritoryIntendedUse::PalaceOfTheDead ||
|
||||
pTeri->territoryIntendedUse == TerritoryIntendedUse::RaidFights ||
|
||||
pTeri->territoryIntendedUse == TerritoryIntendedUse::Raids ||
|
||||
pTeri->territoryIntendedUse == TerritoryIntendedUse::TreasureMapInstance;
|
||||
auto intendedUse = pTeri->territoryIntendedUse;
|
||||
|
||||
return intendedUse == TerritoryIntendedUse::AllianceRaid ||
|
||||
intendedUse == TerritoryIntendedUse::BeforeTrialDung ||
|
||||
intendedUse == TerritoryIntendedUse::Trial ||
|
||||
intendedUse == TerritoryIntendedUse::Dungeon ||
|
||||
intendedUse == TerritoryIntendedUse::OpenWorldInstanceBattle ||
|
||||
intendedUse == TerritoryIntendedUse::PalaceOfTheDead ||
|
||||
intendedUse == TerritoryIntendedUse::RaidFights ||
|
||||
intendedUse == TerritoryIntendedUse::Raids ||
|
||||
intendedUse == TerritoryIntendedUse::TreasureMapInstance ||
|
||||
intendedUse == TerritoryIntendedUse::EventTrial;
|
||||
}
|
||||
|
||||
bool Core::TerritoryMgr::isPrivateTerritory( uint32_t territoryTypeId ) const
|
||||
|
|
|
@ -53,7 +53,10 @@ namespace Core
|
|||
FreeCompanyGarrison = 30,
|
||||
PalaceOfTheDead = 31,
|
||||
TreasureMapInstance = 33,
|
||||
EventArea = 40,
|
||||
EventTrial = 36,
|
||||
TheFeastArea = 37,
|
||||
PrivateEventArea = 40,
|
||||
//Eureka = 41, // wat
|
||||
};
|
||||
|
||||
TerritoryMgr();
|
||||
|
|
Loading…
Add table
Reference in a new issue