SQL: Characters db storage type cleanup No. 4
This commit is contained in:
1 parent
471b6f138d
commit
a7df9ddff1
19 files changed
+161
-92
No files matched your search
@@ -3988,7 +3988,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
|
||||
Field* fields = result->Fetch();
|
||||
uint32 spell_id = fields[0].GetUInt32();
|
||||
uint32 item_id = fields[1].GetUInt32();
|
||||
time_t db_time = (time_t)fields[2].GetUInt64();
|
||||
time_t db_time = time_t(fields[2].GetUInt32());
|
||||
|
||||
if (!sSpellStore.LookupEntry(spell_id))
|
||||
{
|
||||
@@ -4684,7 +4684,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
|
||||
{
|
||||
sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
|
||||
|
||||
QueryResult resultChars = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < '" UI64FMTD "'", uint64(time(NULL) - time_t(keepDays * DAY)));
|
||||
QueryResult resultChars = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < '%u'", uint32(time(NULL) - time_t(keepDays * DAY)));
|
||||
if (resultChars)
|
||||
{
|
||||
sLog->outString("Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete",resultChars->GetRowCount());
|
||||
@@ -7044,7 +7044,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
|
||||
if (!result)
|
||||
return 0;
|
||||
Field* fields = result->Fetch();
|
||||
uint32 zone = fields[0].GetUInt32();
|
||||
uint32 zone = fields[0].GetUInt16();
|
||||
|
||||
if (!zone)
|
||||
{
|
||||
@@ -7053,7 +7053,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
|
||||
if (!result)
|
||||
return 0;
|
||||
fields = result->Fetch();
|
||||
uint32 map = fields[0].GetUInt32();
|
||||
uint32 map = fields[0].GetUInt16();
|
||||
float posx = fields[1].GetFloat();
|
||||
float posy = fields[2].GetFloat();
|
||||
float posz = fields[3].GetFloat();
|
||||
@@ -16097,7 +16097,7 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float&
|
||||
y = fields[1].GetFloat();
|
||||
z = fields[2].GetFloat();
|
||||
o = fields[3].GetFloat();
|
||||
mapid = fields[4].GetUInt32();
|
||||
mapid = fields[4].GetUInt16();
|
||||
in_flight = !fields[5].GetString().empty();
|
||||
|
||||
return true;
|
||||
@@ -16249,7 +16249,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
// init saved position, and fix it later if problematic
|
||||
uint32 transGUID = uint32(fields[30].GetUInt64()); // field type is uint64 but lowguid is saved
|
||||
Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat());
|
||||
uint32 mapId = fields[15].GetUInt32();
|
||||
uint32 mapId = fields[15].GetUInt16();
|
||||
uint32 instanceId = fields[58].GetUInt8();
|
||||
|
||||
uint32 dungeonDiff = fields[38].GetUInt32() & 0x0F;
|
||||
@@ -16516,7 +16516,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
SaveRecallPosition();
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t logoutTime = time_t(fields[22].GetUInt64());
|
||||
time_t logoutTime = time_t(fields[22].GetUInt32());
|
||||
|
||||
// since last logout (in seconds)
|
||||
uint32 time_diff = uint32(now - logoutTime); //uint64 is excessive for a time_diff in seconds.. uint32 allows for 136~ year difference.
|
||||
@@ -16536,7 +16536,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
m_Played_time[PLAYED_TIME_LEVEL]= fields[20].GetUInt32();
|
||||
|
||||
m_resetTalentsCost = fields[24].GetUInt32();
|
||||
m_resetTalentsTime = time_t(fields[25].GetUInt64());
|
||||
m_resetTalentsTime = time_t(fields[25].GetUInt32());
|
||||
|
||||
// reserve some flags
|
||||
uint32 old_safe_flags = GetUInt32Value(PLAYER_FLAGS) & (PLAYER_FLAGS_HIDE_CLOAK | PLAYER_FLAGS_HIDE_HELM);
|
||||
@@ -16546,7 +16546,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
|
||||
m_taxi.LoadTaxiMask(fields[17].GetCString()); // must be before InitTaxiNodesForLevel
|
||||
|
||||
uint32 extraflags = fields[31].GetUInt32();
|
||||
uint32 extraflags = fields[31].GetUInt16();
|
||||
|
||||
m_stableSlots = fields[32].GetUInt8();
|
||||
if (m_stableSlots > MAX_PET_STABLES)
|
||||
@@ -16555,14 +16555,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
m_stableSlots = MAX_PET_STABLES;
|
||||
}
|
||||
|
||||
m_atLoginFlags = fields[33].GetUInt32();
|
||||
m_atLoginFlags = fields[33].GetUInt16();
|
||||
|
||||
// Honor system
|
||||
// Update Honor kills data
|
||||
m_lastHonorUpdateTime = logoutTime;
|
||||
UpdateHonorFields();
|
||||
|
||||
m_deathExpireTime = (time_t)fields[36].GetUInt64();
|
||||
m_deathExpireTime = time_t(fields[36].GetUInt32());
|
||||
if (m_deathExpireTime > now+MAX_DEATH_COUNT*DEATH_EXPIRE_STEP)
|
||||
m_deathExpireTime = now+MAX_DEATH_COUNT*DEATH_EXPIRE_STEP-1;
|
||||
|
||||
@@ -18014,12 +18014,12 @@ void Player::SaveToDB()
|
||||
ss << m_Played_time[PLAYED_TIME_LEVEL] << ", ";
|
||||
|
||||
ss << finiteAlways(m_rest_bonus) << ", ";
|
||||
ss << (uint64)time(NULL) << ", ";
|
||||
ss << uint32(time(NULL)) << ", ";
|
||||
ss << (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0) << ", ";
|
||||
//save, far from tavern/city
|
||||
//save, but in tavern/city
|
||||
ss << m_resetTalentsCost << ", ";
|
||||
ss << (uint64)m_resetTalentsTime << ", ";
|
||||
ss << uint32(m_resetTalentsTime) << ", ";
|
||||
|
||||
ss << finiteAlways(m_movementInfo.t_pos.GetPositionX()) << ", ";
|
||||
ss << finiteAlways(m_movementInfo.t_pos.GetPositionY()) << ", ";
|
||||
@@ -18039,7 +18039,7 @@ void Player::SaveToDB()
|
||||
|
||||
ss << GetZoneId() << ", ";
|
||||
|
||||
ss << (uint64)m_deathExpireTime << ", '";
|
||||
ss << uint32(m_deathExpireTime) << ", '";
|
||||
|
||||
ss << m_taxi.SaveTaxiDestinationsToString() << "', ";
|
||||
|
||||
|
||||
Reference in new issue
Block a user