Script Instance Forge of Souls.

Script based on proposal of Synric on trinitycore forum (submitted by Skarabex on GC).
Fix EventMap::DelayEvents
Fixes issue #1310.

--HG--
branch : trunk
This commit is contained in:
Trazom62
2010-04-08 21:03:26 +02:00
parent 6f3996fd11
commit d93e4079f7
13 changed files with 1597 additions and 95 deletions
+26 -9
View File
@@ -405,18 +405,27 @@ class EventMap : private std::map<uint32, uint32>
return 0;
}
void DelayEvents(uint32 time, uint32 gcd)
// Delay all events
void DelayEvents(uint32 delay)
{
time += m_time;
if (delay < m_time)
m_time -= delay;
else
m_time = 0;
}
// Delay all events having the specified Global Cooldown.
void DelayEvents(uint32 delay, uint32 gcd)
{
uint32 nextTime = m_time + delay;
gcd = (1 << (gcd + 16));
for (iterator itr = begin(); itr != end();)
for (iterator itr = begin(); itr != end() && itr->first < nextTime;)
{
if (itr->first >= time)
break;
if (itr->second & gcd)
{
ScheduleEvent(time, itr->second);
erase(itr++);
ScheduleEvent(itr->second, itr->first-m_time+delay);
erase(itr);
itr = begin();
}
else
++itr;
@@ -428,7 +437,10 @@ class EventMap : private std::map<uint32, uint32>
for (iterator itr = begin(); itr != end();)
{
if (eventId == (itr->second & 0x0000FFFF))
erase(itr++);
{
erase(itr);
itr = begin();
}
else
++itr;
}
@@ -436,10 +448,15 @@ class EventMap : private std::map<uint32, uint32>
void CancelEventsByGCD(uint32 gcd)
{
gcd = (1 << (gcd + 16));
for (iterator itr = begin(); itr != end();)
{
if (itr->second & gcd)
erase(itr++);
{
erase(itr);
itr = begin();
}
else
++itr;
}