Skip to content

Commit 2ef6908

Browse files
committed
Added a new feature: LFG Reminder, shows in chat which dungeon group you joined, with a clickable teleport link if you know the teleport spell
1 parent 516edb8 commit 2ef6908

File tree

9 files changed

+1036
-855
lines changed

9 files changed

+1036
-855
lines changed

KeystoneUtil.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
local _, MPT = ...
1+
--- @class MPT_NS
2+
local MPT = select(2, ...);
23
--- @class KeystoneSharingUtil
34
local Util = {};
45
MPT.KeystoneSharingUtil = Util;
5-
KSUtil = Util;
66

77
local BNSendGameData = C_BattleNet and C_BattleNet.SendGameData or BNSendGameData
88

MythicPlusTweaks.toc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
libs\embeds.xml
2424

25+
data.lua
2526
SharedUtil.lua
2627
KeystoneUtil.lua
2728
core.lua

SharedUtil.lua

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ local MPT = select(2, ...);
33
--- @class MPT_Util
44
local Util = {};
55
MPT.Util = Util;
6+
local Data = MPT.Data;
67

78
-- whether to support affix-specific scores
89
Util.AFFIX_SPECIFIC_SCORES = false;
910

1011
local scoreRarityColors = {
11-
colors = {ITEM_STANDARD_COLOR, ITEM_GOOD_COLOR, ITEM_SUPERIOR_COLOR, ITEM_EPIC_COLOR, ITEM_LEGENDARY_COLOR},
12-
overallScore = {0, 1000, 1500, 1800, 2200},
13-
level = {0, 4, 7, 10, 15},
14-
dungeonAffixScore = {0, 63, 94, 113, 138},
15-
dungeonOverallScore = {0, 125, 188, 225, 275},
12+
colors = { ITEM_STANDARD_COLOR, ITEM_GOOD_COLOR, ITEM_SUPERIOR_COLOR, ITEM_EPIC_COLOR, ITEM_LEGENDARY_COLOR },
13+
overallScore = { 0, 1000, 1500, 1800, 2200 },
14+
level = { 0, 4, 7, 10, 15 },
15+
dungeonAffixScore = { 0, 63, 94, 113, 138 },
16+
dungeonOverallScore = { 0, 125, 188, 225, 275 },
1617
};
1718

1819
--- @return ColorMixin
@@ -49,6 +50,16 @@ function Util:GetRarityColor(score, scoreType)
4950
return colors[#colors];
5051
end
5152

53+
--- @param activityID number
54+
--- @return number|nil challengeMapID
55+
--- @return string fullName
56+
--- @return boolean isMythicPlusActivity
57+
function Util:GetMapInfoByLfgActivityID(activityID)
58+
local activityInfo = C_LFGList.GetActivityInfoTable(activityID);
59+
60+
return Data.ActivityIdToChallengeMapIdMap[activityID], activityInfo.fullName, activityInfo.isMythicPlusActivity;
61+
end
62+
5263
function Util:ExtractTooltipLines(tooltip)
5364
local linesLeft, linesRight = {}, {};
5465
local i = 0;
@@ -67,9 +78,10 @@ function Util:ExtractTooltipLines(tooltip)
6778
if not left and not right then break; end
6879
local leftR, leftG, leftB, _ = lineLeft:GetTextColor();
6980
local rightR, rightG, rightB, _ = lineRight:GetTextColor();
70-
table.insert(linesLeft, {text=left, r=leftR, g=leftG, b=leftB, wrap=leftWrap});
71-
table.insert(linesRight, {text=right, r=rightR, g=rightG, b=rightB});
81+
table.insert(linesLeft, { text = left, r = leftR, g = leftG, b = leftB, wrap = leftWrap, });
82+
table.insert(linesRight, { text = right, r = rightR, g = rightG, b = rightB, });
7283
end
84+
7385
return linesLeft, linesRight;
7486
end
7587

@@ -111,18 +123,18 @@ function Util:GetOverallInfoByMapId(mapId, includeAffixInfo)
111123
local isCurrentAffix = affixInfo.name == localizedAffixName;
112124
if isCurrentAffix then
113125
currentAffixInfo = {
114-
level = affixInfo.level,
115-
levelColor = affixInfo.overTime and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR,
116-
score = affixInfo.score,
117-
scoreColor = self:GetRarityColorDungeonAffixScore(affixInfo.score or 0),
118-
};
126+
level = affixInfo.level,
127+
levelColor = affixInfo.overTime and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR,
128+
score = affixInfo.score,
129+
scoreColor = self:GetRarityColorDungeonAffixScore(affixInfo.score or 0),
130+
};
119131
else
120132
secondaryAffixInfo = {
121-
level = affixInfo.level,
122-
levelColor = affixInfo.overTime and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR,
123-
score = affixInfo.score,
124-
scoreColor = self:GetRarityColorDungeonAffixScore(affixInfo.score or 0),
125-
};
133+
level = affixInfo.level,
134+
levelColor = affixInfo.overTime and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR,
135+
score = affixInfo.score,
136+
scoreColor = self:GetRarityColorDungeonAffixScore(affixInfo.score or 0),
137+
};
126138
end
127139
end
128140
end
@@ -160,16 +172,18 @@ end
160172
function Util:GetLocalizedAffixName()
161173
local affixIDs = C_MythicPlus.GetCurrentAffixes();
162174
if not affixIDs then return nil; end
175+
163176
local tyrannicalOrFortifiedAffix = affixIDs[1];
164177
if not tyrannicalOrFortifiedAffix or not tyrannicalOrFortifiedAffix.id then return nil; end
165-
local name = C_ChallengeMode.GetAffixInfo(tyrannicalOrFortifiedAffix.id);
166-
return name;
178+
179+
return C_ChallengeMode.GetAffixInfo(tyrannicalOrFortifiedAffix.id);
167180
end
168181

