Esempio n. 1
0
        private static bool searchBlueprintText(Blueprint blueprint, string text)
        {
            byte b = 0;

            while ((int)b < blueprint.outputs.Length)
            {
                BlueprintOutput blueprintOutput = blueprint.outputs[(int)b];
                ItemAsset       itemAsset       = (ItemAsset)Assets.find(EAssetType.ITEM, blueprintOutput.id);
                if (itemAsset != null && itemAsset.itemName != null && itemAsset.itemName.IndexOf(text, StringComparison.OrdinalIgnoreCase) != -1)
                {
                    return(true);
                }
                b += 1;
            }
            if (blueprint.tool != 0)
            {
                ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, blueprint.tool);
                if (itemAsset2 != null && itemAsset2.itemName != null && itemAsset2.itemName.IndexOf(text, StringComparison.OrdinalIgnoreCase) != -1)
                {
                    return(true);
                }
            }
            byte b2 = 0;

            while ((int)b2 < blueprint.supplies.Length)
            {
                BlueprintSupply blueprintSupply = blueprint.supplies[(int)b2];
                ItemAsset       itemAsset3      = (ItemAsset)Assets.find(EAssetType.ITEM, blueprintSupply.id);
                if (itemAsset3 != null && itemAsset3.itemName != null && itemAsset3.itemName.IndexOf(text, StringComparison.OrdinalIgnoreCase) != -1)
                {
                    return(true);
                }
                b2 += 1;
            }
            return(false);
        }
Esempio n. 2
0
        // Token: 0x06001A3F RID: 6719 RVA: 0x000937B4 File Offset: 0x00091BB4
        protected override void writeAsset(IFormattedFileWriter writer)
        {
            base.writeAsset(writer);
            writer.writeValue <bool>("Is_Pro", this.isPro);
            writer.writeValue <EItemType>("Type", this.type);
            writer.writeValue <EItemRarity>("Rarity", this.rarity);
            writer.writeValue <byte>("Size_X", this.size_x);
            writer.writeValue <byte>("Size_Y", this.size_y);
            writer.writeValue <float>("Size_Z", this.size_z);
            writer.writeValue <float>("Size2_Z", this.size2_z);
            writer.writeValue <byte>("Amount", this.amount);
            writer.writeValue <byte>("Count_Min", this.countMin);
            writer.writeValue <byte>("Count_Max", this.countMax);
            writer.writeValue <byte>("Quality_Min", this.qualityMin);
            writer.writeValue <byte>("Quality_Max", this.qualityMax);
            writer.writeValue <bool>("Backward", this.isBackward);
            writer.writeValue("Useable", this.useable);
            writer.writeValue <ESlotType>("Slot", this.slot);
            writer.beginArray("Blueprints");
            for (int i = 0; i < this.blueprints.Count; i++)
            {
                writer.beginObject();
                Blueprint blueprint = this.blueprints[i];
                writer.writeValue <EBlueprintType>("Type", blueprint.type);
                writer.beginArray("Supplies");
                for (int j = 0; j < blueprint.supplies.Length; j++)
                {
                    writer.beginObject();
                    BlueprintSupply blueprintSupply = blueprint.supplies[j];
                    writer.writeValue <ushort>("ID", blueprintSupply.id);
                    writer.writeValue <bool>("Critical", blueprintSupply.isCritical);
                    writer.writeValue <ushort>("Amount", blueprintSupply.amount);
                    writer.endObject();
                }
                writer.endArray();
                writer.beginArray("Output");
                for (int k = 0; k < blueprint.outputs.Length; k++)
                {
                    writer.beginObject();
                    BlueprintOutput blueprintOutput = blueprint.outputs[k];
                    writer.writeValue <ushort>("ID", blueprintOutput.id);
                    writer.writeValue <ushort>("Amount", blueprintOutput.amount);
                    writer.endObject();
                }
                writer.endArray();
                writer.writeValue <ushort>("Tool", blueprint.tool);
                writer.writeValue <bool>("Tool_Critical", blueprint.toolCritical);
                writer.writeValue <ushort>("Build", blueprint.build);
                writer.writeValue <byte>("Level", blueprint.level);
                writer.writeValue <EBlueprintSkill>("Skill", blueprint.skill);
                writer.writeValue <bool>("Transfer_State", blueprint.transferState);
                writer.endObject();
            }
            writer.endArray();
            writer.beginArray("Actions");
            byte b = 0;

            while ((int)b < this.actions.Count)
            {
                writer.beginObject();
                Action action = this.actions[(int)b];
                writer.writeValue <EActionType>("Type", action.type);
                writer.beginArray("Blueprints");
                byte b2 = 0;
                while ((int)b2 < action.blueprints.Length)
                {
                    writer.beginObject();
                    ActionBlueprint actionBlueprint = action.blueprints[(int)b2];
                    writer.writeValue <byte>("Index", actionBlueprint.id);
                    writer.writeValue <bool>("Is_Link", actionBlueprint.isLink);
                    writer.endObject();
                    b2 += 1;
                }
                writer.endArray();
                writer.writeValue("Text", action.text);
                writer.writeValue("Tooltip", action.tooltip);
                writer.writeValue("Key", action.key);
                writer.writeValue <ushort>("Source", action.source);
                writer.endObject();
                b += 1;
            }
            writer.endArray();
            writer.writeValue <bool>("Should_Verify_Hash", this._shouldVerifyHash);
        }
Esempio n. 3
0
        // Token: 0x06001A26 RID: 6694 RVA: 0x00092038 File Offset: 0x00090438
        public ItemAsset(Bundle bundle, Data data, Local localization, ushort id) : base(bundle, data, localization, id)
        {
            this.isPro = data.has("Pro");
            if (id < 2000 && !bundle.hasResource && !this.isPro && !data.has("Bypass_ID_Limit"))
            {
                throw new NotSupportedException("ID < 2000");
            }
            if (!this.isPro)
            {
                this._itemName        = localization.format("Name");
                this._itemDescription = localization.format("Description");
                this._itemDescription = ItemTool.filterRarityRichText(this.itemDescription);
            }
            this.type = (EItemType)Enum.Parse(typeof(EItemType), data.readString("Type"), true);
            if (data.has("Rarity"))
            {
                this.rarity = (EItemRarity)Enum.Parse(typeof(EItemRarity), data.readString("Rarity"), true);
            }
            else
            {
                this.rarity = EItemRarity.COMMON;
            }
            if (this.isPro)
            {
                if (this.type == EItemType.SHIRT)
                {
                    this._proPath = "/Shirts";
                }
                else if (this.type == EItemType.PANTS)
                {
                    this._proPath = "/Pants";
                }
                else if (this.type == EItemType.HAT)
                {
                    this._proPath = "/Hats";
                }
                else if (this.type == EItemType.BACKPACK)
                {
                    this._proPath = "/Backpacks";
                }
                else if (this.type == EItemType.VEST)
                {
                    this._proPath = "/Vests";
                }
                else if (this.type == EItemType.MASK)
                {
                    this._proPath = "/Masks";
                }
                else if (this.type == EItemType.GLASSES)
                {
                    this._proPath = "/Glasses";
                }
                else if (this.type == EItemType.KEY)
                {
                    this._proPath = "/Keys";
                }
                else if (this.type == EItemType.BOX)
                {
                    this._proPath = "/Boxes";
                }
                this._proPath = this._proPath + "/" + this.name;
            }
            this.size_x = data.readByte("Size_X");
            if (this.size_x < 1)
            {
                this.size_x = 1;
            }
            this.size_y = data.readByte("Size_Y");
            if (this.size_y < 1)
            {
                this.size_y = 1;
            }
            this.size_z  = data.readSingle("Size_Z");
            this.size2_z = data.readSingle("Size2_Z");
            this.amount  = data.readByte("Amount");
            if (this.amount < 1)
            {
                this.amount = 1;
            }
            this.countMin = data.readByte("Count_Min");
            if (this.countMin < 1)
            {
                this.countMin = 1;
            }
            this.countMax = data.readByte("Count_Max");
            if (this.countMax < 1)
            {
                this.countMax = 1;
            }
            if (data.has("Quality_Min"))
            {
                this.qualityMin = data.readByte("Quality_Min");
            }
            else
            {
                this.qualityMin = 10;
            }
            if (data.has("Quality_Max"))
            {
                this.qualityMax = data.readByte("Quality_Max");
            }
            else
            {
                this.qualityMax = 90;
            }
            this.isBackward = data.has("Backward");
            this.useable    = data.readString("Useable");
            this.isUseable  = !string.IsNullOrEmpty(this.useable);
            if (this.isUseable)
            {
                this._equip = (AudioClip)bundle.load("Equip");
                if (!this.isPro)
                {
                    GameObject gameObject = (GameObject)bundle.load("Animations");
                    if (gameObject != null)
                    {
                        Animation component = gameObject.GetComponent <Animation>();
                        this._animations = new AnimationClip[component.GetClipCount()];
                        int         num        = 0;
                        IEnumerator enumerator = component.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                object         obj            = enumerator.Current;
                                AnimationState animationState = (AnimationState)obj;
                                this.animations[num] = animationState.clip;
                                num++;
                            }
                        }
                        finally
                        {
                            IDisposable disposable;
                            if ((disposable = (enumerator as IDisposable)) != null)
                            {
                                disposable.Dispose();
                            }
                        }
                    }
                    else
                    {
                        this._animations = new AnimationClip[0];
                    }
                }
            }
            string text = data.readString("Slot");

            if (text == null)
            {
                this.slot = ESlotType.NONE;
            }
            else
            {
                this.slot = (ESlotType)Enum.Parse(typeof(ESlotType), text, true);
            }
            if (!Dedicator.isDedicated || this.type == EItemType.GUN || this.type == EItemType.MELEE)
            {
                this._item = (GameObject)bundle.load("Item");
                if (this.item == null)
                {
                    throw new NotSupportedException("Missing item gameobject");
                }
                if (this.item.transform.FindChild("Icon") != null && this.item.transform.FindChild("Icon").GetComponent <Camera>() != null)
                {
                    Assets.errors.Add(this.itemName + " icon has a camera attached!");
                }
                if (id < 2000 && (this.type == EItemType.GUN || this.type == EItemType.MELEE) && this.item.transform.FindChild("Stat_Tracker") == null)
                {
                    Assets.errors.Add(this.itemName + " missing stat tracker hook!");
                }
            }
            byte b  = data.readByte("Blueprints");
            byte b2 = data.readByte("Actions");

            this._blueprints = new List <Blueprint>((int)b);
            this._actions    = new List <Action>((int)b2);
            for (byte b3 = 0; b3 < b; b3 += 1)
            {
                if (!data.has("Blueprint_" + b3 + "_Type"))
                {
                    throw new NotSupportedException("Missing blueprint type");
                }
                EBlueprintType newType = (EBlueprintType)Enum.Parse(typeof(EBlueprintType), data.readString("Blueprint_" + b3 + "_Type"), true);
                byte           b4      = data.readByte("Blueprint_" + b3 + "_Supplies");
                if (b4 < 1)
                {
                    b4 = 1;
                }
                BlueprintSupply[] array = new BlueprintSupply[(int)b4];
                byte b5 = 0;
                while ((int)b5 < array.Length)
                {
                    ushort newID = data.readUInt16(string.Concat(new object[]
                    {
                        "Blueprint_",
                        b3,
                        "_Supply_",
                        b5,
                        "_ID"
                    }));
                    bool newCritical = data.has(string.Concat(new object[]
                    {
                        "Blueprint_",
                        b3,
                        "_Supply_",
                        b5,
                        "_Critical"
                    }));
                    byte b6 = data.readByte(string.Concat(new object[]
                    {
                        "Blueprint_",
                        b3,
                        "_Supply_",
                        b5,
                        "_Amount"
                    }));
                    if (b6 < 1)
                    {
                        b6 = 1;
                    }
                    array[(int)b5] = new BlueprintSupply(newID, newCritical, b6);
                    b5            += 1;
                }
                byte b7 = data.readByte("Blueprint_" + b3 + "_Outputs");
                BlueprintOutput[] array2;
                if (b7 > 0)
                {
                    array2 = new BlueprintOutput[(int)b7];
                    byte b8 = 0;
                    while ((int)b8 < array2.Length)
                    {
                        ushort newID2 = data.readUInt16(string.Concat(new object[]
                        {
                            "Blueprint_",
                            b3,
                            "_Output_",
                            b8,
                            "_ID"
                        }));
                        byte b9 = data.readByte(string.Concat(new object[]
                        {
                            "Blueprint_",
                            b3,
                            "_Output_",
                            b8,
                            "_Amount"
                        }));
                        if (b9 < 1)
                        {
                            b9 = 1;
                        }
                        array2[(int)b8] = new BlueprintOutput(newID2, b9);
                        b8 += 1;
                    }
                }
                else
                {
                    array2 = new BlueprintOutput[1];
                    ushort num2 = data.readUInt16("Blueprint_" + b3 + "_Product");
                    if (num2 == 0)
                    {
                        num2 = id;
                    }
                    byte b10 = data.readByte("Blueprint_" + b3 + "_Products");
                    if (b10 < 1)
                    {
                        b10 = 1;
                    }
                    array2[0] = new BlueprintOutput(num2, b10);
                }
                ushort          newTool         = data.readUInt16("Blueprint_" + b3 + "_Tool");
                bool            newToolCritical = data.has("Blueprint_" + b3 + "_Tool_Critical");
                ushort          newBuild        = data.readUInt16("Blueprint_" + b3 + "_Build");
                byte            b11             = data.readByte("Blueprint_" + b3 + "_Level");
                EBlueprintSkill newSkill        = EBlueprintSkill.NONE;
                if (b11 > 0)
                {
                    newSkill = (EBlueprintSkill)Enum.Parse(typeof(EBlueprintSkill), data.readString("Blueprint_" + b3 + "_Skill"), true);
                }
                bool            newTransferState = data.has("Blueprint_" + b3 + "_State_Transfer");
                string          newMap           = data.readString("Blueprint_" + b3 + "_Map");
                INPCCondition[] array3           = new INPCCondition[(int)data.readByte("Blueprint_" + b3 + "_Conditions")];
                NPCTool.readConditions(data, localization, "Blueprint_" + b3 + "_Condition_", array3, string.Concat(new object[]
                {
                    "item ",
                    id,
                    " blueprint ",
                    b3
                }));
                INPCReward[] array4 = new INPCReward[(int)data.readByte("Blueprint_" + b3 + "_Rewards")];
                NPCTool.readRewards(data, localization, "Blueprint_" + b3 + "_Reward_", array4, string.Concat(new object[]
                {
                    "item ",
                    id,
                    " blueprint ",
                    b3
                }));
                this.blueprints.Add(new Blueprint(id, b3, newType, array, array2, newTool, newToolCritical, newBuild, b11, newSkill, newTransferState, newMap, array3, array4));
            }
            for (byte b12 = 0; b12 < b2; b12 += 1)
            {
                if (!data.has("Action_" + b12 + "_Type"))
                {
                    throw new NotSupportedException("Missing action type");
                }
                EActionType newType2 = (EActionType)Enum.Parse(typeof(EActionType), data.readString("Action_" + b12 + "_Type"), true);
                byte        b13      = data.readByte("Action_" + b12 + "_Blueprints");
                if (b13 < 1)
                {
                    b13 = 1;
                }
                ActionBlueprint[] array5 = new ActionBlueprint[(int)b13];
                byte b14 = 0;
                while ((int)b14 < array5.Length)
                {
                    byte newID3 = data.readByte(string.Concat(new object[]
                    {
                        "Action_",
                        b12,
                        "_Blueprint_",
                        b14,
                        "_Index"
                    }));
                    bool newLink = data.has(string.Concat(new object[]
                    {
                        "Action_",
                        b12,
                        "_Blueprint_",
                        b14,
                        "_Link"
                    }));
                    array5[(int)b14] = new ActionBlueprint(newID3, newLink);
                    b14 += 1;
                }
                string newText    = data.readString("Action_" + b12 + "_Text");
                string newTooltip = data.readString("Action_" + b12 + "_Tooltip");
                string newKey     = data.readString("Action_" + b12 + "_Key");
                ushort num3       = data.readUInt16("Action_" + b12 + "_Source");
                if (num3 == 0)
                {
                    num3 = id;
                }
                this.actions.Add(new Action(num3, newType2, array5, newText, newTooltip, newKey));
            }
            if (b2 == 0)
            {
                bool flag = false;
                byte b15  = 0;
                while ((int)b15 < this.blueprints.Count)
                {
                    Blueprint blueprint = this.blueprints[(int)b15];
                    if (blueprint.type == EBlueprintType.REPAIR)
                    {
                        Action item = new Action(id, EActionType.BLUEPRINT, new ActionBlueprint[]
                        {
                            new ActionBlueprint(b15, true)
                        }, null, null, "Repair");
                        this.actions.Insert(0, item);
                    }
                    else if (blueprint.type == EBlueprintType.AMMO)
                    {
                        flag = true;
                    }
                    else if (blueprint.supplies.Length == 1 && blueprint.supplies[0].id == id)
                    {
                        Action item2 = new Action(id, EActionType.BLUEPRINT, new ActionBlueprint[]
                        {
                            new ActionBlueprint(b15, this.type == EItemType.GUN || this.type == EItemType.MELEE)
                        }, null, null, "Salvage");
                        this.actions.Add(item2);
                    }
                    b15 += 1;
                }
                if (flag)
                {
                    List <ActionBlueprint> list = new List <ActionBlueprint>();
                    byte b16 = 0;
                    while ((int)b16 < this.blueprints.Count)
                    {
                        Blueprint blueprint2 = this.blueprints[(int)b16];
                        if (blueprint2.type == EBlueprintType.AMMO)
                        {
                            ActionBlueprint item3 = new ActionBlueprint(b16, true);
                            list.Add(item3);
                        }
                        b16 += 1;
                    }
                    Action item4 = new Action(id, EActionType.BLUEPRINT, list.ToArray(), null, null, "Refill");
                    this.actions.Add(item4);
                }
            }
            this._shouldVerifyHash   = !data.has("Bypass_Hash_Verification");
            this.overrideShowQuality = data.has("Override_Show_Quality");
            if (!Dedicator.isDedicated)
            {
                this._albedoBase   = (Texture2D)bundle.load("Albedo_Base");
                this._metallicBase = (Texture2D)bundle.load("Metallic_Base");
                this._emissionBase = (Texture2D)bundle.load("Emission_Base");
            }
        }
