mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-09-22 07:36:58 +00:00
Fix realm-gate disable for book/options, pet-rank learning, unique beasts
- Hunter's Book and options window now show a full 'DISABLED.' overlay on realm-gated realms instead of rendering content - Pet training: new rank of an already-known ability is now recognised, announced, and reflected in tooltips - Restore curated 'unique appearance' beast allowlist (34 beasts) in data/init.lua - CHANGELOG updated
This commit is contained in:
+68
-1
@@ -7,7 +7,18 @@ MTH = MTH or {
|
||||
}
|
||||
|
||||
local MTH_CHAT_PREFIX = "|cFFFFFFFF[|r|cFFD14A4AMeta|r|cFFABD473Hunt|r|cFFFFFFFF]|r "
|
||||
local MTH_NON_HUNTER_BLOCK_MESSAGE = "You are not a hunter and you are not allowed here. Disable the add-on for this character."
|
||||
local MTH_NON_HUNTER_BLOCK_MESSAGE = "You are not a hunter. Disable the add-on for this character."
|
||||
local MTH_REALM_BLOCK_MESSAGE = "Zero support for Ravencraft/Capybara mafia's realms. Consider joining Octowow."
|
||||
local MTH_BLOCKED_REALMS = {
|
||||
["Medivh"] = true,
|
||||
["\230\176\184\230\173\140\232\141\146\233\135\142"] = true,
|
||||
["\211\192\184\232\187\196\210\176"] = true,
|
||||
["\229\159\186\232\181\171\231\186\179\230\150\175"] = true,
|
||||
["\187\249\186\213\196\201\203\185"] = true,
|
||||
["\231\190\164\230\152\159\231\155\134\229\156\176"] = true,
|
||||
["\200\186\208\199\197\232\181\216"] = true,
|
||||
}
|
||||
|
||||
local MTH_MESSAGE_DEFAULTS = {
|
||||
initModulesLoaded = false,
|
||||
initSarcasticWelcome = true,
|
||||
@@ -189,6 +200,57 @@ function MTH:ApplyClassGate(_source)
|
||||
return blocked
|
||||
end
|
||||
|
||||
function MTH:GetCurrentRealmName()
|
||||
local realm = nil
|
||||
if type(GetRealmName) == "function" then
|
||||
realm = GetRealmName()
|
||||
end
|
||||
if (realm == nil or realm == "") and type(GetCVar) == "function" then
|
||||
realm = GetCVar("realmName")
|
||||
end
|
||||
return realm
|
||||
end
|
||||
|
||||
function MTH:IsRealmGateBlocked()
|
||||
return self and self._realmGateBlocked and true or false
|
||||
end
|
||||
|
||||
function MTH:CheckRealmGate()
|
||||
-- Realm name is only reliable once logged in; an empty result never blocks.
|
||||
local realm = self:GetCurrentRealmName()
|
||||
if type(realm) == "string" and realm ~= "" then
|
||||
self._currentRealm = realm
|
||||
if MTH_BLOCKED_REALMS[realm] then
|
||||
self._realmGateBlocked = true
|
||||
end
|
||||
end
|
||||
return self:IsRealmGateBlocked()
|
||||
end
|
||||
|
||||
function MTH:AnnounceRealmGateBlocked()
|
||||
if self._realmGateAnnounced then
|
||||
return
|
||||
end
|
||||
local sink = MTH_TryOutputClassGateMessage(MTH_REALM_BLOCK_MESSAGE)
|
||||
if sink == "chat" or sink == "uierrors" or sink == "print" then
|
||||
self._realmGateAnnounced = true
|
||||
end
|
||||
end
|
||||
|
||||
function MTH:ApplyRealmGate(_source)
|
||||
if self:IsHardBlocked() then
|
||||
return true
|
||||
end
|
||||
if self:CheckRealmGate() then
|
||||
self:AnnounceRealmGateBlocked()
|
||||
if self.ShutdownForNonHunter then
|
||||
self:ShutdownForNonHunter(_source or "realm-gate")
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
MTH:ApplyClassGate("startup")
|
||||
|
||||
if not MTH._classGateLifecycleFrame then
|
||||
@@ -202,6 +264,11 @@ if not MTH._classGateLifecycleFrame then
|
||||
MTH._classGateAnnounced = nil
|
||||
MTH._classGateAnnouncePending = nil
|
||||
end
|
||||
if MTH and MTH.ApplyRealmGate and MTH:ApplyRealmGate(event) then
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
return
|
||||
end
|
||||
if MTH and MTH.ApplyClassGate and MTH:ApplyClassGate(event) and MTH._classGateAnnouncedChat then
|
||||
this:UnregisterAllEvents()
|
||||
this:SetScript("OnEvent", nil)
|
||||
|
||||
Reference in New Issue
Block a user