Account data saving must work now

This commit is contained in:
tomrus88 2008-10-28 01:44:27 +03:00
parent 97bf2e7d68
commit 6496f7499e
13 changed files with 87 additions and 71 deletions

View file

@ -18568,28 +18568,3 @@ void Player::InitGlyphsForLevel()
SetUInt32Value(PLAYER_GLYPHS_ENABLED, value);
}
void Player::LoadAccountData(QueryResult *result)
{
do
{
Field *fields = result->Fetch();
AccountData data;
uint32 type = fields[0].GetUInt32();
data.Time = fields[1].GetUInt32();
data.Data = fields[2].GetCppString();
if(type < NUM_ACCOUNT_DATA_TYPES)
m_accountData[type] = data;
} while (result->NextRow());
delete result;
}
void Player::SaveAccountData(uint32 type)
{
uint32 lowguid = GetGUIDLow();
CharacterDatabase.PExecute("DELETE FROM account_data WHERE guid=%u AND type=%u", lowguid, type);
CharacterDatabase.PExecute("INSERT INTO account_data VALUES (%u,%u,%u,%s)", lowguid, type, (uint32)m_accountData[type].Time, m_accountData[type].Data.c_str());
}