1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-24 18:47:45 +00:00

Merge branch 'master' of https://github.com/SapphireMordred/Sapphire into party_crap

This commit is contained in:
Tahir Akhlaq 2017-11-24 12:29:24 +00:00
commit aeae64a8d5
48 changed files with 420 additions and 343 deletions

View file

@ -1,5 +1,5 @@
# Sapphire - FINAL FANTASY XIV Server Emulator
[![Discord Server](https://img.shields.io/badge/discord-Sapphire-7289DA.svg)](https://discord.gg/KfrZCkx)
[![Discord Server](https://img.shields.io/badge/discord-Sapphire-7289DA.svg)](https://discord.gg/xxcdCER)
[![Linux Build Status](https://travis-ci.org/SapphireMordred/Sapphire.svg?branch=master)](https://travis-ci.org/SapphireMordred/Sapphire)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/lil7lxa3ty165emm?svg=true)](https://ci.appveyor.com/project/SapphireMordred/Sapphire)
![FFXIV Sapphire](http://i.imgur.com/I4bj1tR.png)

@ -1 +1 @@
Subproject commit 2d0e1a962d13c8e07d1131789642e044eb489579
Subproject commit 8a26ae78e37701a9b66e7200f1e0ad3387da17c3

View file

@ -210,7 +210,7 @@ boost::shared_ptr< T > Core::Db::DbWorkerPool< T >::getFreeConnection()
{
connection = m_connections[IDX_SYNCH][i++ % numCons];
if (connection->lockIfReady())
if( connection->lockIfReady() )
break;
}

View file

@ -169,6 +169,8 @@ inline istream& operator>>(istream& is, FFXIVARR_IPC_HEADER& hdr)
return is.read(reinterpret_cast<char*>(&hdr), sizeof hdr);
}
} /* Packets */
} /* Network */
} /* Core */

View file

@ -22,6 +22,12 @@ class GamePacketNew;
template <typename T, typename T1>
std::ostream& operator<< ( std::ostream& os, const GamePacketNew<T, T1>& packet );
template< class T >
using ZoneChannelPacket = GamePacketNew< T, ServerZoneIpcType >;
template< class T >
using ChatChannelPacket = GamePacketNew< T, ServerChatIpcType >;
/**
* The base implementation of a game packet. Needed for parsing packets.
*/

View file

@ -50,7 +50,7 @@ void Core::Action::ActionCast::onStart()
m_pSource->getAsPlayer()->sendDebug( "onStart()" );
m_startTime = Util::getTimeMs();
GamePacketNew< FFXIVIpcActorCast, ServerZoneIpcType > castPacket( m_pSource->getId() );
ZoneChannelPacket< FFXIVIpcActorCast > castPacket( m_pSource->getId() );
castPacket.data().action_id = m_id;
castPacket.data().skillType = Common::SkillType::Normal;

View file

@ -49,7 +49,7 @@ void Core::Action::ActionMount::onStart()
m_pSource->getAsPlayer()->sendDebug( "ActionMount::onStart()" );
m_startTime = Util::getTimeMs();
GamePacketNew< FFXIVIpcActorCast, ServerZoneIpcType > castPacket( m_pSource->getId() );
ZoneChannelPacket< FFXIVIpcActorCast > castPacket( m_pSource->getId() );
castPacket.data().action_id = m_id;
castPacket.data().skillType = Common::SkillType::MountSkill;
@ -74,7 +74,7 @@ void Core::Action::ActionMount::onFinish()
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
pPlayer->sendStateFlags();
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket(pPlayer->getId());
ZoneChannelPacket< FFXIVIpcEffect > effectPacket(pPlayer->getId());
effectPacket.data().targetId = pPlayer->getId();
effectPacket.data().actionAnimationId = m_id;
effectPacket.data().unknown_62 = 13; // Affects displaying action name next to number in floating text

View file

@ -45,7 +45,7 @@ void Core::Action::ActionTeleport::onStart()
m_startTime = Util::getTimeMs();
GamePacketNew< FFXIVIpcActorCast, ServerZoneIpcType > castPacket( m_pSource->getId() );
ZoneChannelPacket< FFXIVIpcActorCast > castPacket( m_pSource->getId() );
castPacket.data().action_id = 5;
castPacket.data().unknown = 1;
@ -83,7 +83,7 @@ void Core::Action::ActionTeleport::onFinish()
pPlayer->setZoningType( Common::ZoneingType::Teleport );
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( pPlayer->getId() );
effectPacket.data().targetId = pPlayer->getId();
effectPacket.data().actionAnimationId = 5;
//effectPacket.data().unknown_3 = 1;

View file

@ -2,12 +2,13 @@
#include <src/servers/Server_Common/Util/UtilMath.h>
#include <src/servers/Server_Common/Network/PacketContainer.h>
#include <src/servers/Server_Common/Exd/ExdData.h>
#include <src/servers/Server_Common/Network/GamePacket.h>
#include "src/servers/Server_Zone/Forwards.h"
#include "src/servers/Server_Zone/Action/Action.h"
#include "Actor.h"
#include "src/servers/Server_Zone/Zone/Zone.h"
#include <src/servers/Server_Common/Network/GamePacket.h>
#include "src/servers/Server_Zone/Network/GameConnection.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
@ -19,7 +20,8 @@
#include "src/servers/Server_Zone/Action/ActionCollision.h"
#include "src/servers/Server_Zone/ServerZone.h"
#include "src/servers/Server_Zone/Session.h"
#include "CalcBattle.h"
#include "src/servers/Server_Zone/Math/CalcBattle.h"
#include "Actor.h"
#include "Player.h"
extern Core::ServerZone g_serverZone;
@ -626,7 +628,7 @@ void Core::Entity::Actor::autoAttack( ActorPtr pTarget )
uint32_t damage = 10 + rand() % 12;
uint32_t variation = 0 + rand() % 4;
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket( getId() );
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( getId() );
effectPacket.data().targetId = pTarget->getId();
effectPacket.data().actionAnimationId = 0x366;
effectPacket.data().unknown_2 = variation;
@ -669,7 +671,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint32_t actionId, u
// Todo: Effect packet generator. 90% of this is basically setting params and it's basically unreadable.
// Prepare packet. This is seemingly common for all packets in the action handler.
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket( getId() );
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( getId() );
effectPacket.data().targetId = pTarget.getId();
effectPacket.data().actionAnimationId = actionId;
effectPacket.data().unknown_62 = 1; // Affects displaying action name next to number in floating text
@ -738,7 +740,7 @@ void Core::Entity::Actor::handleScriptSkill( uint32_t type, uint32_t actionId, u
case ActionEffectType::Heal:
{
uint32_t calculatedHeal = Data::CalcBattle::calculateHealValue( getAsPlayer(), static_cast< uint32_t >( param1 ) );
uint32_t calculatedHeal = Math::CalcBattle::calculateHealValue( getAsPlayer(), static_cast< uint32_t >( param1 ) );
effectPacket.data().effects[0].value = calculatedHeal;
effectPacket.data().effects[0].effectType = ActionEffectType::Heal;

View file

@ -66,7 +66,7 @@ Core::Entity::BattleNpc::BattleNpc( uint32_t modelId, uint32_t nameid, const Com
m_currentStance = Stance::Passive;
m_class = ClassJob::Gladiator;
m_level = level > 0 ? level : 60;
m_level = level > 0 ? level : 70;
m_modelId = modelId;
m_nameId = nameid;
@ -125,7 +125,7 @@ void Core::Entity::BattleNpc::spawn( Core::Entity::PlayerPtr pTarget )
//pTarget->queuePacket( spawnPacket );
GamePacketNew< FFXIVIpcNpcSpawn, ServerZoneIpcType > spawnPacket( getId(), pTarget->getId() );
ZoneChannelPacket< FFXIVIpcNpcSpawn > spawnPacket( getId(), pTarget->getId() );
spawnPacket.data().pos.x = m_pos.x;
@ -223,14 +223,14 @@ void Core::Entity::BattleNpc::setOwner( Core::Entity::PlayerPtr pPlayer )
if( pPlayer != nullptr )
{
GamePacketNew< FFXIVIpcActorOwner, ServerZoneIpcType > setOwnerPacket( getId(), pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcActorOwner > setOwnerPacket( getId(), pPlayer->getId() );
setOwnerPacket.data().type = 0x01;
setOwnerPacket.data().actorId = pPlayer->getId();
sendToInRangeSet( setOwnerPacket );
}
else
{
GamePacketNew< FFXIVIpcActorOwner, ServerZoneIpcType > setOwnerPacket(getId(), INVALID_GAME_OBJECT_ID );
ZoneChannelPacket< FFXIVIpcActorOwner > setOwnerPacket(getId(), INVALID_GAME_OBJECT_ID );
setOwnerPacket.data().type = 0x01;
setOwnerPacket.data().actorId = INVALID_GAME_OBJECT_ID;
sendToInRangeSet( setOwnerPacket );
@ -489,6 +489,8 @@ void Core::Entity::BattleNpc::update( int64_t currTime )
return;
}
if ( !m_pStatusEffectContainer )
initStatusEffectContainer();
m_pStatusEffectContainer->update();
float distance = Math::Util::distance( m_pos.x, m_pos.y, m_pos.z,
m_posOrigin.x, m_posOrigin.y, m_posOrigin.z );

View file

@ -41,7 +41,8 @@
#include "src/servers/Server_Zone/Action/EventAction.h"
#include "src/servers/Server_Zone/Action/EventItemAction.h"
#include "src/servers/Server_Zone/Zone/ZonePosition.h"
#include "src/servers/Server_Zone/Actor/CalcBattle.h"
#include "src/servers/Server_Zone/Math/CalcStats.h"
#include "src/servers/Server_Zone/Math/CalcBattle.h"
#include <boost/make_shared.hpp>
extern Core::Logger g_log;
@ -71,7 +72,8 @@ Core::Entity::Player::Player() :
m_bMarkedForZoning( false ),
m_zoningType( Common::ZoneingType::None ),
m_bAutoattack( false ),
m_markedForRemoval( false )
m_markedForRemoval( false ),
m_mount( 0 )
{
m_id = 0;
m_type = ActorType::Player;
@ -198,7 +200,7 @@ uint64_t Core::Entity::Player::getOnlineStatusMask() const
void Core::Entity::Player::prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime, uint16_t animation )
{
GamePacketNew< FFXIVIpcPrepareZoning, ServerZoneIpcType > preparePacket( getId() );
ZoneChannelPacket< FFXIVIpcPrepareZoning > preparePacket( getId() );
preparePacket.data().targetZone = targetZone;
preparePacket.data().fadeOutTime = fadeOutTime;
preparePacket.data().animation = animation;
@ -226,7 +228,7 @@ void Core::Entity::Player::calculateStats()
auto paramGrowthInfo = paramGrowthInfoIt->second;
// TODO: put formula somewhere else...
float base = Data::CalcBattle::calculateBaseStat( getAsPlayer() );
float base = Math::CalcStats::calculateBaseStat( getAsPlayer() );
m_baseStats.str = static_cast< uint32_t >( base * ( static_cast< float >( classInfo.mod_str ) / 100 ) + tribeInfo.mod_str );
m_baseStats.dex = static_cast< uint32_t >( base * ( static_cast< float >( classInfo.mod_dex ) / 100 ) + tribeInfo.mod_dex );
@ -242,9 +244,9 @@ void Core::Entity::Player::calculateStats()
m_baseStats.attackPotMagic = paramGrowthInfo.base_secondary;
m_baseStats.healingPotMagic = paramGrowthInfo.base_secondary;
m_baseStats.max_mp = Data::CalcBattle::calculateMaxMp( getAsPlayer() );
m_baseStats.max_mp = Math::CalcStats::calculateMaxMp( getAsPlayer() );
m_baseStats.max_hp = Data::CalcBattle::calculateMaxHp( getAsPlayer() );
m_baseStats.max_hp = Math::CalcStats::calculateMaxHp( getAsPlayer() );
if( m_mp > m_baseStats.max_mp )
m_mp = m_baseStats.max_mp;
@ -271,7 +273,7 @@ bool Core::Entity::Player::isAutoattackOn() const
void Core::Entity::Player::sendStats()
{
GamePacketNew< FFXIVIpcPlayerStats, ServerZoneIpcType > statPacket( getId() );
ZoneChannelPacket< FFXIVIpcPlayerStats > statPacket( getId() );
statPacket.data().strength = m_baseStats.str;
statPacket.data().dexterity = m_baseStats.dex;
statPacket.data().vitality = m_baseStats.vit;
@ -388,7 +390,7 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
m_pCurrentZone = pZone;
m_pCurrentZone->pushActor( shared_from_this() );
GamePacketNew< FFXIVIpcInit, ServerZoneIpcType > initPacket( getId() );
ZoneChannelPacket< FFXIVIpcInit > initPacket( getId() );
initPacket.data().charId = getId();
queuePacket( initPacket );
@ -409,7 +411,7 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
// only initialize the UI if the player in fact just logged in.
if( isLogin() )
{
GamePacketNew< FFXIVIpcCFAvailableContents, ServerZoneIpcType > contentFinderList( getId() );
ZoneChannelPacket< FFXIVIpcCFAvailableContents > contentFinderList( getId() );
for( auto i = 0; i < sizeof( contentFinderList.data().contents ); i++ )
{
// unlock all contents for now
@ -420,14 +422,14 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
Server::InitUIPacket initUIPacket( pPlayer );
queuePacket( initUIPacket );
GamePacketNew< FFXIVIpcPlayerClassInfo, ServerZoneIpcType > classInfoPacket( getId() );
ZoneChannelPacket< FFXIVIpcPlayerClassInfo > classInfoPacket( getId() );
classInfoPacket.data().classId = static_cast< uint8_t >( getClass() );
classInfoPacket.data().unknown = 1;
classInfoPacket.data().level = getLevel();
classInfoPacket.data().level1 = getLevel();
queuePacket( classInfoPacket );
GamePacketNew< FFXIVGCAffiliation, ServerZoneIpcType > gcAffPacket( getId() );
ZoneChannelPacket< FFXIVGCAffiliation > gcAffPacket( getId() );
gcAffPacket.data().gcId = m_gc;
gcAffPacket.data().gcRank[0] = m_gcRank[0];
gcAffPacket.data().gcRank[1] = m_gcRank[1];
@ -435,7 +437,7 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
queuePacket( gcAffPacket );
}
GamePacketNew< FFXIVIpcInitZone, ServerZoneIpcType > initZonePacket( getId() );
ZoneChannelPacket< FFXIVIpcInitZone > initZonePacket( getId() );
initZonePacket.data().zoneId = getCurrentZone()->getLayoutId();
initZonePacket.data().weatherId = static_cast< uint8_t >( getCurrentZone()->getCurrentWeather() );
initZonePacket.data().bitmask = 0x1;
@ -447,10 +449,10 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
if( isLogin() )
{
GamePacketNew< FFXIVARR_IPC_UNK322, ServerZoneIpcType > unk322( getId() );
ZoneChannelPacket< FFXIVARR_IPC_UNK322 > unk322( getId() );
queuePacket( unk322 );
GamePacketNew< FFXIVARR_IPC_UNK320, ServerZoneIpcType > unk320( getId() );
ZoneChannelPacket< FFXIVARR_IPC_UNK320 > unk320( getId() );
queuePacket( unk320 );
}
@ -675,7 +677,7 @@ void Core::Entity::Player::gainLevel()
m_hp = getMaxHp();
m_mp = getMaxMp();
GamePacketNew< FFXIVIpcStatusEffectList, ServerZoneIpcType > effectListPacket( getId() );
ZoneChannelPacket< FFXIVIpcStatusEffectList > effectListPacket( getId() );
effectListPacket.data().classId = static_cast< uint8_t > ( getClass() );
effectListPacket.data().classId1 = static_cast< uint8_t > ( getClass() );
effectListPacket.data().level = getLevel();
@ -690,7 +692,7 @@ void Core::Entity::Player::gainLevel()
getLevel(), getLevel() - 1 ), true );
GamePacketNew< FFXIVIpcUpdateClassInfo, ServerZoneIpcType > classInfoPacket( getId() );
ZoneChannelPacket< FFXIVIpcUpdateClassInfo > classInfoPacket( getId() );
classInfoPacket.data().classId = static_cast< uint8_t > ( getClass() );
classInfoPacket.data().classId1 = static_cast< uint8_t > ( getClass() );
classInfoPacket.data().level = getLevel();
@ -780,7 +782,7 @@ void Core::Entity::Player::setClassJob( Core::Common::ClassJob classJob )
m_tp = 0;
GamePacketNew< FFXIVIpcPlayerClassInfo, ServerZoneIpcType > classInfoPacket( getId() );
ZoneChannelPacket< FFXIVIpcPlayerClassInfo > classInfoPacket( getId() );
classInfoPacket.data().classId = static_cast< uint8_t >( getClass() );
classInfoPacket.data().level = getLevel();
queuePacket( classInfoPacket );
@ -919,7 +921,7 @@ void Core::Entity::Player::setGc( uint8_t gc )
{
m_gc = gc;
GamePacketNew< FFXIVGCAffiliation, ServerZoneIpcType > gcAffPacket( getId() );
ZoneChannelPacket< FFXIVGCAffiliation > gcAffPacket( getId() );
gcAffPacket.data().gcId = m_gc;
gcAffPacket.data().gcRank[0] = m_gcRank[0];
gcAffPacket.data().gcRank[1] = m_gcRank[1];
@ -931,7 +933,7 @@ void Core::Entity::Player::setGcRankAt( uint8_t index, uint8_t rank )
{
m_gcRank[index] = rank;
GamePacketNew< FFXIVGCAffiliation, ServerZoneIpcType > gcAffPacket( getId() );
ZoneChannelPacket< FFXIVGCAffiliation > gcAffPacket( getId() );
gcAffPacket.data().gcId = m_gc;
gcAffPacket.data().gcRank[0] = m_gcRank[0];
gcAffPacket.data().gcRank[1] = m_gcRank[1];
@ -1026,7 +1028,7 @@ void Core::Entity::Player::update( int64_t currTime )
}
else
{
GamePacketNew< FFXIVIpcActorSetPos, ServerZoneIpcType > setActorPosPacket( getId() );
ZoneChannelPacket< FFXIVIpcActorSetPos > setActorPosPacket( getId() );
setActorPosPacket.data().r16 = Math::Util::floatToUInt16Rot( m_queuedZoneing->m_targetRotation );
setActorPosPacket.data().waitForLoad = 0x04;
setActorPosPacket.data().x = targetPos.x;
@ -1107,7 +1109,7 @@ void Core::Entity::Player::freePlayerSpawnId( uint32_t actorId )
m_playerIdToSpawnIdMap.erase( actorId );
m_freeSpawnIdQueue.push( spawnId );
GamePacketNew< FFXIVIpcActorFreeSpawn, ServerZoneIpcType > freeActorSpawnPacket( getId() );
ZoneChannelPacket< FFXIVIpcActorFreeSpawn > freeActorSpawnPacket( getId() );
freeActorSpawnPacket.data().actorId = actorId;
freeActorSpawnPacket.data().spawnId = spawnId;
queuePacket( freeActorSpawnPacket );
@ -1378,7 +1380,7 @@ void Core::Entity::Player::initHateSlotQueue()
void Core::Entity::Player::sendHateList()
{
GamePacketNew< FFXIVIpcHateList, ServerZoneIpcType > hateListPacket( getId() );
ZoneChannelPacket< FFXIVIpcHateList > hateListPacket( getId() );
hateListPacket.data().numEntries = m_actorIdTohateSlotMap.size();
auto it = m_actorIdTohateSlotMap.begin();
for( int32_t i = 0; it != m_actorIdTohateSlotMap.end(); ++it, i++ )
@ -1435,7 +1437,7 @@ void Core::Entity::Player::setTitle( uint16_t titleId )
void Core::Entity::Player::setEquipDisplayFlags( uint8_t state )
{
m_equipDisplayFlags = state;
GamePacketNew< FFXIVIpcEquipDisplayFlags, ServerZoneIpcType > paramPacket( getId() );
ZoneChannelPacket< FFXIVIpcEquipDisplayFlags > paramPacket( getId() );
paramPacket.data().bitmask = m_equipDisplayFlags;
sendToInRangeSet( paramPacket, true );
}
@ -1447,29 +1449,25 @@ uint8_t Core::Entity::Player::getEquipDisplayFlags() const
void Core::Entity::Player::mount( uint32_t id )
{
// TODO: Fix me for SQL rewrite
/* m_mount = id;
m_mount = id;
sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Mounted )), true );
sendToInRangeSet( ActorControlPacket143( getId(), 0x39e, 12 ), true ); //?
GamePacketNew< FFXIVIpcMount, ServerZoneIpcType > mountPacket( getId() );
mountPacket.data().id = m_mount;
sendToInRangeSet( mountPacket, true );*/
ZoneChannelPacket< FFXIVIpcMount > mountPacket( getId() );
mountPacket.data().id = id;
sendToInRangeSet( mountPacket, true );
}
void Core::Entity::Player::dismount()
{
// TODO: Fix me for SQL rewrite
/* sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle )), true );
sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle )), true );
sendToInRangeSet( ActorControlPacket143( getId(), ActorControlType::Dismount, 1 ), true );
m_mount = 0;*/
m_mount = 0;
}
uint8_t Core::Entity::Player::getCurrentMount() const
{
// TODO: Fix me for SQL rewrite
// return m_mount;
return 0;
return m_mount;
}
void Core::Entity::Player::autoAttack( ActorPtr pTarget )
@ -1488,7 +1486,7 @@ void Core::Entity::Player::autoAttack( ActorPtr pTarget )
getClass() == ClassJob::Bard ||
getClass() == ClassJob::Archer )
{
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket(getId());
ZoneChannelPacket< FFXIVIpcEffect > effectPacket(getId());
effectPacket.data().targetId = pTarget->getId();
effectPacket.data().actionAnimationId = 8;
// effectPacket.data().unknown_2 = variation;
@ -1509,7 +1507,7 @@ void Core::Entity::Player::autoAttack( ActorPtr pTarget )
else
{
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket(getId());
ZoneChannelPacket< FFXIVIpcEffect > effectPacket(getId());
effectPacket.data().targetId = pTarget->getId();
effectPacket.data().actionAnimationId = 7;
// effectPacket.data().unknown_2 = variation;
@ -1578,7 +1576,7 @@ void Core::Entity::Player::setOpeningSequence( uint8_t seq )
void Core::Entity::Player::setEorzeaTimeOffset( uint64_t timestamp )
{
// TODO: maybe change to persistent?
GamePacketNew< FFXIVIpcEorzeaTimeOffset, ServerZoneIpcType > packet ( getId() );
ZoneChannelPacket< FFXIVIpcEorzeaTimeOffset > packet ( getId() );
packet.data().timestamp = timestamp;
// Send to single player

View file

@ -629,6 +629,8 @@ private:
// content finder info
uint32_t m_cfPenaltyUntil; // unix time
uint8_t m_mount;
};
}

View file

@ -130,7 +130,7 @@ void Core::Entity::Player::addCurrency( uint8_t type, uint32_t amount )
if( !m_pInventory->addCurrency( static_cast< Inventory::CurrencyType >( type ), amount ) )
return;
GamePacketNew< FFXIVIpcUpdateInventorySlot, ServerZoneIpcType > invUpPacket( getId() );
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( getId() );
invUpPacket.data().containerId = Inventory::InventoryType::Currency;
invUpPacket.data().catalogId = 1;
invUpPacket.data().quantity = m_pInventory->getCurrency( static_cast< Inventory::CurrencyType >( type ) );
@ -144,7 +144,7 @@ void Core::Entity::Player::removeCurrency( uint8_t type, uint32_t amount )
if( !m_pInventory->removeCurrency( static_cast< Inventory::CurrencyType >( type ), amount ) )
return;
GamePacketNew< FFXIVIpcUpdateInventorySlot, ServerZoneIpcType > invUpPacket( getId() );
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( getId() );
invUpPacket.data().containerId = Inventory::InventoryType::Currency;
invUpPacket.data().catalogId = 1;
invUpPacket.data().quantity = m_pInventory->getCurrency( static_cast< Inventory::CurrencyType >( type ) );
@ -164,7 +164,7 @@ void Core::Entity::Player::addCrystal( uint8_t type, uint32_t amount )
if( !m_pInventory->addCrystal( static_cast< Inventory::CrystalType >( type ), amount ) )
return;
GamePacketNew< FFXIVIpcUpdateInventorySlot, ServerZoneIpcType > invUpPacket( getId() );
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( getId() );
invUpPacket.data().containerId = Inventory::InventoryType::Crystal;
invUpPacket.data().catalogId = static_cast< uint8_t >( type ) + 1;
invUpPacket.data().quantity = m_pInventory->getCrystal( static_cast< Inventory::CrystalType >( type ) );
@ -180,7 +180,7 @@ void Core::Entity::Player::removeCrystal( uint8_t type, uint32_t amount )
if( !m_pInventory->removeCrystal( static_cast< Inventory::CrystalType >( type ), amount ) )
return;
GamePacketNew< FFXIVIpcUpdateInventorySlot, ServerZoneIpcType > invUpPacket( getId() );
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( getId() );
invUpPacket.data().containerId = Inventory::InventoryType::Crystal;
invUpPacket.data().catalogId = static_cast< uint8_t >( type ) + 1;
invUpPacket.data().quantity = m_pInventory->getCrystal( static_cast< Inventory::CrystalType >( type ) );

View file

@ -44,13 +44,13 @@ void Core::Entity::Player::removeQuest( uint16_t questId )
if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) )
{
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > questUpdatePacket( getId() );
ZoneChannelPacket< FFXIVIpcQuestUpdate > questUpdatePacket( getId() );
questUpdatePacket.data().slot = idx;
questUpdatePacket.data().questInfo.c.questId = 0;
questUpdatePacket.data().questInfo.c.sequence = 0xFF;
queuePacket( questUpdatePacket );
GamePacketNew< FFXIVIpcQuestFinish, ServerZoneIpcType > questFinishPacket( getId() );
ZoneChannelPacket< FFXIVIpcQuestFinish > questFinishPacket( getId() );
questFinishPacket.data().questId = questId;
questFinishPacket.data().flag1 = 1;
questFinishPacket.data().flag2 = 1;
@ -865,7 +865,7 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
{
uint8_t index = getQuestIndex( questId );
auto pNewQuest = m_activeQuests[index];
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() );
ZoneChannelPacket< FFXIVIpcQuestUpdate > pe_qa( getId() );
pNewQuest->c.sequence = sequence;
pe_qa.data().slot = index;
pe_qa.data().questInfo = *pNewQuest;
@ -895,7 +895,7 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
m_questIdToQuestIdx[questId] = idx;
m_questIdxToQuestId[idx] = questId;
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() );
ZoneChannelPacket< FFXIVIpcQuestUpdate > pe_qa( getId() );
pe_qa.data().slot = idx;
pe_qa.data().questInfo = *pNewQuest;
queuePacket( pe_qa );
@ -917,7 +917,7 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
void Core::Entity::Player::sendQuestTracker()
{
GamePacketNew< FFXIVIpcQuestTracker, ServerZoneIpcType > trackerPacket( getId() );
ZoneChannelPacket< FFXIVIpcQuestTracker > trackerPacket( getId() );
for( int32_t ii = 0; ii < 5; ii++ )
{
@ -962,7 +962,7 @@ void Core::Entity::Player::setQuestTracker( uint16_t index, int16_t flag )
void Core::Entity::Player::sendQuestInfo()
{
GamePacketNew< FFXIVIpcQuestActiveList, ServerZoneIpcType > pe_qa( getId() );
ZoneChannelPacket< FFXIVIpcQuestActiveList > pe_qa( getId() );
for( int32_t i = 0; i < 30; i++ )
{
@ -978,7 +978,7 @@ void Core::Entity::Player::sendQuestInfo()
queuePacket( pe_qa );
GamePacketNew< FFXIVIpcQuestCompleteList, ServerZoneIpcType > pe_qc( getId() );
ZoneChannelPacket< FFXIVIpcQuestCompleteList > pe_qc( getId() );
memcpy( pe_qc.data().questCompleteMask, m_questCompleteFlags, 200 );
queuePacket( pe_qc );

View file

@ -166,6 +166,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
m_maxHp = getMaxHp();
m_maxMp = getMaxMp();
m_mount = res->getUInt8( "Mount" );
m_modelSubWeapon = 0;
m_lastTickTime = 0;
@ -305,7 +307,7 @@ void Core::Entity::Player::updateSql()
stmt->setInt( 3, 0 ); // TP
stmt->setInt( 4, 0 ); // GP
stmt->setInt( 5, 0 ); // Mode
stmt->setInt( 6, 0 ); // Mount
stmt->setInt( 6, m_mount ); // Mount
stmt->setInt( 7, 0 ); // InvicibleGM
stmt->setInt( 8, m_voice );

View file

@ -14,6 +14,7 @@ file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
Event/*.h
Inventory/*.h
Linkshell/*.h
Math/*.h
Network/*.h
Network/Handlers/*.h
Network/PacketWrappers/*.h
@ -31,6 +32,7 @@ file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
Event/*.c*
Inventory/*.c*
Linkshell/*.c*
Math/*.c*
Network/*.c*
Network/Handlers/*.c*
Network/PacketWrappers/*.c*

View file

@ -183,7 +183,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
pPlayer->getPos().y + static_cast< float >( posY ),
pPlayer->getPos().z + static_cast< float >( posZ ) );
Network::Packets::GamePacketNew< Network::Packets::Server::FFXIVIpcActorSetPos, Network::Packets::ServerZoneIpcType >
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
setActorPosPacket( pPlayer->getId() );
setActorPosPacket.data().x = pPlayer->getPos().x;
setActorPosPacket.data().y = pPlayer->getPos().y;
@ -204,7 +204,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
int32_t discover_id;
sscanf( params.c_str(), "%i %i", &map_id, &discover_id );
Network::Packets::GamePacketNew< Network::Packets::Server::FFXIVIpcDiscovery, Network::Packets::ServerZoneIpcType > discoveryPacket( pPlayer->getId() );
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcDiscovery > discoveryPacket( pPlayer->getId() );
discoveryPacket.data().map_id = map_id;
discoveryPacket.data().map_part_id = discover_id;
pPlayer->queuePacket( discoveryPacket );
@ -375,7 +375,7 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
pPlayer->sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
Network::Packets::GamePacketNew< Network::Packets::Server::FFXIVIpcActorControl143, Network::Packets::ServerZoneIpcType > actorControl( playerId, pPlayer->getId() );
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, pPlayer->getId() );
actorControl.data().category = opcode;
actorControl.data().param1 = param1;
actorControl.data().param2 = param2;
@ -501,7 +501,7 @@ void Core::DebugCommandHandler::nudge( char * data, Entity::PlayerPtr pPlayer, b
}
if( offset != 0 )
{
Network::Packets::GamePacketNew< Network::Packets::Server::FFXIVIpcActorSetPos, Network::Packets::ServerZoneIpcType >
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
setActorPosPacket( pPlayer->getId() );
setActorPosPacket.data().x = pPlayer->getPos().x;
setActorPosPacket.data().y = pPlayer->getPos().y;

View file

@ -484,7 +484,7 @@ int16_t Core::Inventory::addItem( uint16_t inventoryId, int8_t slotId, uint32_t
" WHERE storageId = " + std::to_string( inventoryId ) +
" AND CharacterId = " + std::to_string( m_pOwner->getId() ) );
GamePacketNew< FFXIVIpcUpdateInventorySlot, ServerZoneIpcType > invUpPacket( m_pOwner->getId() );
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( m_pOwner->getId() );
invUpPacket.data().containerId = inventoryId;
invUpPacket.data().catalogId = catalogId;
invUpPacket.data().quantity = item->getStackSize();
@ -605,7 +605,7 @@ void Core::Inventory::discardItem( uint16_t fromInventoryId, uint8_t fromSlotId
m_inventoryMap[fromInventoryId]->removeItem( fromSlotId );
updateContainer( fromInventoryId, fromSlotId, nullptr );
GamePacketNew< FFXIVIpcInventoryTransaction, ServerZoneIpcType > invTransPacket( m_pOwner->getId() );
ZoneChannelPacket< FFXIVIpcInventoryTransaction > invTransPacket( m_pOwner->getId() );
invTransPacket.data().transactionId = transactionId;
invTransPacket.data().ownerId = m_pOwner->getId();
invTransPacket.data().storageId = fromInventoryId;
@ -615,7 +615,7 @@ void Core::Inventory::discardItem( uint16_t fromInventoryId, uint8_t fromSlotId
invTransPacket.data().type = 7;
m_pOwner->queuePacket( invTransPacket );
GamePacketNew< FFXIVIpcInventoryTransactionFinish, ServerZoneIpcType > invTransFinPacket( m_pOwner->getId() );
ZoneChannelPacket< FFXIVIpcInventoryTransactionFinish > invTransFinPacket( m_pOwner->getId() );
invTransFinPacket.data().transactionId = transactionId;
invTransFinPacket.data().transactionId1 = transactionId;
m_pOwner->queuePacket( invTransFinPacket );
@ -793,7 +793,7 @@ void Core::Inventory::send()
if( it->second->getId() == InventoryType::Currency || it->second->getId() == InventoryType::Crystal )
{
GamePacketNew< FFXIVIpcCurrencyCrystalInfo, ServerZoneIpcType > currencyInfoPacket( m_pOwner->getId() );
ZoneChannelPacket< FFXIVIpcCurrencyCrystalInfo > currencyInfoPacket( m_pOwner->getId() );
currencyInfoPacket.data().sequence = count;
currencyInfoPacket.data().catalogId = itM->second->getId();
currencyInfoPacket.data().unknown = 1;
@ -804,7 +804,7 @@ void Core::Inventory::send()
}
else
{
GamePacketNew< FFXIVIpcItemInfo, ServerZoneIpcType > itemInfoPacket( m_pOwner->getId() );
ZoneChannelPacket< FFXIVIpcItemInfo > itemInfoPacket( m_pOwner->getId() );
itemInfoPacket.data().sequence = count;
itemInfoPacket.data().containerId = it->second->getId();
itemInfoPacket.data().slot = itM->first;
@ -817,7 +817,7 @@ void Core::Inventory::send()
}
}
GamePacketNew< FFXIVIpcContainerInfo, ServerZoneIpcType > containerInfoPacket( m_pOwner->getId() );
ZoneChannelPacket< FFXIVIpcContainerInfo > containerInfoPacket( m_pOwner->getId() );
containerInfoPacket.data().sequence = count;
containerInfoPacket.data().numItems = it->second->getEntryCount();
containerInfoPacket.data().containerId = it->second->getId();

View file

@ -0,0 +1,45 @@
#include <cmath>
#include <Server_Common/Exd/ExdData.h>
#include <Server_Common/Common.h>
#include <Server_Zone/Actor/Actor.h>
#include <Server_Zone/Actor/Player.h>
#include "CalcBattle.h"
using namespace Core::Math;
using namespace Core::Entity;
extern Core::Data::ExdData g_exdData;
/*
Class used for battle-related formulas and calculations.
Big thanks to the Theoryjerks group!
NOTE:
Formulas here shouldn't be considered final. It's possible that the formula it was based on is correct but
wasn't implemented correctly here, or approximated things due to limited knowledge of how things work in retail.
It's also possible that we're using formulas that were correct for previous patches, but not the current version.
TODO:
Damage outgoing calculations. This includes auto-attacks, etc.
More formulas in general. Most of it was moved to another class, but work can be done in this area as well already.
*/
uint32_t CalcBattle::calculateHealValue( PlayerPtr pPlayer, uint32_t potency )
{
auto classInfoIt = g_exdData.m_classJobInfoMap.find( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( pPlayer->getLevel() );
if ( classInfoIt == g_exdData.m_classJobInfoMap.end() ||
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end())
return 0;
auto jobModVal = classInfoIt->second;
// consider 3% variation
return potency / 10;
}

View file

@ -0,0 +1,24 @@
#ifndef _CALCBATTLE_H
#define _CALCBATTLE_H
#include <Server_Common/Common.h>
#include <Server_Zone/Actor/Actor.h>
using namespace Core::Entity;
namespace Core {
namespace Math {
class CalcBattle
{
public:
static uint32_t calculateHealValue( PlayerPtr pPlayer, uint32_t potency );
private:
};
}
}
#endif

View file

@ -1,11 +1,14 @@
#include <src/servers/Server_Common/Exd/ExdData.h>
#include "CalcBattle.h"
#include "Actor.h"
#include "Player.h"
#include <cmath>
using namespace Core::Data;
#include <Server_Common/Exd/ExdData.h>
#include <Server_Common/Common.h>
#include <Server_Zone/Actor/Actor.h>
#include <Server_Zone/Actor/Player.h>
#include "CalcStats.h"
using namespace Core::Math;
using namespace Core::Entity;
extern Core::Data::ExdData g_exdData;
@ -22,15 +25,14 @@ extern Core::Data::ExdData g_exdData;
TODO:
Base HP val modifier. I can only find values for levels 50~70.
Attack power (and healing power). Needs more research on this.
Damage outgoing calculations. This includes auto-attacks, etc.
Dereferencing the actor (Player right now) for stats seem meh, perhaps consider a structure purely for stats?
Reduce repeated code (more specifically the data we pull from exd)
*/
// 3 Versions. SB and HW are linear, ARR is polynomial.
// Originally from Player.cpp, calculateStats().
float CalcBattle::calculateBaseStat( PlayerPtr pPlayer )
float CalcStats::calculateBaseStat( PlayerPtr pPlayer )
{
float base = 0.0f;
uint8_t level = pPlayer->getLevel();
@ -53,10 +55,10 @@ float CalcBattle::calculateBaseStat( PlayerPtr pPlayer )
// Leggerless' HP Formula
// ROUNDDOWN(JobModHP * (BaseHP / 100)) + ROUNDDOWN(VitHPMod / 100 * (VIT - BaseDET))
uint32_t CalcBattle::calculateMaxHp( PlayerPtr pPlayer )
uint32_t CalcStats::calculateMaxHp( PlayerPtr pPlayer )
{
// TODO: Replace ApproxBaseHP with something that can get us an accurate BaseHP.
// Is there any way to pull BaseHP without having to manually use a pet for every level, and using the values from a table?
// Is there any way to pull reliable BaseHP without having to manually use a pet for every level, and using the values from a table?
// More info here: https://docs.google.com/spreadsheets/d/1de06KGT0cNRUvyiXNmjNgcNvzBCCQku7jte5QxEQRbs/edit?usp=sharing
auto classInfoIt = g_exdData.m_classJobInfoMap.find( static_cast< uint8_t >( pPlayer->getClass() ) );
@ -91,7 +93,7 @@ uint32_t CalcBattle::calculateMaxHp( PlayerPtr pPlayer )
// Leggerless' MP Formula
// ROUNDDOWN(((ROUNDDOWN(((PIE - BaseDET) * PieMPMod/100),0) + BaseMP) * JobModMP / 100),0)
uint32_t CalcBattle::calculateMaxMp( PlayerPtr pPlayer )
uint32_t CalcStats::calculateMaxMp( PlayerPtr pPlayer )
{
auto classInfoIt = g_exdData.m_classJobInfoMap.find( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( pPlayer->getLevel() );
@ -109,19 +111,4 @@ uint32_t CalcBattle::calculateMaxMp( PlayerPtr pPlayer )
uint16_t result = static_cast< uint16_t >( floor( floor( piety - baseStat ) * ( pietyScalar / 100 ) + baseMp ) * jobModMp / 100 );
return result;
}
uint32_t CalcBattle::calculateHealValue( PlayerPtr pPlayer, uint32_t potency )
{
auto classInfoIt = g_exdData.m_classJobInfoMap.find( static_cast< uint8_t >( pPlayer->getClass() ) );
auto paramGrowthInfoIt = g_exdData.m_paramGrowthInfoMap.find( pPlayer->getLevel() );
if ( classInfoIt == g_exdData.m_classJobInfoMap.end() ||
paramGrowthInfoIt == g_exdData.m_paramGrowthInfoMap.end())
return 0;
auto jobModVal = classInfoIt->second;
// consider 3% variation
return potency / 10;
}

View file

@ -1,23 +1,20 @@
#ifndef _CALCBATTLE_H
#define _CALCBATTLE_H
#ifndef _CALCSTATS_H
#define _CALCSTATS_H
#include <src/servers/Server_Common/Common.h>
#include "Actor.h"
#include <Server_Common/Common.h>
#include <Server_Zone/Actor/Actor.h>
using namespace Core::Entity;
namespace Core {
namespace Data {
class CalcBattle
namespace Math {
class CalcStats
{
public:
static float calculateBaseStat( PlayerPtr pPlayer );
static uint32_t calculateMaxMp( PlayerPtr pPlayer );
static uint32_t calculateMaxHp( PlayerPtr pPlayer );
static uint32_t calculateHealValue( PlayerPtr pPlayer, uint32_t potency );
private:

View file

@ -126,7 +126,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
}
case 0x12F: // Get title list
{
GamePacketNew< FFXIVIpcPlayerTitleList, ServerZoneIpcType > titleListPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcPlayerTitleList > titleListPacket( pPlayer->getId() );
memcpy( titleListPacket.data().titleList, pPlayer->getTitleList(), sizeof( titleListPacket.data().titleList ) );
pPlayer->queuePacket( titleListPacket );

View file

@ -27,7 +27,7 @@ using namespace Core::Network::Packets::Server;
void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer )
{
GamePacketNew< FFXIVIpcCFDutyInfo, ServerZoneIpcType > dutyInfoPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcCFDutyInfo > dutyInfoPacket( pPlayer->getId() );
auto penaltyMinutes = pPlayer->getCFPenaltyMinutes();
if (penaltyMinutes > 255)
@ -39,7 +39,7 @@ void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::GamePacket
queueOutPacket( dutyInfoPacket );
GamePacketNew< FFXIVIpcCFPlayerInNeed, ServerZoneIpcType > inNeedsPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcCFPlayerInNeed > inNeedsPacket( pPlayer->getId() );
queueOutPacket( inNeedsPacket );
}
@ -62,7 +62,7 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& i
pPlayer->sendDebug("ContentId5" + std::to_string(contentId5));
// let's cancel it because otherwise you can't register it again
GamePacketNew< FFXIVIpcCFNotify, ServerZoneIpcType > cfCancelPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( pPlayer->getId() );
cfCancelPacket.data().state1 = 3;
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
queueOutPacket( cfCancelPacket );

View file

@ -139,7 +139,7 @@ void Core::Network::GameConnection::eventHandler( const Packets::GamePacket& inP
GamePacketNew< FFXIVIpcEventLinkshell, ServerZoneIpcType > linkshellEvent( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcEventLinkshell > linkshellEvent( pPlayer->getId() );
linkshellEvent.data().eventId = eventId;
linkshellEvent.data().scene = static_cast< uint8_t >(subEvent);
linkshellEvent.data().param3 = 1;

View file

@ -86,10 +86,12 @@ enum GmCommand
GCRank = 0x0155,
Aetheryte = 0x015E,
Teri = 0x0258,
Kick = 0x025C,
TeriInfo = 0x025D,
Jump = 0x025E,
JumpNpc = 0x025F,
};
void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
{
if( pPlayer->getGmRank() <= 0 )
@ -126,35 +128,85 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
switch( commandId )
{
case GmCommand::Kill:
case GmCommand::Lv:
{
targetActor->takeDamage( 9999999 );
pPlayer->sendNotice( "Killed " + std::to_string( targetActor->getId() ) );
targetPlayer->setLevel( param1 );
pPlayer->sendNotice( "Level for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
break;
}
case GmCommand::QuestSequence:
case GmCommand::Race:
{
targetPlayer->updateQuest( param1, param2 );
targetPlayer->setLookAt( CharaLook::Race, param1 );
pPlayer->sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors();
for ( auto actor : inRange )
{
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
break;
}
case GmCommand::QuestComplete:
case GmCommand::Tribe:
{
targetPlayer->finishQuest( param1 );
targetPlayer->setLookAt( CharaLook::Tribe, param1 );
pPlayer->sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors();
for ( auto actor : inRange )
{
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
break;
}
case GmCommand::QuestAccept:
case GmCommand::Sex:
{
targetPlayer->updateQuest( param1, 1 );
targetPlayer->setLookAt( CharaLook::Gender, param1 );
pPlayer->sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer );
auto inRange = targetActor->getInRangeActors();
for ( auto actor : inRange )
{
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
break;
}
case GmCommand::QuestCancel:
case GmCommand::Time:
{
targetPlayer->removeQuest( param1 );
pPlayer->setEorzeaTimeOffset( param2 );
pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( param2 ) );
break;
}
case GmCommand::QuestIncomplete:
case GmCommand::Weather:
{
targetPlayer->unfinishQuest( param1 );
targetPlayer->getCurrentZone()->setWeatherOverride( param1 );
pPlayer->sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
targetPlayer->getName() + " set in range." );
break;
}
case GmCommand::Call:
{
if ( targetPlayer->getZoneId() != pPlayer->getZoneId() )
targetPlayer->setZone( pPlayer->getZoneId() );
targetPlayer->changePosition( pPlayer->getPos().x, pPlayer->getPos().y, pPlayer->getPos().z,
pPlayer->getRotation() );
pPlayer->sendNotice( "Calling " + targetPlayer->getName() );
break;
}
case GmCommand::Inspect:
{
pPlayer->sendNotice( "Name: " + targetPlayer->getName() +
"\nGil: " + std::to_string( targetPlayer->getCurrency( 1 ) ) +
"\nZone: " + targetPlayer->getCurrentZone()->getName() +
"(" + std::to_string( targetPlayer->getZoneId() ) + ")" +
"\nClass: " + std::to_string( static_cast< uint8_t >( targetPlayer->getClass() ) ) +
"\nLevel: " + std::to_string( targetPlayer->getLevel() ) +
"\nExp: " + std::to_string( targetPlayer->getExp() ) +
"\nSearchMessage: " + targetPlayer->getSearchMessage() +
"\nPlayTime: " + std::to_string( targetPlayer->getPlayTime() ) );
break;
}
case GmCommand::Speed:
@ -163,16 +215,30 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
pPlayer->sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
break;
}
case GmCommand::Gil:
case GmCommand::Kill:
{
targetPlayer->addCurrency( 1, param1 );
pPlayer->sendNotice( "Added " + std::to_string( param1 ) + " Gil for " + targetPlayer->getName() );
targetActor->takeDamage( 9999999 );
pPlayer->sendNotice( "Killed " + std::to_string( targetActor->getId() ) );
break;
}
case GmCommand::Lv:
case GmCommand::Icon:
{
targetPlayer->setLevel( param1 );
pPlayer->sendNotice( "Level for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->setOnlineStatusMask( param1 );
ZoneChannelPacket< FFXIVIpcSetOnlineStatus > statusPacket( targetPlayer->getId() );
statusPacket.data().onlineStatusFlags = param1;
queueOutPacket( statusPacket );
ZoneChannelPacket< FFXIVIpcSetSearchInfo > searchInfoPacket( targetPlayer->getId() );
searchInfoPacket.data().onlineStatusFlags = param1;
searchInfoPacket.data().selectRegion = targetPlayer->getSearchSelectRegion();
strcpy( searchInfoPacket.data().searchMessage, targetPlayer->getSearchMessage() );
targetPlayer->queuePacket( searchInfoPacket );
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatusIcon,
static_cast< uint8_t >( pPlayer->getOnlineStatus() ) ),
true );
pPlayer->sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
break;
}
case GmCommand::Hp:
@ -199,43 +265,37 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
pPlayer->sendNotice( std::to_string( param1 ) + " Exp was added to " + targetPlayer->getName() );
break;
}
case GmCommand::Sex:
case GmCommand::Inv:
{
targetPlayer->setLookAt( CharaLook::Gender, param1 );
pPlayer->sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer );
auto inRange = targetActor->getInRangeActors();
for( auto actor : inRange )
{
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
if ( targetActor->getInvincibilityType() == Common::InvincibilityType::InvincibilityRefill )
targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityNone );
else
targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityRefill );
pPlayer->sendNotice( "Invincibility for " + targetPlayer->getName() +
" was switched." );
break;
}
case GmCommand::Race:
case GmCommand::Orchestrion:
{
targetPlayer->setLookAt( CharaLook::Race, param1 );
pPlayer->sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors();
for( auto actor : inRange )
if ( param1 == 1 )
{
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
break;
}
case GmCommand::Tribe:
{
targetPlayer->setLookAt( CharaLook::Tribe, param1 );
pPlayer->sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors();
for( auto actor : inRange )
{
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
if ( param2 == 0 )
{
for ( uint8_t i = 0; i < 255; i++ )
targetActor->getAsPlayer()->learnSong( i, 0 );
pPlayer->sendNotice( "All Songs for " + targetPlayer->getName() +
" were turned on." );
}
else
{
targetActor->getAsPlayer()->learnSong( param2, 0 );
pPlayer->sendNotice( "Song " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
" was turned on." );
}
}
break;
}
case GmCommand::Item:
@ -255,61 +315,17 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
pPlayer->sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
break;
}
case GmCommand::Time:
case GmCommand::Gil:
{
pPlayer->setEorzeaTimeOffset( param2 );
pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( param2 ) );
break;
}
case GmCommand::Weather:
{
targetPlayer->getCurrentZone()->setWeatherOverride( param1 );
pPlayer->sendNotice( "Weather in Zone \"" + targetPlayer->getCurrentZone()->getName() + "\" of " +
targetPlayer->getName() + " set in range." );
break;
}
case GmCommand::TeriInfo:
{
pPlayer->sendNotice( "ZoneId: " + std::to_string( pPlayer->getZoneId() ) + "\nName: " +
pPlayer->getCurrentZone()->getName() + "\nInternalName: " +
pPlayer->getCurrentZone()->getInternalName() + "\nPopCount: " +
std::to_string( pPlayer->getCurrentZone()->getPopCount() ) +
"\nCurrentWeather:" + std::to_string( pPlayer->getCurrentZone()->getCurrentWeather() ) +
"\nNextWeather:" + std::to_string( pPlayer->getCurrentZone()->getNextWeather() ) );
break;
}
case GmCommand::Teri:
{
auto zoneInfo = g_zoneMgr.getZone( param1 );
if ( !zoneInfo )
{
pPlayer->sendUrgent( "Invalid zone " + std::to_string( param1 ) );
}
else
{
targetPlayer->setPosition( targetPlayer->getPos() );
targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 );
pPlayer->sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName( ) + ")" );
}
break;
}
case GmCommand::Jump:
{
auto inRange = pPlayer->getInRangeActors();
for( auto actor : inRange )
{
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
targetActor->getRotation() );
}
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() + " in range." );
targetPlayer->addCurrency( 1, param1 );
pPlayer->sendNotice( "Added " + std::to_string( param1 ) + " Gil for " + targetPlayer->getName() );
break;
}
case GmCommand::Collect:
{
uint32_t gil = targetPlayer->getCurrency( 1 );
if( gil < param1 )
if ( gil < param1 )
{
pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
}
@ -322,24 +338,29 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
}
break;
}
case GmCommand::Icon:
case GmCommand::QuestAccept:
{
targetPlayer->setOnlineStatusMask( param1 );
GamePacketNew< FFXIVIpcSetOnlineStatus, ServerZoneIpcType > statusPacket( targetPlayer->getId() );
statusPacket.data().onlineStatusFlags = param1;
queueOutPacket( statusPacket );
GamePacketNew< FFXIVIpcSetSearchInfo, ServerZoneIpcType > searchInfoPacket( targetPlayer->getId() );
searchInfoPacket.data().onlineStatusFlags = param1;
searchInfoPacket.data().selectRegion = targetPlayer->getSearchSelectRegion();
strcpy( searchInfoPacket.data().searchMessage, targetPlayer->getSearchMessage() );
targetPlayer->queuePacket( searchInfoPacket );
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatusIcon,
static_cast< uint8_t >( pPlayer->getOnlineStatus() ) ),
true );
pPlayer->sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->updateQuest( param1, 1 );
break;
}
case GmCommand::QuestCancel:
{
targetPlayer->removeQuest( param1 );
break;
}
case GmCommand::QuestComplete:
{
targetPlayer->finishQuest( param1 );
break;
}
case GmCommand::QuestIncomplete:
{
targetPlayer->unfinishQuest( param1 );
break;
}
case GmCommand::QuestSequence:
{
targetPlayer->updateQuest( param1, param2 );
break;
}
case GmCommand::GC:
@ -357,28 +378,17 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
" was set to " + std::to_string( targetPlayer->getGcRankArray()[targetPlayer->getGc() - 1] ) );
break;
}
case GmCommand::Inv:
{
if( targetActor->getInvincibilityType() == Common::InvincibilityType::InvincibilityRefill )
targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityNone );
else
targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityRefill );
pPlayer->sendNotice( "Invincibility for " + targetPlayer->getName() +
" was switched." );
break;
}
case GmCommand::Aetheryte:
{
if( param1 == 0 )
if ( param1 == 0 )
{
if( param2 == 0 )
if ( param2 == 0 )
{
for( uint8_t i = 0; i < 255; i++ )
for ( uint8_t i = 0; i < 255; i++ )
targetActor->getAsPlayer()->registerAetheryte( i );
pPlayer->sendNotice( "All Aetherytes for " + targetPlayer->getName() +
" were turned on." );
" were turned on." );
}
else
{
@ -388,33 +398,46 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
}
}
break;
}
case GmCommand::Orchestrion:
case GmCommand::Teri:
{
if( param1 == 1 )
auto zoneInfo = g_zoneMgr.getZone( param1 );
if ( !zoneInfo )
{
if( param2 == 0 )
{
for( uint8_t i = 0; i < 255; i++ )
targetActor->getAsPlayer()->learnSong( i, 0 );
pPlayer->sendNotice( "All Songs for " + targetPlayer->getName() +
" were turned on." );
}
else
{
targetActor->getAsPlayer()->learnSong( param2, 0 );
pPlayer->sendNotice( "Song " + std::to_string( param2 ) + " for " + targetPlayer->getName() +
" was turned on." );
}
pPlayer->sendUrgent( "Invalid zone " + std::to_string( param1 ) );
}
else
{
targetPlayer->setPosition( targetPlayer->getPos() );
targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 );
pPlayer->sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName( ) + ")" );
}
break;
}
case GmCommand::TeriInfo:
{
pPlayer->sendNotice( "ZoneId: " + std::to_string( pPlayer->getZoneId() ) + "\nName: " +
pPlayer->getCurrentZone()->getName() + "\nInternalName: " +
pPlayer->getCurrentZone()->getInternalName() + "\nPopCount: " +
std::to_string( pPlayer->getCurrentZone()->getPopCount() ) +
"\nCurrentWeather:" + std::to_string( pPlayer->getCurrentZone()->getCurrentWeather() ) +
"\nNextWeather:" + std::to_string( pPlayer->getCurrentZone()->getNextWeather() ) );
break;
}
case GmCommand::Jump:
{
auto inRange = pPlayer->getInRangeActors();
for( auto actor : inRange )
{
pPlayer->changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z,
targetActor->getRotation() );
}
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() + " in range." );
break;
}
default:
pPlayer->sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) );
break;
@ -454,6 +477,7 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
if( !targetActor )
return;
auto targetPlayer = targetActor->getAsPlayer();
switch( commandId )
@ -481,30 +505,6 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() );
break;
}
case GmCommand::Call:
{
if( targetPlayer->getZoneId() != pPlayer->getZoneId() )
targetPlayer->setZone( pPlayer->getZoneId() );
targetPlayer->changePosition( pPlayer->getPos().x, pPlayer->getPos().y, pPlayer->getPos().z,
pPlayer->getRotation() );
pPlayer->sendNotice( "Calling " + targetPlayer->getName() );
break;
}
case GmCommand::Inspect:
{
pPlayer->sendNotice( "Name: " + targetPlayer->getName() +
"\nGil: " + std::to_string( targetPlayer->getCurrency( 1 ) ) +
"\nZone: " + targetPlayer->getCurrentZone()->getName() +
"(" + std::to_string( targetPlayer->getZoneId() ) + ")" +
"\nClass: " + std::to_string( static_cast< uint8_t >( targetPlayer->getClass() ) ) +
"\nLevel: " + std::to_string( targetPlayer->getLevel() ) +
"\nExp: " + std::to_string( targetPlayer->getExp() ) +
"\nSearchMessage: " + targetPlayer->getSearchMessage() +
"\nPlayTime: " + std::to_string( targetPlayer->getPlayTime() ) );
break;
}
default:
pPlayer->sendUrgent( "GM2 Command not implemented: " + std::to_string( commandId ) );
break;

