mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[Feature] GM State Change Persistance (#2328)
* [Feature] GM State Change Persistance - Flymode and Invulnerable will now persist over zoning. - Appended GMSpeed, Flymode and Invulnerable to the hideme message GMs see when they first login. - Added #godmode [on/off] command to turn on or off hideme, flymode, gmspeed and invulnerable all in one shot. - /becomenpc will now disable tells to the target player. It will also automatically disable GM States that interfere with its functionality. - GM Command /toggle will not properly turn tells on/off - GMs will now be notified if they are ignoring tells when they first zone-in, provided their GM flag is up. - Added TellsOff variable to the output to #showstats * [Bug] Fix tells when gmhideme is turned off. * [Cleanup] Cleanup function and rename for consistancy. Remove un-needed this-> * Tweaks * Tweaks * Update db_update_manifest.txt * Move string building logic to a vector and use strings join * Update client_packet.cpp * Update 2022_07_28_gm_state_changes.sql * PR comment tweaks Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
+37
-20
@@ -39,6 +39,7 @@
|
||||
#include "eqemu_config.h"
|
||||
#include "data_verification.h"
|
||||
#include "repositories/criteria/content_filter_criteria.h"
|
||||
#include "repositories/account_repository.h"
|
||||
|
||||
namespace ItemField
|
||||
{
|
||||
@@ -65,40 +66,56 @@ SharedDatabase::~SharedDatabase() = default;
|
||||
|
||||
bool SharedDatabase::SetHideMe(uint32 account_id, uint8 hideme)
|
||||
{
|
||||
const std::string query = StringFormat("UPDATE account SET hideme = %i WHERE id = %i", hideme, account_id);
|
||||
const auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
auto a = AccountRepository::FindOne(*this, account_id);
|
||||
if (a.id > 0) {
|
||||
a.hideme = hideme ? 1 : 0;
|
||||
AccountRepository::UpdateOne(*this, a);
|
||||
}
|
||||
|
||||
return true;
|
||||
return a.id > 0;
|
||||
}
|
||||
|
||||
uint8 SharedDatabase::GetGMSpeed(uint32 account_id)
|
||||
{
|
||||
const std::string query = StringFormat("SELECT gmspeed FROM account WHERE id = '%i'", account_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return 0;
|
||||
auto a = AccountRepository::FindOne(*this, account_id);
|
||||
if (a.id > 0) {
|
||||
return a.gmspeed;
|
||||
}
|
||||
|
||||
if (results.RowCount() != 1)
|
||||
return 0;
|
||||
|
||||
auto& row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SharedDatabase::SetGMSpeed(uint32 account_id, uint8 gmspeed)
|
||||
{
|
||||
const std::string query = StringFormat("UPDATE account SET gmspeed = %i WHERE id = %i", gmspeed, account_id);
|
||||
const auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
auto a = AccountRepository::FindOne(*this, account_id);
|
||||
if (a.id > 0) {
|
||||
a.gmspeed = gmspeed ? 1 : 0;
|
||||
AccountRepository::UpdateOne(*this, a);
|
||||
}
|
||||
|
||||
return true;
|
||||
return a.id > 0;
|
||||
}
|
||||
|
||||
bool SharedDatabase::SetGMInvul(uint32 account_id, bool gminvul)
|
||||
{
|
||||
auto a = AccountRepository::FindOne(*this, account_id);
|
||||
if (a.id > 0) {
|
||||
a.invulnerable = gminvul ? 1 : 0;
|
||||
AccountRepository::UpdateOne(*this, a);
|
||||
}
|
||||
|
||||
return a.id > 0;
|
||||
}
|
||||
|
||||
bool SharedDatabase::SetGMFlymode(uint32 account_id, uint8 flymode)
|
||||
{
|
||||
auto a = AccountRepository::FindOne(*this, account_id);
|
||||
if (a.id > 0) {
|
||||
a.flymode = flymode;
|
||||
AccountRepository::UpdateOne(*this, a);
|
||||
}
|
||||
|
||||
return a.id > 0;
|
||||
}
|
||||
|
||||
uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) {
|
||||
|
||||
Reference in New Issue
Block a user