From 21acd79acf381f53111b8be6390311a84018daf4 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 2 Nov 2015 17:58:35 -0500 Subject: [PATCH 01/10] Fix procs that have end cost from consuming end --- zone/spells.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index 6b5707278..9ec68c3ff 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2267,7 +2267,9 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } } // one may want to check if this is a disc or not, but we actually don't, there are non disc stuff that have end cost - if (spells[spell_id].EndurCost) { + // lets not consume end for custom items that have disc procs. + // One might also want to filter out USE_ITEM_SPELL_SLOT, but DISCIPLINE_SPELL_SLOT are both #defined to the same thing ... + if (spells[spell_id].EndurCost && !isproc) { auto end_cost = spells[spell_id].EndurCost; if (mgb) end_cost *= 2; From f884d8d7388f000c8db024e63bf2311d4ddb30e5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 2 Nov 2015 21:33:36 -0600 Subject: [PATCH 02/10] Fix an issue where during a depop cycle and NPC's are engaged by wiping hatelist before issuing NPC depop --- zone/entity.cpp | 2 ++ zone/mob_ai.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/zone/entity.cpp b/zone/entity.cpp index c427d82d7..643b27177 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2438,6 +2438,8 @@ void EntityList::Depop(bool StartSpawnTimer) if (pnpc->IsFindable()) UpdateFindableNPCState(pnpc, true); + pnpc->WipeHateList(); + pnpc->Depop(StartSpawnTimer); } } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 0a2219428..6bde54d0a 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1867,6 +1867,9 @@ bool NPC::AI_IdleCastCheck() { //if we didnt cast any spells, our autocast timer just resets to the //last duration it was set to... try to put up a more reasonable timer... AIautocastspell_timer->Start(RandomTimer(AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max), false); + + Log.Out(Logs::Moderate, Logs::Spells, "Triggering AI_IdleCastCheck :: Mob %s - Min : %u Max : %u", this->GetCleanName(), AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max); + } //else, spell casting finishing will reset the timer. } //else, spell casting finishing will reset the timer. return(true); From 63051dda9c438290dce276e75caa5a64d9761e05 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 2 Nov 2015 22:12:41 -0600 Subject: [PATCH 03/10] Performance boost (exponential) - Adjusted default idle cast check timers in rules - NPC:NPCToNPCAggroTimerMin 500 (Now 6000) 6 seconds - NPC:NPCToNPCAggroTimerMax 2000 (Now 60000) 60 seconds - Database version 9089 will take care of this update automatically only if you used the default values - The CPU cost of NPC's checking the entire entity list to cast beneficial spells (Heals/Buffs) becomes extremely high when higher NPC count zones exist (Based off of process profiling) - Distance checks for every single NPC to every single other NPC who are casting beneficial spells occur every .5 - 2 seconds unless npc_spells dictates other values, which most of the time it does not - Zones that once fluctuated from 1-8% CPU with no activity (Idle but players present) now idle at .5% based on my testings due to this change in conjunction with the past few performance commits, these are zones that have 600-800 NPC's in them - These values normally are overidden by the spells table (npc_spells), fields (idle_no_sp_recast_min, idle_no_sp_recast_max) --- changelog.txt | 13 +++++++++++++ common/ruletypes.h | 4 ++-- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + ...1_02_ai_idle_no_spell_recast_default_changes.sql | 2 ++ 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 utils/sql/git/required/2015_11_02_ai_idle_no_spell_recast_default_changes.sql diff --git a/changelog.txt b/changelog.txt index 7aa6ee7e1..1b1e9630a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,18 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/2/2015 == +Akkadius: Performance boost (exponential) - Adjusted default idle cast check timers in rules + - NPC:NPCToNPCAggroTimerMin 500 (Now 6000) 6 seconds + - NPC:NPCToNPCAggroTimerMax 2000 (Now 60000) 60 seconds + - Database version 9089 will take care of this update automatically only if you used the default values + - The CPU cost of NPC's checking the entire entity list to cast beneficial spells (Heals/Buffs) becomes extremely high when + higher NPC count zones exist (Based off of process profiling) + - Distance checks for every single NPC to every single other NPC who are casting beneficial spells occur every .5 - 2 seconds unless + npc_spells dictates other values, which most of the time it does not + - Zones that once fluctuated from 1-8% CPU with no activity (Idle but players present) now idle at .5% based on my testings due + to this change in conjunction with the past few performance commits, these are zones that have 600-800 NPC's in them + - These values normally are overidden by the spells table (npc_spells), fields (idle_no_sp_recast_min, idle_no_sp_recast_max) + == 11/1/2015 == Akkadius: Made many performance optimizing oriented code changes in the source - Added Rate limit the rate in which signals are processed for NPC's (.5 seconds instead of .01 seconds) diff --git a/common/ruletypes.h b/common/ruletypes.h index 456c9f378..411489ca1 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -347,8 +347,8 @@ RULE_INT(Spells, AI_EngagedDetrimentalChance, 20) // Chance during third AI Cast RULE_INT(Spells, AI_PursueNoSpellMinRecast, 500) // AI spell recast time(MS) check when no spell is cast while chasing target. (min time in random) RULE_INT(Spells, AI_PursueNoSpellMaxRecast, 2000) // AI spell recast time(MS) check when no spell is cast while chasing target. (max time in random) RULE_INT(Spells, AI_PursueDetrimentalChance, 90) // Chance while chasing target to cast a detrimental spell. -RULE_INT(Spells, AI_IdleNoSpellMinRecast, 500) // AI spell recast time(MS) check when no spell is cast while idle. (min time in random) -RULE_INT(Spells, AI_IdleNoSpellMaxRecast, 2000) // AI spell recast time(MS) check when no spell is cast while chasing target. (max time in random) +RULE_INT(Spells, AI_IdleNoSpellMinRecast, 6000) // AI spell recast time(MS) check when no spell is cast while idle. (min time in random) +RULE_INT(Spells, AI_IdleNoSpellMaxRecast, 60000) // AI spell recast time(MS) check when no spell is cast while chasing target. (max time in random) RULE_INT(Spells, AI_IdleBeneficialChance, 100) // Chance while idle to do a beneficial spell on self or others. RULE_BOOL(Spells, SHDProcIDOffByOne, true) // pre June 2009 SHD spell procs were off by 1, they stopped doing this in June 2009 (so UF+ spell files need this false) RULE_BOOL(Spells, Jun182014HundredHandsRevamp, false) // this should be true for if you import a spell file newer than June 18, 2014 diff --git a/common/version.h b/common/version.h index 3a3969ec1..4f39b595c 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9088 +#define CURRENT_BINARY_DATABASE_VERSION 9089 #ifdef BOTS #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9000 #else diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 2ffc2f452..aa1e46be9 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -342,6 +342,7 @@ 9086|2015_07_02_aa_rework.sql|SHOW TABLES LIKE 'aa_ranks'|empty| 9087|2015_09_25_inventory_snapshots.sql|SHOW TABLES LIKE 'inventory_snapshots'|empty| 9088|2015_11_01_perl_event_export_settings.sql|SHOW TABLES LIKE 'perl_event_export_settings'|empty| +9089|2015_11_02_ai_idle_no_spell_recast_default_changes.sql|SELECT * FROM `rule_values` WHERE `rule_name` LIKE '%Spells:AI_IdleNoSpellMinRecast%' AND `rule_value` = '500'|not_empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2015_11_02_ai_idle_no_spell_recast_default_changes.sql b/utils/sql/git/required/2015_11_02_ai_idle_no_spell_recast_default_changes.sql new file mode 100644 index 000000000..fe09523c7 --- /dev/null +++ b/utils/sql/git/required/2015_11_02_ai_idle_no_spell_recast_default_changes.sql @@ -0,0 +1,2 @@ +UPDATE `rule_values` SET `rule_value` = '6000' WHERE `rule_value` = '500' AND `rule_name` = 'Spells:AI_IdleNoSpellMinRecast'; +UPDATE `rule_values` SET `rule_value` = '60000' WHERE `rule_value` = '2000' AND `rule_name` = 'Spells:AI_IdleNoSpellMaxRecast'; \ No newline at end of file From 9304e09eca12e7bd412f4a40122b1aa4f9841c8a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 2 Nov 2015 22:15:40 -0600 Subject: [PATCH 04/10] Adjust changelog.txt [skip ci] --- changelog.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1b1e9630a..0b93e015c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,10 +5,8 @@ Akkadius: Performance boost (exponential) - Adjusted default idle cast check tim - NPC:NPCToNPCAggroTimerMin 500 (Now 6000) 6 seconds - NPC:NPCToNPCAggroTimerMax 2000 (Now 60000) 60 seconds - Database version 9089 will take care of this update automatically only if you used the default values - - The CPU cost of NPC's checking the entire entity list to cast beneficial spells (Heals/Buffs) becomes extremely high when - higher NPC count zones exist (Based off of process profiling) - - Distance checks for every single NPC to every single other NPC who are casting beneficial spells occur every .5 - 2 seconds unless - npc_spells dictates other values, which most of the time it does not + - The CPU cost of NPC's checking the entire entity list to cast beneficial spells (Heals/Buffs) becomes extremely high when higher NPC count zones exist (Based off of process profiling) + - Distance checks for every single NPC to every single other NPC who are casting beneficial spells occur every .5 - 2 seconds unless npc_spells dictates other values, which most of the time it does not - Zones that once fluctuated from 1-8% CPU with no activity (Idle but players present) now idle at .5% based on my testings due to this change in conjunction with the past few performance commits, these are zones that have 600-800 NPC's in them - These values normally are overidden by the spells table (npc_spells), fields (idle_no_sp_recast_min, idle_no_sp_recast_max) From 67c7254fd15e08cdca0eae9ec32b052c6559de49 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 2 Nov 2015 22:48:17 -0600 Subject: [PATCH 05/10] Copy paste fail [skip ci] --- changelog.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0b93e015c..5a1c346de 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,8 +2,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/2/2015 == Akkadius: Performance boost (exponential) - Adjusted default idle cast check timers in rules - - NPC:NPCToNPCAggroTimerMin 500 (Now 6000) 6 seconds - - NPC:NPCToNPCAggroTimerMax 2000 (Now 60000) 60 seconds + - Spells:AI_IdleNoSpellMinRecast 500 (Now 6000) 6 seconds + - Spells:AI_IdleNoSpellMaxRecast 2000 (Now 60000) 60 seconds - Database version 9089 will take care of this update automatically only if you used the default values - The CPU cost of NPC's checking the entire entity list to cast beneficial spells (Heals/Buffs) becomes extremely high when higher NPC count zones exist (Based off of process profiling) - Distance checks for every single NPC to every single other NPC who are casting beneficial spells occur every .5 - 2 seconds unless npc_spells dictates other values, which most of the time it does not From 27c8a85f6149a51984ba6054505ffc7b2b639a20 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 2 Nov 2015 23:23:04 -0600 Subject: [PATCH 06/10] Change AI_scan_area_timer to have a little variability in renewing a new timer time versus deciding one on spawn and sticking with it --- zone/mob_ai.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 6bde54d0a..25ed72441 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1364,9 +1364,14 @@ void Mob::AI_Process() { * */ - Mob* tmptar = entity_list.AICheckCloseAggro(this, GetAggroRange(), GetAssistRange()); - if (tmptar) - AddToHateList(tmptar); + Mob* temp_target = entity_list.AICheckCloseAggro(this, GetAggroRange(), GetAssistRange()); + if (temp_target){ + AddToHateList(temp_target); + } + + AI_scan_area_timer->Disable(); + AI_scan_area_timer->Start(RandomTimer(RuleI(NPC, NPCToNPCAggroTimerMin), RuleI(NPC, NPCToNPCAggroTimerMax)), false); + } else if (AI_movement_timer->Check() && !IsRooted()) { From 835fbb81cbf349e102320154b0e7e1deddbea5c6 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 3 Nov 2015 14:09:22 -0500 Subject: [PATCH 07/10] Expand Casting Restrictions Mostly to nerf HT, not fully implemented --- zone/spell_effects.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 4b92fc688..f7e794334 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -6224,16 +6224,17 @@ bool Mob::PassCastRestriction(bool UseCastRestriction, int16 value, bool IsDama Range 410 - 411 : UNKOWN Range 500 - 599 : Heal if HP less than a specified value Range 600 - 699 : Limit to Body Type [base2 - 600 = Body] - Range 700 : UNKNOWN + Range 700 : UNKNOWN -- Was added to higher HTs in Oct 21 2015 live patch Range 701 : NOT PET Range 800 : UKNOWN Range 818 - 819 : If Undead/If Not Undead Range 820 - 822 : UKNOWN Range 835 : Unknown *not implemented - Range 836 - 837 : Progression Server / Live Server *not implemented - Range 839 : Unknown *not implemented + Range 836 - 837 : Progression Server / Live Server *not fully implemented + Range 839 : Progression Server and GoD released -- broken until Oct 21 2015 on live *not fully implemented Range 842 - 844 : Humaniod lv MAX ((842 - 800) * 2) Range 845 - 847 : UNKNOWN + Range 860 - 871 : Humanoid lv MAX 860 = 90, 871 = 104 *not implemented Range 10000 - 11000 : Limit to Race [base2 - 10000 = Race] (*Not on live: Too useful a function to not implement) THIS IS A WORK IN PROGRESS */ @@ -6402,6 +6403,15 @@ bool Mob::PassCastRestriction(bool UseCastRestriction, int16 value, bool IsDama return true; break; + case 836: + return true; // todo implement progression flag assume not progression for now + + case 837: + return false; // todo implement progression flag assume not progression for now + + case 839: + return true; // todo implement progression flag assume not progression for now, this one is a check if GoD is live + case 842: if (GetBodyType() == BT_Humanoid && GetLevel() <= 84) return true; @@ -6789,4 +6799,4 @@ void Client::BreakFeignDeathWhenCastOn(bool IsResisted) SetFeigned(false); Message_StringID(MT_SpellFailure,FD_CAST_ON); } -} \ No newline at end of file +} From e7184f402d66dbca0a3a80c612fb3333cee08ca0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 3 Nov 2015 14:13:56 -0500 Subject: [PATCH 08/10] Add Casting Restrictions to SE_CurrentHPOnce --- zone/spell_effects.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index f7e794334..a0f2aa8ee 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -283,9 +283,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove //do any AAs apply to these spells? if(dmg < 0) { + if (!PassCastRestriction(false, spells[spell_id].base2[i], true)) + break; dmg = -dmg; Damage(caster, dmg, spell_id, spell.skill, false, buffslot, false); } else { + if (!PassCastRestriction(false, spells[spell_id].base2[i], true)) + break; HealDamage(dmg, caster); } break; From 63ae7ac3157e316f679c972d349912de588f84c7 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 3 Nov 2015 14:15:55 -0500 Subject: [PATCH 09/10] Add Casting Restrictions to SE_CurrentHP (DoTs) buff processing --- zone/spell_effects.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index a0f2aa8ee..f96ac88fd 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3433,6 +3433,8 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster) switch (effect) { case SE_CurrentHP: { + if (!PassCastRestriction(false, spells[buff.spellid].base2[i], true)) + break; effect_value = CalcSpellEffectValue(buff.spellid, i, buff.casterlevel, buff.instrument_mod, caster, buff.ticsremaining); // Handle client cast DOTs here. From 8d80f39ead7bc5872287a10498b771815dcbc9d3 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 3 Nov 2015 14:17:55 -0500 Subject: [PATCH 10/10] Fix copy paste error --- zone/spell_effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index f96ac88fd..a2e769320 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -288,7 +288,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove dmg = -dmg; Damage(caster, dmg, spell_id, spell.skill, false, buffslot, false); } else { - if (!PassCastRestriction(false, spells[spell_id].base2[i], true)) + if (!PassCastRestriction(false, spells[spell_id].base2[i], false)) break; HealDamage(dmg, caster); }