Skip to content

Commit

Permalink
First version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adirelle committed Nov 7, 2013
0 parents commit 68634fa
Show file tree
Hide file tree
Showing 12 changed files with 1,128 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .docmeta
@@ -0,0 +1,9 @@
-
type: textile
input-file: README.textile
output-page: Main

-
type: luadoc
input-file: LibItemBuffs-1.0.lua
output-page: "API"
6 changes: 6 additions & 0 deletions .pkgmeta
@@ -0,0 +1,6 @@
package-as: LibItemBuffs-1.0

enable-nolib-creation: no

ignore:
- extractor
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions LibItemBuffs-1.0.lua
@@ -0,0 +1,82 @@
--[[
LibItemBuffs-1.0 - buff-to-item database.
(c) 2013 Adirelle (adirelle@gmail.com)
This file is part of LibItemBuffs-1.0.
LibItemBuffs-1.0 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
LibItemBuffs-1.0 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LibItemBuffs-1.0. If not, see <http://www.gnu.org/licenses/>.
--]]
local MAJOR, MINOR = "LibItemBuffs-1.0", tonumber("@project-date-integer@") or math.huge -- dev version should ovewrite normal version
local lib = LibStub:NewLibrary(MAJOR, MINOR)
if not lib then return end
lib.trinkets = LibStub:NewLibrary("LibItemBuffs-Trinkets-1.0")
lib.enchantments = {
-- MoP enchantments
-- Weapon (we assign it to the main hand weapon though it could come from the off-hand)
[118334] = INVSLOT_MAINHAND, -- Dancing Steel (agility)
[118335] = INVSLOT_MAINHAND, -- Dancing Steel (strength)
[104993] = INVSLOT_MAINHAND, -- Jade Spirit
[116660] = INVSLOT_MAINHAND, -- River's Song -- NEED CONFIRMATION
[116631] = INVSLOT_MAINHAND, -- Colossus
[104423] = INVSLOT_MAINHAND, -- Windsong (haste)
[104510] = INVSLOT_MAINHAND, -- Windsong (mastery)
[104509] = INVSLOT_MAINHAND, -- Windsong (critical strike)
-- Glove
[108788] = INVSLOT_HAND, -- Engineering: Phase Fingers -- NEED CONFIRMATION
[ 96228] = INVSLOT_HAND, -- Engineering: Synapse Springs, Mark II (agility)
[ 96229] = INVSLOT_HAND, -- Engineering: Synapse Springs, Mark II (strength)
[ 96230] = INVSLOT_HAND, -- Engineering: Synapse Springs, Mark II (intellect)
-- Belt
[131459] = INVSLOT_WAIST, -- Engineering: Watergliding Jets
-- Cloak
[126389] = INVSLOT_BACK, -- Engineering: Goblin Glider -- NEED CONFIRMATION
[125488] = INVSLOT_BACK, -- Tailoring: Darkglow Embroidery, rank 3 -- NEED CONFIRMATION
[125484] = INVSLOT_BACK, -- Tailoring: Lightweave Embroidery, rank 3
[125489] = INVSLOT_BACK, -- Tailoring: Swordguard Embroidery, rank 3 -- NEED CONFIRMATION
-- Legendary meta gems
[137593] = INVSLOT_HEAD, -- Indomitable Primal Diamond
[137288] = INVSLOT_HEAD, -- Courageous Primal Diamond
[137596] = INVSLOT_HEAD, -- Capacitive Primal Diamond
[137590] = INVSLOT_HEAD, -- Sinister Primal Diamond
}
--- Tell whether a spell is a item buff or not.
-- @param spellID number Spell identifier.
-- @param boolean True if the spell is a buff given by an item.
function lib:IsItemBuff(spellID)
return spellID and (lib.enchantments[spellID] or lib.trinkets[SpellID]) and true
end
--- Get information about the inventory item that can gives this buff.
-- @param spellID number Spell identifier.
-- @param (string, number) Either ("slot", inventorySlot), ("item", itemID) or nil if the spell is unknown.
function lib:GetBuffItem(spellID)
if spellID then
if lib.enchantments[spellID] then
return "slot", lib.enchantments[spellID]
elseif lib.trinkets[spellID] then
return "item", lib.trinkets[spellID]
end
end
end
13 changes: 13 additions & 0 deletions LibItemBuffs-1.0.toc
@@ -0,0 +1,13 @@
## Interface: 50400
## Title: Lib: ItemBuffs-1.0
## Notes: Buff-to-item database.
## Author: Adirelle
## Version: @project-version@
## LoadOnDemand: 1
## X-Date: @project-date-iso@
## X-Category: Library
## X-License: GPL v3
## X-eMail: adirelle@gmail.com

LibStub.lua
LibItemBuffs-1.0.xml
5 changes: 5 additions & 0 deletions LibItemBuffs-1.0.xml
@@ -0,0 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="LibItemBuffs-Trinkets-1.0.lua"/>
<Script file="LibItemBuffs-1.0.lua"/>
</Ui>
51 changes: 51 additions & 0 deletions LibStub.lua
@@ -0,0 +1,51 @@
-- $Id: LibStub.lua 76 2007-09-03 01:50:17Z mikk $
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]

-- Check to see is this version of the stub is obsolete
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR

-- LibStub:NewLibrary(major, minor)
-- major (string) - the major version of the library
-- minor (string or number ) - the minor version of the library
--
-- returns nil if a newer or same version of the lib is already present
-- returns empty library object or old library object if upgrade is needed
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")

local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end

-- LibStub:GetLibrary(major, [silent])
-- major (string) - the major version of the library
-- silent (boolean) - if true, library is optional, silently return nil if its not found
--
-- throws an error if the library can not be found (except silent is set)
-- returns the library object if found
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end

-- LibStub:IterateLibraries()
--
-- Returns an iterator for the currently registered libraries
function LibStub:IterateLibraries()
return pairs(self.libs)
end

setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
2 changes: 2 additions & 0 deletions extractor/.gitignore
@@ -0,0 +1,2 @@
cache/
vendor/*
14 changes: 14 additions & 0 deletions extractor/composer.json
@@ -0,0 +1,14 @@
{
"name": "adirelle/trinket-spell-extractor",
"description": "Extract buffs from trinket pages.",
"authors": [
{
"name": "Adirelle",
"email": "adirelle@gmail.com"
}
],
"require": {
"symfony/dom-crawler": "2.4.*@dev",
"symfony/css-selector": "2.4.*@dev"
}
}
130 changes: 130 additions & 0 deletions extractor/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added extractor/composer.phar
Binary file not shown.

0 comments on commit 68634fa

Please sign in to comment.