コード例 #1
0
        internal static void FinishBehavior()
        {
            //We don't want to close our inventory immeditaly after our last cast, so this prevents that by making it wait around 3-4s
                if (shouldUpdateTime)
                {
                     //Update time to wait before actual finish
                     waitTime=RandomWaitTime();
                     shouldUpdateTime=false;
                     lastCastTime=DateTime.Now;
                }

                //Wait..
                if (!finishPauseDone&&DateTime.Now.Subtract(lastCastTime).TotalMilliseconds>(waitTime*1.35))
                     finishPauseDone=true;
                else
                     return;

                Logging.WriteDiagnostic("[Funky] Finishing OOC ID Behavior");

                //reset vars
                RefreshDone=false;
                castAttempt=false;
                shouldUpdateTime=true;
                currentItem=null;
                totalFailures=0;
                castAttempts=0;
                shouldPreformOOCItemIDing=false;
                preWaitBeforeOpenInv=false;
                isFinishingBahavior=false;

                //close inv only if we are not wanting to town run!
                if (Bot.Character.BackPack.InventoryBackpackVisible()&&!Zeta.CommonBot.Logic.BrainBehavior.ShouldVendor)
                     Bot.Character.BackPack.InventoryBackPackToggle(false);
        }
コード例 #2
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
 public static StatType GetMainStatType(ACDItem item)
 {
     if (item.Stats.Strength > 0) return StatType.Strength;
     if (item.Stats.Intelligence > 0) return StatType.Intelligence;
     if (item.Stats.Dexterity > 0) return StatType.Dexterity;
     return StatType.Unknown;
 }
コード例 #3
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
 public static int GetMainStatValue(ACDItem item)
 {
     if (item.Stats.Strength > 0) return (int)item.Stats.Strength;
     if (item.Stats.Intelligence > 0) return (int)item.Stats.Intelligence;
     if (item.Stats.Dexterity > 0) return (int)item.Stats.Dexterity;
     return 0;
 }
コード例 #4
0
ファイル: ThiolesIdentify.cs プロジェクト: ipo/AGBA
 public bool HasToIdentify(ACDItem item)
 {
     //Important to get semi accurate data
     //item.ParseItemTable();
     if (item.InternalName.ToLower().Contains("bow")) return true;
     if (item.Name != "whatiwanttobeidentified") return false;
     /*Insert your logic for what items should be identified here*/
     return true;
 }
コード例 #5
0
ファイル: AdventurerGem.cs プロジェクト: mythsya/db-plugins
 public AdventurerGem(ACDItem gem, int griftLevel)
 {
     Guid = gem.ACDGuid;
     SNO = gem.ActorSNO;
     Rank = gem.JewelRank;
     Name = gem.Name;
     MaxRank = (Rank == 50 && (SNO == 428355 || SNO == 405796 || SNO == 405797 || SNO == 405803));
     IsEquiped = !MaxRank && gem.InventorySlot == InventorySlot.Socket;
     UpgradeChance = MaxRank ? 0 : CalculateUpgradeChance(griftLevel);
 }
コード例 #6
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
        public static double GetElementalDamage(ACDItem item, Element element)
        {
            switch (element)
            {
                case Element.Fire:
                    return item.Stats.FireSkillDamagePercentBonus;
                case Element.Cold:
                    return item.Stats.ColdSkillDamagePercentBonus;
                case Element.Lightning:
                    return item.Stats.LightningSkillDamagePercentBonus;
                case Element.Poison:
                    return item.Stats.PosionSkillDamagePercentBonus;
                case Element.Arcane:
                    return item.Stats.ArcaneSkillDamagePercentBonus;
                case Element.Holy:
                    return item.Stats.HolySkillDamagePercentBonus;
                case Element.Physical:
                    return item.Stats.PhysicalSkillDamagePercentBonus;
                case Element.Any:

                    var fire = GetElementalDamage(item, Element.Fire);
                    if (fire > 0)
                        return fire;

                    var cold = GetElementalDamage(item, Element.Cold);
                    if (cold > 0)
                        return cold;

                    var lightning = GetElementalDamage(item, Element.Lightning);
                    if (lightning > 0)
                        return lightning;

                    var arcane = GetElementalDamage(item, Element.Arcane);
                    if (arcane > 0)
                        return arcane;

                    var poison = GetElementalDamage(item, Element.Poison);
                    if (poison > 0)
                        return poison;

                    var holy = GetElementalDamage(item, Element.Holy);
                    if (holy > 0)
                        return holy;

                    var physical = GetElementalDamage(item, Element.Physical);
                    if (physical > 0)
                        return physical;

                    break;
            }
            return 0;
        }
コード例 #7
0
        internal static ItemData GetItemDataFromACD(ACDItem item)
        {
            if (!item.IsValid)
                return default(ItemData);
            ItemData itemData = new ItemData()
            {
                Locale = DiaCollector.Instance.Locale,
                ActorSNO = item.ActorSNO,
                DurabilityMax = item.DurabilityMax,
                FollowerSpecialType = item.FollowerSpecialType.ToString(),
                GameBalanceType = item.GameBalanceType.ToString(),
                GemQuality = (int)item.GemQuality,
                HitpointsGranted = item.HitpointsGranted,
                IdentifyCost = item.IdentifyCost,
                InternalName = GetCleanName(item.InternalName),
                IsArmor = item.IsArmor,
                IsCrafted = item.IsCrafted,
                IsCraftingPage = item.IsCraftingPage,
                IsCraftingReagent = item.IsCraftingReagent,
                IsEquipped = item.IsEquipped,
                IsGem = item.IsGem,
                IsMiscItem = item.IsMiscItem,
                IsOneHand = item.IsOneHand,
                IsPotion = item.IsPotion,
                IsRare = item.IsRare,
                IsTwoHand = item.IsTwoHand,
                IsTwoSquareItem = item.IsTwoSquareItem,
                IsUnidentified = item.IsUnidentified,
                IsUnique = item.IsUnique,
                IsValid = item.IsValid,
                IsVendorBought = item.IsVendorBought,
                ItemBaseType = item.ItemBaseType.ToString(),
                ItemLevelRequirementReduction = item.ItemLevelRequirementReduction,
                ItemLink = GetCleanItemLink(item.ItemLink),
                ItemQualityLevel = item.ItemQualityLevel.ToString(),
                ItemStackQuantity = item.ItemStackQuantity,
                ItemType = item.ItemType.ToString(),
                Level = item.Level,
                MaxDurability = item.MaxDurability,
                MaxStackCount = item.MaxStackCount,
                Name = item.Name,
                NumSockets = item.NumSockets,
                RequiredLevel = item.RequiredLevel,
                Stats = ItemStatsDataFactory.GetItemStatsDataFromStats(item.Stats)
            };

            itemData.ItemHash = itemData.GetMD5Hash();

            return itemData;
        }
コード例 #8
0
ファイル: SellOverlord.cs プロジェクト: herbfunk/Funky
        internal static RunStatus PostSell(object ret)
        {
            if (!Delay.Test()) return RunStatus.Running;

            FunkyTownRunPlugin.DBLog.DebugFormat("GSDebug: Sell routine ending sequence...");

            //if (bLoggedJunkThisStash)
            //{
            //	FileStream LogStream;
            //	try
            //	{
            //		string sLogFileName = FunkyTownRunPlugin.LoggingPrefixString + " -- JunkLog.log";
            //		LogStream = File.Open(FolderPaths.LoggingFolderPath + sLogFileName, FileMode.Append, FileAccess.Write, FileShare.Read);
            //		using (StreamWriter LogWriter = new StreamWriter(LogStream))
            //			LogWriter.WriteLine("");
            //		//LogStream.Close();
            //	}
            //	catch (IOException)
            //	{
            //		FunkyTownRunPlugin.DBLog.DebugFormat("Fatal Error: File access error for signing off the junk log file.");
            //	}
            //	bLoggedJunkThisStash = false;
            //}

            // See if we can close the inventory window
            if (UIElement.IsValidElement(0x368FF8C552241695))
            {
                try
                {
                    var el = UIElement.FromHash(0x368FF8C552241695);
                    if (el != null && el.IsValid && el.IsVisible && el.IsEnabled)
                        el.Click();
                }
                catch (Exception)
                {
                    // Do nothing if it fails, just catching to prevent any big errors/plugin crashes from this
                }
            }

            Delay.Reset();

            PotionDynamicID = 0;
            PotionMerchantACDItem = null;

            FunkyTownRunPlugin.DBLog.DebugFormat("GSDebug: Sell routine finished.");
            //Bot.Character.Data.lastPreformedNonCombatAction = DateTime.Now;
            return RunStatus.Success;
        }
コード例 #9
0
        private static void ItemDroppedLog(ACDItem item)
        {
            if (Bot.BotStatistics.ProfileStats.CurrentProfile==null)
                return;

            //No implementation for misc items yet!
                ItemBaseType thisType = item.ItemBaseType;
                if (thisType != ItemBaseType.Armor && thisType != ItemBaseType.Jewelry && thisType != ItemBaseType.Weapon)
                return;

            //Keep track of ILevel and Quality!
            int ItemLevel = item.Level;
            int Itemquality = 0;
            switch (item.ItemQualityLevel)
            {
                case ItemQuality.Inferior:
                case ItemQuality.Invalid:
                case ItemQuality.Normal:
                case ItemQuality.Superior:
                case ItemQuality.Special:
                    Itemquality = 0;
                    break;

                case ItemQuality.Magic1:
                case ItemQuality.Magic2:
                case ItemQuality.Magic3:
                    Itemquality = 1;
                    break;

                case ItemQuality.Rare4:
                case ItemQuality.Rare5:
                case ItemQuality.Rare6:
                    Itemquality = 2;
                    break;

                case ItemQuality.Legendary:
                    Itemquality = 3;
                    break;
            }

                if (!Bot.BotStatistics.ProfileStats.CurrentProfile.ItemStats.droppedItemTotals.ContainsKey(ItemLevel))
                     Bot.BotStatistics.ProfileStats.CurrentProfile.ItemStats.droppedItemTotals.Add(ItemLevel, new int[] { 0, 0, 0, 0 });

                Bot.BotStatistics.ProfileStats.CurrentProfile.ItemStats.droppedItemTotals[ItemLevel][Itemquality]++;
        }
コード例 #10
0
ファイル: TrackedItem.cs プロジェクト: herbfunk/ItemTracker
 public TrackedItem(ACDItem item)
 {
     Name = item.Name;
     InternalName = item.InternalName;
     SNO = item.ActorSNO;
     BalanceId = item.GameBalanceId;
     Gold = item.Gold;
     Level = item.Level;
     StackQuantity = item.ItemStackQuantity;
     FollowerType = item.FollowerSpecialType;
     Quality = item.ItemQualityLevel;
     OneHanded = item.IsOneHand;
     IsUnidentified = item.IsUnidentified;
     Type = item.ItemType;
     DyeType = item.DyeType;
     IsPotion = item.IsPotion;
     invRow = item.InventoryRow;
     invCol = item.InventoryColumn;
     IsVendorBought = item.IsVendorBought;
     InventorySlot = item.InventorySlot;
     IsArmor = item.IsArmor;
     IsCrafted = item.IsCrafted;
     IsCraftingPage = item.IsCraftingPage;
     IsCraftingReagent = item.IsCraftingReagent;
     IsElite = item.IsElite;
     IsEquipped = item.IsEquipped;
     IsGem = item.IsGem;
     IsMiscItem = item.IsMiscItem;
     IsRare = item.IsRare;
     IsTwoHand = item.IsTwoHand;
     IsTwoSquareItem = item.IsTwoSquareItem;
     IsUnique = item.IsUnique;
     RequiredLevel = item.RequiredLevel;
     ItemLevelRequirementReduction = item.ItemLevelRequirementReduction;
     MaxStackCount = item.MaxStackCount;
     MaxDurability = item.MaxDurability;
     NumSockets = item.NumSockets;
     GemQuality = item.GemQuality;
     BaseType = item.ItemBaseType;
     NumSocketsFilled = item.NumSocketsFilled;
     ItemStats thesestats = item.Stats;
     ItemStats = new ItemProperties(thesestats);
 }
