public Blueprint(ushort newSource, byte newID, EBlueprintType newType, BlueprintSupply[] newSupplies, BlueprintOutput[] newOutputs, ushort newTool, bool newToolCritical, ushort newBuild, byte newLevel, EBlueprintSkill newSkill, bool newTransferState, string newMap) { this._source = newSource; this._id = newID; this._type = newType; this._supplies = newSupplies; this._outputs = newOutputs; this._tool = newTool; this._toolCritical = newToolCritical; this._build = newBuild; this._level = newLevel; this._skill = newSkill; this._transferState = newTransferState; this.map = newMap; this.hasSupplies = false; this.hasTool = false; this.tools = 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"); } }
// 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"); }