Exemplo n.º 1
0
        /**
         * From JSON / ModificationFile
         */
        public Item(JToken node)
        {
            className = ArkName.From(node.Value <string>("className"));
            ItemData itemData = ArkDataManager.GetItem(className.ToString());

            type = itemData != null ? itemData.Name : className.ToString();
            blueprintGeneratedClass = "BlueprintGeneratedClass " + node.Value <string>("blueprintGeneratedClass");

            canEquip             = node.Value <bool?>("canEquip") ?? true;
            canSlot              = node.Value <bool?>("canSlot") ?? true;
            isEngram             = node.Value <bool>("isEngram");
            isBlueprint          = node.Value <bool>("isBlueprint");
            canRemove            = node.Value <bool?>("canRemove") ?? true;
            canRemoveFromCluster = node.Value <bool?>("canRemoveFromCluster") ?? true;
            isHidden             = node.Value <bool>("isHidden");

            quantity = Math.Max(1, node.Value <int?>("quantity") ?? 1);

            customName = node.Value <string>("customName");

            customDescription = node.Value <string>("customDescription");

            durability = node.Value <float>("durability");
            rating     = node.Value <float>("rating");

            quality = node.Value <byte>("quality");

            nextSpoilingTime = node.Value <double>("nextSpoilingTime");
            lastSpoilingTime = node.Value <double>("lastSpoilingTime");

            for (int i = 0; i < itemStatValues.Length; i++)
            {
                itemStatValues[i] = node.Value <short>("itemStatsValue_" + i);
            }

            for (int i = 0; i < itemColors.Length; i++)
            {
                itemColors[i] = node.Value <short>("itemColor_" + i);
            }

            for (int i = 0; i < preSkinItemColors.Length; i++)
            {
                preSkinItemColors[i] = node.Value <short>("preSkinItemColor_" + i);
            }

            for (int i = 0; i < eggLevelups.Length; i++)
            {
                eggLevelups[i] = node.Value <byte>("eggLevelup_" + i);
            }

            for (int i = 0; i < eggColors.Length; i++)
            {
                eggColors[i] = node.Value <byte>("eggColor_" + i);
            }

            crafterCharacterName = node.Value <string>("crafterCharacterName");
            crafterTribeName     = node.Value <string>("crafterTribeName");
            craftedSkillBonus    = node.Value <float>("craftedSkillBonus");

            uploadOffset = node.Value <int>("uploadOffset");
        }
Exemplo n.º 2
0
        /**
         * From ArkSavegame
         */
        public Item(GameObject item)
        {
            className = item.ClassName;
            ItemData itemData = ArkDataManager.GetItem(className.ToString());

            type = itemData != null ? itemData.Name : className.ToString();
            blueprintGeneratedClass = itemData != null ? itemData.BlueprintGeneratedClass : null;

            canEquip             = item.GetPropertyValue <bool>("bAllowEquppingItem", defaultValue: true);
            canSlot              = item.GetPropertyValue <bool>("bCanSlot", defaultValue: true);
            isEngram             = item.GetPropertyValue <bool>("bIsEngram");
            isBlueprint          = item.GetPropertyValue <bool>("bIsBlueprint");
            canRemove            = item.GetPropertyValue <bool>("bAllowRemovalFromInventory", defaultValue: true);
            canRemoveFromCluster = true;
            isHidden             = item.GetPropertyValue <bool>("bHideFromInventoryDisplay");

            //quantity = Math.Max(1, item.findPropertyValue<Number>("ItemQuantity").map(Number.intValue).orElse(1));
            quantity = Math.Max(1, item.GetPropertyValue <int>("ItemQuantity", defaultValue: 1));

            customName = item.GetPropertyValue <string>("CustomItemName", defaultValue: string.Empty);

            customDescription = item.GetPropertyValue <string>("CustomItemDescription", defaultValue: string.Empty);

            durability = item.GetPropertyValue <float>("SavedDurability");

            rating = item.GetPropertyValue <float>("ItemRating");

            quality = item.GetPropertyValue <ArkByteValue>("ItemQualityIndex")?.ByteValue ?? 0;

            nextSpoilingTime = item.GetPropertyValue <double>("NextSpoilingTime");
            lastSpoilingTime = item.GetPropertyValue <double>("LastSpoilingTime");

            for (int i = 0; i < ItemStatDefinitions.Instance.Count; i++)
            {
                itemStatValues[i] = item.GetPropertyValue <short>("ItemStatValues", i);
            }

            for (int i = 0; i < itemColors.Length; i++)
            {
                itemColors[i] = item.GetPropertyValue <short>("ItemColorID", i);
            }

            for (int i = 0; i < preSkinItemColors.Length; i++)
            {
                preSkinItemColors[i] = item.GetPropertyValue <short>("PreSkinItemColorID", i);
            }

            for (int i = 0; i < eggLevelups.Length; i++)
            {
                eggLevelups[i] = item.GetPropertyValue <ArkByteValue>("EggNumberOfLevelUpPointsApplied", i)?.ByteValue ?? 0;
            }

            for (int i = 0; i < eggColors.Length; i++)
            {
                eggColors[i] = item.GetPropertyValue <ArkByteValue>("EggColorSetIndices", i)?.ByteValue ?? 0;
            }

            crafterCharacterName = item.GetPropertyValue <string>("CrafterCharacterName", defaultValue: string.Empty);
            crafterTribeName     = item.GetPropertyValue <string>("CrafterTribeName", defaultValue: string.Empty);
            craftedSkillBonus    = item.GetPropertyValue <float>("CraftedSkillBonus");
        }