Esempio n. 4
0
        // Token: 0x06001A3E RID: 6718 RVA: 0x000930C0 File Offset: 0x000914C0
        protected override void readAsset(IFormattedFileReader reader)
        {
            base.readAsset(reader);
            this.isPro  = reader.readValue <bool>("Is_Pro");
            this.type   = reader.readValue <EItemType>("Type");
            this.rarity = reader.readValue <EItemRarity>("Rarity");
            if (this.isPro)
            {
                if (this.type == EItemType.SHIRT)
                {
                    this._proPath = "/Shirts";
                }
                else if (this.type == EItemType.PANTS)
                {
                    this._proPath = "/Pants";
                }
                else if (this.type == EItemType.HAT)
                {
                    this._proPath = "/Hats";
                }
                else if (this.type == EItemType.BACKPACK)
                {
                    this._proPath = "/Backpacks";
                }
                else if (this.type == EItemType.VEST)
                {
                    this._proPath = "/Vests";
                }
                else if (this.type == EItemType.MASK)
                {
                    this._proPath = "/Masks";
                }
                else if (this.type == EItemType.GLASSES)
                {
                    this._proPath = "/Glasses";
                }
                else if (this.type == EItemType.KEY)
                {
                    this._proPath = "/Keys";
                }
                else if (this.type == EItemType.BOX)
                {
                    this._proPath = "/Boxes";
                }
                this._proPath = this._proPath + "/" + this.name;
            }
            this.size_x = reader.readValue <byte>("Size_X");
            if (this.size_x < 1)
            {
                this.size_x = 1;
            }
            this.size_y = reader.readValue <byte>("Size_Y");
            if (this.size_y < 1)
            {
                this.size_y = 1;
            }
            this.size_z  = reader.readValue <float>("Size_Z");
            this.size2_z = reader.readValue <float>("Size2_Z");
            this.amount  = reader.readValue <byte>("Amount");
            if (this.amount < 1)
            {
                this.amount = 1;
            }
            this.countMin = reader.readValue <byte>("Count_Min");
            if (this.countMin < 1)
            {
                this.countMin = 1;
            }
            this.countMax = reader.readValue <byte>("Count_Max");
            if (this.countMax < 1)
            {
                this.countMax = 1;
            }
            this.qualityMin = reader.readValue <byte>("Quality_Min");
            this.qualityMax = reader.readValue <byte>("Quality_Max");
            this.isBackward = reader.readValue <bool>("Backward");
            this.useable    = reader.readValue <string>("Useable");
            this.isUseable  = !string.IsNullOrEmpty(this.useable);
            this.slot       = reader.readValue <ESlotType>("Slot");
            int num = reader.readArrayLength("Blueprints");

            this._blueprints = new List <Blueprint>(num);
            for (int i = 0; i < num; i++)
            {
                IFormattedFileReader formattedFileReader = reader.readObject(i);
                EBlueprintType       newType             = formattedFileReader.readValue <EBlueprintType>("Type");
                int num2 = formattedFileReader.readArrayLength("Supplies");
                BlueprintSupply[] array = new BlueprintSupply[num2];
                for (int j = 0; j < num2; j++)
                {
                    IFormattedFileReader formattedFileReader2 = formattedFileReader.readObject(j);
                    ushort newID       = formattedFileReader2.readValue <ushort>("ID");
                    bool   newCritical = formattedFileReader2.readValue <bool>("Critical");
                    byte   newAmount   = formattedFileReader2.readValue <byte>("Amount");
                    array[j] = new BlueprintSupply(newID, newCritical, newAmount);
                }
                int num3 = formattedFileReader.readArrayLength("Output");
                BlueprintOutput[] array2 = new BlueprintOutput[num3];
                for (int k = 0; k < num3; k++)
                {
                    IFormattedFileReader formattedFileReader3 = formattedFileReader.readObject(k);
                    ushort newID2     = formattedFileReader3.readValue <ushort>("ID");
                    byte   newAmount2 = formattedFileReader3.readValue <byte>("Amount");
                    array2[k] = new BlueprintOutput(newID2, newAmount2);
                }
                ushort          newTool          = formattedFileReader.readValue <ushort>("Tool");
                bool            newToolCritical  = formattedFileReader.readValue <bool>("Tool_Critical");
                ushort          newBuild         = formattedFileReader.readValue <ushort>("Build");
                byte            newLevel         = formattedFileReader.readValue <byte>("Level");
                EBlueprintSkill newSkill         = formattedFileReader.readValue <EBlueprintSkill>("Skill");
                bool            newTransferState = formattedFileReader.readValue <bool>("Transfer_State");
                string          newMap           = formattedFileReader.readValue("Map");
                this.blueprints.Add(new Blueprint(this.id, (byte)i, newType, array, array2, newTool, newToolCritical, newBuild, newLevel, newSkill, newTransferState, newMap, null, null));
            }
            int num4 = reader.readArrayLength("Actions");

            this._actions = new List <Action>(num4);
            byte b = 0;

            while ((int)b < num4)
            {
                IFormattedFileReader formattedFileReader4 = reader.readObject((int)b);
                EActionType          newType2             = formattedFileReader4.readValue <EActionType>("Type");
                int num5 = formattedFileReader4.readArrayLength("Blueprints");
                ActionBlueprint[] array3 = new ActionBlueprint[num5];
                byte b2 = 0;
                while ((int)b2 < array3.Length)
                {
                    IFormattedFileReader formattedFileReader5 = formattedFileReader4.readObject((int)b2);
                    byte newID3  = formattedFileReader5.readValue <byte>("Index");
                    bool newLink = formattedFileReader5.readValue <bool>("Is_Link");
                    array3[(int)b2] = new ActionBlueprint(newID3, newLink);
                    b2 += 1;
                }
                string newText    = formattedFileReader4.readValue <string>("Text");
                string newTooltip = formattedFileReader4.readValue <string>("Tooltip");
                string newKey     = formattedFileReader4.readValue <string>("Key");
                ushort num6       = formattedFileReader4.readValue <ushort>("Source");
                if (num6 == 0)
                {
                    num6 = this.id;
                }
                this.actions.Add(new Action(num6, newType2, array3, newText, newTooltip, newKey));
                b += 1;
            }
            if (num4 == 0)
            {
                bool flag = false;
                byte b3   = 0;
                while ((int)b3 < this.blueprints.Count)
                {
                    Blueprint blueprint = this.blueprints[(int)b3];
                    if (blueprint.type == EBlueprintType.REPAIR)
                    {
                        Action item = new Action(this.id, EActionType.BLUEPRINT, new ActionBlueprint[]
                        {
                            new ActionBlueprint(b3, true)
                        }, null, null, "Repair");
                        this.actions.Insert(0, item);
                    }
                    else if (blueprint.type == EBlueprintType.AMMO)
                    {
                        flag = true;
                    }
                    else if (blueprint.supplies.Length == 1 && blueprint.supplies[0].id == this.id)
                    {
                        Action item2 = new Action(this.id, EActionType.BLUEPRINT, new ActionBlueprint[]
                        {
                            new ActionBlueprint(b3, this.type == EItemType.GUN || this.type == EItemType.MELEE)
                        }, null, null, "Salvage");
                        this.actions.Add(item2);
                    }
                    b3 += 1;
                }
                if (flag)
                {
                    List <ActionBlueprint> list = new List <ActionBlueprint>();
                    byte b4 = 0;
                    while ((int)b4 < this.blueprints.Count)
                    {
                        Blueprint blueprint2 = this.blueprints[(int)b4];
                        if (blueprint2.type == EBlueprintType.AMMO)
                        {
                            ActionBlueprint item3 = new ActionBlueprint(b4, true);
                            list.Add(item3);
                        }
                        b4 += 1;
                    }
                    Action item4 = new Action(this.id, EActionType.BLUEPRINT, list.ToArray(), null, null, "Refill");
                    this.actions.Add(item4);
                }
            }
            this._shouldVerifyHash = reader.readValue <bool>("Should_Verify_Hash");
        }
Esempio n. 5
0
 public void askCraft(CSteamID steamID, ushort id, byte index, bool force)
 {
     if (base.channel.checkOwner(steamID))
     {
         if (base.player.equipment.isBusy)
         {
             return;
         }
         if (!base.player.tryToPerformRateLimitedAction())
         {
             return;
         }
         ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id);
         if (itemAsset != null)
         {
             if ((int)index >= itemAsset.blueprints.Count)
             {
                 return;
             }
             Blueprint blueprint = itemAsset.blueprints[(int)index];
             if (blueprint.skill == EBlueprintSkill.REPAIR && (uint)blueprint.level > Provider.modeConfigData.Gameplay.Repair_Level_Max)
             {
                 return;
             }
             if (!string.IsNullOrEmpty(blueprint.map) && !blueprint.map.Equals(Level.info.name, StringComparison.InvariantCultureIgnoreCase))
             {
                 return;
             }
             if (blueprint.tool != 0 && base.player.inventory.has(blueprint.tool) == null)
             {
                 return;
             }
             if (blueprint.skill != EBlueprintSkill.NONE)
             {
                 bool flag = PowerTool.checkFires(base.transform.position, 16f);
                 if ((blueprint.skill == EBlueprintSkill.CRAFT && base.player.skills.skills[2][1].level < blueprint.level) || (blueprint.skill == EBlueprintSkill.COOK && (!flag || base.player.skills.skills[2][3].level < blueprint.level)) || (blueprint.skill == EBlueprintSkill.REPAIR && base.player.skills.skills[2][7].level < blueprint.level))
                 {
                     return;
                 }
             }
             bool flag2 = false;
             while (blueprint.areConditionsMet(base.player))
             {
                 List <InventorySearch>[] array = new List <InventorySearch> [blueprint.supplies.Length];
                 byte b = 0;
                 while ((int)b < blueprint.supplies.Length)
                 {
                     BlueprintSupply        blueprintSupply = blueprint.supplies[(int)b];
                     List <InventorySearch> list            = base.player.inventory.search(blueprintSupply.id, false, true);
                     if (list.Count == 0)
                     {
                         return;
                     }
                     ushort num = 0;
                     byte   b2  = 0;
                     while ((int)b2 < list.Count)
                     {
                         num += (ushort)list[(int)b2].jar.item.amount;
                         b2  += 1;
                     }
                     if (num < blueprintSupply.amount && blueprint.type != EBlueprintType.AMMO)
                     {
                         return;
                     }
                     if (blueprint.type == EBlueprintType.AMMO)
                     {
                         list.Sort(PlayerCrafting.amountAscendingComparator);
                     }
                     else
                     {
                         list.Sort(PlayerCrafting.qualityAscendingComparator);
                     }
                     array[(int)b] = list;
                     b            += 1;
                 }
                 if (blueprint.type == EBlueprintType.REPAIR)
                 {
                     List <InventorySearch> list2 = base.player.inventory.search(itemAsset.id, false, false);
                     byte b3 = byte.MaxValue;
                     byte b4 = byte.MaxValue;
                     byte b5 = 0;
                     while ((int)b5 < list2.Count)
                     {
                         if (list2[(int)b5].jar.item.quality < b3)
                         {
                             b3 = list2[(int)b5].jar.item.quality;
                             b4 = b5;
                         }
                         b5 += 1;
                     }
                     if (b4 == 255)
                     {
                         return;
                     }
                     InventorySearch inventorySearch = list2[(int)b4];
                     if (base.player.equipment.checkSelection(inventorySearch.page, inventorySearch.jar.x, inventorySearch.jar.y))
                     {
                         base.player.equipment.dequip();
                     }
                     byte b6 = 0;
                     while ((int)b6 < array.Length)
                     {
                         BlueprintSupply        blueprintSupply2 = blueprint.supplies[(int)b6];
                         List <InventorySearch> list3            = array[(int)b6];
                         byte b7 = 0;
                         while ((ushort)b7 < blueprintSupply2.amount)
                         {
                             InventorySearch inventorySearch2 = list3[(int)b7];
                             if (base.player.equipment.checkSelection(inventorySearch2.page, inventorySearch2.jar.x, inventorySearch2.jar.y))
                             {
                                 base.player.equipment.dequip();
                             }
                             this.removeItem(inventorySearch2.page, inventorySearch2.jar);
                             if (inventorySearch2.page < PlayerInventory.SLOTS)
                             {
                                 base.player.equipment.sendSlot(inventorySearch2.page);
                             }
                             b7 += 1;
                         }
                         b6 += 1;
                     }
                     base.player.inventory.sendUpdateQuality(inventorySearch.page, inventorySearch.jar.x, inventorySearch.jar.y, 100);
                     if (itemAsset.type == EItemType.REFILL && inventorySearch.jar.item.state[0] == 3)
                     {
                         inventorySearch.jar.item.state[0] = 1;
                         base.player.inventory.sendUpdateInvState(inventorySearch.page, inventorySearch.jar.x, inventorySearch.jar.y, inventorySearch.jar.item.state);
                     }
                     base.channel.send("tellCraft", ESteamCall.OWNER, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[0]);
                 }
                 else if (blueprint.type == EBlueprintType.AMMO)
                 {
                     List <InventorySearch> list4 = base.player.inventory.search(itemAsset.id, true, true);
                     int  num2 = -1;
                     byte b8   = byte.MaxValue;
                     byte b9   = 0;
                     while ((int)b9 < list4.Count)
                     {
                         if ((int)list4[(int)b9].jar.item.amount > num2 && list4[(int)b9].jar.item.amount < itemAsset.amount)
                         {
                             num2 = (int)list4[(int)b9].jar.item.amount;
                             b8   = b9;
                         }
                         b9 += 1;
                     }
                     if (b8 == 255)
                     {
                         return;
                     }
                     InventorySearch inventorySearch3 = list4[(int)b8];
                     int             num3             = (int)itemAsset.amount - num2;
                     if (base.player.equipment.checkSelection(inventorySearch3.page, inventorySearch3.jar.x, inventorySearch3.jar.y))
                     {
                         base.player.equipment.dequip();
                     }
                     List <InventorySearch> list5 = array[0];
                     byte b10 = 0;
                     while ((int)b10 < list5.Count)
                     {
                         InventorySearch inventorySearch4 = list5[(int)b10];
                         if (inventorySearch4.jar != inventorySearch3.jar)
                         {
                             if (base.player.equipment.checkSelection(inventorySearch4.page, inventorySearch4.jar.x, inventorySearch4.jar.y))
                             {
                                 base.player.equipment.dequip();
                             }
                             if ((int)inventorySearch4.jar.item.amount > num3)
                             {
                                 base.player.inventory.sendUpdateAmount(inventorySearch4.page, inventorySearch4.jar.x, inventorySearch4.jar.y, (byte)((int)inventorySearch4.jar.item.amount - num3));
                                 num3 = 0;
                                 break;
                             }
                             num3 -= (int)inventorySearch4.jar.item.amount;
                             base.player.inventory.sendUpdateAmount(inventorySearch4.page, inventorySearch4.jar.x, inventorySearch4.jar.y, 0);
                             if ((index == 0 && itemAsset.blueprints.Count > 1) || itemAsset.blueprints.Count == 1)
                             {
                                 this.removeItem(inventorySearch4.page, inventorySearch4.jar);
                                 if (inventorySearch4.page < PlayerInventory.SLOTS)
                                 {
                                     base.player.equipment.sendSlot(inventorySearch4.page);
                                 }
                             }
                             if (num3 == 0)
                             {
                                 break;
                             }
                         }
                         b10 += 1;
                     }
                     base.player.inventory.sendUpdateAmount(inventorySearch3.page, inventorySearch3.jar.x, inventorySearch3.jar.y, (byte)((int)itemAsset.amount - num3));
                     base.channel.send("tellCraft", ESteamCall.OWNER, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[0]);
                 }
                 else
                 {
                     byte b11 = 0;
                     while ((int)b11 < array.Length)
                     {
                         BlueprintSupply        blueprintSupply3 = blueprint.supplies[(int)b11];
                         List <InventorySearch> list6            = array[(int)b11];
                         byte b12 = 0;
                         while ((ushort)b12 < blueprintSupply3.amount)
                         {
                             InventorySearch inventorySearch5 = list6[(int)b12];
                             if (base.player.equipment.checkSelection(inventorySearch5.page, inventorySearch5.jar.x, inventorySearch5.jar.y))
                             {
                                 base.player.equipment.dequip();
                             }
                             this.removeItem(inventorySearch5.page, inventorySearch5.jar);
                             if (inventorySearch5.page < PlayerInventory.SLOTS)
                             {
                                 base.player.equipment.sendSlot(inventorySearch5.page);
                             }
                             b12 += 1;
                         }
                         b11 += 1;
                     }
                     byte b13 = 0;
                     while ((int)b13 < blueprint.outputs.Length)
                     {
                         BlueprintOutput blueprintOutput = blueprint.outputs[(int)b13];
                         byte            b14             = 0;
                         while ((ushort)b14 < blueprintOutput.amount)
                         {
                             if (blueprint.transferState)
                             {
                                 base.player.inventory.forceAddItem(new Item(blueprintOutput.id, array[0][0].jar.item.amount, array[0][0].jar.item.quality, array[0][0].jar.item.state), true);
                             }
                             else
                             {
                                 base.player.inventory.forceAddItem(new Item(blueprintOutput.id, EItemOrigin.CRAFT), true);
                             }
                             b14 += 1;
                         }
                         b13 += 1;
                     }
                     blueprint.applyConditions(base.player, true);
                     blueprint.grantRewards(base.player, true);
                     base.channel.send("tellCraft", ESteamCall.OWNER, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[0]);
                 }
                 if (!flag2)
                 {
                     flag2 = true;
                     base.player.sendStat(EPlayerStat.FOUND_CRAFTS);
                     if (blueprint.build != 0)
                     {
                         EffectManager.sendEffect(blueprint.build, EffectManager.SMALL, base.transform.position);
                         if (Provider.isServer)
                         {
                             AlertTool.alert(base.transform.position, 8f);
                         }
                     }
                 }
                 if (!force || blueprint.type == EBlueprintType.REPAIR || blueprint.type == EBlueprintType.AMMO)
                 {
                     return;
                 }
             }
             return;
         }
     }
 }
