The relevant UESP page of Daggerfall items provides good concepts on how to make such judgements, but the maths and numbers are off and do not seem to reflect the true weight or price of Daggerfall items, making the provided tables and formulae unreliable.
I decided to have a look at the source files to get a better understanding of how the weight and prices are calculated. ItemTemplates.txt reveals the base weight and base price for every Daggerfall item. These values, particularly in relation to weapons and armour, are further modified in respect to the material of the weapon or armour.
ItemBuilder.cs provides the rest of the information on how the material calculations are made:
Code: Select all
// Weight multipliers by material type. Iron through Daedric. Weight is baseWeight * value / 4.
static readonly short[] weightMultipliersByMaterial = { 4, 5, 4, 4, 3, 4, 4, 2, 4, 5 };
// Value multipliers by material type. Iron through Daedric. Value is baseValue * ( 3 * value).
static readonly short[] valueMultipliersByMaterial = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
Code: Select all
/// <summary>
/// Sets properties for a weapon or piece of armor based on its material.
/// </summary>
/// <param name="item">Item to have its properties modified.</param>
/// <param name="material">Material to use to apply properties.</param>
/// <returns>DaggerfallUnityItem</returns>
public static DaggerfallUnityItem SetItemPropertiesByMaterial(DaggerfallUnityItem item, WeaponMaterialTypes material)
{
item.value *= 3 * valueMultipliersByMaterial[(int)material];
item.weightInKg = CalculateWeightForMaterial(item, material);
item.maxCondition = item.maxCondition * conditionMultipliersByMaterial[(int)material] / 4;
item.currentCondition = item.maxCondition;
return item;
}
static float CalculateWeightForMaterial(DaggerfallUnityItem item, WeaponMaterialTypes material)
{
int quarterKgs = (int)(item.weightInKg * 4);
float matQuarterKgs = (float)(quarterKgs * weightMultipliersByMaterial[(int)material]) / 4;
return Mathf.Round(matQuarterKgs) / 4;
}
(All calculations seem to be rounded to the nearest two decimal places.)
- Take the item base weight
- Multiply it by 4 (value is type int)
- Multiply this by the material weight multiplier
- Divide this by 4 (value is type float)
- Round to the nearest whole number (nearest even number if ending in .5, as per the functionality of Mathf.Round())
- Divide this by 4
Code: Select all
/// <summary>Set material and adjust armor stats accordingly</summary>
public static void ApplyArmorMaterial(DaggerfallUnityItem armor, ArmorMaterialTypes material)
{
armor.nativeMaterialValue = (int)material;
if (armor.nativeMaterialValue == (int)ArmorMaterialTypes.Leather)
{
armor.weightInKg /= 2;
}
else if (armor.nativeMaterialValue == (int)ArmorMaterialTypes.Chain)
{
armor.value *= 2;
}
else if (armor.nativeMaterialValue >= (int)ArmorMaterialTypes.Iron)
{
int plateMaterial = armor.nativeMaterialValue - 0x0200;
armor = SetItemPropertiesByMaterial(armor, (WeaponMaterialTypes)plateMaterial);
}
armor.dyeColor = DaggerfallUnity.Instance.ItemHelper.GetArmorDyeColor(material);
}
Overall, the weight calculations largely seem to match up with the weight values on loot in the game (mind that I haven't progressed beyond Privateer's Hold, the initial dungeon). However, some items don't match with the expected weight:
- The iron wakazashi weighs 2.25 kg but the expected weight is 2 kg.
- The iron shortsword weighs 2 kg but the expected weight is 2.5 kg.
- The steel shortsword weighs 2.5 kg but the expected weight is 3 kg.
- The silver wakazashi weighs 2.25 kg but the expected weight is 2 kg.
I'm wondering if my own calculations or formula is off or perhaps there are more elements in the code that I have missed causing the actual values to be different?