AGAIN - This only happens when a focus item like Bear-hide boots are in effect and we use SendBuffDuration() to update the duration...
I decided to test effect as if it were a bitfield and drop a bit, test, drop a bit test..
What I found was that for the
shielding line of spells, the effect field's bottom 6 bits contained an addition to max HP. So 32, 16, 8, 4, 2 and 1 changed max HP by those amounts (above and beyond the original spell). That's obviously not what we want to do when we update Buff Duration.
Setting effect to 0 cancelled the effect entirely. Setting any bits higher than 32 seemed to work (meaning, did not alter the spell effect). Maybe because the GUI rejects values that high or one of those bits being set means not to mess with the effect. So 64, 65, 128, 129, things like that had no impact on the max HP (left the value correct, while still fixing the Duration) which is what we want. Its hard to say if those upper 2 bits are a flag or simply make the value too large and the GUI rejects it.
The fix (for the shielding line) would be to set effect to 128 or 64. Trying to set it to the value of HP gained just ADDS that on top of the existing buff.
Now, for the
Allure of Death, which converts HP to mana...
Setting effect to 128 resulted in the loss of 68hp per tick, 64 resulted in 30hp per tick, 32 resulted in 10 per tick, 16 resulted in 1 per tick, values 8, 4 and 2 actually resulted in POSITIVE HP per tick (from the GUI) and a value of 1 cancelled the effect as did 0.
I can't see a logical pattern to this. However, by setting the effect to 16 we only see a -1 HP per tick and the server side will do the right thing and push the correct HP updates as always.
Results of both shielding spell like and allure of death using various values for effect in the BuffFade_Struct:
At first glance setting effect to 0 in both cases seems nice, as the server will update HP regardless, but 0 makes the GUI drop max HP in the case of the shielding line and change color of max hp in the allure of death spell.
I'm planning a patch that will have a switch statement based on spellid, with a default value for effect of caster_level (which was what was there before my 1st patch). For spells we know that this breaks, I will use values that I found above. If you guys see a better solution, I'm all ears.