コード例 #11
0
ファイル: PickupItem.cs プロジェクト: MGramolini/Trinity
 public PickupItem(ACDItem item, TrinityItemBaseType trinityItemBaseType, TrinityItemType trinityItemType)
 {
     Name = item.Name;
     InternalName = Trinity.NameNumberTrimRegex.Replace(item.InternalName, ""); ;
     Level = item.Level;
     Quality = item.ItemQualityLevel;
     BalanceID = item.GameBalanceId;
     DBBaseType = item.ItemBaseType;
     DBItemType = item.ItemType;
     TBaseType = trinityItemBaseType;
     TType = trinityItemType;
     IsOneHand = item.IsOneHand;
     IsTwoHand = item.IsTwoHand;
     ItemFollowerType = item.FollowerSpecialType;
     DynamicID = item.DynamicId;
     ActorSNO = item.ActorSNO;
     ACDGuid = item.ACDGuid;
     WorldId = Trinity.Player.WorldID;
 }
コード例 #12
0
ファイル: ItemDropper.cs プロジェクト: mythsya/db-plugins
        /// <summary>
        /// Drop item in town and record it so we can avoid picking it up again.
        /// </summary>
        public static bool Drop(ACDItem item)
        {
            if (!ZetaDia.IsInGame || !ZetaDia.IsInTown || item.IsAccountBound)
                return false;

            if (item.IsPotion || item.IsMiscItem || item.IsGem || item.IsCraftingReagent || item.IsCraftingPage)
                return false;

            Logger.Log("--> Dropping {0} ({1}) in town. DynamicId={2} ", item.Name, item.ActorSNO, item.DynamicId);

            if (item.Drop())
            {
                DroppedItems.Add(item.DynamicId);
                Thread.Sleep(250);
                return true;
            }

            return false;
        }
コード例 #13
0
ファイル: CacheACDItem.cs プロジェクト: NEVEROYATNII/Funky
 public CacheBPItem(int Acdguid, ACDItem acditem)
 {
     this.ACDGUID=Acdguid;
              this.Ref_ACDItem=acditem;
              this.StackCount=acditem.MaxStackCount;
 }
コード例 #14
0
 public static double SkillDamagePercent(ACDItem acdItem, SNOPower power)
 {
     return Math.Round(acdItem.GetAttribute<float>(((int)power << 12) + ((int)ActorAttributeType.PowerDamagePercentBonus & 0xFFF)) * 100, MidpointRounding.AwayFromZero);
 }
コード例 #15
0
 /// <summary>
 /// Gets the item stack quantity.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>System.Int32.</returns>
 public static int GetItemStackQuantity(this ACDItem item)
 {
     return((item.GetAttribute <int>(ActorAttributeType.ItemStackQuantityHi) << 32) | item.GetAttribute <int>(ActorAttributeType.ItemStackQuantityLo));
 }
コード例 #16
0
 public static bool GetIsMyDroppedItem(this ACDItem item)
 {
     return(TrinityTownRun.DroppedItemAnnIds.Contains(item.AnnId));
 }
コード例 #17
0
ファイル: AdventurerGems.cs プロジェクト: ysj1995/Trinity
        public ACDItem GetUpgradeTarget()
        {
            ZetaDia.Actors.Update();

            var minChance     = PluginSettings.Current.GreaterRiftGemUpgradeChance;
            var level         = ZetaDia.Me.InTieredLootRunLevel + 1;
            var priority      = PluginSettings.Current.GemUpgradePriority;
            var equipPriority = PluginSettings.Current.GreaterRiftPrioritizeEquipedGems;
            var chanceReq     = PluginSettings.Current.GreaterRiftGemUpgradeChance;

            UpdateGems(level);

            Core.Logger.Log($"[UpgradeGems] ---- Gem Upgrade Summary ----");
            Core.Logger.Log($"[UpgradeGems] Current Rift Level: {level}");
            Core.Logger.Log($"[UpgradeGems] Gem Count: {Gems.Count}");
            Core.Logger.Log($"[UpgradeGems] Highest Ranked Gem: {Gems.Max(g => g.Rank)}");
            Core.Logger.Log($"[UpgradeGems] Lowest Ranked Gem: {Gems.Min(g => g.Rank)}");
            Core.Logger.Log($"[UpgradeGems] Upgrade Chance Setting: {minChance}%");
            Core.Logger.Log($"[UpgradeGems] Ordering Priority: {priority}");
            Core.Logger.Log($"[UpgradeGems] Prioritize Equipped: {equipPriority}");

            var gems = Gems.ToList();

            Core.Logger.Log($"[UpgradeGems] ---- Excluded: User Disabled Type ----");

            foreach (var gem in gems.ToList())
            {
                if (!gem.Settings.IsEnabled)
                {
                    Core.Logger.Log($"[UpgradeGems] {gem.Name} ({gem.SNO}) Id={gem.Guid} Rank={gem.Rank}");
                    gems.Remove(gem);
                }
            }

            Core.Logger.Log($"[UpgradeGems] ---- Excluded: By Max Rank ----");

            foreach (var gem in gems.ToList())
            {
                if (gem.Rank >= gem.Settings.MaxRank)
                {
                    Core.Logger.Log($"[UpgradeGems] {gem.Name} ({gem.SNO}) Id={gem.Guid} Rank={gem.Rank} MaxRank={gem.Settings.MaxRank}");
                    gems.Remove(gem);
                }
            }

            Core.Logger.Log($"[UpgradeGems] ---- Excluded: User Rank Limit ----");

            foreach (var gem in gems.ToList())
            {
                if (gem.Settings.IsLimited && gem.Rank >= gem.Settings.Limit)
                {
                    Core.Logger.Log($"[UpgradeGems] {gem.Name} ({gem.SNO}) Id={gem.Guid} Rank={gem.Rank} Limit={(!gem.Settings.IsLimited ? "None" : gem.Settings.Limit.ToString())}");
                    gems.Remove(gem);
                }
            }

            Core.Logger.Log($"[UpgradeGems] ---- Excluded: Below Chance ({minChance}%) ----");

            foreach (var gem in gems.ToList())
            {
                if (gem.UpgradeChance < chanceReq)
                {
                    Core.Logger.Log($"[UpgradeGems] {gem.Name} ({gem.SNO}) Id={gem.Guid} Rank={gem.Rank} Chance={gem.UpgradeChance}");
                    gems.Remove(gem);
                }
            }

            switch (priority)
            {
            case GemPriority.None:
            case GemPriority.Rank:
                Core.Logger.Log($"[UpgradeGems] ---- 'Rank' Ordered Candidates ({gems.Count}), by {(equipPriority ? "Equipped, " : "")}Rank ----");
                gems = gems.OrderBy(g => equipPriority && g.IsEquiped ? 0 : 1).ThenByDescending(g => g.Rank).ThenBy(g => g.Settings.Order).ToList();
                break;

            case GemPriority.Order:
                Core.Logger.Log($"[UpgradeGems] ---- 'Order' Ordered Candidates ({gems.Count}), by {(equipPriority ? "Equipped, " : "")}Order ----");
                gems = gems.OrderBy(g => equipPriority && g.IsEquiped ? 0 : 1).ThenBy(g => g.Settings.Order).ToList();
                break;

            case GemPriority.Chance:
                Core.Logger.Log($"[UpgradeGems] ---- 'Chance' Ordered Candidates ({gems.Count}), by {(equipPriority ? "Equipped, " : "")}Chance, then Rank ----");
                gems = gems.OrderBy(g => equipPriority && g.IsEquiped ? 0 : 1).ThenByDescending(g => g.UpgradeChance).ThenByDescending(g => g.Rank).ToList();
                break;
            }

            //if (focus)
            //{
            //    Core.Logger.Log($"[UpgradeGems] ---- Ordered Candidates ({gems.Count}), by {(equipPriority ? "Equipped, " : "")}Order, Rank - Focus Mode ----");
            //    gems = gems.OrderBy(g => equipPriority && g.IsEquiped ? 0 : 1).ThenBy(g => g.Settings.Order).ToList();
            //}
            //else
            //{
            //    Core.Logger.Log($"[UpgradeGems] ---- Ordered Candidates ({gems.Count}), by {(equipPriority ? "Equipped, " : "")}Chance, Order, Rank ----");
            //    gems = gems.OrderBy(g => equipPriority && g.IsEquiped ? 0 : 1).ThenByDescending(g => g.UpgradeChance).ThenBy(g => g.Settings.Order).ThenBy(g => g.Rank).ToList();
            //}

            for (int i = 0; i < gems.Count; i++)
            {
                var gem = gems.ElementAtOrDefault(i);
                Core.Logger.Log($"[UpgradeGems] #{(i + 1)}: {gem.Name} ({gem.SNO}) Id={gem.Guid} Rank={gem.Rank} Chance={gem.UpgradeChance} @{level} Order={gem.Settings.Order} Limit={(gem.Settings.IsLimited ? "None" : gem.Settings.Limit.ToString())} Equipped={gem.IsEquiped}");
            }

            if (gems.Count == 0)
            {
                Core.Logger.Log("[UpgradeGems] Couldn't find any gems over the minimum upgrade chance, upgrading the gem with highest upgrade chance");
                gems = Gems.Where(g => !g.IsMaxRank).OrderByDescending(g => g.UpgradeChance).ToList();
            }

            ACDItem acdGem = null;

            var gemToUpgrade = gems.FirstOrDefault();

            if (gemToUpgrade != null)
            {
                Core.Logger.Log($"[UpgradeGems] ---- Selection ----");
                Core.Logger.Log($"[UpgradeGems] Attempting to upgrade {gemToUpgrade.DisplayName} ({gemToUpgrade.SNO}) Rank={gemToUpgrade.Rank} Chance={gemToUpgrade.UpgradeChance}%");
                acdGem = ZetaDia.Actors.GetActorsOfType <ACDItem>().FirstOrDefault(i => gemToUpgrade.Guid == i.AnnId);
            }

            if (acdGem == null)
            {
                acdGem = ZetaDia.Actors.GetActorsOfType <ACDItem>().FirstOrDefault(i => i.ItemType == ItemType.LegendaryGem);
                Core.Logger.Log($"[UpgradeGems] AcdItem Not Found {gemToUpgrade?.DisplayName} - Using {acdGem?.Name} so the quest can be completed");
            }

            return(acdGem);
        }
コード例 #18
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
 internal static double GetAreaDamage(ACDItem acdItem)
 {
     return Math.Round(Math.Max(acdItem.Stats.OnHitAreaDamageProcChance, acdItem.Stats.OnHitAreaDamageProcChance), MidpointRounding.AwayFromZero);
 }
コード例 #19
0
 /// <summary>
 /// Calculate Armor points
 /// </summary>
 /// <returns></returns>
 internal double Armor(ACDItem item)
 {
     return(item.Stats.Armor + item.Stats.ArmorBonus);
 }
コード例 #20
0
 /// <summary>
 /// Calculate CritDamagePercent
 /// </summary>
 /// <returns></returns>
 internal double CritDamagePercent(ACDItem item)
 {
     return(item.Stats.CritDamagePercent);
 }
コード例 #21
0
 /// <summary>
 /// Calculate Crit Chance Percent
 /// </summary>
 /// <returns></returns>
 internal double CritChancePercent(ACDItem item)
 {
     return(item.Stats.CritPercent);
 }
コード例 #22
0
 /// <summary>
 /// Calculate Base Damage Percent
 /// </summary>
 /// <returns></returns>
 internal double BaseDamagePercent(ACDItem item)
 {
     return(0);
 }
コード例 #23
0
 /// <summary>
 /// Check if the item is a weapon (to detect dual wield later on)
 /// </summary>
 /// <returns></returns>
 internal Boolean IsItemWeapon(ACDItem item)
 {
     // Code seems redundant, math is already done in GetBaseDPS()
     return(item.Stats.WeaponAttacksPerSecond > 0 ? true : false);
 }
コード例 #24
0
 /// <summary>
 /// Calculate Base Damage
 /// </summary>
 /// <returns></returns>
 internal double BaseDamage(ACDItem item)
 {
     // Code seems redundant, math is already done in GetBaseDPS()
     return((item.Stats.MinDamage + item.Stats.MaxDamage + item.Stats.WeaponMinDamage + item.Stats.WeaponMaxDamage) / 2);
 }
コード例 #25
0
 /// <summary>
 /// Calculate Additional DPS from generic Abilities
 /// </summary>
 /// <returns></returns>
 internal double AbilityMultiplier(ACDItem item)
 {
     throw new NotImplementedException();
 }
コード例 #26
0
 /// <summary>
 /// Calculate defencive effects of Strenght
 /// </summary>
 /// <returns></returns>
 internal double Vitality(ACDItem item)
 {
     return(item.Stats.Vitality);
 }
コード例 #27
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
 public static int GetMaxBaseDamage(ACDItem item)
 {
     var max = Math.Max(item.Stats.MinDamageElemental, item.Stats.MaxDamageElemental);
     return (max != 0) ? (int)max : (int)item.WeaponBaseMaxPhysicalDamage();
 }
コード例 #28
0
 /// <summary>
 /// Calculate Resist All
 /// </summary>
 /// <returns></returns>
 internal double ResistAll(ACDItem item)
 {
     return(item.Stats.ResistAll);
 }
コード例 #29
0
 /// <summary>
 /// Calculate defencive effects of Strenght
 /// </summary>
 /// <returns></returns>
 internal double Strength(ACDItem item)
 {
     return(item.Stats.Strength);
 }
コード例 #30
0
 /// <summary>
 /// Calculate Life Perecent
 /// </summary>
 /// <returns></returns>
 internal double LifePercent(ACDItem item)
 {
     return(item.Stats.LifePercent);
 }
コード例 #31
0
 public static bool GetIsGold(this ACDItem item)
 {
     return(item.GetRawItemType() == RawItemType.Gold);
 }
コード例 #32
0
        public CacheACDItem(ACDItem item)
        {
            ACDItem          = item;
            SNO              = item.ActorSNO;
            ThisInternalName = item.InternalName;

            try
            {
                _thisLevel = item.Level;
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items, "Failed to retrieve item level for {0} \r\n {1}", SimpleDebugString, ex.Message);
            }


            ItemDataEntry itemEntry;

            if (TheCache.ObjectIDCache.ItemDataEntries.TryGetValue(SNO, out itemEntry))
            {
                ItemType          = itemEntry.ItemType;
                ThisDBItemType    = ItemFunc.PluginItemTypeToDBItemType(ItemType);
                ThisFollowerType  = ItemFunc.ReturnFollowerType(ItemType);
                LegendaryItemType = itemEntry.LegendaryType;
            }
            else
            {
                ThisFollowerType = item.FollowerSpecialType;
                ThisDBItemType   = item.ItemType;
                ItemType         = ItemFunc.DetermineItemType(ThisInternalName, ThisDBItemType, ThisFollowerType);
            }

            BaseItemType    = ItemFunc.DetermineBaseType(ItemType);
            IsStackableItem = ItemFunc.DetermineIsStackable(ItemType, SNO);
            IsTwoSlot       = !IsStackableItem && ItemFunc.DetermineIsTwoSlot(ItemType);

            //Armor / Jewelery / Weapons / Offhand / Follower Items
            if (BaseItemType == PluginBaseItemTypes.Armor || BaseItemType == PluginBaseItemTypes.Jewelry || BaseItemType == PluginBaseItemTypes.Offhand || BaseItemType == PluginBaseItemTypes.WeaponOneHand || BaseItemType == PluginBaseItemTypes.WeaponRange || BaseItemType == PluginBaseItemTypes.WeaponTwoHand || BaseItemType == PluginBaseItemTypes.FollowerItem)
            {
                if (BaseItemType == PluginBaseItemTypes.WeaponOneHand)
                {
                    ThisOneHanded = true;
                }
                else if (BaseItemType == PluginBaseItemTypes.WeaponTwoHand)
                {
                    TwoHanded = true;
                }


                try
                {
                    ItemStats thesestats = item.Stats;
                    ItemStatString     = thesestats.ToString();
                    ItemStatProperties = new ItemProperties(thesestats);
                }
                catch (Exception ex)
                {
                    Logger.Write(LogLevel.Items, "Failed to retrieve item stats {0} \r\n {1}", SimpleDebugString, ex.Message);
                }


                #region Durability
                try
                {
                    //Durability
                    DurabilityCurrent = item.CurrentDurability;
                    DurabilityMax     = item.MaxDurability;
                    DurabilityPercent = item.DurabilityPercent;
                }
                catch (Exception ex)
                {
                    Logger.Write(LogLevel.Items, "Failed to retrieve item durability {0} \r\n {1}", SimpleDebugString, ex.Message);
                }
                #endregion

                #region ItemQualityLevel
                try
                {
                    _thisQuality = item.ItemQualityLevel;
                }
                catch (Exception ex)
                {
                    Logger.Write(LogLevel.Items, "Failed to retrieve item quality {0} \r\n {1}", SimpleDebugString, ex.Message);
                }
                #endregion
            }
            else
            {            //Gem, Misc
                if (ItemType == PluginItemTypes.KeyStone)
                {
                    KeystoneRank = ItemFunc.GetGreaterRiftKeystoneRank(SNO);

                    if (KeystoneRank == -1)
                    {
                        try
                        {
                            KeystoneRank = item.TieredLootRunKeyLevel;
                        }
                        catch (Exception ex)
                        {
                            Logger.DBLog.DebugFormat("Failed to get TieredLootRunKeyLevel for Keystone!{0} \r\n {1}", SimpleDebugString, ex.Message);
                        }
                    }
                }
                else if (BaseItemType == PluginBaseItemTypes.Gem && ItemType == PluginItemTypes.LegendaryGem)
                {
                    try
                    {
                        LegendaryGemRank = item.JewelRank;
                    }
                    catch (Exception ex)
                    {
                        Logger.DBLog.DebugFormat("Failed to get Jewel Rank for Legendary Gem!{0} \r\n {1}", SimpleDebugString, ex.Message);
                    }

                    try
                    {
                        LegendaryGemType = (LegendaryGemTypes)Enum.Parse(typeof(LegendaryGemTypes), SNO.ToString());
                    }
                    catch (Exception)
                    {
                        LegendaryGemType = LegendaryGemTypes.None;
                    }
                }
                else
                {
                    IsPotion = ItemType == PluginItemTypes.HealthPotion || ItemType == PluginItemTypes.LegendaryHealthPotion;
                    if (IsPotion)
                    {
                        PotionType = ItemFunc.ReturnPotionType(SNO);
                    }
                }

                #region DyeType
                try
                {
                    _thisDyeType = item.DyeType;
                }
                catch (Exception ex)
                {
                    Logger.Write(LogLevel.Items, "Failed to retrieve item dye type {0} \r\n {1}", SimpleDebugString, ex.Message);
                }
                #endregion

                if (IsStackableItem)
                {
                    #region ItemStackQuantity
                    try
                    {
                        _thisItemStackQuantity = item.ItemStackQuantity;
                    }
                    catch (Exception ex)
                    {
                        Logger.Write(LogLevel.Items, "Failed to retrieve item stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message);
                    }
                    #endregion

                    #region ItemStackMaxQuantity
                    try
                    {
                        _maxstackquanity = item.MaxStackCount;
                    }
                    catch (Exception ex)
                    {
                        Logger.Write(LogLevel.Items, "Failed to retrieve item max stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message);
                    }
                    #endregion
                }
            }


            #region GameBalanceId
            try
            {
                ThisBalanceID = item.GameBalanceId;
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items, "Failed to retrieve item GameBalanceId {0} \r\n {1}", SimpleDebugString, ex.Message);
            }
            #endregion

            #region ACDGuid
            try
            {
                ACDGUID = item.ACDGuid;
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items, "Failed to retrieve item ACDGUID {0} \r\n {1}", SimpleDebugString, ex.Message);
            }
            #endregion

            #region DynamicId
            try
            {
                ThisDynamicID = item.DynamicId;
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items, "Failed to retrieve item DynamicId {0} \r\n {1}", SimpleDebugString, ex.Message);
            }

            #endregion

            #region Name
            try
            {
                _thisRealName = item.Name;
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items, "Failed to retrieve item name {0} \r\n {1}", SimpleDebugString, ex.Message);
            }
            #endregion

            #region Gold
            try
            {
                _thisGoldAmount = item.Gold;
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items, "Failed to retrieve item gold amount {0} \r\n {1}", SimpleDebugString, ex.Message);
            }
            #endregion


            if (!IsStackableItem)
            {
                #region IsUnidentified
                try
                {
                    _isUnidentified = item.IsUnidentified;
                }
                catch (Exception ex)
                {
                    Logger.Write(LogLevel.Items, "Failed to retrieve item is identified {0} \r\n {1}", SimpleDebugString, ex.Message);
                }
                #endregion
            }

            #region IsVendorBought
            try
            {
                _isVendorBought = item.IsVendorBought;
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items, "Failed to retrieve item is vendor bought {0} \r\n {1}", SimpleDebugString, ex.Message);
            }
            #endregion

            #region InventoryRow/Column
            try
            {
                invRow = item.InventoryRow;
                invCol = item.InventoryColumn;
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items, "Failed to retrieve item inventory row/column {0} \r\n {1}", SimpleDebugString, ex.Message);
            }
            #endregion


            if (itemEntry == null && !_isUnidentified && ItemType != PluginItemTypes.Unknown && _thisRealName != String.Empty)
            {
                if (FunkyBaseExtension.Settings.Debugging.DebuggingData && FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Items))
                {
                    ObjectCache.DebuggingData.CheckEntry(this);
                }
            }
        }
コード例 #33
0
 /// <summary>
 /// Calculate defencive effects of Strenght
 /// </summary>
 /// <returns></returns>
 internal double Dexterity(ACDItem item)
 {
     return(item.Stats.Dexterity);
 }
コード例 #34
0
 public void SendItemDrop(ACDItem item)
 {
     plugin.LogMessage("Add to send cache");
     sendCache.Add(item);
 }
コード例 #35
0
ファイル: TrinityItem.cs プロジェクト: galou12345/Trinity
 private bool IsAcdItemValid(ACDItem acdItem) => acdItem != null && acdItem.IsValid && !acdItem.IsDisposed;
コード例 #36
0
ファイル: ItemHandling.cs プロジェクト: MGramolini/Trinity
        internal static bool ItemRulesIdentifyValidation(ACDItem item)
        {
            ItemEvents.ResetTownRun();
            PickupItem pickupItem = new PickupItem(
                                       item.Name,
                                       item.InternalName,
                                       item.Level,
                                       item.ItemQualityLevel,
                                       item.GameBalanceId,
                                       item.ItemBaseType,
                                       item.ItemType,
                                       item.IsOneHand,
                                       item.IsTwoHand,
                                       item.FollowerSpecialType,
                                       item.ACDGuid,
                                       item.DynamicId);

            Logger.Log(TrinityLogLevel.Info, LogCategory.ItemValuation,
                "Incoming Identification Request: {0}, {1}, {2}, {3}, {4}",
                pickupItem.Quality, pickupItem.Level, pickupItem.DBBaseType,
                pickupItem.DBItemType, pickupItem.IsOneHand ? "1H" : pickupItem.IsTwoHand ? "2H" : "NH");

            if (Trinity.StashRule != null)
            {

                // using ItemEvaluationType.Identify isn't available so we are abusing Sell for that manner
                Interpreter.InterpreterAction action = Trinity.StashRule.checkPickUpItem(pickupItem, ItemEvaluationType.Sell);

                Logger.Log(TrinityLogLevel.Debug, LogCategory.ItemValuation, "Action is: {0}", action);

                switch (action)
                {
                    case Interpreter.InterpreterAction.IDENTIFY:
                        return true;
                    case Interpreter.InterpreterAction.UNIDENT:
                        return false;
                    default:
                        Logger.Log(TrinityLogLevel.Info, LogCategory.ScriptRule, "Trinity, item is unhandled by ItemRules (Identification)!");
                        return IdentifyItemValidation(pickupItem);
                }
            }
            else
                return IdentifyItemValidation(pickupItem);

        }
コード例 #37
0
        public static ItemSelectionType GetItemSelectionType(this ACDItem item)
        {
            ItemSelectionType result;

            return(Enum.TryParse(item.GetTrinityItemType().ToString(), out result) ? result : ItemSelectionType.Unknown);
        }
コード例 #38
0
        /// <summary>
        /// Items the link color quality.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>ItemQuality.</returns>
        public static ItemQuality GetItemQuality(this ACDItem item)
        {
            if (item == null)
            {
                return(ItemQuality.Invalid);
            }
            if (!item.IsValid)
            {
                return(ItemQuality.Invalid);
            }

            /*
             * {c:ff00ff00} = Set
             * {c:ffff8000} = Legendary
             * {c:ffffff00} = Rare
             * {c:ff6969ff} = Magic
             */

            string itemLink = item.ItemLink;

            string linkColor = _itemQualityRegex.Match(itemLink).Value;

            ItemQuality qualityResult;

            switch (linkColor)
            {
            case "{c:ff00ff00}":     // Green
                qualityResult = ItemQuality.Legendary;
                break;

            case "{c:ffff8000}":     // Orange
                qualityResult = ItemQuality.Legendary;
                break;

            case "{c:ffffff00}":     // Yellow
                qualityResult = ItemQuality.Rare4;
                break;

            case "{c:ff6969ff}":     // Magic Blue
                qualityResult = ItemQuality.Magic1;
                break;

            case "{c:ffffffff}":     // White
                qualityResult = ItemQuality.Normal;
                break;

            // got this off a "lore book" - not sure what it actually equates to
            case "{c:ff99bbff}":     // Gem Blue
                qualityResult = ItemQuality.Normal;
                break;

            case "{c:ffc236ff}":     // Purple
                qualityResult = ItemQuality.Special;
                break;

            case "{c:ff888888}":     // Gray
                qualityResult = ItemQuality.Inferior;
                break;

            case "{c:ff6cd8bb}":     // Unique
                qualityResult = ItemQuality.Rare4;
                break;

            case "":
                qualityResult = item.ItemQualityLevel;
                break;

            default:
                Core.Logger.Log("Invalid Item Link color={0} internalName={1} name={2} gameBalanceId={3}", linkColor, item.InternalName, item.Name, item.GameBalanceId);
                qualityResult = item.ItemQualityLevel;
                break;
            }

            return(qualityResult);
        }
コード例 #39
0
ファイル: CacheACDItem.cs プロジェクト: NEVEROYATNII/Funky
        public CacheACDItem(string internalname, string realname, int level, ItemQuality quality, int goldamount, int balanceid, int dynamicid, float dps,
					 bool onehanded, DyeType dyetype, ItemType dbitemtype, FollowerType dbfollowertype, bool unidentified, int stackquantity, ItemStats thesestats, ACDItem item, int row, int col, bool ispotion, int acdguid)
        {
            ThisInternalName=internalname;
                     ThisRealName=realname;
                     ThisLevel=level;
                     ThisQuality=quality;
                     ThisGoldAmount=goldamount;
                     ThisBalanceID=balanceid;
                     ThisDynamicID=dynamicid;

                     ThisOneHanded=onehanded;
                     ThisDyeType=dyetype;
                     ThisDBItemType=dbitemtype;
                     ThisFollowerType=dbfollowertype;
                     IsUnidentified=unidentified;
                     ThisItemStackQuantity=stackquantity;

                     SpiritRegen=thesestats.SpiritRegen;
                     ExperienceBonus=thesestats.ExperienceBonus;
                     Dexterity=thesestats.Dexterity;
                     Intelligence=thesestats.Intelligence;
                     Strength=thesestats.Strength;
                     Vitality=thesestats.Vitality;
                     LifePercent=thesestats.LifePercent;
                     LifeOnHit=thesestats.LifeOnHit;
                     LifeSteal=thesestats.LifeSteal;
                     HealthPerSecond=thesestats.HealthPerSecond;
                     MagicFind=thesestats.MagicFind;
                     GoldFind=thesestats.GoldFind;
                     MovementSpeed=thesestats.MovementSpeed;
                     PickUpRadius=thesestats.PickUpRadius;
                     Sockets=thesestats.Sockets;
                     CritPercent=thesestats.CritPercent;
                     CritDamagePercent=thesestats.CritDamagePercent;
                     AttackSpeedPercent=thesestats.AttackSpeedPercent;
                     MinDamage=thesestats.MinDamage;
                     MaxDamage=thesestats.MaxDamage;
                     BlockChance=thesestats.BlockChance;
                     Thorns=thesestats.Thorns;
                     ResistAll=thesestats.ResistAll;
                     ResistArcane=thesestats.ResistArcane;
                     ResistCold=thesestats.ResistCold;
                     ResistFire=thesestats.ResistFire;
                     ResistHoly=thesestats.ResistHoly;
                     ResistLightning=thesestats.ResistLightning;
                     ResistPhysical=thesestats.ResistPhysical;
                     ResistPoison=thesestats.ResistPoison;
                     WeaponDamagePerSecond=thesestats.WeaponDamagePerSecond;
                     ArmorBonus=thesestats.ArmorBonus;
                     MaxDiscipline=thesestats.MaxDiscipline;
                     MaxMana=thesestats.MaxMana;
                     ArcaneOnCrit=thesestats.ArcaneOnCrit;
                     ManaRegen=thesestats.ManaRegen;
                     GlobeBonus=thesestats.HealthGlobeBonus;

                     ACDItem=item;
                     invRow=row;
                     invCol=col;
                     IsPotion=ispotion;
                     ACDGUID=acdguid;
        }
コード例 #40
0
ファイル: SessionLogger.cs プロジェクト: honorbuddy/Trinity
        public void RecordItemStats(ItemStats stats, ACDItem item)
        {
            if (!IsRunning)
            {
                return;
            }

            stats.Total++;

            if (item.Stats.IsAncient)
            {
                stats.Ancients++;
            }

            if (GameData.PetTable.Contains(item.GameBalanceId) || GameData.PetSnoIds.Contains(item.ActorSnoId))
            {
                stats.Pets++;
            }

            if (GameData.TransmogTable.Contains(item.GameBalanceId))
            {
                stats.Transmog++;
            }

            if (Core.Settings.Items.SpecialItems.HasFlag(SpecialItemTypes.Wings) && GameData.WingsTable.Contains(item.GameBalanceId) || GameData.CosmeticSnoIds.Contains(item.ActorSnoId))
            {
                stats.Wings++;
            }

            if (item.GetTrinityItemType() == TrinityItemType.HealthPotion)
            {
                stats.Potions++;
            }

            if (item.GetTrinityItemType() == TrinityItemType.UberReagent)
            {
                stats.Ubers++;
            }

            if (item.GetTrinityItemType() == TrinityItemType.ConsumableAddSockets)
            {
                stats.Gifts++;
            }

            if (item.IsCraftingReagent)
            {
                stats.Crafting++;
                stats.CraftingStackQuantity += item.ItemStackQuantity;
            }

            if (item.GetIsEquipment())
            {
                stats.Equipment++;

                switch (item.GetTrinityItemQuality())
                {
                case TrinityItemQuality.Set:
                    stats.Sets++;
                    break;

                case TrinityItemQuality.Legendary:
                    stats.Legendaries++;
                    break;

                case TrinityItemQuality.Rare:
                    stats.Rares++;
                    break;

                case TrinityItemQuality.Magic:
                    stats.Magics++;
                    break;

                case TrinityItemQuality.Inferior:
                case TrinityItemQuality.Common:
                    stats.Normals++;
                    break;
                }
            }
        }
コード例 #41
0
ファイル: CacheACDItem.cs プロジェクト: NEVEROYATNII/Funky
        public CacheACDItem(ACDItem item)
        {
            ACDItem=item;

                     ACDGUID=item.ACDGuid;
                     ThisBalanceID=item.GameBalanceId;
                     ThisDynamicID=item.DynamicId;
                     ThisInternalName=item.InternalName;
                     ThisRealName=item.Name;
                     ThisGoldAmount=item.Gold;
                     ThisLevel=item.Level;
                     ThisItemStackQuantity=item.ItemStackQuantity;
                     ThisFollowerType=item.FollowerSpecialType;
                     ThisQuality=item.ItemQualityLevel;
                     ThisOneHanded=item.IsOneHand;
                     IsUnidentified=item.IsUnidentified;
                     ThisDBItemType=item.ItemType;
                     ThisDyeType=item.DyeType;
                     IsPotion=item.IsPotion;
                     invRow=item.InventoryRow;
                     invCol=item.InventoryColumn;

                     ItemStats thesestats=item.Stats;
                     ItemStatString=thesestats.ToString();
                     ArmorBonus=thesestats.ArmorBonus;
                     ArcaneOnCrit=thesestats.ArcaneOnCrit;
                     AttackSpeedPercent=thesestats.AttackSpeedPercent;
                     BlockChance=thesestats.BlockChance;
                     CritPercent=thesestats.CritPercent;
                     CritDamagePercent=thesestats.CritDamagePercent;
                     Dexterity=thesestats.Dexterity;
                     ExperienceBonus=thesestats.ExperienceBonus;
                     Intelligence=thesestats.Intelligence;

                     LifePercent=thesestats.LifePercent;
                     LifeOnHit=thesestats.LifeOnHit;
                     LifeSteal=thesestats.LifeSteal;
                     HealthPerSecond=thesestats.HealthPerSecond;
                     MagicFind=thesestats.MagicFind;
                     GoldFind=thesestats.GoldFind;
                     GlobeBonus=thesestats.HealthGlobeBonus;
                     MovementSpeed=thesestats.MovementSpeed;
                     PickUpRadius=thesestats.PickUpRadius;

                     ResistAll=thesestats.ResistAll;
                     ResistArcane=thesestats.ResistArcane;
                     ResistCold=thesestats.ResistCold;
                     ResistFire=thesestats.ResistFire;
                     ResistHoly=thesestats.ResistHoly;
                     ResistLightning=thesestats.ResistLightning;
                     ResistPhysical=thesestats.ResistPhysical;
                     ResistPoison=thesestats.ResistPoison;

                     MinDamage=thesestats.MinDamage;
                     MaxDamage=thesestats.MaxDamage;
                     MaxDiscipline=thesestats.MaxDiscipline;
                     MaxMana=thesestats.MaxMana;
                     ManaRegen=thesestats.ManaRegen;

                     Thorns=thesestats.Thorns;

                     Sockets=thesestats.Sockets;
                     SpiritRegen=thesestats.SpiritRegen;
                     Strength=thesestats.Strength;
                     Vitality=thesestats.Vitality;
                     WeaponDamagePerSecond=thesestats.WeaponDamagePerSecond;
        }
コード例 #42
0
 /// <summary>
 /// Calculate defencive effects of Strenght
 /// </summary>
 /// <returns></returns>
 internal double Intelligence(ACDItem item)
 {
     return(item.Stats.Intelligence);
 }
コード例 #43
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
        public static double GetElementalResist(ACDItem item, Element element)
        {
            switch (element)
            {
                case Element.Fire:
                    return item.Stats.ResistFire;
                case Element.Cold:
                    return item.Stats.ResistCold;
                case Element.Lightning:
                    return item.Stats.ResistLightning;
                case Element.Poison:
                    return item.Stats.ResistPoison;
                case Element.Arcane:
                    return item.Stats.ResistArcane;
                case Element.Holy:
                    return item.Stats.ResistHoly;
                case Element.Physical:
                    return item.Stats.ResistPhysical;
                case Element.Any:

                    var fire = GetElementalResist(item, Element.Fire);
                    if (fire > 0)
                        return fire;

                    var cold = GetElementalResist(item, Element.Cold);
                    if (cold > 0)
                        return cold;

                    var lightning = GetElementalResist(item, Element.Lightning);
                    if (lightning > 0)
                        return lightning;

                    var arcane = GetElementalResist(item, Element.Arcane);
                    if (arcane > 0)
                        return arcane;

                    var poison = GetElementalResist(item, Element.Poison);
                    if (poison > 0)
                        return poison;

                    var holy = GetElementalResist(item, Element.Holy);
                    if (holy > 0)
                        return holy;

                    var physical = GetElementalResist(item, Element.Physical);
                    if (physical > 0)
                        return physical;

                    break;
            }
            return 0;
        }
コード例 #44
0
        internal static void ComputeItemProperty(CacheItem item)
        {
            try
            {
                ACDItem acd = item.ACDItem;
                int     standardRequiredLevel = (acd.Stats.Level > 60) ? 60 : acd.Stats.Level - 1;
                item.LevelReduction = standardRequiredLevel - acd.Stats.RequiredLevel;

                item.Vitality                       = (int)Math.Floor(acd.Stats.Vitality);
                item.Strength                       = (int)Math.Floor(acd.Stats.Strength);
                item.Intelligence                   = (int)Math.Floor(acd.Stats.Intelligence);
                item.Dexterity                      = (int)Math.Floor(acd.Stats.Dexterity);
                item.ArcaneOnCrit                   = (int)Math.Floor(acd.Stats.ArcaneOnCrit);
                item.Armor                          = (int)Math.Floor(acd.Stats.Armor);
                item.ArmorBonus                     = (int)Math.Floor(acd.Stats.ArmorBonus);
                item.ArmorTotal                     = (int)Math.Floor(acd.Stats.ArmorTotal);
                item.AttackSpeedPercent             = acd.Stats.AttackSpeedPercent;
                item.BlockChance                    = (int)Math.Floor(acd.Stats.BlockChance);
                item.CritDamagePercent              = (int)Math.Floor(acd.Stats.CritDamagePercent);
                item.CritPercent                    = acd.Stats.CritPercent;
                item.DamageReductionPhysicalPercent = (int)Math.Floor(acd.Stats.DamageReductionPhysicalPercent);
                item.GoldFind                       = (int)Math.Floor(acd.Stats.GoldFind);
                item.HatredRegen                    = (int)Math.Floor(acd.Stats.HatredRegen);
                item.HealthGlobeBonus               = (int)Math.Floor(acd.Stats.HealthGlobeBonus);
                item.HealthPerSecond                = (int)Math.Floor(acd.Stats.HealthPerSecond);
                item.HealthPerSpiritSpent           = (int)Math.Floor(acd.Stats.HealthPerSpiritSpent);
                item.LifeOnHit                      = (int)Math.Floor(acd.Stats.LifeOnHit);
                item.LifePercent                    = (int)Math.Floor(acd.Stats.LifePercent);
                item.LifeSteal                      = (int)Math.Floor(acd.Stats.LifeSteal);
                item.MagicFind                      = (int)Math.Floor(acd.Stats.MagicFind);
                item.ManaRegen                      = (int)Math.Floor(acd.Stats.ManaRegen);
                item.MaxArcanePower                 = (int)Math.Floor(acd.Stats.MaxArcanePower);
                item.MaxDamage                      = (int)Math.Floor(acd.Stats.MaxDamage);
                item.MaxDiscipline                  = (int)Math.Floor(acd.Stats.MaxDiscipline);
                item.MaxFury                        = (int)Math.Floor(acd.Stats.MaxFury);
                item.MaxMana                        = (int)Math.Floor(acd.Stats.MaxMana);
                item.MaxSpirit                      = (int)Math.Floor(acd.Stats.MaxSpirit);
                item.MinDamage                      = (int)Math.Floor(acd.Stats.MinDamage);
                item.MovementSpeed                  = (int)Math.Floor(acd.Stats.MovementSpeed);
                item.PickUpRadius                   = (int)Math.Floor(acd.Stats.PickUpRadius);
                item.ResistAll                      = (int)Math.Floor(acd.Stats.ResistAll);
                item.ResistArcane                   = (int)Math.Floor(acd.Stats.ResistArcane);
                item.ResistCold                     = (int)Math.Floor(acd.Stats.ResistCold);
                item.ResistFire                     = (int)Math.Floor(acd.Stats.ResistFire);
                item.ResistHoly                     = (int)Math.Floor(acd.Stats.ResistHoly);
                item.ResistLightning                = (int)Math.Floor(acd.Stats.ResistLightning);
                item.ResistPhysical                 = (int)Math.Floor(acd.Stats.ResistPhysical);
                item.ResistPoison                   = (int)Math.Floor(acd.Stats.ResistPoison);
                item.SpiritRegen                    = (int)Math.Floor(acd.Stats.SpiritRegen);
                item.Thorns                         = (int)Math.Floor(acd.Stats.Thorns);
                item.WeaponAttacksPerSecond         = (int)Math.Floor(acd.Stats.WeaponAttacksPerSecond);
                item.WeaponDamagePerSecond          = (int)Math.Floor(acd.Stats.WeaponDamagePerSecond);
                item.WeaponDamageType               = acd.Stats.WeaponDamageType;
                item.WeaponMaxDamage                = (int)Math.Floor(acd.Stats.WeaponMaxDamage);
                item.WeaponMinDamage                = (int)Math.Floor(acd.Stats.WeaponMinDamage);

                item.LifeSteal = acd.Stats.LifeSteal;

                item.Sockets             = acd.Stats.Sockets;
                item.FollowerSpecialType = acd.FollowerSpecialType;
                item.Gold              = acd.Gold;
                item.IdentifyCost      = acd.IdentifyCost;
                item.InventoryColumn   = acd.InventoryColumn;
                item.InventoryRow      = acd.InventoryRow;
                item.IsTwoHand         = acd.IsTwoHand;
                item.IsTwoSquareItem   = acd.IsTwoSquareItem;
                item.IsUnidentified    = acd.IsUnidentified;
                item.ItemStackQuantity = acd.ItemStackQuantity;
                item.MaxStackCount     = acd.MaxStackCount;
                item.Name              = acd.Name;
                item.Position          = acd.Position;
                item.Level             = acd.Stats.Level;
                item.Distance          = acd.Position.Distance(GilesTrinity.PlayerStatus.CurrentPosition);

                if (item.Gold > 0)
                {
                    item.ShouldPickup = ShouldPickupGold(item.Gold, item.Distance);
                }
                else
                {
                    item.ShouldPickup = ShouldPickupItem(item);
                }
            }
            catch { }
        }
コード例 #45
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
        public static int GetSkillDamagePercent(ACDItem item)
        {
            if (!SkillDamageByItemTypeAndClass.Any())
                return 0;

            var statType = GetMainStatType(item);
            var actorClasses = new List<ActorClass>();
            var itemType = TrinityItemManager.DetermineItemType(item);

            switch (statType)
            {
                case StatType.Dexterity:
                    actorClasses.Add(ActorClass.Monk);
                    actorClasses.Add(ActorClass.DemonHunter);
                    break;

                case StatType.Intelligence:
                    actorClasses.Add(ActorClass.Witchdoctor);
                    actorClasses.Add(ActorClass.Wizard);
                    break;

                case StatType.Strength:
                    actorClasses.Add(ActorClass.Crusader);
                    actorClasses.Add(ActorClass.Barbarian);
                    break;
            }

            if (!actorClasses.Any())
                return 0;

            foreach (var actorClass in actorClasses)
            {
                var kvp = new KeyValuePair<TrinityItemType, ActorClass>(itemType, actorClass);

                foreach (var skill in SkillDamageByItemTypeAndClass[kvp])
                {
                    var skillDamageIncrease = item.GetSkillDamageIncrease(skill.SNOPower);
                    if (skillDamageIncrease > 0)
                    {
                        Logger.Log(string.Format("SkillDamage +{0}% {1}", skillDamageIncrease, skill.Name));
                        return (int)skillDamageIncrease;
                    }                        
                }
            }

            return 0;
        }
コード例 #46
0
ファイル: Interpreter.cs プロジェクト: MGramolini/Trinity
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        internal InterpreterAction checkItem(ACDItem item, ItemEvaluationType evaluationType)
        {
            try
            {
                fillDic(item);

                return checkItem(evaluationType);
            }
            catch (Exception ex)
            {
                Logger.Log("Exception in checkItem: {0} item: {1}/{2} eval type: {3}", ex, item.Name, item.InternalName, evaluationType);
                switch (evaluationType)
                {
                    case ItemEvaluationType.Keep:
                        return InterpreterAction.KEEP;
                    case ItemEvaluationType.PickUp:
                        return InterpreterAction.PICKUP;
                    case ItemEvaluationType.Salvage:
                        return InterpreterAction.KEEP;
                    case ItemEvaluationType.Sell:
                        return InterpreterAction.KEEP;
                    default:
                        return InterpreterAction.NULL;
                }
            }
        }
コード例 #47
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
 public static int GetMinBaseDamage(ACDItem item)
 {
     var min = Math.Min(item.Stats.MinDamageElemental, item.Stats.MaxDamageElemental);
     return (min != 0) ? (int)min : (int)item.WeaponBaseMinPhysicalDamage();
 }
コード例 #48
0
ファイル: Interpreter.cs プロジェクト: MGramolini/Trinity
        private string inSet(ACDItem item)
        {
            if (isSet(item))
            {
                var set = Legendary.ToList().Where(x => x.Id == item.ActorSNO).FirstOrDefault();

                if (set != null)
                    return set.SetName;
            }

            return "NO SET FOUND";
        }
コード例 #49
0
ファイル: ItemDataUtils.cs プロジェクト: mythsya/db-plugins
 internal static double GetAttackSpeed(ACDItem acdItem)
 {
     return Math.Round(Math.Max(acdItem.Stats.AttackSpeedPercent, acdItem.Stats.AttackSpeedPercentBonus), MidpointRounding.AwayFromZero);
 }
コード例 #50
0
ファイル: ItemSort.cs プロジェクト: MGramolini/Trinity
 private static int GetNumberOfStacks(ACDItem item, InventorySlot inventorySlot)
 {
     List<ACDItem> items;
     switch (inventorySlot)
     {
         case InventorySlot.BackpackItems:
             items = ZetaDia.Me.Inventory.Backpack.Where(i => i.IsValid && i.ActorSNO == item.ActorSNO && i.ItemType == item.ItemType).ToList();
             break;
         case InventorySlot.SharedStash:
             items = ZetaDia.Me.Inventory.StashItems.Where(i => i.IsValid && i.ActorSNO == item.ActorSNO && i.ItemType == item.ItemType).ToList();
             break;
         default: 
             return 0;
     }
     return items.Count();
 }
コード例 #51
0
        public CachedACDItem(
            ACDItem acdItem,
            string internalName,
            string realName,
            int level,
            ItemQuality quality,
            int goldAmount,
            int balanceId,
            int dynamicId,
            float dps,
            bool oneHanded,
            bool twoHanded,
            DyeType dyeType,
            ItemType itemType,
            Zeta.Game.Internals.Actors.ItemBaseType itembasetype,
            FollowerType followerType,
            bool unidentified,
            int stackQuantity,
            ItemStats itemStats)
        {
            AcdItem           = acdItem;
            InternalName      = internalName;
            RealName          = realName;
            Level             = level;
            Quality           = quality;
            GoldAmount        = goldAmount;
            BalanceID         = balanceId;
            DynamicID         = dynamicId;
            WeaponDPS         = dps;
            OneHanded         = oneHanded;
            TwoHanded         = twoHanded;
            DyeType           = dyeType;
            DBItemType        = itemType;
            DBBaseType        = itembasetype;
            FollowerType      = followerType;
            IsUnidentified    = unidentified;
            ItemStackQuantity = stackQuantity;

            Dexterity                      = itemStats.Dexterity;
            Intelligence                   = itemStats.Intelligence;
            Strength                       = itemStats.Strength;
            Vitality                       = itemStats.Vitality;
            LifePercent                    = itemStats.LifePercent;
            LifeOnHit                      = itemStats.LifeOnHit;
            LifeSteal                      = itemStats.LifeSteal;
            HealthPerSecond                = itemStats.HealthPerSecond;
            MagicFind                      = itemStats.MagicFind;
            GoldFind                       = itemStats.GoldFind;
            MovementSpeed                  = itemStats.MovementSpeed;
            PickUpRadius                   = itemStats.PickUpRadius;
            Sockets                        = itemStats.Sockets;
            CritPercent                    = itemStats.CritPercent;
            CritDamagePercent              = itemStats.CritDamagePercent;
            AttackSpeedPercent             = itemStats.AttackSpeedPercent;
            MinDamage                      = itemStats.MinDamage;
            MaxDamage                      = itemStats.MaxDamage;
            BlockChance                    = itemStats.BlockChance;
            Thorns                         = itemStats.Thorns;
            ResistAll                      = itemStats.ResistAll;
            ResistArcane                   = itemStats.ResistArcane;
            ResistCold                     = itemStats.ResistCold;
            ResistFire                     = itemStats.ResistFire;
            ResistHoly                     = itemStats.ResistHoly;
            ResistLightning                = itemStats.ResistLightning;
            ResistPhysical                 = itemStats.ResistPhysical;
            ResistPoison                   = itemStats.ResistPoison;
            WeaponDamagePerSecond          = itemStats.WeaponDamagePerSecond;
            ArmorBonus                     = itemStats.ArmorBonus;
            MaxDiscipline                  = itemStats.MaxDiscipline;
            MaxMana                        = itemStats.MaxMana;
            ArcaneOnCrit                   = itemStats.ArcaneOnCrit;
            ManaRegen                      = itemStats.ManaRegen;
            GlobeBonus                     = itemStats.HealthGlobeBonus;
            HatredRegen                    = itemStats.HatredRegen;
            MaxFury                        = itemStats.MaxFury;
            SpiritRegen                    = itemStats.SpiritRegen;
            MaxSpirit                      = itemStats.MaxSpirit;
            HealthPerSpiritSpent           = itemStats.HealthPerSpiritSpent;
            MaxArcanePower                 = itemStats.MaxArcanePower;
            DamageReductionPhysicalPercent = itemStats.DamageReductionPhysicalPercent;
            ArmorTotal                     = itemStats.ArmorTotal;
            Armor = itemStats.Armor;
            //FireDamagePercent = itemStats.FireDamagePercent;
            //LightningDamagePercent = itemStats.LightningDamagePercent;
            //ColdDamagePercent = itemStats.ColdDamagePercent;
            //PoisonDamagePercent = itemStats.PoisonDamagePercent;
            //ArcaneDamagePercent = itemStats.ArcaneDamagePercent;
            //HolyDamagePercent = itemStats.HolyDamagePercent;
            HealthGlobeBonus       = itemStats.HealthGlobeBonus;
            WeaponAttacksPerSecond = itemStats.WeaponAttacksPerSecond;
            WeaponMaxDamage        = itemStats.WeaponMaxDamage;
            WeaponMinDamage        = itemStats.WeaponMinDamage;

            TrinityItemType     = Trinity.DetermineItemType(internalName, itemType, followerType);
            TrinityItemBaseType = Trinity.DetermineBaseType(TrinityItemType);

            ComputeUpgrade();
        }
コード例 #52
0
 /// <summary>
 /// Calculate itemID from equipped weapons, for legendary handling
 /// </summary>
 /// <returns></returns>
 internal double ItemID(ACDItem item)
 {
     return(item.GameBalanceId);
 }
コード例 #53
0
ファイル: Interpreter.cs プロジェクト: MGramolini/Trinity
 private void checkItemForMissingTranslation(ACDItem item)
 {
     string balanceIDstr;
     if (!nameToBalanceId.TryGetValue(item.Name.Replace(" ", ""), out balanceIDstr) && !nameToBalanceId.ContainsValue(item.GameBalanceId.ToString()))
     {
         Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "Translation: Missing: " + item.GameBalanceId.ToString() + ";" + item.Name + " (ID is missing report)");
         // not found missing name
         StreamWriter transFix = new StreamWriter(Path.Combine(FileManager.LoggingPath, tranLogFile), true);
         transFix.WriteLine("Missing: " + item.GameBalanceId.ToString() + ";" + item.Name);
         transFix.Close();
     }
     else if (balanceIDstr != item.GameBalanceId.ToString())
     {
         Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "Translation: Wrong(" + balanceIDstr + "): " + item.GameBalanceId.ToString() + ";" + item.Name);
         // wrong reference
         StreamWriter transFix = new StreamWriter(Path.Combine(FileManager.LoggingPath, tranLogFile), true);
         transFix.WriteLine("Wrong(" + balanceIDstr + "): " + item.GameBalanceId.ToString() + ";" + item.Name);
         transFix.Close();
     }
 }
