mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-23 20:31:28 +00:00
Merge remote-tracking branch 'origin/feature/eqemu-api-data-service-netstats-ws' into unstable
This commit is contained in:
commit
8293225ecc
@ -177,6 +177,12 @@ Json::Value EQ::Net::WebsocketServer::Login(WebsocketServerConnection *connectio
|
||||
connection->SetAuthorized(true, r.account_name, r.account_id, 255);
|
||||
ret["status"] = "Ok";
|
||||
}
|
||||
else if (user == "admin" && (connection->RemoteIP() == "127.0.0.1" || connection->RemoteIP() == "::")) {
|
||||
r.logged_in = true;
|
||||
r.account_id = 0;
|
||||
connection->SetAuthorized(true, r.account_name, r.account_id, 255);
|
||||
ret["status"] = "Ok";
|
||||
}
|
||||
else {
|
||||
connection->SetAuthorized(false, "", 0, 0);
|
||||
ret["status"] = "Not Authorized";
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9139
|
||||
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9022
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9023
|
||||
#else
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||
#endif
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
9020|2018_08_13_bots_inventory_update.sql|SELECT * FROM `inventory_versions` WHERE `version` = 2 and `bot_step` = 0|not_empty|
|
||||
9021|2018_10_09_bots_owner_options.sql|SHOW TABLES LIKE 'bot_owner_options'|empty|
|
||||
9022|2019_02_07_bots_stance_type_update.sql|SELECT * FROM `bot_spell_casting_chances` WHERE `spell_type_index` = '255' AND `class_id` = '255' AND `stance_index` = '0'|not_empty|
|
||||
9023|2019_06_22_bots_owner_option_stats_update.sql|SHOW COLUMNS FROM `bot_owner_options` LIKE 'stats_update'|empty|
|
||||
|
||||
# Upgrade conditions:
|
||||
# This won't be needed after this system is implemented, but it is used database that are not
|
||||
|
||||
@ -0,0 +1 @@
|
||||
ALTER TABLE `bot_owner_options` ADD COLUMN `stats_update` SMALLINT(3) UNSIGNED NULL DEFAULT '0' AFTER `death_marquee`;
|
||||
@ -34,7 +34,9 @@
|
||||
|
||||
extern Zone *zone;
|
||||
|
||||
EQ::Net::WebsocketLoginStatus CheckLogin(EQ::Net::WebsocketServerConnection *connection, const std::string &username, const std::string &password) {
|
||||
EQ::Net::WebsocketLoginStatus
|
||||
CheckLogin(EQ::Net::WebsocketServerConnection *connection, const std::string &username, const std::string &password)
|
||||
{
|
||||
EQ::Net::WebsocketLoginStatus ret;
|
||||
ret.logged_in = false;
|
||||
|
||||
@ -47,32 +49,33 @@ EQ::Net::WebsocketLoginStatus CheckLogin(EQ::Net::WebsocketServerConnection *con
|
||||
char account_name[64];
|
||||
database.GetAccountName(static_cast<uint32>(ret.account_id), account_name);
|
||||
ret.account_name = account_name;
|
||||
ret.logged_in = true;
|
||||
ret.status = database.CheckStatus(ret.account_id);
|
||||
ret.logged_in = true;
|
||||
ret.status = database.CheckStatus(ret.account_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetClientList();
|
||||
auto &list = entity_list.GetClientList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto client = iter.second;
|
||||
auto connection = client->Connection();
|
||||
auto opts = connection->GetManager()->GetOptions();
|
||||
auto opts = connection->GetManager()->GetOptions();
|
||||
auto eqs_stats = connection->GetStats();
|
||||
auto &stats = eqs_stats.DaybreakStats;
|
||||
auto now = EQ::Net::Clock::now();
|
||||
auto sec_since_stats_reset = std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||
now - stats.created
|
||||
).count();
|
||||
|
||||
|
||||
Json::Value row;
|
||||
|
||||
|
||||
row["client_id"] = client->GetID();
|
||||
row["client_name"] = client->GetCleanName();
|
||||
row["seconds_since_reset"] = sec_since_stats_reset;
|
||||
@ -96,25 +99,25 @@ Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connectio
|
||||
row["resent_fragments"] = stats.resent_fragments;
|
||||
row["resent_non_fragments"] = stats.resent_full;
|
||||
row["dropped_datarate_packets"] = stats.dropped_datarate_packets;
|
||||
|
||||
|
||||
Json::Value sent_packet_types;
|
||||
|
||||
|
||||
for (auto i = 0; i < _maxEmuOpcode; ++i) {
|
||||
auto count = eqs_stats.SentCount[i];
|
||||
if (count > 0) {
|
||||
sent_packet_types[OpcodeNames[i]] = count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Json::Value receive_packet_types;
|
||||
|
||||
|
||||
for (auto i = 0; i < _maxEmuOpcode; ++i) {
|
||||
auto count = eqs_stats.RecvCount[i];
|
||||
if (count > 0) {
|
||||
receive_packet_types[OpcodeNames[i]] = count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
row["sent_packet_types"] = sent_packet_types;
|
||||
row["receive_packet_types"] = receive_packet_types;
|
||||
|
||||
@ -124,13 +127,14 @@ Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connectio
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetOpcodeList(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetOpcodeList(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
|
||||
Json::Value response;
|
||||
for (auto i = 0; i < _maxEmuOpcode; ++i) {
|
||||
for (auto i = 0; i < _maxEmuOpcode; ++i) {
|
||||
Json::Value row = OpcodeNames[i];
|
||||
|
||||
response.append(row);
|
||||
@ -139,13 +143,14 @@ Json::Value ApiGetOpcodeList(EQ::Net::WebsocketServerConnection *connection, Jso
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetNpcListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetNpcListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetNPCList();
|
||||
auto &list = entity_list.GetNPCList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto npc = iter.second;
|
||||
@ -232,13 +237,14 @@ Json::Value ApiGetNpcListDetail(EQ::Net::WebsocketServerConnection *connection,
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetDoorListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetDoorListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &door_list = entity_list.GetDoorsList();
|
||||
auto &door_list = entity_list.GetDoorsList();
|
||||
|
||||
for (auto itr : door_list) {
|
||||
Doors *door = itr.second;
|
||||
@ -275,13 +281,14 @@ Json::Value ApiGetDoorListDetail(EQ::Net::WebsocketServerConnection *connection,
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetCorpseListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetCorpseListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &corpse_list = entity_list.GetCorpseList();
|
||||
auto &corpse_list = entity_list.GetCorpseList();
|
||||
|
||||
for (auto itr : corpse_list) {
|
||||
auto corpse = itr.second;
|
||||
@ -314,13 +321,14 @@ Json::Value ApiGetCorpseListDetail(EQ::Net::WebsocketServerConnection *connectio
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetObjectListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetObjectListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetObjectList();
|
||||
auto &list = entity_list.GetObjectList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto object = iter.second;
|
||||
@ -349,13 +357,14 @@ Json::Value ApiGetObjectListDetail(EQ::Net::WebsocketServerConnection *connectio
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetMobListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetMobListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetMobList();
|
||||
auto &list = entity_list.GetMobList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto mob = iter.second;
|
||||
@ -555,13 +564,14 @@ Json::Value ApiGetMobListDetail(EQ::Net::WebsocketServerConnection *connection,
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetClientListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetClientListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetClientList();
|
||||
auto &list = entity_list.GetClientList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto client = iter.second;
|
||||
@ -754,7 +764,8 @@ Json::Value ApiGetClientListDetail(EQ::Net::WebsocketServerConnection *connectio
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetZoneAttributes(EQ::Net::WebsocketServerConnection *connection, Json::Value params) {
|
||||
Json::Value ApiGetZoneAttributes(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
@ -800,18 +811,79 @@ Json::Value ApiGetZoneAttributes(EQ::Net::WebsocketServerConnection *connection,
|
||||
return response;
|
||||
}
|
||||
|
||||
void RegisterApiLogEvent(std::unique_ptr<EQ::Net::WebsocketServer> &server)
|
||||
Json::Value ApiGetLogsysCategories(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
LogSys.SetConsoleHandler([&](uint16 debug_level, uint16 log_category, const std::string &msg) {
|
||||
Json::Value data;
|
||||
data["debug_level"] = debug_level;
|
||||
data["log_category"] = log_category;
|
||||
data["msg"] = msg;
|
||||
server->DispatchEvent(EQ::Net::SubscriptionEventLog, data, 50);
|
||||
});
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
|
||||
for (int i = 1; i < Logs::LogCategory::MaxCategoryID; i++) {
|
||||
Json::Value row;
|
||||
|
||||
row["log_category_id"] = i;
|
||||
row["log_category_description"] = Logs::LogCategoryName[i];
|
||||
row["log_to_console"] = LogSys.log_settings[i].log_to_console;
|
||||
row["log_to_file"] = LogSys.log_settings[i].log_to_file;
|
||||
row["log_to_gmsay"] = LogSys.log_settings[i].log_to_gmsay;
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
void RegisterApiService(std::unique_ptr<EQ::Net::WebsocketServer> &server) {
|
||||
Json::Value ApiSetLoggingLevel(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
|
||||
auto logging_category = params[0].asInt();
|
||||
auto logging_level = params[1].asInt();
|
||||
|
||||
response["status"] = "Category doesn't exist";
|
||||
|
||||
Log(Logs::General, Logs::Status, "Logging category is %i and level is %i",
|
||||
logging_category,
|
||||
logging_level
|
||||
);
|
||||
|
||||
if (logging_category < Logs::LogCategory::MaxCategoryID &&
|
||||
logging_category > Logs::LogCategory::None
|
||||
) {
|
||||
LogSys.log_settings[logging_category].log_to_console = logging_level;
|
||||
response["status"] = "Category log level updated";
|
||||
}
|
||||
|
||||
if (logging_level > 0) {
|
||||
LogSys.log_settings[logging_category].is_category_enabled = 1;
|
||||
}
|
||||
else {
|
||||
LogSys.log_settings[logging_category].is_category_enabled = 0;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
void RegisterApiLogEvent(std::unique_ptr<EQ::Net::WebsocketServer> &server)
|
||||
{
|
||||
LogSys.SetConsoleHandler(
|
||||
[&](uint16 debug_level, uint16 log_category, const std::string &msg) {
|
||||
Json::Value data;
|
||||
data["debug_level"] = debug_level;
|
||||
data["log_category"] = log_category;
|
||||
data["msg"] = msg;
|
||||
server->DispatchEvent(EQ::Net::SubscriptionEventLog, data, 50);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void RegisterApiService(std::unique_ptr<EQ::Net::WebsocketServer> &server)
|
||||
{
|
||||
server->SetLoginHandler(CheckLogin);
|
||||
server->SetMethodHandler("get_packet_statistics", &ApiGetPacketStatistics, 50);
|
||||
server->SetMethodHandler("get_opcode_list", &ApiGetOpcodeList, 50);
|
||||
@ -822,6 +894,8 @@ void RegisterApiService(std::unique_ptr<EQ::Net::WebsocketServer> &server) {
|
||||
server->SetMethodHandler("get_mob_list_detail", &ApiGetMobListDetail, 50);
|
||||
server->SetMethodHandler("get_client_list_detail", &ApiGetClientListDetail, 50);
|
||||
server->SetMethodHandler("get_zone_attributes", &ApiGetZoneAttributes, 50);
|
||||
server->SetMethodHandler("get_logsys_categories", &ApiGetLogsysCategories, 50);
|
||||
server->SetMethodHandler("set_logging_level", &ApiSetLoggingLevel, 50);
|
||||
|
||||
RegisterApiLogEvent(server);
|
||||
}
|
||||
|
||||
@ -3499,7 +3499,7 @@ void Bot::LevelBotWithClient(Client* client, uint8 level, bool sendlvlapp) {
|
||||
Bot* bot = *biter;
|
||||
if(bot && (bot->GetLevel() != client->GetLevel())) {
|
||||
bot->SetPetChooser(false); // not sure what this does, but was in bot 'update' code
|
||||
bot->CalcBotStats(false); // TODO: look at this and see if 'true' should be passed...
|
||||
bot->CalcBotStats(client->GetBotOptionStatsUpdate());
|
||||
if(sendlvlapp)
|
||||
bot->SendLevelAppearance();
|
||||
// modified from Client::SetLevel()
|
||||
@ -4176,6 +4176,9 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
|
||||
size_t returned_count = client_return.size();
|
||||
|
||||
client->Message(CC_Lime, "Trade with '%s' resulted in %i accepted item%s, %i returned item%s.", GetCleanName(), accepted_count, ((accepted_count == 1) ? "" : "s"), returned_count, ((returned_count == 1) ? "" : "s"));
|
||||
|
||||
if (accepted_count)
|
||||
CalcBotStats(client->GetBotOptionStatsUpdate());
|
||||
}
|
||||
|
||||
bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) {
|
||||
|
||||
@ -3441,16 +3441,34 @@ void bot_command_movement_speed(Client *c, const Seperator *sep)
|
||||
void bot_command_owner_option(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||
c->Message(m_usage, "usage: %s [deathmarquee]", sep->arg[0]);
|
||||
c->Message(m_usage, "usage: %s [deathmarquee | statsupdate] (argument: enable | disable | null (toggles))", sep->arg[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string owner_option = sep->arg[1];
|
||||
std::string flag = sep->arg[2];
|
||||
|
||||
if (!owner_option.compare("deathmarquee")) {
|
||||
c->SetBotOptionDeathMarquee(!c->GetBotOptionDeathMarquee());
|
||||
c->Message(m_action, "Bot death marquee is now %s.", (c->GetBotOptionDeathMarquee() == true ? "enabled" : "disabled"));
|
||||
if (!flag.compare("enable"))
|
||||
c->SetBotOptionDeathMarquee(true);
|
||||
else if (!flag.compare("disable"))
|
||||
c->SetBotOptionDeathMarquee(false);
|
||||
else
|
||||
c->SetBotOptionDeathMarquee(!c->GetBotOptionDeathMarquee());
|
||||
|
||||
botdb.SaveOwnerOptionDeathMarquee(c->CharacterID(), c->GetBotOptionDeathMarquee());
|
||||
c->Message(m_action, "Bot 'death marquee' is now %s.", (c->GetBotOptionDeathMarquee() == true ? "enabled" : "disabled"));
|
||||
}
|
||||
else if (!owner_option.compare("statsupdate")) {
|
||||
if (!flag.compare("enable"))
|
||||
c->SetBotOptionStatsUpdate(true);
|
||||
else if (!flag.compare("disable"))
|
||||
c->SetBotOptionStatsUpdate(false);
|
||||
else
|
||||
c->SetBotOptionStatsUpdate(!c->GetBotOptionStatsUpdate());
|
||||
|
||||
botdb.SaveOwnerOptionStatsUpdate(c->CharacterID(), c->GetBotOptionStatsUpdate());
|
||||
c->Message(m_action, "Bot 'stats update' is now %s.", (c->GetBotOptionStatsUpdate() == true ? "enabled" : "disabled"));
|
||||
}
|
||||
else {
|
||||
c->Message(m_fail, "Owner option '%s' is not recognized.", owner_option.c_str());
|
||||
@ -5532,7 +5550,7 @@ void bot_subcommand_bot_update(Client *c, const Seperator *sep)
|
||||
continue;
|
||||
|
||||
bot_iter->SetPetChooser(false);
|
||||
bot_iter->CalcBotStats((sbl.size() == 1));
|
||||
bot_iter->CalcBotStats(c->GetBotOptionStatsUpdate());
|
||||
bot_iter->SendAppearancePacket(AT_WhoLevel, bot_iter->GetLevel(), true, true);
|
||||
++bot_count;
|
||||
}
|
||||
@ -7321,7 +7339,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
my_bot->BotRemoveEquipItem(slotId);
|
||||
my_bot->CalcBotStats();
|
||||
my_bot->CalcBotStats(c->GetBotOptionStatsUpdate());
|
||||
}
|
||||
|
||||
switch (slotId) {
|
||||
|
||||
@ -2188,7 +2188,7 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
|
||||
return false;
|
||||
|
||||
query = StringFormat(
|
||||
"SELECT `death_marquee` FROM `bot_owner_options`"
|
||||
"SELECT `death_marquee`, `stats_update` FROM `bot_owner_options`"
|
||||
" WHERE `owner_id` = '%u'",
|
||||
owner->CharacterID()
|
||||
);
|
||||
@ -2204,6 +2204,7 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
|
||||
|
||||
auto row = results.begin();
|
||||
owner->SetBotOptionDeathMarquee((atoi(row[0]) != 0));
|
||||
owner->SetBotOptionStatsUpdate((atoi(row[1]) != 0));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2227,6 +2228,25 @@ bool BotDatabase::SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BotDatabase::SaveOwnerOptionStatsUpdate(const uint32 owner_id, const bool flag)
|
||||
{
|
||||
if (!owner_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat(
|
||||
"UPDATE `bot_owner_options`"
|
||||
" SET `stats_update` = '%u'"
|
||||
" WHERE `owner_id` = '%u'",
|
||||
(flag == true ? 1 : 0),
|
||||
owner_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Bot bot-group functions */
|
||||
bool BotDatabase::QueryBotGroupExistence(const std::string& group_name, bool& extant_flag)
|
||||
|
||||
@ -148,6 +148,7 @@ public:
|
||||
|
||||
bool LoadOwnerOptions(Client *owner);
|
||||
bool SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool flag);
|
||||
bool SaveOwnerOptionStatsUpdate(const uint32 owner_id, const bool flag);
|
||||
|
||||
/* Bot bot-group functions */
|
||||
bool QueryBotGroupExistence(const std::string& botgroup_name, bool& extant_flag);
|
||||
|
||||
@ -1642,18 +1642,22 @@ private:
|
||||
#ifdef BOTS
|
||||
struct BotOwnerOptions {
|
||||
bool death_marquee;
|
||||
bool stats_update;
|
||||
};
|
||||
|
||||
BotOwnerOptions bot_owner_options;
|
||||
|
||||
const BotOwnerOptions DefaultBotOwnerOptions = {
|
||||
false // death_marquee
|
||||
false, // death_marquee
|
||||
false // stats_update
|
||||
};
|
||||
|
||||
public:
|
||||
void SetBotOptionDeathMarquee(bool flag) { bot_owner_options.death_marquee = flag; }
|
||||
void SetBotOptionStatsUpdate(bool flag) { bot_owner_options.stats_update = flag; }
|
||||
|
||||
bool GetBotOptionDeathMarquee() const { return bot_owner_options.death_marquee; }
|
||||
bool GetBotOptionStatsUpdate() const { return bot_owner_options.stats_update; }
|
||||
|
||||
private:
|
||||
#endif
|
||||
|
||||
@ -11772,15 +11772,25 @@ void command_logs(Client *c, const Seperator *sep){
|
||||
safe_delete(pack);
|
||||
}
|
||||
/* #logs list_settings */
|
||||
if (strcasecmp(sep->arg[1], "list_settings") == 0 || (strcasecmp(sep->arg[1], "set") == 0 && strcasecmp(sep->arg[3], "") == 0)){
|
||||
if (strcasecmp(sep->arg[1], "list_settings") == 0 ||
|
||||
(strcasecmp(sep->arg[1], "set") == 0 && strcasecmp(sep->arg[3], "") == 0)) {
|
||||
c->Message(0, "[Category ID | console | file | gmsay | Category Description]");
|
||||
int redisplay_columns = 0;
|
||||
for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++){
|
||||
if (redisplay_columns == 10){
|
||||
for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++) {
|
||||
if (redisplay_columns == 10) {
|
||||
c->Message(0, "[Category ID | console | file | gmsay | Category Description]");
|
||||
redisplay_columns = 0;
|
||||
}
|
||||
c->Message(0, StringFormat("--- %i | %u | %u | %u | %s", i, LogSys.log_settings[i].log_to_console, LogSys.log_settings[i].log_to_file, LogSys.log_settings[i].log_to_gmsay, Logs::LogCategoryName[i]).c_str());
|
||||
c->Message(
|
||||
0,
|
||||
StringFormat(
|
||||
"--- %i | %u | %u | %u | %s",
|
||||
i,
|
||||
LogSys.log_settings[i].log_to_console,
|
||||
LogSys.log_settings[i].log_to_file,
|
||||
LogSys.log_settings[i].log_to_gmsay,
|
||||
Logs::LogCategoryName[i]
|
||||
).c_str());
|
||||
redisplay_columns++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2436,7 +2436,7 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
|
||||
}
|
||||
DBnpcspells_Struct* parentlist = database.GetNPCSpells(spell_list->parent_list);
|
||||
#if MobAI_DEBUG_Spells >= 10
|
||||
std::string debug_msg = StringFormat("Loading NPCSpells onto %s: dbspellsid=%u", this->GetName(), iDBSpellsID);
|
||||
std::string debug_msg = StringFormat("Loading NPCSpells onto %s: dbspellsid=%u, level=%u", this->GetName(), iDBSpellsID, this->GetLevel());
|
||||
if (spell_list) {
|
||||
debug_msg.append(StringFormat(" (found, %u), parentlist=%u", spell_list->entries.size(), spell_list->parent_list));
|
||||
if (spell_list->parent_list) {
|
||||
@ -2450,6 +2450,22 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
|
||||
debug_msg.append(" (not found)");
|
||||
}
|
||||
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
|
||||
|
||||
#ifdef MobAI_DEBUG_Spells >= 25
|
||||
if (parentlist) {
|
||||
for (const auto &iter : parentlist->entries) {
|
||||
Log(Logs::Detail, Logs::AI, "(%i) %s", iter.spellid, spells[iter.spellid].name);
|
||||
}
|
||||
}
|
||||
Log(Logs::Detail, Logs::AI, "fin (parent list)");
|
||||
if (spell_list) {
|
||||
for (const auto &iter : spell_list->entries) {
|
||||
Log(Logs::Detail, Logs::AI, "(%i) %s", iter.spellid, spells[iter.spellid].name);
|
||||
}
|
||||
}
|
||||
Log(Logs::Detail, Logs::AI, "fin (spell list)");
|
||||
#endif
|
||||
|
||||
#endif
|
||||
uint16 attack_proc_spell = -1;
|
||||
int8 proc_chance = 3;
|
||||
|
||||
26
zone/net.cpp
26
zone/net.cpp
@ -451,7 +451,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
bool worldwasconnected = worldserver.Connected();
|
||||
bool eqsf_open = false;
|
||||
bool telnet_server_opened = false;
|
||||
bool websocker_server_opened = false;
|
||||
|
||||
Timer quest_timers(100);
|
||||
UpdateWindowTitle();
|
||||
@ -475,19 +475,17 @@ int main(int argc, char** argv) {
|
||||
/**
|
||||
* Telnet server
|
||||
*/
|
||||
if (!telnet_server_opened && Config->ZonePort != 0) {
|
||||
if (Config->TelnetEnabled) {
|
||||
Log(
|
||||
Logs::General,
|
||||
Logs::Zone_Server,
|
||||
"Telnet Console (TCP) listener started (%s:%u).",
|
||||
Config->TelnetIP.c_str(),
|
||||
Config->ZonePort
|
||||
);
|
||||
ws_server.reset(new EQ::Net::WebsocketServer(Config->TelnetIP, Config->ZonePort));
|
||||
RegisterApiService(ws_server);
|
||||
telnet_server_opened = true;
|
||||
}
|
||||
if (!websocker_server_opened && Config->ZonePort != 0) {
|
||||
Log(
|
||||
Logs::General,
|
||||
Logs::Zone_Server,
|
||||
"Websocket Server listener started (%s:%u).",
|
||||
Config->TelnetIP.c_str(),
|
||||
Config->ZonePort
|
||||
);
|
||||
ws_server.reset(new EQ::Net::WebsocketServer(Config->TelnetIP, Config->ZonePort));
|
||||
RegisterApiService(ws_server);
|
||||
websocker_server_opened = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user