mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[6868] Don't load data field from DB to save money or arena team id.
Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
parent
571221148a
commit
818c378854
5 changed files with 22 additions and 7 deletions
|
|
@ -977,7 +977,7 @@ void WorldSession::HandleGuildBankDeposit( WorldPacket & recv_data )
|
||||||
|
|
||||||
pGuild->SetBankMoney(pGuild->GetGuildBankMoney()+money);
|
pGuild->SetBankMoney(pGuild->GetGuildBankMoney()+money);
|
||||||
GetPlayer()->ModifyMoney(-int(money));
|
GetPlayer()->ModifyMoney(-int(money));
|
||||||
GetPlayer()->SaveGoldToDB();
|
GetPlayer()->SaveDataFieldToDB(); //contains money
|
||||||
|
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
|
|
@ -1033,7 +1033,7 @@ void WorldSession::HandleGuildBankWithdraw( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPlayer()->ModifyMoney(money);
|
GetPlayer()->ModifyMoney(money);
|
||||||
GetPlayer()->SaveGoldToDB();
|
GetPlayer()->SaveDataFieldToDB(); // contains money
|
||||||
|
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -517,7 +517,7 @@ void WorldSession::HandleTakeMoney(WorldPacket & recv_data )
|
||||||
|
|
||||||
// save money and mail to prevent cheating
|
// save money and mail to prevent cheating
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
pl->SetUInt32ValueInDB(PLAYER_FIELD_COINAGE,pl->GetMoney(),pl->GetGUID());
|
pl->SaveDataFieldToDB(); // contains money
|
||||||
pl->_SaveMail();
|
pl->_SaveMail();
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14993,7 +14993,8 @@ void Player::SaveToDB()
|
||||||
void Player::SaveInventoryAndGoldToDB()
|
void Player::SaveInventoryAndGoldToDB()
|
||||||
{
|
{
|
||||||
_SaveInventory();
|
_SaveInventory();
|
||||||
SetUInt32ValueInDB(PLAYER_FIELD_COINAGE,GetMoney(),GetGUID());
|
//money is in data field
|
||||||
|
SaveDataFieldToDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_SaveActions()
|
void Player::_SaveActions()
|
||||||
|
|
@ -15384,6 +15385,20 @@ void Player::SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint
|
||||||
CharacterDatabase.Execute(ss.str().c_str());
|
CharacterDatabase.Execute(ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::SaveDataFieldToDB()
|
||||||
|
{
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss<<"UPDATE characters SET data='";
|
||||||
|
|
||||||
|
for(uint16 i = 0; i < m_valuesCount; i++ )
|
||||||
|
{
|
||||||
|
ss << GetUInt32Value(i) << " ";
|
||||||
|
}
|
||||||
|
ss<<"' WHERE guid='"<< GUID_LOPART(GetGUIDLow()) <<"'";
|
||||||
|
|
||||||
|
CharacterDatabase.Execute(ss.str().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
bool Player::SaveValuesArrayInDB(Tokens const& tokens, uint64 guid)
|
bool Player::SaveValuesArrayInDB(Tokens const& tokens, uint64 guid)
|
||||||
{
|
{
|
||||||
std::ostringstream ss2;
|
std::ostringstream ss2;
|
||||||
|
|
|
||||||
|
|
@ -1264,7 +1264,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
|
|
||||||
void SaveToDB();
|
void SaveToDB();
|
||||||
void SaveInventoryAndGoldToDB(); // fast save function for item/money cheating preventing
|
void SaveInventoryAndGoldToDB(); // fast save function for item/money cheating preventing
|
||||||
void SaveGoldToDB() { SetUInt32ValueInDB(PLAYER_FIELD_COINAGE,GetMoney(),GetGUID()); }
|
void SaveDataFieldToDB();
|
||||||
static bool SaveValuesArrayInDB(Tokens const& data,uint64 guid);
|
static bool SaveValuesArrayInDB(Tokens const& data,uint64 guid);
|
||||||
static void SetUInt32ValueInArray(Tokens& data,uint16 index, uint32 value);
|
static void SetUInt32ValueInArray(Tokens& data,uint16 index, uint32 value);
|
||||||
static void SetFloatValueInArray(Tokens& data,uint16 index, float value);
|
static void SetFloatValueInArray(Tokens& data,uint16 index, float value);
|
||||||
|
|
@ -1517,7 +1517,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot)
|
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot)
|
||||||
{
|
{
|
||||||
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId);
|
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId);
|
||||||
SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId, GetGUID());
|
SaveDataFieldToDB(); // needed?
|
||||||
}
|
}
|
||||||
uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6)); }
|
uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6)); }
|
||||||
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
|
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6867"
|
#define REVISION_NR "6868"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue