示例#1
0
        public ItemData(NormalInventoryItem inventoryItem, BaseItemType baseItemType)
        {
            InventoryItem = inventoryItem;
            var item = inventoryItem.Item;

            Path = item.Path;
            var baseComponent = item.GetComponent <Base>();

            isElder      = baseComponent.isElder;
            isShaper     = baseComponent.isShaper;
            isCorrupted  = baseComponent.isCorrupted;
            isCrusader   = baseComponent.isCrusader;
            isRedeemer   = baseComponent.isRedeemer;
            isWarlord    = baseComponent.isWarlord;
            isHunter     = baseComponent.isHunter;
            isInfluenced = isCrusader || isRedeemer || isWarlord || isHunter || isShaper || isElder;
            var mods = item.GetComponent <Mods>();

            Rarity             = mods?.ItemRarity ?? ItemRarity.Normal;
            BIdentified        = mods?.Identified ?? true;
            ItemLevel          = mods?.ItemLevel ?? 0;
            Veiled             = mods?.ItemMods.Where(m => m.DisplayName.Contains("Veil")).Count() ?? 0;
            Fractured          = mods?.CountFractured ?? 0;
            Synthesised        = mods?.Synthesised ?? false;
            isBlightMap        = mods?.ItemMods.Where(m => m.Name.Contains("InfectedMap")).Count() > 0;
            isElderGuardianMap = mods?.ItemMods.Where(m => m.Name.Contains("MapElderContainsBoss")).Count() > 0;


            NumberOfSockets = item.GetComponent <Sockets>()?.NumberOfSockets ?? 0;
            LargestLinkSize = item.GetComponent <Sockets>()?.LargestLinkSize ?? 0;

            ItemQuality = item.GetComponent <Quality>()?.ItemQuality ?? 0;
            ClassName   = baseItemType.ClassName;
            BaseName    = baseItemType.BaseName;

            /*
             * if (baseItemType.BaseName.Contains("Cluster"))
             * {
             *  ClusterJewelpassives = int.Parse(new string(mods?.HumanStats.ElementAt(0).
             *      SkipWhile(c => c < '0' || c > '9').TakeWhile(c => c >= '0' && c <= '9').ToArray()));
             *  ClusterJewelBase = mods?.HumanStats.ElementAt(1).ToString();
             * }
             * else
             * {
             *  ClusterJewelpassives = 0;
             *  ClusterJewelBase = "";
             * }*/

            Name        = "";
            Description = "";
            MapTier     = item.HasComponent <Map>() ? item.GetComponent <Map>().Tier : 0;
            clientRect  = InventoryItem.GetClientRect().Center;

            if (@baseComponent.Name == "Prophecy")
            {
                var @prophParse = item.GetComponent <Prophecy>();
                ProphecyName        = @prophParse.DatProphecy.Name.ToLower();
                ProphecyName        = ProphecyName.Replace(" ", "");
                ProphecyName        = ProphecyName.Replace(",", "");
                ProphecyName        = ProphecyName.Replace("'", "");
                ProphecyDescription = @prophParse.DatProphecy.PredictionText.ToLower();
                ProphecyDescription = ProphecyDescription.Replace(" ", "");
                ProphecyDescription = ProphecyDescription.Replace(",", "");
                ProphecyDescription = ProphecyDescription.Replace("'", "");
                Description         = ProphecyDescription;
                Name     = ProphecyName;
                BaseName = "Prophecy";
            }
        }
示例#2
0
        public ItemData(NormalInventoryItem inventoryItem, BaseItemType baseItemType)
        {
            InventoryItem = inventoryItem;
            var item = inventoryItem.Item;

            Path = item.Path;
            var baseComponent = item.GetComponent <Base>();

            if (baseComponent != null)
            {
                isElder     = baseComponent.isElder;
                isShaper    = baseComponent.isShaper;
                isCorrupted = baseComponent.isCorrupted;
                isCrusader  = baseComponent.isCrusader;
                isRedeemer  = baseComponent.isRedeemer;
                isWarlord   = baseComponent.isWarlord;
                isHunter    = baseComponent.isHunter;
            }

            isInfluenced = isCrusader || isRedeemer || isWarlord || isHunter || isShaper || isElder;
            var mods = item.GetComponent <Mods>();

            Rarity             = mods?.ItemRarity ?? ItemRarity.Normal;
            BIdentified        = mods?.Identified ?? true;
            ItemLevel          = mods?.ItemLevel ?? 0;
            Veiled             = mods?.ItemMods.Where(m => m.DisplayName.Contains("Veil")).Count() ?? 0;
            Fractured          = mods?.CountFractured ?? 0;
            Synthesised        = mods?.Synthesised ?? false;
            isBlightMap        = mods?.ItemMods.Where(m => m.Name.Contains("InfectedMap")).Count() > 0;
            isElderGuardianMap = mods?.ItemMods.Where(m => m.Name.Contains("MapElderContainsBoss")).Count() > 0;

            var sockets = item.GetComponent <Sockets>();

            NumberOfSockets = sockets?.NumberOfSockets ?? 0;
            LargestLinkSize = sockets?.LargestLinkSize ?? 0;

            var quality = item.GetComponent <Quality>();

            ItemQuality = quality?.ItemQuality ?? 0;
            ClassName   = baseItemType.ClassName;
            BaseName    = baseItemType.BaseName;
            Name        = "";
            Description = "";
            MapTier     = item.HasComponent <Map>() ? item.GetComponent <Map>().Tier : 0;
            clientRect  = InventoryItem.GetClientRect().Center;

            if (baseComponent != null && @baseComponent.Name == "Prophecy")
            {
                var @prophParse = item.GetComponent <Prophecy>();
                ProphecyName        = @prophParse.DatProphecy.Name.ToLower();
                ProphecyName        = ProphecyName.Replace(" ", "");
                ProphecyName        = ProphecyName.Replace(",", "");
                ProphecyName        = ProphecyName.Replace("'", "");
                ProphecyDescription = @prophParse.DatProphecy.PredictionText.ToLower();
                ProphecyDescription = ProphecyDescription.Replace(" ", "");
                ProphecyDescription = ProphecyDescription.Replace(",", "");
                ProphecyDescription = ProphecyDescription.Replace("'", "");
                Description         = ProphecyDescription;
                Name     = ProphecyName;
                BaseName = "Prophecy";
            }
        }