From a82d6606880f47e515df69bd8bcdc03082bb250a Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sat, 30 Dec 2017 18:03:05 +0100 Subject: [PATCH 1/3] Fix a bunch of things Cache AP calculation w/ AK increase (not that this matters anymore) Map AP calculations (w/ proper 'bonus' token amounts) A bunch of extra whitespace/indent tweaks because I'm a bit OCD w/ these things --- Affixes.lua | 2 +- ArtifactKnowledge.lua | 10 ++-- ArtifactPower.lua | 71 ++++++++++++++-------- AstralKeys.lua | 16 ++--- AstralKeys.toc | 2 +- BNFriends.lua | 27 ++++----- Character Info.lua | 8 +-- Communications.lua | 17 +++--- Events.lua | 4 +- Frame Functions.lua | 18 +++--- Frame.lua | 133 +++++++++++++++++++----------------------- Key Information.lua | 6 +- MinimapButton.lua | 2 +- Options.lua | 24 ++++---- Settings.lua | 6 +- Tables.lua | 4 +- Unit Information.lua | 2 +- embeds.xml | 8 +-- 18 files changed, 181 insertions(+), 179 deletions(-) diff --git a/Affixes.lua b/Affixes.lua index dfba1ea..bf9543f 100644 --- a/Affixes.lua +++ b/Affixes.lua @@ -108,4 +108,4 @@ function e.AffixThree(weekOffSet) local week = (e.Week + offSet) % 12 if week == 0 then week = 12 end return AFFIXES[week][3] -end \ No newline at end of file +end diff --git a/ArtifactKnowledge.lua b/ArtifactKnowledge.lua index 4556adc..fa8ecd0 100644 --- a/ArtifactKnowledge.lua +++ b/ArtifactKnowledge.lua @@ -60,13 +60,11 @@ AK_BONUS[54] = 4846001 AK_BONUS[55] = 6300001 -- Returns artifact bonus percent --- @param akLevel integer value representing artifact level function e.GetAKBonus() return AK_BONUS[math.min(e.Week + 35, #AK_BONUS)] - --return AK_BONUS[tonumber(akLevel)] end ---Gets Artifact Knowledge level -function e.ParseAKLevel() - return math.min(e.Week + 35, #AK_BONUS) -end \ No newline at end of file +-- Returns next week's artifact bonus percent +function e.GetNextAKBonus() + return AK_BONUS[math.min(e.Week + 35 + 1, #AK_BONUS)] +end diff --git a/ArtifactPower.lua b/ArtifactPower.lua index 7c5890d..8c6d282 100644 --- a/ArtifactPower.lua +++ b/ArtifactPower.lua @@ -6,13 +6,12 @@ local WEEKLY_AP = {} --[[ RUSSIAN Upper Kara Верхний Каражан -Lowre Kara Нижний Каражан +Lower Kara Нижний Каражан ]] - DUNGEON_TABLE[197] = {} ---DUNGEON_TABLE[197]['enUS'] ---DUNGEON_TABLE[197]['ptBR'] ---DUNGEON_TABLE[197]['deDE'] +--DUNGEON_TABLE[197]['enUS'] +--DUNGEON_TABLE[197]['ptBR'] +--DUNGEON_TABLE[197]['deDE'] --DUNGEON_TABLE[197]['frFR'] --DUNGEON_TABLE[197]['esMX'] --DUNGEON_TABLE[197]['ruRU'] @@ -43,7 +42,7 @@ DUNGEON_TABLE[234]['name'] = 'Return to Karazhan: Upper' DUNGEON_TABLE[239] = {} DUNGEON_TABLE[239]['name'] = 'Seat of the Triumvirate' ---[[ +--[[ Times -1440 > 1440 @@ -86,26 +85,29 @@ function e.BuildMapTable() DUNGEON_TABLE[map].chestTimes[3] = c DUNGEON_TABLE[map]['apTier'] = {} if runTime == 1440 then - DUNGEON_TABLE[map].apTier[1] = 175 -- 2-3 - DUNGEON_TABLE[map].apTier[2] = 290 -- 4-6 - DUNGEON_TABLE[map].apTier[3] = 325 -- 7-9 - DUNGEON_TABLE[map].apTier[4] = 465 -- 10-14 - DUNGEON_TABLE[map].apTier[5] = 725 -- 15-19 - DUNGEON_TABLE[map].apTier[6] = 1025 --20-25 + DUNGEON_TABLE[map].apTier[1] = 175 -- 2-3 + DUNGEON_TABLE[map].apTier[2] = 290 -- 4-6 + DUNGEON_TABLE[map].apTier[3] = 325 -- 7-9 + DUNGEON_TABLE[map].apTier[4] = 465 -- 10-14 + DUNGEON_TABLE[map].apTier[5] = 725 -- 15-19 + DUNGEON_TABLE[map].apTier[6] = 1025 -- 20-25 + DUNGEON_TABLE[map].apBonus = 50 -- 10+ elseif runTime > 1440 and runTime < 2700 then - DUNGEON_TABLE[map].apTier[1] = 300 + DUNGEON_TABLE[map].apTier[1] = 300 DUNGEON_TABLE[map].apTier[2] = 475 DUNGEON_TABLE[map].apTier[3] = 540 DUNGEON_TABLE[map].apTier[4] = 775 DUNGEON_TABLE[map].apTier[5] = 1200 DUNGEON_TABLE[map].apTier[6] = 1700 + DUNGEON_TABLE[map].apBonus = 100 elseif runTime == 2700 then - DUNGEON_TABLE[map].apTier[1] = 375 + DUNGEON_TABLE[map].apTier[1] = 375 DUNGEON_TABLE[map].apTier[2] = 600 DUNGEON_TABLE[map].apTier[3] = 675 DUNGEON_TABLE[map].apTier[4] = 1000 DUNGEON_TABLE[map].apTier[5] = 1500 DUNGEON_TABLE[map].apTier[6] = 2125 + DUNGEON_TABLE[map].apBonus = 125 end end end @@ -136,10 +138,26 @@ local function GetKeyTier(keyLevel) end end -function e.GetMapAP(mapID, keyLevel) +local function GetKeyBonusTokens(keyLevel) + if keyLevel < 10 then + return 0 + elseif keyLevel < 15 then + return (keyLevel % 10) + elseif keyLevel < 20 then + return (keyLevel % 15) + else + return (keyLevel % 20) + end +end + +local function GetMapAP(mapID, keyLevel) return DUNGEON_TABLE[tonumber(mapID)]['apTier'][GetKeyTier(tonumber(keyLevel))] end +local function GetMapBonusAP(mapID) + return DUNGEON_TABLE[tonumber(mapID)].apBonus +end + WEEKLY_AP[2] = 1250 WEEKLY_AP[3] = 1250 WEEKLY_AP[4] = 1925 @@ -147,7 +165,7 @@ WEEKLY_AP[5] = 1925 WEEKLY_AP[6] = 1925 WEEKLY_AP[7] = 2150 WEEKLY_AP[8] = 2150 -WEEKLY_AP[9] = 2150 +WEEKLY_AP[9] = 2150 WEEKLY_AP[10] = 3125 WEEKLY_AP[11] = 3525 WEEKLY_AP[12] = 3925 @@ -161,6 +179,15 @@ WEEKLY_AP[19] = 6600 WEEKLY_AP[20] = 7000 WEEKLY_AP[21] = 7400 WEEKLY_AP[22] = 7800 +-- Here be dragons! +WEEKLY_AP[23] = 8200 +WEEKLY_AP[24] = 8600 +WEEKLY_AP[25] = 9000 +WEEKLY_AP[26] = 9400 +WEEKLY_AP[27] = 9800 +WEEKLY_AP[28] = 10200 +WEEKLY_AP[29] = 10600 +WEEKLY_AP[30] = 11000 function e.GetWeeklyAP(keyLevel) if keyLevel == 0 then return 0 end @@ -169,12 +196,8 @@ end function e.MapApText(mapID, keyLevel) - local amount = e.GetMapAP(mapID, keyLevel) * e.GetAKBonus(e.ParseAKLevel()) - local s = '' - local chest1 = e.ConvertToSI(amount/math.floor(GetMapTime(mapID, 1)/60)) - local chest2 = e.ConvertToSI(amount/math.floor(GetMapTime(mapID, 2)/60)) - local chest3 = e.ConvertToSI(amount/math.floor(GetMapTime(mapID, 3)/60)) + local amount = GetMapAP(mapID, keyLevel) * e.GetAKBonus() + local bonusAmount = (GetMapBonusAP(mapID) * GetKeyBonusTokens(keyLevel)) * e.GetAKBonus() + return e.ConvertToSI(amount + bonusAmount) .. ' AP' - return e.ConvertToSI(amount) .. ' AP\n' .. '+1 ' .. chest1 .. '/m \n+2 ' .. chest2 .. '/m \n+3 ' .. chest3 .. '/m' - -end \ No newline at end of file +end diff --git a/AstralKeys.lua b/AstralKeys.lua index 74e0042..d7a9206 100644 --- a/AstralKeys.lua +++ b/AstralKeys.lua @@ -4,7 +4,7 @@ if not AstralKeys then AstralKeys = {} end if not AstralCharacters then AstralCharacters = {} end if not AstralFriends then AstralFriends = {} end -local initializeTime = {} +local initializeTime = {} initializeTime[1]= 1500390000 -- US Tuesday at reset initializeTime[2]= 1500447600 -- EU Wednesday at reset @@ -30,13 +30,13 @@ function e.ConvertToSI(quantity) while amount > 1000 do power = power + 1 - amount = amount /1000 + amount = amount / 1000 end if amount < 10 then - return string.format('%.2f', amount) .. ' ' .. IMP[power] + return string.format('%.2f', amount) .. ' ' .. SI[power] else - return math.floor(amount) .. ' ' .. IMP[power] + return string.format('%.1f', amount) .. ' ' .. SI[power] end end @@ -58,7 +58,7 @@ AstralEvents:Register('PLAYER_LOGIN', function() else e.FACTION = 1 end - + local region = GetCurrentRegion() local currentTime = GetServerTime() local d = date('*t', currentTime) @@ -114,7 +114,7 @@ AstralEvents:Register('PLAYER_LOGIN', function() end self.elapsed = 0 end - end) + end) elseif d.wday == 4 and d.hour < (7 + hourOffset + (d.isdst and 1 or 0)) and region == 3 then local frame = CreateFrame('FRAME') frame.elapsed = 0 @@ -145,7 +145,7 @@ AstralEvents:Register('PLAYER_LOGIN', function() end self.elapsed = 0 end - end) + end) end for i = 1, #AstralKeys do -- index guild units @@ -155,7 +155,7 @@ AstralEvents:Register('PLAYER_LOGIN', function() for i = 1, #AstralCharacters do -- index player's characters e.SetCharacterID(AstralCharacters[i].unit, i) - end + end for i = 1, #AstralFriends do e.SetFriendID(AstralFriends[i][1], i) diff --git a/AstralKeys.toc b/AstralKeys.toc index c168572..45051f6 100644 --- a/AstralKeys.toc +++ b/AstralKeys.toc @@ -25,4 +25,4 @@ BNFriends.lua Frame Functions.lua Frame.lua MinimapButton.lua -Options.lua \ No newline at end of file +Options.lua diff --git a/BNFriends.lua b/BNFriends.lua index d6aef2f..55f3aab 100644 --- a/BNFriends.lua +++ b/BNFriends.lua @@ -53,13 +53,13 @@ function e.BNFriendUpdate(index) end end - if not BNFriendList[battleTag] then + if not BNFriendList[battleTag] then BNFriendList[battleTag] = {toonName = toonName, client = client, gaID = gaID, usingAK = false} else BNFriendList[battleTag].client = client --Update client, did they log off WoW? BNFriendList[battleTag].presID = presID or 0 -- If they have a presID force an update, else set to 0. Used for all API needing a pressence ID BNFriendList[battleTag].gaID = gaID -- Might as well keep it up to date - end + end end AstralEvents:Register('BN_FRIEND_INFO_CHANGED', e.BNFriendUpdate, 'update_BNFriend') @@ -139,7 +139,7 @@ local function UpdateNonBNetFriendList() local guid = select(20, BNGetGameAccountInfo(gaID)) BNFriendList[battleTag] = {toonName = toonName, client = client, gaID = gaID, usingAK = false} if client == 'WoW' then - local fullName = toonName .. '-' .. select(4, BNGetGameAccountInfo(gaID)) + local fullName = toonName .. '-' .. select(4, BNGetGameAccountInfo(gaID)) if NonBNFriend_List[fullName] then NonBNFriend_List[fullName].isBtag = true -- don't need to send people on WoW friend and bnet friend the same data. end @@ -183,7 +183,7 @@ local function RecieveKey(msg, sender) e.AddUnitToTable(unit, class, faction, 'friend', dungeonID, keyLevel, nil, btag) - if e.FrameListShown() == 'friends' then + if e.FrameListShown() == 'friends' then e.UpdateFrames() end end @@ -192,8 +192,9 @@ AstralComs:RegisterPrefix('WHISPER', UPDATE_VERSION, RecieveKey) local function SyncFriendUpdate(entry, sender) if not AstralKeysSettings.options.friendSync then return end + local bnetID = select(17, BNGetGameAccountInfo(sender)) local btag - if type(sender) == 'number' then + if type(sender) == 'number' then local bnetID = select(17, BNGetGameAccountInfo(sender)) btag = select(3, BNGetFriendInfo(BNGetFriendIndex(bnetID))) end @@ -218,7 +219,7 @@ local function SyncFriendUpdate(entry, sender) week = tonumber(week) timeStamp = tonumber(timeStamp) - if week >= e.Week then + if week >= e.Week then local id = e.FriendID(unit) if id then @@ -236,8 +237,8 @@ local function SyncFriendUpdate(entry, sender) e.AddUnitToTable(unit, class, faction, 'friend', dungeonID, keyLevel, nil, btag) end end - if e.FrameListShown() == 'friends' then - e.UpdateFrames() + if e.FrameListShown() == 'friends' then + e.UpdateFrames() end end AstralComs:RegisterPrefix('BNET', SYNC_VERSION, SyncFriendUpdate) @@ -332,7 +333,7 @@ local function PingFriendsForAstralKeys() local guid = select(20, BNGetGameAccountInfo(gaID)) BNFriendList[battleTag] = {toonName = toonName, client = client, gaID = gaID, usingAK = false} if client == 'WoW' then - local fullName = toonName .. '-' .. select(4, BNGetGameAccountInfo(gaID)) + local fullName = toonName .. '-' .. select(4, BNGetGameAccountInfo(gaID)) if NonBNFriend_List[fullName] then NonBNFriend_List[fullName].isBtag = true -- don't need to send people on WoW friend and bnet friend the same data. end @@ -343,7 +344,7 @@ local function PingFriendsForAstralKeys() end end end - end + end for _, player in pairs(BNFriendList) do if player.client == 'WoW' then @@ -439,7 +440,7 @@ e.AddListFilter('friend', FriendFilter) local function FriendSort(A, v) if v == 5 then v = 1 end if v == 3 then - table.sort(A, function(a, b) + table.sort(A, function(a, b) if AstralKeysSettings.frameOptions.orientation == 0 then return e.GetMapName(a[v]) > e.GetMapName(b[v]) else @@ -458,7 +459,7 @@ local function FriendSort(A, v) end end) else - table.sort(A, function(a, b) + table.sort(A, function(a, b) if AstralKeysSettings.frameOptions.orientation == 0 then return a[v] > b[v] else @@ -469,4 +470,4 @@ local function FriendSort(A, v) end end -e.AddListSort('friend', FriendSort) \ No newline at end of file +e.AddListSort('friend', FriendSort) diff --git a/Character Info.lua b/Character Info.lua index 2114663..f52d3a6 100644 --- a/Character Info.lua +++ b/Character Info.lua @@ -47,7 +47,7 @@ end -- @return int mapID for the highest ran mythic+ for the week -- @return int 0 implies no key run for the week function e.GetCharacterBestMap(id) - return AstralCharacters[id].map + return AstralCharacters[id].map end -- Retrieves faction for character @@ -100,10 +100,10 @@ function e.GetCharacterKey(unit) if not unit then return '' end local id = e.UnitID(unit) - - if id then + + if id then return AstralKeys[id][4] .. ' ' .. C_ChallengeMode.GetMapInfo(AstralKeys[id][3]) -- 4:: key level 3:: mapID else return WrapTextInColorCode('No key found.', 'ff9d9d9d') end -end \ No newline at end of file +end diff --git a/Communications.lua b/Communications.lua index 34b943c..87cd4db 100644 --- a/Communications.lua +++ b/Communications.lua @@ -40,7 +40,7 @@ function AstralComs:RegisterPrefix(channel, prefix, f) if self:IsPrefixRegistered(channel, prefix) then return end -- Did we register something to the same channel with the same name? if not self.dtbl[channel] then self.dtbl[channel] = {} end - + local obj = {} obj.method = f obj.prefix = prefix @@ -190,7 +190,7 @@ local function UpdateUnitKey(msg) local timeStamp = e.WeekTime() -- part of the week we got this key update, used to determine if a key got de-leveled or not local unit, class, dungeonID, keyLevel, weekly, week = strsplit(':', msg) - + dungeonID = tonumber(dungeonID) keyLevel = tonumber(keyLevel) weekly = tonumber(weekly) @@ -211,7 +211,7 @@ local function UpdateUnitKey(msg) e.UpdateFrames() e.AddUnitToTable(unit, class, faction, 'guild', dungeonID, keyLevel, weekly) - + -- Update character frames if we received our own key if unit == e.Player() then e.UpdateCharacterFrames() @@ -228,10 +228,9 @@ local function SyncReceive(entry, sender) local _pos = 0 while find(entry, '_', _pos) do - class, dungeonID, keyLevel, weekly, week, timeStamp = entry:match(':(%a+):(%d+):(%d+):(%d+):(%d+):(%d)', entry:find(':', _pos)) unit = entry:sub(_pos, entry:find(':', _pos) - 1) - + _pos = find(entry, '_', _pos) + 1 dungeonID = tonumber(dungeonID) @@ -240,8 +239,7 @@ local function SyncReceive(entry, sender) week = tonumber(week) timeStamp = tonumber(timeStamp) - if week >= e.Week and e.UnitInGuild(unit) then - + if week >= e.Week and e.UnitInGuild(unit) then local id = e.UnitID(unit) if id then if AstralKeys[id][7] < timeStamp then @@ -275,7 +273,6 @@ AstralComs:RegisterPrefix('GUILD', 'updateWeekly', UpdateWeekly) local function PushKeyList(msg, sender) if sender == e.Player() then return end - wipe(messageStack) for i = 1, #AstralKeys do if e.UnitInGuild(AstralKeys[i][1]) then -- Only send current guild keys, who wants keys from a different guild? @@ -283,7 +280,7 @@ local function PushKeyList(msg, sender) messageStack[#messageStack + 1] = strformat('%s_', table.concat(AstralKeys[i], ':')) end end - + local msg = '' while messageStack[1] do msg = strformat('%s%s', msg, messageStack[1]) @@ -406,4 +403,4 @@ function e.AnnounceNewKey(keyLink, level) if not IsInGroup() then return end if not AstralKeysSettings.options.announceKey then return end SendChatMessage(strformat(ANNOUNCE_MESSAGE, keyLink, level), 'PARTY') -end \ No newline at end of file +end diff --git a/Events.lua b/Events.lua index 1616664..7cb1fa8 100644 --- a/Events.lua +++ b/Events.lua @@ -24,7 +24,7 @@ function AstralEvents:Register(event, f, name) if self:IsRegistered(event, name) then return end -- Event already registered with same name, bail out local obj = self:NewObject(f, name) - if not self.dtbl[event] then + if not self.dtbl[event] then self.dtbl[event] = {} AstralEvents:RegisterEvent(event) end @@ -85,4 +85,4 @@ function AstralEvents:OnEvent(event, ...) end end -AstralEvents:SetScript('OnEvent', AstralEvents.OnEvent) \ No newline at end of file +AstralEvents:SetScript('OnEvent', AstralEvents.OnEvent) diff --git a/Frame Functions.lua b/Frame Functions.lua index 2d1d9ed..b8ac50c 100644 --- a/Frame Functions.lua +++ b/Frame Functions.lua @@ -104,10 +104,10 @@ function e.CreateEditBox(parent, width, label, minValue, maxValue, labelPos) editBox:SetNumeric(true) editBox:SetScript("OnEnterPressed", function(self) self:ClearFocus() - end) + end) editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() - end) + end) if label then editBox.label = e.CreateLabel(editBox, label, labelPos) @@ -119,11 +119,11 @@ function e.CreateEditBox(parent, width, label, minValue, maxValue, labelPos) editBox:SetScript('OnDisable', function(self) self.label:SetTextColor(122/255, 122/255, 122/255) - end) + end) editBox:SetScript('OnEnable', function(self) self.label:SetTextColor(1, 1, 1) - end) + end) editBox:SetScript("OnEditFocusLost", function(self) @@ -133,7 +133,7 @@ function e.CreateEditBox(parent, width, label, minValue, maxValue, labelPos) if self:GetNumber() > self.maxValue then self:SetNumber(self.maxValue) end - end) + end) return editBox @@ -249,11 +249,11 @@ menuFrame:SetScript('OnKeyDown', function(self, key) if key == 'ESCAPE' then AstralMenuFrame:Hide() end - end) +end) menuFrame:SetScript('OnShow', function(self) self:SetPropagateKeyboardInput(true) - end) +end) menuFrame.title = menuFrame:CreateFontString('ARTWORK') menuFrame.title:SetFont(FONT_CONTENT, FONT_SIZE - 1) @@ -308,5 +308,5 @@ function menuFrame:AddSelection(name, onClick, onShow) dtbl[#dtbl]:HookScript('OnClick', HideMenu) end - dtbl[#dtbl]:SetPoint('TOPLEFT', self, 'TOPLEFT', 5, -20*(#dtbl) -5) -end \ No newline at end of file + dtbl[#dtbl]:SetPoint('TOPLEFT', self, 'TOPLEFT', 5, -20*(#dtbl) -5) +end diff --git a/Frame.lua b/Frame.lua index 8fc6db2..db1e717 100644 --- a/Frame.lua +++ b/Frame.lua @@ -50,7 +50,7 @@ local numShown = 0 local characters = {} local characterTable = {} -local function MixIn(D, T) +local function MixIn(D, T) for k,v in pairs(T) do if (type(v) == "function") and (force or (D[k] == nil)) then D[k] = v; @@ -87,7 +87,6 @@ local function CreateButton(parent, btnID, width, height, text, fontobject, high end local function CreateCharacterFrame(parent, frameName, unitName, bestKey, createDivider) - local frame = CreateFrame('FRAME', frameName, parent) frame:SetSize(210, 31) frame:SetFrameLevel(5) @@ -113,12 +112,10 @@ local function CreateCharacterFrame(parent, frameName, unitName, bestKey, create frame.keystone:SetPoint('BOTTOMLEFT', frame, 'BOTTOMLEFT', 10, 0) if createDivider then - frame.divider = frame:CreateTexture('BACKGROUND') frame.divider:SetSize(125, 1) frame.divider:SetPoint('BOTTOMLEFT', frame, 'BOTTOMLEFT', 25) frame.divider:SetColorTexture(.3, .3, .3) - end function frame:UpdateBestDungeon(characterID) @@ -130,7 +127,7 @@ local function CreateCharacterFrame(parent, frameName, unitName, bestKey, create end function frame:UpdateInformation(characterID) - if characterID then + if characterID then self.cid = characterID self.unit = e.CharacterName(characterID) self.realm = e.CharacterRealm(characterID) @@ -158,9 +155,8 @@ local function CreateCharacterFrame(parent, frameName, unitName, bestKey, create end frame:SetScript('OnEnter', function(self) - if self.weeklyAP > 0 then - astralMouseOver:SetText(e.GetMapName(self.bestMap) .. '\n- ' .. e.ConvertToSI(self.weeklyAP * e.GetAKBonus()) .. ' AP in cache') + astralMouseOver:SetText(e.GetMapName(self.bestMap) .. '\n- ' .. e.ConvertToSI(self.weeklyAP * e.GetNextAKBonus()) .. ' AP in cache') else astralMouseOver:SetText('No mythic+ ran this week.') end @@ -170,15 +166,14 @@ local function CreateCharacterFrame(parent, frameName, unitName, bestKey, create astralMouseOver:SetPoint('TOPLEFT', frame, 'BOTTOMRIGHT', - 105, 20) astralMouseOver:Show() AstralCharacterContent.slider:SetAlpha(1) - end) + end) frame:SetScript('OnLeave', function() astralMouseOver:Hide() AstralCharacterContent.slider:SetAlpha(.2) - end) + end) return frame - end local unit_frames = {} @@ -277,7 +272,7 @@ function UnitFrame:SetUnit(unit, class, mapID, keyLevel, cache, faction, btag) end if e.FrameListShown() == 'friend' then self.unitID = e.FriendID(unit) - self.nameString:SetWidth(165) + self.nameString:SetWidth(165) if btag then if tonumber(faction) == e.FACTION then self.nameString:SetText( string.format('%s (%s)', WrapTextInColorCode(btag:sub(1, btag:find('#') - 1), 'ff82c5ff'), WrapTextInColorCode(unit:sub(1, unit:find('-') - 1), select(4, GetClassColor(class))))) @@ -378,7 +373,7 @@ end local function InviteUnit(self) if not self.isConnected then return end - + if e.FrameListShown() == 'guild' then if self.inviteType == 'INVITE' then InviteToGroup(e.Unit(AstralMenuFrame.unit)) @@ -396,7 +391,7 @@ local function InviteUnit(self) BNRequestInviteFriend(e.GetFriendGaID(AstralFriends[AstralMenuFrame.unit][2])) elseif self.inviteType == 'SUGGEST_INVITE' then BNInviteFriend(e.GetFriendGaID(AstralFriends[AstralMenuFrame.unit][2])) - end + end else if self.inviteType == 'INVITE' then BNInviteFriend(e.FriendGUID(e.Friend(AstralMenuFrame.unit))) @@ -404,7 +399,7 @@ local function InviteUnit(self) BNRequestInviteFriend(e.FriendGUID(e.Friend(AstralMenuFrame.unit))) elseif self.inviteType == 'SUGGEST_INVITE' then BNInviteFriend(e.FriendGUID(e.Friend(AstralMenuFrame.unit))) - end + end end end -- GetDisplayedInviteType(guid) @@ -437,7 +432,7 @@ local guildInfo = CreateFrame('FRAME', nil, AstralKeyFrame) guildInfo:SetSize(125, 13) guildInfo:SetPoint('BOTTOMRIGHT', AstralKeyFrame, 'BOTTOMRIGHT', -5, 5) guildInfo:EnableMouse(true) -guildInfo:SetScript('OnMouseDown', function(self) +guildInfo:SetScript('OnMouseDown', function(self) if not astralGuildInfo then local astralGuildInfo = CreateFrame('FRAME', 'astralGuildInfo', UIParent) astralGuildInfo:SetFrameLevel(8) @@ -468,16 +463,16 @@ guildInfo:SetScript('OnMouseDown', function(self) astralGuildInfo.editBox:SetScript('OnChar', function(self, char) self:SetText('www.astralguild.com') self:HighlightText() + end) astralGuildInfo.editBox:SetScript("OnEscapePressed", function(self) astralGuildInfo:Hide() end) - end) astralGuildInfo.editBox:SetScript('OnEditFocusLost', function(self) self:SetText('www.astralguild.com') self:HighlightText() - end) + end) astralGuildInfo.button = CreateButton(astralGuildInfo, nil, 40, 20, 'OK', FONT_OBJECT_CENTRE, FONT_OBJECT_HIGHLIGHT) astralGuildInfo.button:SetBackdrop(BACKDROPBUTTON) @@ -486,11 +481,12 @@ guildInfo:SetScript('OnMouseDown', function(self) astralGuildInfo.button.t:ClearAllPoints() astralGuildInfo.button.t = nil astralGuildInfo.button:SetScript('OnClick', function(self) - astralGuildInfo:Hide() end) + astralGuildInfo:Hide() + end) else astralGuildInfo:Show() end - end) +end) guildInfo.string = guildInfo:CreateFontString('ARTWORK') guildInfo.string:SetFont(FONT_CONTENT, FONT_SIZE - 2) @@ -510,7 +506,7 @@ logo:SetTexture('Interface\\AddOns\\AstralKeys\\Media\\Astral.tga') logo:SetPoint('TOPLEFT', AstralKeyFrame, 'TOPLEFT', 10, -10) local title = e.CreateHeader(AstralKeyFrame, 'title', 220, 20, 'Astral Keys', 26) -title:SetPoint('LEFT', logo, 'RIGHT', 10, 7) +title:SetPoint('LEFT', logo, 'RIGHT', 10, 7) ----------------------------------- ---- Guild/Friend List buttons @@ -548,10 +544,10 @@ toggleButton:SetPoint('TOPRIGHT', closeButton, 'TOPLEFT', - 5, 0) toggleButton:SetNormalTexture('Interface\\AddOns\\AstralKeys\\Media\\minimize.tga') toggleButton:SetScript('OnEnter', function(self) self:GetNormalTexture():SetVertexColor(126/255, 126/255, 126/255) - end) +end) toggleButton:SetScript('OnLeave', function(self) self:GetNormalTexture():SetVertexColor(1, 1, 1) - end) +end) toggleButton:SetScript('OnClick', function(self) local left, bottom, width = AstralKeyFrame:GetRect() @@ -578,7 +574,7 @@ toggleButton:SetScript('OnClick', function(self) AstralContentFrame:ClearAllPoints() AstralContentFrame:SetPoint('TOPLEFT', AstralKeyFrame, 'TOPLEFT', 255, -95) end - end) +end) local optionsButton = CreateFrame('BUTTON', nil, AstralKeyFrame) optionsButton:SetSize(16, 16) @@ -586,14 +582,14 @@ optionsButton:SetPoint('TOPRIGHT', toggleButton, 'TOPLEFT', -5, 0) optionsButton:SetNormalTexture('Interface\\AddOns\\AstralKeys\\Media\\menu3.tga') optionsButton:SetScript('OnEnter', function(self) self:GetNormalTexture():SetVertexColor(126/255, 126/255, 126/255) - end) +end) optionsButton:SetScript('OnLeave', function(self) self:GetNormalTexture():SetVertexColor(1, 1, 1) - end) +end) optionsButton:SetScript('OnClick', function() AstralOptionsFrame:SetShown( not AstralOptionsFrame:IsShown()) - end) +end) -- Announce Buttons @@ -618,7 +614,7 @@ end announceFrame.announce:SetScript('OnClick', function(self) e.ToggleAnnounce() - end) +end) announceFrame.string = announceFrame:CreateFontString('ARTWORK') announceFrame.string:SetFont(FONT_CONTENT, FONT_SIZE) @@ -635,7 +631,7 @@ partyAnnounce:SetPoint('LEFT', announceFrame.announce, 'RIGHT', 5, 0) partyAnnounce:SetScript('OnClick', function() e.AnnounceCharacterKeys('PARTY') - end) +end) local guildAnnounce = CreateFrame('BUTTON', nil, announceFrame) guildAnnounce:SetSize(15, 15) @@ -648,7 +644,7 @@ guildAnnounce:SetPoint('LEFT', partyAnnounce, 'RIGHT') guildAnnounce:SetScript('OnClick', function() e.AnnounceCharacterKeys('GUILD') - end) +end) -- Tooltip AstralKeyFrame @@ -704,11 +700,11 @@ affixFrame:SetScript('OnEnter', function(self) mouseOverFrame:SetText('Next week\'s affixes\n -' .. C_ChallengeMode.GetAffixInfo(e.AffixOne(1)) .. '\n -' .. C_ChallengeMode.GetAffixInfo(e.AffixTwo(1)) .. '\n -' .. C_ChallengeMode.GetAffixInfo(e.AffixThree(1))) mouseOverFrame:AdjustSize() mouseOverFrame:Show() - end) +end) affixFrame:SetScript('OnLeave', function(self) mouseOverFrame:Hide() - end) +end) local affixHeader = e.CreateHeader(affixFrame, 'affixHeader', 175, 20, 'Affixes', 12) affixHeader:SetPoint('TOPLEFT', affixFrame, 'TOPLEFT') @@ -740,12 +736,11 @@ affixOne:SetScript('OnEnter', function(self) astralMouseOver:AdjustSize(150) astralMouseOver:SetPoint('TOPLEFT', self, 'BOTTOMRIGHT', -15, 10) astralMouseOver:Show() - - end) +end) affixOne:SetScript('OnLeave', function() astralMouseOver:Hide() - end) +end) local affixTwo = CreateFrame('FRAME', 'AstralAffixTwo', affixFrame) --affixTwo.aid = e.GetAffix(2) @@ -774,12 +769,11 @@ affixTwo:SetScript('OnEnter', function(self) astralMouseOver:AdjustSize(150) astralMouseOver:SetPoint('TOPLEFT', self, 'BOTTOMRIGHT', -15, 10) astralMouseOver:Show() - - end) +end) affixTwo:SetScript('OnLeave', function() astralMouseOver:Hide() - end) +end) local affixThree = CreateFrame('FRAME', 'AstralAffixThree', affixFrame) --affixThree.aid = e.GetAffix(3) @@ -801,19 +795,18 @@ function affixThree:UpdateInfo() self.texture:SetTexture(select(3, C_ChallengeMode.GetAffixInfo(self.aid))) end -affixThree:SetScript('OnEnter', function(self) +affixThree:SetScript('OnEnter', function(self) if tonumber(self.aid) == 0 or not self.aid then return end astralMouseOver:SetText(select(2, C_ChallengeMode.GetAffixInfo(self.aid))) astralMouseOver:AdjustSize(150) astralMouseOver:SetPoint('TOPLEFT', self, 'BOTTOMRIGHT', -15, 10) astralMouseOver:Show() - - end) +end) affixThree:SetScript('OnLeave', function() astralMouseOver:Hide() - end) +end) -- Character Frames ---------------------------------------------------------------- @@ -833,11 +826,11 @@ characterContent.slider:SetAlpha(.2) characterContent:SetScript('OnEnter', function() AstralCharacterContent.slider:SetAlpha(1) - end) +end) characterContent:SetScript('OnLeave', function() AstralCharacterContent.slider:SetAlpha(.2) - end) +end) -- Key Frames ---------------------------------------------------------------- @@ -864,24 +857,23 @@ contentFrame:SetScript('OnMouseWheel', function(self, delta) if sortedTable.numShown < 26 then return end offset = offset - (delta * math.ceil(sortedTable.numShown/25)) - + offset = math.max(0, offset) offset = math.min(offset, sortedTable.numShown - 25) - + e.UpdateLines() contentFrame.slider:ClearAllPoints() contentFrame.slider:SetPoint('TOPLEFT', contentFrame, 'TOPRIGHT', 0, -offset/(sortedTable.numShown - 25) * 365) - - end) +end) contentFrame:SetScript('OnEnter', function() contentFrame.slider:SetAlpha(1) - end) +end) contentFrame:SetScript('OnLeave', function() contentFrame.slider:SetAlpha(0.2) - end) +end) local keyButton = CreateButton(contentFrame, 'keyButton', 45, 20, 'Level', FONT_OBJECT_CENTRE, FONT_OBJECT_HIGHLIGHT) --75 keyButton:SetPoint('BOTTOMLEFT', contentFrame, 'TOPLEFT') @@ -899,8 +891,7 @@ keyButton:SetScript('OnClick', function() AstralKeysSettings.frameOptions.sortMethod = 4 e.SortTable(sortedTable[e.FrameListShown()], AstralKeysSettings.frameOptions.sortMethod) e.UpdateLines() - - end) +end) local mapButton = CreateButton(contentFrame, 'mapButton', 170, 20, 'Dungeon', FONT_OBJECT_CENTRE, FONT_OBJECT_HIGHLIGHT) mapButton:SetPoint('LEFT', keyButton, 'RIGHT') @@ -917,8 +908,7 @@ mapButton:SetScript('OnClick', function() AstralKeysSettings.frameOptions.sortMethod = 3 e.SortTable(sortedTable[e.FrameListShown()], AstralKeysSettings.frameOptions.sortMethod) e.UpdateLines() - - end) +end) local nameButton = CreateButton(contentFrame, 'nameButton', 130, 20, 'Player', FONT_OBJECT_CENTRE, FONT_OBJECT_HIGHLIGHT) nameButton:SetPoint('LEFT', mapButton, 'RIGHT') @@ -935,8 +925,7 @@ nameButton:SetScript('OnClick', function() AstralKeysSettings.frameOptions.sortMethod = 1 e.SortTable(sortedTable[e.FrameListShown()], AstralKeysSettings.frameOptions.sortMethod) e.UpdateLines() - - end) +end) local completeButton = CreateButton(contentFrame, 'completeButton', 30, 20, e.CACHE_LEVEL .. '+', FONT_OBJECT_CENTRE, FONT_OBJECT_HIGHLIGHT) completeButton:SetPoint('LEFT', nameButton, 'RIGHT') @@ -953,8 +942,7 @@ completeButton:SetScript('OnClick', function() AstralKeysSettings.frameOptions.sortMethod = 5 e.SortTable(sortedTable[e.FrameListShown()], AstralKeysSettings.frameOptions.sortMethod) e.UpdateLines() - - end) +end) function AstralKeyFrame:OnUpdate(elapsed) self.updateDelay = self.updateDelay + elapsed @@ -975,7 +963,7 @@ guildButton:SetScript('OnClick', function() AstralContentFrame:ResetSlider() friendButton:SetNormalTexture(nil) friendButton:SetText(WrapTextInColorCode('Friend list', 'ff9d9d9d')) - + guildButton:SetNormalTexture(guildButton:GetHighlightTexture()) guildButton:SetText('Guild list') e.SetFrameListShown('guild') @@ -983,7 +971,7 @@ guildButton:SetScript('OnClick', function() completeButton:Show() nameButton:SetW(130) end - end) +end) friendButton:SetScript('OnClick', function() if AstralMenuFrame:IsShown() then @@ -996,14 +984,14 @@ friendButton:SetScript('OnClick', function() guildButton:SetText(WrapTextInColorCode('Guild list', 'ff9d9d9d')) guildButton:SetNormalTexture(nil) - friendButton:SetNormalTexture(friendButton:GetHighlightTexture()) + friendButton:SetNormalTexture(friendButton:GetHighlightTexture()) friendButton:SetText('Friend list') e.UpdateFrames() completeButton:Hide() nameButton:SetW(180) end - end) +end) function AstralKeyFrame:ToggleLists() if AstralKeysSettings.options.friendSync then @@ -1013,9 +1001,9 @@ function AstralKeyFrame:ToggleLists() guildButton:Hide() friendButton:Hide() if e.FrameListShown() == 'friend' then - friendButton:SetNormalTexture(nil) + friendButton:SetNormalTexture(nil) friendButton:SetText(WrapTextInColorCode('Friend list', 'ff9d9d9d')) - + guildButton:SetNormalTexture(guildButton:GetHighlightTexture()) guildButton:SetText('Guild list') e.SetFrameListShown('guild') @@ -1031,20 +1019,20 @@ AstralKeyFrame:SetScript('OnKeyDown', function(self, key) self:SetPropagateKeyboardInput(false) AstralKeyFrame:Hide() end - end) +end) AstralKeyFrame:SetScript('OnShow', function(self) e.UpdateFrames() self:SetPropagateKeyboardInput(true) - end) +end) AstralKeyFrame:SetScript('OnDragStart', function(self) self:StartMoving() - end) +end) AstralKeyFrame:SetScript('OnDragStop', function(self) self:StopMovingOrSizing() - end) +end) for i = 1, 25 do unit_frames[i] = UnitFrame:NewFrame(AstralContentFrame) @@ -1096,7 +1084,7 @@ local function InitializeFrame() local id = e.GetCharacterID(e.Player()) - -- Only create 9 character frames in total, first is reserved for current logged in character if + -- Only create 9 character frames in total, first is reserved for current logged in character if if id then -- We are logged into a character that has a key characters[1] = CreateCharacterFrame(characterFrame, nil, characterTable[id].unit, nil, false) characters[1]:SetPoint('TOPLEFT', characterHeader, 'BOTTOMLEFT', 0, -5) @@ -1136,7 +1124,6 @@ local function InitializeFrame() characterOffset = characterOffset - delta e.UpdateCharacterFrames() end - else if characterOffset > 0 then -- Scroll up characterOffset = characterOffset - delta @@ -1146,12 +1133,10 @@ local function InitializeFrame() characterContent.slider:ClearAllPoints() characterContent.slider:SetPoint('TOPLEFT', characterContent, 'TOPRIGHT', 0, characterContent:GetHeight() * -characterOffset/(#characterTable - #characters)) - - end) + end) e.UpdateFrames() e.UpdateCharacterFrames() - end function e.UpdateAffixes() @@ -1223,7 +1208,7 @@ function e.UpdateCharacterFrames() characters[i]:UpdateInformation(e.GetCharacterID(characterTable[i + characterOffset - 1].unit)) else characters[i]:UpdateInformation('') - end + end end else for i = 1, #characters do @@ -1270,4 +1255,4 @@ local function handler(msg) end SlashCmdList['ASTRALKEYS'] = handler; -SlashCmdList['ASTRALKEYSV'] = function(msg) e.VersionCheck() end \ No newline at end of file +SlashCmdList['ASTRALKEYSV'] = function(msg) e.VersionCheck() end diff --git a/Key Information.lua b/Key Information.lua index bcbf516..0d26fec 100644 --- a/Key Information.lua +++ b/Key Information.lua @@ -133,7 +133,7 @@ end -- Parses item link to get mapID, key level, affix1, affix2, affix3 -- @param link Item Link for keystone --- return int ID's for mapID, keyLevel, affix1, affix2, affix3 +-- return int ID's for mapID, keyLevel, affix1, affix2, affix3 -- return ex. 239 12 4 5 10 function e.ParseLink(link) if not link:find('keystone') then return end -- Not a keystone link, don't do anything, also something went wrong shouldn't be here if not keystone link @@ -168,7 +168,7 @@ end -- Deprecated --[[ -if not AstralAffixes then +if not AstralAffixes then AstralAffixes = {} AstralAffixes[1] = 0 AstralAffixes[2] = 0 @@ -182,4 +182,4 @@ end function e.GetAffix(affixNumber) return AstralAffixes[affixNumber] end -]] \ No newline at end of file +]] diff --git a/MinimapButton.lua b/MinimapButton.lua index 464228a..62e6051 100644 --- a/MinimapButton.lua +++ b/MinimapButton.lua @@ -20,4 +20,4 @@ function addon:OnInitialize() }, }) e.icon:Register("AstralKeys", astralkeysLDB, self.db.profile.minimap) -end \ No newline at end of file +end diff --git a/Options.lua b/Options.lua index 7d86627..bbe8d56 100644 --- a/Options.lua +++ b/Options.lua @@ -66,11 +66,11 @@ AstralOptionsFrame:Hide() AstralOptionsFrame:SetScript('OnDragStart', function(self) self:StartMoving() - end) +end) AstralOptionsFrame:SetScript('OnDragStop', function(self) self:StopMovingOrSizing() - end) +end) local logo = AstralOptionsFrame:CreateTexture('ARTWORK') logo:SetSize(64, 64) @@ -92,7 +92,7 @@ closeButton:SetScript('OnClick', function() end) -- Content frame to anchor all option panels --- +-- local contentFrame = CreateFrame('FRAME', 'AstralFrame_OptionContent', AstralOptionsFrame) contentFrame:SetPoint('TOPLEFT', logo, 'BOTTOMLEFT', 5, -10) contentFrame:SetSize(630, 350) @@ -106,7 +106,7 @@ showOffLine:SetScript('OnClick', function(self) AstralKeysSettings.options.showOffline = self:GetChecked() AstralContentFrame:ResetSlider() e.UpdateFrames() - end) +end) local showMinimap = e.CreateCheckBox(contentFrame, 'Show Minimap button') showMinimap:SetPoint('LEFT', showOffLine, 'RIGHT', 10, 0) @@ -120,13 +120,13 @@ showMinimap:SetScript('OnClick', function(self) if IsAddOnLoaded('ElvUI_Enhanced') then ElvUI[1]:GetModule('MinimapButtons'):UpdateLayout() end - end) +end) local announceKeys = e.CreateCheckBox(contentFrame, 'Announce new keys to party') announceKeys:SetPoint('LEFT', showMinimap, 'RIGHT', 10, 0) announceKeys:SetScript('OnClick', function(self) e.ToggleAnnounce() - end) +end) contentFrame.syncHeader = e.CreateHeader(contentFrame, 'sync_header', 200, 20, 'Syncing Options', 10) contentFrame.syncHeader:SetPoint('TOPLEFT', showOffLine, 'BOTTOMLEFT', 0, -10) @@ -137,20 +137,20 @@ syncFriends:SetScript('OnClick', function(self) AstralKeysSettings.options.friendSync= self:GetChecked() AstralKeyFrame:ToggleLists() e.ToggleFriendSync() - end) +end) local minFriendSync = e.CreateEditBox(contentFrame, 25, 'Minimum key level to send to friends', 2, 99, 'LEFT') minFriendSync:SetPoint('LEFT', syncFriends, 'RIGHT', 245, 0) minFriendSync:HookScript('OnEditFocusLost', function(self) AstralKeysSettings.options.minFriendSync = self:GetNumber() - end) +end) local otherFaction = e.CreateCheckBox(contentFrame, 'Show other faction') otherFaction:SetPoint('TOPLEFT', syncFriends, 'BOTTOMLEFT', 0, -5) otherFaction:SetScript('OnClick', function(self) AstralKeysSettings.options.showOtherFaction = self:GetChecked() e.UpdateFrames() - end) +end) local filter_header = e.CreateHeader(contentFrame, 'filter_header', 200, 20, 'Rank filter for Guild list', 10) filter_header:SetPoint('TOPLEFT', otherFaction, 'BOTTOMLEFT', 0, -10) @@ -200,7 +200,7 @@ function InitData() if AstralKeysSettings.frameOptions.list == 'guild' then e.UpdateFrames() end - end) + end) end end AstralEvents:Register('PLAYER_LOGIN', InitData, 'initOptions') @@ -210,8 +210,8 @@ AstralOptionsFrame:SetScript('OnKeyDown', function(self, key) self:SetPropagateKeyboardInput(false) AstralOptionsFrame:Hide() end - end) +end) AstralOptionsFrame:SetScript('OnShow', function(self) self:SetPropagateKeyboardInput(true) - end) \ No newline at end of file +end) diff --git a/Settings.lua b/Settings.lua index d642bc0..b36b47c 100644 --- a/Settings.lua +++ b/Settings.lua @@ -27,7 +27,7 @@ function e.DataResetTime() hours = 7 + (d.isdst and 1 or 0) + hourOffset if d.wday > 3 then if d.wday == 4 then - days = (d.hour < hours and 0 or 7) + days = (d.hour < hours and 0 or 7) else days = 11 - d.wday end @@ -122,7 +122,7 @@ frame:SetScript('OnEvent', function(self, event, ...) end end frame:UnregisterEvent('ADDON_LOADED') - end) +end) function e.FrameListShown() return AstralKeysSettings.frameOptions.list @@ -130,4 +130,4 @@ end function e.SetFrameListShown(data) AstralKeysSettings.frameOptions.list = data -end \ No newline at end of file +end diff --git a/Tables.lua b/Tables.lua index 0a79dc1..ede0d6a 100644 --- a/Tables.lua +++ b/Tables.lua @@ -41,7 +41,7 @@ end SORT_MEDTHOD['guild'] = function(A, v) if v == 3 then - table.sort(A, function(a, b) + table.sort(A, function(a, b) if AstralKeysSettings.frameOptions.orientation == 0 then return e.GetMapName(a[v]) > e.GetMapName(b[v]) else @@ -81,4 +81,4 @@ function e.DeepCopy(orig) copy = orig end return copy -end \ No newline at end of file +end diff --git a/Unit Information.lua b/Unit Information.lua index 1c57adf..d05ae83 100644 --- a/Unit Information.lua +++ b/Unit Information.lua @@ -84,4 +84,4 @@ end function e.UnitMapID(id) if not id then return nil end return AstralKeys[id][3] -end \ No newline at end of file +end diff --git a/embeds.xml b/embeds.xml index 13de029..869b73f 100644 --- a/embeds.xml +++ b/embeds.xml @@ -1,12 +1,10 @@ - - -