Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library updates, include FlameLeviathan bonus itemlevels + Herald Check in character sheet #246

Merged
merged 10 commits into from
Feb 25, 2023
80 changes: 62 additions & 18 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,26 @@ local function DrawListings(self)
listing.messageSent = true
listing.senderName = myname
end)
button.btn:SetScript("OnEnter", function()
local groupieMsg = addon.GetPlayerInfoMsg(listing.fullName,nil,true)
if groupieMsg and #groupieMsg > 0 then
local color = CreateColor(ChatTypeInfo["WHISPER"].r, ChatTypeInfo["WHISPER"].g, ChatTypeInfo["WHISPER"].b)
groupieMsg = color:WrapTextInColorCode(groupieMsg)
else
groupieMsg = nil
end
if groupieMsg then
GameTooltip:SetOwner(button.btn, "ANCHOR_CURSOR")
GameTooltip:SetText(L["ClickSend"],246/255,235/255,97/25, 1, false)
GameTooltip:AddLine(groupieMsg, 1, 1, 1, 1, true)
GameTooltip:Show()
end
end)
button.btn:SetScript("OnLeave", function()
if GameTooltip:IsOwned(button.btn) then
GameTooltip:Hide()
end
end)
--clear messages sent on switching characters
if listing.messageSent and myname ~= listing.senderName then
listing.messageSent = nil
Expand All @@ -583,7 +603,7 @@ local function DrawListings(self)
button.btn:SetText("|TInterface\\AddOns\\" ..
addonName .. "\\Images\\load" .. tostring(MainTabFrame.animFrame + 1) .. ":10:32:0:-1|t")
else
button.btn:SetText("LFG")
button.btn:SetText(L["Reply"])
end
if myName == button.listing.author and not addon.debugMenus then
button.btn:Hide()
Expand Down Expand Up @@ -909,7 +929,7 @@ local function CreateListingButtons()
currentListing.btn = CreateFrame("Button", "$parentApplyBtn", currentListing, "UIPanelButtonTemplate")
currentListing.btn:SetPoint("LEFT", currentListing.msg, "RIGHT", 4, 0)
currentListing.btn:SetWidth(APPLY_BTN_WIDTH)
currentListing.btn:SetText("LFG")
currentListing.btn:SetText(L["Reply"])
currentListing.btn:SetScript("OnClick", function()
return
end)
Expand Down Expand Up @@ -1669,7 +1689,7 @@ local function BuildGroupieWindow()
CharSheetSummaryFrame = _G["CharacterModelFrame"]:CreateFontString("GroupieCharSheetAddin", "OVERLAY",
"GameFontNormalSmall")
CharSheetSummaryFrame:SetPoint("LEFT", CharSheetSummaryFrame:GetParent(), "LEFT", 8 +
addon.db.global.charSheetXOffset, -60 + addon.db.global.charSheetYOffset)
addon.db.global.charSheetXOffset, -50 + addon.db.global.charSheetYOffset)
CharSheetSummaryFrame:SetJustifyH("LEFT")

-------------
Expand Down Expand Up @@ -2929,7 +2949,7 @@ function addon.SetupConfig()
local PopupGroupieTitle = PopupFrame:CreateFontString("FontString", "OVERLAY", "GameFontNormalMed1")
PopupGroupieTitle:SetPoint("TOP", PopupFrame, "TOP", 0, -36)
PopupGroupieTitle:SetWidth(POPUP_WINDOW_WIDTH - 32)
PopupGroupieTitle:SetText("Groupie 1.64")
PopupGroupieTitle:SetText(format("Groupie %s",addon.version))
--Info Text
local PopupMsg = PopupFrame:CreateFontString("FontString", "OVERLAY", "GameFontHighlight")
PopupMsg:SetPoint("TOPLEFT", PopupFrame, "TOPLEFT", 16, -64)
Expand Down Expand Up @@ -3141,31 +3161,54 @@ function addon.UpdateCharacterSheet(ignoreILVL, ignoreGS)
--2nd Line : Show Average Item Level
--3rd Line : Show Gear Score

