mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +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;
|
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
|
uint8_t Core::Entity::Player::getMode() const
|
||||||
{
|
{
|
||||||
return m_mode;
|
return m_mode;
|
||||||
|
@ -161,7 +167,7 @@ bool Core::Entity::Player::isMarkedForRemoval() const
|
||||||
return m_markedForRemoval;
|
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 >();
|
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||||
if( !pExdData )
|
if( !pExdData )
|
||||||
|
|
|
@ -325,7 +325,7 @@ public:
|
||||||
/*! sets players combat state */
|
/*! sets players combat state */
|
||||||
void setInCombat( bool mode );
|
void setInCombat( bool mode );
|
||||||
/*! return current online status depending on current state / activity */
|
/*! return current online status depending on current state / activity */
|
||||||
Common::OnlineStatus getOnlineStatus();
|
Common::OnlineStatus getOnlineStatus() const;
|
||||||
/*! sets the players zone, initiating a zoning process */
|
/*! sets the players zone, initiating a zoning process */
|
||||||
void setZone( uint32_t zoneId );
|
void setZone( uint32_t zoneId );
|
||||||
/*! sets the players instance & initiates zoning process */
|
/*! sets the players instance & initiates zoning process */
|
||||||
|
@ -551,6 +551,8 @@ public:
|
||||||
bool getGmInvis() const;
|
bool getGmInvis() const;
|
||||||
void setGmInvis( bool invis );
|
void setGmInvis( bool invis );
|
||||||
|
|
||||||
|
bool isActingAsGm() const;
|
||||||
|
|
||||||
uint8_t getMode() const;
|
uint8_t getMode() const;
|
||||||
void setMode( uint8_t mode );
|
void setMode( uint8_t mode );
|
||||||
|
|
||||||
|
|
|
@ -449,12 +449,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
||||||
case GmCommand::TeriInfo:
|
case GmCommand::TeriInfo:
|
||||||
{
|
{
|
||||||
auto pCurrentZone = player.getCurrentZone();
|
auto pCurrentZone = player.getCurrentZone();
|
||||||
player.sendNotice( "ZoneId: " + std::to_string( player.getZoneId() ) + "\nName: " +
|
player.sendNotice( "ZoneId: " + std::to_string( player.getZoneId() ) +
|
||||||
pCurrentZone->getName() + "\nInternalName: " +
|
"\nName: " + pCurrentZone->getName() +
|
||||||
pCurrentZone->getInternalName() + "\nPopCount: " +
|
"\nInternalName: " + pCurrentZone->getInternalName() +
|
||||||
std::to_string( pCurrentZone->getPopCount() ) +
|
"\nGuId: " + std::to_string( pCurrentZone->getGuId() ) +
|
||||||
"\nCurrentWeather:" + std::to_string( static_cast< uint8_t >( pCurrentZone->getCurrentWeather() ) ) +
|
"\nPopCount: " + std::to_string( pCurrentZone->getPopCount() ) +
|
||||||
"\nNextWeather:" + std::to_string( static_cast< uint8_t >( pCurrentZone->getNextWeather() ) ) );
|
"\nCurrentWeather: " + std::to_string( static_cast< uint8_t >( pCurrentZone->getCurrentWeather() ) ) +
|
||||||
|
"\nNextWeather: " + std::to_string( static_cast< uint8_t >( pCurrentZone->getNextWeather() ) ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GmCommand::Jump:
|
case GmCommand::Jump:
|
||||||
|
@ -521,10 +522,8 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
||||||
targetPlayer->resetHp();
|
targetPlayer->resetHp();
|
||||||
targetPlayer->resetMp();
|
targetPlayer->resetMp();
|
||||||
targetPlayer->setStatus( Entity::Chara::ActorStatus::Idle );
|
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() );
|
player.sendNotice( "Raised " + targetPlayer->getName() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,7 +511,7 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
||||||
{
|
{
|
||||||
case ChatType::Say:
|
case ChatType::Say:
|
||||||
{
|
{
|
||||||
if (player.getGmRank() > 0)
|
if ( player.isActingAsGm() )
|
||||||
chatPacket.data().chatType = ChatType::GMSay;
|
chatPacket.data().chatType = ChatType::GMSay;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||||
|
@ -519,7 +519,7 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
||||||
}
|
}
|
||||||
case ChatType::Yell:
|
case ChatType::Yell:
|
||||||
{
|
{
|
||||||
if( player.getGmRank() > 0 )
|
if( player.isActingAsGm() )
|
||||||
chatPacket.data().chatType = ChatType::GMYell;
|
chatPacket.data().chatType = ChatType::GMYell;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||||
|
@ -527,7 +527,7 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
|
||||||
}
|
}
|
||||||
case ChatType::Shout:
|
case ChatType::Shout:
|
||||||
{
|
{
|
||||||
if( player.getGmRank() > 0 )
|
if( player.isActingAsGm() )
|
||||||
chatPacket.data().chatType = ChatType::GMShout;
|
chatPacket.data().chatType = ChatType::GMShout;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||||
|
|
|
@ -132,7 +132,7 @@ bool Core::TerritoryMgr::createDefaultTerritories()
|
||||||
InstanceIdToZonePtrMap instanceMap;
|
InstanceIdToZonePtrMap instanceMap;
|
||||||
instanceMap[guid] = pZone;
|
instanceMap[guid] = pZone;
|
||||||
m_instanceIdToZonePtrMap[guid] = pZone;
|
m_instanceIdToZonePtrMap[guid] = pZone;
|
||||||
m_territoryInstanceMap[territoryId] = instanceMap;
|
m_territoryIdToInstanceGuidMap[territoryId] = instanceMap;
|
||||||
m_zoneSet.insert( { pZone } );
|
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 );
|
auto pZone = make_Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name );
|
||||||
pZone->init();
|
pZone->init();
|
||||||
|
|
||||||
m_territoryInstanceMap[pZone->getTerritoryId()][pZone->getGuId()] = pZone;
|
|
||||||
m_instanceIdToZonePtrMap[pZone->getGuId()] = pZone;
|
m_instanceIdToZonePtrMap[pZone->getGuId()] = pZone;
|
||||||
|
m_territoryIdToInstanceGuidMap[pZone->getTerritoryId()][pZone->getGuId()] = pZone;
|
||||||
|
m_zoneSet.insert( { pZone } );
|
||||||
|
|
||||||
return pZone;
|
return pZone;
|
||||||
}
|
}
|
||||||
|
@ -205,8 +206,8 @@ bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
||||||
|
|
||||||
m_instanceIdToZonePtrMap.erase( pZone->getGuId() );
|
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() ) )
|
if( isInstanceContentTerritory( pZone->getTerritoryId() ) )
|
||||||
{
|
{
|
||||||
|
@ -214,7 +215,7 @@ bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
||||||
m_instanceContentToInstanceMap[instance->getInstanceContentId()].erase( pZone->getGuId() );
|
m_instanceContentToInstanceMap[instance->getInstanceContentId()].erase( pZone->getGuId() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_territoryInstanceMap[pZone->getTerritoryId()].erase( pZone->getGuId() );
|
m_territoryIdToInstanceGuidMap[pZone->getTerritoryId()].erase( pZone->getGuId() );
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -275,8 +276,8 @@ Core::ZonePositionPtr Core::TerritoryMgr::getTerritoryPosition( uint32_t territo
|
||||||
|
|
||||||
Core::ZonePtr Core::TerritoryMgr::getZoneByTerriId( uint32_t territoryId ) const
|
Core::ZonePtr Core::TerritoryMgr::getZoneByTerriId( uint32_t territoryId ) const
|
||||||
{
|
{
|
||||||
auto zoneMap = m_territoryInstanceMap.find( territoryId );
|
auto zoneMap = m_territoryIdToInstanceGuidMap.find( territoryId );
|
||||||
if( zoneMap == m_territoryInstanceMap.end() )
|
if( zoneMap == m_territoryIdToInstanceGuidMap.end() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// TODO: actually select the proper one
|
// TODO: actually select the proper one
|
||||||
|
|
|
@ -135,7 +135,7 @@ namespace Core
|
||||||
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
|
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
|
||||||
|
|
||||||
/*! map holding actual instances of default territories */
|
/*! map holding actual instances of default territories */
|
||||||
TerritoryIdToInstanceMap m_territoryInstanceMap;
|
TerritoryIdToInstanceMap m_territoryIdToInstanceGuidMap;
|
||||||
|
|
||||||
/*! map holding actual instances of InstanceContent */
|
/*! map holding actual instances of InstanceContent */
|
||||||
InstanceContentIdToInstanceMap m_instanceContentToInstanceMap;
|
InstanceContentIdToInstanceMap m_instanceContentToInstanceMap;
|
||||||
|
|
Loading…
Add table
Reference in a new issue