Exemplo n.º 3
0
        /**
         * From cluster storage
         */
        public Item(IPropertyContainer item)
        {
            blueprintGeneratedClass = item.GetPropertyValue <ObjectReference>("ItemArchetype").ObjectString.ToString();
            className = ArkName.From(blueprintGeneratedClass.Substring(blueprintGeneratedClass.LastIndexOf('.') + 1));
            ItemData itemData = ArkDataManager.GetItem(className.ToString());

            type = itemData != null ? itemData.Name : className.ToString();

            canEquip             = true;
            canSlot              = item.GetPropertyValue <bool>("bIsSlot", defaultValue: true);
            isEngram             = item.GetPropertyValue <bool>("bIsEngram");
            isBlueprint          = item.GetPropertyValue <bool>("bIsBlueprint");
            canRemove            = item.GetPropertyValue <bool>("bAllowRemovalFromInventory", defaultValue: true);
            canRemoveFromCluster = item.GetPropertyValue <bool>("bAllowRemovalFromSteamInventory", defaultValue: true);
            isHidden             = item.GetPropertyValue <bool>("bHideFromInventoryDisplay");

            //quantity = Math.Max(1, item.findPropertyValue<Number>("ItemQuantity").map(Number::intValue).orElse(1));
            quantity = Math.Max(1, item.GetPropertyValue <int>("ItemQuantity", defaultValue: 1));

            customName = item.GetPropertyValue <string>("CustomItemName", defaultValue: string.Empty);

            customDescription = item.GetPropertyValue <string>("CustomItemDescription", defaultValue: string.Empty);

            durability = item.GetPropertyValue <float>("ItemDurability");

            rating = item.GetPropertyValue <float>("ItemRating");

            quality = item.GetPropertyValue <ArkByteValue>("ItemQualityIndex")?.ByteValue ?? 0;

            nextSpoilingTime = item.GetPropertyValue <double>("NextSpoilingTime");
            lastSpoilingTime = item.GetPropertyValue <double>("LastSpoilingTime");

            for (int i = 0; i < itemStatValues.Length; i++)
            {
                itemStatValues[i] = item.GetPropertyValue <short>("ItemStatValues", i);
            }

            for (int i = 0; i < itemColors.Length; i++)
            {
                itemColors[i] = item.GetPropertyValue <short>("ItemColorID", i);
            }

            for (int i = 0; i < preSkinItemColors.Length; i++)
            {
                preSkinItemColors[i] = item.GetPropertyValue <short>("PreSkinItemColorID", i);
            }

            for (int i = 0; i < eggLevelups.Length; i++)
            {
                eggLevelups[i] = item.GetPropertyValue <ArkByteValue>("EggNumberOfLevelUpPointsApplied", i)?.ByteValue ?? 0;
            }

            for (int i = 0; i < eggColors.Length; i++)
            {
                eggColors[i] = item.GetPropertyValue <ArkByteValue>("EggColorSetIndices", i)?.ByteValue ?? 0;
            }

            crafterCharacterName = item.GetPropertyValue <string>("CrafterCharacterName", defaultValue: string.Empty);
            crafterTribeName     = item.GetPropertyValue <string>("CrafterTribeName", defaultValue: string.Empty);
            craftedSkillBonus    = item.GetPropertyValue <float>("CraftedSkillBonus");
        }