CI:DoInspect("player")
--Calculate gearscore
LGS:PLAYER_EQUIPMENT_CHANGED() --Workaround for PEW event in library being too early
local guid, gsData = LGS:GetScore("player")
if gsData and gsData.GearScore and gsData.GearScore > 0 then
addon.playerGearScore = gsData.GearScore
addon.playerFLOPScore = gsData.FLOPScore
end

--Calculate talents
local spec1, spec2, spec3 = CI:GetTalentPoints("player")
local talentStr = format("%d / %d / %d", spec1, spec2, spec3)
local talentStr = format("%d/%d/%d", spec1 or 0, spec2 or 0, spec3 or 0)
--Calculate Item level
local ilvl = addon.MyILVL()
if ilvl then
if ilvl > 0 then
addon.playerILVL = ilvl
end
end
--Calculate gearscore
LGS:PLAYER_EQUIPMENT_CHANGED() --Workaround for PEW event in library being too early
CI:DoInspect("player")
local guid, gearScore = LGS:GetScore("player")
if gearScore and gearScore.GearScore and gearScore.GearScore > 0 then
addon.playerGearScore = gearScore.GearScore
end
local colorStr = ""
if gearScore.Color then
colorStr = "|c" .. gearScore.Color:GenerateHexColor()
end

--Display on character sheet
if addon.db.global.charSheetGear then
CharSheetSummaryFrame:SetText(format("%s\nItem-level : %d\nGearScore : %s%d", talentStr, ilvl,
colorStr, gearScore.GearScore))
local ilvlStr, gearScoreStr, flopScoreStr, heraldStr = "", "", "", ""
if addon.playerILVL then
ilvlStr = gsData.Color and gsData.Color:WrapTextInColorCode(addon.playerILVL) or format("%d",addon.playerILVL)
end
if addon.playerGearScore then
gearScoreStr = gsData.Color and gsData.Color:WrapTextInColorCode(addon.playerGearScore) or format("%d",addon.playerGearScore)
end
if addon.playerFLOPScore then
local percent_delta = LGS:VehicleMath(addon.playerFLOPScore)
if addon.playerFLOPScore > 0 then
flopScoreStr = format("+%s%%",percent_delta)
else
flopScoreStr = format("%s%%",percent_delta)
end
flopScoreStr = gsData.FLOPColor and gsData.FLOPColor:WrapTextInColorCode(flopScoreStr) or format("%s",flopScoreStr)
end
if gsData.HeraldFails then
heraldStr = gsData.HeraldColor and gsData.HeraldColor:WrapTextInColorCode(_G.YES) or _G.YES
for failslot,faillvl in pairs(gsData.HeraldFails) do
if faillvl then
heraldStr = gsData.HeraldColor and gsData.HeraldColor:WrapTextInColorCode(_G.NO) or _G.NO
break
end
end
end
CharSheetSummaryFrame:SetText(format("Spec: %s\nItemLevel: %s\nGearScore: %s\nVehicles: %s\nHerald: %s", talentStr, ilvlStr, gearScoreStr, flopScoreStr, heraldStr))
end
end

