Quantcast

Fix OvaleEnemies to track the number of enemies correctly.

Author Johnny C. Lam <jlam88@gmail.com>
Author date 2013-03-16 08:04:03
Author local date 2013-03-16 08:04:03 +0000
Committer Johnny C. Lam <jlam88@gmail.com>
Committer date 2013-03-16 08:04:03
Committer local date 2013-03-16 08:04:03 +0000
Commit 8a33fb2e8d7bbfcb21802f5ccf99009b6b772dc4
Tree 617a660250d448fc3cd10ab7efeb6b0a679a6f6f
Parent 6c1e90f19cd3912cb23f275f95783ed81c41969c
Fix OvaleEnemies to track the number of enemies correctly.

Before this change, the enemies table was not being updated properly when
UNIT_DIED was received.

Split out the routines to add and remove enemies into public methods to
make the code more DRY.

API change: Remove method GetNumberOfEnemies() and introduce a public
static variable ``activeEnemies'' that holds the number of active enemies.

Schedule a timer to remove enemies that haven't been active for at least 3
seconds.  These are either not in combat with your group, out of range, or
incapacitated and shouldn't count toward your active enemies.

When a unit is no longer an active enemy, throw a new Ovale event
``Ovale_InactiveUnit'' that has the GUID of the dead unit as an event
parameter.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@780 d5049fe3-3747-40f7-a4b5-f36d6801af5f