Skip to content

Commit

Permalink
Merge branch 'release/3.13.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Sep 12, 2024
2 parents 8b3db95 + ddcc64c commit 1ddb91e
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 64 deletions.
54 changes: 51 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"todo-tree.tree.showCountsInTree": false,
"Lua.runtime.path": [
"${workspace}/__tests/?.lua"
],
Expand All @@ -16,9 +15,58 @@
"utf8": "disable"
},
"Lua.workspace.library": [
"~\\.vscode\\extensions\\ketho.wow-api-0.16.8\\Annotations"
"~\\.vscode\\extensions\\ketho.wow-api-0.17.6\\Annotations"
],
"Lua.diagnostics.globals": [
"lfs"
"lfs",
"ChatFrame_AddMessageEventFilter",
"INVSLOT_LAST_EQUIPPED",
"UIParent",
"WOW_PROJECT_MAINLINE",
"WOW_PROJECT_ID",
"RAID_CLASS_COLORS",
"GameTooltip",
"getglobal",
"tIndexOf",
"tInvert",
"GetClassColorObj",
"Settings",
"SettingsPanel",
"CLASS_ICON_TCOORDS",
"CreateAtlasMarkup",
"CreateSimpleTextureMarkup",
"tContains",
"FindValueInTableIf",
"escapePatternSymbols",
"ITEM_BNETACCOUNTBOUND",
"PLAYER_LIST_DELIMITER",
"BIND_TRADE_TIME_REMAINING",
"ITEM_SOULBOUND",
"ITEM_ACCOUNTBOUND",
"LIST_DELIMITER",
"INT_SPELL_DURATION_SEC",
"INT_SPELL_DURATION_HOURS",
"TIME_UNIT_DELIMITER",
"INT_SPELL_DURATION_MIN",
"GetUnitName",
"FauxScrollFrame_OnVerticalScroll",
"CopyTable",
"tDeleteItem",
"Clamp",
"HandleModifiedItemClick",
"REQUEST_ROLL",
"CreateColor",
"AccumulateOp",
"BACKPACK_CONTAINER",
"NUM_BAG_SLOTS",
"GUILD_BANK_LOG_TIME",
"SecondsToTime",
"RANDOM_ROLL_RESULT",
"FindInTableIf",
"tFilter",
"tCompare",
"ContainsIf",
"ITEM_ACCOUNTBOUND_UNTIL_EQUIP",
"ChatFrame1"
]
}
31 changes: 13 additions & 18 deletions Modules/History/lootHistory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@ function LootHistory:OnInitialize()
self:SubscribeToPermanentComms()
end

local tierLookUpTable = { -- instanceMapID to Tier text
[1530] = L["Tier 19"],
[1676] = L["Tier 20"],
[1712] = L["Tier 21"],
}

local difficultyLookupTable = {
[14] = L["tier_token_normal"],
[15] = L["tier_token_heroic"],
[16] = L["tier_token_mythic"],
}

