Exemplo n.º 1
0
        public static ItemId FromItem(ItemIdentifierDto itemIdentifier)
        {
            if (IsObsolete(itemIdentifier))
            {
                throw new Exception($"{itemIdentifier.Name} is obsolete");
            }

            return(FromString(itemIdentifier.TooltipParams));
        }
Exemplo n.º 2
0
        public static ItemId FromItemDyeOptional(ItemIdentifierDto itemIdentifier)
        {
            if (itemIdentifier == null)
            {
                return(null);
            }

            /* BattleNet api returns invalid TooltipParams */
            var tooltipParams = $"{itemIdentifier.TooltipParams}-{itemIdentifier.Id}";

            return(FromString(tooltipParams));
        }
Exemplo n.º 3
0
 public static bool IsObsolete(ItemIdentifierDto itemIdentifier)
 {
     /* obsolete items have no TooltipParams (e.g. items that are not updated after the patch that must be looted again) */
     return(string.IsNullOrEmpty(itemIdentifier.TooltipParams));
 }
Exemplo n.º 4
0
 public static ItemId FromItemOptional(ItemIdentifierDto itemIdentifier)
 {
     return(itemIdentifier == null ? null : FromString(itemIdentifier.TooltipParams));
 }