aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorleak <leakzx@googlemail.com>2011-01-19 18:40:36 +0100
committerleak <leakzx@googlemail.com>2011-01-19 18:51:00 +0100
commit471b6f138d3025a01c5410f19862f8ee05c4007d (patch)
tree80b8d583b5c765725f467de91933635c387274da /src
parentc306acf298ade5547512e04351a8f9ae4fdbae6d (diff)
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;
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp6
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp14
-rwxr-xr-xsrc/server/game/Reputation/ReputationMgr.cpp4
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/NPCHandler.cpp4
-rwxr-xr-xsrc/server/game/World/World.cpp2
5 files changed, 16 insertions, 14 deletions
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index ee7988f1e8c..1fed8912e2f 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -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());
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 89b81282e36..135175ca26a 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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();
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index 19f730ba4a0..64daab36082 100755
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -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
diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
index 133ff07489c..73406262b2d 100755
--- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
@@ -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)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 0f99fc38f48..5a4e83992a5 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -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;