mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-07 19:27:45 +00:00
Sql updates now happen on a timer per player instead of controlled by flags
This commit is contained in:
parent
8cdb70cf31
commit
ac0a935885
14 changed files with 87 additions and 268 deletions
|
@ -275,35 +275,6 @@ namespace Core {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PlayerSyncFlags : uint32_t
|
|
||||||
{
|
|
||||||
None = 0x00000000,
|
|
||||||
Position = 0x00000001, // x,y,z,zone
|
|
||||||
Status = 0x00000002, // hp,mp,tp,class
|
|
||||||
Look = 0x00000004, // models to display
|
|
||||||
ExpLevel = 0x00000008, // exp,level
|
|
||||||
Quests = 0x00000010, // quest status
|
|
||||||
Achievements = 0x00000020, // achievements
|
|
||||||
Discovery = 0x00000040, // Discovered places
|
|
||||||
Aetherytes = 0x00000080, // Attuned aetherytes
|
|
||||||
HomePoint = 0x00000100, // Current homepoint
|
|
||||||
HowTo = 0x00000200,
|
|
||||||
|
|
||||||
HpMp = 0x00000800,
|
|
||||||
QuestTracker = 0x00001000,
|
|
||||||
NewGame = 0x00002000,
|
|
||||||
OpeningSeq = 0x00004000,
|
|
||||||
Unlocks = 0x00008000,
|
|
||||||
PlayTime = 0x00010000,
|
|
||||||
NewAdventurer = 0x00020000,
|
|
||||||
SearchInfo = 0x00040000,
|
|
||||||
GC = 0x00080000,
|
|
||||||
|
|
||||||
CFPenaltyTime = 0x00100000,
|
|
||||||
|
|
||||||
All = 0xFFFFFFFF,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structural representation of the packet sent by the server
|
* Structural representation of the packet sent by the server
|
||||||
* Send the entire StatusEffect list
|
* Send the entire StatusEffect list
|
||||||
|
|
|
@ -29,10 +29,7 @@ uint64_t Core::Util::getTimeSeconds()
|
||||||
|
|
||||||
uint64_t Core::Util::getEorzeanTimeStamp()
|
uint64_t Core::Util::getEorzeanTimeStamp()
|
||||||
{
|
{
|
||||||
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
|
return static_cast< uint64_t >( getTimeSeconds() * 20.571428571428573f );
|
||||||
auto now = std::chrono::time_point_cast< std::chrono::seconds >( t1 ).time_since_epoch().count();
|
|
||||||
|
|
||||||
return static_cast< uint64_t >( now * 20.571428571428573f );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Util::valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex )
|
void Core::Util::valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex )
|
||||||
|
|
|
@ -379,9 +379,6 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
|
||||||
m_pCurrentZone = pZone;
|
m_pCurrentZone = pZone;
|
||||||
m_pCurrentZone->pushActor( shared_from_this() );
|
m_pCurrentZone->pushActor( shared_from_this() );
|
||||||
|
|
||||||
// mark the player for a position update in DB
|
|
||||||
setSyncFlag( PlayerSyncFlags::Position );
|
|
||||||
|
|
||||||
GamePacketNew< FFXIVIpcInit, ServerZoneIpcType > initPacket( getId() );
|
GamePacketNew< FFXIVIpcInit, ServerZoneIpcType > initPacket( getId() );
|
||||||
initPacket.data().charId = getId();
|
initPacket.data().charId = getId();
|
||||||
queuePacket( initPacket );
|
queuePacket( initPacket );
|
||||||
|
@ -501,9 +498,6 @@ void Core::Entity::Player::registerAetheryte( uint8_t aetheryteId )
|
||||||
Util::valueToFlagByteIndexValue( aetheryteId, value, index );
|
Util::valueToFlagByteIndexValue( aetheryteId, value, index );
|
||||||
|
|
||||||
m_aetheryte[index] |= value;
|
m_aetheryte[index] |= value;
|
||||||
|
|
||||||
setSyncFlag( Aetherytes );
|
|
||||||
|
|
||||||
queuePacket( ActorControlPacket143( getId(), LearnTeleport, aetheryteId, 1 ) );
|
queuePacket( ActorControlPacket143( getId(), LearnTeleport, aetheryteId, 1 ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -544,8 +538,6 @@ void Core::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
||||||
|
|
||||||
m_discovery[index] |= value;
|
m_discovery[index] |= value;
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::Discovery );
|
|
||||||
|
|
||||||
uint16_t level = getLevel();
|
uint16_t level = getLevel();
|
||||||
|
|
||||||
uint32_t exp = ( g_exdData.m_paramGrowthInfoMap[level].needed_exp * 5 / 100 );
|
uint32_t exp = ( g_exdData.m_paramGrowthInfoMap[level].needed_exp * 5 / 100 );
|
||||||
|
@ -573,13 +565,11 @@ void Core::Entity::Player::setNewAdventurer( bool state )
|
||||||
//}
|
//}
|
||||||
sendStateFlags();
|
sendStateFlags();
|
||||||
m_bNewAdventurer = state;
|
m_bNewAdventurer = state;
|
||||||
setSyncFlag( PlayerSyncFlags::NewAdventurer );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::resetDiscovery()
|
void Core::Entity::Player::resetDiscovery()
|
||||||
{
|
{
|
||||||
memset( m_discovery, 0, sizeof( m_discovery ) );
|
memset( m_discovery, 0, sizeof( m_discovery ) );
|
||||||
setSyncFlag( PlayerSyncFlags::Discovery );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::changePosition( float x, float y, float z, float o )
|
void Core::Entity::Player::changePosition( float x, float y, float z, float o )
|
||||||
|
@ -599,7 +589,6 @@ void Core::Entity::Player::learnAction( uint8_t actionId )
|
||||||
|
|
||||||
m_unlocks[index] |= value;
|
m_unlocks[index] |= value;
|
||||||
|
|
||||||
setSyncFlag( Unlocks );
|
|
||||||
queuePacket( ActorControlPacket143( getId(), ToggleActionUnlock, actionId, 1 ) );
|
queuePacket( ActorControlPacket143( getId(), ToggleActionUnlock, actionId, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,7 +637,6 @@ void Core::Entity::Player::gainExp( uint32_t amount )
|
||||||
}
|
}
|
||||||
|
|
||||||
sendStatusUpdate();
|
sendStatusUpdate();
|
||||||
setSyncFlag( PlayerSyncFlags::ExpLevel );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::gainLevel()
|
void Core::Entity::Player::gainLevel()
|
||||||
|
@ -774,7 +762,6 @@ void Core::Entity::Player::setClassJob( Core::Common::ClassJob classJob )
|
||||||
|
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), ClassJobChange, 0x04 ), true );
|
sendToInRangeSet( ActorControlPacket142( getId(), ClassJobChange, 0x04 ), true );
|
||||||
|
|
||||||
setSyncFlag( Status );
|
|
||||||
sendStatusUpdate( true );
|
sendStatusUpdate( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,16 +769,12 @@ void Core::Entity::Player::setLevel( uint8_t level )
|
||||||
{
|
{
|
||||||
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
|
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
|
||||||
m_classArray[classJobIndex] = level;
|
m_classArray[classJobIndex] = level;
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::ExpLevel );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setLevelForClass( uint8_t level, Core::Common::ClassJob classjob )
|
void Core::Entity::Player::setLevelForClass( uint8_t level, Core::Common::ClassJob classjob )
|
||||||
{
|
{
|
||||||
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( classjob )].exp_idx;
|
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( classjob )].exp_idx;
|
||||||
m_classArray[classJobIndex] = level;
|
m_classArray[classJobIndex] = level;
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::ExpLevel );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::sendModel()
|
void Core::Entity::Player::sendModel()
|
||||||
|
@ -808,7 +791,6 @@ uint32_t Core::Entity::Player::getModelForSlot( Inventory::EquipSlot slot )
|
||||||
void Core::Entity::Player::setModelForSlot( Inventory::EquipSlot slot, uint32_t val )
|
void Core::Entity::Player::setModelForSlot( Inventory::EquipSlot slot, uint32_t val )
|
||||||
{
|
{
|
||||||
m_modelEquip[slot] = val;
|
m_modelEquip[slot] = val;
|
||||||
setSyncFlag( PlayerSyncFlags::Status );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Core::Entity::Player::getModelMainWeapon() const
|
uint64_t Core::Entity::Player::getModelMainWeapon() const
|
||||||
|
@ -856,7 +838,6 @@ uint8_t Core::Entity::Player::getLookAt( uint8_t index ) const
|
||||||
void Core::Entity::Player::setLookAt( uint8_t index, uint8_t value )
|
void Core::Entity::Player::setLookAt( uint8_t index, uint8_t value )
|
||||||
{
|
{
|
||||||
m_customize[index] = value;
|
m_customize[index] = value;
|
||||||
setSyncFlag( PlayerSyncFlags::Look );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// spawn this player for pTarget
|
// spawn this player for pTarget
|
||||||
|
@ -920,8 +901,6 @@ void Core::Entity::Player::setGc( uint8_t gc )
|
||||||
gcAffPacket.data().gcRank[1] = m_gcRank[1];
|
gcAffPacket.data().gcRank[1] = m_gcRank[1];
|
||||||
gcAffPacket.data().gcRank[2] = m_gcRank[2];
|
gcAffPacket.data().gcRank[2] = m_gcRank[2];
|
||||||
queuePacket( gcAffPacket );
|
queuePacket( gcAffPacket );
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::GC );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setGcRankAt( uint8_t index, uint8_t rank )
|
void Core::Entity::Player::setGcRankAt( uint8_t index, uint8_t rank )
|
||||||
|
@ -934,8 +913,6 @@ void Core::Entity::Player::setGcRankAt( uint8_t index, uint8_t rank )
|
||||||
gcAffPacket.data().gcRank[1] = m_gcRank[1];
|
gcAffPacket.data().gcRank[1] = m_gcRank[1];
|
||||||
gcAffPacket.data().gcRank[2] = m_gcRank[2];
|
gcAffPacket.data().gcRank[2] = m_gcRank[2];
|
||||||
queuePacket( gcAffPacket );
|
queuePacket( gcAffPacket );
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::GC );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t* Core::Entity::Player::getStateFlags() const
|
const uint8_t* Core::Entity::Player::getStateFlags() const
|
||||||
|
@ -1039,10 +1016,7 @@ void Core::Entity::Player::update( int64_t currTime )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_hp <= 0 && m_status != ActorStatus::Dead )
|
if( m_hp <= 0 && m_status != ActorStatus::Dead )
|
||||||
{
|
|
||||||
die();
|
die();
|
||||||
setSyncFlag( PlayerSyncFlags::Status );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isAlive() )
|
if( !isAlive() )
|
||||||
return;
|
return;
|
||||||
|
@ -1093,14 +1067,9 @@ void Core::Entity::Player::update( int64_t currTime )
|
||||||
{
|
{
|
||||||
// add 3 seconds to total play time
|
// add 3 seconds to total play time
|
||||||
m_playTime += 3;
|
m_playTime += 3;
|
||||||
setSyncFlag( PlayerSyncFlags::PlayTime );
|
|
||||||
|
|
||||||
m_lastTickTime = currTime;
|
m_lastTickTime = currTime;
|
||||||
onTick();
|
onTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
createUpdateSql();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::onMobKill( uint16_t nameId )
|
void Core::Entity::Player::onMobKill( uint16_t nameId )
|
||||||
|
@ -1121,11 +1090,6 @@ void Core::Entity::Player::freePlayerSpawnId( uint32_t actorId )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setSyncFlag( uint32_t updateFlag )
|
|
||||||
{
|
|
||||||
m_updateFlags |= updateFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t * Core::Entity::Player::getAetheryteArray()
|
uint8_t * Core::Entity::Player::getAetheryteArray()
|
||||||
{
|
{
|
||||||
return m_aetheryte;
|
return m_aetheryte;
|
||||||
|
@ -1137,8 +1101,6 @@ void Core::Entity::Player::setHomepoint( uint8_t aetheryteId )
|
||||||
m_homePoint = aetheryteId;
|
m_homePoint = aetheryteId;
|
||||||
|
|
||||||
queuePacket( ActorControlPacket143( getId(), SetHomepoint, aetheryteId ) );
|
queuePacket( ActorControlPacket143( getId(), SetHomepoint, aetheryteId ) );
|
||||||
|
|
||||||
setSyncFlag( HomePoint );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! get homepoint */
|
/*! get homepoint */
|
||||||
|
@ -1254,9 +1216,6 @@ void Core::Entity::Player::performZoning(uint16_t zoneId, const Common::FFXIVARR
|
||||||
m_zoneId = zoneId;
|
m_zoneId = zoneId;
|
||||||
m_bMarkedForZoning = true;
|
m_bMarkedForZoning = true;
|
||||||
setRotation( rotation );
|
setRotation( rotation );
|
||||||
|
|
||||||
// mark the player for a position update in DB
|
|
||||||
setSyncFlag( PlayerSyncFlags::Position );
|
|
||||||
setZone( zoneId );
|
setZone( zoneId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1281,8 +1240,6 @@ void Core::Entity::Player::setSearchInfo( uint8_t selectRegion, uint8_t selectCl
|
||||||
m_searchSelectClass = selectClass;
|
m_searchSelectClass = selectClass;
|
||||||
memset( &m_searchMessage[0], 0, sizeof( searchMessage ) );
|
memset( &m_searchMessage[0], 0, sizeof( searchMessage ) );
|
||||||
strcpy( &m_searchMessage[0], searchMessage );
|
strcpy( &m_searchMessage[0], searchMessage );
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::SearchInfo );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Core::Entity::Player::getSearchMessage() const
|
const char* Core::Entity::Player::getSearchMessage() const
|
||||||
|
@ -1323,8 +1280,6 @@ void Core::Entity::Player::updateHowtosSeen( uint32_t howToId )
|
||||||
uint8_t value = 1 << bitIndex;
|
uint8_t value = 1 << bitIndex;
|
||||||
|
|
||||||
m_howTo[index] |= value;
|
m_howTo[index] |= value;
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::HowTo );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1486,7 +1441,6 @@ uint32_t Core::Entity::Player::getCFPenaltyTimestamp() const
|
||||||
void Core::Entity::Player::setCFPenaltyTimestamp( uint32_t timestamp )
|
void Core::Entity::Player::setCFPenaltyTimestamp( uint32_t timestamp )
|
||||||
{
|
{
|
||||||
m_cfPenaltyUntil = timestamp;
|
m_cfPenaltyUntil = timestamp;
|
||||||
setSyncFlag( PlayerSyncFlags::CFPenaltyTime );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Core::Entity::Player::getCFPenaltyMinutes() const
|
uint32_t Core::Entity::Player::getCFPenaltyMinutes() const
|
||||||
|
@ -1515,7 +1469,6 @@ uint8_t Core::Entity::Player::getOpeningSequence() const
|
||||||
|
|
||||||
void Core::Entity::Player::setOpeningSequence( uint8_t seq )
|
void Core::Entity::Player::setOpeningSequence( uint8_t seq )
|
||||||
{
|
{
|
||||||
setSyncFlag( OpeningSeq );
|
|
||||||
m_openingSequence = seq;
|
m_openingSequence = seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -409,9 +409,7 @@ public:
|
||||||
// Player Database Handling
|
// Player Database Handling
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/*! generate the update sql based on update flags */
|
/*! generate the update sql based on update flags */
|
||||||
void createUpdateSql();
|
void updateSql();
|
||||||
/*! set an update flag */
|
|
||||||
void setSyncFlag( uint32_t updateFlag );
|
|
||||||
/*! load player from db, by id */
|
/*! load player from db, by id */
|
||||||
bool load( uint32_t charId, SessionPtr pSession );
|
bool load( uint32_t charId, SessionPtr pSession );
|
||||||
/*! load active class data */
|
/*! load active class data */
|
||||||
|
@ -606,7 +604,6 @@ private:
|
||||||
Common::ZoneingType m_zoningType;
|
Common::ZoneingType m_zoningType;
|
||||||
|
|
||||||
bool m_bMarkedForZoning;
|
bool m_bMarkedForZoning;
|
||||||
uint32_t m_updateFlags;
|
|
||||||
bool m_bNewAdventurer;
|
bool m_bNewAdventurer;
|
||||||
uint64_t m_onlineStatus;
|
uint64_t m_onlineStatus;
|
||||||
boost::shared_ptr< QueuedZoning > m_queuedZoneing;
|
boost::shared_ptr< QueuedZoning > m_queuedZoneing;
|
||||||
|
|
|
@ -356,8 +356,5 @@ void Core::Entity::Player::onTick()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sendUpdate )
|
if( sendUpdate )
|
||||||
{
|
|
||||||
sendStatusUpdate();
|
sendStatusUpdate();
|
||||||
setSyncFlag( PlayerSyncFlags::Status );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,8 +91,6 @@ void Core::Entity::Player::finishQuest( uint16_t questId )
|
||||||
queuePacket( questFinishPacket );
|
queuePacket( questFinishPacket );
|
||||||
|
|
||||||
updateQuestsCompleted( questId );
|
updateQuestsCompleted( questId );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
setSyncFlag( PlayerSyncFlags::QuestTracker );
|
|
||||||
|
|
||||||
for( int32_t ii = 0; ii < 5; ii++ )
|
for( int32_t ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
|
@ -116,7 +114,6 @@ void Core::Entity::Player::finishQuest( uint16_t questId )
|
||||||
void Core::Entity::Player::unfinishQuest( uint16_t questId )
|
void Core::Entity::Player::unfinishQuest( uint16_t questId )
|
||||||
{
|
{
|
||||||
removeQuestsCompleted( questId );
|
removeQuestsCompleted( questId );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
sendQuestInfo();
|
sendQuestInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,9 +137,6 @@ void Core::Entity::Player::removeQuest( uint16_t questId )
|
||||||
questFinishPacket.data().flag2 = 1;
|
questFinishPacket.data().flag2 = 1;
|
||||||
queuePacket( questFinishPacket );
|
queuePacket( questFinishPacket );
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
setSyncFlag( PlayerSyncFlags::QuestTracker );
|
|
||||||
|
|
||||||
for( int32_t ii = 0; ii < 5; ii++ )
|
for( int32_t ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
if( m_questTracking[ii] == idx )
|
if( m_questTracking[ii] == idx )
|
||||||
|
@ -550,7 +544,6 @@ void Core::Entity::Player::setQuestUI8A( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->c.UI8A = val;
|
pNewQuest->c.UI8A = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,7 +558,6 @@ void Core::Entity::Player::setQuestUI8B( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->c.UI8B = val;
|
pNewQuest->c.UI8B = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +572,6 @@ void Core::Entity::Player::setQuestUI8C( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->c.UI8C = val;
|
pNewQuest->c.UI8C = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,7 +586,6 @@ void Core::Entity::Player::setQuestUI8D( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->c.UI8D = val;
|
pNewQuest->c.UI8D = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +600,6 @@ void Core::Entity::Player::setQuestUI8E( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->c.UI8E = val;
|
pNewQuest->c.UI8E = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +614,6 @@ void Core::Entity::Player::setQuestUI8F( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->c.UI8F = val;
|
pNewQuest->c.UI8F = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,7 +628,6 @@ void Core::Entity::Player::setQuestUI8AH( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8AH = val;
|
pNewQuest->b.UI8AH = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +642,6 @@ void Core::Entity::Player::setQuestUI8BH( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8BH = val;
|
pNewQuest->b.UI8BH = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,7 +656,6 @@ void Core::Entity::Player::setQuestUI8CH( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8CH = val;
|
pNewQuest->b.UI8CH = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +670,6 @@ void Core::Entity::Player::setQuestUI8DH( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8DH = val;
|
pNewQuest->b.UI8DH = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,7 +684,6 @@ void Core::Entity::Player::setQuestUI8EH( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8EH = val;
|
pNewQuest->b.UI8EH = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,7 +698,6 @@ void Core::Entity::Player::setQuestUI8FH( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8FH = val;
|
pNewQuest->b.UI8FH = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +712,6 @@ void Core::Entity::Player::setQuestUI8AL( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8AL = val;
|
pNewQuest->b.UI8AL = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,7 +726,6 @@ void Core::Entity::Player::setQuestUI8BL( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8BL = val;
|
pNewQuest->b.UI8BL = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,7 +740,6 @@ void Core::Entity::Player::setQuestUI8CL( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8CL = val;
|
pNewQuest->b.UI8CL = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,7 +754,6 @@ void Core::Entity::Player::setQuestUI8DL( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8DL = val;
|
pNewQuest->b.UI8DL = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,7 +768,6 @@ void Core::Entity::Player::setQuestUI8EL( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8EL = val;
|
pNewQuest->b.UI8EL = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,7 +782,6 @@ void Core::Entity::Player::setQuestUI8FL( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->b.UI8FL = val;
|
pNewQuest->b.UI8FL = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +796,6 @@ void Core::Entity::Player::setQuestUI16A( uint16_t questId, uint16_t val )
|
||||||
// pNewQuest->d.UI16A = val;
|
// pNewQuest->d.UI16A = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,7 +811,6 @@ void Core::Entity::Player::setQuestUI16B( uint16_t questId, uint16_t val )
|
||||||
// pNewQuest->d.UI16B = val;
|
// pNewQuest->d.UI16B = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,7 +825,6 @@ void Core::Entity::Player::setQuestUI16C( uint16_t questId, uint16_t val )
|
||||||
// pNewQuest->d.UI16C = val;
|
// pNewQuest->d.UI16C = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,7 +839,6 @@ void Core::Entity::Player::setQuestUI32A( uint16_t questId, uint32_t val )
|
||||||
// pNewQuest->e.UI32A = val;
|
// pNewQuest->e.UI32A = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,7 +853,6 @@ void Core::Entity::Player::setQuestBitFlag8( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->a.BitFlag8 = val;
|
pNewQuest->a.BitFlag8 = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -896,7 +867,6 @@ void Core::Entity::Player::setQuestBitFlag16( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->a.BitFlag16 = val;
|
pNewQuest->a.BitFlag16 = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,7 +881,6 @@ void Core::Entity::Player::setQuestBitFlag24( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->a.BitFlag24 = val;
|
pNewQuest->a.BitFlag24 = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t val )
|
void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t val )
|
||||||
|
@ -925,7 +894,6 @@ void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->a.BitFlag32 = val;
|
pNewQuest->a.BitFlag32 = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,7 +908,6 @@ void Core::Entity::Player::setQuestBitFlag40( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->a.BitFlag40 = val;
|
pNewQuest->a.BitFlag40 = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,7 +922,6 @@ void Core::Entity::Player::setQuestBitFlag48( uint16_t questId, uint8_t val )
|
||||||
pNewQuest->a.BitFlag48 = val;
|
pNewQuest->a.BitFlag48 = val;
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,8 +951,6 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
|
||||||
pe_qa.data().questInfo = *pNewQuest;
|
pe_qa.data().questInfo = *pNewQuest;
|
||||||
queuePacket( pe_qa );
|
queuePacket( pe_qa );
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1012,9 +976,6 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
|
||||||
|
|
||||||
queuePacket( pe_qa );
|
queuePacket( pe_qa );
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
setSyncFlag( PlayerSyncFlags::QuestTracker );
|
|
||||||
|
|
||||||
for( int32_t ii = 0; ii < 5; ii++ )
|
for( int32_t ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
if( m_questTracking[ii] == -1 )
|
if( m_questTracking[ii] == -1 )
|
||||||
|
@ -1071,8 +1032,6 @@ void Core::Entity::Player::setQuestTracker( uint16_t index, int16_t flag )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::QuestTracker );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1115,8 +1074,6 @@ void Core::Entity::Player::updateQuestsCompleted( uint32_t questId )
|
||||||
uint8_t value = 0x80 >> bitIndex;
|
uint8_t value = 0x80 >> bitIndex;
|
||||||
|
|
||||||
m_questCompleteFlags[index] |= value;
|
m_questCompleteFlags[index] |= value;
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::removeQuestsCompleted( uint32_t questId )
|
void Core::Entity::Player::removeQuestsCompleted( uint32_t questId )
|
||||||
|
@ -1128,7 +1085,6 @@ void Core::Entity::Player::removeQuestsCompleted( uint32_t questId )
|
||||||
|
|
||||||
m_questCompleteFlags[index] ^= value;
|
m_questCompleteFlags[index] ^= value;
|
||||||
|
|
||||||
setSyncFlag( PlayerSyncFlags::Quests );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optionalChoice )
|
bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optionalChoice )
|
||||||
|
|
|
@ -93,7 +93,6 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_updateFlags = PlayerSyncFlags::None;
|
|
||||||
m_id = charId;
|
m_id = charId;
|
||||||
|
|
||||||
Db::Field *field = pQR->fetch();
|
Db::Field *field = pQR->fetch();
|
||||||
|
@ -197,7 +196,6 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
m_bNewGame = false;
|
m_bNewGame = false;
|
||||||
m_hp = getMaxHp();
|
m_hp = getMaxHp();
|
||||||
m_mp = getMaxMp();
|
m_mp = getMaxMp();
|
||||||
setSyncFlag( PlayerSyncFlags::NewGame );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_hp > getMaxHp() )
|
if( m_hp > getMaxHp() )
|
||||||
|
@ -265,12 +263,10 @@ bool Core::Entity::Player::loadSearchInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Core::Entity::Player::createUpdateSql()
|
void Core::Entity::Player::updateSql()
|
||||||
{
|
{
|
||||||
|
|
||||||
// if nothing to update, don't bother.
|
g_log.info( "Updating Player Data to SQL DB " );
|
||||||
if( m_updateFlags == PlayerSyncFlags::None )
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::set< std::string > charaBaseSet;
|
std::set< std::string > charaBaseSet;
|
||||||
std::set< std::string > charaDetailSet;
|
std::set< std::string > charaDetailSet;
|
||||||
|
@ -287,117 +283,70 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
|
|
||||||
std::string condition = " UPDATE_DATE = NOW() WHERE CharacterId = " + std::to_string( m_id ) + ";";
|
std::string condition = " UPDATE_DATE = NOW() WHERE CharacterId = " + std::to_string( m_id ) + ";";
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::Position )
|
charaBaseSet.insert( " Pos_0_0 = " + std::to_string( m_pos.x ) );
|
||||||
|
charaBaseSet.insert( " Pos_0_1 = " + std::to_string( m_pos.y ) );
|
||||||
|
charaBaseSet.insert( " Pos_0_2 = " + std::to_string( m_pos.z ) );
|
||||||
|
charaBaseSet.insert( " Pos_0_3 = " + std::to_string( getRotation() ) );
|
||||||
|
charaBaseSet.insert( " PrimaryTerritoryId = " + std::to_string( m_zoneId ) );
|
||||||
|
charaBaseSet.insert( " IsNewGame = " + std::to_string( static_cast< uint32_t >( m_bNewGame ) ) );
|
||||||
|
charaBaseSet.insert( " IsNewAdventurer = " + std::to_string( static_cast< uint32_t >( m_bNewAdventurer ) ) );
|
||||||
|
charaBaseSet.insert( " Hp = " + std::to_string( getHp() ) );
|
||||||
|
charaBaseSet.insert( " Mp = " + std::to_string( getMp() ) );
|
||||||
|
charaBaseSet.insert( " Mode = " + std::to_string( static_cast< uint32_t >( getStance() ) ) );
|
||||||
|
charaBaseSet.insert( " ModelEquip = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_modelEquip ), 40 ) ) + "')" );
|
||||||
|
|
||||||
|
charaDetailSet.insert( " Homepoint = " + std::to_string( m_homePoint ) );
|
||||||
|
charaDetailSet.insert( " Discovery = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_discovery ), sizeof( m_discovery ) ) ) + "')" );
|
||||||
|
charaDetailSet.insert( " TotalPlayTime = " + std::to_string( m_playTime ) );
|
||||||
|
charaDetailSet.insert( " unlocks = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_unlocks ), sizeof( m_unlocks ) ) ) + "')" );
|
||||||
|
charaDetailSet.insert( " QuestTracking = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_questTracking ), sizeof( m_questTracking ) ) ) + "')" );
|
||||||
|
charaDetailSet.insert( " HowTo = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_howTo ), sizeof( m_howTo ) ) ) + "')" );
|
||||||
|
charaDetailSet.insert( " Aetheryte = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_aetheryte ), sizeof( m_aetheryte ) ) ) + "')" );
|
||||||
|
charaDetailSet.insert( " GrandCompany = " + std::to_string( m_gc ) );
|
||||||
|
charaDetailSet.insert( " GrandCompanyRank = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_gcRank ), sizeof( m_gcRank ) ) ) + "')" );
|
||||||
|
charaDetailSet.insert( " CFPenaltyUntil = " + std::to_string( m_cfPenaltyUntil ) );
|
||||||
|
charaDetailSet.insert( " Class = " + std::to_string( static_cast< uint32_t >( getClass() ) ) );
|
||||||
|
charaDetailSet.insert( " Status = " + std::to_string( static_cast< uint8_t >( getStatus() ) ) );
|
||||||
|
charaDetailSet.insert( " OpeningSequence = " + std::to_string( static_cast< uint8_t >( getOpeningSequence() ) ) );
|
||||||
|
charaDetailSet.insert( " QuestCompleteFlags = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_questCompleteFlags ), 200 ) ) + "')" );
|
||||||
|
|
||||||
|
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
|
||||||
|
charaClassSet.insert( " Lv_" + std::to_string( classJobIndex ) + " = " + std::to_string( static_cast< uint32_t >( getLevel() ) ) );
|
||||||
|
charaClassSet.insert( " Exp_" + std::to_string( classJobIndex ) + " = " + std::to_string( getExp() ) );
|
||||||
|
|
||||||
|
for( int32_t i = 0; i < 30; i++ )
|
||||||
{
|
{
|
||||||
charaBaseSet.insert( " Pos_0_0 = " + std::to_string( m_pos.x ) );
|
if( m_activeQuests[i] != nullptr )
|
||||||
charaBaseSet.insert( " Pos_0_1 = " + std::to_string( m_pos.y ) );
|
|
||||||
charaBaseSet.insert( " Pos_0_2 = " + std::to_string( m_pos.z ) );
|
|
||||||
charaBaseSet.insert( " Pos_0_3 = " + std::to_string( getRotation() ) );
|
|
||||||
charaBaseSet.insert( " PrimaryTerritoryId = " + std::to_string( m_zoneId ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::HomePoint )
|
|
||||||
charaDetailSet.insert( " Homepoint = " + std::to_string( m_homePoint ) );
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::Discovery )
|
|
||||||
charaDetailSet.insert( " Discovery = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_discovery ), sizeof( m_discovery ) ) ) + "')" );
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::PlayTime )
|
|
||||||
charaDetailSet.insert( " TotalPlayTime = " + std::to_string( m_playTime ) );
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::Unlocks )
|
|
||||||
charaDetailSet.insert( " unlocks = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_unlocks ), sizeof( m_unlocks ) ) ) + "')" );
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::QuestTracker )
|
|
||||||
charaDetailSet.insert( " QuestTracking = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_questTracking ), sizeof( m_questTracking ) ) ) + "')" );
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::HowTo )
|
|
||||||
charaDetailSet.insert( " HowTo = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_howTo ), sizeof( m_howTo ) ) ) + "')" );
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::Aetherytes )
|
|
||||||
charaDetailSet.insert( " Aetheryte = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_aetheryte ), sizeof( m_aetheryte ) ) ) + "')" );
|
|
||||||
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::NewGame )
|
|
||||||
charaBaseSet.insert( " IsNewGame = " + std::to_string( static_cast< uint32_t >( m_bNewGame ) ) );
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::NewAdventurer )
|
|
||||||
charaBaseSet.insert( " IsNewAdventurer = " + std::to_string( static_cast< uint32_t >( m_bNewAdventurer ) ) );
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::GC )
|
|
||||||
{
|
|
||||||
charaDetailSet.insert( " GrandCompany = " + std::to_string( m_gc ) );
|
|
||||||
charaDetailSet.insert( " GrandCompanyRank = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_gcRank ), sizeof( m_gcRank ) ) ) + "')" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::CFPenaltyTime )
|
|
||||||
{
|
|
||||||
charaDetailSet.insert( " CFPenaltyUntil = " + std::to_string( m_cfPenaltyUntil ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::ExpLevel )
|
|
||||||
{
|
|
||||||
uint8_t classJobIndex = g_exdData.m_classJobInfoMap[static_cast< uint8_t >( getClass() )].exp_idx;
|
|
||||||
charaClassSet.insert( " Lv_" + std::to_string( classJobIndex ) + " = " + std::to_string( static_cast< uint32_t >( getLevel() ) ) );
|
|
||||||
charaClassSet.insert( " Exp_" + std::to_string( classJobIndex ) + " = " + std::to_string( getExp() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::Status )
|
|
||||||
{
|
|
||||||
charaBaseSet.insert( " Hp = " + std::to_string( getHp() ) );
|
|
||||||
charaBaseSet.insert( " Mp = " + std::to_string( getMp() ) );
|
|
||||||
charaBaseSet.insert( " Mode = " + std::to_string( static_cast< uint32_t >( getStance() ) ) );
|
|
||||||
charaBaseSet.insert( " ModelEquip = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_modelEquip ), 40 ) ) + "')" );
|
|
||||||
charaDetailSet.insert( " Class = " + std::to_string( static_cast< uint32_t >( getClass() ) ) );
|
|
||||||
charaDetailSet.insert( " Status = " + std::to_string( static_cast< uint8_t >( getStatus() ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::OpeningSeq )
|
|
||||||
{
|
|
||||||
charaDetailSet.insert( " OpeningSequence = " + std::to_string( static_cast< uint8_t >( getOpeningSequence() ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::Quests )
|
|
||||||
{
|
|
||||||
charaDetailSet.insert( " QuestCompleteFlags = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_questCompleteFlags ), 200 ) ) + "')" );
|
|
||||||
|
|
||||||
for( int32_t i = 0; i < 30; i++ )
|
|
||||||
{
|
{
|
||||||
if( m_activeQuests[i] != nullptr )
|
charaQuestSet.insert( " QuestId_" + std::to_string( i ) + " = " + std::to_string( m_activeQuests[i]->c.questId ) );
|
||||||
{
|
charaQuestSet.insert( " Sequence_" + std::to_string( i ) + " = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.sequence ) ) );
|
||||||
charaQuestSet.insert( " QuestId_" + std::to_string( i ) + " = " + std::to_string( m_activeQuests[i]->c.questId ) );
|
charaQuestSet.insert( " Flags_" + std::to_string( i ) + " = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.flags ) ) );
|
||||||
charaQuestSet.insert( " Sequence_" + std::to_string( i ) + " = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.sequence ) ) );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_0 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8A ) ) );
|
||||||
charaQuestSet.insert( " Flags_" + std::to_string( i ) + " = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.flags ) ) );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_1 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8B ) ) );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_0 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8A ) ) );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_2 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8C ) ) );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_1 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8B ) ) );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_3 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8D ) ) );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_2 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8C ) ) );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_4 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8E ) ) );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_3 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8D ) ) );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_5 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8F ) ) );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_4 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8E ) ) );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_6 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.padding1 ) ) );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_5 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8F ) ) );
|
}
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_6 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.padding1 ) ) );
|
else
|
||||||
}
|
{
|
||||||
else
|
charaQuestSet.insert( " QuestId_" + std::to_string( i ) + " = 0" );
|
||||||
{
|
charaQuestSet.insert( " Sequence_" + std::to_string( i ) + " = 0" );
|
||||||
charaQuestSet.insert( " QuestId_" + std::to_string( i ) + " = 0" );
|
charaQuestSet.insert( " Flags_" + std::to_string( i ) + " = 0" );
|
||||||
charaQuestSet.insert( " Sequence_" + std::to_string( i ) + " = 0" );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_0 = 0" );
|
||||||
charaQuestSet.insert( " Flags_" + std::to_string( i ) + " = 0" );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_1 = 0" );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_0 = 0" );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_2 = 0" );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_1 = 0" );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_3 = 0" );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_2 = 0" );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_4 = 0" );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_3 = 0" );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_5 = 0" );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_4 = 0" );
|
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_6 = 0" );
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_5 = 0" );
|
|
||||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_6 = 0" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_updateFlags & PlayerSyncFlags::SearchInfo )
|
charaInfoSearchSet.insert( " SelectClassId = " + std::to_string( m_searchSelectClass ) );
|
||||||
{
|
charaInfoSearchSet.insert( " SelectRegion = " + std::to_string( m_searchSelectRegion ) );
|
||||||
charaInfoSearchSet.insert( " SelectClassId = " + std::to_string( m_searchSelectClass ) );
|
charaInfoSearchSet.insert( " SearchComment = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_searchMessage ), sizeof( m_searchMessage ) ) + "')" ) );
|
||||||
charaInfoSearchSet.insert( " SelectRegion = " + std::to_string( m_searchSelectRegion ) );
|
|
||||||
charaInfoSearchSet.insert( " SearchComment = UNHEX('" + std::string( Util::binaryToHexString( reinterpret_cast< uint8_t* >( m_searchMessage ), sizeof( m_searchMessage ) ) + "')" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !charaInfoSearchSet.empty() )
|
if( !charaInfoSearchSet.empty() )
|
||||||
{
|
{
|
||||||
|
@ -444,7 +393,5 @@ void Core::Entity::Player::createUpdateSql()
|
||||||
g_database.execute( updateCharaQuest );
|
g_database.execute( updateCharaQuest );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_updateFlags = PlayerSyncFlags::None;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in
|
||||||
pPlayer->resetHp();
|
pPlayer->resetHp();
|
||||||
pPlayer->resetMp();
|
pPlayer->resetMp();
|
||||||
pPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
pPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
||||||
pPlayer->setSyncFlag( Status );
|
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 111 ), true );
|
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 111 ), true );
|
||||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus, static_cast< uint8_t >( Entity::Actor::ActorStatus::Idle ) ), true );
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,9 +370,6 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPlayer->setSyncFlag( Common::PlayerSyncFlags::All );
|
|
||||||
targetPlayer->setSyncFlag( Common::PlayerSyncFlags::All );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPacket, Entity::PlayerPtr pPlayer )
|
||||||
|
@ -416,7 +413,6 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
||||||
targetPlayer->resetHp();
|
targetPlayer->resetHp();
|
||||||
targetPlayer->resetMp();
|
targetPlayer->resetMp();
|
||||||
targetPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
targetPlayer->setStatus( Entity::Actor::ActorStatus::Idle );
|
||||||
targetPlayer->setSyncFlag( Status );
|
|
||||||
|
|
||||||
targetPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
targetPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
||||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus,
|
targetPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), SetStatus,
|
||||||
|
@ -464,7 +460,4 @@ void Core::Network::GameConnection::gm2Handler( const Packets::GamePacket& inPac
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPlayer->setSyncFlag( Common::PlayerSyncFlags::All );
|
|
||||||
targetPlayer->setSyncFlag( Common::PlayerSyncFlags::All );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,8 +95,5 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GameP
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPlayer->setSyncFlag( PlayerSyncFlags::Status );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,8 +190,6 @@ void Core::Network::GameConnection::updatePositionHandler( const Packets::GamePa
|
||||||
inPacket.getValAt< float >( 0x30 ),
|
inPacket.getValAt< float >( 0x30 ),
|
||||||
inPacket.getValAt< float >( 0x34 ) );
|
inPacket.getValAt< float >( 0x34 ) );
|
||||||
|
|
||||||
pPlayer->setSyncFlag( PlayerSyncFlags::Position );
|
|
||||||
|
|
||||||
if( ( pPlayer->getCurrentAction() != nullptr ) && bPosChanged )
|
if( ( pPlayer->getCurrentAction() != nullptr ) && bPosChanged )
|
||||||
pPlayer->getCurrentAction()->setInterrupted();
|
pPlayer->getCurrentAction()->setInterrupted();
|
||||||
|
|
||||||
|
@ -327,8 +325,6 @@ void Core::Network::GameConnection::zoneLineHandler( const Packets::GamePacket&
|
||||||
}
|
}
|
||||||
|
|
||||||
pPlayer->performZoning( targetZone, targetPos, rotation);
|
pPlayer->performZoning( targetZone, targetPos, rotation);
|
||||||
pPlayer->setSyncFlag( PlayerSyncFlags::Position );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,6 @@ void Core::ServerZone::run( int32_t argc, char* argv[] )
|
||||||
g_log.setLogPath( "log\\SapphireZone_" );
|
g_log.setLogPath( "log\\SapphireZone_" );
|
||||||
g_log.init();
|
g_log.init();
|
||||||
|
|
||||||
|
|
||||||
printBanner();
|
printBanner();
|
||||||
|
|
||||||
if( !loadSettings( argc, argv ) )
|
if( !loadSettings( argc, argv ) )
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
|
|
||||||
Core::Session::Session( uint32_t sessionId )
|
Core::Session::Session( uint32_t sessionId )
|
||||||
: m_sessionId( sessionId )
|
: m_sessionId( sessionId )
|
||||||
, m_lastDataTime( static_cast< uint32_t >( time( nullptr ) ) )
|
, m_lastDataTime( static_cast< uint32_t >( Util::getTimeSeconds() ) )
|
||||||
|
, m_lastSqlTime( static_cast< uint32_t >( Util::getTimeSeconds() ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
// boost::posix_time::ptime now = boost::date_time::not_a_date_time;
|
// boost::posix_time::ptime now = boost::date_time::not_a_date_time;
|
||||||
|
@ -49,10 +50,7 @@ bool Core::Session::loadPlayer()
|
||||||
|
|
||||||
m_pPlayer = Entity::PlayerPtr( new Entity::Player() );
|
m_pPlayer = Entity::PlayerPtr( new Entity::Player() );
|
||||||
|
|
||||||
if( !m_pPlayer->load( m_sessionId, shared_from_this() ) )
|
return m_pPlayer->load(m_sessionId, shared_from_this() );
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,9 +75,19 @@ uint32_t Core::Session::getLastDataTime() const
|
||||||
return m_lastDataTime;
|
return m_lastDataTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Core::Session::getLastSqlTime() const
|
||||||
|
{
|
||||||
|
return m_lastSqlTime;
|
||||||
|
}
|
||||||
|
|
||||||
void Core::Session::updateLastDataTime()
|
void Core::Session::updateLastDataTime()
|
||||||
{
|
{
|
||||||
m_lastDataTime = static_cast< uint32_t >( time( nullptr ) );
|
m_lastDataTime = static_cast< uint32_t >( Util::getTimeSeconds() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Session::updateLastSqlTime()
|
||||||
|
{
|
||||||
|
m_lastSqlTime = static_cast< uint32_t >( Util::getTimeSeconds() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Session::update()
|
void Core::Session::update()
|
||||||
|
@ -91,7 +99,11 @@ void Core::Session::update()
|
||||||
// SESSION LOGIC
|
// SESSION LOGIC
|
||||||
m_pPlayer->update( Util::getTimeMs() );
|
m_pPlayer->update( Util::getTimeMs() );
|
||||||
|
|
||||||
m_pPlayer->createUpdateSql();
|
if( ( static_cast< uint32_t >( Util::getTimeSeconds() ) - static_cast< uint32_t >( getLastSqlTime() ) ) > 10 )
|
||||||
|
{
|
||||||
|
updateLastSqlTime();
|
||||||
|
m_pPlayer->updateSql();
|
||||||
|
}
|
||||||
|
|
||||||
m_pZoneConnection->processOutQueue();
|
m_pZoneConnection->processOutQueue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,10 @@ namespace Core {
|
||||||
Network::GameConnectionPtr getChatConnection() const;
|
Network::GameConnectionPtr getChatConnection() const;
|
||||||
|
|
||||||
uint32_t getLastDataTime() const;
|
uint32_t getLastDataTime() const;
|
||||||
|
uint32_t getLastSqlTime() const;
|
||||||
|
|
||||||
void updateLastDataTime();
|
void updateLastDataTime();
|
||||||
|
void updateLastSqlTime();
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
@ -44,6 +46,8 @@ namespace Core {
|
||||||
|
|
||||||
uint32_t m_lastDataTime;
|
uint32_t m_lastDataTime;
|
||||||
|
|
||||||
|
uint32_t m_lastSqlTime;
|
||||||
|
|
||||||
Network::GameConnectionPtr m_pZoneConnection;
|
Network::GameConnectionPtr m_pZoneConnection;
|
||||||
Network::GameConnectionPtr m_pChatConnection;
|
Network::GameConnectionPtr m_pChatConnection;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue