Example #1
0
 // When the bot stops, output a final item-stats report so it is as up-to-date as can be
 private static void TrinityBotStop(IBot bot)
 {
     GoldInactivity.Instance.ResetCheckGold();
     XpInactivity.Instance.ResetCheckXp();
     // Issue final reports
     ItemDropStats.OutputReport();
     PlayerMover.TotalAntiStuckAttempts     = 1;
     PlayerMover.vSafeMovementLocation      = Vector3.Zero;
     PlayerMover.LastPosition               = Vector3.Zero;
     PlayerMover.TimesReachedStuckPoint     = 0;
     PlayerMover.TimeLastRecordedPosition   = DateTime.MinValue;
     PlayerMover.LastGeneratedStuckPosition = DateTime.MinValue;
     DeathsThisRun = 0;
     CacheData.FullClear();
 }
Example #2
0
        /// <summary>
        /// Receive Pulse event from DemonBuddy.
        /// </summary>
        public void OnPulse()
        {
            try
            {
                if (ZetaDia.Me == null)
                {
                    return;
                }

                if (!ZetaDia.IsInGame || !ZetaDia.Me.IsValid || ZetaDia.IsLoadingWorld)
                {
                    return;
                }

                //ScenesStorage.Update();

                using (new PerformanceLogger("OnPulse"))
                {
                    //if (IsMoveRequested)
                    //    NavServerReport();

                    GameUI.SafeClickUIButtons();

                    if (ZetaDia.Me.IsDead)
                    {
                        return;
                    }

                    using (new PerformanceLogger("LazyRaiderClickToPause"))
                    {
                        if (Settings.Advanced.LazyRaiderClickToPause && !BotMain.IsPaused)
                        {
                            BotMain.PauseWhile(MouseLeft);
                        }
                    }

                    // See if we should update the stats file
                    if (DateTime.UtcNow.Subtract(ItemDropStats.ItemStatsLastPostedReport).TotalSeconds > 10)
                    {
                        ItemDropStats.ItemStatsLastPostedReport = DateTime.UtcNow;
                        ItemDropStats.OutputReport();
                    }

                    // Recording of all the XML's in use this run
                    UsedProfileManager.RecordProfile();

                    DebugUtil.LogOnPulse();

                    Gamble.CheckShouldTownRunForGambling();

                    MonkCombat.RunOngoingPowers();
                }
            }
            catch (AccessViolationException)
            {
                // woof!
            }
            catch (Exception ex)
            {
                Logger.Log(LogCategory.UserInformation, "Exception in Pulse: {0}", ex.ToString());
            }
        }
Example #3
0
        private static bool RefreshItemStats(TrinityItemBaseType baseType)
        {
            bool isNewLogItem = false;

            c_ItemMd5Hash = HashGenerator.GenerateItemHash(CurrentCacheObject.Position, CurrentCacheObject.ActorSNO, CurrentCacheObject.InternalName, CurrentWorldDynamicId, c_ItemQuality, c_ItemLevel);

            if (!GenericCache.ContainsKey(c_ItemMd5Hash))
            {
                GenericCache.AddToCache(new GenericCacheObject(c_ItemMd5Hash, null, new TimeSpan(1, 0, 0)));

                try
                {
                    isNewLogItem = true;
                    if (baseType == TrinityItemBaseType.Armor || baseType == TrinityItemBaseType.WeaponOneHand || baseType == TrinityItemBaseType.WeaponTwoHand ||
                        baseType == TrinityItemBaseType.WeaponRange || baseType == TrinityItemBaseType.Jewelry || baseType == TrinityItemBaseType.FollowerItem ||
                        baseType == TrinityItemBaseType.Offhand)
                    {
                        try
                        {
                            int iThisQuality;
                            ItemDropStats.ItemsDroppedStats.Total++;
                            if (c_ItemQuality >= ItemQuality.Legendary)
                            {
                                iThisQuality = ItemDropStats.QUALITYORANGE;
                            }
                            else if (c_ItemQuality >= ItemQuality.Rare4)
                            {
                                iThisQuality = ItemDropStats.QUALITYYELLOW;
                            }
                            else if (c_ItemQuality >= ItemQuality.Magic1)
                            {
                                iThisQuality = ItemDropStats.QUALITYBLUE;
                            }
                            else
                            {
                                iThisQuality = ItemDropStats.QUALITYWHITE;
                            }
                            ItemDropStats.ItemsDroppedStats.TotalPerQuality[iThisQuality]++;
                            ItemDropStats.ItemsDroppedStats.TotalPerLevel[c_ItemLevel]++;
                            ItemDropStats.ItemsDroppedStats.TotalPerQPerL[iThisQuality, c_ItemLevel]++;
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError("Error Refreshing Item Stats for Equippable Item: " + ex.ToString());
                        }
                    }
                    else if (baseType == TrinityItemBaseType.Gem)
                    {
                        try
                        {
                            int iThisGemType = 0;
                            ItemDropStats.ItemsDroppedStats.TotalGems++;
                            if (_cItemTinityItemType == TrinityItemType.Topaz)
                            {
                                iThisGemType = ItemDropStats.GEMTOPAZ;
                            }
                            if (_cItemTinityItemType == TrinityItemType.Ruby)
                            {
                                iThisGemType = ItemDropStats.GEMRUBY;
                            }
                            if (_cItemTinityItemType == TrinityItemType.Emerald)
                            {
                                iThisGemType = ItemDropStats.GEMEMERALD;
                            }
                            if (_cItemTinityItemType == TrinityItemType.Amethyst)
                            {
                                iThisGemType = ItemDropStats.GEMAMETHYST;
                            }
                            if (_cItemTinityItemType == TrinityItemType.Diamond)
                            {
                                iThisGemType = ItemDropStats.GEMDIAMOND;
                            }
                            ItemDropStats.ItemsDroppedStats.GemsPerType[iThisGemType]++;
                            ItemDropStats.ItemsDroppedStats.GemsPerLevel[c_ItemLevel]++;
                            ItemDropStats.ItemsDroppedStats.GemsPerTPerL[iThisGemType, c_ItemLevel]++;
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError("Error refreshing item stats for Gem: " + ex.ToString());
                        }
                    }
                    else if (_cItemTinityItemType == TrinityItemType.InfernalKey)
                    {
                        try
                        {
                            ItemDropStats.ItemsDroppedStats.TotalInfernalKeys++;
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError("Error refreshing item stats for InfernalKey: " + ex.ToString());
                        }
                    }
                    // See if we should update the stats file
                    if (DateTime.UtcNow.Subtract(ItemDropStats.ItemStatsLastPostedReport).TotalSeconds > 10)
                    {
                        try
                        {
                            ItemDropStats.ItemStatsLastPostedReport = DateTime.UtcNow;
                            ItemDropStats.OutputReport();
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError("Error Calling OutputReport from RefreshItemStats " + ex.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError("Couldn't do Item Stats" + ex.ToString());
                }
            }
            return(isNewLogItem);
        }