From 955514c20ffdf75878995febe291164bd474945f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 12 Feb 2017 23:16:38 -0600 Subject: [PATCH 1/7] eqemu_server.pl Linux make routine compile with the amount of cores available [skip ci] --- utils/scripts/eqemu_server.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index b81520a3c..0fcfa9161 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -334,8 +334,9 @@ sub build_linux_source { } print "Building EQEmu Server code. This will take a while."; - #::: Build - print `make`; + #::: Build + $processor_cores = `cat /proc/cpuinfo | grep -c ^processor /proc/cpuinfo`; + print `make -j$processor_cores`; chdir ($current_directory); From 0f32f780a9d9dab0ec54808be224b1e795db077b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 12 Feb 2017 23:31:25 -0600 Subject: [PATCH 2/7] Revert previous change to keep installation memory safe and independent [skip ci] --- utils/scripts/eqemu_server.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index 0fcfa9161..e9ba02099 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -335,8 +335,7 @@ sub build_linux_source { print "Building EQEmu Server code. This will take a while."; #::: Build - $processor_cores = `cat /proc/cpuinfo | grep -c ^processor /proc/cpuinfo`; - print `make -j$processor_cores`; + print `make`; chdir ($current_directory); From 92d4468326026549c487a6cc84a4601773307ee1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 13 Feb 2017 01:26:19 -0600 Subject: [PATCH 3/7] Put a category enabled filter on default switch case so we're not chewing up extra cpu cycles --- loginserver/client.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/loginserver/client.cpp b/loginserver/client.cpp index 9a6a81593..6f64b5899 100644 --- a/loginserver/client.cpp +++ b/loginserver/client.cpp @@ -99,9 +99,11 @@ bool Client::Process() } default: { - char dump[64]; - app->build_header_dump(dump); - Log.Out(Logs::General, Logs::Error, "Recieved unhandled application packet from the client: %s.", dump); + if (Log.log_settings[Logs::Client_Server_Packet_Unhandled].is_category_enabled == 1) { + char dump[64]; + app->build_header_dump(dump); + Log.Out(Logs::General, Logs::Error, "Recieved unhandled application packet from the client: %s.", dump); + } } } From fe215646592331b1a95b20b0d8e2dff5397609f3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 13 Feb 2017 01:38:23 -0600 Subject: [PATCH 4/7] Apply KLS' tweaks to Log.Out (CPU saves) https://github.com/EQEmu/Server/commit/1d055b5364a4183a327683dfa13cf33954874616 --- common/eqemu_logsys.cpp | 57 ++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 4c0ee1c9f..78a26c5dc 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -123,26 +123,21 @@ void EQEmuLogSys::LoadLogSettingsDefaults() std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message) { - std::string category_string; - if (log_category > 0 && Logs::LogCategoryName[log_category]) - category_string = StringFormat("[%s] ", Logs::LogCategoryName[log_category]); - return StringFormat("%s%s", category_string.c_str(), in_message.c_str()); + std::string ret; + ret.push_back('['); + ret.append(Logs::LogCategoryName[log_category]); + ret.push_back(']'); + ret.push_back(' '); + ret.append(in_message); + return ret; } void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message) { - /* Check if category enabled for process */ - if (log_settings[log_category].log_to_gmsay == 0) - return; - /* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */ if (log_category == Logs::LogCategory::Netcode) return; - /* Make sure the message inbound is at a debug level we're set at */ - if (log_settings[log_category].log_to_gmsay < debug_level) - return; - /* Check to see if the process that actually ran this is zone */ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) on_log_gmsay_hook(log_category, message); @@ -160,14 +155,6 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const crash_log.close(); } - /* Check if category enabled for process */ - if (log_settings[log_category].log_to_file == 0) - return; - - /* Make sure the message inbound is at a debug level we're set at */ - if (log_settings[log_category].log_to_file < debug_level) - return; - char time_stamp[80]; EQEmuLogSys::SetCurrentTimeStamp(time_stamp); @@ -246,13 +233,6 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) { void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message) { - /* Check if category enabled for process */ - if (log_settings[log_category].log_to_console == 0) - return; - - /* Make sure the message inbound is at a debug level we're set at */ - if (log_settings[log_category].log_to_console < debug_level) - return; #ifdef _WINDOWS HANDLE console_handle; @@ -273,12 +253,25 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...) { - const bool log_to_console = log_settings[log_category].log_to_console > 0; - const bool log_to_file = log_settings[log_category].log_to_file > 0; - const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0; - const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay; - if (nothing_to_log) return; + bool log_to_console = true; + if (log_settings[log_category].log_to_console < debug_level) { + log_to_console = false; + } + + bool log_to_file = true; + if (log_settings[log_category].log_to_file < debug_level) { + log_to_file = false; + } + + bool log_to_gmsay = true; + if (log_settings[log_category].log_to_gmsay < debug_level) { + log_to_gmsay = false; + } + + const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay; + if (nothing_to_log) + return; va_list args; va_start(args, message); From ef165224731eeac848e6a5181d017b31ed228734 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 13 Feb 2017 02:16:40 -0600 Subject: [PATCH 5/7] Implement Rule Zone:GlobalLootMultiplier (Default 1) - Sets Global Loot drop multiplier for database based drops, useful for double, triple loot etc. --- common/ruletypes.h | 1 + zone/loottables.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 5323fda49..f972034f0 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -258,6 +258,7 @@ RULE_BOOL(Zone, EnableLoggedOffReplenishments, true) RULE_INT(Zone, MinOfflineTimeToReplenishments, 21600) // 21600 seconds is 6 Hours RULE_BOOL(Zone, UseZoneController, true) // Enables the ability to use persistent quest based zone controllers (zone_controller.pl/lua) RULE_BOOL(Zone, EnableZoneControllerGlobals, false) // Enables the ability to use quest globals with the zone controller NPC +RULE_INT(Zone, GlobalLootMultiplier, 1) // Sets Global Loot drop multiplier for database based drops, useful for double, triple loot etc. RULE_CATEGORY_END() RULE_CATEGORY(Map) diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 7f8e371bd..3297dec60 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -80,10 +80,11 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite *copper = cash; } + uint32 global_loot_multiplier = RuleI(Zone, GlobalLootMultiplier); // Do items for (uint32 i=0; iNumEntries; i++) { - for (uint32 k = 1; k <= lts->Entries[i].multiplier; k++) { + for (uint32 k = 1; k <= (lts->Entries[i].multiplier * global_loot_multiplier); k++) { uint8 droplimit = lts->Entries[i].droplimit; uint8 mindrop = lts->Entries[i].mindrop; From 5b8ad902ce367cf70d9ebc68eb9cf6c9ce46e718 Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 13 Feb 2017 16:00:39 -0500 Subject: [PATCH 6/7] Add character_tasks to the list when deleting a character. --- common/database.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/database.cpp b/common/database.cpp index 423bbac58..b06540cbd 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -307,6 +307,7 @@ bool Database::DeleteCharacter(char *name) { query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); QueryDatabase(query); query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); QueryDatabase(query); query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); QueryDatabase(query); + query = StringFormat("DELETE FROM `character_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query); query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query); query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); QueryDatabase(query); query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); QueryDatabase(query); From d043c38f71eef1436a8fc11b85e09b5a1480f7f4 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 14 Feb 2017 16:39:31 -0500 Subject: [PATCH 7/7] Make it so enraged NPCs can't be riposted This should prevent infinite loops --- zone/attack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 801242d45..826ae713b 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -358,7 +358,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit) } // riposte -- it may seem crazy, but if the attacker has SPA 173 on them, they are immune to Ripo - bool ImmuneRipo = attacker->aabonuses.RiposteChance || attacker->spellbonuses.RiposteChance || attacker->itembonuses.RiposteChance; + bool ImmuneRipo = attacker->aabonuses.RiposteChance || attacker->spellbonuses.RiposteChance || attacker->itembonuses.RiposteChance || attacker->IsEnraged(); // Need to check if we have something in MainHand to actually attack with (or fists) if (hit.hand != EQEmu::inventory::slotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) { if (IsEnraged()) {