Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode/
.history/
16 changes: 9 additions & 7 deletions RaidBrowser/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ local raid_list = {
},

{
name = 'toc10hc',
name = 'togc10hc',
instance_name = 'Trial of the Crusader',
size = 10,
patterns = std.algorithm.copy_back(
Expand All @@ -170,7 +170,7 @@ local raid_list = {
},

{
name = 'toc25hc',
name = 'togc25hc',
instance_name = 'Trial of the Crusader',
size = 25,
patterns = std.algorithm.copy_back(
Expand Down Expand Up @@ -884,12 +884,13 @@ end
lfm_channel_listeners = {
['CHAT_MSG_CHANNEL'] = {},
['CHAT_MSG_YELL'] = {},
['CHAT_MSG_SAY'] = {},
};

local channel_listeners = {};

local function is_lfm_channel(channel)
return channel == 'CHAT_MSG_CHANNEL' or channel == 'CHAT_MSG_YELL';
return channel == 'CHAT_MSG_CHANNEL' or channel == 'CHAT_MSG_YELL' or channel == 'CHAT_MSG_SAY';
end

local function event_handler(self, event, message, sender)
Expand Down Expand Up @@ -927,21 +928,21 @@ local function refresh_lfm_messages()
end

function raid_browser:OnEnable()
raid_browser:Print('loaded. Type /rb to toggle the raid browser.')
-- raid_browser:Print('loaded. Type /rb to toggle the raid browser.')

if not raid_browser_character_current_raidset then
raid_browser_character_current_raidset = 'Active';
end

if not raid_browser_character_raidsets then
raid_browser_character_raidsets = {
primary = {},
secondary = {},
Primary = {},
Secondary = {},
};
end

-- LFM messages expire after 60 seconds
raid_browser.expiry_time = 60;
raid_browser.expiry_time = 120;

raid_browser.lfm_messages = {}
raid_browser.timer = raid_browser.set_timer(10, refresh_lfm_messages, true)
Expand All @@ -950,6 +951,7 @@ function raid_browser:OnEnable()
end

raid_browser.gui.raidset.initialize();
raid_browser.check_button()
end

function raid_browser:OnDisable()
Expand Down
8 changes: 7 additions & 1 deletion RaidBrowser/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ local function set_sort(column)
end
end

function raid_browser.set_sort(column)
set_sort(column)
end

local function get_sorted_messages()
local keys = {}
for key,info in pairs(raid_browser.lfm_messages) do
Expand Down Expand Up @@ -193,6 +197,8 @@ local function assign_lfr_button(button, host_name, lfm_info, index)
button.damageIcon:SetTexture("Interface\\LFGFrame\\LFGRole");
button.partyIcon:SetTexture("Interface\\LFGFrame\\LFGRole");

button:SetScript("OnDoubleClick", on_join)

button:SetScript('OnEnter',
function(button)
GameTooltip:SetOwner(button, 'ANCHOR_RIGHT');
Expand Down Expand Up @@ -306,4 +312,4 @@ LFRBrowseFrameListButton_SetData = insert_lfm_button
LFRFrame_SetActiveTab(2)

LFRParentFrameTab1:Hide();
LFRParentFrameTab2:Hide();
LFRParentFrameTab2:Hide();
98 changes: 95 additions & 3 deletions RaidBrowser/raidset_frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,44 @@ local function is_secondary_selected(option)
return ('Secondary' == current_selection);
end

local function is_both_selected(option)
return ('Both' == current_selection);
end

local function set_selection(selection)
local text = '';

if selection == 'Active' then
text = 'Active';

elseif selection == 'Both' then
local spec1, gs1 = raid_browser.stats.get_raidset('Primary')
local spec2, gs2 = raid_browser.stats.get_raidset('Secondary')


if spec1 and gs1 then
text = text .. gs1 .. ' ' .. spec1
else
text = text .. '-'
end
text = text .. ' / '
if spec2 and gs2 then
text = text .. gs2 .. ' ' .. spec2
else
text = text .. '-'
end
if not (spec1 or spec2) then
text = 'Set any spec first';
end

else
local spec, gs = raid_browser.stats.get_raidset(selection)
if not spec then
text = 'Open';
elseif not gs then
text = spec;
else
text = gs..' '..spec
end
end

Expand All @@ -39,16 +66,25 @@ end
local function on_active()
set_selection('Active');
raid_browser.stats.select_current_raidset('Active');
raid_browser.check_button()
end

local function on_primary()
set_selection('Primary');
raid_browser.stats.select_current_raidset('Primary');
raid_browser.check_button()
end

local function on_secondary()
set_selection('Secondary');
raid_browser.stats.select_current_raidset('Secondary');
raid_browser.check_button()
end

local function on_both()
set_selection('Both');
raid_browser.stats.select_current_raidset('Both');
raid_browser.check_button()
end

local menu = {
Expand All @@ -69,25 +105,60 @@ local menu = {
func = on_secondary,
checked = is_secondary_selected,
},

{
text = "Both",
func = on_both,
checked = is_both_selected,
}
}

-- Get the menu option text
local function get_option_active(option)
local spec, gs = raid_browser.stats.active_spec(), GearScore_GetScore(UnitName('player'), 'player');
return (option .. ': ' .. gs .. ' ' .. spec)
end

-- Get the menu option text
local function get_option_text(option)
local spec = raid_browser.stats.get_raidset(option);
local spec, gs = raid_browser.stats.get_raidset(option);
if not spec then
return (option .. ': Open');
end

return (option .. ': ' .. spec);
return (option .. ': ' .. gs .. ' ' .. spec);
end

-- Get the menu option texts
local function get_option_texts(option)
local spec1, gs1 = raid_browser.stats.get_raidset('Primary');
local spec2, gs2 = raid_browser.stats.get_raidset('Secondary');
if not spec1 then
return (option .. ': Open');
end

if not (spec1 or spec2) then
return (option .. ': Set any spec first')
elseif (spec1 and spec2) then
return (option .. ': ' .. gs1 .. ' ' .. spec1 .. ' / ' .. gs2 .. ' ' .. spec2)
elseif spec1 then
return (option .. ': ' .. gs1 .. ' ' .. spec1 .. ' / ' .. '-')
elseif spec2 then
return (option .. ': ' .. '-' .. ' / ' .. gs2 .. ' ' .. spec2)
end

return (option .. ': ' .. gs1 .. ' ' .. spec1 .. ' / ' .. gs2 .. ' ' .. spec2);
end

-- Setup dropdown menu for the raidset selection
frame:SetPoint("CENTER", LFRBrowseFrame, "CENTER", 30, 165)
UIDropDownMenu_Initialize(frame, EasyMenu_Initialize, nil, nil, menu);

local function show_menu()
menu[1].text = get_option_active('Active');
menu[2].text = get_option_text('Primary');
menu[3].text = get_option_text('Secondary');
menu[4].text = get_option_texts('Both');
ToggleDropDownMenu(1, nil, frame, frame, 25, 10, menu);
end

Expand All @@ -110,6 +181,27 @@ function raid_browser.gui.raidset.initialize()
set_selection(raid_browser_character_current_raidset);
end

local function check_button(button)
if is_active_selected() or is_both_selected() then
button:Disable()
else
button:Enable()
end
end

function raid_browser.check_button()
if is_active_selected() or is_both_selected() then
RaidBrowserRaidSetSaveButton:Disable()
RaidBrowserRaidSetSaveButton:SetText("Select spec first")
RaidBrowserRaidSetSaveButton:Hide()
else
RaidBrowserRaidSetSaveButton:Enable()
RaidBrowserRaidSetSaveButton:SetText("Save gear+spec")
RaidBrowserRaidSetSaveButton:Show()
end
end


-- Create raidset save button
local button = CreateFrame("BUTTON","RaidBrowserRaidSetSaveButton", LFRBrowseFrame, "OptionsButtonTemplate")
button:SetPoint("CENTER", LFRBrowseFrame, "CENTER", -53, 168)
Expand All @@ -120,4 +212,4 @@ button:SetText("Save Raid Gear");
button:SetWidth(110);
button:SetScript("OnClick", on_raidset_save);
button:Show();

check_button(button);
Loading