mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
gm teri accepts instance id
This commit is contained in:
parent
5afe002c33
commit
339a089d47
3 changed files with 13 additions and 24 deletions
|
@ -685,8 +685,6 @@ void Core::DebugCommandHandler::instance( char* data, Entity::Player &player, bo
|
|||
sscanf( params.c_str(), "%d", &terriId );
|
||||
|
||||
auto instance = g_territoryMgr.createTerritoryInstance( terriId );
|
||||
g_territoryMgr.addInstance( instance );
|
||||
|
||||
player.sendDebug( "Created instance with guid: " + std::to_string( instance->getGuId() ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -403,14 +403,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
}
|
||||
case GmCommand::Teri:
|
||||
{
|
||||
|
||||
if( !g_territoryMgr.isValidTerritory( param1 ) )
|
||||
if( auto instance = g_territoryMgr.getTerritoryZonePtr( param1 ) )
|
||||
{
|
||||
player.sendDebug( "Found instance: " + instance->getName() + ", id: " + std::to_string( param1 ) );
|
||||
}
|
||||
else if( !g_territoryMgr.isValidTerritory( param1 ) )
|
||||
{
|
||||
player.sendUrgent( "Invalid zone " + std::to_string( param1 ) );
|
||||
}
|
||||
else if( auto instance = g_territoryMgr.getInstance( param1 ) )
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -144,27 +144,19 @@ Core::ZonePtr Core::TerritoryMgr::createTerritoryInstance( uint32_t territoryTyp
|
|||
ZonePtr pZone( new Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, false ) );
|
||||
pZone->init();
|
||||
|
||||
m_territoryInstanceMap[pZone->getTerritoryId()][pZone->getGuId()] = pZone;
|
||||
m_instanceIdToZonePtrMap[pZone->getGuId()] = pZone;
|
||||
|
||||
return pZone;
|
||||
}
|
||||
|
||||
bool Core::TerritoryMgr::addInstance( ZonePtr pInstance )
|
||||
Core::ZonePtr Core::TerritoryMgr::getTerritoryZonePtr( uint32_t instanceId ) const
|
||||
{
|
||||
// todo: wtf...
|
||||
m_territoryInstanceMap[ pInstance->getTerritoryId() ][ pInstance->getGuId() ] = pInstance;
|
||||
auto it = m_instanceIdToZonePtrMap.find( instanceId );
|
||||
if( it == m_instanceIdToZonePtrMap.end() )
|
||||
return nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::ZonePtr Core::TerritoryMgr::getInstance( uint32_t instanceId ) const
|
||||
{
|
||||
for( InstanceIdToZonePtrMap map : m_territoryInstanceMap )
|
||||
{
|
||||
auto it = map.find( instanceId );
|
||||
if( it == map.end() )
|
||||
return nullptr;
|
||||
|
||||
return it->second;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void Core::TerritoryMgr::loadTerritoryPositionMap()
|
||||
|
|
Loading…
Add table
Reference in a new issue