View file

@ -46,7 +46,7 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GameP
uint16_t fromContainer = inPacket.getValAt< uint16_t >( 0x2C );
uint16_t toContainer = inPacket.getValAt< uint16_t >( 0x40 );
GamePacketNew< FFXIVIpcInventoryActionAck, ServerZoneIpcType > ackPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( pPlayer->getId() );
ackPacket.data().sequence = seq;
ackPacket.data().type = 7;
pPlayer->queuePacket( ackPacket );

View file

@ -77,11 +77,11 @@ void Core::Network::GameConnection::setSearchInfoHandler( const Packets::GamePac
// mark player as new adventurer
pPlayer->setNewAdventurer( true );
GamePacketNew< FFXIVIpcSetOnlineStatus, ServerZoneIpcType > statusPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcSetOnlineStatus > statusPacket( pPlayer->getId() );
statusPacket.data().onlineStatusFlags = status;
queueOutPacket( statusPacket );
GamePacketNew< FFXIVIpcSetSearchInfo, ServerZoneIpcType > searchInfoPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcSetSearchInfo > searchInfoPacket( pPlayer->getId() );
searchInfoPacket.data().onlineStatusFlags = status;
searchInfoPacket.data().selectRegion = pPlayer->getSearchSelectRegion();
strcpy( searchInfoPacket.data().searchMessage, pPlayer->getSearchMessage() );
@ -95,7 +95,7 @@ void Core::Network::GameConnection::setSearchInfoHandler( const Packets::GamePac
void Core::Network::GameConnection::reqSearchInfoHandler( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer )
{
GamePacketNew< FFXIVIpcInitSearchInfo, ServerZoneIpcType > searchInfoPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcInitSearchInfo > searchInfoPacket( pPlayer->getId() );
searchInfoPacket.data().onlineStatusFlags = pPlayer->getOnlineStatusMask();
searchInfoPacket.data().selectRegion = pPlayer->getSearchSelectRegion();
strcpy( searchInfoPacket.data().searchMessage, pPlayer->getSearchMessage() );
@ -105,7 +105,7 @@ void Core::Network::GameConnection::reqSearchInfoHandler( const Packets::GamePac
void Core::Network::GameConnection::linkshellListHandler( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer )
{
GamePacketNew< FFXIVIpcLinkshellList, ServerZoneIpcType > linkshellListPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcLinkshellList > linkshellListPacket( pPlayer->getId() );
queueOutPacket( linkshellListPacket );
}
@ -311,7 +311,7 @@ void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket&
targetZone = pLine->getTargetZoneId();
rotation = pLine->getTargetRotation();
GamePacketNew< FFXIVIpcPrepareZoning, ServerZoneIpcType > preparePacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcPrepareZoning > preparePacket( pPlayer->getId() );
preparePacket.data().targetZone = targetZone;
//ActorControlPacket143 controlPacket( pPlayer, ActorControlType::DespawnZoneScreenMsg,
@ -347,7 +347,7 @@ void Core::Network::GameConnection::discoveryHandler( const Packets::GamePacket&
return;
}
GamePacketNew< FFXIVIpcDiscovery, ServerZoneIpcType > discoveryPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcDiscovery > discoveryPacket( pPlayer->getId() );
discoveryPacket.data().map_id = pQR->getUInt( 2 );
discoveryPacket.data().map_part_id = pQR->getUInt( 3 );
@ -362,7 +362,7 @@ void Core::Network::GameConnection::discoveryHandler( const Packets::GamePacket&
void Core::Network::GameConnection::playTimeHandler( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer )
{
GamePacketNew< FFXIVIpcPlayTime, ServerZoneIpcType > playTimePacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcPlayTime > playTimePacket( pPlayer->getId() );
playTimePacket.data().playTimeInMinutes = pPlayer->getPlayTime() / 60;
pPlayer->queuePacket( playTimePacket );
}
@ -383,7 +383,7 @@ void Core::Network::GameConnection::blackListHandler( const Packets::GamePacket&
{
uint8_t count = inPacket.getValAt< uint8_t >( 0x21 );
GamePacketNew< FFXIVIpcBlackList, ServerZoneIpcType > blackListPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcBlackList > blackListPacket( pPlayer->getId() );
blackListPacket.data().sequence = count;
// TODO: Fill with actual blacklist data
//blackListPacket.data().entry[0].contentId = 1;
@ -435,7 +435,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
if( type == 0x02 )
{ // party list
GamePacketNew< FFXIVIpcSocialList, ServerZoneIpcType > listPacket( pPlayer->getId() );;
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( pPlayer->getId() );;
listPacket.data().type = 2;
listPacket.data().sequence = count;
@ -469,7 +469,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
else if( type == 0x0b )
{ // friend list
GamePacketNew< FFXIVIpcSocialList, ServerZoneIpcType > listPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( pPlayer->getId() );
listPacket.data().type = 0x0B;
listPacket.data().sequence = count;
memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) );
@ -535,7 +535,7 @@ void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPa
void Core::Network::GameConnection::logoutHandler( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer )
{
GamePacketNew< FFXIVIpcLogout, ServerZoneIpcType > logoutPacket( pPlayer->getId() );
ZoneChannelPacket< FFXIVIpcLogout > logoutPacket( pPlayer->getId() );
logoutPacket.data().flags1 = 0x02;
logoutPacket.data().flags2 = 0x2000;
queueOutPacket( logoutPacket );

View file

@ -14,7 +14,7 @@ namespace Server {
* @brief The Ping response packet.
*/
class ActorControlPacket142 :
public GamePacketNew< FFXIVIpcActorControl142, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcActorControl142 >
{
public:
ActorControlPacket142( uint32_t actorId,
@ -24,7 +24,7 @@ public:
uint32_t param3 = 0,
uint32_t param4 = 0,
uint32_t padding1 = 0 ) :
GamePacketNew< FFXIVIpcActorControl142, ServerZoneIpcType >( actorId, actorId )
ZoneChannelPacket< FFXIVIpcActorControl142 >( actorId, actorId )
{
initialize( category, param1, param2, param3, param4 );
};

View file

@ -15,7 +15,7 @@ namespace Server {
* @brief The Ping response packet.
*/
class ActorControlPacket143 :
public GamePacketNew< FFXIVIpcActorControl143, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcActorControl143 >
{
public:
ActorControlPacket143( uint32_t actorId,
@ -26,7 +26,7 @@ public:
uint32_t param4 = 0,
uint32_t param5 = 0,
uint32_t padding1 = 0 ) :
GamePacketNew< FFXIVIpcActorControl143, ServerZoneIpcType >( actorId, actorId )
ZoneChannelPacket< FFXIVIpcActorControl143 >( actorId, actorId )
{
initialize( category, param1, param2, param3, param4, param5 );
};

View file

@ -13,7 +13,7 @@ namespace Server {
* @brief The Ping response packet.
*/
class ActorControlPacket144 :
public GamePacketNew< FFXIVIpcActorControl144, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcActorControl144 >
{
public:
ActorControlPacket144( uint32_t actorId,
@ -24,7 +24,7 @@ public:
uint32_t param4 = 0,
uint64_t targetId = 0,
uint32_t padding1 = 0 ) :
GamePacketNew< FFXIVIpcActorControl144, ServerZoneIpcType >( actorId, actorId )
ZoneChannelPacket< FFXIVIpcActorControl144 >( actorId, actorId )
{
initialize( category, param1, param2, param3, param4, targetId );
};

View file

@ -15,11 +15,11 @@ namespace Server {
* @brief The Chat packet.
*/
class ChatPacket :
public GamePacketNew< FFXIVIpcChat, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcChat >
{
public:
ChatPacket( Entity::PlayerPtr player, Common::ChatType chatType, const std::string& msg ) :
GamePacketNew< FFXIVIpcChat, ServerZoneIpcType >( player->getId(), player->getId() )
ZoneChannelPacket< FFXIVIpcChat >( player->getId(), player->getId() )
{
initialize( player, chatType, msg );
};

View file

@ -11,14 +11,14 @@ namespace Server {
/**
* @brief The packet sent to finish an event.
*/
class EventFinishPacket : public GamePacketNew< FFXIVIpcEventFinish, ServerZoneIpcType >
class EventFinishPacket : public ZoneChannelPacket< FFXIVIpcEventFinish >
{
public:
EventFinishPacket( uint32_t playerId,
uint32_t eventId,
uint8_t param1,
uint32_t param3 ) :
GamePacketNew< FFXIVIpcEventFinish, ServerZoneIpcType >( playerId, playerId )
ZoneChannelPacket< FFXIVIpcEventFinish >( playerId, playerId )
{
initialize( eventId, param1, param3 );
};

View file

@ -12,7 +12,7 @@ namespace Server {
/**
* @brief The packet sent to play an event.
*/
class EventPlayPacket : public GamePacketNew< FFXIVIpcEventPlay, ServerZoneIpcType >
class EventPlayPacket : public ZoneChannelPacket< FFXIVIpcEventPlay >
{
public:
EventPlayPacket( uint32_t playerId,
@ -23,7 +23,7 @@ public:
uint8_t param3,
uint32_t param4 = 0,
uint32_t param5 = 0 ) :
GamePacketNew< FFXIVIpcEventPlay, ServerZoneIpcType >( playerId, playerId )
ZoneChannelPacket< FFXIVIpcEventPlay >( playerId, playerId )
{
initialize( actorId, eventId, scene, flags, param3, param4, param5 );
};

View file

@ -12,7 +12,7 @@ namespace Server {
/**
* @brief The packet sent to start an event.
*/
class EventStartPacket : public GamePacketNew< FFXIVIpcEventStart, ServerZoneIpcType >
class EventStartPacket : public ZoneChannelPacket< FFXIVIpcEventStart >
{
public:
EventStartPacket( uint32_t playerId,
@ -21,7 +21,7 @@ public:
uint8_t param1 = 0,
uint8_t param2 = 0,
uint32_t param3 = 0 ) :
GamePacketNew< FFXIVIpcEventStart, ServerZoneIpcType >( playerId, playerId )
ZoneChannelPacket< FFXIVIpcEventStart >( playerId, playerId )
{
initialize( actorId, eventId, param1, param2, param3 );
};

View file

@ -15,11 +15,11 @@ namespace Server {
* @brief The Client UI Initialization packet. This must be sent to the client
* once upon connection to configure the UI.
*/
class InitUIPacket : public GamePacketNew< FFXIVIpcInitUI, ServerZoneIpcType >
class InitUIPacket : public ZoneChannelPacket< FFXIVIpcInitUI >
{
public:
InitUIPacket( Entity::PlayerPtr player ) :
GamePacketNew< FFXIVIpcInitUI, ServerZoneIpcType >( player->getId(), player->getId() )
ZoneChannelPacket< FFXIVIpcInitUI >( player->getId(), player->getId() )
{
initialize( player );
};

View file

@ -14,11 +14,11 @@ namespace Server {
* @brief The update model packet.
*/
class ModelEquipPacket :
public GamePacketNew< FFXIVIpcModelEquip, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcModelEquip >
{
public:
ModelEquipPacket( Entity::PlayerPtr player ) :
GamePacketNew< FFXIVIpcModelEquip, ServerZoneIpcType >( player->getId(), player->getId() )
ZoneChannelPacket< FFXIVIpcModelEquip >( player->getId(), player->getId() )
{
initialize( player );
};

View file

@ -18,11 +18,11 @@ namespace Server {
* once upon connection to configure the UI.
*/
class MoveActorPacket :
public GamePacketNew< FFXIVIpcActorMove, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcActorMove >
{
public:
MoveActorPacket( Entity::ActorPtr actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) :
GamePacketNew< FFXIVIpcActorMove, ServerZoneIpcType >( actor->getId(), actor->getId() )
ZoneChannelPacket< FFXIVIpcActorMove >( actor->getId(), actor->getId() )
{
initialize( actor, unk1, unk2, unk3, unk4 );
};

View file

@ -14,11 +14,11 @@ namespace Server {
* @brief The Ping response packet.
*/
class PingPacket :
public GamePacketNew< FFXIVIpcPing, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcPing >
{
public:
PingPacket( Entity::PlayerPtr player, int32_t inVal ) :
GamePacketNew< FFXIVIpcPing, ServerZoneIpcType >( player->getId(), player->getId() )
ZoneChannelPacket< FFXIVIpcPing >( player->getId(), player->getId() )
{
initialize( player, inVal );
};

View file

@ -72,7 +72,7 @@ namespace Server {
m_data.title = pPlayer->getTitle();
m_data.voice = pPlayer->getVoiceId();
m_data.currentMount = 0;
m_data.currentMount = pPlayer->getCurrentMount();
m_data.onlineStatus = static_cast< uint8_t >( pPlayer->getOnlineStatus() );

View file

@ -14,17 +14,17 @@ namespace Server {
* @brief Packet sent to set a players state, this impacts which actions he can perform.
*/
class PlayerStateFlagsPacket :
public GamePacketNew< FFXIVIpcPlayerStateFlags, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcPlayerStateFlags >
{
public:
PlayerStateFlagsPacket( Entity::PlayerPtr pActor ) :
GamePacketNew< FFXIVIpcPlayerStateFlags, ServerZoneIpcType >( pActor->getId(), pActor->getId() )
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( pActor->getId(), pActor->getId() )
{
initialize( pActor->getStateFlags() );
}
PlayerStateFlagsPacket( Entity::PlayerPtr pActor, std::vector< Common::PlayerStateFlag > flags ) :
GamePacketNew< FFXIVIpcPlayerStateFlags, ServerZoneIpcType >( pActor->getId(), pActor->getId() )
ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( pActor->getId(), pActor->getId() )
{
uint8_t newFlags[7];
memset( newFlags, 0, 7 );

View file

@ -14,12 +14,12 @@ namespace Server {
* @brief Packet to display a quest specific info message.
*/
class QuestMessagePacket :
public GamePacketNew< FFXIVIpcQuestMessage, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcQuestMessage >
{
public:
QuestMessagePacket( Entity::ActorPtr pActor, uint32_t questId, int8_t msgId,
uint8_t type = 0, uint32_t var1 = 0, uint32_t var2 = 0 ) :
GamePacketNew< FFXIVIpcQuestMessage, ServerZoneIpcType >( pActor->getId(), pActor->getId() )
ZoneChannelPacket< FFXIVIpcQuestMessage >( pActor->getId(), pActor->getId() )
{
initialize( questId, msgId, type, var1, var2 );
};

View file

@ -14,11 +14,11 @@ namespace Server {
* @brief The Ping response packet.
*/
class ServerNoticePacket :
public GamePacketNew<FFXIVIpcServerNotice, ServerZoneIpcType>
public ZoneChannelPacket< FFXIVIpcServerNotice >
{
public:
ServerNoticePacket( uint32_t playerId, const std::string& message ) :
GamePacketNew<FFXIVIpcServerNotice, ServerZoneIpcType>( playerId, playerId )
ZoneChannelPacket< FFXIVIpcServerNotice >( playerId, playerId )
{
initialize( message );
};

View file

@ -2,6 +2,7 @@
#define _UPDATEHPMPTP_H
#include <src/servers/Server_Common/Network/GamePacketNew.h>
#include <src/servers/Server_Zone/Actor/Actor.h>
#include "src/servers/Server_Zone/Forwards.h"
namespace Core {
@ -13,11 +14,11 @@ namespace Server {
* @brief The Ping response packet.
*/
class UpdateHpMpTpPacket :
public GamePacketNew< FFXIVIpcUpdateHpMpTp, ServerZoneIpcType >
public ZoneChannelPacket< FFXIVIpcUpdateHpMpTp >
{
public:
UpdateHpMpTpPacket( Entity::ActorPtr pActor ) :
GamePacketNew< FFXIVIpcUpdateHpMpTp, ServerZoneIpcType >( pActor->getId(), pActor->getId() )
ZoneChannelPacket< FFXIVIpcUpdateHpMpTp >( pActor->getId(), pActor->getId() )
{
initialize( pActor );
};

View file

@ -44,7 +44,8 @@ Core::Db::DbWorkerPool< Core::Db::CharaDbConnection > g_charaDb;
Core::ServerZone::ServerZone( const std::string& configPath )
: m_configPath( configPath ),
m_bRunning( true )
m_bRunning( true ),
m_lastDBPingTime( 0 )
{
m_pConfig = XMLConfigPtr( new XMLConfig );
}
@ -272,6 +273,12 @@ void Core::ServerZone::mainLoop()
}
}
if( currTime - m_lastDBPingTime > 3 )
{
g_charaDb.keepAlive();
m_lastDBPingTime = currTime;
}
auto it = this->m_sessionMap.begin();
for( ; it != this->m_sessionMap.end(); )

View file

@ -51,6 +51,7 @@ namespace Core {
uint16_t m_port;
std::string m_ip;
uint32_t m_lastDBPingTime;
bool m_bRunning;

View file

@ -56,7 +56,7 @@ void Core::StatusEffect::StatusEffectContainer::addStatusEffect( StatusEffectPtr
pEffect->applyStatus();
m_effectMap[nextSlot] = pEffect;
GamePacketNew< Server::FFXIVIpcAddStatusEffect, ServerZoneIpcType > statusEffectAdd( m_pOwner->getId() );
ZoneChannelPacket< Server::FFXIVIpcAddStatusEffect > statusEffectAdd( m_pOwner->getId() );
statusEffectAdd.data().actor_id = pEffect->getTargetActorId();
statusEffectAdd.data().actor_id1 = pEffect->getSrcActorId();
statusEffectAdd.data().current_hp = m_pOwner->getHp();
@ -117,7 +117,7 @@ void Core::StatusEffect::StatusEffectContainer::sendUpdate()
{
uint64_t currentTimeMs = Util::getTimeMs();
GamePacketNew< Server::FFXIVIpcStatusEffectList, ServerZoneIpcType > statusEffectList( m_pOwner->getId() );
ZoneChannelPacket< Server::FFXIVIpcStatusEffectList > statusEffectList( m_pOwner->getId() );
statusEffectList.data().current_hp = m_pOwner->getHp();
statusEffectList.data().current_mp = m_pOwner->getMp();

View file

@ -517,8 +517,7 @@ bool Zone::runZoneLogic()
if( changedWeather )
{
Network::Packets::GamePacketNew< Network::Packets::Server::FFXIVIpcWeatherChange,
Network::Packets::ServerZoneIpcType >
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcWeatherChange >
weatherChangePacket( pSession->getPlayer()->getId() );
weatherChangePacket.data().weatherId = m_currentWeather;
weatherChangePacket.data().delay = 5.0f;