|
|
|
@@ -4305,7 +4305,9 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
|
|
|
|
|
|
|
|
|
|
void Player::_SaveSpellCooldowns(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
trans->PAppend("DELETE FROM character_spell_cooldown WHERE guid = '%u'", GetGUIDLow());
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_COOLDOWN);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
time_t curTime = time(NULL);
|
|
|
|
|
time_t infTime = curTime + infinityCooldownDelayCheck;
|
|
|
|
@@ -4826,13 +4828,19 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
|
|
|
|
|
|
|
|
|
// We can return mail now
|
|
|
|
|
// So firstly delete the old one
|
|
|
|
|
trans->PAppend("DELETE FROM mail WHERE id = '%u'", mail_id);
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
|
|
|
|
|
stmt->setUInt32(0, mail_id);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
// Mail is not from player
|
|
|
|
|
if (mailType != MAIL_NORMAL)
|
|
|
|
|
{
|
|
|
|
|
if (has_items)
|
|
|
|
|
trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mail_id);
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
|
|
|
|
|
stmt->setUInt32(0, mail_id);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -4877,7 +4885,9 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mail_id);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
|
|
|
|
|
stmt->setUInt32(0, mail_id);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
uint32 pl_account = sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
|
|
|
|
|
|
|
|
|
@@ -4921,48 +4931,134 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
|
|
|
|
} while (resultFriends->NextRow());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trans->PAppend("DELETE FROM characters WHERE guid = '%u'", guid);
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ACCOUNT_DATA);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
trans->PAppend("DELETE FROM character_declinedname WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_action WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_aura WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_gifts WHERE guid = '%u'", guid);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ACCOUNT_DATA);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GIFT);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
trans->PAppend("DELETE FROM character_instance WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_inventory WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_queststatus WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_queststatus_rewarded WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_spell WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_spell_cooldown WHERE guid = '%u'", guid);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_COOLDOWN);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_GM_TICKETS);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
trans->PAppend("DELETE FROM item_instance WHERE owner_guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_social WHERE guid = '%u' OR friend='%u'", guid, guid);
|
|
|
|
|
trans->PAppend("DELETE FROM mail WHERE receiver = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM mail_items WHERE receiver = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_pet WHERE owner = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_pet_declinedname WHERE owner = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_achievement WHERE guid = '%u' " // NOTE: These achievements have flags & 256 in DBC.
|
|
|
|
|
"AND achievement NOT BETWEEN '456' AND '467' " // Realm First Level 80
|
|
|
|
|
"AND achievement NOT BETWEEN '1400' AND '1427' " // Realm First Raid Achievements
|
|
|
|
|
"AND achievement NOT IN(1463, 3117, 3259) ", guid); // Realm First Northen Vanguard + Raid Achievements
|
|
|
|
|
trans->PAppend("DELETE FROM character_achievement_progress WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_equipmentsets WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM guild_eventlog WHERE PlayerGuid1 = '%u' OR PlayerGuid2 = '%u'", guid, guid);
|
|
|
|
|
trans->PAppend("DELETE FROM guild_bank_eventlog WHERE PlayerGuid = '%u'", guid);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEMS);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_OWNER);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENTS);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_EQUIPMENTSETS);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
stmt->setUInt32(1, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_BGDATA);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
trans->PAppend("DELETE FROM character_glyphs WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_queststatus_daily WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_talent WHERE guid = '%u'", guid);
|
|
|
|
|
trans->PAppend("DELETE FROM character_skills WHERE guid = '%u'", guid);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_DAILY);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILLS);
|
|
|
|
|
stmt->setUInt32(0, guid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
CharacterDatabase.CommitTransaction(trans);
|
|
|
|
|
break;
|
|
|
|
@@ -7270,24 +7366,38 @@ void Player::SetArenaPoints(uint32 value)
|
|
|
|
|
|
|
|
|
|
void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
int32 newValue = int32(GetHonorPoints()) + value;
|
|
|
|
|
if (newValue < 0)
|
|
|
|
|
newValue = 0;
|
|
|
|
|
SetHonorPoints(uint32(newValue));
|
|
|
|
|
|
|
|
|
|
if (trans && !trans->null())
|
|
|
|
|
(*trans)->PAppend("UPDATE characters SET totalHonorPoints=%u WHERE guid=%u", newValue, GetGUIDLow());
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
|
|
|
|
|
stmt->setUInt32(0, newValue);
|
|
|
|
|
stmt->setUInt32(1, GetGUIDLow());
|
|
|
|
|
(*trans)->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
int32 newValue = int32(GetArenaPoints()) + value;
|
|
|
|
|
if (newValue < 0)
|
|
|
|
|
newValue = 0;
|
|
|
|
|
SetArenaPoints(uint32(newValue));
|
|
|
|
|
|
|
|
|
|
if (trans && !trans->null())
|
|
|
|
|
(*trans)->PAppend("UPDATE characters SET arenaPoints=%u WHERE guid=%u", newValue, GetGUIDLow());
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
|
|
|
|
|
stmt->setUInt32(0, newValue);
|
|
|
|
|
stmt->setUInt32(1, GetGUIDLow());
|
|
|
|
|
(*trans)->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32 Player::GetGuildIdFromDB(uint64 guid)
|
|
|
|
@@ -17576,6 +17686,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
|
|
|
|
|
|
|
|
|
|
Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
Item* item = NULL;
|
|
|
|
|
uint32 itemGuid = fields[13].GetUInt32();
|
|
|
|
|
uint32 itemEntry = fields[14].GetUInt32();
|
|
|
|
@@ -17605,7 +17716,11 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
|
|
|
|
{
|
|
|
|
|
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with expired refund time (%u). Deleting refund data and removing refundable flag.",
|
|
|
|
|
GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), item->GetPlayedTime());
|
|
|
|
|
trans->PAppend("DELETE FROM item_refund_instance WHERE item_guid = '%u'", item->GetGUIDLow());
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
|
|
|
|
|
stmt->setUInt32(0, item->GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@@ -18134,7 +18249,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
|
|
|
|
|
|
|
|
|
|
if (deleteInstance)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE);
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID);
|
|
|
|
|
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, instanceId);
|
|
|
|
@@ -18190,7 +18305,7 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu
|
|
|
|
|
{
|
|
|
|
|
if (!unload)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE);
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE);
|
|
|
|
|
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, itr->second.save->GetInstanceId());
|
|
|
|
@@ -18815,29 +18930,51 @@ void Player::SaveInventoryAndGoldToDB(SQLTransaction& trans)
|
|
|
|
|
|
|
|
|
|
void Player::SaveGoldToDB(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
trans->PAppend("UPDATE characters SET money = '%u' WHERE guid = '%u'", GetMoney(), GetGUIDLow());
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_MONEY);
|
|
|
|
|
stmt->setUInt32(0, GetMoney());
|
|
|
|
|
stmt->setUInt32(1, GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::_SaveActions(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end();)
|
|
|
|
|
{
|
|
|
|
|
switch (itr->second.uState)
|
|
|
|
|
{
|
|
|
|
|
case ACTIONBUTTON_NEW:
|
|
|
|
|
trans->PAppend("INSERT INTO character_action (guid, spec, button, action, type) VALUES ('%u', '%u', '%u', '%u', '%u')",
|
|
|
|
|
GetGUIDLow(), m_activeSpec, (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType());
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt8(1, m_activeSpec);
|
|
|
|
|
stmt->setUInt8(2, itr->first);
|
|
|
|
|
stmt->setUInt32(3, itr->second.GetAction());
|
|
|
|
|
stmt->setUInt8(4, uint8(itr->second.GetType()));
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
itr->second.uState = ACTIONBUTTON_UNCHANGED;
|
|
|
|
|
++itr;
|
|
|
|
|
break;
|
|
|
|
|
case ACTIONBUTTON_CHANGED:
|
|
|
|
|
trans->PAppend("UPDATE character_action SET action = '%u', type = '%u' WHERE guid = '%u' AND button = '%u' AND spec = '%u'",
|
|
|
|
|
(uint32)itr->second.GetAction(), (uint32)itr->second.GetType(), GetGUIDLow(), (uint32)itr->first, m_activeSpec);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACTION);
|
|
|
|
|
stmt->setUInt32(0, itr->second.GetAction());
|
|
|
|
|
stmt->setUInt8(1, uint8(itr->second.GetType()));
|
|
|
|
|
stmt->setUInt32(2, GetGUIDLow());
|
|
|
|
|
stmt->setUInt8(3, itr->first);
|
|
|
|
|
stmt->setUInt8(4, m_activeSpec);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
itr->second.uState = ACTIONBUTTON_UNCHANGED;
|
|
|
|
|
++itr;
|
|
|
|
|
break;
|
|
|
|
|
case ACTIONBUTTON_DELETED:
|
|
|
|
|
trans->PAppend("DELETE FROM character_action WHERE guid = '%u' and button = '%u' and spec = '%u'", GetGUIDLow(), (uint32)itr->first, m_activeSpec);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt8(1, itr->first);
|
|
|
|
|
stmt->setUInt8(2, m_activeSpec);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
m_actionButtons.erase(itr++);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
@@ -18905,6 +19042,7 @@ void Player::_SaveAuras(SQLTransaction& trans)
|
|
|
|
|
|
|
|
|
|
void Player::_SaveInventory(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
// force items in buyback slots to new state
|
|
|
|
|
// and remove those that aren't already
|
|
|
|
|
for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i)
|
|
|
|
@@ -18912,8 +19050,12 @@ void Player::_SaveInventory(SQLTransaction& trans)
|
|
|
|
|
Item* item = m_items[i];
|
|
|
|
|
if (!item || item->GetState() == ITEM_NEW)
|
|
|
|
|
continue;
|
|
|
|
|
trans->PAppend("DELETE FROM character_inventory WHERE item = '%u'", item->GetGUIDLow());
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
|
|
|
|
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
|
|
|
|
|
stmt->setUInt32(0, item->GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
|
|
|
|
stmt->setUInt32(0, item->GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
m_items[i]->FSetState(ITEM_NEW);
|
|
|
|
@@ -18971,7 +19113,12 @@ void Player::_SaveInventory(SQLTransaction& trans)
|
|
|
|
|
bagTestGUID = test2->GetGUIDLow();
|
|
|
|
|
sLog->outError("Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState());
|
|
|
|
|
// according to the test that was just performed nothing should be in this slot, delete
|
|
|
|
|
trans->PAppend("DELETE FROM character_inventory WHERE bag=%u AND slot=%u AND guid=%u", bagTestGUID, item->GetSlot(), lowGuid);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT);
|
|
|
|
|
stmt->setUInt32(0, bagTestGUID);
|
|
|
|
|
stmt->setUInt8(1, item->GetSlot());
|
|
|
|
|
stmt->setUInt32(2, lowGuid);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
// also THIS item should be somewhere else, cheat attempt
|
|
|
|
|
item->FSetState(ITEM_REMOVED); // we are IN updateQueue right now, can't use SetState which modifies the queue
|
|
|
|
|
DeleteRefundReference(item->GetGUIDLow());
|
|
|
|
@@ -19019,17 +19166,32 @@ void Player::_SaveMail(SQLTransaction& trans)
|
|
|
|
|
if (!m_mailsLoaded)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
|
|
|
|
|
{
|
|
|
|
|
Mail* m = (*itr);
|
|
|
|
|
if (m->state == MAIL_STATE_CHANGED)
|
|
|
|
|
{
|
|
|
|
|
trans->PAppend("UPDATE mail SET has_items = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "', money = '%u', cod = '%u', checked = '%u' WHERE id = '%u'",
|
|
|
|
|
m->HasItems() ? 1 : 0, (uint64)m->expire_time, (uint64)m->deliver_time, m->money, m->COD, m->checked, m->messageID);
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL);
|
|
|
|
|
stmt->setUInt8(0, uint8(m->HasItems() ? 1 : 0));
|
|
|
|
|
stmt->setUInt32(1, uint32(m->expire_time));
|
|
|
|
|
stmt->setUInt32(2, uint32(m->deliver_time));
|
|
|
|
|
stmt->setUInt32(3, m->money);
|
|
|
|
|
stmt->setUInt32(4, m->COD);
|
|
|
|
|
stmt->setUInt8(5, uint8(m->checked));
|
|
|
|
|
stmt->setUInt32(6, m->messageID);
|
|
|
|
|
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
if (!m->removedItems.empty())
|
|
|
|
|
{
|
|
|
|
|
for (std::vector<uint32>::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
|
|
|
|
|
trans->PAppend("DELETE FROM mail_items WHERE item_guid = '%u'", *itr2);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
|
|
|
|
|
stmt->setUInt32(0, *itr2);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
m->removedItems.clear();
|
|
|
|
|
}
|
|
|
|
|
m->state = MAIL_STATE_UNCHANGED;
|
|
|
|
@@ -19046,8 +19208,13 @@ void Player::_SaveMail(SQLTransaction& trans)
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
trans->PAppend("DELETE FROM mail WHERE id = '%u'", m->messageID);
|
|
|
|
|
trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", m->messageID);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
|
|
|
|
|
stmt->setUInt32(0, m->messageID);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
|
|
|
|
|
stmt->setUInt32(0, m->messageID);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -19076,6 +19243,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans)
|
|
|
|
|
|
|
|
|
|
QuestStatusSaveMap::iterator saveItr;
|
|
|
|
|
QuestStatusMap::iterator statusItr;
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
bool keepAbandoned = !(sWorld->GetCleaningFlags() & CharacterDatabaseCleaner::CLEANING_FLAG_QUESTSTATUS);
|
|
|
|
|
|
|
|
|
@@ -19085,12 +19253,33 @@ void Player::_SaveQuestStatus(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
statusItr = m_QuestStatus.find(saveItr->first);
|
|
|
|
|
if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.Status != QUEST_STATUS_NONE))
|
|
|
|
|
trans->PAppend("REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, playercount) "
|
|
|
|
|
"VALUES ('%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')",
|
|
|
|
|
GetGUIDLow(), statusItr->first, statusItr->second.Status, statusItr->second.Explored, uint64(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime()), statusItr->second.CreatureOrGOCount[0], statusItr->second.CreatureOrGOCount[1], statusItr->second.CreatureOrGOCount[2], statusItr->second.CreatureOrGOCount[3], statusItr->second.ItemCount[0], statusItr->second.ItemCount[1], statusItr->second.ItemCount[2], statusItr->second.ItemCount[3], statusItr->second.PlayerCount);
|
|
|
|
|
{
|
|
|
|
|
uint8 index = 0;
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHAR_QUESTSTATUS);
|
|
|
|
|
|
|
|
|
|
stmt->setUInt32(index++, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(index++, statusItr->first);
|
|
|
|
|
stmt->setUInt8(index++, uint8(statusItr->second.Status));
|
|
|
|
|
stmt->setBool(index++, statusItr->second.Explored);
|
|
|
|
|
stmt->setUInt32(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime()));
|
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < 4; i++)
|
|
|
|
|
stmt->setUInt16(index++, statusItr->second.CreatureOrGOCount[i]);
|
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < 4; i++)
|
|
|
|
|
stmt->setUInt16(index++, statusItr->second.ItemCount[i]);
|
|
|
|
|
|
|
|
|
|
stmt->setUInt16(index, statusItr->second.PlayerCount);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
trans->PAppend("DELETE FROM character_queststatus WHERE guid = %u AND quest = %u", GetGUIDLow(), saveItr->first);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, saveItr->first);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_QuestStatusSave.clear();
|
|
|
|
@@ -19098,9 +19287,20 @@ void Player::_SaveQuestStatus(SQLTransaction& trans)
|
|
|
|
|
for (saveItr = m_RewardedQuestsSave.begin(); saveItr != m_RewardedQuestsSave.end(); ++saveItr)
|
|
|
|
|
{
|
|
|
|
|
if (saveItr->second)
|
|
|
|
|
trans->PAppend("INSERT IGNORE INTO character_queststatus_rewarded (guid, quest) VALUES (%u, %u)", GetGUIDLow(), saveItr->first);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_QUESTSTATUS);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, saveItr->first);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (!keepAbandoned)
|
|
|
|
|
trans->PAppend("DELETE FROM character_queststatus_rewarded WHERE guid = %u AND quest = %u", GetGUIDLow(), saveItr->first);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, saveItr->first);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_RewardedQuestsSave.clear();
|
|
|
|
@@ -19200,6 +19400,7 @@ void Player::_SaveSeasonalQuestStatus(SQLTransaction& trans)
|
|
|
|
|
|
|
|
|
|
void Player::_SaveSkills(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
// we don't need transactions here.
|
|
|
|
|
for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end();)
|
|
|
|
|
{
|
|
|
|
@@ -19211,7 +19412,11 @@ void Player::_SaveSkills(SQLTransaction& trans)
|
|
|
|
|
|
|
|
|
|
if (itr->second.uState == SKILL_DELETED)
|
|
|
|
|
{
|
|
|
|
|
trans->PAppend("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), itr->first);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_BY_SKILL);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, itr->first);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
mSkillStatus.erase(itr++);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@@ -19223,12 +19428,22 @@ void Player::_SaveSkills(SQLTransaction& trans)
|
|
|
|
|
switch (itr->second.uState)
|
|
|
|
|
{
|
|
|
|
|
case SKILL_NEW:
|
|
|
|
|
trans->PAppend("INSERT INTO character_skills (guid, skill, value, max) VALUES ('%u', '%u', '%u', '%u')",
|
|
|
|
|
GetGUIDLow(), itr->first, value, max);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILLS);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt16(1, uint16(itr->first));
|
|
|
|
|
stmt->setUInt16(2, value);
|
|
|
|
|
stmt->setUInt16(3, max);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case SKILL_CHANGED:
|
|
|
|
|
trans->PAppend("UPDATE character_skills SET value = '%u', max = '%u'WHERE guid = '%u' AND skill = '%u' ",
|
|
|
|
|
value, max, GetGUIDLow(), itr->first);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_SKILLS);
|
|
|
|
|
stmt->setUInt16(0, value);
|
|
|
|
|
stmt->setUInt16(1, max);
|
|
|
|
|
stmt->setUInt32(2, GetGUIDLow());
|
|
|
|
|
stmt->setUInt16(3, uint16(itr->first));
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
@@ -19241,14 +19456,28 @@ void Player::_SaveSkills(SQLTransaction& trans)
|
|
|
|
|
|
|
|
|
|
void Player::_SaveSpells(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();)
|
|
|
|
|
{
|
|
|
|
|
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED)
|
|
|
|
|
trans->PAppend("DELETE FROM character_spell WHERE guid = '%u' and spell = '%u'", GetGUIDLow(), itr->first);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
|
|
|
|
|
stmt->setUInt32(0, itr->first);
|
|
|
|
|
stmt->setUInt32(1, GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add only changed/new not dependent spells
|
|
|
|
|
if (!itr->second->dependent && (itr->second->state == PLAYERSPELL_NEW || itr->second->state == PLAYERSPELL_CHANGED))
|
|
|
|
|
trans->PAppend("INSERT INTO character_spell (guid, spell, active, disabled) VALUES ('%u', '%u', '%u', '%u')", GetGUIDLow(), itr->first, itr->second->active ? 1 : 0, itr->second->disabled ? 1 : 0);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, itr->first);
|
|
|
|
|
stmt->setBool(2, itr->second->active);
|
|
|
|
|
stmt->setBool(3, itr->second->disabled);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (itr->second->state == PLAYERSPELL_REMOVED)
|
|
|
|
|
{
|
|
|
|
@@ -19271,31 +19500,40 @@ void Player::_SaveStats(SQLTransaction& trans)
|
|
|
|
|
if (!sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE) || getLevel() < sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
trans->PAppend("DELETE FROM character_stats WHERE guid = '%u'", GetGUIDLow());
|
|
|
|
|
std::ostringstream ss;
|
|
|
|
|
ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, "
|
|
|
|
|
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
|
|
|
|
|
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower, resilience) VALUES ("
|
|
|
|
|
<< GetGUIDLow() << ','
|
|
|
|
|
<< GetMaxHealth() << ',';
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_STATS);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
uint8 index = 0;
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_STATS);
|
|
|
|
|
stmt->setUInt32(index++, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(index++, GetMaxHealth());
|
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < MAX_POWERS; ++i)
|
|
|
|
|
ss << GetMaxPower(Powers(i)) << ',';
|
|
|
|
|
stmt->setUInt32(index++, GetMaxPower(Powers(i)));
|
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < MAX_STATS; ++i)
|
|
|
|
|
ss << GetStat(Stats(i)) << ',';
|
|
|
|
|
// armor + school resistances
|
|
|
|
|
stmt->setUInt32(index++, GetStat(Stats(i)));
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
|
|
|
|
|
ss << GetResistance(SpellSchools(i)) << ',';
|
|
|
|
|
ss << GetFloatValue(PLAYER_BLOCK_PERCENTAGE) << ','
|
|
|
|
|
<< GetFloatValue(PLAYER_DODGE_PERCENTAGE) << ','
|
|
|
|
|
<< GetFloatValue(PLAYER_PARRY_PERCENTAGE) << ','
|
|
|
|
|
<< GetFloatValue(PLAYER_CRIT_PERCENTAGE) << ','
|
|
|
|
|
<< GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE) << ','
|
|
|
|
|
<< GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1) << ','
|
|
|
|
|
<< GetUInt32Value(UNIT_FIELD_ATTACK_POWER) << ','
|
|
|
|
|
<< GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) << ','
|
|
|
|
|
<< GetBaseSpellPowerBonus() << ','
|
|
|
|
|
<< GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL) << ')';
|
|
|
|
|
trans->Append(ss.str().c_str());
|
|
|
|
|
stmt->setUInt32(index++, GetResistance(SpellSchools(i)));
|
|
|
|
|
|
|
|
|
|
stmt->setFloat(index++, GetFloatValue(PLAYER_BLOCK_PERCENTAGE));
|
|
|
|
|
stmt->setFloat(index++, GetFloatValue(PLAYER_DODGE_PERCENTAGE));
|
|
|
|
|
stmt->setFloat(index++, GetFloatValue(PLAYER_PARRY_PERCENTAGE));
|
|
|
|
|
stmt->setFloat(index++, GetFloatValue(PLAYER_CRIT_PERCENTAGE));
|
|
|
|
|
stmt->setFloat(index++, GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE));
|
|
|
|
|
stmt->setFloat(index++, GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1));
|
|
|
|
|
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_ATTACK_POWER));
|
|
|
|
|
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER));
|
|
|
|
|
stmt->setUInt32(index++, GetBaseSpellPowerBonus());
|
|
|
|
|
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL));
|
|
|
|
|
stmt->setUInt32(index++, GetMaxHealth());
|
|
|
|
|
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::outDebugValues() const
|
|
|
|
@@ -20294,13 +20532,25 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
|
|
|
|
|
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
|
|
|
|
if (type == 10)
|
|
|
|
|
{
|
|
|
|
|
trans->PAppend("DELETE FROM petition WHERE ownerguid = '%u'", GUID_LOPART(guid));
|
|
|
|
|
trans->PAppend("DELETE FROM petition_sign WHERE ownerguid = '%u'", GUID_LOPART(guid));
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER);
|
|
|
|
|
stmt->setUInt32(0, GUID_LOPART(guid));
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER);
|
|
|
|
|
stmt->setUInt32(0, GUID_LOPART(guid));
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
trans->PAppend("DELETE FROM petition WHERE ownerguid = '%u' AND type = '%u'", GUID_LOPART(guid), type);
|
|
|
|
|
trans->PAppend("DELETE FROM petition_sign WHERE ownerguid = '%u' AND type = '%u'", GUID_LOPART(guid), type);
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER_AND_TYPE);
|
|
|
|
|
stmt->setUInt32(0, GUID_LOPART(guid));
|
|
|
|
|
stmt->setUInt8(1, uint8(type));
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE);
|
|
|
|
|
stmt->setUInt32(0, GUID_LOPART(guid));
|
|
|
|
|
stmt->setUInt8(1, uint8(type));
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
CharacterDatabase.CommitTransaction(trans);
|
|
|
|
|
}
|
|
|
|
@@ -24697,12 +24947,26 @@ void Player::_LoadGlyphs(PreparedQueryResult result)
|
|
|
|
|
|
|
|
|
|
void Player::_SaveGlyphs(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
trans->PAppend("DELETE FROM character_glyphs WHERE guid='%u'", GetGUIDLow());
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
uint8 index = 0;
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GLYPHS);
|
|
|
|
|
stmt->setUInt32(index++, GetGUIDLow());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (uint8 spec = 0; spec < m_specsCount; ++spec)
|
|
|
|
|
{
|
|
|
|
|
trans->PAppend("INSERT INTO character_glyphs VALUES('%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')",
|
|
|
|
|
GetGUIDLow(), spec, m_Glyphs[spec][0], m_Glyphs[spec][1], m_Glyphs[spec][2], m_Glyphs[spec][3], m_Glyphs[spec][4], m_Glyphs[spec][5]);
|
|
|
|
|
stmt->setUInt8(index++, spec);
|
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
|
|
|
|
|
stmt->setUInt16(index++, uint16(m_Glyphs[spec][i]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::_LoadTalents(PreparedQueryResult result)
|
|
|
|
@@ -24718,15 +24982,29 @@ void Player::_LoadTalents(PreparedQueryResult result)
|
|
|
|
|
|
|
|
|
|
void Player::_SaveTalents(SQLTransaction& trans)
|
|
|
|
|
{
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i)
|
|
|
|
|
{
|
|
|
|
|
for (PlayerTalentMap::iterator itr = m_talents[i]->begin(); itr != m_talents[i]->end();)
|
|
|
|
|
{
|
|
|
|
|
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED)
|
|
|
|
|
trans->PAppend("DELETE FROM character_talent WHERE guid = '%u' and spell = '%u' and spec = '%u'", GetGUIDLow(), itr->first, itr->second->spec);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT_BY_SPELL_SPEC);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, itr->first);
|
|
|
|
|
stmt->setUInt8(2, itr->second->spec);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (itr->second->state == PLAYERSPELL_NEW || itr->second->state == PLAYERSPELL_CHANGED)
|
|
|
|
|
trans->PAppend("INSERT INTO character_talent (guid, spell, spec) VALUES ('%u', '%u', '%u')", GetGUIDLow(), itr->first, itr->second->spec);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_TALENT);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt32(1, itr->first);
|
|
|
|
|
stmt->setUInt8(2, itr->second->spec);
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (itr->second->state == PLAYERSPELL_REMOVED)
|
|
|
|
|
{
|
|
|
|
@@ -24752,20 +25030,33 @@ void Player::UpdateSpecCount(uint8 count)
|
|
|
|
|
ActivateSpec(0);
|
|
|
|
|
|
|
|
|
|
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
|
|
|
|
PreparedStatement* stmt = NULL;
|
|
|
|
|
|
|
|
|
|
// Copy spec data
|
|
|
|
|
if (count > curCount)
|
|
|
|
|
{
|
|
|
|
|
_SaveActions(trans); // make sure the button list is cleaned up
|
|
|
|
|
for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end(); ++itr)
|
|
|
|
|
trans->PAppend("INSERT INTO character_action (guid, button, action, type, spec) VALUES ('%u', '%u', '%u', '%u', '%u')",
|
|
|
|
|
GetGUIDLow(), uint32(itr->first), uint32(itr->second.GetAction()), uint32(itr->second.GetType()), 1);
|
|
|
|
|
{
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION);
|
|
|
|
|
stmt->setUInt32(0, GetGUIDLow());
|
|
|
|
|
stmt->setUInt8(1, 1);
|
|
|
|
|
stmt->setUInt8(2, itr->first);
|
|
|
|
|
stmt->setUInt32(3, itr->second.GetAction());
|
|
|
|
|
stmt->setUInt8(4, uint8(itr->second.GetType()));
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Delete spec data for removed spec.
|
|
|
|
|
else if (count < curCount)
|
|
|
|
|
{
|
|
|
|
|
_SaveActions(trans);
|
|
|
|
|
trans->PAppend("DELETE FROM character_action WHERE spec<>'%u' AND guid='%u'", m_activeSpec, GetGUIDLow());
|
|
|
|
|
|
|
|
|
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC);
|
|
|
|
|
stmt->setUInt8(0, m_activeSpec);
|
|
|
|
|
stmt->setUInt32(1, GetGUIDLow());
|
|
|
|
|
trans->Append(stmt);
|
|
|
|
|
|
|
|
|
|
m_activeSpec = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|