Пример #1
0
        internal static void InitCraftedItemObject(
            ref ItemObject itemObject,
            TextObject name,
            BasicCultureObject culture,
            ItemFlags itemProperties,
            float weight,
            float appearance,
            WeaponDesign craftedData)
        {
            BladeData bladeData = craftedData.UsedPieces[0].CraftingPiece.BladeData;

            itemObject.Weight                    = weight;
            itemObject.Name                      = name;
            itemObject.MultiMeshName             = "";
            itemObject.HolsterMeshName           = "";
            itemObject.HolsterWithWeaponMeshName = "";
            itemObject.ItemHolsters              = (string[])craftedData.Template.ItemHolsters.Clone();
            itemObject.HolsterPositionShift      = craftedData.HolsterShiftAmount;
            itemObject.FlyingMeshName            = "";
            itemObject.BodyName                  = bladeData?.BodyName;
            itemObject.HolsterBodyName           = bladeData?.HolsterBodyName ?? bladeData?.BodyName;
            itemObject.CollisionBodyName         = "";
            itemObject.RecalculateBody           = true;
            itemObject.Culture                   = culture;
            itemObject.Difficulty                = 0;
            itemObject.ScaleFactor               = 1f;
            itemObject.Type                      = WeaponComponentData.GetItemTypeFromWeaponClass(craftedData.Template.WeaponUsageDatas.First <WeaponUsageData>().WeaponClass);
            itemObject.ItemFlags                 = itemProperties;
            itemObject.Appearance                = appearance;
            itemObject.WeaponDesign              = craftedData;
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            WeaponDesign weaponDesign = obj as WeaponDesign;

            return((object)weaponDesign != null && this.HashedCode == weaponDesign.HashedCode && this.WeaponName == weaponDesign.WeaponName);
        }
Пример #3
0
 public WeaponDesign(WeaponDesign other)
 {
     this.Template             = other.Template;
     this._usedPieces          = ((IEnumerable <WeaponDesignElement>)other._usedPieces).ToArray <WeaponDesignElement>();
     this.WeaponName           = other.WeaponName.ToString();
     this._piecePivotDistances = new float[this._usedPieces.Length];
     this.CalculatePivotDistances();
     this.CraftedWeaponLength = this.CalculateWeaponLength();
     this.HolsterShiftAmount  = this.CalculateHolsterShiftAmount();
 }
Пример #4
0
        private float CalculateWeaponTier(WeaponComponent weaponComponent)
        {
            WeaponDesign weaponDesign = weaponComponent.Item?.WeaponDesign;

            if (!(weaponDesign != (WeaponDesign)null))
            {
                return(this.CalculateTierNonCraftedWeapon(weaponComponent));
            }
            float tierCraftedWeapon = this.CalculateTierCraftedWeapon(weaponDesign);

            return((float)(0.600000023841858 * (double)this.CalculateTierMeleeWeapon(weaponComponent) + 0.400000005960464 * (double)tierCraftedWeapon));
        }
Пример #5
0
        private float CalculateTierCraftedWeapon(WeaponDesign craftingData)
        {
            int num1 = 0;
            int num2 = 0;
            int num3 = 0;
            int num4 = 0;

            foreach (WeaponDesignElement usedPiece in craftingData.UsedPieces)
            {
                if (usedPiece.CraftingPiece.IsValid)
                {
                    num1 += usedPiece.CraftingPiece.PieceTier;
                    ++num2;
                    foreach ((CraftingMaterials craftingMaterials3, int num8) in (IEnumerable <(CraftingMaterials, int)>)usedPiece.CraftingPiece.MaterialsUsed)
                    {
                        int temp_40;
                        switch (craftingMaterials3)
                        {
                        case CraftingMaterials.Iron1:
                            temp_40 = 1;
                            break;

                        case CraftingMaterials.Iron2:
                            temp_40 = 2;
                            break;

                        case CraftingMaterials.Iron3:
                            temp_40 = 3;
                            break;

                        case CraftingMaterials.Iron4:
                            temp_40 = 4;
                            break;

                        case CraftingMaterials.Iron5:
                            temp_40 = 5;
                            break;

                        case CraftingMaterials.Iron6:
                            temp_40 = 6;
                            break;

                        case CraftingMaterials.Wood:
                            temp_40 = -1;
                            break;

                        default:
                            temp_40 = -1;
                            break;
                        }
                        int local_10 = temp_40;
                        if (local_10 >= 0)
                        {
                            num3 += num8 * local_10;
                            num4 += num8;
                        }
                    }
                }
            }
            if (num4 > 0 && num2 > 0)
            {
                return((float)(0.400000005960464 * (double)(1.25f * (float)num1 / (float)num2) + 0.600000023841858 * ((double)num3 * 1.29999995231628 / ((double)num4 + 0.600000023841858) - 1.29999995231628)));
            }
            return(num2 > 0 ? (float)num1 / (float)num2 : 0.1f);
        }