SQL: Characters db storage type cleanup No. 3 - Note:
There is a chance that you will be getting importing errors / data truncation warnings because of ancient invalid pet names. SELECT * FROM character_pet WHERE CHAR_LENGTH(`name`) > 21;
This commit is contained in:
@@ -198,7 +198,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
|
||||
SetDisplayId(fields[3].GetUInt32());
|
||||
SetNativeDisplayId(fields[3].GetUInt32());
|
||||
uint32 petlevel = fields[4].GetUInt32();
|
||||
uint32 petlevel = fields[4].GetUInt16();
|
||||
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
SetName(fields[8].GetString());
|
||||
|
||||
@@ -258,7 +258,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
// 0=current
|
||||
// 1..MAX_PET_STABLES in stable slot
|
||||
// PET_SAVE_NOT_IN_SLOT(100) = not stable slot (summoning))
|
||||
if (fields[7].GetUInt32() != 0)
|
||||
if (fields[7].GetUInt8() != 0)
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u' AND id <> '%u'",
|
||||
@@ -287,7 +287,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
map->Add(this->ToCreature());
|
||||
|
||||
m_resetTalentsCost = fields[15].GetUInt32();
|
||||
m_resetTalentsTime = fields[16].GetUInt64();
|
||||
m_resetTalentsTime = time_t(fields[16].GetUInt32());
|
||||
InitTalentForLevel(); // set original talents points before spell loading
|
||||
|
||||
uint32 timediff = uint32(time(NULL) - fields[14].GetUInt32());
|
||||
|
||||
@@ -1680,7 +1680,7 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket * p_data)
|
||||
if (cInfo)
|
||||
{
|
||||
petDisplayId = fields[17].GetUInt32();
|
||||
petLevel = fields[18].GetUInt32();
|
||||
petLevel = fields[18].GetUInt16();
|
||||
petFamily = cInfo->family;
|
||||
}
|
||||
}
|
||||
@@ -17313,8 +17313,10 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
||||
{
|
||||
uint16 slot = 0;
|
||||
|
||||
//// 0 1 3 4 5 6 7 8 9 10 11 12
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4 FROM character_queststatus WHERE guid = '%u'", GetGUIDLow());
|
||||
//// 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
|
||||
// itemcount4 FROM character_queststatus WHERE guid = '%u'", GetGUIDLow());
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -17341,7 +17343,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
||||
|
||||
questStatusData.m_explored = (fields[2].GetUInt8() > 0);
|
||||
|
||||
time_t quest_time = time_t(fields[3].GetUInt64());
|
||||
time_t quest_time = time_t(fields[3].GetUInt32());
|
||||
|
||||
if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_TIMED) && !GetQuestRewardStatus(quest_id))
|
||||
{
|
||||
@@ -17448,7 +17450,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
|
||||
if (qQuest->IsDFQuest())
|
||||
{
|
||||
m_DFQuests.insert(qQuest->GetQuestId());
|
||||
m_lastDailyQuestTime = (time_t)fields[1].GetUInt64();
|
||||
m_lastDailyQuestTime = time_t(fields[1].GetUInt32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -17900,7 +17902,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
m_homebindMapId = fields[0].GetUInt32();
|
||||
m_homebindMapId = fields[0].GetUInt16();
|
||||
m_homebindAreaId = fields[1].GetUInt16();
|
||||
m_homebindX = fields[2].GetFloat();
|
||||
m_homebindY = fields[3].GetFloat();
|
||||
|
||||
@@ -484,7 +484,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt32());
|
||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
|
||||
if (factionEntry && (factionEntry->reputationListID >= 0))
|
||||
{
|
||||
FactionState* faction = &m_factions[factionEntry->reputationListID];
|
||||
@@ -498,7 +498,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
|
||||
ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing);
|
||||
UpdateRankCounters(old_rank, new_rank);
|
||||
|
||||
uint32 dbFactionFlags = fields[2].GetUInt32();
|
||||
uint32 dbFactionFlags = fields[2].GetUInt16();
|
||||
|
||||
if (dbFactionFlags & FACTION_FLAG_VISIBLE)
|
||||
SetVisible(faction); // have internal checks for forced invisibility
|
||||
|
||||
@@ -562,7 +562,7 @@ void WorldSession::SendStablePetCallback(QueryResult result, uint64 guid)
|
||||
|
||||
data << uint32(fields[1].GetUInt32()); // petnumber
|
||||
data << uint32(fields[2].GetUInt32()); // creature entry
|
||||
data << uint32(fields[3].GetUInt32()); // level
|
||||
data << uint32(fields[3].GetUInt16()); // level
|
||||
data << fields[4].GetString(); // name
|
||||
data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show)
|
||||
|
||||
@@ -816,7 +816,7 @@ void WorldSession::HandleStableSwapPetCallback(QueryResult result, uint32 petnum
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
uint32 slot = fields[0].GetUInt32();
|
||||
uint32 slot = fields[0].GetUInt8();
|
||||
uint32 creature_id = fields[1].GetUInt32();
|
||||
|
||||
if (!creature_id)
|
||||
|
||||
@@ -2600,7 +2600,7 @@ void World::InitDailyQuestResetTime()
|
||||
if (result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
mostRecentQuestTime = (time_t)fields[0].GetUInt64();
|
||||
mostRecentQuestTime = time_t(fields[0].GetUInt32());
|
||||
}
|
||||
else
|
||||
mostRecentQuestTime = 0;
|
||||
|
||||
Reference in New Issue
Block a user