*[8508] Not assign boolean value to integer variable, expecting to always be 0. Also renaming member variables. Author: NoFantasy

*[8516] Implement spell 53271. Author: Shendor
*[8519] Use RuneType enum where appropriate and more explicit data for rune init. Author: VladimirMangos
Thanks to: Stryker
*[8520] Limit telent 49182 and ranks triggering expected:wq runes cooldown case. Author: Shendor
*Fix Herald Volazj wrongly targeting himself on Shadow Bolt Volley instead of randomly targeting on Shiver, by tlexii.

--HG--
branch : trunk
This commit is contained in:
maximius
2009-09-21 12:31:36 -07:00
parent f093c18ca1
commit 9e5c8db01f
9 changed files with 75 additions and 28 deletions

View File

@@ -32,6 +32,7 @@ template <class T>
PoolGroup<T>::PoolGroup()
{
m_SpawnedPoolAmount = 0;
m_LastDespawnedNode = 0;
}
// Method to add a gameobject/creature guid to the proper list depending on pool type and chance value
@@ -107,7 +108,7 @@ void PoolGroup<T>::DespawnObject(uint32 guid)
if (!guid || EqualChanced[i].guid == guid)
{
if (guid)
CacheValue = EqualChanced[i].guid;
m_LastDespawnedNode = EqualChanced[i].guid;
else
Despawn1Object(EqualChanced[i].guid);
@@ -183,9 +184,11 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache)
if (limit == 1) // This is the only case where explicit chance is used
{
uint32 roll = RollOne();
if (cache && CacheValue != roll)
Despawn1Object(CacheValue);
CacheValue = Spawn1Object(roll);
if (cache && m_LastDespawnedNode != roll)
Despawn1Object(m_LastDespawnedNode);
m_LastDespawnedNode = 0;
Spawn1Object(roll);
}
else if (limit < EqualChanced.size() && m_SpawnedPoolAmount < limit)
{
@@ -198,10 +201,10 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache)
{
uint32 roll = urand(1, IndexList.size()) - 1;
uint32 index = IndexList[roll];
if (!cache || (cache && EqualChanced[index].guid != CacheValue))
if (!cache || (cache && EqualChanced[index].guid != m_LastDespawnedNode))
{
if (cache)
Despawn1Object(CacheValue);
Despawn1Object(m_LastDespawnedNode);
EqualChanced[index].spawned = Spawn1Object(EqualChanced[index].guid);
}
else
@@ -213,7 +216,7 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache)
std::vector<uint32>::iterator itr = IndexList.begin()+roll;
IndexList.erase(itr);
}
CacheValue = 0;
m_LastDespawnedNode = 0;
}
else // Not enough objects in pool, so spawn all
{
@@ -332,7 +335,7 @@ bool PoolGroup<Pool>::ReSpawn1Object(uint32 /*guid*/)
PoolHandler::PoolHandler()
{
isSystemInit = false;
m_IsPoolSystemStarted = false;
}
void PoolHandler::LoadFromDB()
@@ -626,7 +629,7 @@ void PoolHandler::Initialize()
}
sLog.outBasic("Pool handling system initialized, %u pools spawned.", count);
isSystemInit = true;
m_IsPoolSystemStarted = true;
}
// Call to spawn a pool, if cache if true the method will spawn only if cached entry is different