private void OnOwlTick(object state)
{
try
{
// Do nothing if still indoor
if (_creature.Region == Region.Limbo || _creature.Region.IsIndoor)
return;
var now = DateTime.Now;
lock (_owlQueue)
{
var arrived = new List<int>();
// Check all owl's arrival times if we're not indoor
// and finally send them.
foreach (var owl in _owlQueue.Values)
{
if (owl.Arrival <= now)
{
arrived.Add(owl.QuestId);
this.StartByOwl(owl.QuestId);
}
}
// Remove arrived quests from queue.
foreach (var questId in arrived)
_owlQueue.Remove(questId);
}
}
catch (Exception ex)
{
Log.Exception(ex, "Exception during owl tick.");
}
}