コード例 #54
0
ファイル: CheckPotions.cs プロジェクト: shmilyzxt/MyBuddy
        private bool CheckPotions()
        {
            Diagnostic("[**POTION**] CheckPotions method has been fired");

            // Verify VendorWindow is available.. Incase user manually runs away or the pause isn't working for some reason...
            if (!Zeta.Internals.UIElements.VendorWindow.IsVisible)
            {
                Diagnostic("[**POTION**] UIElement VendorWindow can not be found. Exiting CheckPotion Method...");
                return(false);
            }

            int _iPotionsBuy    = 0;
            int _iPotionsNeeded = 0;

            // Merchant Potions
            Potion merchantitem;
            var    merchantItems = ZetaDia.Actors.Me.Inventory.MerchantItems.Where(i => i.IsPotion);

            if (merchantItems == null)
            {
                Log("[**POTION**] Memory read error or Vendor has no potions.");
                _lastBuy = DateTime.Now;
                return(false);
            }
            else
            {
                merchantList = new List <Potion>();
                foreach (ACDItem item in merchantItems)
                {
                    Diagnostic(String.Format("[**POTION**] Merchant potion found... Name: {0}, ActorSNO: {1}, GUID: {2}, DynamicId: {3}, IsPotion: {4}, maxStackCount: {5}, RequiredLevel: {6}",
                                             item.Name, item.ActorSNO, item.ACDGuid, item.DynamicId, item.IsPotion, item.MaxStackCount, item.RequiredLevel));
                    Potion P = potionList.Where(p => p.Name == item.Name).FirstOrDefault();
                    merchantList.Add(new Potion(item.ActorSNO, item.DynamicId, item.Name, P.HitpointsGranted, P.RequiredLevel, P.Gold));
                }
                merchantitem = merchantList.Where(i => i.RequiredLevel <= ZetaDia.Me.Level).OrderByDescending(p => p.HitpointsGranted).FirstOrDefault();
            }


            Diagnostic("[**POTION**] Strongest Potion that can be purchased from merchant is '" + merchantitem.Name + "'");

            // Pack Potions
            ACDItem thisPackPotion;

            try { thisPackPotion = ZetaDia.Me.Inventory.Backpack.Where(i => (i.IsPotion) && (i.RequiredLevel <= ZetaDia.Me.Level)).OrderByDescending(p => p.HitpointsGranted).ThenByDescending(p => p.ItemStackQuantity).FirstOrDefault(); }
            catch (Exception e) { Diagnostic("[**POTION**] Exception occured trying to read potions from pack. Exception: " + e.ToString()); thisPackPotion = null; }
            if (thisPackPotion == null)
            {
                Log("[**POTION**] Memory read error or you do not have any potions in your backpack. Assuming the 2nd...");
                Log("[**POTION**] Buying a single potion from merchant to initialize BuyPotion logic.");
                ZetaDia.Actors.Me.Inventory.BuyItem(merchantitem.DynamicId);
                DateTime _lastCheck = DateTime.Now;

                int _numChecks = 0;
                while (true)
                {
                    if (_numChecks >= 10)
                    {
                        Log("[**POTION**] Its been ~10 seconds since we tried purchasing a potion and it still is not reading from our backpack.");
                        break;
                    }
                    if (DateTime.Now.Subtract(_lastCheck).TotalSeconds > 1)
                    {
                        try {
                            ACDItem tempACDItem = ZetaDia.Me.Inventory.Backpack.Where(i => (i.IsPotion) && (i.RequiredLevel <= ZetaDia.Me.Level)).OrderByDescending(p => p.ItemStackQuantity).FirstOrDefault();
                            if (tempACDItem == null)
                            {
                                Diagnostic("[**POTION**] Memory read error or Still can't see the potion in our backpack... **Sigh**");
                            }
                            else
                            {
                                Diagnostic("[**POTION**] Backpack finally updated. We can now move forward with buying potions.");
                                thisPackPotion = tempACDItem;
                                break;
                            }
                        }
                        catch (Exception e) {
                            Diagnostic("[**POTION**] An exception occured trying to initialize BuyPotion logic. Exception: " + e.ToString());
                        }
                        ZetaDia.Actors.Update();
                        _lastCheck = DateTime.Now;
                        _numChecks++;
                    }
                }
                if (_numChecks >= 10)
                {
                    Log(String.Format("[**POTION**] An error occured trying to purchase potion '{0}'", merchantitem.Name));
                    return(false);
                }
            }
            int totalPackPotions = ZetaDia.Me.Inventory.Backpack.Where(i => (i.IsPotion) && (i.HitpointsGranted == thisPackPotion.HitpointsGranted)).Sum(p => p.ItemStackQuantity);

            Diagnostic(String.Format("[**POTION**] Backpack potion found... Name: {0}, ActorSNO: {1}, GUID: {2}, DynamicId: {3}, IsPotion: {4}, maxStackCount: {5}, RequiredLevel: {6}",
                                     thisPackPotion.Name, thisPackPotion.ActorSNO, thisPackPotion.ACDGuid, thisPackPotion.DynamicId, thisPackPotion.IsPotion, thisPackPotion.MaxStackCount, thisPackPotion.RequiredLevel));
            Diagnostic(String.Format("[**POTION**] MerchantPotion: '{0}', BackPackPotion: {1} ({2})", merchantitem.Name, thisPackPotion.Name, totalPackPotions));

            switch (merchantitem.Level)
            {
            case 1:                      // 1-5, Minor Health Potion
                _iPotionsBuy = (int)iQtyPotion1; break;

            case 6:                     // 6-10, Lesser Health Potion
                _iPotionsBuy = (int)iQtyPotion2; break;

            case 11:                     // 11-15, Health Potion
                _iPotionsBuy = (int)iQtyPotion3; break;

            case 16:                     // 16-20, Greater Health Potion
                _iPotionsBuy = (int)iQtyPotion4; break;

            case 21:                     // 21-25, Major Health Potion
                _iPotionsBuy = (int)iQtyPotion5; break;

            case 26:                     // 26-36, Super Health Potion
                _iPotionsBuy = (int)iQtyPotion6; break;

            case 37:                     // 37-46, Heroic Health Potion
                _iPotionsBuy = (int)iQtyPotion7; break;

            case 47:                     // 47-52, Resplendent Health Potion
                _iPotionsBuy = (int)iQtyPotion8; break;

            case 53:                     // 53-57, Runic Health Potion
                _iPotionsBuy = (int)iQtyPotion9; break;

            case 58:                     // 58-60, Mythic Health Potion
                _iPotionsBuy = (int)iQtyPotion10; break;

            default:                     // O_o Memory Read Error, Item became Invalid, or Blizz added new potions and I need to add support for them....
                Diagnostic(String.Format("Unknown Item Encountered: Name: {0}, ActorSNO: {1}, DynamicId: {2}, RequiredLevel: {3}",
                                         merchantitem.Name, merchantitem.ActorSNO, merchantitem.DynamicId, merchantitem.RequiredLevel));
                break;
            }
            Diagnostic(String.Format("[**POTION**] Vendor Price for {0} is {1}g", merchantitem.Name, merchantitem.Gold));

            // TODO: Need to verify all conditions under which we may want or need potions and ensure each condition is covered.
            if (_iPotionsBuy > 0 && (potionList.Where(p => p.Name == merchantitem.Name).FirstOrDefault()).Level == (potionList.Where(p => p.Name == thisPackPotion.Name).FirstOrDefault()).Level)
            {
                _iPotionsNeeded = (_iPotionsBuy - totalPackPotions);

                // No Potions are needed
                if (_iPotionsNeeded == 0)
                {
                    Diagnostic(String.Format("[**POTION**] No more potions are needed. BackPackPotion: {0} ({1}), MerchantPotion: {2} ({3})", thisPackPotion.Name, totalPackPotions, merchantitem.Name, _iPotionsBuy));
                    _lastBuy = DateTime.Now;
                    return(false);
                }
            }
            else if ((potionList.Where(p => p.Name == merchantitem.Name).FirstOrDefault()).Level > (potionList.Where(p => p.Name == thisPackPotion.Name).FirstOrDefault()).Level || merchantitem.HitpointsGranted >= (ZetaDia.Actors.Me.HitpointsMax * .25))
            {
                Diagnostic("[**POTION**] Either a new and improved potion is now available or something is better than nothing");
                Diagnostic(String.Format("[**POTION**] MerchantPotion:  Name: {0}, Level: {1}, HitpointsGranted: {2}", merchantitem.Name, merchantitem.RequiredLevel, merchantitem.HitpointsGranted));
                _iPotionsNeeded = _iPotionsBuy;
            }
            else
            {
                Diagnostic("[**POTION**] O_o What condition actually lead the method this far along.... ");
                Diagnostic(String.Format("[**POTION**] MerchantPotion=  Name: {0}, RequiredLevel: {1}, Needed: {2} / BackPackPotion= Name: {3}, RequiredLevel: {4}, Qty: {5}", merchantitem.Name, merchantitem.RequiredLevel, _iPotionsNeeded, thisPackPotion.Name, thisPackPotion.RequiredLevel, totalPackPotions));
                _lastBuy = DateTime.Now;
                return(false);
            }

            for (int count = 1; count <= _iPotionsNeeded; count++)
            {
                // If we run away while purchasing potions this can cause DB/D3 to crash and burn....
                if (!Zeta.Internals.UIElements.VendorWindow.IsVisible)
                {
                    Log("[**POTION**] UIElement VendorWindow is not open, breaking BuyPotion routine...");
                    break;
                }
                // Check Coinage
                if (ZetaDia.Me.Inventory.Coinage <= merchantitem.Gold)
                {
                    Log(String.Format("[**POTION**] {0}'s cost {1}, Your current coinage reads {2}. You Know Your Broke When... You have to save up to be poor.", merchantitem.Name, merchantitem.Gold, ZetaDia.Me.Inventory.Coinage));
                    break;
                }
                if (DateTime.Now.Subtract(_lastBuy).TotalMilliseconds > getRandNumber(200, 400))
                {
                    Log(String.Format("[**POTION**] Buying '{0}' ({1}/{2})", merchantitem.Name, count.ToString(), _iPotionsNeeded.ToString()));
                    ZetaDia.Actors.Me.Inventory.BuyItem(merchantitem.DynamicId);
                    _lastBuy = DateTime.Now;
                }
                else
                {
                    // We dont want to count this loop
                    count--;
                }
            }
            return(false);
        }
コード例 #55
0
ファイル: Interpreter.cs プロジェクト: MGramolini/Trinity
        private bool isSet(ACDItem item)
        {
            if (item == null)
                return false;
            if (!item.IsValid)
                return false;

            /*
            {c:ff00ff00} = Set
            {c:ffff8000} = Legendary
            {c:ffffff00} = Rare
            {c:ff6969ff} = Magic
             */

            string itemLink = item.ItemLink;

            string linkColor = ItemQualityRegex.Match(itemLink).Value;

            string itemLinkLog = itemLink.Replace("{", "{{").Replace("}", "}}");

            switch (linkColor)
            {
                case "{c:ff00ff00}": // Green
                    return true;
                default:
                    return false;
            }
        }
コード例 #56
0
 public Item(ACDItem acdItem)
 {
     Id       = acdItem.ActorSnoId;
     Name     = acdItem.Name;
     ItemType = acdItem.ItemType;
 }
