예제 #1
0
 public void Reset()
 {
     BountyQuestStates.Clear();
     CurrentBounties.Clear();
     ActiveQuests.Clear();
     CurrentBountyMapMarkers.Clear();
     ActiveBounty            = null;
     CurrentBountyCacheEntry = null;
     CurrentAct          = Act.Invalid;
     lastCheckedQuestSNO = -1;
     _lastAttemptedUpdateActiveBounty = DateTime.Today;
 }
예제 #2
0
        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;
                        }
                    }
                }
            }
        }
예제 #3
0
        ///<summary>
        ///Sets Active Bounty
        ///</summary>
        public void UpdateActiveBounty()
        {
            var activeBounty = new BountyInfoCache();

            BountyInfo ZetaActiveBounty = null;

            using (ZetaDia.Memory.AcquireFrame())
            {
                ZetaActiveBounty = ZetaDia.ActInfo.ActiveBounty;
            }

            if (ZetaActiveBounty != null)
            {
                activeBounty = new BountyInfoCache(ZetaDia.ActInfo.ActiveBounty);


                if ((ActiveBounty == null || ActiveBounty.QuestSNO != activeBounty.QuestSNO) && activeBounty.QuestSNO != 0)
                {
                    ActiveBounty = activeBounty;
                    Logger.Write(LogLevel.Bounty, "Active Bounty Changed To {0}", ActiveBounty.QuestSNO);
                    //nullify Cache Entry then set it if Cache contains it.
                    CurrentBountyCacheEntry = null;
                }
                else if (activeBounty.QuestSNO == 0)
                {                //nullify when active bounty is nothing
                    ActiveBounty = null;
                }

                return;
            }

            RefreshActiveQuests();

            if (ActiveQuests.ContainsKey(ADVENTUREMODE_RIFTID) && ActiveQuests[ADVENTUREMODE_RIFTID].State != QuestState.NotStarted)
            {
                if (ActiveBounty != null && ActiveBounty.QuestSNO == ADVENTUREMODE_RIFTID)
                {
                    ((QuestInfoCache)ActiveBounty).Refresh();
                }
                else
                {
                    ActiveBounty = ActiveQuests[ADVENTUREMODE_RIFTID];
                    Logger.Write(LogLevel.Bounty, "Active Bounty Changed To Rifting");
                }
            }
            else if (ActiveQuests.ContainsKey(ADVENTUREMODE_GREATERRIFT_TRIAL) && ActiveQuests[ADVENTUREMODE_GREATERRIFT_TRIAL].State != QuestState.NotStarted)
            {
                if (ActiveBounty != null && ActiveBounty.QuestSNO == ADVENTUREMODE_GREATERRIFT_TRIAL)
                {
                    ((QuestInfoCache)ActiveBounty).Refresh();
                }
                else
                {
                    ActiveBounty = ActiveQuests[ADVENTUREMODE_GREATERRIFT_TRIAL];
                    Logger.Write(LogLevel.Bounty, "Active Bounty Changed To Rift Trial");
                }
            }
            else
            {
                Logger.Write(LogLevel.Bounty, "Active Bounty Is Null!");
            }
        }