Skip to content

Commit

Permalink
v1.7.2 is invited to events checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Serkan Yazıcıoğlu committed Oct 10, 2024
1 parent b9e1c3e commit f22c57b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
31 changes: 27 additions & 4 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -679,15 +679,16 @@ function Core:CreateUpcomingEvents()
local upcomingEvent = ns.UPCOMING_EVENTS.events[i];

if (guildName == upcomingEvent.guild and realmName == upcomingEvent.guildRealmNormalized and regionId == upcomingEvent.guildRegionId) then
hasAnyData = true;
Core:AppendCalendarList(upcomingEvent);
if (Core:AppendCalendarList(upcomingEvent)) then
hasAnyData = true;
end
end
end
end

if (not hasAnyData) then
Core:AppendMessage(
"This guild doesn't have any upcoming event or you are not an event manager!\r\n\r\nGuild: " ..
"This guild either doesn't have any upcoming events that you are a member of, or you are not an event manager!\r\n\r\nGuild: " ..
guildName .. " / " .. realmName, true);
end
end
Expand Down Expand Up @@ -901,6 +902,10 @@ function Core:AppendMessage(message, appendReloadUIButton)
end

function Core:AppendCalendarList(event)
if not Core:IsInvitedToEvent(event) then
return false;
end

local itemGroup = GOW.GUI:Create("InlineGroup");
itemGroup:SetTitle(event.title);
itemGroup:SetFullWidth(true);
Expand Down Expand Up @@ -1141,6 +1146,7 @@ function Core:AppendCalendarList(event)
itemGroup:AddChild(buttonsGroup);

containerScrollFrame:AddChild(itemGroup);
return true;
end

function Core:AppendTeam(teamData)
Expand Down Expand Up @@ -1455,6 +1461,23 @@ function Core:AddCheckEventsTask()
end, 6);
end

function Core:IsInvitedToEvent(upcomingEvent)
if (upcomingEvent.isEventMember) then
if (upcomingEvent.calendarType == 1) then
return true;
else
local currentCharacterInvite = GetCurrentCharacterUniqueKey();

for m = 1, upcomingEvent.totalMembers do
local currentInviteMember = upcomingEvent.inviteMembers[m];
if (currentInviteMember and currentCharacterInvite == currentInviteMember.name .. "-" .. currentInviteMember.realmNormalized) then
return true;
end
end
end
end
end

function Core:CheckEventInvites()
Core:Debug("Starting event invites!");

Expand Down Expand Up @@ -1498,7 +1521,7 @@ function Core:CheckEventInvites()
workQueue:clearTasks();
return;
elseif (eventIndex == -1) then
if (upcomingEvent.isEventMember) then
if (Core:IsInvitedToEvent(upcomingEvent)) then
hasAnyUninvitedEvent = true;
end
elseif (eventIndex > 0) then
Expand Down
2 changes: 1 addition & 1 deletion GuildsOfWoW-Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Notes: Guilds of WoW guild herald for Classic Progression servers
## X-Website: https://guildsofwow.com
## Author: Nhea
## Version: 1.7.1
## Version: 1.7.2
## SavedVariables: GoWDB
## IconTexture: Interface\Icons\vas_guildfactionchange

Expand Down
2 changes: 1 addition & 1 deletion GuildsOfWoW-Classic.toc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Notes: Guilds of WoW guild herald for Classic Era servers
## X-Website: https://guildsofwow.com
## Author: Nhea
## Version: 1.7.1
## Version: 1.7.2
## SavedVariables: GoWDB

embed.xml
Expand Down
2 changes: 1 addition & 1 deletion GuildsOfWoW.toc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Notes: Guilds of WoW guild herald for retail World of Warcraft
## X-Website: https://guildsofwow.com
## Author: Nhea
## Version: 1.7.1
## Version: 1.7.2
## SavedVariables: GoWDB
## OptionalDeps: AstralKeys
## AddonCompartmentFunc: GuildsOfWow_OnAddonButtonClick
Expand Down

0 comments on commit f22c57b

Please sign in to comment.