mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 23:27: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 );
|
sscanf( params.c_str(), "%d", &terriId );
|
||||||
|
|
||||||
auto instance = g_territoryMgr.createTerritoryInstance( terriId );
|
auto instance = g_territoryMgr.createTerritoryInstance( terriId );
|
||||||
g_territoryMgr.addInstance( instance );
|
|
||||||
|
|
||||||
player.sendDebug( "Created instance with guid: " + std::to_string( instance->getGuId() ) );
|
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:
|
case GmCommand::Teri:
|
||||||
{
|
{
|
||||||
|
if( auto instance = g_territoryMgr.getTerritoryZonePtr( param1 ) )
|
||||||
if( !g_territoryMgr.isValidTerritory( 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 ) );
|
player.sendUrgent( "Invalid zone " + std::to_string( param1 ) );
|
||||||
}
|
|
||||||
else if( auto instance = g_territoryMgr.getInstance( param1 ) )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,27 +144,19 @@ Core::ZonePtr Core::TerritoryMgr::createTerritoryInstance( uint32_t territoryTyp
|
||||||
ZonePtr pZone( new Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, false ) );
|
ZonePtr pZone( new Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, false ) );
|
||||||
pZone->init();
|
pZone->init();
|
||||||
|
|
||||||
|
m_territoryInstanceMap[pZone->getTerritoryId()][pZone->getGuId()] = pZone;
|
||||||
|
m_instanceIdToZonePtrMap[pZone->getGuId()] = pZone;
|
||||||
|
|
||||||
return pZone;
|
return pZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core::TerritoryMgr::addInstance( ZonePtr pInstance )
|
Core::ZonePtr Core::TerritoryMgr::getTerritoryZonePtr( uint32_t instanceId ) const
|
||||||
{
|
{
|
||||||
// todo: wtf...
|
auto it = m_instanceIdToZonePtrMap.find( instanceId );
|
||||||
m_territoryInstanceMap[ pInstance->getTerritoryId() ][ pInstance->getGuId() ] = pInstance;
|
if( it == m_instanceIdToZonePtrMap.end() )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
return true;
|
return it->second;
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::TerritoryMgr::loadTerritoryPositionMap()
|
void Core::TerritoryMgr::loadTerritoryPositionMap()
|
||||||
|
|
Loading…
Add table
Reference in a new issue