Expand All @@ -3192,6 +3235,7 @@ function addon:OnEnable()
end)
if isInitialLogin == true then
C_Timer.After(15, function()
addon.UpdateCharacterSheet()
local GroupieGroupBrowser = Groupie:GetModule("GroupieGroupBrowser")
if GroupieGroupBrowser then
--Queue updates from the LFG tool for dungeons and raids on login
Expand Down
2 changes: 1 addition & 1 deletion Globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ addon.LFGMode = false
addon.ILVLCache = {}
addon.playerILVL = nil
addon.playerGearScore = nil
addon.playerGearScoreColor = nil
addon.playerFLOPScore = nil

--Message formats for various checked messages
addon.askForPlayerInfo = format("{rt3} %s : What Role are you?", addonName)
Expand Down
3 changes: 2 additions & 1 deletion Groupie.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 30401
## Title: Groupie
## Notes: A better LFG tool for Classic WoW.
## Version: 1.66
## Version: 1.72
## Author: Gogo, LemonDrake, Kynura, Raegen
## SavedVariables: GroupieDB
## X-Curse-Project-ID: 661450
Expand All @@ -23,3 +23,4 @@ RightClick.lua
Listener.lua
AutoResponse.lua
AnnounceReset.lua
AfterParty.lua
14 changes: 14 additions & 0 deletions Helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local GetTalentTabInfo = GetTalentTabInfo
local time = time
local gmatch = gmatch
local L = LibStub('AceLocale-3.0'):GetLocale('Groupie')
local LGS = LibStub("LibGearScore.1000", true)
local CI = LibStub("LibClassicInspector")
local myname = UnitName("player")

Expand Down Expand Up @@ -716,6 +717,13 @@ end

--Calculate the player's own ilvl average
function addon.MyILVL()
if LGS then
local _, gsData = LGS:GetScore("player")
if gsData and gsData.GearScore and gsData.GearScore > 0 then
return gsData.AvgItemLevel
end
end

local iLevelSum = 0
for slotNum = 1, 19 do
--Exclude shirt and tabard slots from itemlevel calculation
Expand Down Expand Up @@ -744,6 +752,12 @@ end

--Calculate the average ilvl for a given GUID
function addon.GetILVLByGUID(guid)
if LGS then
local _, gsData = LGS:GetScore(guid)
if gsData and gsData.GearScore and gsData.GearScore > 0 then
return gsData.AvgItemLevel
end
end

if addon.ILVLCache[guid] then
return addon.ILVLCache[guid]
Expand Down
2 changes: 2 additions & 0 deletions Localization/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ L["Settings"] = "Settings"
L["BulletinBoard"] = "Bulletin Board"
L["Reset"] = "Reset"
L["Options"] = "Options"
L["Reply"] = "Reply"
L["ClickSend"] = "Reply with:"
-- Channels Name /!\ VERY IMPORTANT, THE ADDON PARSES DEPENDING ON THE CHANNEL NAME
L["text_channels"] = {
["Guild"] = "Guild",
Expand Down
1 change: 1 addition & 0 deletions Localization/frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ if not L then return end
L["Settings"] = "Réglages"
L["BulletinBoard"] = "Panneau d'affichage"
L["Reset"] = "Remise à zéro"
L["ClickSend"] = "Répondre avec:"

-- Channels Name /!\ VERY IMPORTANT, THE ADDON PARSES DEPENDING ON THE CHANNEL NAME
L["GuildChannel"] = "Guilde"
Expand Down
15 changes: 14 additions & 1 deletion RightClick.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ local myclass = UnitClass("player")
-------------------------------
-- Right Click Functionality --
-------------------------------
function addon.SendPlayerInfo(targetName, dropdownMenu, which, fullName, resultID, isAutoResponse)
local msgCache = {}
function addon.GetPlayerInfoMsg(fullName, isAutoResponse, isTooltip)
local msgKey = format("%s:%s",tostring(fullName),tostring(isAutoResponse))
if msgCache[msgKey] and isTooltip then
return msgCache[msgKey]
end
local mylevel = UnitLevel("player")
addon.UpdateSpecOptions()

Expand Down Expand Up @@ -116,6 +121,14 @@ function addon.SendPlayerInfo(targetName, dropdownMenu, which, fullName, resultI
myclass,
achieveLinkStr
)
msgCache[msgKey] = groupieMsg:gsub("%b{}%s*","")
if isTooltip then return msgCache[msgKey] end
return groupieMsg
end

function addon.SendPlayerInfo(targetName, dropdownMenu, which, fullName, resultID, isAutoResponse)

local groupieMsg = addon.GetPlayerInfoMsg(fullName, isAutoResponse)

--Hash the message and attach the suffix of the hash
------------
Expand Down