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.
This commit is contained in:
Michael Cook 2013-11-27 16:05:09 -05:00
parent b4fce37c14
commit a7ce852ca5
2 changed files with 9 additions and 5 deletions

View File

@ -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.

View File

@ -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);
}
}
}