private void RefreshBountyLevelChange()
{
//Logger.DBLog.InfoFormat("Updating Bounty Info!");
//Do we have any bounties stored?.. if we do refresh states
if (CurrentBounties.Count == 0) RefreshBountyInfo(); else RefreshBountyQuestStates();
//If we are in town.. we don't do anything else! (Since the Active Bounty is no longer visible)
if (FunkyGame.Hero.bIsInTown)
{
//We could check that active bounty has been completed..
if (ActiveBounty != null && BountyQuestStates.ContainsKey(ActiveBounty.QuestSNO) && BountyQuestStates[ActiveBounty.QuestSNO] == QuestState.Completed)
{
Logger.Write(LogLevel.Bounty, "ActiveBounty Quest State is Completed!");
ActiveBounty = null;
}
return;
}
//Do we have an active bounty set.. lets try to invalidate it.
if (ActiveBounty == null)
{
UpdateActiveBounty();
}
else if (!BountyQuestStates.ContainsKey(ActiveBounty.QuestSNO))
{
Logger.Write(LogLevel.Bounty, "ActiveBounty is not contained within BountyQuestStates Cache!");
UpdateActiveBounty();
}
else if (BountyQuestStates[ActiveBounty.QuestSNO] == QuestState.Completed)
{
Logger.Write(LogLevel.Bounty, "ActiveBounty Quest State is Completed!");
ActiveBounty = null;
UpdateActiveBounty();
}
//Refresh any Map Markers we could use for navigation..
RefreshBountyMapMarkers();
//Is ActiveBounty valid still?
if (ActiveBounty != null)
{
//Load Act Bounty Cache
if (!ZetaDia.IsInTown && ActiveBounty.Act != CurrentAct)
{
CurrentAct = ActiveBounty.Act;
}
if (CurrentBountyCacheEntry == null)
{//Attempt to Match a Cache Entry to the QuestSNO.
if (lastCheckedQuestSNO != ActiveBounty.QuestSNO)
{//Only attempt search once for the SNO..
lastCheckedQuestSNO = ActiveBounty.QuestSNO;
//var allCacheBounties = CurrentActCache.AllBounties;
BountyDataCollection.BountyActCollection bountyActCache=null;
switch (CurrentAct)
{
case Act.A1:
bountyActCache = TheCache.ObjectIDCache.BountyEntries.ActOne;
break;
case Act.A2:
bountyActCache = TheCache.ObjectIDCache.BountyEntries.ActTwo;
break;
case Act.A3:
bountyActCache = TheCache.ObjectIDCache.BountyEntries.ActThree;
break;
case Act.A4:
bountyActCache = TheCache.ObjectIDCache.BountyEntries.ActFour;
break;
case Act.A5:
bountyActCache = TheCache.ObjectIDCache.BountyEntries.ActFive;
break;
}
if (bountyActCache == null) return;
foreach (var b in bountyActCache.AllBounties.Where(c => c.QuestSNOs != null && c.QuestSNOs.Any(i => i == ActiveBounty.QuestSNO)))
{
CurrentBountyCacheEntry = b;
break;
}
}
}
}
}