mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 08:07:46 +00:00
More sql updates, specifically quest and searchmessages
This commit is contained in:
parent
e490d0c28c
commit
a4dfc28129
6 changed files with 213 additions and 214 deletions
|
@ -19,6 +19,7 @@ void Core::Db::CharaDbConnection::doPrepareStatements()
|
|||
if( !m_reconnecting )
|
||||
m_stmts.resize( MAX_STATEMENTS );
|
||||
|
||||
/// CHARA
|
||||
prepareStatement( CHARA_SEL, "SELECT ContentId, Name, Hp, Mp, Tp, Gp, Mode, Mount, InvincibleGM, Voice, "
|
||||
"Customize, ModelMainWeapon, ModelSubWeapon, ModelSystemWeapon, "
|
||||
"ModelEquip, EmoteModeType, FirstLoginTime, Language, IsNewGame, "
|
||||
|
@ -51,8 +52,8 @@ void Core::Db::CharaDbConnection::doPrepareStatements()
|
|||
"FROM charainfo WHERE CharacterId = ?;", CONNECTION_SYNC );
|
||||
|
||||
prepareStatement( CHARA_CLASSINFO_SEL_LOAD, "SELECT * FROM characlass WHERE CharacterId = ?;", CONNECTION_SYNC );
|
||||
prepareStatement( CHARA_SEACHINFO_SEL_LOAD, "SELECT * FROM charainfosearch WHERE CharacterId = ?;", CONNECTION_SYNC );
|
||||
prepareStatement( CHARA_QUESTINFO_SEL_LOAD, "SELECT * FROM charaquest WHERE CharacterId = ?;", CONNECTION_SYNC );
|
||||
prepareStatement( CHARA_SEARCHINFO_SEL_LOAD, "SELECT * FROM charainfosearch WHERE CharacterId = ?;", CONNECTION_SYNC );
|
||||
prepareStatement( CHARA_QUESTINFO_SEL_LOAD, "SELECT * FROM charaquestnew WHERE CharacterId = ?;", CONNECTION_SYNC );
|
||||
|
||||
prepareStatement( CHARA_INS, "INSERT INTO charainfo (AccountId, CharacterId, ContentId, Name, Hp, Mp, "
|
||||
"Customize, Voice, IsNewGame, TerritoryId, PosX, PosY, PosZ, PosR, ModelEquip, "
|
||||
|
@ -103,11 +104,22 @@ void Core::Db::CharaDbConnection::doPrepareStatements()
|
|||
prepareStatement( CHARA_UP_UNLOCKS, "UPDATE charainfo SET Unlocks = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
prepareStatement( CHARA_UP_CFPENATLY, "UPDATE charainfo SET CFPenaltyUntil = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
|
||||
/// SEARCHINFO
|
||||
prepareStatement( CHARA_SEARCHINFO_UP_SELECTCLASS, "UPDATE charainfosearch SET SelectClassId = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
prepareStatement( CHARA_SEARCHINFO_UP_SELECTREGION, "UPDATE charainfosearch SET SelectRegion = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
prepareStatement( CHARA_SEARCHINFO_UP_SEARCHCOMMENT, "UPDATE charainfosearch SET SearchComment = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
|
||||
/// QUEST
|
||||
prepareStatement( CHARA_QUEST_INS, "INSERT INTO charaquestnew ( CharacterId, SlotId, QuestId, Sequence, Flags, Variables_0 "
|
||||
"Variables_1, Variables_2, Variables_3, Variables_4, "
|
||||
"Variables_5, Variables_6 ) VALUES( ?,?,?,?,?,?,?,?,?,?,?,? );", CONNECTION_ASYNC );
|
||||
|
||||
prepareStatement( CHARA_QUEST_UP, "UPDATE charaquestnew SET Sequence = ?, Flags = ?, Variables_0 = ?, "
|
||||
"Variables_1 = ?, Variables_2 = ?, Variables_3 = ?, "
|
||||
"Variables_4 = ?, Variables_5 = ?, Variables_6 = ? "
|
||||
"WHERE CharacterId = ? AND QuestId = ?;", CONNECTION_ASYNC );
|
||||
|
||||
|
||||
|
||||
prepareStatement( CHARA_QUEST_DEL, "DELETE FROM charaquestnew WHERE CharacterId = ? AND QuestId = ?;", CONNECTION_ASYNC );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ enum CharaDbStatements : uint32_t
|
|||
CHARA_SEL,
|
||||
CHARA_SEL_MINIMAL,
|
||||
CHARA_CLASSINFO_SEL_LOAD,
|
||||
CHARA_SEACHINFO_SEL_LOAD,
|
||||
CHARA_SEARCHINFO_SEL_LOAD,
|
||||
CHARA_QUESTINFO_SEL_LOAD,
|
||||
CHARA_INS,
|
||||
CHARA_UP,
|
||||
|
@ -58,6 +58,13 @@ enum CharaDbStatements : uint32_t
|
|||
CHARA_UP_GMRANK,
|
||||
CHARA_UP_UNLOCKS,
|
||||
CHARA_UP_CFPENATLY,
|
||||
CHARA_SEARCHINFO_UP_SELECTCLASS,
|
||||
CHARA_SEARCHINFO_UP_SELECTREGION,
|
||||
CHARA_SEARCHINFO_UP_SEARCHCOMMENT,
|
||||
|
||||
CHARA_QUEST_INS,
|
||||
CHARA_QUEST_UP,
|
||||
CHARA_QUEST_DEL,
|
||||
|
||||
MAX_STATEMENTS
|
||||
};
|
||||
|
|
|
@ -54,37 +54,47 @@ namespace Packets {
|
|||
CFDutyInfo = 0x007A,
|
||||
CFPlayerInNeed = 0x007F,
|
||||
|
||||
Playtime = 0x00B7, // updated 4.1
|
||||
|
||||
SocialRequestError = 0x00AD,
|
||||
SocialRequestResponse = 0x00BB, // updated 4.1
|
||||
Playtime = 0x00B7, // updated 4.1
|
||||
CFRegistered = 0x00B8, // updated 4.1
|
||||
SocialRequestResponse = 0x00BB, // updated 4.1
|
||||
SocialList = 0x00BE, // updated 4.1
|
||||
UpdateSearchInfo = 0x10BB,
|
||||
InitSearchInfo = 0x00C1, // updated 4.1
|
||||
ServerNotice = 0x00C6, // updated 4.1
|
||||
SetOnlineStatus = 0x00C7, // test update
|
||||
BlackList = 0x00D4, // updated 4.1
|
||||
SetOnlineStatus = 0x00C7, // updated 4.1
|
||||
|
||||
LogMessage = 0x00D0,
|
||||
BlackList = 0x00D4, // updated 4.1
|
||||
|
||||
LinkshellList = 0x00DC, // updated 4.1
|
||||
StatusEffectList = 0x00FA, // updated 4.1
|
||||
|
||||
Effect = 0x00FB, // updated 4.1
|
||||
GCAffiliation = 0x00FC,
|
||||
|
||||
ActorSetPos = 0x0120, // updated 4.1
|
||||
ActorCast = 0x0123, // updated 4.1
|
||||
HateList = 0x011A,
|
||||
PlayerSpawn = 0x011C, // updated 4.1
|
||||
NpcSpawn = 0x011D, // updated 4.1
|
||||
ActorMove = 0x011E, // updated 4.1
|
||||
HateList = 0x011A,
|
||||
UpdateClassInfo = 0x011D,
|
||||
|
||||
UpdateClassInfo = 0x111D,
|
||||
|
||||
ActorSetPos = 0x0120, // updated 4.1
|
||||
ActorCast = 0x0123, // updated 4.1
|
||||
InitUI = 0x012B, // updated 4.1
|
||||
ActorOwner = 0x012D, // updated 4.1
|
||||
PlayerStats = 0x0138, // updated 4.1
|
||||
PlayerStateFlags = 0x013A, // updated 4.1
|
||||
PlayerClassInfo = 0x013B, // updated 4.1
|
||||
ModelEquip = 0x013C, // updated 4.1
|
||||
|
||||
AddStatusEffect = 0x0141,
|
||||
ActorControl142 = 0x0142, // updated 4.1
|
||||
ActorControl143 = 0x0143, // updated 4.1
|
||||
ActorControl144 = 0x0144, // updated 4.1
|
||||
UpdateHpMpTp = 0x0145, // updated 4.1
|
||||
|
||||
ItemInfo = 0x014C, // updated 4.1
|
||||
ContainerInfo = 0x014D, // updated 4.1
|
||||
InventoryTransactionFinish = 0x014E, // updated 4.1
|
||||
|
@ -92,11 +102,7 @@ namespace Packets {
|
|||
CurrencyCrystalInfo = 0x0150, // updated 4.1
|
||||
InventoryActionAck = 0x1139,
|
||||
UpdateInventorySlot = 0x0153, // updated 4.1
|
||||
AddStatusEffect = 0x0141,
|
||||
ActorControl142 = 0x0142, // updated 4.1
|
||||
ActorControl143 = 0x0143, // updated 4.1
|
||||
ActorControl144 = 0x0144, // updated 4.1
|
||||
UpdateHpMpTp = 0x0145, // updated 4.1
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -106,11 +112,13 @@ namespace Packets {
|
|||
|
||||
EventLinkshell = 0x1169,
|
||||
|
||||
QuestMessage = 0x0179,
|
||||
QuestActiveList = 0x017D, // updated 4.1
|
||||
QuestUpdate = 0x017E, // updated 4.1
|
||||
QuestCompleteList = 0x017F, // updated 4.1
|
||||
|
||||
QuestFinish = 0x0180, // updated 4.1
|
||||
QuestMessage = 0x0179,
|
||||
|
||||
|
||||
QuestTracker = 0x018D, // updated 4.1
|
||||
ActorSpawn = 0x0190, // todo: split into playerspawn/actorspawn and use opcode 0x110/0x111
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
/*! set quest tracker flag for a specified slot */
|
||||
void setQuestTracker( uint16_t index, int16_t flag );
|
||||
/*! return the index of a given quest in the players quest list */
|
||||
int16_t getQuestIndex( uint16_t questId );
|
||||
int8_t getQuestIndex( uint16_t questId );
|
||||
/*! finish a given quest */
|
||||
void finishQuest( uint16_t questId );
|
||||
/*! finish a given quest */
|
||||
|
@ -515,7 +515,13 @@ public:
|
|||
void setCFPenaltyMinutes( uint32_t minutes );
|
||||
|
||||
void setEorzeaTimeOffset( uint64_t timestamp );
|
||||
|
||||
|
||||
|
||||
// Database
|
||||
void updateAllQuests() const;
|
||||
void deleteQuest( uint16_t questId ) const;
|
||||
void insertQuest( uint16_t questId, uint8_t index, uint8_t seq ) const;
|
||||
|
||||
|
||||
private:
|
||||
uint32_t m_lastWrite;
|
||||
|
@ -608,8 +614,8 @@ private:
|
|||
std::queue< uint8_t > m_freeSpawnIdQueue; // queue with spawn ids free to be assigned
|
||||
std::queue< uint8_t > m_freeHateSlotQueue; // queue with "hate slots" free to be assigned
|
||||
std::map< uint32_t, uint8_t > m_actorIdTohateSlotMap;
|
||||
std::map< uint32_t, uint16_t > m_questIdToQuestIdx; // quest mapping, quest id to quest container index
|
||||
std::map< uint16_t, uint32_t > m_questIdxToQuestId; // quest mapping, quest container index to questId
|
||||
std::map< uint32_t, uint8_t > m_questIdToQuestIdx; // quest mapping, quest id to quest container index
|
||||
std::map< uint8_t, uint32_t > m_questIdxToQuestId; // quest mapping, quest container index to questId
|
||||
std::queue< uint8_t > m_freeQuestIdxQueue; // queue with quest indices free to be assigned
|
||||
boost::shared_ptr< Common::QuestActive > m_activeQuests[30];
|
||||
int16_t m_questTracking[5];
|
||||
|
|
|
@ -22,38 +22,10 @@ using namespace Core::Network::Packets::Server;
|
|||
void Core::Entity::Player::finishQuest( uint16_t questId )
|
||||
{
|
||||
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
|
||||
if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) )
|
||||
{
|
||||
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > 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() );
|
||||
questFinishPacket.data().questId = questId;
|
||||
questFinishPacket.data().flag1 = 1;
|
||||
questFinishPacket.data().flag2 = 1;
|
||||
queuePacket( questFinishPacket );
|
||||
|
||||
updateQuestsCompleted( questId );
|
||||
|
||||
for( int32_t ii = 0; ii < 5; ii++ )
|
||||
{
|
||||
if( m_questTracking[ii] == idx )
|
||||
m_questTracking[ii] = -1;
|
||||
}
|
||||
|
||||
boost::shared_ptr< QuestActive > pQuest = m_activeQuests[idx];
|
||||
m_activeQuests[idx].reset();
|
||||
|
||||
m_freeQuestIdxQueue.push( idx );
|
||||
m_questIdToQuestIdx.erase( questId );
|
||||
m_questIdxToQuestId.erase( idx );
|
||||
}
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
removeQuest( questId );
|
||||
updateQuestsCompleted( questId );
|
||||
|
||||
sendQuestTracker();
|
||||
|
||||
|
@ -68,7 +40,7 @@ void Core::Entity::Player::unfinishQuest( uint16_t questId )
|
|||
void Core::Entity::Player::removeQuest( uint16_t questId )
|
||||
{
|
||||
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) )
|
||||
{
|
||||
|
@ -97,6 +69,8 @@ void Core::Entity::Player::removeQuest( uint16_t questId )
|
|||
m_freeQuestIdxQueue.push( idx );
|
||||
m_questIdToQuestIdx.erase( questId );
|
||||
m_questIdxToQuestId.erase( idx );
|
||||
|
||||
deleteQuest( questId );
|
||||
}
|
||||
|
||||
sendQuestTracker();
|
||||
|
@ -108,7 +82,7 @@ bool Core::Entity::Player::hasQuest( uint16_t questId )
|
|||
return ( getQuestIndex( questId ) > -1 );
|
||||
}
|
||||
|
||||
int16_t Core::Entity::Player::getQuestIndex( uint16_t questId )
|
||||
int8_t Core::Entity::Player::getQuestIndex( uint16_t questId )
|
||||
{
|
||||
auto it = m_questIdToQuestIdx.find( questId );
|
||||
if( it != m_questIdToQuestIdx.end() )
|
||||
|
@ -119,7 +93,7 @@ int16_t Core::Entity::Player::getQuestIndex( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag8( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -132,7 +106,7 @@ uint8_t Core::Entity::Player::getQuestBitFlag8( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag16( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -145,7 +119,7 @@ uint8_t Core::Entity::Player::getQuestBitFlag16( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag24( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -158,7 +132,7 @@ uint8_t Core::Entity::Player::getQuestBitFlag24( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag32( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -171,7 +145,7 @@ uint8_t Core::Entity::Player::getQuestBitFlag32( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag40( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -184,7 +158,7 @@ uint8_t Core::Entity::Player::getQuestBitFlag40( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestBitFlag48( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -197,7 +171,7 @@ uint8_t Core::Entity::Player::getQuestBitFlag48( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8A( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -210,7 +184,7 @@ uint8_t Core::Entity::Player::getQuestUI8A( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8B( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -223,7 +197,7 @@ uint8_t Core::Entity::Player::getQuestUI8B( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8C( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -236,7 +210,7 @@ uint8_t Core::Entity::Player::getQuestUI8C( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8D( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -249,7 +223,7 @@ uint8_t Core::Entity::Player::getQuestUI8D( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8E( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -262,7 +236,7 @@ uint8_t Core::Entity::Player::getQuestUI8E( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8F( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -275,7 +249,7 @@ uint8_t Core::Entity::Player::getQuestUI8F( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8AH( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -288,7 +262,7 @@ uint8_t Core::Entity::Player::getQuestUI8AH( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8BH( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -301,7 +275,7 @@ uint8_t Core::Entity::Player::getQuestUI8BH( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8CH( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -314,7 +288,7 @@ uint8_t Core::Entity::Player::getQuestUI8CH( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8DH( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -327,7 +301,7 @@ uint8_t Core::Entity::Player::getQuestUI8DH( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8EH( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -340,7 +314,7 @@ uint8_t Core::Entity::Player::getQuestUI8EH( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8FH( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -353,7 +327,7 @@ uint8_t Core::Entity::Player::getQuestUI8FH( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8AL( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -366,7 +340,7 @@ uint8_t Core::Entity::Player::getQuestUI8AL( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8BL( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -379,7 +353,7 @@ uint8_t Core::Entity::Player::getQuestUI8BL( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8CL( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -392,7 +366,7 @@ uint8_t Core::Entity::Player::getQuestUI8CL( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8DL( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -405,7 +379,7 @@ uint8_t Core::Entity::Player::getQuestUI8DL( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8EL( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -418,7 +392,7 @@ uint8_t Core::Entity::Player::getQuestUI8EL( uint16_t questId )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestUI8FL( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint8_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -431,7 +405,7 @@ uint8_t Core::Entity::Player::getQuestUI8FL( uint16_t questId )
|
|||
|
||||
uint16_t Core::Entity::Player::getQuestUI16A( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint16_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -444,7 +418,7 @@ uint16_t Core::Entity::Player::getQuestUI16A( uint16_t questId )
|
|||
|
||||
uint16_t Core::Entity::Player::getQuestUI16B( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint16_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -457,7 +431,7 @@ uint16_t Core::Entity::Player::getQuestUI16B( uint16_t questId )
|
|||
|
||||
uint16_t Core::Entity::Player::getQuestUI16C( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint16_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -470,7 +444,7 @@ uint16_t Core::Entity::Player::getQuestUI16C( uint16_t questId )
|
|||
|
||||
uint32_t Core::Entity::Player::getQuestUI32A( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
uint32_t value = 0;
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -483,7 +457,7 @@ uint32_t Core::Entity::Player::getQuestUI32A( uint16_t questId )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8A( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -497,7 +471,7 @@ void Core::Entity::Player::setQuestUI8A( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8B( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -511,7 +485,7 @@ void Core::Entity::Player::setQuestUI8B( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8C( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -525,7 +499,7 @@ void Core::Entity::Player::setQuestUI8C( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8D( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -539,7 +513,7 @@ void Core::Entity::Player::setQuestUI8D( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8E( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -553,7 +527,7 @@ void Core::Entity::Player::setQuestUI8E( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8F( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -567,7 +541,7 @@ void Core::Entity::Player::setQuestUI8F( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8AH( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -581,7 +555,7 @@ void Core::Entity::Player::setQuestUI8AH( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8BH( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -595,7 +569,7 @@ void Core::Entity::Player::setQuestUI8BH( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8CH( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -609,7 +583,7 @@ void Core::Entity::Player::setQuestUI8CH( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8DH( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -623,7 +597,7 @@ void Core::Entity::Player::setQuestUI8DH( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8EH( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -637,7 +611,7 @@ void Core::Entity::Player::setQuestUI8EH( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8FH( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -651,7 +625,7 @@ void Core::Entity::Player::setQuestUI8FH( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8AL( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -665,7 +639,7 @@ void Core::Entity::Player::setQuestUI8AL( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8BL( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -679,7 +653,7 @@ void Core::Entity::Player::setQuestUI8BL( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8CL( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -693,7 +667,7 @@ void Core::Entity::Player::setQuestUI8CL( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8DL( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -707,7 +681,7 @@ void Core::Entity::Player::setQuestUI8DL( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8EL( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -721,7 +695,7 @@ void Core::Entity::Player::setQuestUI8EL( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI8FL( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -735,7 +709,7 @@ void Core::Entity::Player::setQuestUI8FL( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI16A( uint16_t questId, uint16_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -750,7 +724,7 @@ void Core::Entity::Player::setQuestUI16A( uint16_t questId, uint16_t val )
|
|||
void Core::Entity::Player::setQuestUI16B( uint16_t questId, uint16_t val )
|
||||
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -764,7 +738,7 @@ void Core::Entity::Player::setQuestUI16B( uint16_t questId, uint16_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI16C( uint16_t questId, uint16_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -778,7 +752,7 @@ void Core::Entity::Player::setQuestUI16C( uint16_t questId, uint16_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestUI32A( uint16_t questId, uint32_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -792,7 +766,7 @@ void Core::Entity::Player::setQuestUI32A( uint16_t questId, uint32_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestBitFlag8( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -806,7 +780,7 @@ void Core::Entity::Player::setQuestBitFlag8( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestBitFlag16( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -820,7 +794,7 @@ void Core::Entity::Player::setQuestBitFlag16( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestBitFlag24( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -833,7 +807,7 @@ void Core::Entity::Player::setQuestBitFlag24( uint16_t questId, uint8_t val )
|
|||
}
|
||||
void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -847,7 +821,7 @@ void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestBitFlag40( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -861,7 +835,7 @@ void Core::Entity::Player::setQuestBitFlag40( uint16_t questId, uint8_t val )
|
|||
|
||||
void Core::Entity::Player::setQuestBitFlag48( uint16_t questId, uint8_t val )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -877,7 +851,7 @@ void Core::Entity::Player::setQuestBitFlag48( uint16_t questId, uint8_t val )
|
|||
|
||||
uint8_t Core::Entity::Player::getQuestSeq( uint16_t questId )
|
||||
{
|
||||
int16_t idx = getQuestIndex( questId );
|
||||
int8_t idx = getQuestIndex( questId );
|
||||
|
||||
if( idx != -1 )
|
||||
{
|
||||
|
@ -891,11 +865,12 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
|
|||
{
|
||||
if( hasQuest( questId ) )
|
||||
{
|
||||
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() );
|
||||
|
||||
int16_t index = getQuestIndex( questId );
|
||||
auto pNewQuest = m_activeQuests[index];
|
||||
pe_qa.data().slot = index;
|
||||
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() );
|
||||
pNewQuest->c.sequence = sequence;
|
||||
pe_qa.data().slot = index;
|
||||
pe_qa.data().questInfo = *pNewQuest;
|
||||
queuePacket( pe_qa );
|
||||
|
||||
|
@ -903,25 +878,22 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
|
|||
else
|
||||
{
|
||||
|
||||
int8_t idx = m_freeQuestIdxQueue.front();
|
||||
uint8_t idx = m_freeQuestIdxQueue.front();
|
||||
m_freeQuestIdxQueue.pop();
|
||||
|
||||
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() );
|
||||
|
||||
|
||||
boost::shared_ptr< QuestActive > pNewQuest( new QuestActive() );
|
||||
pNewQuest->c.questId = questId;
|
||||
pNewQuest->c.sequence = sequence;
|
||||
pNewQuest->c.padding = 0;
|
||||
m_activeQuests[idx] = pNewQuest;
|
||||
|
||||
m_questIdToQuestIdx[questId] = idx;
|
||||
m_questIdxToQuestId[idx] = questId;
|
||||
|
||||
GamePacketNew< FFXIVIpcQuestUpdate, ServerZoneIpcType > pe_qa( getId() );
|
||||
pe_qa.data().slot = idx;
|
||||
pNewQuest->c.sequence = sequence;
|
||||
pe_qa.data().questInfo = *pNewQuest;
|
||||
|
||||
|
||||
queuePacket( pe_qa );
|
||||
|
||||
for( int32_t ii = 0; ii < 5; ii++ )
|
||||
|
@ -933,6 +905,7 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
|
|||
}
|
||||
}
|
||||
|
||||
insertQuest( questId, idx, sequence );
|
||||
sendQuestTracker();
|
||||
|
||||
}
|
||||
|
|
|
@ -212,46 +212,27 @@ bool Core::Entity::Player::loadActiveQuests()
|
|||
stmt->setUInt( 1, m_id );
|
||||
auto res = g_charaDb.query( stmt );
|
||||
|
||||
if( !res->next() )
|
||||
return false;
|
||||
|
||||
auto pQR = g_database.query( "SELECT * FROM charaquest WHERE CharacterId = " + std::to_string( m_id ) + ";" );
|
||||
|
||||
if( !pQR )
|
||||
return false;
|
||||
|
||||
Db::Field* field = pQR->fetch();
|
||||
|
||||
for( uint8_t i = 0; i < 30; i++ )
|
||||
while( res->next() )
|
||||
{
|
||||
|
||||
uint16_t index = i * 10 + 1;
|
||||
auto slotId = res->getUInt8( 1 );
|
||||
|
||||
if( res->getUInt16( index ) != 0 )
|
||||
{
|
||||
boost::shared_ptr<QuestActive> pActiveQuest( new QuestActive() );
|
||||
pActiveQuest->c.questId = res->getUInt16( 3 );
|
||||
pActiveQuest->c.sequence = res->getUInt8( 4 );
|
||||
pActiveQuest->c.flags = res->getUInt8( 5 );
|
||||
pActiveQuest->c.UI8A = res->getUInt8( 6 );
|
||||
pActiveQuest->c.UI8B = res->getUInt8( 7 );
|
||||
pActiveQuest->c.UI8C = res->getUInt8( 8 );
|
||||
pActiveQuest->c.UI8D = res->getUInt8( 9 );
|
||||
pActiveQuest->c.UI8E = res->getUInt8( 10 );
|
||||
pActiveQuest->c.UI8F = res->getUInt8( 11 );
|
||||
pActiveQuest->c.padding1 = res->getUInt8( 12 );
|
||||
m_activeQuests[slotId] = pActiveQuest;
|
||||
|
||||
boost::shared_ptr<QuestActive> pActiveQuest( new QuestActive() );
|
||||
pActiveQuest->c.questId = res->getUInt16( index );
|
||||
pActiveQuest->c.sequence = res->getUInt8( index + 1 );
|
||||
pActiveQuest->c.flags = res->getUInt8( index + 2 );
|
||||
pActiveQuest->c.UI8A = res->getUInt8( index + 3 );
|
||||
pActiveQuest->c.UI8B = res->getUInt8( index + 4 );
|
||||
pActiveQuest->c.UI8C = res->getUInt8( index + 5 );
|
||||
pActiveQuest->c.UI8D = res->getUInt8( index + 6 );
|
||||
pActiveQuest->c.UI8E = res->getUInt8( index + 7 );
|
||||
pActiveQuest->c.UI8F = res->getUInt8( index + 8 );
|
||||
pActiveQuest->c.padding1 = res->getUInt8( index + 9 );
|
||||
m_activeQuests[i] = pActiveQuest;
|
||||
m_questIdToQuestIdx[pActiveQuest->c.questId] = slotId;
|
||||
m_questIdxToQuestId[slotId] = pActiveQuest->c.questId;
|
||||
|
||||
m_questIdToQuestIdx[pActiveQuest->c.questId] = i;
|
||||
m_questIdxToQuestId[i] = pActiveQuest->c.questId;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_activeQuests[i] = nullptr;
|
||||
m_freeQuestIdxQueue.push( i );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -281,7 +262,7 @@ bool Core::Entity::Player::loadClassData()
|
|||
|
||||
bool Core::Entity::Player::loadSearchInfo()
|
||||
{
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_SEACHINFO_SEL_LOAD );
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_SEARCHINFO_SEL_LOAD );
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = g_charaDb.query( stmt );
|
||||
|
||||
|
@ -416,14 +397,29 @@ void Core::Entity::Player::updateSql()
|
|||
|
||||
g_charaDb.execute( stmt );
|
||||
|
||||
////// Searchinfo
|
||||
auto stmtS = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
||||
stmtS->setInt( 1, m_searchSelectClass );
|
||||
stmtS->setInt( 2, m_id );
|
||||
g_charaDb.execute( stmtS );
|
||||
|
||||
auto stmtS1 = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_SEARCHINFO_UP_SELECTREGION );
|
||||
stmtS1->setInt( 1, m_searchSelectRegion );
|
||||
stmtS1->setInt( 2, m_id );
|
||||
g_charaDb.execute( stmtS1 );
|
||||
|
||||
auto stmtS2 = g_charaDb.getPreparedStatement( Core::Db::CharaDbStatements::CHARA_SEARCHINFO_UP_SELECTREGION );
|
||||
stmtS2->setString( 1, std::string( m_searchMessage != nullptr ? m_searchMessage : "" ) );
|
||||
stmtS2->setInt( 2, m_id );
|
||||
g_charaDb.execute( stmtS2 );
|
||||
|
||||
////// QUESTS
|
||||
updateAllQuests();
|
||||
|
||||
std::set< std::string > charaClassSet;
|
||||
std::set< std::string > charaQuestSet;
|
||||
std::set< std::string > charaInfoSearchSet;
|
||||
|
||||
std::string dbName = g_serverZone.getConfig()->getValue< std::string >( "Settings.General.Mysql.Database", "sapphire" );
|
||||
std::string updateCharaClass = "UPDATE " + dbName + ".characlass SET ";
|
||||
std::string updateCharaQuest = "UPDATE " + dbName + ".charaquest SET ";
|
||||
std::string updateCharaInfoSearch = "UPDATE " + dbName + ".charainfosearch SET ";
|
||||
|
||||
std::string condition = " UPDATE_DATE = NOW() WHERE CharacterId = " + std::to_string( m_id ) + ";";
|
||||
|
||||
|
@ -431,48 +427,6 @@ void Core::Entity::Player::updateSql()
|
|||
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++ )
|
||||
{
|
||||
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( " Flags_" + std::to_string( i ) + " = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.flags ) ) );
|
||||
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 ) + "_1 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8B ) ) );
|
||||
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 ) + "_3 = " + std::to_string( static_cast< uint32_t >( m_activeQuests[i]->c.UI8D ) ) );
|
||||
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 ) + "_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
|
||||
{
|
||||
charaQuestSet.insert( " QuestId_" + std::to_string( i ) + " = 0" );
|
||||
charaQuestSet.insert( " Sequence_" + std::to_string( i ) + " = 0" );
|
||||
charaQuestSet.insert( " Flags_" + std::to_string( i ) + " = 0" );
|
||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_0 = 0" );
|
||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_1 = 0" );
|
||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_2 = 0" );
|
||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_3 = 0" );
|
||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_4 = 0" );
|
||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_5 = 0" );
|
||||
charaQuestSet.insert( " Variables_" + std::to_string( i ) + "_6 = 0" );
|
||||
}
|
||||
}
|
||||
|
||||
charaInfoSearchSet.insert( " SelectClassId = " + std::to_string( m_searchSelectClass ) );
|
||||
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() )
|
||||
{
|
||||
for( auto entry : charaInfoSearchSet )
|
||||
updateCharaInfoSearch += entry + ", ";
|
||||
|
||||
updateCharaInfoSearch += condition;
|
||||
g_database.execute( updateCharaInfoSearch );
|
||||
}
|
||||
|
||||
if( !charaClassSet.empty() )
|
||||
{
|
||||
|
@ -482,15 +436,54 @@ void Core::Entity::Player::updateSql()
|
|||
updateCharaClass += condition;
|
||||
g_database.execute( updateCharaClass );
|
||||
}
|
||||
|
||||
if( !charaQuestSet.empty() )
|
||||
{
|
||||
for( auto entry : charaQuestSet )
|
||||
updateCharaQuest += entry + ", ";
|
||||
|
||||
updateCharaQuest += condition;
|
||||
g_database.execute( updateCharaQuest );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Core::Entity::Player::updateAllQuests() const
|
||||
{
|
||||
for( int32_t i = 0; i < 30; i++ )
|
||||
{
|
||||
if( m_activeQuests[i] != nullptr )
|
||||
{
|
||||
auto stmtS3 = g_charaDb.getPreparedStatement( Core::Db::CHARA_QUEST_UP );
|
||||
stmtS3->setInt( 1, m_activeQuests[i]->c.sequence );
|
||||
stmtS3->setInt( 2, m_activeQuests[i]->c.flags );
|
||||
stmtS3->setInt( 3, m_activeQuests[i]->c.UI8A );
|
||||
stmtS3->setInt( 4, m_activeQuests[i]->c.UI8B );
|
||||
stmtS3->setInt( 5, m_activeQuests[i]->c.UI8C );
|
||||
stmtS3->setInt( 6, m_activeQuests[i]->c.UI8D );
|
||||
stmtS3->setInt( 7, m_activeQuests[i]->c.UI8E );
|
||||
stmtS3->setInt( 8, m_activeQuests[i]->c.UI8F );
|
||||
stmtS3->setInt( 9, m_id);
|
||||
stmtS3->setInt( 10, m_activeQuests[i]->c.questId );
|
||||
g_charaDb.execute( stmtS3 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Entity::Player::deleteQuest( uint16_t questId ) const
|
||||
{
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CHARA_QUEST_DEL );
|
||||
stmt->setInt( 1, m_id );
|
||||
stmt->setInt( 2, questId );
|
||||
g_charaDb.execute( stmt );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uint8_t seq ) const
|
||||
{
|
||||
auto stmt = g_charaDb.getPreparedStatement( Core::Db::CHARA_QUEST_INS );
|
||||
stmt->setInt( 1, m_id );
|
||||
stmt->setInt( 2, index );
|
||||
stmt->setInt( 3, questId );
|
||||
stmt->setInt( 4, seq );
|
||||
stmt->setInt( 5, 0 );
|
||||
stmt->setInt( 6, 0 );
|
||||
stmt->setInt( 7, 0 );
|
||||
stmt->setInt( 8, 0 );
|
||||
stmt->setInt( 9, 0 );
|
||||
stmt->setInt( 10, 0 );
|
||||
stmt->setInt( 11, 0 );
|
||||
stmt->setInt( 12, 0 );
|
||||
g_charaDb.execute( stmt );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue