19.7.1.0 breaking change: IItemStat menu

User Tag List

Results 1 to 6 of 6
  1. #1
    JarJarD3's Avatar Contributor
    Reputation
    106
    Join Date
    Oct 2017
    Posts
    395
    Thanks G/R
    41/101
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    19.7.1.0 breaking change: IItemStat

    Removing IItemStat.Value totally is quite drastic change and breaks some plugins and causes lots of difficulties to THUD users as THUD will not start anymore if you got one of those plugins that can not compile anymore.
    Especially for those users that are using Jack's Extensions will suffer and maybe can not fix it by themselves like programmers can.

    I suggest that give us Value back and maybe make it return a string like the new StringValue.
    At least for some grace period to get all plugins compile or something.

    And I don't understand why IItemStat.IntegerValue is nullable but IItemStat.DoubleValue and IItemStat.StringValue are not!?

    I agree that IItemStat.Value is quite "hard" to use and changes to make it more user friendly are welcome.

    19.7.1.0 breaking change: IItemStat
  2. #2
    KillerJohn's Avatar TurboHUD HUDmaster CoreCoins Purchaser Authenticator enabled
    Reputation
    3693
    Join Date
    Jul 2012
    Posts
    2,532
    Thanks G/R
    46/3335
    Trade Feedback
    0 (0%)
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I had no idea anybody is using IItemStat
    Do not send me private messages unless it is absolutely necessary or the content is sensitive or when I ask you to do that...

  3. #3
    KillerJohn's Avatar TurboHUD HUDmaster CoreCoins Purchaser Authenticator enabled
    Reputation
    3693
    Join Date
    Jul 2012
    Posts
    2,532
    Thanks G/R
    46/3335
    Trade Feedback
    0 (0%)
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    uploaded 19.7.2.0, added back .Value
    Do not send me private messages unless it is absolutely necessary or the content is sensitive or when I ask you to do that...

  4. #4
    KillerJohn's Avatar TurboHUD HUDmaster CoreCoins Purchaser Authenticator enabled
    Reputation
    3693
    Join Date
    Jul 2012
    Posts
    2,532
    Thanks G/R
    46/3335
    Trade Feedback
    0 (0%)
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by JarJarD3 View Post
    And I don't understand why IItemStat.IntegerValue is nullable but IItemStat.DoubleValue and IItemStat.StringValue are not!?
    strings are reference types, so "nullable" by default
    Do not send me private messages unless it is absolutely necessary or the content is sensitive or when I ask you to do that...

  5. Thanks xblade2k7 (1 members gave Thanks to KillerJohn for this useful post)
  6. #5
    JarJarD3's Avatar Contributor
    Reputation
    106
    Join Date
    Oct 2017
    Posts
    395
    Thanks G/R
    41/101
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    With comments in IItemStat in version 19.7.2.0 everything is now A-OK and makes sense to me.
    Code:
    double DoubleValue { get; } // always has a value, even if the attribute value type is _int
    int? IntegerValue { get; } // contains the value as an integer - only if the attribute value type is _int
    string StringValue { get; } // there is only one stat (Id = "name") which has a StringValue
    Jack has a lot of code similar to this (which needs to be refactored soon):
    Code:
    public static int intValue(this IEnumerable<IItemStat> stats, string id)
    {
        return stats.Where(s => s.Id == id).Select(s => int.Parse(s.Value.ToString())).FirstOrDefault();
    }
    
    public static float floatValue(this IEnumerable<IItemStat> stats, string id)
    {
        return stats.Where(s => s.Id == id).Select(s => float.Parse(s.Value.ToString())).FirstOrDefault();
    }
    I use it to check if an item has been "enchanted":
    Code:
    private static ISnoItemMod GetEnhancedItemMod(IItem item)
    {
        if (item.StatList != null && item.Affixes != null)
        {
            var stat = item.StatList.FirstOrDefault(x => x.Id == "EnchantedAffixNew#1048575");
            if (stat != null)
            {
                var integerValue = stat.IntegerValue;
                if (integerValue.HasValue)
                {
                    var enchantedAffix = (uint)integerValue.Value;
                    if (enchantedAffix > 0)
                    {
                        var affix = item.Affixes.FirstOrDefault(x => x.Id == enchantedAffix);
                        if (affix != null && affix.Mods.Length > 0)
                        {
                            return affix.Mods[0];
                        }
                    }
                }
            }
        }
        return null;
    }
    if IntegerValue is not costly operation, I could even make it easier to read (querying it twice):
    Code:
    private static ISnoItemMod GetEnhancedItemMod(IItem item)
    {
        if (item.StatList != null && item.Affixes != null)
        {
            var stat = item.StatList.FirstOrDefault(x => x.Id == "EnchantedAffixNew#1048575");
            if (stat != null && stat.IntegerValue.HasValue)
            {
                var enchantedAffix = (uint)stat.IntegerValue.Value;
                if (enchantedAffix > 0)
                {
                    var affix = item.Affixes.FirstOrDefault(x => x.Id == enchantedAffix);
                    if (affix != null && affix.Mods.Length > 0)
                    {
                        return affix.Mods[0];
                    }
                }
            }
        }
        return null;
    }

  7. Thanks SeaDragon (1 members gave Thanks to JarJarD3 for this useful post)
  8. #6
    KillerJohn's Avatar TurboHUD HUDmaster CoreCoins Purchaser Authenticator enabled
    Reputation
    3693
    Join Date
    Jul 2012
    Posts
    2,532
    Thanks G/R
    46/3335
    Trade Feedback
    0 (0%)
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    why don't you use item.EnchantedAffixNew instead of finding it in the stat list ?

    var affix = item.EnchantedAffixNew != 0
    ? item.Affixes.FirstOrDefault(x => x.Id == item.EnchantedAffixNew)
    : null;
    Do not send me private messages unless it is absolutely necessary or the content is sensitive or when I ask you to do that...

Similar Threads

  1. How to Change Breaking News!
    By reaplang in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 12-29-2009, 02:16 PM
  2. [Request] Enchanting Levels Changed Level 19
    By [Shon3m] in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 03-22-2009, 09:59 AM
  3. New twink items/ Changed items (19)
    By shindaustin in forum WoW Items & Quests
    Replies: 6
    Last Post: 10-30-2007, 08:33 PM
  4. MMOwned's Server Move + Forum Change
    By Matt in forum OC News
    Replies: 0
    Last Post: 03-25-2006, 04:52 AM
All times are GMT -5. The time now is 02:17 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search