Takes an itemData table and compresses into a single wstring. The compressed string will have a length of around 160 characters.
Usage
First, retrieve the library using LibStub:
local LibItemCompress = LibStub:GetLibrary("LibItemCompress-1.0")
To compress an itemData table, use the compressItemData method, which takes a single itemData table and returns a wstring e.g.:
local itemDataComp = LibItemCompress.compressItemData(itemData)
To uncompress a wstring, use the uncompressItemData method, which takes a single wstring and returns an itemData table e.g.:
local itemDataUnComp = LibItemCompress.uncompressItemData(itemDataComp)
Fields
The following fields are compressed and uncompressed . Any other itemData fields, such as slots, enhslot, cooldownTimeLeft will not be present in the uncompressed itemData and will be ignored when compressing.
- name
- description
- races
- skills
- careers
- slots
- enhSlot
- bonus
- craftingBonus
- flagsComp
- miscFlagsComp
- uniqueID
- id
- iconNum
- sellPrice
- itemSet
- rarity
- type
- level
- renown
- iLevel
- equipSlot
- maxEquip
- tintA
- tintB
- dyeTintA
- dyeTintB
- dps
- speed
- armor
- blockRating
- trophyLocIndex
- stackCount
- craftingSkillRequirement
- cultivationType
- marketingIndex
- marketingVariation
- numEnhancementSlots
- noChargeLeftDontDelete
- trophyLocation
- currChargesRemaining
Testing
There is an optional file provided LibItemCompressTest.lua, which contains various tests. Any failure in any test will cause the test to halt with the appropriate error message. All test output is to the debug console. The test file is commented out of the LibItemCompress.mod file, so you'll need to uncomment it yourself to use it.
LibItemCompressTest.all()
This runs each of the unit tests and provides the average compressed wstring length.
LibItemCompressTest.sampleData()
This tests 10 sample itemData objects, created at the end of LibItemCompressTest.lua.
LibItemCompressTest.failData()
This tests all of the error / bad / incomplete input conditions.
LibItemCompressTest.getDatabaseItemData()
Tests all items found in the local itemData cache, retrieved via getDatabaseItemData().
LibItemCompressTest.nLootLink()
If nLootLink is present, each of the items in the database will be tested.
Example
Annihilator Barbute,,#1|6|#1|16|#1|2|0|16||5||2|2|0|13||6||3|2|0|29||9||4|2|0|2||88||5|5||0||12958||&&772*4*434187*5939*3501*3023*4091*5*6*36*33*48*9********216**1*1*****1****
is the result of compressing
itemData = {
description = L"",
renown = 33,
maxEquip = 0,
isNew = false,
equipSlot = 9,
races =
{
},
tintB = 0,
speed = 0,
cultivationType = 0,
craftingSkillRequirement = 0,
iconNum = 3501,
rarity = 5,
marketingVariation = 0,
flags =
{
false,
true,
false,
false,
false,
false,
false,
true,
true,
false,
false,
false,
false,
false,
false,
false,
[0] = false,
},
name = L"Annihilator Barbute",
broken = false,
skills =
{
[1] = 6,
},
marketingIndex = 0,
uniqueID = 434187,
blockRating = 0,
sellPrice = 3023,
slots =
{
},
level = 36,
armor = 216,
dyeTintB = 0,
currChargesRemaining = 0,
trophyLocation = 0,
dyeTintA = 0,
iLevel = 48,
bonus =
{
{
value = 16,
type = 2,
reference = 5,
duration = 0,
},
{
value = 13,
type = 2,
reference = 6,
duration = 0,
},
{
value = 29,
type = 2,
reference = 9,
duration = 0,
},
{
value = 2,
type = 2,
reference = 88,
duration = 0,
},
{
value = 0,
type = 5,
reference = 12958,
},
},
enhSlot =
{
},
type = 6,
boundToPlayer = false,
numEnhancementSlots = 1,
id = 5939,
dps = 0,
craftingBonus =
{
},
trophyLocIndex = 1,
careers =
{
[1] = 16,
},
bop = true,
itemSet = 4091,
noChargeLeftDontDelete = 0,
stackCount = 1,
isRefinable = false,
tintA = 0,
}
Facts
- Date created
- 19 Apr 2009
- Category
- Last update
- 18 Aug 2009
- Development stage
- Inactive
- License
- GNU General Public License version 2 (GPLv2)
- Curse link
- LibItemCompress
- Recent files
- R: 1.1.2-release for 1.30b on 18 Aug 2009
- R: 1.1.1-release for 1.3 on 21 Jun 2009
- A: r17 for 1.3 on 21 Jun 2009
- A: r15 for 1.3 on 21 Jun 2009
- A: r8 for 1.3 on 21 Jun 2009