mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
Merge pull request #287 from AcedArmy/actor_rewrite
Fixed making new zones and done some more gm stuff
This commit is contained in:
commit
d4133f19d9
6 changed files with 30 additions and 22 deletions
|
@ -136,6 +136,12 @@ void Core::Entity::Player::setGmInvis( bool invis )
|
|||
m_gmInvis = invis;
|
||||
}
|
||||
|
||||
bool Core::Entity::Player::isActingAsGm() const
|
||||
{
|
||||
auto status = getOnlineStatus();
|
||||
return status == OnlineStatus::GameMaster || status == OnlineStatus::GameMaster1 || status == OnlineStatus::GameMaster2;
|
||||
}
|
||||
|
||||
uint8_t Core::Entity::Player::getMode() const
|
||||
{
|
||||
return m_mode;
|
||||
|
@ -161,7 +167,7 @@ bool Core::Entity::Player::isMarkedForRemoval() const
|
|||
return m_markedForRemoval;
|
||||
}
|
||||
|
||||
Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
|
||||
Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus() const
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
if( !pExdData )
|
||||
|
|
|
@ -325,7 +325,7 @@ public:
|
|||
/*! sets players combat state */
|
||||
void setInCombat( bool mode );
|
||||
/*! return current online status depending on current state / activity */
|
||||
Common::OnlineStatus getOnlineStatus();
|
||||
Common::OnlineStatus getOnlineStatus() const;
|
||||
/*! sets the players zone, initiating a zoning process */
|
||||
void setZone( uint32_t zoneId );
|
||||
/*! sets the players instance & initiates zoning process */
|
||||
|
@ -551,6 +551,8 @@ public:
|
|||
bool getGmInvis() const;
|
||||
void setGmInvis( bool invis );
|
||||
|
||||
bool isActingAsGm() const;
|
||||
|
||||
uint8_t getMode() const;
|
||||
void setMode( uint8_t mode );
|
||||
|
||||
|
|
|
@ -449,12 +449,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
|||
case GmCommand::TeriInfo:
|
||||
{
|
||||
auto pCurrentZone = player.getCurrentZone();
|
||||
player.sendNotice( "ZoneId: " + std::to_string( player.getZoneId() ) + "\nName: " +
|
||||
pCurrentZone->getName() + "\nInternalName: " +
|
||||
pCurrentZone->getInternalName() + "\nPopCount: " +
|
||||
std::to_string( pCurrentZone->getPopCount() ) +
|
||||
"\nCurrentWeather:" + std::to_string( static_cast< uint8_t >( pCurrentZone->getCurrentWeather() ) ) +
|
||||
"\nNextWeather:" + std::to_string( static_cast< uint8_t >( pCurrentZone->getNextWeather() ) ) );
|
||||
player.sendNotice( "ZoneId: " + std::to_string( player.getZoneId() ) +
|
||||
"\nName: " + pCurrentZone->getName() +
|
||||
"\nInternalName: " + pCurrentZone->getInternalName() +
|
||||
"\nGuId: " + std::to_string( pCurrentZone->getGuId() ) +
|
||||
"\nPopCount: " + std::to_string( pCurrentZone->getPopCount() ) +
|
||||
"\nCurrentWeather: " + std::to_string( static_cast< uint8_t >( pCurrentZone->getCurrentWeather() ) ) +
|
||||
"\nNextWeather: " + std::to_string( static_cast< uint8_t >( pCurrentZone->getNextWeather() ) ) );
|
||||
break;
|
||||
}
|
||||
case GmCommand::Jump:
|
||||
|
@ -521,10 +522,8 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
|||
targetPlayer->resetHp();
|
||||
targetPlayer->resetMp();
|
||||
targetPlayer->setStatus( Entity::Chara::ActorStatus::Idle );
|
||||
targetPlayer->sendZoneInPackets( 0x01, 0x01, 0, 113, true );
|
||||
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatus,
|
||||
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) ), true );
|
||||
player.sendNotice( "Raised " + targetPlayer->getName() );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -511,7 +511,7 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
|||
{
|
||||
case ChatType::Say:
|
||||
{
|
||||
if (player.getGmRank() > 0)
|
||||
if ( player.isActingAsGm() )
|
||||
chatPacket.data().chatType = ChatType::GMSay;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||
|
@ -519,7 +519,7 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
|||
}
|
||||
case ChatType::Yell:
|
||||
{
|
||||
if( player.getGmRank() > 0 )
|
||||
if( player.isActingAsGm() )
|
||||
chatPacket.data().chatType = ChatType::GMYell;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
|
@ -527,7 +527,7 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
|||
}
|
||||
case ChatType::Shout:
|
||||
{
|
||||
if( player.getGmRank() > 0 )
|
||||
if( player.isActingAsGm() )
|
||||
chatPacket.data().chatType = ChatType::GMShout;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
|
|
|
@ -132,7 +132,7 @@ bool Core::TerritoryMgr::createDefaultTerritories()
|
|||
InstanceIdToZonePtrMap instanceMap;
|
||||
instanceMap[guid] = pZone;
|
||||
m_instanceIdToZonePtrMap[guid] = pZone;
|
||||
m_territoryInstanceMap[territoryId] = instanceMap;
|
||||
m_territoryIdToInstanceGuidMap[territoryId] = instanceMap;
|
||||
m_zoneSet.insert( { pZone } );
|
||||
|
||||
}
|
||||
|
@ -161,8 +161,9 @@ Core::ZonePtr Core::TerritoryMgr::createTerritoryInstance( uint32_t territoryTyp
|
|||
auto pZone = make_Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name );
|
||||
pZone->init();
|
||||
|
||||
m_territoryInstanceMap[pZone->getTerritoryId()][pZone->getGuId()] = pZone;
|
||||
m_instanceIdToZonePtrMap[pZone->getGuId()] = pZone;
|
||||
m_territoryIdToInstanceGuidMap[pZone->getTerritoryId()][pZone->getGuId()] = pZone;
|
||||
m_zoneSet.insert( { pZone } );
|
||||
|
||||
return pZone;
|
||||
}
|
||||
|
@ -205,8 +206,8 @@ bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
|||
|
||||
m_instanceIdToZonePtrMap.erase( pZone->getGuId() );
|
||||
|
||||
if( m_instanceZoneSet.count( pZone ) )
|
||||
m_instanceZoneSet.erase( pZone );
|
||||
m_instanceZoneSet.erase( pZone );
|
||||
m_zoneSet.erase( pZone );
|
||||
|
||||
if( isInstanceContentTerritory( pZone->getTerritoryId() ) )
|
||||
{
|
||||
|
@ -214,7 +215,7 @@ bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
|||
m_instanceContentToInstanceMap[instance->getInstanceContentId()].erase( pZone->getGuId() );
|
||||
}
|
||||
else
|
||||
m_territoryInstanceMap[pZone->getTerritoryId()].erase( pZone->getGuId() );
|
||||
m_territoryIdToInstanceGuidMap[pZone->getTerritoryId()].erase( pZone->getGuId() );
|
||||
|
||||
|
||||
return true;
|
||||
|
@ -275,8 +276,8 @@ Core::ZonePositionPtr Core::TerritoryMgr::getTerritoryPosition( uint32_t territo
|
|||
|
||||
Core::ZonePtr Core::TerritoryMgr::getZoneByTerriId( uint32_t territoryId ) const
|
||||
{
|
||||
auto zoneMap = m_territoryInstanceMap.find( territoryId );
|
||||
if( zoneMap == m_territoryInstanceMap.end() )
|
||||
auto zoneMap = m_territoryIdToInstanceGuidMap.find( territoryId );
|
||||
if( zoneMap == m_territoryIdToInstanceGuidMap.end() )
|
||||
return nullptr;
|
||||
|
||||
// TODO: actually select the proper one
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace Core
|
|||
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
|
||||
|
||||
/*! map holding actual instances of default territories */
|
||||
TerritoryIdToInstanceMap m_territoryInstanceMap;
|
||||
TerritoryIdToInstanceMap m_territoryIdToInstanceGuidMap;
|
||||
|
||||
/*! map holding actual instances of InstanceContent */
|
||||
InstanceContentIdToInstanceMap m_instanceContentToInstanceMap;
|
||||
|
|
Loading…
Add table
Reference in a new issue