TrinityCore/TrinityCore — pull request #7839 by Warpten (2012-09-22 13:38:17+00:00)
Title: Core/Spells: Fixed Soulwell charges removal on use.

## What's the bug ##

* Warlock's soulwell should not lose charges if you cannot store a stone in your inventory, either because you don't have free space or because you already have a stone.
* Soulwell shouldn't lose two charges per use.

## What does the fix fix ##

* Fixes charges loss

## What does the fix bug out ##

* No matter what, you will always get min. one, max. two SpellCastResult error strings. The reason for this is that the Soulwell sends CMSG_*_REPORT_USE and CMSG_*_USE. The two packet handlers related to these call `GameObjectAI::GossipHello`. So we have a race between the `GossipHello` hook called by REPORT_USE and the one called by USE.

Case #1:
a) Player has no stone.
b) Player clicks on the well.
c) First call of the hook will add the stone, second one will send an error string (SpellCastResult)
d) The well loses 1 charge.
You now have one stone, and one error string.

Case #2:
a) Player has a stone.
b) Player clicks on the well.
c) First call of the hook will print the error string, second one will do the same.
d) Charges are not affected.
You now have one stone, and two error strings.

Cheers.