mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 02:31:03 +00:00
[Repositories] Convert Shared Bank Platinum to Repositories (#5006)
This commit is contained in:
+9
-16
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user