Esempio n. 6
0
        private static void updateSelection(Blueprint[] view, byte typeIndex, bool uncraftable, string search)
        {
            bool             flag = PowerTool.checkFires(Player.player.transform.position, 16f);
            List <Blueprint> list;

            if (view == null)
            {
                list = new List <Blueprint>();
                foreach (ItemAsset itemAsset in Assets.find(EAssetType.ITEM))
                {
                    if (itemAsset != null)
                    {
                        for (int j = 0; j < itemAsset.blueprints.Count; j++)
                        {
                            Blueprint blueprint = itemAsset.blueprints[j];
                            if ((search.Length <= 0) ? (blueprint.type == (EBlueprintType)typeIndex) : PlayerDashboardCraftingUI.searchBlueprintText(blueprint, search))
                            {
                                list.Add(blueprint);
                            }
                        }
                    }
                }
            }
            else
            {
                list = new List <Blueprint>(view);
            }
            List <Blueprint> list2 = new List <Blueprint>();

            for (int k = 0; k < list.Count; k++)
            {
                Blueprint blueprint2 = list[k];
                if (blueprint2.skill != EBlueprintSkill.REPAIR || (uint)blueprint2.level <= Provider.modeConfigData.Gameplay.Repair_Level_Max)
                {
                    if (string.IsNullOrEmpty(blueprint2.map) || blueprint2.map.Equals(Level.info.name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, blueprint2.source);
                        ushort    num        = 0;
                        bool      flag2      = true;
                        blueprint2.hasSupplies = true;
                        blueprint2.hasSkills   = (blueprint2.skill == EBlueprintSkill.NONE || (blueprint2.skill == EBlueprintSkill.CRAFT && Player.player.skills.skills[2][1].level >= blueprint2.level) || (blueprint2.skill == EBlueprintSkill.COOK && flag && Player.player.skills.skills[2][3].level >= blueprint2.level) || (blueprint2.skill == EBlueprintSkill.REPAIR && Player.player.skills.skills[2][7].level >= blueprint2.level));
                        List <InventorySearch>[] array2 = new List <InventorySearch> [blueprint2.supplies.Length];
                        byte b = 0;
                        while ((int)b < blueprint2.supplies.Length)
                        {
                            BlueprintSupply        blueprintSupply = blueprint2.supplies[(int)b];
                            List <InventorySearch> list3           = Player.player.inventory.search(blueprintSupply.id, false, true);
                            ushort num2 = 0;
                            byte   b2   = 0;
                            while ((int)b2 < list3.Count)
                            {
                                num2 += (ushort)list3[(int)b2].jar.item.amount;
                                b2   += 1;
                            }
                            num += num2;
                            blueprintSupply.hasAmount = num2;
                            if (blueprint2.type == EBlueprintType.AMMO)
                            {
                                if (blueprintSupply.hasAmount == 0)
                                {
                                    blueprint2.hasSupplies = false;
                                }
                            }
                            else if (blueprintSupply.hasAmount < blueprintSupply.amount)
                            {
                                blueprint2.hasSupplies = false;
                            }
                            if (blueprintSupply.hasAmount < blueprintSupply.amount && blueprintSupply.isCritical)
                            {
                                flag2 = false;
                            }
                            array2[(int)b] = list3;
                            b += 1;
                        }
                        if (blueprint2.tool != 0)
                        {
                            InventorySearch inventorySearch = Player.player.inventory.has(blueprint2.tool);
                            blueprint2.tools   = ((inventorySearch == null) ? 0 : 1);
                            blueprint2.hasTool = (inventorySearch != null);
                            if (inventorySearch == null && blueprint2.toolCritical)
                            {
                                flag2 = false;
                            }
                        }
                        else
                        {
                            blueprint2.tools   = 1;
                            blueprint2.hasTool = true;
                        }
                        if (!flag2)
                        {
                            num = 0;
                        }
                        if (blueprint2.type == EBlueprintType.REPAIR)
                        {
                            List <InventorySearch> list4 = Player.player.inventory.search(itemAsset2.id, false, false);
                            byte b3 = byte.MaxValue;
                            byte b4 = byte.MaxValue;
                            byte b5 = 0;
                            while ((int)b5 < list4.Count)
                            {
                                if (list4[(int)b5].jar.item.quality < b3)
                                {
                                    b3 = list4[(int)b5].jar.item.quality;
                                    b4 = b5;
                                }
                                b5 += 1;
                            }
                            if (b4 != 255)
                            {
                                blueprint2.items = (ushort)list4[(int)b4].jar.item.quality;
                                num += 1;
                            }
                            else
                            {
                                blueprint2.items = 0;
                            }
                            blueprint2.hasItem = (b4 != byte.MaxValue);
                        }
                        else if (blueprint2.type == EBlueprintType.AMMO)
                        {
                            List <InventorySearch> list5 = Player.player.inventory.search(itemAsset2.id, true, true);
                            int  num3 = -1;
                            byte b6   = byte.MaxValue;
                            byte b7   = 0;
                            while ((int)b7 < list5.Count)
                            {
                                if ((int)list5[(int)b7].jar.item.amount > num3 && list5[(int)b7].jar.item.amount < itemAsset2.amount)
                                {
                                    num3 = (int)list5[(int)b7].jar.item.amount;
                                    b6   = b7;
                                }
                                b7 += 1;
                            }
                            if (b6 != 255)
                            {
                                if (list5[(int)b6].jar.item.id == blueprint2.supplies[0].id)
                                {
                                    BlueprintSupply blueprintSupply2 = blueprint2.supplies[0];
                                    blueprintSupply2.hasAmount -= (ushort)num3;
                                }
                                blueprint2.supplies[0].amount = (ushort)((byte)((int)itemAsset2.amount - num3));
                                blueprint2.items = (ushort)list5[(int)b6].jar.item.amount;
                                num += 1;
                            }
                            else
                            {
                                blueprint2.supplies[0].amount = 0;
                                blueprint2.items = 0;
                            }
                            blueprint2.hasItem = (b6 != byte.MaxValue);
                            if (b6 == 255)
                            {
                                blueprint2.products = 0;
                            }
                            else if (blueprint2.items + blueprint2.supplies[0].hasAmount > (ushort)itemAsset2.amount)
                            {
                                blueprint2.products = (ushort)itemAsset2.amount;
                            }
                            else
                            {
                                blueprint2.products = blueprint2.items + blueprint2.supplies[0].hasAmount;
                            }
                        }
                        else
                        {
                            blueprint2.hasItem = true;
                        }
                        if (uncraftable)
                        {
                            if (blueprint2.hasSupplies && blueprint2.hasTool && blueprint2.hasItem && blueprint2.hasSkills)
                            {
                                list2.Add(blueprint2);
                            }
                        }
                        else if (view != null)
                        {
                            if (blueprint2.hasSupplies && blueprint2.hasTool && blueprint2.hasItem && blueprint2.hasSkills)
                            {
                                list2.Insert(0, blueprint2);
                            }
                            else
                            {
                                list2.Add(blueprint2);
                            }
                        }
                        else if (blueprint2.hasSupplies && blueprint2.hasTool && blueprint2.hasItem && blueprint2.hasSkills)
                        {
                            list2.Insert(0, blueprint2);
                        }
                        else if ((blueprint2.type == EBlueprintType.AMMO || blueprint2.type == EBlueprintType.REPAIR || num != 0) && blueprint2.hasItem)
                        {
                            list2.Add(blueprint2);
                        }
                    }
                }
            }
            PlayerDashboardCraftingUI.viewBlueprints  = view;
            PlayerDashboardCraftingUI.selectedType    = typeIndex;
            PlayerDashboardCraftingUI.hideUncraftable = uncraftable;
            PlayerDashboardCraftingUI.searchText      = search;
            PlayerDashboardCraftingUI.blueprints      = list2.ToArray();
            PlayerDashboardCraftingUI.blueprintsScrollBox.remove();
            PlayerDashboardCraftingUI.blueprintsScrollBox.area = new Rect(0f, 0f, 5f, (float)(PlayerDashboardCraftingUI.blueprints.Length * 205 - 10));
            for (int l = 0; l < PlayerDashboardCraftingUI.blueprints.Length; l++)
            {
                Blueprint      newBlueprint   = PlayerDashboardCraftingUI.blueprints[l];
                SleekBlueprint sleekBlueprint = new SleekBlueprint(newBlueprint);
                sleekBlueprint.positionOffset_Y = l * 205;
                sleekBlueprint.sizeOffset_X     = -30;
                sleekBlueprint.sizeOffset_Y     = 195;
                sleekBlueprint.sizeScale_X      = 1f;
                SleekButton sleekButton = sleekBlueprint;
                if (PlayerDashboardCraftingUI.< > f__mg$cache0 == null)
                {
                    PlayerDashboardCraftingUI.< > f__mg$cache0 = new ClickedButton(PlayerDashboardCraftingUI.onClickedBlueprintButton);
                }
                sleekButton.onClickedButton = PlayerDashboardCraftingUI.< > f__mg$cache0;
                PlayerDashboardCraftingUI.blueprintsScrollBox.add(sleekBlueprint);
            }
            PlayerDashboardCraftingUI.infoBox.isVisible = (PlayerDashboardCraftingUI.blueprints.Length == 0);
        }