function LootHistory:OnEnable()
addon.Log("LootHistory:OnEnable()")
moreInfo = true
Expand Down Expand Up @@ -136,7 +124,8 @@ end
function LootHistory:OnHistoryReceived (name, history)
if not addon:Getdb().enableHistory then return end
-- v2.15 Add itemClass and itemSubClass locally:
local _, _, _, _, _, itemClassID, itemSubClassID = C_Item.GetItemInfoInstant(history.lootWon)
local itemID, _, _, _, _, itemClassID, itemSubClassID = C_Item.GetItemInfoInstant(history.lootWon)
history.tierToken = RCTokenTable[itemID] and true
history.iClass = itemClassID
history.iSubClass = itemSubClassID
if addon.lootDB.factionrealm[name] then
Expand Down Expand Up @@ -478,7 +467,7 @@ function LootHistory.SetCellResponse(rowFrame, frame, data, cols, row, realrow,

if args.color and type(args.color) == "table" and type(args.color[1]) == "number" then -- Never version saves the color with the entry
frame.text:SetTextColor(unpack(args.color))
elseif args.responseID and args.responseID > 0 then -- try to recreate color from ID
elseif args.responseID and (type(args.responseID) == "string" or args.responseID > 0) then -- try to recreate color from ID
frame.text:SetTextColor(unpack(addon:GetResponse("default", args.responseID).color))
else -- default to white
frame.text:SetTextColor(1,1,1,1)
Expand Down Expand Up @@ -931,6 +920,7 @@ function LootHistory:GetFrame()

self.moreInfo = CreateFrame("GameTooltip", "RCLootHistoryMoreInfo", f.content, "GameTooltipTemplate")
self.moreInfo:SetIgnoreParentScale(true)
self.moreInfo:SetClampedToScreen(false)
f.content:SetScript("OnSizeChanged", function()
self.moreInfo:SetScale(Clamp(f:GetScale() * 0.6, .4, .9))
end)
Expand Down Expand Up @@ -1074,10 +1064,14 @@ function LootHistory:UpdateMoreInfo(rowFrame, cellFrame, dat, cols, row, realrow
end
tip:AddLine(" ")
tip:AddLine(L["Tokens received"])
local tokensSorted = {}
for n in pairs(moreInfoData[row.name].totals.tokens) do tinsert(tokensSorted, n) end
table.sort(tokensSorted)
-- Add tier tokens
for _, v in pairs(moreInfoData[row.name].totals.tokens) do
if v.mapID and v.difficultyID and tierLookUpTable[v.mapID] then
tip:AddDoubleLine(tierLookUpTable[v.mapID].." "..difficultyLookupTable[v.difficultyID]..":", v.num, 1,1,1, 1,1,1)
for _, instance in pairs(tokensSorted) do
local num = moreInfoData[row.name].totals.tokens[instance]
if num > 0 then
tip:AddDoubleLine(instance..":", num, 1,1,1, 1,1,1)
end
end
tip:AddLine(" ")
Expand Down Expand Up @@ -1117,9 +1111,10 @@ function LootHistory:UpdateMoreInfo(rowFrame, cellFrame, dat, cols, row, realrow
tip:AddDoubleLine("difficultyID:", data.difficultyID, 1,1,1, 1,1,1)
tip:AddDoubleLine("mapID", data.mapID, 1,1,1, 1,1,1)
tip:AddDoubleLine("groupSize", data.groupSize, 1,1,1, 1,1,1)
tip:AddDoubleLine("tierToken", data.tierToken, 1,1,1, 1,1,1)
tip:AddDoubleLine("tierToken", tostring(data.tierToken), 1,1,1, 1,1,1)
tip:AddDoubleLine("tokenRoll", tostring(data.tokenRoll), 1,1,1, 1,1,1)
tip:AddDoubleLine("relicRoll", tostring(data.relicRoll), 1,1,1, 1,1,1)
tip:AddDoubleLine("typeCode", tostring(data.typeCode))
tip:AddLine(" ")
tip:AddDoubleLine("Total LootDB entries:", #self.frame.rows, 1,1,1, 0,0,1)
end
Expand Down
22 changes: 12 additions & 10 deletions Modules/votingFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,10 @@ function RCVotingFrame:OnBaggedReceived (s)
self:UpdateItemAwardHistory()
end, 1) -- Make sure we've received the history data before updating
if not lootTable[s] then return end -- We might not have lootTable - e.g. if we just reloaded
lootTable[s].bagged = true
lootTable[s].baggedInSession = true
if addon.isMasterLooter and session ~= #lootTable then -- ML should move to the next item on award
lootTable[s].awarded = true
local nextSession = self:FetchUnawardedSession()
if addon.isMasterLooter and nextSession then -- ML should move to the next item on award
self:SwitchSession(session + 1)
else
self:SwitchSession(session) -- Use switch session to update awardstring
Expand Down Expand Up @@ -836,7 +837,12 @@ function RCVotingFrame:Update(forceUpdate)
self.frame.st:SortData()
self.frame.st:SortData() -- It appears that there is a bug in lib-st that only one SortData() does not use the "sortnext" to correct sort the rows.
-- update awardString
if lootTable[session] and lootTable[session].awarded then
if lootTable[session] and lootTable[session].baggedInSession then
self.frame.awardString:SetText(L["The item will be awarded later"])
self.frame.awardString:Show()
self.frame.awardStringPlayer:Hide()
self.frame.awardStringPlayer.classIcon:Hide()
elseif lootTable[session] and lootTable[session].awarded then
self.frame.awardString:SetText(L["Item was awarded to"])
self.frame.awardString:Show()
local name = lootTable[session].awarded
Expand All @@ -847,11 +853,6 @@ function RCVotingFrame:Update(forceUpdate)
-- Hack-reuse the SetCellClassIcon function
addon.SetCellClassIcon(nil,self.frame.awardStringPlayer.classIcon,nil,nil,nil,nil,nil,nil,nil, lootTable[session].candidates[name].class)
self.frame.awardStringPlayer.classIcon:Show()
elseif lootTable[session] and lootTable[session].baggedInSession then
self.frame.awardString:SetText(L["The item will be awarded later"])
self.frame.awardString:Show()
self.frame.awardStringPlayer:Hide()
self.frame.awardStringPlayer.classIcon:Hide()
else
self.frame.awardString:Hide()
self.frame.awardStringPlayer:Hide()
Expand Down Expand Up @@ -1005,7 +1006,7 @@ function RCVotingFrame:UpdateMoreInfo(row, data)
end
if moreInfoData[name].totals.tokens[addon.currentInstanceName] then
tip:AddLine(" ")
tip:AddDoubleLine(L["Tier tokens received from here:"], moreInfoData[name].totals.tokens[addon.currentInstanceName].num, 1,1,1, 1,1,1)
tip:AddDoubleLine(L["Tier tokens received from here:"], moreInfoData[name].totals.tokens[addon.currentInstanceName], 1,1,1, 1,1,1)
end
tip:AddDoubleLine(L["Number of raids received loot from:"], moreInfoData[name].totals.raids.num, 1,1,1, 1,1,1)
tip:AddDoubleLine(L["Total items received:"], moreInfoData[name].totals.total, 0,1,1, 0,1,1)
Expand Down Expand Up @@ -1193,6 +1194,7 @@ function RCVotingFrame:GetFrame()

f.moreInfo = CreateFrame( "GameTooltip", "RCVotingFrameMoreInfo", f.content, "GameTooltipTemplate" )
f.moreInfo:SetIgnoreParentScale(true)
f.moreInfo:SetClampedToScreen(false)
f.content:SetScript("OnSizeChanged", function()
f.moreInfo:SetScale(Clamp(f:GetScale() * 0.6, .4, .9))
end)
Expand Down Expand Up @@ -1983,7 +1985,7 @@ do
text = L["Award later"],
notCheckable = true,
disabled = function()
return not lootTable[session] or lootTable[session].bagged or lootTable[session].awarded
return not lootTable[session] or lootTable[session].baggedInSession or lootTable[session].awarded
end,
func = function()
LibDialog:Spawn("RCLOOTCOUNCIL_CONFIRM_AWARD_LATER", {session=session, link=lootTable[session].link})
Expand Down
4 changes: 2 additions & 2 deletions RCLootCouncil.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Author: Potdisc
## Interface: 110002
## Notes: Interface for running a Loot Council v3.13.1
## Notes: Interface for running a Loot Council v3.13.2
## Title: RCLootCouncil
## Version: 3.13.1
## Version: 3.13.2
## SavedVariables: RCLootCouncilDB, RCLootCouncilLootDB
## OptionalDeps: LibStub, CallbackHandler-1.0, Ace3, lib-st, LibWindow-1.1, LibDialog-1.0
## X-Curse-Project-ID: 39928
Expand Down
15 changes: 15 additions & 0 deletions Utils/BackwardsCompat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,20 @@ Compat.list = {
func = function ()
addon:ResetUI()
end
},

{
name = "Update 'tierToken' in history",
version = "3.13.2",
func = function ()
local Item = addon.Require "Utils.Item"
for _, factionrealm in pairs(addon.lootDB.sv.factionrealm) do
for _, data in pairs(factionrealm) do
for _, v in ipairs(data) do
v.tierToken = RCTokenTable[Item:GetItemIDFromLink(v.lootWon)] and true
end
end
end
end
}
}
5 changes: 3 additions & 2 deletions Utils/TrinketData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ _G.RCTrinketCategories = {
["3092776070010"] = DAMAGER .. ", " .. ITEM_MOD_INTELLECT_SHORT, -- Damage + Healers, Intellect
["1010671040000"] = DAMAGER .. ", " .. ITEM_MOD_INTELLECT_SHORT, -- Damage, Intellect (direct damage, no affliction warlock and shadow priest)
["5010771040000"] = DAMAGER .. ", " .. ITEM_MOD_INTELLECT_SHORT, -- Damage, Intellect (no discipline)
["1134773647743"] = DAMAGER, -- Damage
["1134773647743"] = DAMAGER, -- Damage (Pre augmentation evoker)
["5134773647743"] = DAMAGER, -- Damage
["0325002007700"] = ITEM_MOD_AGILITY_SHORT, -- Agility (DPS + vengance and brewmaster)??
["73F7777077710"] = ITEM_MOD_AGILITY_SHORT .. "/" .. ITEM_MOD_INTELLECT_SHORT, -- Agility/Intellect
["0000000700077"] = ITEM_MOD_STRENGTH_SHORT, -- Strength
Expand Down Expand Up @@ -1927,7 +1928,7 @@ _G.RCTrinketSpecs = {
-- Nerub-ar Palace Normal (id: 1273).
[212451] = "5010771040000", -- Aberrant Spellforge, Damage, Intellect
[219915] = "0241000100024", -- Foul Behemoth's Chelicera, Tank
[212454] = "73F7777777777", -- Mad Queen's Mandate, All Classes
[212454] = "5134773647743", -- Mad Queen's Mandate, Damage
[212449] = "0124002607443", -- Sikran's Endless Arsenal, Damage, Melee
[212453] = "0000000700067", -- Skyterror's Corrosive Organ, Strength
[212450] = "0241000100024", -- Swarmlord's Authority, Tank
Expand Down
23 changes: 12 additions & 11 deletions __tests/wow_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1079,17 +1079,6 @@ TOOLTIP_DEFAULT_BACKGROUND_COLOR = { r = 0.09, g = 0.09, b = 0.19, };
_G.INVSLOT_FIRST_EQUIPPED = 1
_G.INVSLOT_LAST_EQUIPPED = 18
NORMAL_FONT_COLOR = CreateColor(255, 209, 0, 255) --ffd100
NUM_LE_ITEM_QUALITYS = 9
LE_ITEM_QUALITY_POOR = 0
LE_ITEM_QUALITY_COMMON = 1
LE_ITEM_QUALITY_UNCOMMON = 2
LE_ITEM_QUALITY_RARE = 3
LE_ITEM_QUALITY_EPIC = 4
LE_ITEM_QUALITY_LEGENDARY = 5
LE_ITEM_QUALITY_ARTIFACT = 6
LE_ITEM_QUALITY_HEIRLOOM = 7
LE_ITEM_QUALITY_WOW_TOKEN = 8


------------------------------------------
-- Global Strings
Expand Down Expand Up @@ -1242,4 +1231,16 @@ Enum = {
Keystone = 1,
ContextToken = 2,
},
ItemBind = {
None = 0,
OnAcquire = 1,
OnEquip = 2,
OnUse = 3,
Quest = 4,
Unused1 = 5,
Unused2 = 6,
ToWoWAccount = 7,
ToBnetAccount = 8,
ToBnetAccountUntilEquipped = 9,
}
}
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 3.13.2

## Changes

More info frames is no longer clamped to screen.

## Bugfixes

- *Selecting an item for "Award Later" during a session will now properly count the item as awarded.*
- *Tier token items are now properly registered as such for usage in more info tooltips.*
- *BoE's are recognized once again.*

# 3.13.1

## Changes
Expand Down
25 changes: 11 additions & 14 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
]]
-- GLOBALS: GetLootMethod, C_AddOns.GetAddOnMetadata, UnitClass
local addonname, addontable = ...
--- @class RCLootCouncil : AceAddon-3.0, AceConsole-3.0, AceEvent-3.0, AceHook-3.0, AceTimer-3.0, AceBucket-3.0
--- @class RCLootCouncil : AceAddon, AceConsole-3.0, AceEvent-3.0, AceHook-3.0, AceTimer-3.0, AceBucket-3.0
_G.RCLootCouncil = LibStub("AceAddon-3.0"):NewAddon(addontable, addonname, "AceConsole-3.0", "AceEvent-3.0",
"AceHook-3.0", "AceTimer-3.0", "AceBucket-3.0");
local LibDialog = LibStub("LibDialog-1.1")
Expand Down Expand Up @@ -1071,7 +1071,7 @@ function RCLootCouncil:PrepareLootTable(lootTable)
v.subType = subType -- Subtype should be in our locale
v.texture = texture
v.token = itemID and RCTokenTable[itemID]
v.boe = bindType == _G.LE_ITEM_BIND_ON_EQUIP
v.boe = bindType == Enum.ItemBind.OnEquip
v.typeID = typeID
v.subTypeID = subTypeID
v.session = v.session or ses
Expand Down Expand Up @@ -1310,7 +1310,7 @@ function RCLootCouncil:GetContainerItemTradeTimeRemaining(container, slot)
local line = getglobal(tooltipForParsing:GetName() .. 'TextLeft' .. i)
if line and line.GetText then
local text = line:GetText() or ""
if text == ITEM_SOULBOUND or text == ITEM_ACCOUNTBOUND or text == ITEM_BNETACCOUNTBOUND then bounded = true end
if text == ITEM_SOULBOUND or text == ITEM_ACCOUNTBOUND or text == ITEM_BNETACCOUNTBOUND or text == ITEM_ACCOUNTBOUND_UNTIL_EQUIP then bounded = true end

local timeText = text:match(bindTradeTimeRemainingPattern)
if timeText then -- Within 2h trade window, parse the time text
Expand Down Expand Up @@ -1365,14 +1365,13 @@ end

function RCLootCouncil:IsItemBoE(item)
if not item then return false end
-- Item binding type: 0 - none; 1 - on pickup; 2 - on equip; 3 - on use; 4 - quest.
return select(14, C_Item.GetItemInfo(item)) == LE_ITEM_BIND_ON_EQUIP
return select(14, C_Item.GetItemInfo(item)) == Enum.ItemBind.OnEquip
end

function RCLootCouncil:IsItemBoP(item)
if not item then return false end
-- Item binding type: 0 - none; 1 - on pickup; 2 - on equip; 3 - on use; 4 - quest.
return select(14, C_Item.GetItemInfo(item)) == LE_ITEM_BIND_ON_ACQUIRE
return select(14, C_Item.GetItemInfo(item)) == Enum.ItemBind.OnAcquire
end

function RCLootCouncil:GetPlayersGuildRank()
Expand Down Expand Up @@ -1861,24 +1860,22 @@ function RCLootCouncil:GetLootDBStatistics()
id = entry.responseID
if type(id) == "number" then -- ID may be string, e.g. "PASS"
if entry.isAwardReason then id = id + 100 end -- Bump to distingush from normal awards
if entry.tokenRoll then id = id + 200 end
if entry.relicRoll then id = id + 300 end
if entry.tierToken then id = id + 200 end
end
-- We assume the mapID and difficultyID is available on any item if at all.
-- Tier Tokens
if not numTokens[entry.instance] then
numTokens[entry.instance] = {num = 0, mapID = entry.mapID, difficultyID = entry.difficultyID}
numTokens[entry.instance] = 0
end
if entry.tierToken then -- If it's a tierToken, increase the count
numTokens[entry.instance].num = numTokens[entry.instance].num + 1
if entry.tierToken and not entry.isAwardReason then -- If it's a tierToken, increase the count
numTokens[entry.instance] = numTokens[entry.instance] + 1
end
count[id] = count[id] and count[id] + 1 or 1
responseText[id] = responseText[id] and responseText[id] or entry.response
if (not color[id] or unpack(color[id], 1, 3) == unpack {1, 1, 1}) and (entry.color and #entry.color ~= 0) then -- If it's not already added
color[id] = #entry.color ~= 0 and #entry.color == 4 and entry.color or {1, 1, 1}
end
if lastestAwardFound < 5 and type(id) == "number" and not entry.isAwardReason
and (id <= db.numMoreInfoButtons or (entry.tokenRoll and id - 200 <= db.numMoreInfoButtons)
or (entry.relicRoll and id - 300 <= db.numMoreInfoButtons)) then
and (id <= db.numMoreInfoButtons or (entry.tierToken and id - 200 <= db.numMoreInfoButtons)) then
tinsert(lootDBStatistics[name], {
entry.lootWon, --[[entry.response .. ", "..]]
format(L["'n days' ago"], self:ConvertDateToString(self:GetNumberOfDaysFromNow(entry.date))),
Expand Down
Loading

0 comments on commit 1ddb91e

Please sign in to comment.