169182
function Util:GetAffixInfoByMapId(mapId)
170183
local localizedAffixName = self:GetLocalizedAffixName();
171184
local affixInfos = C_MythicPlus.GetSeasonBestAffixScoreInfoForMap(mapId);
172185
if not affixInfos then return nil; end
186+
173187
for _, affixInfo in pairs(affixInfos) do
174188
if affixInfo and affixInfo.name == localizedAffixName then
175189
return {
@@ -180,6 +194,7 @@ function Util:GetAffixInfoByMapId(mapId)
180194
};
181195
end
182196
end
197+
183198
return nil;
184199
end
185200

@@ -228,7 +243,7 @@ local scoreCache = {};
228243
function Util:GetUnitScores(unit)
229244
local summary = C_PlayerInfo.GetPlayerMythicPlusRatingSummary(unit);
230245
local guid = UnitGUID(unit);
231-
if not summary then
246+
if not summary or not guid then
232247
-- data is only available when you're somewhat close to the player, so cache it so it stays available when moving further away
233248
return guid and scoreCache[guid] or nil;
234249
end

core.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if not _G.MPT then _G.MPT = MPT; end
88
--@end-debug@
99

1010
--- @class MPT_Main: AceAddon,AceHook-3.0,AceEvent-3.0,AceConsole-3.0
11-
local Main = LibStub('AceAddon-3.0'):NewAddon(name, 'AceConsole-3.0', 'AceHook-3.0', 'AceEvent-3.0');
11+
local Main = LibStub('AceAddon-3.0'):NewAddon('Mythic Plus Tweaks', 'AceConsole-3.0', 'AceHook-3.0', 'AceEvent-3.0');
1212
if not Main then return; end
1313
MPT.Main = Main;
1414

@@ -62,8 +62,7 @@ function Main:InitConfig()
6262

6363
self.options = {
6464
type = 'group',
65-
name = 'Mythic+ Tweaks',
66-
desc = 'Various tweaks related to mythic+',
65+
name = 'Mythic Plus Tweaks',
6766
childGroups = 'tab',
6867
args = {
6968
version = {
@@ -184,7 +183,7 @@ function Main:InitConfig()
184183
self.options.args.modules.args[moduleName] = moduleOptions;
185184
end
186185

187-
self.configCategory = 'Mythic+ Tweaks';
186+
self.configCategory = 'Mythic Plus Tweaks';
188187
registerOptions();
189188
LibStub('AceConfigDialog-3.0'):AddToBlizOptions(self.configCategory);
190189
end

0 commit comments

Comments
 (0)