Fixed /keystone command; Fixed issues with nicknames
This commit is contained in:
@@ -697,6 +697,28 @@ function DF:trim (s)
|
||||
return from > #s and "" or s:match(".*%S", from)
|
||||
end
|
||||
|
||||
--truncated revoming at a maximum of 10 character from the string
|
||||
function DF:TruncateTextSafe(fontString, maxWidth)
|
||||
local text = fontString:GetText()
|
||||
local numIterations = 10
|
||||
|
||||
while (fontString:GetStringWidth() > maxWidth) do
|
||||
text = strsub(text, 1, #text-1)
|
||||
fontString:SetText(text)
|
||||
if (#text <= 1) then
|
||||
break
|
||||
end
|
||||
|
||||
numIterations = numIterations - 1
|
||||
if (numIterations <= 0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
text = DF:CleanTruncateUTF8String(text)
|
||||
fontString:SetText(text)
|
||||
end
|
||||
|
||||
function DF:TruncateText (fontString, maxWidth)
|
||||
local text = fontString:GetText()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ Code Rules:
|
||||
- Public callbacks are callbacks registered by an external addon.
|
||||
|
||||
Change Log:
|
||||
- added "KeystoneWipe" callback
|
||||
- finished keystone info, see docs
|
||||
- added interrupts to cooldown tracker, new filter: "interrupt"
|
||||
- after encounter_end cooldowns now check for cooldowns reset.
|
||||
@@ -45,7 +46,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE) then
|
||||
end
|
||||
|
||||
local major = "LibOpenRaid-1.0"
|
||||
local CONST_LIB_VERSION = 37
|
||||
local CONST_LIB_VERSION = 39
|
||||
LIB_OPEN_RAID_CAN_LOAD = false
|
||||
|
||||
--declae the library within the LibStub
|
||||
@@ -153,17 +154,13 @@ LIB_OPEN_RAID_CAN_LOAD = false
|
||||
function openRaidLib.commHandler.OnReceiveComm(self, event, prefix, text, channel, sender, target, zoneChannelID, localID, name, instanceID)
|
||||
--check if the data belong to us
|
||||
if (prefix == CONST_COMM_PREFIX) then
|
||||
--check if the lib can receive comms
|
||||
if (not openRaidLib.IsCommAllowed()) then
|
||||
return
|
||||
end
|
||||
|
||||
sender = Ambiguate(sender, "none")
|
||||
|
||||
--don't receive comms from the player it self
|
||||
local playerName = UnitName("player")
|
||||
if (playerName == sender) then
|
||||
--return
|
||||
return
|
||||
end
|
||||
|
||||
local data = text
|
||||
@@ -179,6 +176,13 @@ LIB_OPEN_RAID_CAN_LOAD = false
|
||||
return
|
||||
end
|
||||
|
||||
--if this is isn't a keystone data comm, check if the lib can receive comms
|
||||
if (dataTypePrefix ~= CONST_COMM_KEYSTONE_DATA_PREFIX and dataTypePrefix ~= CONST_COMM_KEYSTONE_DATAREQUEST_PREFIX) then
|
||||
if (not openRaidLib.IsCommAllowed()) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
--get the table with functions regitered for this type of data
|
||||
local callbackTable = openRaidLib.commHandler.commCallback[dataTypePrefix]
|
||||
if (not callbackTable) then
|
||||
@@ -361,6 +365,7 @@ LIB_OPEN_RAID_CAN_LOAD = false
|
||||
"TalentUpdate",
|
||||
"PvPTalentUpdate",
|
||||
"KeystoneUpdate",
|
||||
"KeystoneWipe",
|
||||
}
|
||||
|
||||
--save build the table to avoid lose registered events on older versions
|
||||
@@ -1967,6 +1972,25 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRai
|
||||
end
|
||||
end
|
||||
|
||||
function openRaidLib.WipeKeystoneData()
|
||||
wipe(openRaidLib.KeystoneInfoManager.KeystoneData)
|
||||
--trigger public callback
|
||||
openRaidLib.publicCallback.TriggerCallback("KeystoneWipe", openRaidLib.KeystoneInfoManager.KeystoneData)
|
||||
|
||||
--keystones are only available on retail
|
||||
if (not checkClientVersion("retail")) then
|
||||
return
|
||||
end
|
||||
|
||||
--generate keystone info for the player
|
||||
local unitName = UnitName("player")
|
||||
local keystoneInfo = openRaidLib.KeystoneInfoManager.GetKeystoneInfo(unitName, true)
|
||||
openRaidLib.KeystoneInfoManager.UpdatePlayerKeystoneInfo(keystoneInfo)
|
||||
|
||||
openRaidLib.publicCallback.TriggerCallback("KeystoneUpdate", unitName, keystoneInfo, openRaidLib.KeystoneInfoManager.KeystoneData)
|
||||
return true
|
||||
end
|
||||
|
||||
--> manager constructor
|
||||
openRaidLib.KeystoneInfoManager = {
|
||||
--structure:
|
||||
@@ -2000,23 +2024,17 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRai
|
||||
end
|
||||
end
|
||||
|
||||
local updateKeystoneInfo = function(keystoneInfo, level, mapID, challengeMapID, classID, rating, mythicPlusMapID)
|
||||
keystoneInfo.level = level or C_MythicPlus.GetOwnedKeystoneLevel() or 0
|
||||
keystoneInfo.mapID = mapID or C_MythicPlus.GetOwnedKeystoneMapID() or 0
|
||||
keystoneInfo.mythicPlusMapID = mythicPlusMapID or 0
|
||||
|
||||
if (not mythicPlusMapID and not mapID and keystoneInfo.mapID ~= 0) then
|
||||
keystoneInfo.mythicPlusMapID = getMythicPlusMapID() or 0
|
||||
end
|
||||
|
||||
keystoneInfo.challengeMapID = challengeMapID or C_MythicPlus.GetOwnedKeystoneChallengeMapID() or 0
|
||||
function openRaidLib.KeystoneInfoManager.UpdatePlayerKeystoneInfo(keystoneInfo)
|
||||
keystoneInfo.level = C_MythicPlus.GetOwnedKeystoneLevel() or 0
|
||||
keystoneInfo.mapID = C_MythicPlus.GetOwnedKeystoneMapID() or 0
|
||||
keystoneInfo.mythicPlusMapID = getMythicPlusMapID() or 0
|
||||
keystoneInfo.challengeMapID = C_MythicPlus.GetOwnedKeystoneChallengeMapID() or 0
|
||||
|
||||
local _, _, playerClassID = UnitClass("player")
|
||||
keystoneInfo.classID = classID or playerClassID
|
||||
keystoneInfo.classID = playerClassID
|
||||
|
||||
local ratingSummary = C_PlayerInfo.GetPlayerMythicPlusRatingSummary("player")
|
||||
local currentRating = ratingSummary and ratingSummary.currentSeasonScore or 0
|
||||
keystoneInfo.rating = rating or currentRating
|
||||
keystoneInfo.rating = ratingSummary and ratingSummary.currentSeasonScore or 0
|
||||
end
|
||||
|
||||
function openRaidLib.KeystoneInfoManager.GetAllKeystonesInfo()
|
||||
@@ -2031,14 +2049,14 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRai
|
||||
openRaidLib.TCopy(keystoneInfo, keystoneTablePrototype)
|
||||
openRaidLib.KeystoneInfoManager.KeystoneData[unitName] = keystoneInfo
|
||||
end
|
||||
|
||||
updateKeystoneInfo(keystoneInfo)
|
||||
return keystoneInfo
|
||||
end
|
||||
|
||||
local getKeystoneInfoToComm = function()
|
||||
local playerName = UnitName("player")
|
||||
local keystoneInfo = openRaidLib.KeystoneInfoManager.GetKeystoneInfo(playerName, true)
|
||||
openRaidLib.KeystoneInfoManager.UpdatePlayerKeystoneInfo(keystoneInfo)
|
||||
|
||||
local dataToSend = CONST_COMM_KEYSTONE_DATA_PREFIX .. "," .. keystoneInfo.level .. "," .. keystoneInfo.mapID .. "," .. keystoneInfo.challengeMapID .. "," .. keystoneInfo.classID .. "," .. keystoneInfo.rating .. "," .. keystoneInfo.mythicPlusMapID
|
||||
return dataToSend
|
||||
end
|
||||
@@ -2055,20 +2073,23 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRai
|
||||
diagnosticComm("SendPlayerKeystoneInfoToGuild| " .. dataToSend) --debug
|
||||
end
|
||||
|
||||
--when a request data is received, only send the data to party and guild
|
||||
--sending stuff to raid need to be called my the application with 'openRaidLib.RequestKeystoneDataFromRaid()'
|
||||
function openRaidLib.KeystoneInfoManager.OnReceiveRequestData()
|
||||
if (not checkClientVersion("retail")) then
|
||||
return
|
||||
end
|
||||
|
||||
--update the information about the key stone the player has
|
||||
openRaidLib.KeystoneInfoManager.GetKeystoneInfo(UnitName("player"), true)
|
||||
local keystoneInfo = openRaidLib.KeystoneInfoManager.GetKeystoneInfo(UnitName("player"), true)
|
||||
openRaidLib.KeystoneInfoManager.UpdatePlayerKeystoneInfo(keystoneInfo)
|
||||
|
||||
if (IsInGroup() and not IsInRaid()) then
|
||||
openRaidLib.Schedules.NewUniqueTimer(1 + math.random(1, 3), openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToParty, "KeystoneInfoManager", "sendKeystoneInfoToParty_Schedule")
|
||||
openRaidLib.Schedules.NewUniqueTimer(0.1, openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToParty, "KeystoneInfoManager", "sendKeystoneInfoToParty_Schedule")
|
||||
end
|
||||
|
||||
if (IsInGuild()) then
|
||||
openRaidLib.Schedules.NewUniqueTimer(1 + math.random(1, 3), openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToGuild, "KeystoneInfoManager", "sendKeystoneInfoToGuild_Schedule")
|
||||
openRaidLib.Schedules.NewUniqueTimer(math.random(0, 3) + math.random(), openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToGuild, "KeystoneInfoManager", "sendKeystoneInfoToGuild_Schedule")
|
||||
end
|
||||
end
|
||||
openRaidLib.commHandler.RegisterComm(CONST_COMM_KEYSTONE_DATAREQUEST_PREFIX, openRaidLib.KeystoneInfoManager.OnReceiveRequestData)
|
||||
@@ -2087,7 +2108,12 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRai
|
||||
|
||||
if (level and mapID and challengeMapID and classID and rating and mythicPlusMapID) then
|
||||
local keystoneInfo = openRaidLib.KeystoneInfoManager.GetKeystoneInfo(unitName, true)
|
||||
updateKeystoneInfo(keystoneInfo, level, mapID, challengeMapID, classID, rating, mythicPlusMapID)
|
||||
keystoneInfo.level = level
|
||||
keystoneInfo.mapID = mapID
|
||||
keystoneInfo.mythicPlusMapID = mythicPlusMapID
|
||||
keystoneInfo.challengeMapID = challengeMapID
|
||||
keystoneInfo.classID = classID
|
||||
keystoneInfo.rating = rating
|
||||
|
||||
--trigger public callback
|
||||
openRaidLib.publicCallback.TriggerCallback("KeystoneUpdate", unitName, keystoneInfo, openRaidLib.KeystoneInfoManager.KeystoneData)
|
||||
@@ -2104,9 +2130,11 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRai
|
||||
|
||||
if (IsInGroup() and not IsInRaid()) then
|
||||
--update the information about the key stone the player has
|
||||
openRaidLib.KeystoneInfoManager.GetKeystoneInfo(UnitName("player"), true)
|
||||
--send to the group which kstone the player has
|
||||
openRaidLib.Schedules.NewUniqueTimer(1 + math.random(1, 3), openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToParty, "KeystoneInfoManager", "sendKeystoneInfoToParty_Schedule")
|
||||
local keystoneInfo = openRaidLib.KeystoneInfoManager.GetKeystoneInfo(UnitName("player"), true)
|
||||
openRaidLib.KeystoneInfoManager.UpdatePlayerKeystoneInfo(keystoneInfo)
|
||||
|
||||
--send to the group which keystone the player has
|
||||
openRaidLib.Schedules.NewUniqueTimer(1 + math.random(0, 2) + math.random(), openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToParty, "KeystoneInfoManager", "sendKeystoneInfoToParty_Schedule")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2121,6 +2149,8 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRai
|
||||
--trigger public callback
|
||||
local unitName = UnitName("player")
|
||||
local keystoneInfo = openRaidLib.KeystoneInfoManager.GetKeystoneInfo(unitName, true)
|
||||
openRaidLib.KeystoneInfoManager.UpdatePlayerKeystoneInfo(keystoneInfo)
|
||||
|
||||
openRaidLib.publicCallback.TriggerCallback("KeystoneUpdate", unitName, keystoneInfo, openRaidLib.KeystoneInfoManager.KeystoneData)
|
||||
end
|
||||
|
||||
@@ -2135,6 +2165,8 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRai
|
||||
--trigger public callback
|
||||
local unitName = UnitName("player")
|
||||
local keystoneInfo = openRaidLib.KeystoneInfoManager.GetKeystoneInfo(unitName, true)
|
||||
openRaidLib.KeystoneInfoManager.UpdatePlayerKeystoneInfo(keystoneInfo)
|
||||
|
||||
openRaidLib.publicCallback.TriggerCallback("KeystoneUpdate", unitName, keystoneInfo, openRaidLib.KeystoneInfoManager.KeystoneData)
|
||||
end
|
||||
|
||||
|
||||
@@ -417,4 +417,15 @@ function MyAddonObject.OnKeystoneUpdate(unitName, keystoneInfo, allKeystoneInfo)
|
||||
end
|
||||
|
||||
--registering the callback:
|
||||
openRaidLib.RegisterCallback(MyAddonObject, "KeystoneUpdate", "OnKeystoneUpdate")
|
||||
openRaidLib.RegisterCallback(MyAddonObject, "KeystoneUpdate", "OnKeystoneUpdate")
|
||||
|
||||
===================================================================================================================================
|
||||
"KeystoneWipe": triggered after the call openRaidLib.WipeKeystoneData()
|
||||
===================================================================================================================================
|
||||
|
||||
function MyAddonObject.OnKeystoneUpdate(allKeystoneInfo)
|
||||
print("no keystone data:", next(allKeystoneInfo) == nil)
|
||||
end
|
||||
|
||||
--registering the callback:
|
||||
openRaidLib.RegisterCallback(MyAddonObject, "KeystoneWipe", "OnKeystoneWipe")
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
local version, build, date, tocversion = GetBuildInfo()
|
||||
|
||||
_detalhes.build_counter = 9814
|
||||
_detalhes.alpha_build_counter = 9814 --if this is higher than the regular counter, use it instead
|
||||
_detalhes.build_counter = 9815
|
||||
_detalhes.alpha_build_counter = 9815 --if this is higher than the regular counter, use it instead
|
||||
_detalhes.bcc_counter = 37
|
||||
_detalhes.dont_open_news = true
|
||||
_detalhes.game_version = version
|
||||
|
||||
@@ -2480,16 +2480,24 @@ end
|
||||
for lineId = 1, self:GetNumLinesShown() do
|
||||
local thisLine = self:GetLine(lineId)
|
||||
|
||||
local playerName = thisLine.lineText1
|
||||
local text2 = thisLine.lineText2
|
||||
local text3 = thisLine.lineText3
|
||||
local text4 = thisLine.lineText4
|
||||
--check if there's something showing in this line
|
||||
if (thisLine.minha_tabela) then
|
||||
local playerNameFontString = thisLine.lineText1
|
||||
local text2 = thisLine.lineText2
|
||||
local text3 = thisLine.lineText3
|
||||
local text4 = thisLine.lineText4
|
||||
|
||||
local totalWidth = text2:GetStringWidth() + text3:GetStringWidth() + text4:GetStringWidth()
|
||||
totalWidth = totalWidth + 50
|
||||
local totalWidth = text2:GetStringWidth() + text3:GetStringWidth() + text4:GetStringWidth()
|
||||
totalWidth = totalWidth + 40 - self.fontstrings_text_limit_offset
|
||||
|
||||
DetailsFramework:TruncateText(playerName, self.cached_bar_width - totalWidth) --this avoid truncated strings with ...
|
||||
--playerName:SetWidth(self.cached_bar_width - totalWidth)
|
||||
DetailsFramework:TruncateTextSafe(playerNameFontString, self.cached_bar_width - totalWidth) --this avoid truncated strings with ...
|
||||
|
||||
--these commented lines are for to create a cache and store the name already truncated there to safe performance
|
||||
--local truncatedName = playerNameFontString:GetText()
|
||||
--local actorObject = thisLine.minha_tabela
|
||||
--actorObject.name_cached = truncatedName
|
||||
--actorObject.name_cached_time = GetTime()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -213,6 +213,27 @@
|
||||
end
|
||||
end
|
||||
|
||||
--check if the nickname fit some minimal rules to be presented to other players
|
||||
local checkValidNickname = function(nickname, playerName)
|
||||
if (nickname and type(nickname) == "string") then
|
||||
if (nickname == "") then
|
||||
return playerName
|
||||
|
||||
elseif (nickname:find(" ")) then
|
||||
return playerName
|
||||
|
||||
--elseif(#nickname > 14) then --cannot check for size as other alphabets uses 2 or 4 bytes to represent letters
|
||||
-- return playerName
|
||||
end
|
||||
else
|
||||
return playerName
|
||||
end
|
||||
|
||||
--remove scapes
|
||||
nickname = nickname:gsub("|","")
|
||||
return nickname
|
||||
end
|
||||
|
||||
--> read the actor flag
|
||||
local read_actor_flag = function(actorObject, dono_do_pet, serial, flag, nome, container_type)
|
||||
|
||||
@@ -220,16 +241,9 @@
|
||||
--> this is player actor
|
||||
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
|
||||
if (not _detalhes.ignore_nicktag) then
|
||||
actorObject.displayName = _detalhes:GetNickname (nome, false, true) --> serial, default, silent
|
||||
if (actorObject.displayName and actorObject.displayName ~= "") then
|
||||
--don't display empty nicknames
|
||||
if (actorObject.displayName:find(" ")) then
|
||||
if (_detalhes.remove_realm_from_name) then
|
||||
actorObject.displayName = nome:gsub (("%-.*"), "")
|
||||
else
|
||||
actorObject.displayName = nome
|
||||
end
|
||||
end
|
||||
actorObject.displayName = checkValidNickname(Details:GetNickname(nome, false, true), nome) --defaults to player name
|
||||
if (_detalhes.remove_realm_from_name) then
|
||||
actorObject.displayName = actorObject.displayName:gsub(("%-.*"), "")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@ _detalhes.instance_defaults = {
|
||||
--use one fontstring for each value in the lines, e.g. one fontstring to damage done, another fontstring to dps and another to percent amount
|
||||
use_multi_fontstrings = true,
|
||||
use_auto_align_multi_fontstrings = true,
|
||||
fontstrings_text_limit_offset = -10,
|
||||
fontstrings_text4_anchor = 0,
|
||||
fontstrings_text3_anchor = 38,
|
||||
fontstrings_text2_anchor = 73,
|
||||
|
||||
@@ -1580,6 +1580,23 @@ do
|
||||
desc = Loc ["STRING_OPTIONS_ALIGNED_TEXT_COLUMNS_AUTOALIGN_DESC"],
|
||||
},
|
||||
|
||||
|
||||
{--name size offset
|
||||
type = "range",
|
||||
get = function() return tonumber(currentInstance.fontstrings_text_limit_offset) end,
|
||||
set = function (self, fixedparam, value)
|
||||
editInstanceSetting(currentInstance, "fontstrings_text_limit_offset", value)
|
||||
editInstanceSetting(currentInstance, "InstanceRefreshRows")
|
||||
Details.options.RefreshInstances(currentInstance)
|
||||
afterUpdate()
|
||||
end,
|
||||
min = -30,
|
||||
max = 30,
|
||||
step = 1,
|
||||
name = "Unit Name Size Offset",
|
||||
desc = "Unit Name Size Offset",
|
||||
},
|
||||
|
||||
{--lineText2 (left, usuali is the 'done' amount)
|
||||
type = "range",
|
||||
get = function() return tonumber (currentInstance.fontstrings_text2_anchor) end,
|
||||
|
||||
@@ -633,12 +633,13 @@ hooksecurefunc (_G, "DeathRecap_LoadUI", function()
|
||||
|
||||
if (Details.death_recap.enabled) then
|
||||
if (Details:GetZoneType() == "party" or Details:GetZoneType() == "raid") then
|
||||
local msgText = "|TInterface\\FriendsFrame\\PlusManz-BattleNet:14:38:0:0:64:64:7:57:18:46|t|cFFAAAAFFDeath Recap:"
|
||||
local msgText = "|cFFAAAAFFDeath Recap (Blizzard):"
|
||||
print(msgText, "|T" .. texture .. ":16:16:0:0:64:64:5:59:5:59|t", GetSpellLink(spellId) or spellName, format(_, amountDamage))
|
||||
end
|
||||
end
|
||||
|
||||
--recap by Details!
|
||||
--[=[
|
||||
local deathEventsDetails = latestDeath[1]
|
||||
for evIndex = #deathEventsDetails, 1, -1 do
|
||||
local ev = deathEventsDetails[evIndex]
|
||||
@@ -656,10 +657,11 @@ hooksecurefunc (_G, "DeathRecap_LoadUI", function()
|
||||
break
|
||||
end
|
||||
end
|
||||
--]=]
|
||||
|
||||
--Details:Msg("the message above are debugs of an Alpha version of Details!")
|
||||
|
||||
local whatKilledThePlayer = 0
|
||||
--local whatKilledThePlayer = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+91
-12
@@ -1969,6 +1969,9 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
local backdrop_color = {.2, .2, .2, 0.2}
|
||||
local backdrop_color_on_enter = {.8, .8, .8, 0.4}
|
||||
|
||||
local backdrop_color_inparty = {.2, .2, .8, 0.3}
|
||||
local backdrop_color_on_enter_inparty = {.5, .5, 1, 0.4}
|
||||
|
||||
local f = DetailsFramework:CreateSimplePanel(UIParent, CONST_WINDOW_WIDTH, CONST_WINDOW_HEIGHT, "M+ Keystones", "DetailsKeystoneInfoFrame")
|
||||
f:SetPoint("center", UIParent, "center", 0, 0)
|
||||
|
||||
@@ -1992,9 +1995,9 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
|
||||
--header
|
||||
local headerTable = {
|
||||
{text = "Class", width = 40, canSort = false, dataType = "string", order = "DESC", offset = 0},
|
||||
{text = "Player Name", width = 100, canSort = true, dataType = "string", order = "DESC", offset = 0},
|
||||
{text = "Keystone Level", width = 100, canSort = true, dataType = "number", order = "DESC", offset = 0, selected = true},
|
||||
{text = "Class", width = 40, canSort = true, dataType = "number", order = "DESC", offset = 0},
|
||||
{text = "Player Name", width = 140, canSort = true, dataType = "string", order = "DESC", offset = 0},
|
||||
{text = "Level", width = 60, canSort = true, dataType = "number", order = "DESC", offset = 0, selected = true},
|
||||
{text = "Dungeon", width = 120, canSort = true, dataType = "string", order = "DESC", offset = 0},
|
||||
{text = "Classic Dungeon", width = 120, canSort = true, dataType = "string", order = "DESC", offset = 0},
|
||||
{text = "Mythic+ Rating", width = 100, canSort = true, dataType = "number", order = "DESC", offset = 0},
|
||||
@@ -2021,6 +2024,29 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
|
||||
--scroll
|
||||
local refreshScrollLines = function(self, data, offset, totalLines)
|
||||
local RaiderIO = _G.RaiderIO
|
||||
local faction = UnitFactionGroup("player") --this can get problems with 9.2.5 cross faction raiding
|
||||
|
||||
--put players in the group at the top of the list
|
||||
if (IsInGroup() and not IsInRaid()) then
|
||||
local playersInTheParty = {}
|
||||
for i = #data, 1, -1 do
|
||||
local unitTable = data[i]
|
||||
if (unitTable[11] > 0) then
|
||||
playersInTheParty[#playersInTheParty+1] = unitTable
|
||||
tremove(data, i)
|
||||
end
|
||||
end
|
||||
|
||||
if (#playersInTheParty > 0) then
|
||||
table.sort(playersInTheParty, function(t1, t2) return t1[11] > t2[11] end)
|
||||
for i = 1, #playersInTheParty do
|
||||
local unitTable = playersInTheParty[i]
|
||||
tinsert(data, 1, unitTable)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, totalLines do
|
||||
local index = i + offset
|
||||
local unitTable = data[index]
|
||||
@@ -2028,7 +2054,23 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
if (unitTable) then
|
||||
local line = self:GetLine(i)
|
||||
|
||||
local unitName, level, mapID, challengeMapID, classID, rating, mythicPlusMapID, classIconTexture, iconTexCoords, mapName, mapNameChallenge = unpack(unitTable)
|
||||
local unitName, level, mapID, challengeMapID, classID, rating, mythicPlusMapID, classIconTexture, iconTexCoords, mapName, inMyParty = unpack(unitTable)
|
||||
|
||||
local rioProfile
|
||||
if (RaiderIO) then
|
||||
local playerName, playerRealm = unitName:match("(.+)%-(.+)")
|
||||
if (playerName and playerRealm) then
|
||||
rioProfile = RaiderIO.GetProfile(playerName, playerRealm, faction == "Horde" and 2 or 1)
|
||||
if (rioProfile) then
|
||||
rioProfile = rioProfile.mythicKeystoneProfile
|
||||
end
|
||||
else
|
||||
rioProfile = RaiderIO.GetProfile(unitName, GetRealmName(), faction == "Horde" and 2 or 1)
|
||||
if (rioProfile) then
|
||||
rioProfile = rioProfile.mythicKeystoneProfile
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
line.icon:SetTexture(classIconTexture)
|
||||
local L, R, T, B = unpack(iconTexCoords)
|
||||
@@ -2036,8 +2078,29 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
line.playerNameText.text = unitName
|
||||
line.keystoneLevelText.text = level
|
||||
line.dungeonNameText.text = mapName
|
||||
DetailsFramework:TruncateText(line.dungeonNameText, 120)
|
||||
line.classicDungeonNameText.text = mapNameChallenge or ""
|
||||
line.ratingText.text = rating
|
||||
DetailsFramework:TruncateText(line.classicDungeonNameText, 120)
|
||||
line.inMyParty = inMyParty > 0
|
||||
|
||||
if (rioProfile) then
|
||||
local score = rioProfile.currentScore or 0
|
||||
local previousScore = rioProfile.previousScore or 0
|
||||
if (previousScore > score) then
|
||||
score = previousScore
|
||||
line.ratingText.text = rating .. " (" .. score .. ")"
|
||||
else
|
||||
line.ratingText.text = rating
|
||||
end
|
||||
else
|
||||
line.ratingText.text = rating
|
||||
end
|
||||
|
||||
if (line.inMyParty) then
|
||||
line:SetBackdropColor(unpack(backdrop_color_inparty))
|
||||
else
|
||||
line:SetBackdropColor(unpack(backdrop_color))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2047,11 +2110,19 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
scrollFrame:SetPoint("topleft", f.Header, "bottomleft", -1, -1)
|
||||
scrollFrame:SetPoint("topright", f.Header, "bottomright", 0, -1)
|
||||
|
||||
local lineOnEnter = function (self)
|
||||
self:SetBackdropColor(unpack(backdrop_color_on_enter))
|
||||
local lineOnEnter = function(self)
|
||||
if (self.inMyParty) then
|
||||
self:SetBackdropColor(unpack(backdrop_color_on_enter_inparty))
|
||||
else
|
||||
self:SetBackdropColor(unpack(backdrop_color_on_enter))
|
||||
end
|
||||
end
|
||||
local lineOnLeave = function (self)
|
||||
self:SetBackdropColor(unpack(backdrop_color))
|
||||
local lineOnLeave = function(self)
|
||||
if (self.inMyParty) then
|
||||
self:SetBackdropColor(unpack(backdrop_color_inparty))
|
||||
else
|
||||
self:SetBackdropColor(unpack(backdrop_color))
|
||||
end
|
||||
end
|
||||
|
||||
local createLineForScroll = function(self, index)
|
||||
@@ -2125,6 +2196,8 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
--local mapInfoChallenge = C_Map.GetMapInfo(keystoneInfo.challengeMapID)
|
||||
--local mapNameChallenge = mapInfoChallenge and mapInfoChallenge.name or ""
|
||||
|
||||
local isInMyParty = UnitInParty(unitName) and (string.byte(unitName, 1) + string.byte(unitName, 2)) or 0
|
||||
|
||||
newData[#newData+1] = {
|
||||
unitName,
|
||||
keystoneInfo.level,
|
||||
@@ -2136,6 +2209,7 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
classIcon,
|
||||
coords[class],
|
||||
mapName,
|
||||
isInMyParty,
|
||||
--mapNameChallenge,
|
||||
}
|
||||
end
|
||||
@@ -2145,8 +2219,11 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
local columnIndex, order = f.Header:GetSelectedColumn()
|
||||
local sortByIndex = 2
|
||||
|
||||
--sort by player name
|
||||
--sort by player class
|
||||
if (columnIndex == 1) then
|
||||
sortByIndex = 5
|
||||
--sort by player name
|
||||
elseif (columnIndex == 2) then
|
||||
sortByIndex = 1
|
||||
--sort by keystone level
|
||||
elseif (columnIndex == 3) then
|
||||
@@ -2163,9 +2240,9 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
end
|
||||
|
||||
if (order == "DESC") then
|
||||
table.sort(newData, function (t1, t2) return t1[sortByIndex] > t2[sortByIndex] end)
|
||||
table.sort(newData, function(t1, t2) return t1[sortByIndex] > t2[sortByIndex] end)
|
||||
else
|
||||
table.sort(newData, function (t1, t2) return t1[sortByIndex] < t2[sortByIndex] end)
|
||||
table.sort(newData, function(t1, t2) return t1[sortByIndex] < t2[sortByIndex] end)
|
||||
end
|
||||
|
||||
scrollFrame:SetData(newData)
|
||||
@@ -2190,6 +2267,8 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||
|
||||
openRaidLib.RegisterCallback(DetailsKeystoneInfoFrame, "KeystoneUpdate", "OnKeystoneUpdate")
|
||||
|
||||
openRaidLib.WipeKeystoneData()
|
||||
|
||||
if (IsInRaid()) then
|
||||
openRaidLib.RequestKeystoneDataFromRaid()
|
||||
elseif (IsInGroup()) then
|
||||
|
||||
Reference in New Issue
Block a user