I'm writing this up because UOSA was the main reason I spent time looking into this, and all this info was researched from the demo which wouldn't have been possible without Derrick, Kaivan, Batlin and others who worked to make the UO98 project a reality. I'd have posted it over at JoinUO.net/UO98, but those forums have long since gone down. This has also been a long running topic on the UOSA forums, so who better to share this info with? I spent lots of time working on the demo the last few days and added numerous modifications in the GM cheat script to adjust various item properties, in an attempt to crack the formula for item values.
Warning: incoming WALL OF TEXT!
To start with I wrote scripts that could do the following in the demo:
- Adjust the damage of a weapon
- Adjust the max and current hit points of weapons.
- Create items that are techically made from "nothing" (they have no metal/resource in them).
- Generate mass resources/gold for further testing.
- Report the current value of the item by use of the core function "getValue" - which is the one used by ItemID.
- Report on other properties of the item, such as damage, armor value, current/max hit points, speed, etc.
The first part of the research involved testing how durability affected the value of the item. The demo will allow you to have a weapon of a durability between 0-255. By testing several items at both ends of the spectrum, it became obvious that the value is linearly affected by CURRENT durability, and is not affected at all by MAX durability. The formula for working out how much an item is worth by durability is CurrentDurability/6.0.
First part of the formula:
value = (Unknown) + CurrentDurability/6.0;
The second part of the research was on how "metal" - or resource - affects the value of an item. I created scripts to create weapons that did not contain any metal - there is a function to do this in the core called "createNoResObject". I added a GM cheat script to do this, and then a GM cheat script which added 1 metal at a time to the object. The value for metal would never increase for the first "piece of metal" that was added to the object, but then would increase by 2 every time after that. I then cross checked these values by creating weapons via blacksmithy and purchasing them from blacksmith vendors, and the values checked out vs the required amount of resources to smith the item.
Second part of the formula:
value = (Unknown) + (ReqdIngots-1)*2 + CurrentDurability/6.0;
The third part of the formula was very hard to crack, but when the final answer was revealed, seemed much more obvious. I suspected this had something to do with weapon DPS (and could confirm that changing the DPS affected the value), but nothing I could come up with lined up with the expected values. I tried all sorts of things. Eventually I used a brute force method by taking 2 objects that had the same initial value, applying exactly the same weapon template to them (speed and damage), and then checking the value of the item. Sure enough, they lined up to have exactly the same reported Item Identification value. From here, I first tried setting the damage of the weapon to 0, and it indeed made the damage part of the formula worth 0 gold. I tried the same with speed and got 0 gold again. Then I set the damage of the weapon to a set amount and set the template values for the weapon to 10 speed, 20 speed, 30 speed, etc. I did this all the way up to 200 speed. Once this was complete, I started again, but doubled the damage. Shockingly,
damage played no part in the value of the item. The only exception to this was when the item had 0 damage. Instead speed was the only factor in the value of the weapon. Again, this proved to be a linear formula.
Third part of the formula:
value = (Unknown) + (Speed*0.125) + (ReqdIngots-1)*2 + CurrentDurability/6.0;
Using this formula got the values close, but offset by seemingly random values. They were generally off by 5-15 gold still. So I mapped these differences into an excel spreadsheet to try and find if there was any common pattern. I had already worked out that none of the following made any difference: damage, weapon class (eg slashing, bashing), weight, handedness (1h or 2h). Finally I turned to UO Fiddler to see if there was anything in the client files that might hold a clue. The final piece of the puzzle was there: the absolute base value of an object in UO is determined by the item flag called "Stacking/Offset Value". By adding 2 to this value, it always lined up perfectly.
Working Formula
value = 2 + [Stacking/Offset Value] + (Speed*0.125) + (ReqdIngots-1)*2 + CurrentDurability/6.0;
Using this formula will produce perfect results for every single weapon type I tried vs the demo, and match extremely close with the tables that Kaivan has linked to (eg: 51 max value for a katana that has 108 hit points - 2 + 10 + 55*0.125 + 7*2 + 1.2*90/6 = 50.875 gold, rounded up to 51. I do find it odd that this value is rounded up, rather than cast to an integer, but the formula does indeed work against every weapon type in the demo.
Note that although these values do not match
perfectly with what is listed here:
http://wayback.archive.org/web/20010414 ... eapons.htm The values are always within +-3gp. And though the formula is so slightly off against the weapons in this link, the formula matches 100% with the weapons that are found in the demo. Remember that the link above was roughly 3 years after the demo, and it is possible that speed/hit point/ingot costs may have been slightly changed during that time for some weapons. For instance, the bardiche and executioners axe both have different speed values in the demo vs stratics, and the damage levels are ALL massively different.
Footnotes:
There is no "bonus" in an item's value for being GM crafted. The only value bonus that comes from a GM crafted weapon is a 20% durability bonus, boosting the max durability of say, a katana, from 90-108.
(ReqdIngots-1) is not actually correct in that part of the formula. I later worked out that the formula actually looks like this:
value = [Stacking/Offset Value] + (Speed*0.125) + Math.Max( 2, ReqdIngots*2 ) + CurrentDurability/6.0;
This means that the "resource value" of an object is ALWAYS at least 2, even if no resources exist in the object. This means that itemids found in the client that have no value, and no value in game, are always worth 2gp when identified with the ItemID skill. If you run around the demo using itemID on random things, they're mostly all worth 2gp. I found this out while working out the values of tailored objects, where cloth is only worth 1gp per resource and not 2.
When applying to armor/clothing, replace the part of the formula which says: (Speed*0.125) with ((int)ScaledArmor*4.5). ScaledArmor meaning armor after it has been scaled by quality, but NOT scaled by durability. It must be casted to int before being multipled by 4.5, or the values are slightly off on exceptional armor. The most likely reason it needs to be casted to an int, is because the demo stores ScaledArmor rather than calculating it on the fly like RunUO does. This can also be observed in the fact that GM quality (and vanq) weapons have their dice offset adjusted in the demo on creation, rather than adding 4 at damage calculation time. This may also explain why OSI routinely bungled up their weapon values and patch notes commonly state that "prepatch weapons will be bugged", since things like an "exceptional" property did not truly exist.
When dealing with items that are made from cloth, change ReqdIngots*2 to ReqdCloth*1. The cloth resource is only worth 1gp per. It should be noted that cloth items NEVER gain armor from being exceptional in the demo - in fact exceptionally made cloth items can not be made at all.
BaseJewels on the other hand, appear to always be slotted with a resource that is equal in value to 20, giving every type of basejewel an ItemID of 21. The only thing that can affect the value of a BaseJewel is having charges on it. It was confirmed that BaseJewels are indeed "slotted" with some kind of resource worth 20, because when a BaseJewel with no resource is created, it is worth 3 (stacking/offset value of 1).
I have not yet tried this for items created with carpentry or tinkering, but there is probably nothing different about the formula. In fact, items do not appear to be "typed" in the demo at all, and instead all items have properties such as "damage", "hit points" and "durability", even if the item does not use those properties. They are usually set to 0 or -1 in those cases. So an all-purpose formula for item value in UO would be:
value = [Stacking/Offset Value] + (Speed*0.125) + ((int)ScaledArmor * 4.5) + Math.Max(2, ReqdResource*ResourceCost) + CurrentDurability/6.0;
Taking care to make sure none of those variables are ever less than 0.
And there you have it. Items in UO are never defined by a hardcoded value, other than what is found in the item data in the client files. They instead linearly scale with properties of the item, and every item in UO has a property called "resource" which contains a list of the resources that were used to create the item (this is done by the function transferResource in the core). The items that sit in an NPC blacksmith's inventory, interestingly, are real items and have already had their durability level generated. As such, you'll find that different NPC blacksmiths in the demo sell a katana for varying amounts, and also, items in an NPC shopkeeper's sell window can be identified, arms lored, etc (but not stolen).
Another note on the demo while doing this:
The blacksmithing skill is extremely bugged. When an item is created, the demo checks for whether the crafted item should be exceptional. The demo does not apply any flag to an exceptional item, but instead increases its durability by 20%, and then *tries* to apply an increased dice offset to the newly created weapon. It's interesting to note that the demo does not give a flat +4 dice offset to every exceptional weapon, but instead, the demo calculates the additional offset based on the existing damage of the weapon. For an exceptional halberd, 4 is added to the offset (sound familiar?), but for a katana, only 1 is added to the offset (partially since the demo katana is only 1d16). The major bug is that the new offset is not applied to the newly created weapon, but is instead applied to the smith hammer that was used to create it. This means that if you make 10 GM halberds with a smith hammer, the smith hammer will go from being 4d6+0 to 4d6+40. If you make 20, the smith hammer will be 4d6+80. This means you can create godly smith hammers in the demo and one shot other players/creatures with them.
This would obviously have been fixed, but the interesting part of that to me was the difference between a halberd and a katana's offset. It seems like katanas should not be given +4 damage on an exceptional craft, but rather only 1 additional damage. This would, however, be a major blow to crafting, as any katana that is might or above would now be better than a crafted one.