public PersistentStats()
            {
                ItemsDropped = new ItemDropStats(0, new double[4], new double[74], new double[4, 74], 0, new double[74], 0, new double[5], new double[74], new double[5, 74], 0);
                ItemsPicked  = new ItemDropStats(0, new double[4], new double[74], new double[4, 74], 0, new double[74], 0, new double[5], new double[74], new double[5, 74], 0);

                Reset();
            }
Example #2
0
        public PersistentStats()
        {
            ItemsDropped = new ItemDropStats(0, new double[4], new double[74], new double[4, 74], 0, new double[74], 0, new double[5], new double[74], new double[5, 74], 0);
            ItemsPicked = new ItemDropStats(0, new double[4], new double[74], new double[4, 74], 0, new double[74], 0, new double[5], new double[74], new double[5, 74], 0);

            Reset();
        }
Example #3
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 #4
0
        public void AddItemsDroppedStats(ItemDropStats Last, ItemDropStats New)
        {
            ItemsDropped.Total += New.Total - Last.Total;
            ItemsDropped.TotalPotions += New.TotalPotions - Last.TotalPotions;
            ItemsDropped.TotalGems += New.TotalGems - Last.TotalGems;
            ItemsDropped.TotalInfernalKeys += New.TotalInfernalKeys - Last.TotalInfernalKeys;

            AddArray(ItemsDropped.TotalPerQuality, Last.TotalPerQuality, New.TotalPerQuality);
            AddArray(ItemsDropped.TotalPerLevel, Last.TotalPerLevel, New.TotalPerLevel);
            AddArray(ItemsDropped.TotalPerQPerL, Last.TotalPerQPerL, New.TotalPerQPerL);
            AddArray(ItemsDropped.PotionsPerLevel, Last.PotionsPerLevel, New.PotionsPerLevel);
            AddArray(ItemsDropped.GemsPerType, Last.GemsPerType, New.GemsPerType);
            AddArray(ItemsDropped.GemsPerLevel, Last.GemsPerLevel, New.GemsPerLevel);
            AddArray(ItemsDropped.GemsPerTPerL, Last.GemsPerTPerL, New.GemsPerTPerL);
        }
Example #5
0
        public void AddItemsDroppedStats(ItemDropStats Last, ItemDropStats New)
        {
            ItemsDropped.Total             += New.Total - Last.Total;
            ItemsDropped.TotalPotions      += New.TotalPotions - Last.TotalPotions;
            ItemsDropped.TotalGems         += New.TotalGems - Last.TotalGems;
            ItemsDropped.TotalInfernalKeys += New.TotalInfernalKeys - Last.TotalInfernalKeys;

            AddArray(ItemsDropped.TotalPerQuality, Last.TotalPerQuality, New.TotalPerQuality);
            AddArray(ItemsDropped.TotalPerLevel, Last.TotalPerLevel, New.TotalPerLevel);
            AddArray(ItemsDropped.TotalPerQPerL, Last.TotalPerQPerL, New.TotalPerQPerL);
            AddArray(ItemsDropped.PotionsPerLevel, Last.PotionsPerLevel, New.PotionsPerLevel);
            AddArray(ItemsDropped.GemsPerType, Last.GemsPerType, New.GemsPerType);
            AddArray(ItemsDropped.GemsPerLevel, Last.GemsPerLevel, New.GemsPerLevel);
            AddArray(ItemsDropped.GemsPerTPerL, Last.GemsPerTPerL, New.GemsPerTPerL);
        }
            static public void UpdateItemsPickedStats(
                ItemDropStats Last, ItemDropStats New)
            {
                Last.Total             = New.Total;
                Last.TotalPotions      = New.TotalPotions;
                Last.TotalGems         = New.TotalGems;
                Last.TotalInfernalKeys = New.TotalInfernalKeys;

                CopyArray(Last.TotalPerQuality, New.TotalPerQuality);
                CopyArray(Last.TotalPerLevel, New.TotalPerLevel);
                CopyArray(Last.TotalPerQPerL, New.TotalPerQPerL);
                CopyArray(Last.PotionsPerLevel, New.PotionsPerLevel);
                CopyArray(Last.GemsPerType, New.GemsPerType);
                CopyArray(Last.GemsPerLevel, New.GemsPerLevel);
                CopyArray(Last.GemsPerTPerL, New.GemsPerTPerL);
            }
Example #7
0
        static public void UpdateItemsPickedStats(
            ItemDropStats Last, ItemDropStats New)
        {
            Last.Total = New.Total;
            Last.TotalPotions = New.TotalPotions;
            Last.TotalGems = New.TotalGems;
            Last.TotalInfernalKeys = New.TotalInfernalKeys;

           CopyArray(Last.TotalPerQuality, New.TotalPerQuality);
           CopyArray(Last.TotalPerLevel, New.TotalPerLevel);
           CopyArray(Last.TotalPerQPerL, New.TotalPerQPerL);
           CopyArray(Last.PotionsPerLevel, New.PotionsPerLevel);
           CopyArray(Last.GemsPerType, New.GemsPerType);
           CopyArray(Last.GemsPerLevel, New.GemsPerLevel);
           CopyArray(Last.GemsPerTPerL, New.GemsPerTPerL);
        }
Example #8
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 #9
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);
        }