[Script Resource] Item Info - A lua database of item data (price, weight, etc.) (partially complete)

[pastebin.com]

Description

Usage

Notes, etc.

itemInfo is a resource for scripts that need data about items beyond just the item's id - something which isn't possible in the current version of tes3mp. It consists of a lua table that contains data on all the basic info (and some specialised info) for all the items in Morrowind (at least, "all the items" is the end goal), and some functions relating to the table, so that server scripts have that information available to use.Items currently with records in itemInfo release 1 (using http://en.uesp.net/wiki/Morrowind:Items for the categories):> WeaponsAll Base Weapons from the base game and expansion packs> ArmourAll Base Armour from the base game and expansion packsGeneric Magic Armour from the base game (no effect data)> ClothingAll Base Clothing for the base game and expansion packs> PotionsAll potions of every type from the base game and expansion packs (no effect data)> ToolsAll Tools (Lockpicks, Probes, Repair Items, Alchemy Apparatus) from the base game and expansion packs> IngredientsJust a few of the more expensive ingredients from the base game and expansion packs (no effect data)What's missing:> Everything not mentioned> Any data on magical effects (ingredient effects, spell effects, etc.) as I hadn't decided on how I wanted to format the data before I got to them :PFor scripts that wish to use itemInfo, the script must first bed somewhere in the script. To check if the item exists in the database, use itemInfo.GetItemData(id), where "id" is the item's id. If the item exists, it'll return the item's table entry, otherwise it'll return nil. From there you can either use the item's table directly to get its information or otherwise use itemInfo's specialised methods.To add your own entries to the table, either write them manually in the file or have a script use itemInfo.RegisterItem to add them (additions aren't saved anywhere, so they have to be added every time the server launches). Refer to the examples in the file as well as the templates for information on how to structure the item data.The ids of entries I've added follow the same formatting as they do in the original Morrowind, however OpenMW and tes3mp record items in all-lowercase, meaning items with capitalisation in their id can't be found using the script's GetItemData since lua keys are case-sensitive. The script will rectify this on it's own entries when the server is initially launched by creating duplicate, all-lowercase entries of any item with capitalisation in its id, but any items registered through outside scripts using itemInfo.RegisterItem will need to make sure their id is in all lowercase.If there's enough demand and someone wants to set up a github project for this, you're more than welcome to (I don't really know how to use github myself). Otherwise, I might eventually release more updates to the table whenever I feel like it (which might be never xP).