mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
[Character] Convert NoRentExpired to Repositories (#3860)
* [Character] Convert NoRentExpired to Repositories - Create a custom `GetSecondsSinceLastLogin` repository method to use in `NoRentExpired`. * Update character_data_repository.h
This commit is contained in:
@@ -763,10 +763,12 @@ void Client::BulkSendInventoryItems()
|
||||
}
|
||||
}
|
||||
|
||||
bool deletenorent = database.NoRentExpired(GetName());
|
||||
if (deletenorent) { //client was offline for more than 30 minutes, delete no rent items
|
||||
if (RuleB(Inventory, TransformSummonedBags))
|
||||
const bool delete_no_rent = database.NoRentExpired(GetName());
|
||||
if (delete_no_rent) { //client was offline for more than 30 minutes, delete no rent items
|
||||
if (RuleB(Inventory, TransformSummonedBags)) {
|
||||
DisenchantSummonedBags(false);
|
||||
}
|
||||
|
||||
RemoveNoRent(false);
|
||||
}
|
||||
|
||||
|
||||
+5
-12
@@ -37,6 +37,7 @@
|
||||
#include "../common/repositories/character_alt_currency_repository.h"
|
||||
#include "../common/repositories/character_item_recast_repository.h"
|
||||
#include "../common/repositories/account_repository.h"
|
||||
#include "../common/repositories/character_data_repository.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
@@ -1389,19 +1390,11 @@ bool ZoneDatabase::DeleteCharacterMemorizedSpell(uint32 character_id, uint32 slo
|
||||
);
|
||||
}
|
||||
|
||||
bool ZoneDatabase::NoRentExpired(const char* name){
|
||||
std::string query = StringFormat("SELECT (UNIX_TIMESTAMP(NOW()) - last_login) FROM `character_data` WHERE name = '%s'", name);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
bool ZoneDatabase::NoRentExpired(const std::string& name)
|
||||
{
|
||||
const uint32 seconds = CharacterDataRepository::GetSecondsSinceLastLogin(*this, name);
|
||||
|
||||
if (results.RowCount() != 1)
|
||||
return false;
|
||||
|
||||
auto& row = results.begin();
|
||||
uint32 seconds = Strings::ToInt(row[0]);
|
||||
|
||||
return (seconds>1800);
|
||||
return seconds > 1800;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::SaveCharacterInvSnapshot(uint32 character_id) {
|
||||
|
||||
+1
-1
@@ -464,7 +464,7 @@ public:
|
||||
void SetEXPModifier(uint32 character_id, uint32 zone_id, double exp_modifier, int16 instance_version = -1);
|
||||
|
||||
/* Character Inventory */
|
||||
bool NoRentExpired(const char* name);
|
||||
bool NoRentExpired(const std::string& name);
|
||||
bool SaveCharacterInvSnapshot(uint32 character_id);
|
||||
int CountCharacterInvSnapshots(uint32 character_id);
|
||||
void ClearCharacterInvSnapshots(uint32 character_id, bool from_now = false);
|
||||
|
||||
Reference in New Issue
Block a user