mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
[Repositories] Convert Shared Bank Platinum to Repositories (#5006)
This commit is contained in:
parent
1eb89edbbd
commit
dee58f9a91
@ -448,27 +448,20 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
int32 SharedDatabase::GetSharedPlatinum(uint32 account_id)
|
||||
{
|
||||
const auto query = fmt::format("SELECT sharedplat FROM account WHERE id = {}", account_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success() || !results.RowCount()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToInt(row[0]);
|
||||
const auto& e = AccountRepository::FindOne(*this, account_id);
|
||||
|
||||
return e.sharedplat;
|
||||
}
|
||||
|
||||
bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) {
|
||||
const std::string query = StringFormat("UPDATE account SET sharedplat = sharedplat + %i WHERE id = %i", amount_to_add, account_id);
|
||||
const auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
bool SharedDatabase::AddSharedPlatinum(uint32 account_id, int amount)
|
||||
{
|
||||
auto e = AccountRepository::FindOne(*this, account_id);
|
||||
|
||||
return true;
|
||||
e.sharedplat += amount;
|
||||
|
||||
return AccountRepository::UpdateOne(*this, e);
|
||||
}
|
||||
|
||||
bool SharedDatabase::SetStartingItems(
|
||||
|
||||
@ -104,7 +104,7 @@ public:
|
||||
bool VerifyInventory(uint32 account_id, int16 slot_id, const EQ::ItemInstance *inst);
|
||||
bool GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is_charid);
|
||||
int32 GetSharedPlatinum(uint32 account_id);
|
||||
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
|
||||
bool AddSharedPlatinum(uint32 account_id, int amount);
|
||||
bool GetInventory(Client* c);
|
||||
bool GetInventory(uint32 account_id, char *name, EQ::InventoryProfile *inv); // deprecated
|
||||
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
|
||||
|
||||
@ -1571,7 +1571,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
if (from_bucket == &m_pp.platinum_shared)
|
||||
amount_to_add = 0 - amount_to_take;
|
||||
|
||||
database.SetSharedPlatinum(AccountID(),amount_to_add);
|
||||
database.AddSharedPlatinum(AccountID(),amount_to_add);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user