Collision is a library that tries to provide more information about the player armor durability in a easy and simple way. It was originally developed by Jaliborc for Bongos Durability, but the author encourages any developer to use it too.
Access Collision[]
To simply get a reference to the library, query LibStub for it:
local Collision = LibStub:GetLibrary("Collision-1.3") local Collision = LibStub("Collision-3.0")
Or, to embed Collision into your addon object:
LibStub("Collision-3.0"):Embed(myObject)
API[]
The following API provides everything you need yo know to use Collision.
:GetArmorDurability(slot, precise)[]
Returns the durability values of the given armor slot
Arguments[]
Arg | Type | Details |
---|---|---|
slot | string or number | Slot id or name |
precise | boolean | (Optional) Disables rounding of the percentage |
Returns[]
Return | Type | Details |
---|---|---|
current | number | Current durability of the given slot |
max | number | Max durability of the given slot |
percentage | number | Durability percentage of the given slot. Won't be rounded if precise is set to true |
:GetOverallDurability(precise)[]
Calculates the overall durability percentage
Arguments[]
Arg | Type | Details |
---|---|---|
precise | boolean | (Optional) Disables rounding of the percentage |
Returns[]
Return | Type | Details |
---|---|---|
percentage | number | Overall durability percentage. Won't be rounded if precise is set to true |
:GetRepairCost()[]
Calculates the repair cost of all armor equipped in the character
Returns[]
Return | Type | Details |
---|---|---|
cost | number | The cost of repairing all armor |
:PrintRepairCost(tooltip)[]
Prints the repair cost of all armor equipped in the character to the given tooltip
Arguments[]
Arg | Type | Details |
---|---|---|
tooltip | table | The tooltip to send the output to |
:IterateDamagedArmor()[]
Iterates over the damaged armor slots
Iterator Returns[]
Return | Type | Details |
---|---|---|
id | number | Slot id |
name | string | Slot name |
:IterateBrokenArmor()[]
Iterates over the broken armor slots
Iterator Returns[]
Return | Type | Details |
---|---|---|
id | number | Slot id |
name | string | Slot name |
More Help[]
For additional help, contact the author at Jalimods or see Collision in action.