Esempio n. 7
0
        public SleekBlueprint(Blueprint newBlueprint)
        {
            this._blueprint = newBlueprint;
            base.init();
            this.fontStyle     = 1;
            this.fontAlignment = 4;
            this.fontSize      = SleekRender.FONT_SIZE;
            this.calculateContent();
            SleekLabel sleekLabel = new SleekLabel();

            sleekLabel.positionOffset_X = 5;
            sleekLabel.positionOffset_Y = 5;
            sleekLabel.sizeOffset_X     = -10;
            sleekLabel.sizeOffset_Y     = 30;
            sleekLabel.sizeScale_X      = 1f;
            sleekLabel.foregroundColor  = ((!this.blueprint.hasSupplies || !this.blueprint.hasTool || !this.blueprint.hasItem || !this.blueprint.hasSkills) ? Palette.COLOR_R : Palette.COLOR_G);
            sleekLabel.foregroundTint   = ESleekTint.NONE;
            sleekLabel.fontSize         = 14;
            base.add(sleekLabel);
            if (this.blueprint.skill != EBlueprintSkill.NONE)
            {
                base.add(new SleekLabel
                {
                    positionOffset_X = 5,
                    positionOffset_Y = -35,
                    positionScale_Y  = 1f,
                    sizeOffset_X     = -10,
                    sizeOffset_Y     = 30,
                    sizeScale_X      = 1f,
                    text             = PlayerDashboardCraftingUI.localization.format("Skill_" + (int)this.blueprint.skill, new object[]
                    {
                        PlayerDashboardSkillsUI.localization.format("Level_" + this.blueprint.level)
                    }),
                    foregroundColor = ((!this.blueprint.hasSkills) ? Palette.COLOR_R : Palette.COLOR_G),
                    foregroundTint  = ESleekTint.NONE,
                    fontSize        = 14
                });
            }
            Sleek sleek = new Sleek();

            sleek.positionOffset_Y = 40;
            sleek.positionScale_X  = 0.5f;
            sleek.sizeOffset_Y     = -45;
            sleek.sizeScale_Y      = 1f;
            base.add(sleek);
            int num = 0;

            for (int i = 0; i < this.blueprint.supplies.Length; i++)
            {
                BlueprintSupply blueprintSupply = this.blueprint.supplies[i];
                ItemAsset       itemAsset       = (ItemAsset)Assets.find(EAssetType.ITEM, blueprintSupply.id);
                if (itemAsset != null)
                {
                    SleekLabel sleekLabel2 = sleekLabel;
                    sleekLabel2.text += itemAsset.itemName;
                    SleekImageTexture sleekImageTexture = new SleekImageTexture();
                    sleekImageTexture.positionOffset_X = num;
                    sleekImageTexture.positionOffset_Y = (int)(-itemAsset.size_y * 25);
                    sleekImageTexture.positionScale_Y  = 0.5f;
                    sleekImageTexture.sizeOffset_X     = (int)(itemAsset.size_x * 50);
                    sleekImageTexture.sizeOffset_Y     = (int)(itemAsset.size_y * 50);
                    sleek.add(sleekImageTexture);
                    ItemTool.getIcon(blueprintSupply.id, 100, itemAsset.getState(false), itemAsset, new ItemIconReady(sleekImageTexture.updateTexture));
                    SleekLabel sleekLabel3 = new SleekLabel();
                    sleekLabel3.positionOffset_X = -100;
                    sleekLabel3.positionOffset_Y = -30;
                    sleekLabel3.positionScale_Y  = 1f;
                    sleekLabel3.sizeOffset_X     = 100;
                    sleekLabel3.sizeOffset_Y     = 30;
                    sleekLabel3.sizeScale_X      = 1f;
                    sleekLabel3.foregroundTint   = ESleekTint.NONE;
                    sleekLabel3.fontAlignment    = 5;
                    sleekLabel3.text             = blueprintSupply.hasAmount + "/" + blueprintSupply.amount;
                    sleekImageTexture.add(sleekLabel3);
                    SleekLabel sleekLabel4 = sleekLabel;
                    string     text        = sleekLabel4.text;
                    sleekLabel4.text = string.Concat(new object[]
                    {
                        text,
                        " ",
                        blueprintSupply.hasAmount,
                        "/",
                        blueprintSupply.amount
                    });
                    if (this.blueprint.type == EBlueprintType.AMMO)
                    {
                        if (blueprintSupply.hasAmount == 0 || blueprintSupply.amount == 0)
                        {
                            sleekLabel3.backgroundColor = Palette.COLOR_R;
                            sleekLabel3.foregroundColor = Palette.COLOR_R;
                        }
                    }
                    else if (blueprintSupply.hasAmount < blueprintSupply.amount)
                    {
                        sleekLabel3.backgroundColor = Palette.COLOR_R;
                        sleekLabel3.foregroundColor = Palette.COLOR_R;
                    }
                    num += (int)(itemAsset.size_x * 50 + 25);
                    if (i < this.blueprint.supplies.Length - 1 || this.blueprint.tool != 0 || this.blueprint.type == EBlueprintType.REPAIR || this.blueprint.type == EBlueprintType.AMMO)
                    {
                        SleekLabel sleekLabel5 = sleekLabel;
                        sleekLabel5.text += " + ";
                        sleek.add(new SleekImageTexture((Texture2D)PlayerDashboardCraftingUI.icons.load("Plus"))
                        {
                            positionOffset_X = num,
                            positionOffset_Y = -20,
                            positionScale_Y  = 0.5f,
                            sizeOffset_X     = 40,
                            sizeOffset_Y     = 40,
                            backgroundTint   = ESleekTint.FOREGROUND
                        });
                        num += 65;
                    }
                }
            }
            if (this.blueprint.tool != 0)
            {
                ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, this.blueprint.tool);
                if (itemAsset2 != null)
                {
                    SleekLabel sleekLabel6 = sleekLabel;
                    sleekLabel6.text += itemAsset2.itemName;
                    SleekImageTexture sleekImageTexture2 = new SleekImageTexture();
                    sleekImageTexture2.positionOffset_X = num;
                    sleekImageTexture2.positionOffset_Y = (int)(-itemAsset2.size_y * 25);
                    sleekImageTexture2.positionScale_Y  = 0.5f;
                    sleekImageTexture2.sizeOffset_X     = (int)(itemAsset2.size_x * 50);
                    sleekImageTexture2.sizeOffset_Y     = (int)(itemAsset2.size_y * 50);
                    sleek.add(sleekImageTexture2);
                    ItemTool.getIcon(this.blueprint.tool, 100, itemAsset2.getState(), itemAsset2, new ItemIconReady(sleekImageTexture2.updateTexture));
                    SleekLabel sleekLabel7 = new SleekLabel();
                    sleekLabel7.positionOffset_X = -100;
                    sleekLabel7.positionOffset_Y = -30;
                    sleekLabel7.positionScale_Y  = 1f;
                    sleekLabel7.sizeOffset_X     = 100;
                    sleekLabel7.sizeOffset_Y     = 30;
                    sleekLabel7.sizeScale_X      = 1f;
                    sleekLabel7.foregroundTint   = ESleekTint.NONE;
                    sleekLabel7.fontAlignment    = 5;
                    sleekLabel7.text             = this.blueprint.tools + "/1";
                    sleekImageTexture2.add(sleekLabel7);
                    SleekLabel sleekLabel8 = sleekLabel;
                    string     text        = sleekLabel8.text;
                    sleekLabel8.text = string.Concat(new object[]
                    {
                        text,
                        " ",
                        this.blueprint.tools,
                        "/1"
                    });
                    if (!this.blueprint.hasTool)
                    {
                        sleekLabel7.backgroundColor = Palette.COLOR_R;
                        sleekLabel7.foregroundColor = Palette.COLOR_R;
                    }
                    num += (int)(itemAsset2.size_x * 50 + 25);
                    if (this.blueprint.type == EBlueprintType.REPAIR || this.blueprint.type == EBlueprintType.AMMO)
                    {
                        SleekLabel sleekLabel9 = sleekLabel;
                        sleekLabel9.text += " + ";
                        sleek.add(new SleekImageTexture((Texture2D)PlayerDashboardCraftingUI.icons.load("Plus"))
                        {
                            positionOffset_X = num,
                            positionOffset_Y = -20,
                            positionScale_Y  = 0.5f,
                            sizeOffset_X     = 40,
                            sizeOffset_Y     = 40,
                            backgroundTint   = ESleekTint.FOREGROUND
                        });
                        num += 65;
                    }
                }
            }
            if (this.blueprint.type == EBlueprintType.REPAIR || this.blueprint.type == EBlueprintType.AMMO)
            {
                ItemAsset itemAsset3 = (ItemAsset)Assets.find(EAssetType.ITEM, this.blueprint.outputs[0].id);
                if (itemAsset3 != null)
                {
                    SleekLabel sleekLabel10 = sleekLabel;
                    sleekLabel10.text += itemAsset3.itemName;
                    SleekImageTexture sleekImageTexture3 = new SleekImageTexture();
                    sleekImageTexture3.positionOffset_X = num;
                    sleekImageTexture3.positionOffset_Y = (int)(-itemAsset3.size_y * 25);
                    sleekImageTexture3.positionScale_Y  = 0.5f;
                    sleekImageTexture3.sizeOffset_X     = (int)(itemAsset3.size_x * 50);
                    sleekImageTexture3.sizeOffset_Y     = (int)(itemAsset3.size_y * 50);
                    sleek.add(sleekImageTexture3);
                    ItemTool.getIcon(this.blueprint.outputs[0].id, 100, itemAsset3.getState(), itemAsset3, new ItemIconReady(sleekImageTexture3.updateTexture));
                    SleekLabel sleekLabel11 = new SleekLabel();
                    sleekLabel11.positionOffset_X = -100;
                    sleekLabel11.positionOffset_Y = -30;
                    sleekLabel11.positionScale_Y  = 1f;
                    sleekLabel11.sizeOffset_X     = 100;
                    sleekLabel11.sizeOffset_Y     = 30;
                    sleekLabel11.sizeScale_X      = 1f;
                    sleekLabel11.foregroundTint   = ESleekTint.NONE;
                    sleekLabel11.fontAlignment    = 5;
                    if (this.blueprint.type == EBlueprintType.REPAIR)
                    {
                        SleekLabel sleekLabel12 = sleekLabel;
                        string     text         = sleekLabel12.text;
                        sleekLabel12.text = string.Concat(new object[]
                        {
                            text,
                            " ",
                            this.blueprint.items,
                            "%"
                        });
                        sleekLabel11.text            = this.blueprint.items + "%";
                        sleekLabel11.backgroundColor = ItemTool.getQualityColor((float)this.blueprint.items / 100f);
                        sleekLabel11.foregroundColor = sleekLabel11.backgroundColor;
                    }
                    else if (this.blueprint.type == EBlueprintType.AMMO)
                    {
                        SleekLabel sleekLabel13 = sleekLabel;
                        string     text         = sleekLabel13.text;
                        sleekLabel13.text = string.Concat(new object[]
                        {
                            text,
                            " ",
                            this.blueprint.items,
                            "/",
                            this.blueprint.products
                        });
                        sleekLabel11.text = this.blueprint.items + "/" + itemAsset3.amount;
                    }
                    if (!this.blueprint.hasItem)
                    {
                        sleekLabel11.backgroundColor = Palette.COLOR_R;
                        sleekLabel11.foregroundColor = Palette.COLOR_R;
                    }
                    sleekImageTexture3.add(sleekLabel11);
                    num += (int)(itemAsset3.size_x * 50 + 25);
                }
            }
            SleekLabel sleekLabel14 = sleekLabel;

            sleekLabel14.text += " = ";
            sleek.add(new SleekImageTexture((Texture2D)PlayerDashboardCraftingUI.icons.load("Equals"))
            {
                positionOffset_X = num,
                positionOffset_Y = -20,
                positionScale_Y  = 0.5f,
                sizeOffset_X     = 40,
                sizeOffset_Y     = 40,
                backgroundTint   = ESleekTint.FOREGROUND
            });
            num += 65;
            for (int j = 0; j < this.blueprint.outputs.Length; j++)
            {
                BlueprintOutput blueprintOutput = this.blueprint.outputs[j];
                ItemAsset       itemAsset4      = (ItemAsset)Assets.find(EAssetType.ITEM, blueprintOutput.id);
                if (itemAsset4 != null)
                {
                    SleekLabel sleekLabel15 = sleekLabel;
                    sleekLabel15.text += itemAsset4.itemName;
                    SleekImageTexture sleekImageTexture4 = new SleekImageTexture();
                    sleekImageTexture4.positionOffset_X = num;
                    sleekImageTexture4.positionOffset_Y = (int)(-itemAsset4.size_y * 25);
                    sleekImageTexture4.positionScale_Y  = 0.5f;
                    sleekImageTexture4.sizeOffset_X     = (int)(itemAsset4.size_x * 50);
                    sleekImageTexture4.sizeOffset_Y     = (int)(itemAsset4.size_y * 50);
                    sleek.add(sleekImageTexture4);
                    ItemTool.getIcon(blueprintOutput.id, 100, itemAsset4.getState(), itemAsset4, new ItemIconReady(sleekImageTexture4.updateTexture));
                    SleekLabel sleekLabel16 = new SleekLabel();
                    sleekLabel16.positionOffset_X = -100;
                    sleekLabel16.positionOffset_Y = -30;
                    sleekLabel16.positionScale_Y  = 1f;
                    sleekLabel16.sizeOffset_X     = 100;
                    sleekLabel16.sizeOffset_Y     = 30;
                    sleekLabel16.sizeScale_X      = 1f;
                    sleekLabel16.foregroundTint   = ESleekTint.NONE;
                    sleekLabel16.fontAlignment    = 5;
                    if (this.blueprint.type == EBlueprintType.REPAIR)
                    {
                        SleekLabel sleekLabel17 = sleekLabel;
                        sleekLabel17.text           += " 100%";
                        sleekLabel16.text            = "100%";
                        sleekLabel16.backgroundColor = Palette.COLOR_G;
                        sleekLabel16.foregroundColor = Palette.COLOR_G;
                    }
                    else if (this.blueprint.type == EBlueprintType.AMMO)
                    {
                        ItemAsset itemAsset5 = (ItemAsset)Assets.find(EAssetType.ITEM, blueprintOutput.id);
                        if (itemAsset5 != null)
                        {
                            SleekLabel sleekLabel18 = sleekLabel;
                            string     text         = sleekLabel18.text;
                            sleekLabel18.text = string.Concat(new object[]
                            {
                                text,
                                " ",
                                this.blueprint.products,
                                "/",
                                itemAsset5.amount
                            });
                            sleekLabel16.text = this.blueprint.products + "/" + itemAsset5.amount;
                        }
                    }
                    else
                    {
                        SleekLabel sleekLabel19 = sleekLabel;
                        sleekLabel19.text = sleekLabel19.text + " x" + blueprintOutput.amount;
                        sleekLabel16.text = "x" + blueprintOutput.amount.ToString();
                    }
                    sleekImageTexture4.add(sleekLabel16);
                    num += (int)(itemAsset4.size_x * 50);
                    if (j < this.blueprint.outputs.Length - 1)
                    {
                        num += 25;
                        SleekLabel sleekLabel20 = sleekLabel;
                        sleekLabel20.text += " + ";
                        sleek.add(new SleekImageTexture((Texture2D)PlayerDashboardCraftingUI.icons.load("Plus"))
                        {
                            positionOffset_X = num,
                            positionOffset_Y = -20,
                            positionScale_Y  = 0.5f,
                            sizeOffset_X     = 40,
                            sizeOffset_Y     = 40,
                            backgroundTint   = ESleekTint.FOREGROUND
                        });
                        num += 65;
                    }
                }
            }
            sleek.positionOffset_X = -num / 2;
            sleek.sizeOffset_X     = num;
            base.tooltip           = sleekLabel.text;
            this.foregroundTint    = ESleekTint.NONE;
            base.foregroundColor   = sleekLabel.foregroundColor;
        }