From a7ce852ca5f313f0f9d89b587a35bb18be14aa4d Mon Sep 17 00:00:00 2001 From: Michael Cook Date: Wed, 27 Nov 2013 16:05:09 -0500 Subject: [PATCH] Fixed issue with SE_StackingCommand_Overwrite SE_StackingCommand_Overwite uses the calc to figure out the slot to check. Seems that calc 202 is slot 1 and 201 is actually something special. It could be any slot, but need further investigation, for now, just ignore it. --- changelog.txt | 3 +++ zone/spells.cpp | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 89c24e8db..b0c4f0552 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/27/2013 == +demonstar55: Fixed issue with SE_StackingCommand_Overwrite getting the wrong slots, still need to figure out what it means when the calc is 201. + == 11/23/2013 == Secrets: Fixed an issue related to a zone crash where the count of the abilities in an AA was 0, leading to a size 0 buffer issue. diff --git a/zone/spells.cpp b/zone/spells.cpp index 758ea4dae..20d2fb160 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2571,16 +2571,18 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, if(effect2 == SE_StackingCommand_Overwrite) { overwrite_effect = sp2.base[i]; - overwrite_slot = sp2.formula[i] - 201; //they use base 1 for slots, we use base 0 + // TODO: seems 201 is special (any?), need to figure it out, 202 is slot 1 (index 0 for us) + overwrite_slot = sp2.formula[i] - 202; //they use base 1 for slots, we use base 0 overwrite_below_value = sp2.max[i]; - if(sp1.effectid[overwrite_slot] == overwrite_effect) + if(overwrite_slot >= 0 && sp1.effectid[overwrite_slot] == overwrite_effect) { sp1_value = CalcSpellEffectValue(spellid1, overwrite_slot, caster_level1); + sp2_value = CalcSpellEffectValue(spellid2, overwrite_slot, caster_level2); mlog(SPELLS__STACKING, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", - sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value, sp1_value, (sp1_value < overwrite_below_value)?"Overwriting":"Not overwriting"); + sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value, sp1_value, (sp1_value < overwrite_below_value && sp1_value <= sp2_value)?"Overwriting":"Not overwriting"); - if(sp1_value < overwrite_below_value) + if(sp1_value < overwrite_below_value && sp1_value <= sp2_value) { mlog(SPELLS__STACKING, "Overwrite spell because sp1_value < overwrite_below_value"); return 1; // overwrite spell if its value is less @@ -2588,7 +2590,6 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, } else { mlog(SPELLS__STACKING, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value); - } } }