コード例 #57
0
ファイル: Interpreter.cs プロジェクト: MGramolini/Trinity
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        private void fillDic(ACDItem item)
        {
            object result;
            itemDic = new Dictionary<string, object>();

            // return if no item available
            if (item == null)
            {
                logOut("received an item with a null reference!", InterpreterAction.NULL, LogType.ERROR);
                return;
            }

            // check for missing translations
            if (Trinity.Settings.Loot.ItemRules.Debug && item.ItemQualityLevel == ItemQuality.Legendary)
                checkItemForMissingTranslation(item);

            // add log unique key
            itemDic.Add("[KEY]", item.DynamicId.ToString());

            // - BASETYPE ---------------------------------------------------------//
            itemDic.Add("[BASETYPE]", item.ItemBaseType.ToString());

            // - TYPE -------------------------------------------------------------//
            /// TODO remove this check if it isnt necessary anymore
            if (item.ItemType == ItemType.Unknown && item.Name.Contains("Plan"))
            {
                Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "There are still buggy itemType infos for craftingPlan around {0} has itemType = {1}", item.Name, item.ItemType);
                result = ItemType.CraftingPlan.ToString();
            }
            else result = item.ItemType.ToString();
            itemDic.Add("[TYPE]", result);

            // - QUALITY -------------------------------------------------------//
            //itemDic.Add("[QUALITY]", Regex.Replace(item.ItemQualityLevel.ToString(), @"[\d-]", string.Empty));
            itemDic.Add("[QUALITY]", Regex.Replace(item.ItemLinkColorQuality().ToString(), @"[\d-]", string.Empty));
            itemDic.Add("[D3QUALITY]", item.ItemQualityLevel.ToString());
            itemDic.Add("[SET]", isSet(item));
            itemDic.Add("[SETNAME]", inSet(item).Replace(" ", "")); //remove spaces to appease the parser Gods <== For use in Macros
            itemDic.Add("[SETFULLNAME]", inSet(item));

            // - ROLL ----------------------------------------------------------//
            float roll;
            if (float.TryParse(Regex.Replace(item.ItemQualityLevel.ToString(), @"[^\d]", string.Empty), out roll))
                itemDic.Add("[ROLL]", roll);
            else
                itemDic.Add("[ROLL]", 0f);

            // - NAME -------------------------------------------------------------//
            itemDic.Add("[NAME]", item.Name.ToString().Replace(" ", ""));

            // - LEVEL ------------------------------------------------------------//
            itemDic.Add("[LEVEL]", (float)item.Level);
            itemDic.Add("[ONEHAND]", item.IsOneHand);
            itemDic.Add("[TWOHAND]", item.IsTwoHand);
            itemDic.Add("[UNIDENT]", item.IsUnidentified);
            itemDic.Add("[INTNAME]", item.InternalName);
            itemDic.Add("[ITEMID]", item.GameBalanceId.ToString());
            itemDic.Add("[SNO]", item.ActorSNO);

            // if there are no stats return
            //if (item.Stats == null) return;

            itemDic.Add("[STR]", item.Stats.Strength);
            itemDic.Add("[DEX]", item.Stats.Dexterity);
            itemDic.Add("[INT]", item.Stats.Intelligence);
            itemDic.Add("[VIT]", item.Stats.Vitality);
            itemDic.Add("[AS%]", item.Stats.AttackSpeedPercent > 0 ? item.Stats.AttackSpeedPercent : item.Stats.AttackSpeedPercentBonus);
            itemDic.Add("[MS%]", item.Stats.MovementSpeed);
            itemDic.Add("[LIFE%]", item.Stats.LifePercent);
            itemDic.Add("[LS%]", item.Stats.LifeSteal);
            itemDic.Add("[LOH]", item.Stats.LifeOnHit);
            itemDic.Add("[LOK]", item.Stats.LifeOnKill);
            itemDic.Add("[REGEN]", item.Stats.HealthPerSecond);
            itemDic.Add("[GLOBEBONUS]", item.Stats.HealthGlobeBonus);
            itemDic.Add("[DPS]", item.Stats.WeaponDamagePerSecond);
            itemDic.Add("[WEAPAS]", item.Stats.WeaponAttacksPerSecond);
            itemDic.Add("[WEAPDMGTYPE]", item.Stats.WeaponDamageType.ToString());
            itemDic.Add("[WEAPMAXDMG]", item.Stats.WeaponMaxDamage);
            itemDic.Add("[WEAPMINDMG]", item.Stats.WeaponMinDamage);
            itemDic.Add("[CRIT%]", item.Stats.CritPercent);
            itemDic.Add("[CRITDMG%]", item.Stats.CritDamagePercent);
            itemDic.Add("[BLOCK%]", item.Stats.BlockChanceBonus);
            itemDic.Add("[MINDMG]", item.Stats.MinDamage);
            itemDic.Add("[MAXDMG]", item.Stats.MaxDamage);
            itemDic.Add("[ALLRES]", item.Stats.ResistAll);
            itemDic.Add("[RESPHYSICAL]", item.Stats.ResistPhysical);
            itemDic.Add("[RESFIRE]", item.Stats.ResistFire);
            itemDic.Add("[RESLIGHTNING]", item.Stats.ResistLightning);
            itemDic.Add("[RESHOLY]", item.Stats.ResistHoly);
            itemDic.Add("[RESARCANE]", item.Stats.ResistArcane);
            itemDic.Add("[RESCOLD]", item.Stats.ResistCold);
            itemDic.Add("[RESPOISON]", item.Stats.ResistPoison);
            itemDic.Add("[ARMOR]", item.Stats.Armor);
            itemDic.Add("[ARMORBONUS]", item.Stats.ArmorBonus);
            itemDic.Add("[ARMORTOT]", item.Stats.ArmorTotal);
            itemDic.Add("[GF%]", item.Stats.GoldFind);
            itemDic.Add("[MF%]", item.Stats.MagicFind);
            itemDic.Add("[PICKRAD]", item.Stats.PickUpRadius);
            itemDic.Add("[SOCKETS]", (float)item.Stats.Sockets);
            itemDic.Add("[THORNS]", item.Stats.Thorns);
            itemDic.Add("[DMGREDPHYSICAL]", item.Stats.DamageReductionPhysicalPercent);
            itemDic.Add("[MAXARCPOWER]", item.Stats.MaxArcanePower);
            itemDic.Add("[HEALTHSPIRIT]", item.Stats.HealthPerSpiritSpent);
            itemDic.Add("[MAXSPIRIT]", item.Stats.MaxSpirit);
            itemDic.Add("[SPIRITREG]", item.Stats.SpiritRegen);
            itemDic.Add("[ARCONCRIT]", item.Stats.ArcaneOnCrit);
            itemDic.Add("[MAXFURY]", item.Stats.MaxFury);
            itemDic.Add("[MAXDISCIP]", item.Stats.MaxDiscipline);
            itemDic.Add("[HATREDREG]", item.Stats.HatredRegen);
            itemDic.Add("[MAXMANA]", item.Stats.MaxMana);
            itemDic.Add("[MANAREG]", item.Stats.ManaRegen);

            itemDic.Add("[ANCIENT]", (float)item.AncientRank);

            // - ROS & MORE STATS ADDED -------------------------------------------//
            // This include Splash Damage, Cooldown Reduction, Resource Cost
            // Reduction, +% damage to Physical damage skills, and specific Class
            // Skill Bonuses
            itemDic.Add("[SLOWPROC%]", item.Stats.WeaponOnHitSlowProcChance);
            itemDic.Add("[BLINDPROC%]", item.Stats.WeaponOnHitBlindProcChance);
            itemDic.Add("[CHILLPROC%]", item.Stats.WeaponOnHitChillProcChance);
            itemDic.Add("[FEARPROC%]", item.Stats.WeaponOnHitFearProcChance);
            itemDic.Add("[FREEZEPROC%]", item.Stats.WeaponOnHitFreezeProcChance);
            itemDic.Add("[IMMOPROC%]", item.Stats.WeaponOnHitImmobilizeProcChance);
            itemDic.Add("[KNOCKPROC%]", item.Stats.WeaponOnHitKnockbackProcChance);
            itemDic.Add("[BLEEDPROC%]", item.Stats.WeaponOnHitBleedProcChance);

            itemDic.Add("[AREADMGPROC%]", item.Stats.OnHitAreaDamageProcChance);

            itemDic.Add("[CDRED%]", item.Stats.PowerCooldownReductionPercent);
            itemDic.Add("[RESRED%]", item.Stats.ResourceCostReductionPercent);

            itemDic.Add("[FIREDMG%]", item.Stats.FireSkillDamagePercentBonus);
            itemDic.Add("[LIGHTNINGDMG%]", item.Stats.LightningSkillDamagePercentBonus);
            itemDic.Add("[COLDDMG%]", item.Stats.ColdSkillDamagePercentBonus);
            itemDic.Add("[POISONDMG%]", item.Stats.PosionSkillDamagePercentBonus);
            itemDic.Add("[ARCANEDMG%]", item.Stats.ArcaneSkillDamagePercentBonus);
            itemDic.Add("[HOLYDMG%]", item.Stats.HolySkillDamagePercentBonus);

            itemDic.Add("[PHYSDMG%]", item.Stats.PhysicalSkillDamagePercentBonus);

            itemDic.Add("[ELEMDMG%]", new float[] { item.Stats.FireSkillDamagePercentBonus,
                                                    item.Stats.LightningSkillDamagePercentBonus,
                                                    item.Stats.ColdSkillDamagePercentBonus,
                                                    item.Stats.PosionSkillDamagePercentBonus,
                                                    item.Stats.ArcaneSkillDamagePercentBonus,
                                                    item.Stats.HolySkillDamagePercentBonus,
                                                    item.Stats.PhysicalSkillDamagePercentBonus }.Max());

            itemDic.Add("[SKILLDMG%]", ItemDataUtils.GetSkillDamagePercent(item));

            float damage, healing, toughness;
            item.GetStatChanges(out damage, out healing, out toughness);
            itemDic.Add("[UPDMG]", damage);
            itemDic.Add("[UPHEAL]", healing);
            itemDic.Add("[UPTOUGH]", toughness);

            // - NEW STATS ADDED --------------------------------------------------//
            itemDic.Add("[LEVELRED]", (float)item.Stats.ItemLevelRequirementReduction);
            itemDic.Add("[TOTBLOCK%]", item.Stats.BlockChance);
            itemDic.Add("[DMGVSELITE%]", item.Stats.DamagePercentBonusVsElites);
            itemDic.Add("[DMGREDELITE%]", item.Stats.DamagePercentReductionFromElites);
            itemDic.Add("[EXPBONUS]", item.Stats.ExperienceBonus);
            itemDic.Add("[REQLEVEL]", (float)item.Stats.RequiredLevel);
            itemDic.Add("[WEAPDMG%]", item.Stats.WeaponDamagePercent);

            itemDic.Add("[MAXSTAT]", new float[] { item.Stats.Strength, item.Stats.Intelligence, item.Stats.Dexterity }.Max());
            itemDic.Add("[MAXSTATVIT]", new float[] { item.Stats.Strength, item.Stats.Intelligence, item.Stats.Dexterity }.Max() + item.Stats.Vitality);
            itemDic.Add("[STRVIT]", item.Stats.Strength + item.Stats.Vitality);
            itemDic.Add("[DEXVIT]", item.Stats.Dexterity + item.Stats.Vitality);
            itemDic.Add("[INTVIT]", item.Stats.Intelligence + item.Stats.Vitality);
            itemDic.Add("[MAXONERES]", new float[] { item.Stats.ResistArcane, item.Stats.ResistCold, item.Stats.ResistFire, item.Stats.ResistHoly, item.Stats.ResistLightning, item.Stats.ResistPhysical, item.Stats.ResistPoison }.Max());
            itemDic.Add("[TOTRES]", item.Stats.ResistArcane + item.Stats.ResistCold + item.Stats.ResistFire + item.Stats.ResistHoly + item.Stats.ResistLightning + item.Stats.ResistPhysical + item.Stats.ResistPoison + item.Stats.ResistAll);
            itemDic.Add("[DMGFACTOR]", item.Stats.AttackSpeedPercent + item.Stats.CritPercent * 2 + item.Stats.CritDamagePercent / 5 + (item.Stats.MinDamage + item.Stats.MaxDamage) / 20);
            itemDic.Add("[AVGDMG]", (item.Stats.MinDamage + item.Stats.MaxDamage) / 2);

            float offstats = 0;
            //if (new float[] { item.Stats.Strength, item.Stats.Intelligence, item.Stats.Dexterity }.Max() > 0)
            //    offstats += 1;
            if (item.Stats.CritPercent > 0)
                offstats += 1;
            if (item.Stats.CritDamagePercent > 0)
                offstats += 1;
            if (item.Stats.AttackSpeedPercent > 0)
                offstats += 1;
            if (item.Stats.MinDamage + item.Stats.MaxDamage > 0)
                offstats += 1;
            itemDic.Add("[OFFSTATS]", offstats);

            float defstats = 0;
            //if (item.Stats.Vitality > 0)
            defstats += 1;
            if (item.Stats.ResistAll > 0)
                defstats += 1;
            if (item.Stats.ArmorBonus > 0)
                defstats += 1;
            if (item.Stats.BlockChance > 0)
                defstats += 1;
            if (item.Stats.LifePercent > 0)
                defstats += 1;
            //if (item.Stats.HealthPerSecond > 0)
            //    defstats += 1;
            itemDic.Add("[DEFSTATS]", defstats);
            itemDic.Add("[WEIGHTS]", WeightSet.CurrentWeightSet.EvaluateItem(item));

            //itemDic.Add("[GAMEBALANCEID]", (float)item.GameBalanceId);
            //itemDic.Add("[DYNAMICID]", item.DynamicId);

            // starting on macro implementation here
            foreach (string key in macroDic.Keys)
            {
                ParseErrors parseErrors = null;
                string expr = macroDic[key];
                try
                {
                    object exprValue = evaluateExpr(expr, out parseErrors);
                    itemDic.Add("[" + key + "]", exprValue);
                }
                catch (Exception e)
                {
                    logOut(e.Message
                        + SEP + "last use rule: " + expr
                        + SEP + getParseErrors(parseErrors)
                        + SEP + getFullItem()
                        + SEP + e.ToString()
                        , InterpreterAction.NULL, LogType.ERROR);
                }
            }

            // end macro implementation
        }
コード例 #58
0
 public static bool GetIsEquipment(this ACDItem item)
 {
     return(TypeConversions.GetIsEquipment(item.GetTrinityItemBaseType()));
 }
コード例 #59
0
ファイル: LootedItem.cs プロジェクト: diacarta/WatchFox
 public LootedItem(ACDItem item)
 {
     Item = item;
 }
コード例 #60
0
        public static bool GetIsTradeable(this ACDItem item)
        {
            int playerId = ZetaDia.Storage.PlayerDataManager.ActivePlayerData.PlayerId;

            return(item.Stats.ItemTradeEndTime != 0 && item.Stats.ItemTradeablePlayers.Contains(playerId));
        }