aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp205
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h22
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp4
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.cpp14
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.h5
5 files changed, 194 insertions, 56 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 180f43109f2..eb7208ceb46 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -7290,13 +7290,112 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto
}
+void Player::_LoadCurrency(PreparedQueryResult result)
+{
+ if (!result)
+ return;
+
+ do
+ {
+ Field* fields = result->Fetch();
+
+ uint16 currencyID = fields[0].GetUInt16();
+
+ CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(currencyID);
+ if (!currencyID)
+ continue;
+
+ PlayerCurrency cur;
+ cur.state = PLAYERCURRENCY_UNCHANGED;
+ cur.weekCount = fields[1].GetUInt32();
+ cur.totalCount = fields[2].GetUInt32();
+
+ _currencyStorage.insert(PlayerCurrenciesMap::value_type(currencyID, cur));
+
+ } while (result->NextRow());
+}
+
+void Player::_SaveCurrency(SQLTransaction& trans)
+{
+ PreparedStatement* stmt = NULL;
+ for (PlayerCurrenciesMap::iterator itr = _currencyStorage.begin(); itr != _currencyStorage.end(); ++itr)
+ {
+ CurrencyTypesEntry const* entry = sCurrencyTypesStore.LookupEntry(itr->first);
+ if (!entry) // should never happen
+ continue;
+
+ switch(itr->second.state)
+ {
+ case PLAYERCURRENCY_NEW:
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_PLAYER_CURRENCY);
+ stmt->setUInt32(0, GetGUIDLow());
+ stmt->setUInt16(1, itr->first);
+ stmt->setUInt32(2, itr->second.weekCount);
+ stmt->setUInt32(3, itr->second.totalCount);
+ trans->Append(stmt);
+ break;
+ case PLAYERCURRENCY_CHANGED:
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_CURRENCY);
+ stmt->setUInt32(0, itr->second.weekCount);
+ stmt->setUInt32(1, itr->second.totalCount);
+ stmt->setUInt32(2, GetGUIDLow());
+ stmt->setUInt16(3, itr->first);
+ trans->Append(stmt);
+ break;
+ default:
+ break;
+ }
+
+ itr->second.state = PLAYERCURRENCY_UNCHANGED;
+ }
+}
+
+void Player::SendNewCurrency(uint32 id) const
+{
+ PlayerCurrenciesMap::const_iterator itr = _currencyStorage.find(id);
+ if (itr == _currencyStorage.end())
+ return;
+
+ ByteBuffer currencyData;
+ WorldPacket packet(SMSG_INIT_CURRENCY, 4 + (5*4 + 1));
+ packet.WriteBits(1, 23);
+
+ CurrencyTypesEntry const* entry = sCurrencyTypesStore.LookupEntry(id);
+ if (!entry) // should never happen
+ return;
+
+ uint32 precision = (entry->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? 100 : 1;
+ uint32 weekCount = itr->second.weekCount / precision;
+ uint32 weekCap = _GetCurrencyWeekCap(entry) / precision;
+
+ packet.WriteBit(weekCount);
+ packet.WriteBits(0, 4); // some flags
+ packet.WriteBit(weekCap);
+ packet.WriteBit(0); // season total earned
+
+ currencyData << uint32(itr->second.totalCount / precision);
+ if (weekCap)
+ currencyData << uint32(weekCap);
+
+ //if (seasonTotal)
+ // currencyData << uint32(seasonTotal);
+
+ currencyData << uint32(entry->ID);
+ if (weekCount)
+ currencyData << uint32(weekCount);
+
+ packet.FlushBits();
+ packet.append(currencyData);
+ GetSession()->SendPacket(&packet);
+}
+
void Player::SendCurrencies() const
{
ByteBuffer currencyData;
- WorldPacket packet(SMSG_INIT_CURRENCY, 4 + m_currencies.size()*(5*4 + 1));
- packet.WriteBits(m_currencies.size(), 23);
+ WorldPacket packet(SMSG_INIT_CURRENCY, 4 + _currencyStorage.size()*(5*4 + 1));
+ packet.WriteBits(_currencyStorage.size(), 23);
- for (PlayerCurrenciesMap::const_iterator itr = m_currencies.begin(); itr != m_currencies.end(); ++itr)
+ for (PlayerCurrenciesMap::const_iterator itr = _currencyStorage.begin(); itr != _currencyStorage.end(); ++itr)
{
CurrencyTypesEntry const* entry = sCurrencyTypesStore.LookupEntry(itr->first);
if (!entry) // should never happen
@@ -7330,15 +7429,16 @@ void Player::SendCurrencies() const
uint32 Player::GetCurrency(uint32 id) const
{
- PlayerCurrenciesMap::const_iterator itr = m_currencies.find(id);
- return itr != m_currencies.end() ? itr->second.totalCount : 0;
+ PlayerCurrenciesMap::const_iterator itr = _currencyStorage.find(id);
+ return itr != _currencyStorage.end() ? itr->second.totalCount : 0;
}
bool Player::HasCurrency(uint32 id, uint32 count) const
{
- PlayerCurrenciesMap::const_iterator itr = m_currencies.find(id);
- return itr != m_currencies.end() && itr->second.totalCount >= count;
+ PlayerCurrenciesMap::const_iterator itr = _currencyStorage.find(id);
+ return itr != _currencyStorage.end() && itr->second.totalCount >= count;
}
+
void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/)
{
if (!count)
@@ -7350,15 +7450,15 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/)
int32 precision = currency->Flags & CURRENCY_FLAG_HIGH_PRECISION ? 100 : 1;
uint32 oldTotalCount = 0;
uint32 oldWeekCount = 0;
- PlayerCurrenciesMap::iterator itr = m_currencies.find(id);
- if (itr == m_currencies.end())
+ PlayerCurrenciesMap::iterator itr = _currencyStorage.find(id);
+ if (itr == _currencyStorage.end())
{
PlayerCurrency cur;
cur.state = PLAYERCURRENCY_NEW;
cur.totalCount = 0;
cur.weekCount = 0;
- m_currencies[id] = cur;
- itr = m_currencies.find(id);
+ _currencyStorage[id] = cur;
+ itr = _currencyStorage.find(id);
}
else
{
@@ -7366,6 +7466,11 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/)
oldWeekCount = itr->second.weekCount;
}
+ // count can't be more then weekCap.
+ uint32 weekCap = _GetCurrencyWeekCap(currency);
+ if (count > int32(weekCap))
+ count = weekCap;
+
int32 newTotalCount = int32(oldTotalCount) + count;
if (newTotalCount < 0)
newTotalCount = 0;
@@ -7374,23 +7479,23 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/)
if (newWeekCount < 0)
newWeekCount = 0;
- if (currency->TotalCap && int32(currency->TotalCap) < newTotalCount)
- {
- int32 delta = newTotalCount - int32(currency->TotalCap);
- newTotalCount = int32(currency->TotalCap);
- newWeekCount -= delta;
- }
+ ASSERT(weekCap >= oldWeekCount);
+
// TODO: fix conquest points
- uint32 weekCap = _GetCurrencyWeekCap(currency);
- if (weekCap && int32(weekCap) < newTotalCount)
+ // if we get more then weekCap just set to limit
+ if (weekCap && int32(weekCap) < newWeekCount)
{
- int32 delta = newWeekCount - int32(weekCap);
newWeekCount = int32(weekCap);
- newTotalCount -= delta;
+ // weekCap - oldWeekCount alwayt >= 0 as we set limit before!
+ newTotalCount = oldTotalCount + (weekCap - oldWeekCount);
}
- // if we change total, we must change week
- ASSERT(((newTotalCount-oldTotalCount) != 0) == ((newWeekCount-oldWeekCount) != 0));
+ // if we get more then totalCap set to maximum;
+ if (currency->TotalCap && int32(currency->TotalCap) < newTotalCount)
+ {
+ newTotalCount = int32(currency->TotalCap);
+ newWeekCount = weekCap;
+ }
if (uint32(newTotalCount) != oldTotalCount)
{
@@ -7406,6 +7511,13 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/)
if (count > 0)
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CURRENCY, id, count);
+ // on new case just set init.
+ if(itr->second.state == PLAYERCURRENCY_NEW)
+ {
+ SendNewCurrency(id);
+ return;
+ }
+
WorldPacket packet(SMSG_UPDATE_CURRENCY, 12);
packet.WriteBit(weekCap != 0);
@@ -16551,11 +16663,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
//"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
// 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//"resettalents_time, talentTree, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, "
- // 40 41 42 43 44 45 46 47
- //"conquestPoints, totalHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
- // 48 49 50 51 52 53 54 55 56 57 58
+ // 40 41 42 43 44 45
+ //"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
+ // 46 47 48 49 50 51 52 53 54 55 56
//"health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, "
- // 59 60 61
+ // 57 58 59
//"knownTitles, actionBars, grantableLevels FROM characters WHERE guid = '%u'", guid);
PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADFROM);
@@ -16621,8 +16733,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
- _LoadIntoDataField(fields[57].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
- _LoadIntoDataField(fields[59].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
+ _LoadIntoDataField(fields[55].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
+ _LoadIntoDataField(fields[57].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
@@ -16639,12 +16751,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(PLAYER_BYTES, fields[9].GetUInt32());
SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32());
SetByteValue(PLAYER_BYTES_3, 0, fields[5].GetUInt8());
- SetByteValue(PLAYER_BYTES_3, 1, fields[47].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 1, fields[45].GetUInt8());
SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32());
- SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[46].GetUInt32());
+ SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[44].GetUInt32());
// set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
- SetByteValue(PLAYER_FIELD_BYTES, 2, fields[60].GetUInt8());
+ SetByteValue(PLAYER_FIELD_BYTES, 2, fields[58].GetUInt8());
InitDisplayIds();
@@ -16677,7 +16789,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat());
uint32 mapId = fields[15].GetUInt16();
- uint32 instanceId = fields[54].GetUInt32();
+ uint32 instanceId = fields[52].GetUInt32();
uint32 dungeonDiff = fields[39].GetUInt8() & 0x0F;
if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
@@ -16712,11 +16824,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetArenaTeamInfoField(arena_slot, ArenaTeamInfoType(j), 0);
}
- SetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, fields[40].GetUInt32());
- SetCurrency(CURRENCY_TYPE_HONOR_POINTS, fields[41].GetUInt32());
- SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, fields[42].GetUInt32());
- SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[43].GetUInt16());
- SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[44].GetUInt16());
+ _LoadCurrency(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADCURRENCY));
+ SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, fields[40].GetUInt32());
+ SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[41].GetUInt16());
+ SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[42].GetUInt16());
_LoadBoundInstances(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES));
_LoadInstanceTimeRestrictions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES));
@@ -17035,8 +17146,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
//mails are loaded only when needed ;-) - when player in game click on mailbox.
//_LoadMail();
- SetSpecsCount(fields[55].GetUInt8());
- SetActiveSpec(fields[56].GetUInt8());
+ SetSpecsCount(fields[53].GetUInt8());
+ SetActiveSpec(fields[54].GetUInt8());
// sanity check
if (GetSpecsCount() > MAX_TALENT_SPECS || GetActiveSpec() > MAX_TALENT_SPEC || GetSpecsCount() < MIN_TALENT_SPECS)
@@ -17087,7 +17198,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
// note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
- uint32 curTitle = fields[45].GetUInt32();
+ uint32 curTitle = fields[43].GetUInt32();
if (curTitle && !HasTitle(curTitle))
curTitle = 0;
@@ -17110,14 +17221,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
UpdateAllStats();
// restore remembered power/health values (but not more max values)
- uint32 savedHealth = fields[48].GetUInt32();
+ uint32 savedHealth = fields[46].GetUInt32();
SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth);
uint32 loadedPowers = 0;
for (uint32 i = 0; i < MAX_POWERS; ++i)
{
if (GetPowerIndexByClass(Powers(i), getClass()) != MAX_POWERS)
{
- uint32 savedPower = fields[49+loadedPowers].GetUInt32();
+ uint32 savedPower = fields[47+loadedPowers].GetUInt32();
uint32 maxPower = GetUInt32Value(UNIT_FIELD_MAXPOWER1 + loadedPowers);
SetPower(Powers(i), (savedPower > maxPower) ? maxPower : savedPower);
if (++loadedPowers >= MAX_STORED_POWERS)
@@ -17196,7 +17307,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
}
// RaF stuff.
- m_grantableLevels = fields[61].GetUInt8();
+ m_grantableLevels = fields[59].GetUInt8();
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND);
@@ -18616,8 +18727,6 @@ void Player::SaveToDB(bool create /*=false*/)
ss << m_taxi.SaveTaxiDestinationsToString();
stmt->setString(index++, ss.str());
- stmt->setUInt32(index++, GetCurrency(CURRENCY_TYPE_CONQUEST_POINTS));
- stmt->setUInt32(index++, GetCurrency(CURRENCY_TYPE_HONOR_POINTS));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS));
stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
@@ -18738,8 +18847,6 @@ void Player::SaveToDB(bool create /*=false*/)
ss << m_taxi.SaveTaxiDestinationsToString();
stmt->setString(index++, ss.str());
- stmt->setUInt32(index++, GetCurrency(CURRENCY_TYPE_CONQUEST_POINTS));
- stmt->setUInt32(index++, GetCurrency(CURRENCY_TYPE_HONOR_POINTS));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS));
stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
@@ -18828,6 +18935,7 @@ void Player::SaveToDB(bool create /*=false*/)
GetSession()->SaveTutorialsData(trans); // changed only while character in game
_SaveGlyphs(trans);
_SaveInstanceTimeRestrictions(trans);
+ _SaveCurrency(trans);
// check if stats should only be saved on logout
// save stats can be out of transaction
@@ -18845,6 +18953,7 @@ void Player::SaveToDB(bool create /*=false*/)
void Player::SaveInventoryAndGoldToDB(SQLTransaction& trans)
{
_SaveInventory(trans);
+ _SaveCurrency(trans);
SaveGoldToDB(trans);
}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index c4047485033..bf3d061d21e 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -130,7 +130,7 @@ enum PlayerCurrencyState
PLAYERCURRENCY_UNCHANGED = 0,
PLAYERCURRENCY_CHANGED = 1,
PLAYERCURRENCY_NEW = 2,
- PLAYERCURRENCY_REMOVED = 3
+ PLAYERCURRENCY_REMOVED = 3 //not removed just set count == 0
};
struct PlayerCurrency
@@ -792,6 +792,7 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES = 30,
PLAYER_LOGIN_QUERY_LOADSEASONALQUESTSTATUS = 31,
PLAYER_LOGIN_QUERY_LOADVOIDSTORAGE = 32,
+ PLAYER_LOGIN_QUERY_LOADCURRENCY = 33,
MAX_PLAYER_LOGIN_QUERY,
};
@@ -1340,10 +1341,25 @@ class Player : public Unit, public GridObject<Player>
void AddRefundReference(uint32 it);
void DeleteRefundReference(uint32 it);
+ /// send initialization of new currency for client
+ void SendNewCurrency(uint32 id) const;
+ /// send full data about all currencies to client
void SendCurrencies() const;
+ /// return count of currency witch has plr
uint32 GetCurrency(uint32 id) const;
+ /// return presence related currency
bool HasCurrency(uint32 id, uint32 count) const;
+ /// @todo: not understand why it subtract from total count and for what it used. It should be remove and replaced by ModifyCurrency
void SetCurrency(uint32 id, uint32 count, bool printLog = true);
+
+ /**
+ * @name ModifyCurrency
+ * @brief Change specific currency and send result to client
+
+ * @param id currency entry from CurrencyTypes.dbc
+ * @param count integer value for adding/removing curent currency
+ * @param printLog used on SMSG_UPDATE_CURRENCY
+ */
void ModifyCurrency(uint32 id, int32 count, bool printLog = true);
void ApplyEquipCooldown(Item* pItem);
@@ -2695,6 +2711,7 @@ class Player : public Unit, public GridObject<Player>
void _LoadGlyphs(PreparedQueryResult result);
void _LoadTalents(PreparedQueryResult result);
void _LoadInstanceTimeRestrictions(PreparedQueryResult result);
+ void _LoadCurrency(PreparedQueryResult result);
/*********************************************************/
/*** SAVE SYSTEM ***/
@@ -2717,6 +2734,7 @@ class Player : public Unit, public GridObject<Player>
void _SaveTalents(SQLTransaction& trans);
void _SaveStats(SQLTransaction& trans);
void _SaveInstanceTimeRestrictions(SQLTransaction& trans);
+ void _SaveCurrency(SQLTransaction& trans);
/*********************************************************/
/*** ENVIRONMENTAL SYSTEM ***/
@@ -2748,7 +2766,7 @@ class Player : public Unit, public GridObject<Player>
Item* m_items[PLAYER_SLOTS_COUNT];
uint32 m_currentBuybackSlot;
- PlayerCurrenciesMap m_currencies;
+ PlayerCurrenciesMap _currencyStorage;
uint32 _GetCurrencyWeekCap(const CurrencyTypesEntry* currency) const;
VoidStorageItem* _voidStorageItems[VOID_STORAGE_MAX_SLOT];
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index c7b66381158..b28ce3ab180 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -202,6 +202,10 @@ bool LoginQueryHolder::Initialize()
stmt->setUInt32(0, m_accountId);
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES, stmt);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_CURRENCY);
+ stmt->setUInt32(0, lowGuid);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADCURRENCY, stmt);
+
return res;
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 368e70a758c..cf8a5880032 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -65,7 +65,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_CHARACTER, "SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
"resettalents_time, talentTree, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, "
- "conquestPoints, totalHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
+ "totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
"health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_BOTH)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_INSTANCE, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = ?", CONNECTION_ASYNC)
@@ -257,6 +257,11 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_INS_AURA, "INSERT INTO character_aura (guid, caster_guid, item_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
+ // Currency
+ PREPARE_STATEMENT(CHAR_SEL_PLAYER_CURRENCY, "SELECT currency, week_count, total_count FROM character_currency WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPD_PLAYER_CURRENCY, "UPDATE character_currency SET week_count = ?, total_count = ? WHERE guid = ? AND currency = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_REP_PLAYER_CURRENCY, "REPLACE INTO character_currency (guid, currency, week_count, total_count) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
+
// Account data
PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_DATA, "SELECT type, time, data FROM account_data WHERE accountId = ?", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_REP_ACCOUNT_DATA, "REPLACE INTO account_data (accountId, type, time, data) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC)
@@ -364,14 +369,14 @@ void CharacterDatabaseConnection::DoPrepareStatements()
"taximask, cinematic, "
"totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, talentTree, "
"extra_flags, stable_slots, at_login, zone, "
- "death_expire_time, taxi_path, conquestPoints, totalHonorPoints, totalKills, "
+ "death_expire_time, taxi_path, totalKills, "
"todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, "
"power4, power5, latency, speccount, activespec, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels) VALUES "
- "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,playerBytes=?,playerBytes2=?,playerFlags=?,"
"map=?,instance_id=?,instance_mode_mask=?,position_x=?,position_y=?,position_z=?,orientation=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?,"
"logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,talentTree=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?,"
- "conquestPoints=?,totalHonorPoints=?,totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,"
+ "totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,"
"watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,latency=?,speccount=?,activespec=?,exploredZones=?,"
"equipmentCache=?,knownTitles=?,actionBars=?,grantableLevels=?,online=? WHERE guid=?", CONNECTION_ASYNC);
@@ -534,7 +539,6 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_DEL_CHAR_QUESTSTATUS_DAILY, "DELETE FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_TALENT, "DELETE FROM character_talent WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_SKILLS, "DELETE FROM character_skills WHERE guid = ?", CONNECTION_ASYNC);
- PREPARE_STATEMENT(CHAR_UDP_CHAR_HONOR_POINTS, "UPDATE characters SET totalHonorPoints = ? WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_UDP_CHAR_MONEY, "UPDATE characters SET money = ? WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_INS_CHAR_ACTION, "INSERT INTO character_action (guid, spec, button, action, type) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_UPD_CHAR_ACTION, "UPDATE character_action SET action = ?, type = ? WHERE guid = ? AND button = ? AND spec = ?", CONNECTION_ASYNC);
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index 8c7042ad926..b63b67914f2 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -248,6 +248,10 @@ enum CharacterDatabaseStatements
CHAR_INS_AURA,
+ CHAR_SEL_PLAYER_CURRENCY,
+ CHAR_UPD_PLAYER_CURRENCY,
+ CHAR_REP_PLAYER_CURRENCY,
+
CHAR_SEL_ACCOUNT_DATA,
CHAR_REP_ACCOUNT_DATA,
CHAR_DEL_ACCOUNT_DATA,
@@ -497,7 +501,6 @@ enum CharacterDatabaseStatements
CHAR_DEL_CHAR_QUESTSTATUS_DAILY,
CHAR_DEL_CHAR_TALENT,
CHAR_DEL_CHAR_SKILLS,
- CHAR_UDP_CHAR_HONOR_POINTS,
CHAR_UDP_CHAR_MONEY,
CHAR_INS_CHAR_ACTION,
CHAR_UPD_CHAR_ACTION,