Exemplo n.º 1
0
 public BlueprintMaterial( BlueprintMaterial baseMaterial )
     : base(baseMaterial)
 {
     Quantity = baseMaterial.Quantity;
     Damage = baseMaterial.Damage;
     IsAdditional = baseMaterial.IsAdditional;
 }
        public Blueprint GetBlueprint(int invTypeId)
        {
            var invBlueprintType = Cached.InvBlueprintTypes.Item.First(x => x.Value.ProductTypeId == invTypeId).Value; // Inv Blueprint
            var blueprint = new Blueprint(invBlueprintType); // Blueprint

            blueprint.Materials = new List<BlueprintMaterial>();

            // Main
            var invMaterials = Cached.InvTypeMaterials.Item.Where(x => x.TypeId == invTypeId); // Inv Materials
            foreach (var invTypeMaterial in invMaterials)
            {
                var materialTypeId = Cached.InvTypes.Item.First(x => x.Value.Id == invTypeMaterial.MaterialTypeId).Value;
                var blueprintMaterial = new BlueprintMaterial(materialTypeId);
                blueprintMaterial.Quantity = invTypeMaterial.Quantity;
                blueprintMaterial.Damage = 1; // full destroy
                blueprint.Materials.Add(new BlueprintMaterial(blueprintMaterial));
            }

            // Additional
            var invRamReqs = Cached.RamTypeRequirements.Item.Where(x => x.TypeId == blueprint.Id && x.ActivityId == 1);
            var skillGroups = Cached.InvGroups.Item.Where(x => x.Value.CategoryId == 16).Select(t=>t.Key).ToList();
            foreach (var invRamReq in invRamReqs)
            {
                var materialTypeId = Cached.InvTypes.Item.First(x => x.Value.Id == invRamReq.RequiredTypeId).Value;

                // Skip skills
                if (materialTypeId.GroupId.HasValue && skillGroups.Contains(materialTypeId.GroupId.Value))
                    continue;

                var blueprintMaterial = new BlueprintMaterial(materialTypeId);
                blueprintMaterial.Quantity = invRamReq.Quantity.HasValue ? invRamReq.Quantity.Value : 0;
                blueprintMaterial.Damage = invRamReq.DamagePerJob.HasValue ? invRamReq.DamagePerJob.Value : 0;
                blueprint.Materials.Add(new BlueprintMaterial(blueprintMaterial));
            }

            return blueprint;
        }