WoW LibHijackMinimap-1.0 addon Dragonflight/Wrath of the Lich King Classic 2025
logo
wow addon LibHijackMinimap-1.0

LibHijackMinimap-1.0

Game Version: 6.2.0
Total Downloads: 814
Updated: Jun 24, 2015
Created: Jun 24, 2015
download LibHijackMinimap-1.0Download Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
LibHijackMinimap-1.0 v1.0 r001 release 13.01 KB Jun 24, 2015 6.2.0 814 download LibHijackMinimap-1.0 LibHijackMinimap-1.0 v1.0 r001 releaseDownload

Description

Share this:

LibHijackMinimap is a library that provides centralized handling for re-parenting the minimap.
LHM provides functionality to handle multiple hijackers and brokers requests between hijacker and client addons.

Addons that draw to the minimap (clients) and want to support minimap replacement/reparenting can register to this library with a callback that is executed on minimap replacement. In the callback routine the client has to handle the reparenting of their minimap items.

Addons that replace the minimap (hijackers) and want to notify clients can register to this library and use library calls to notify the hijack and release of the minimap.

One of the major advantages of using LHM is that new client addons don't have to contact every single hijacker addon to be supported, existing hijacker addons don't have to update for every new client addon and new hijacker addons don't have to find all existing clients out there.

Clients can be blacklisted for hijacking by specific hijackers. If more than one hijacker addon replaced the minimap for a client the first hijacker wins. If a hijacker restores the minimap the client will fall back to the next valid hijacker or be restored to the minimap if none.

The blacklisting can be configured through an external addon. Only one addon can be used for configuration. As default LibHijackMinimap-1.0-Options has been designed to do the job.

With LibHijackMinimap hijacker addons don't have direct control over which client addons they hijack and therefore don't need to provide a setup for this.

With a single hijacker addon and assuming the user will want to see all client addons on the minimap replacement this behaviour is the default with no need for the options addon.

API Reference

Example

Hijacker

local AddonName = "Hijacker"
local Addon = LibStub:GetLibrary("AceAddon-3.0"):NewAddon(AddonName)
local LHM = LibStub:GetLibrary("LibHijackMinimap-1.0")

-- used as private unique id to authenticate hijack requests with LHM
local lhmToken = {}

LHM:RegisterHijacker(AddonName, lhmToken)

function Addon:HijackMinimap(frame)
	if not frame then
		return
	end

	LHM:HijackMinimap(lhmToken, frame)
end

function Addon:ReleaseMinimap()
	LHM:ReleaseMinimap(lhmToken)
end

Client

local AddonName = "Client"
local Addon = LibStub:GetLibrary("AceAddon-3.0"):NewAddon(AddonName)
local LHM = LibStub:GetLibrary("LibHijackMinimap-1.0")

function Addon:ReparentMinimap(frame)
	if not frame then
		return
	end

	-- in case hijacker did not provide optional argument "ROTATE_MINIMAP" in SetCVar("rotateMinimap", value, "ROTATE_MINIMAP") so CVAR_UPDATE did not fire
	local rotateMinimap = GetCVar("rotateMinimap") == "1"

	-- reparent your minimap items
end

LHM:RegisterClient(AddonName, Addon, "ReparentMinimap")

Comments

Add a comment