diff --git a/CHANGELOG.txt b/CHANGELOG.txt new file mode 100644 index 0000000..4d0bdb2 --- /dev/null +++ b/CHANGELOG.txt @@ -0,0 +1,96 @@ +====================================================================== +This is a modified version of LibEventHandler, originally by Justinon. +====================================================================== +https://www.esoui.com/downloads/info1452-LibEventHandler.html + +NOTE : this modified version is still under the Artistic License 2.0 + +Version 1.3.13: (Calamath) +- Updated API version to 101050 (ESO 12.0.x : Update 50) + +Version 1.3.12: (Calamath) +- Updated API version to 101049 (ESO 11.3.x : Season Zero - Dawn and Dusk) + +Version 1.3.11: (Calamath) +- Updated API version to 101048 (ESO 11.2.x : Seasons of the Worm Cult Part 2) + +Version 1.3.10: (Calamath) +- Updated API version to 101047 (ESO 11.1.x : Feast of Shadows) + +Version 1.3.9: (Calamath) +- Updated API version to 101046 (ESO 11.0.x : Seasons of the Worm Cult Part 1) + +Version 1.3.8: (Calamath) +- Updated API version to 101045 (ESO 10.3.x : Fallen Banners) + +Version 1.3.7: (Calamath) +- Updated API version to 101044 (ESO 10.2.x : Update 44) + +Version 1.3.6: (Calamath) +- Updated API version to 101043 (ESO 10.1.x : Update 43) + +Version 1.3.5: (Calamath) +- Updated API version to 101042 (ESO 10.0.x : Gold Road) + +Version 1.3.4: (Calamath) +- Updated API version to 101039 (ESO 9.1.x : Update 39) + +Version 1.3.3: (Calamath) +- Updated API version to 101038 (ESO 9.0.x : Necrom) + +Version 1.3.2: (Calamath) +- Updated API version to 101037 (ESO 8.3.x : Scribes of Fate) + +Version 1.3.1: (Calamath) +- Updated API version to 101036 (ESO 8.2.x : Firesong) + +Version 1.3.0: (Calamath) +- Updated API version to 101035 (ESO 8.1.x : Lost Depths) + +Version 1.2.99: (Calamath) +- Updated API version to 101034 (ESO 8.0.x : High Isle) + +Version 1.2.98: (Calamath) +- Updated API version to 101033 (ESO 7.3.x : Ascending Tide) + +Version 1.2.97: (Calamath) +- Updated API version to 101032 (ESO 7.2.x : Deadlands) + +Version 1.2.96: (Calamath) +- Updated API version to 101031 (ESO 7.1.x : Waking Flame) + +Version 1.2.95: (Calamath) +- Updated API version to 100035 (ESO 7.0.x : Blackwood) + +Version 1.2.94: (Calamath) +- Updated API version to 100034 (ESO 6.3.x : Flames of Ambition) + +Version 1.2.93: (Calamath) +- Updated API version to 100033 (ESO 6.2.x : Markarth) + +Version 1.2.92: (Calamath) +- Updated API version to 100032 (ESO 6.1.x : Stonethorn) + +Version 1.2.91: (Calamath) +- Updated API version to 100031 (ESO 6.0.x : Greymoor) + +Version 1.2.90: (Calamath) +- LibEventHandler library now has its own manifest file and a global variable LibEventHandler for direct access. +- Updated API version to 100029 (ESO 5.2.5 : Dragonhold) +- LibDebugLogger has been newly added to OptionalDependsOn in the add-on manifest file. +- Moved debug message output from UI chat to LibDebugLogger. From now on, we add-on authors and contributers will look at the debug log with the DebugLogViewer add-on. + +------------------------------------------------------------------------------ +The following are changes to the standard version by original author Justinon. +------------------------------------------------------------------------------ + +Version 1.2: + +- Removed a print statement + + +Version 1.1: + +- Changed async to allow for user input for the delay time as opposed to hard codes half a second. Still accepts boolean values + + diff --git a/LibEventHandler.addon b/LibEventHandler.addon new file mode 100644 index 0000000..6edc8ae --- /dev/null +++ b/LibEventHandler.addon @@ -0,0 +1,31 @@ +## Title: LibEventHandler +## Version: 1.3.13 +## Author: Justinon +## IsLibrary: true +## APIVersion: 101049 101050 +## AddOnVersion: 1313 +## OptionalDependsOn: LibDebugLogger>=307 + +LibEventHandler.lua + +; DISCLOSURE: +; This Add-on is not created by, affiliated with or sponsored by ZeniMax +; Media Inc. or its affiliates. The Elder Scrolls® and related logos are +; registered trademarks or trademarks of ZeniMax Media Inc. in the United +; States and/or other countries. All rights reserved. +; You can read the full terms at https://account.elderscrollsonline.com/add-on-terms + +; AUTHOR NOTE: +; Thank you for downloading LibEventHandler! +; +; The main purpose of this library is to allow for a more versatile event handler than what ZOS provides +; through their EVENT_MANAGER. LibEventHandler expands the limitation of an event being incarcerated with +; only one function, to now being able to be linked to as many different functions as needed. In addition, +; it allows for the firing and registering of local events that you create within your addon. Together, +; these features enable this powerful tool to allow the developer to not only be more flexible with event +; managing, but also to be more clean, concise, and acyclical with code. +; +; Zenimax's EVENT_MANAGER will still need to be used should you require registering any functions for update, +; simply because I found theirs to be sufficient and did not need any more versatility. +; +; Again, thanks a bunch! Have fun programming! :) diff --git a/LibEventHandler.lua b/LibEventHandler.lua index 53dd08e..3a58ab2 100644 --- a/LibEventHandler.lua +++ b/LibEventHandler.lua @@ -1,7 +1,7 @@ -local MAJOR, MINOR = "LibEventHandler-1.2", 1.1 -local LEH, LEHminor = LibStub:NewLibrary(MAJOR, MINOR) -if not LEH then return end - +if LibEventHandler then d("Warning : 'LibEventHandler' has always been loaded.") return end +local LEH = {} +if LibDebugLogger then LEH.LDL = LibDebugLogger("LibEventHandler") end +local LDL = LEH.LDL LEH.eventToFunctionTable = {} local eventToFunctionTable = LEH.eventToFunctionTable @@ -27,7 +27,7 @@ function LEH:FireEvent(eventCode, async, ...) return elseif type(async) == number then if async < 0 then - d("Can't delay by a negative time!") + if LDL then LDL:Warn("Can't delay by a negative time!") end return end zo_callLater(function() CallEventFunctions(eventCode, unpack(arg)) end, async) @@ -55,10 +55,10 @@ function LEH:UnregisterForLocalEvent(eventCode, functionName) return false end end - if not didUnregister then d("Function trying to be removed isn't registered with event "..eventCode) end + if not didUnregister then if LDL then LDL:Warn("Function trying to be removed isn't registered with event", eventCode) end end return false else - d("No function registered yet for "..eventCode) + if LDL then LDL:Warn("No function registered yet for", eventCode) end return false end end @@ -81,7 +81,7 @@ function LEH:RegisterForLocalEvent(eventCode, functionName) local numOfFuncs = #eventToFunctionTable[eventCode] for i = 1, numOfFuncs, 1 do if eventToFunctionTable[eventCode][i] == functionName then - d("Function already registered for event "..eventCode) + if LDL then LDL:Warn("Function already registered for event ", eventCode) end return false end end @@ -99,4 +99,7 @@ function LEH:RegisterForEvent(namespace, eventCode, functionName) if needsRegistration then EVENT_MANAGER:RegisterForEvent(namespace, eventCode, CallEventFunctions) end -end \ No newline at end of file +end + + +LibEventHandler = LEH -- global variable for accessing library API. diff --git a/README.txt b/README.txt index 0959b49..b088679 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,5 @@ Author: Justin Glommen (Justinon) -Version: 1.2 +Version: 1.3 Thank you for downloading LibEventHandler!