public static string GetRandomMountKey(ItemObject mountItem, int randomSeed)
        {
            Random random = new Random(randomSeed);

            if (mountItem == null)
            {
                return(new MountCreationKey((byte)random.Next(4), (byte)random.Next(4), (byte)random.Next(4), (byte)random.Next(4), (byte)0, (byte)0).ToString());
            }
            HorseComponent horseComponent = mountItem.HorseComponent;

            if (horseComponent.HorseMaterialNames == null || horseComponent.HorseMaterialNames.Count <= 0)
            {
                return(new MountCreationKey((byte)MBRandom.RandomInt(4), (byte)MBRandom.RandomInt(4), (byte)MBRandom.RandomInt(4), (byte)MBRandom.RandomInt(4), (byte)0, (byte)0).ToString());
            }
            int   index1 = random.Next(horseComponent.HorseMaterialNames.Count);
            float num1   = random.NextFloat();
            int   num2   = 0;
            float num3   = 0.0f;

            HorseComponent.MaterialProperty horseMaterialName = horseComponent.HorseMaterialNames[index1];
            for (int index2 = 0; index2 < horseMaterialName.MeshMultiplier.Count; ++index2)
            {
                num3 += horseMaterialName.MeshMultiplier[index2].Item2;
                if ((double)num1 <= (double)num3)
                {
                    num2 = index2;
                    break;
                }
            }
            return(new MountCreationKey((byte)random.Next(4), (byte)random.Next(4), (byte)random.Next(4), (byte)random.Next(4), (byte)index1, (byte)num2).ToString());
        }
        public TextObject GetModifiedItemName()
        {
            if (this.ItemModifier == null)
            {
                return(this.Item.Name);
            }
            HorseComponent horseComponent = this.Item.HorseComponent;
            TextObject     textObject;

            if (!TextObject.IsNullOrEmpty(horseComponent?.ModifiedName) && this.ItemModifier == null)
            {
                textObject = horseComponent.ModifiedName;
            }
            else
            {
                textObject = this.ItemModifier.Name;
                textObject.SetTextVariable("ITEMNAME", this.Item.Name);
            }
            return(textObject);
        }
Example #3
0
 private float CalculateHorseTier(HorseComponent horseComponent) => (float)((horseComponent.IsPackAnimal ? 25.0 : 0.0 + 0.600000023841858 * (double)horseComponent.Maneuver + (double)horseComponent.Speed + 1.5 * (double)horseComponent.ChargeDamage + 0.100000001490116 * (double)horseComponent.HitPoints) / 13.0 - 8.0);