Skip to content
Permalink
Browse files

Fixes to Classic broadcast (#376)

* Fix is_classic call, call ready broadcast event

* Fixing advanced settings + copy-pasted comments

* Swap back to parity dev/release
  • Loading branch information
Solanya committed Dec 12, 2019
1 parent 7112422 commit ae66102437c702c3de1b2d7babcaffb7e5a2e234
@@ -31,12 +31,16 @@ TRP3_API.ADVANCED_SETTINGS_STRUCTURE = {
}

TRP3_API.ADVANCED_SETTINGS_KEYS = {
USE_BROADCAST_COMMUNICATIONS = "comm_broad_use",
BROADCAST_CHANNEL = "comm_broad_chan",
PROFILE_SANITIZATION = "register_sanitization",
MAKE_SURE_BROADCAST_CHANNEL_IS_LAST = "MAKE_SURE_BROADCAST_CHANNEL_IS_LAST",
}

-- Broadcast keys should only be registered in Retail
if not TRP3_API.globals.is_classic then
TRP3_API.ADVANCED_SETTINGS_KEYS.USE_BROADCAST_COMMUNICATIONS = "comm_broad_use";
TRP3_API.ADVANCED_SETTINGS_KEYS.BROADCAST_CHANNEL = "comm_broad_chan";
TRP3_API.ADVANCED_SETTINGS_KEYS.MAKE_SURE_BROADCAST_CHANNEL_IS_LAST = "MAKE_SURE_BROADCAST_CHANNEL_IS_LAST";
end

TRP3_API.ADVANCED_SETTINGS_DEFAULT_VALUES = {};

--- Display a warning to let the user know modifying advanced settings might cause issues
@@ -51,8 +55,8 @@ TRP3_API.events.listenToEvent(TRP3_API.events.WORKFLOW_ON_LOAD, function()
TRP3_API.ADVANCED_SETTINGS_STRUCTURE.menuText = loc.CO_ADVANCED_SETTINGS_MENU_NAME
TRP3_API.ADVANCED_SETTINGS_STRUCTURE.pageText = loc.CO_ADVANCED_SETTINGS

if not TRP3_API.is_classic then
-- Reset button
if not TRP3_API.globals.is_classic then
-- Broadcast settings
tinsert(TRP3_API.ADVANCED_SETTINGS_STRUCTURE.elements, {
inherit = "TRP3_ConfigH1",
title = loc.CO_ADVANCED_BROADCAST,
@@ -85,7 +89,7 @@ TRP3_API.events.listenToEvent(TRP3_API.events.WORKFLOW_ON_LOAD, function()
});
end

-- Localization settings
-- Sanitization
tinsert(TRP3_API.ADVANCED_SETTINGS_STRUCTURE.elements, {
inherit = "TRP3_ConfigH1",
title = loc.REG_REGISTER,
@@ -70,11 +70,11 @@ Comm.totalBroadcastR = 0;
Comm.totalBroadcastP2PR = 0;

local function broadcast(command, ...)
if not TRP3_API.is_classic and not config_UseBroadcast() or not command then
if not Globals.is_classic and not config_UseBroadcast() or not command then
Log.log("Bad params");
return;
end
if not TRP3_API.is_classic and not helloWorlded and command ~= HELLO_CMD then
if not Globals.is_classic and not helloWorlded and command ~= HELLO_CMD then
Log.log("Broadcast channel not yet initialized.");
return;
end
@@ -88,7 +88,7 @@ local function broadcast(command, ...)
message = message .. BROADCAST_SEPARATOR .. arg;
end
if message:len() < 254 then
if TRP3_API.is_classic then
if Globals.is_classic then
Chomp.SendAddonMessage(BROADCAST_HEADER, message, "YELL");
else
local channelName = GetChannelName(config_BroadcastChannel());
@@ -283,7 +283,7 @@ local function moveBroadcastChannelToTheBottomOfTheList()
end
end

if not TRP3_API.is_classic then
if not Globals.is_classic then
Ellyb.GameEvents.registerCallback("CHANNEL_UI_UPDATE", moveBroadcastChannelToTheBottomOfTheList);
Ellyb.GameEvents.registerCallback("CHANNEL_COUNT_UPDATE", moveBroadcastChannelToTheBottomOfTheList);
Ellyb.GameEvents.registerCallback("CHAT_MSG_CHANNEL_JOIN", moveBroadcastChannelToTheBottomOfTheList);
@@ -303,7 +303,8 @@ Comm.broadcast.init = function()
Utils.event.registerHandler("CHAT_MSG_ADDON", onMessageReceived);

-- No broadcast channel on Classic (1.13.3)
if TRP3_API.is_classic then
if Globals.is_classic then
TRP3_API.events.fireEvent(TRP3_API.events.BROADCAST_CHANNEL_READY);
return
end

@@ -139,7 +139,7 @@ TRP3_API.Events.registerCallback(TRP3_API.Events.WORKFLOW_ON_LOADED, function()
end
else
-- Classic 1.13.3: with the scan moving to YELL, we're forbidding scans in another zone than the one you're in.
if TRP3_API.is_classic then
if TRP3_API.globals.is_classic then
return false;
end
end

0 comments on commit ae66102

Please sign in to comment.
You can’t perform that action at this time.