mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 02:50:29 +00:00
Core/Players: Fixed saving quest item progress (#1129)
Ported from TC (original commit by Shauren) Add 2 columns to character_queststatus
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
INSERT INTO version_db_characters (`sql_rev`) VALUES ('1545178470896804464');
|
||||
|
||||
ALTER TABLE `character_queststatus`
|
||||
ADD `itemcount5` smallint(5) unsigned NOT NULL DEFAULT '0' AFTER `itemcount4`,
|
||||
ADD `itemcount6` smallint(5) unsigned NOT NULL DEFAULT '0' AFTER `itemcount5`;
|
||||
@@ -66,7 +66,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
"base_amount0, base_amount1, base_amount2, maxDuration, remainTime, remainCharges FROM character_aura WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_SPELL, "SELECT spell, specMask FROM character_spell WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_QUESTSTATUS, "SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, "
|
||||
"itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ? AND status <> 0", CONNECTION_ASYNC);
|
||||
"itemcount1, itemcount2, itemcount3, itemcount4, itemcount5, itemcount6, playercount FROM character_queststatus WHERE guid = ? AND status <> 0", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_DAILYQUESTSTATUS, "SELECT quest, time FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_WEEKLYQUESTSTATUS, "SELECT quest FROM character_queststatus_weekly WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_MONTHLYQUESTSTATUS, "SELECT quest FROM character_queststatus_monthly WHERE guid = ?", CONNECTION_ASYNC);
|
||||
@@ -478,7 +478,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM, "DELETE FROM character_inventory WHERE item = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT, "DELETE FROM character_inventory WHERE bag = ? AND slot = ? AND guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_MAIL, "UPDATE mail SET has_items = ?, expire_time = ?, deliver_time = ?, money = ?, cod = ?, checked = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_CHAR_QUESTSTATUS, "REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, playercount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_CHAR_QUESTSTATUS, "REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, itemcount5, itemcount6, playercount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST, "DELETE FROM character_queststatus WHERE guid = ? AND quest = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_CHAR_QUESTSTATUS_REWARDED, "INSERT IGNORE INTO character_queststatus_rewarded (guid, quest, active) VALUES (?, ?, 1)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, "DELETE FROM character_queststatus_rewarded WHERE guid = ? AND quest = ?", CONNECTION_ASYNC);
|
||||
|
||||
@@ -18975,8 +18975,8 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
||||
|
||||
//// 0 1 2 3 4 5 6 7 8 9 10
|
||||
//QueryResult* result = CharacterDatabase.PQuery("SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3,
|
||||
// 11 12
|
||||
// itemcount4, playercount FROM character_queststatus WHERE guid = '%u'", GetGUIDLow());
|
||||
// 11 12 13 14
|
||||
// itemcount4, itemcount5, itemcount6, playercount FROM character_queststatus WHERE guid = '%u'", GetGUIDLow());
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -19018,15 +19018,13 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
||||
else
|
||||
quest_time = 0;
|
||||
|
||||
questStatusData.CreatureOrGOCount[0] = fields[4].GetUInt16();
|
||||
questStatusData.CreatureOrGOCount[1] = fields[5].GetUInt16();
|
||||
questStatusData.CreatureOrGOCount[2] = fields[6].GetUInt16();
|
||||
questStatusData.CreatureOrGOCount[3] = fields[7].GetUInt16();
|
||||
questStatusData.ItemCount[0] = fields[8].GetUInt16();
|
||||
questStatusData.ItemCount[1] = fields[9].GetUInt16();
|
||||
questStatusData.ItemCount[2] = fields[10].GetUInt16();
|
||||
questStatusData.ItemCount[3] = fields[11].GetUInt16();
|
||||
questStatusData.PlayerCount = fields[12].GetUInt16();
|
||||
for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
questStatusData.CreatureOrGOCount[i] = fields[4 + i].GetUInt16();
|
||||
|
||||
for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
|
||||
questStatusData.ItemCount[i] = fields[8 + i].GetUInt16();
|
||||
|
||||
questStatusData.PlayerCount = fields[14].GetUInt16();
|
||||
|
||||
// add to quest log
|
||||
if (slot < MAX_QUEST_LOG_SIZE && questStatusData.Status != QUEST_STATUS_NONE)
|
||||
@@ -19952,10 +19950,10 @@ void Player::_SaveQuestStatus(SQLTransaction& trans)
|
||||
stmt->setBool(index++, statusItr->second.Explored);
|
||||
stmt->setUInt32(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime()));
|
||||
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
|
||||
stmt->setUInt16(index++, statusItr->second.CreatureOrGOCount[i]);
|
||||
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
|
||||
stmt->setUInt16(index++, statusItr->second.ItemCount[i]);
|
||||
|
||||
stmt->setUInt16(index, statusItr->second.PlayerCount);
|
||||
|
||||
Reference in New Issue
Block a user