Download
(3 Kb)
Download
Updated: 11/17/14 09:29 PM
Compatibility:
Update 5 (1.5.2)
Updated:11/17/14 09:29 PM
Created:11/17/14 09:29 PM
Monthly downloads:92
Total downloads:26,588
Favorites:7
MD5:
LibGuildHistory  Popular! (More than 5000 hits)
Version: 1.0.3
by: mattmillus [More]
LibGuildHistory is a library to facilitate and coordinate the requesting of guild history information.

Usage
LibGuildHistory:RequestHistory(category, completionFunc)

Categories
GUILD_HISTORY_GENERAL
GUILD_HISTORY_BANK
GUILD_HISTORY_STORE
GUILD_HISTORY_COMBAT (currently unused by game, but supported for any future use)
GUILD_HISTORY_ALLIANCE_WAR

Notes
  • LibGuildHistory will disable the Guild Menu's History tab while history requests are pending. This is to prevent the game from interfering with the library.
  • Set LibGuildHistory.Debug to true to enable debug text.

Example Code
Code:
local LGH = LibStub("LibGuildHistory")

local function OnGuildHistoryGeneralCompleted(guildId)
	d("General history for " .. GetGuildName(guildId) .. " is complete!")
	
	if (guildId == GetGuildId(GetNumGuilds())) then d("General history ready for all guilds") end
end

local function onAddOnLoaded(eventCode, addonName)
	if (addonName ~= "LibGuildHistory") then return end
	
	LGH:RequestHistory(GUILD_HISTORY_GENERAL, OnGuildHistoryGeneralCompleted)
	
	EVENT_MANAGER:UnregisterForEvent("LibGuildHistoryExample", EVENT_ADD_ON_LOADED)
end

EVENT_MANAGER:RegisterForEvent("LibGuildHistoryExample", EVENT_ADD_ON_LOADED, onAddOnLoaded)
Optional Files (0)


Post A Reply Comment Options
Unread 12/04/14, 07:52 PM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 832
File comments: 1097
Uploads: 33
There is a small issue with versioning. LibStub does not support strings or decimals, so library update won't work.

The following line tells LibStub that library version is not the whole string, but just number 1:
Lua Code:
  1. local ADDON_VERSION = "1.0.3"
  2.  
  3. local LibGuildHistory = LibStub:NewLibrary("LibGuildHistory", ADDON_VERSION)
  4. if not LibGuildHistory then return end
I'd recommend changing it to something like:
Lua Code:
  1. local VERSION = 3
  2.  
  3. local LibGuildHistory = LibStub:NewLibrary("LibGuildHistory", VERSION)
  4. if not LibGuildHistory then return end
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: