WowAce.com
Home
Addons
Authors
Forums
Knowledge base
Paste
Site issues
Sign in
Register new account
LibPeriodicTable-3.1
Overview
Files
Tickets
Pages
Repository
Subscriptions
Curse
API
r1
Source
Markup:
*
= Making Changes to PT3 = <ul><li> Changes to the file PeriodicTable-3.0.lua can be made as normal. </li><li> Edit data in data.lua only, then run compresssplit.lua in the command line. </li><li> All new data sets must be added to both data.lua and the corresponding mini-embed (use Misc if it's a smallish data group that doesn't make sense in any of the other files. </li><li> Changes to existing sets must be made ONLY to data.lua, changes made in other places will be overwritten. To make the changes take effect in the other files, run compresssplit.lua in the command line. In addition, be aware that if a set is automatically generated, your changes will be overwritten the next time the dataminer is run -- in those cases, you'll need to make changes directly to dataminer.lua. </li></ul> = Set Types = == Basic Set == <p>A set containing itemId or spellId. Optionally, it can have values for those which must be integers and are separated by a colon. </p> === Examples === <pre>["Reagent.Ammo.Arrow"] = "31737:500,12654:200,30611:385", ["GearSet.Tier 2.Priest.Vestments of Transcendence"] = "16925,16926,16919,16921,16920,16922,16924,16923", ["ClassSpell.Druid.Restoration"] = "-48435:0,-48436:0,-48437:0,-5185:1,-1126:1,-774:4,..." </pre> == Multi Set == <p>A set containing references to sets. These can be used to form links between different points in the data hierarchy. </p> === Examples === <pre>["InstanceLoot.Blackrock Spire"] = "m,InstanceLoot.Lower Blackrock Spire,InstanceLoot.Upper Blackrock Spire", ["Tradeskill.Mat.BySource.Gather"] = "m,Tradeskill.Gather", </pre> === Remarks === <p>There's no need to define a set that's implied by the hierarchy, PT3 creates these on the fly. </p> == Compressed Set == <p>A set containing multiple sets. </p> === Examples === <pre>["Consumable.Bandage.Battleground"] = "c[Alterac Valley,19307:2000][Arathi Basin,20232:1104,20234:2000][Warsong Gulch,19067:1104,19066:2000]", </pre> === Remarks === <p>If you request a child of one of these sets, such as (with the above example as the only set) PT:ItemInSet(19066, "Consumable.Bandage.Battleground.Warsong Gulch"), PT3 will automatically discover this and return the correct data. </p><p>Any type of set can be stored within these sets, they can also be nested within each other, such as: </p> <pre>"c[Monkey,c[Stuff,c[Tiny,1211:55][Reference,m,InstanceLoot.Blackrock Spire]]]" </pre> <p>In addition, the contained sets must follow all the rules of their set type (specifically, data compression) </p> == Oddball Sets == <p>A set with non-integer values. These values can contain any string data aside from commas. </p> === Examples === <pre>["Manufac.Alchemy"] = "o,16797:Elixir,16787:Healing,1235:Some'thing With_Spaces!,12534:111:111:111-2", </pre> === Remarks === <p>The itemids must be compressed, the values must be uncompressed. </p> == Uncompressed Sets == <p>A set that does not get uncompressed. In addition, the values can contain any string data aside from commas. </p> === Examples === <pre>["MyAddon.Custom"] = "u,7132:Value!!,23684,32116:11", </pre> === Remarks === <p>Nothing here gets uncompressed. Use this set type for custom sets that are created on the fly in-game. </p> == Notes on Sets == <ul><li> Be aware of what you're overwriting. </li></ul> <p>For example, if you define a set: </p> <pre>["a.b.c"] = "32257:1000,14431:400", </pre> <p>then the sets "a" and "a.b" are assumed from the hierarchy context. If you overwrite one of them, for example: </p> <pre>["a.b"] = "1221:112", </pre> <p>then the flow of the hierarchy is disrupted, as "a.b" should naturally be a multiset that contains it's children. This will <i>not</i> break anything, but be aware of the effects. </p><p>A more damaging scenario would be this: </p> <pre>["a.b.c"] = "c[d,1111:11]", ["a.b.c.d"] = "2222:22", </pre> <p>In this case, data will be destroyed - and the kicker is that which data gets destroyed depends on the order in which they're requested. </p> = API = == :GetSetTable("setname") == <p>Returns a table with the contents of the requested set. </p> === Args === <dl><dt> "setname" <dd> string - The name of a set within PT3 </dl> === Returns === <p>table - </p> <ul><li><i>if this is a multiset:</i> a list ordered table of this multiset's member tables. </li><li><i>if this is not a multiset:</i> the index of each table member is the itemid, and the value of each member is the value of that itemid in the set (or true if the item has no attached value). Also contains the field .set, which is the set's name. </li></ul> === Remarks === <p>Use this function if you need to display a list of items in a set or something similar. </p> === Example === <pre>PT:GetSetTable("Reagent.Ammo") </pre> == :GetSetStringCompressed("setname") == <p>Returns the set data that PT3 has for a given set, without uncompressing it into a useable form. Will also autogenerate the correct strings for virtual children (which are implied in "c[]" sets) or virtual parents (which are implied in the data hierarchy). </p> === Args === <dl><dt> "setname" <dd> string - The name of a set within PT3 </dl> === Returns === <p>string - The <i>compressed</i> set string for this set. </p> === Remarks === <p>A quick and simple function for checking the state of a set. Good for keeping an eye on a dynamic custom set. </p> === Example === <pre>PT:GetSetStringCompressed("MyAddon.DataB") </pre> == :GetSetStringUncompressed("setname") == <p>Returns the set data that PT3 has for a given set, uncompressed into a usable form. Will also autogenerate the correct strings for virtual children (which are implied in "c[]" sets) or virtual parents (which are implied in the data hierarchy). </p> === Args === <dl><dt> "setname" <dd> string - The name of a set within PT3 </dl> === Returns === <p>string - The <i>uncompressed</i> set string for this set. </p> === Remarks === <p>A quick and simple function for checking the state of a set. Good for keeping an eye on a dynamic custom set. </p> === Example === <pre>PT:GetSetStringUncompressed("MyAddon.DataE") </pre> == :ItemInSet(item, "setname") == <p>Find if an item is contained within a set. </p> === Args === <dl><dt> item <dd> string or number - The itemid or itemlink of an item <dt> "setname" <dd> string - The name of a set within PT3 </dl> === Returns === <p>string - the value of this item within the given set. </p><p>string - the set that this item was found within. </p> === Example === <pre>PT:ItemInSet(24468, "Tradeskill.Crafted") </pre> == :AddData("name", arg2[, arg3]) == <p>Add custom data to PeriodicTable-3.0 </p> === Args === <dl><dt> "name" <dd> string - The name of the set or module you're importing <dt> arg2 <dd> string or table - The contents of the set's string -or- the table of the module -or- the module's version string <dt> arg3 <dd> table - The module's data contents (if you provided a version number) </dl> === Remarks === <p>Add data to PT3. Note that you can use this function to overwrite data that's already present, if, for example, a custom set gets changed. </p> === Example === <pre>PT:AddData("MyAddon.SetA", "u,11436:Moose,7521:Sock") PT:AddData("MyAddon", {["MyAddon.SetA"] = "u,11436:Moose,7521:Sock", ["MyAddon.SetB"] = "5132,25443",}) PT:AddData("MyAddon", "$Rev: 23470 $" ,{["MyAddon.SetA"] = "u,11436:Moose,7521:Sock", ["MyAddon.SetB"] = "5132,25443"}) </pre> == :ItemSearch(item) == <p>Search for an item in the PT3 data library. </p> === Args === <dl><dt> item <dd> string or number - itemid or itemlink </dl> === Returns === <p>table - a table of all the sets this item is a member of. </p> === Remarks === <p>This sucker is slow and heavy. It takes about 0.12 seconds for me at the moment. And it needs to uncompress -all- the set's data. The bad news is that this eats a ton of memory, the good news is that it can be reclaimed by the GC directly afterward. I'd suggest only using this when requested by the user, and then running collectgarbage() right afterward. If you must run this automatically, cache the results. </p> === Example === <pre>PT:ItemSearch(14373) </pre> == :GetNumSets() == <p>Returns the number of sets currently in the PT3 set library. Note that "c[]" style sets will take up more spots after being requested, so don't be alarmed if this number grows during operation. </p> === Returns === <p>number - the number of sets. </p> === Remarks === <p>Just kinda a 'toy' function for statistical purposes. </p> === Example === <pre>PT:GetNumSets() </pre> == :GetNumCachedSets() == <p>Returns the number of set tables currently in the PT3 cache. </p> === Returns === <p>number - the number of sets. </p> === Remarks === <p>Just kinda a 'toy' function for statistical purposes. </p> === Example === <pre>PT:GetNumCachedSets() </pre> == :GetBetter("setname",itema,itemb) == <p>Return which one of the items has the higher value. </p> === Args === <dl><dt> "setname" <dd> string - PT3 set name <dt> itema <dd> string or number - itemid or itemlink <dt> itemb <dd> string or number - itemid or itemlink </dl> === Returns === <p>number - the itemid of the higher valued item. </p> === Example === <pre>PT:GetBetter("Rep.Rewards",13221,32002) </pre> == :GetBest("setname") == <p>Get the highest valued item in this set. </p> === Args === <dl><dt> "setname" <dd> string - PT3 set name </dl> === Returns === <p>number - the itemid of the highest valued item </p><p>number - the value of the highest valued item </p> === Example === <pre>PT:GetBest("Rep.Rewards") </pre> == :IsSetMulti(set) == <p>Check to see if a set is a multiset. </p> === Args === <dl><dt> set <dd> string - name of a set </dl> === Returns === <p>boolean - true if set is a multiset, false if set is not, nil if set does not exist. </p> === Remarks === <p>Most handy for determining how to iterate a set table. See :GetSetTable() for more info </p> === Example === <pre>PT:IsSetMulti("InstanceLoot.Tempest Keep") </pre> == :IterateSet(set) == <p>Iterate all the items in a given set. </p> === Args === <dl><dt> set <dd> string - name of a set </dl> === Returns === <p>number - itemid of the item string or boolean - value of the item string - set origin of the item </p> === Example === <pre>for item, value, set in PT:IterateSet("Misc.Minipet") do self:Print(item,value,set) end </pre> <!-- restored from web page -->
Markup Type:
*
The type of markup for this entry.
Click here for details
.
WikiCreole
BBCode
Safe HTML
Plain Text
Markdown
Textile
Curse Wiki (Deprecated)