Skip to content

Commit

Permalink
Brackets delimeters + Brackets titles
Browse files Browse the repository at this point in the history
* welcome message
  • Loading branch information
kakysha committed Nov 1, 2019
1 parent 6836dee commit 4d2311f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 34 deletions.
82 changes: 49 additions & 33 deletions GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,29 @@ end

function GUI:UpdateTableView()
local buttons = HybridScrollFrame_GetButtons(scroll);
local offset = HybridScrollFrame_GetOffset(scroll);

for buttonIndex = 1, #buttons do
local button = buttons[buttonIndex];
local itemIndex = buttonIndex + offset;

if itemIndex <= #rows then
local name, class, thisWeekHonor, lastWeekHonor, standing, RP, rank, last_checked = unpack(rows[itemIndex])
local last_seen, last_seen_human = (GetServerTime() - last_checked), ""
local offset = HybridScrollFrame_GetOffset(scroll);
local brk_delim_inserted = false

for buttonIndex = 1, #buttons do
local button = buttons[buttonIndex];
local itemIndex = buttonIndex + offset;

if (itemIndex > 1 and brackets[itemIndex] and brackets[itemIndex-1] ~= brackets[itemIndex] and not brk_delim_inserted) then
offset = offset-1
brk_delim_inserted = true
button.Name:SetText(colorize(format(L["Bracket"] .. " %d", brackets[itemIndex]), "GREY"))
button.Honor:SetText();
button.LstWkHonor:SetText();
button.Standing:SetText();
button.RP:SetText();
button.Rank:SetText();
button.LastSeen:SetText();
button.Background:SetTexture("Interface/Glues/CharacterCreate/CharacterCreateMetalFrameHorizontal")
button:Show();

elseif (itemIndex <= #rows) then
local name, class, thisWeekHonor, lastWeekHonor, standing, RP, rank, last_checked = unpack(rows[itemIndex])
local last_seen, last_seen_human = (GetServerTime() - last_checked), ""
if (last_seen/60/60/24 > 1) then
last_seen_human = ""..math.floor(last_seen/60/60/24)..L["d"]
elseif (last_seen/60/60 > 1) then
Expand All @@ -115,30 +129,32 @@ function GUI:UpdateTableView()
else
last_seen_human = ""..last_seen..L["s"]
end
button:SetID(itemIndex);
button.Name:SetText(colorize(itemIndex .. ') ' .. name, class));
button.Honor:SetText(colorize(thisWeekHonor, class));
button.LstWkHonor:SetText(colorize(lastWeekHonor, class));
button.Standing:SetText(colorize(standing, class));
button.RP:SetText(colorize(RP, class));
button.Rank:SetText(colorize(rank, class));
button.LastSeen:SetText(colorize(last_seen_human, class));

if (name == playerName) then
button.Background:SetColorTexture(0.5, 0.5, 0.5, 0.2)
else
button.Background:SetColorTexture(colors["br"..brackets[itemIndex]].r, colors["br"..brackets[itemIndex]].g, colors["br"..brackets[itemIndex]].b, 0.1)
end

button:Show();
else
button:Hide();
end
end

local buttonHeight = scroll.buttonHeight;
local totalHeight = #rows * buttonHeight;
local shownHeight = #buttons * buttonHeight;
button:SetID(itemIndex);
button.Name:SetText(colorize(itemIndex .. ') ', "GREY") .. colorize(name, class));
button.Honor:SetText(colorize(thisWeekHonor, class));
button.LstWkHonor:SetText(colorize(lastWeekHonor, class));
button.Standing:SetText(colorize(standing, class));
button.RP:SetText(colorize(RP, class));
button.Rank:SetText(colorize(rank, class));
button.LastSeen:SetText(colorize(last_seen_human, class));

if (name == playerName) then
button.Background:SetColorTexture(0.5, 0.5, 0.5, 0.2)
else
button.Background:SetColorTexture(colors["br"..brackets[itemIndex]].r, colors["br"..brackets[itemIndex]].g, colors["br"..brackets[itemIndex]].b, 0.05)
--button.Background:SetColorTexture(0, 0, 0, 0.2)
end

brk_delim_inserted = false
button:Show();
else
button:Hide();
end
end

local buttonHeight = scroll.buttonHeight;
local totalHeight = #rows * buttonHeight;
local shownHeight = #buttons * buttonHeight;

HybridScrollFrame_Update(scroll, totalHeight, shownHeight);
end
Expand Down
10 changes: 10 additions & 0 deletions honorspy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function HonorSpy:OnInitialize()
HonorSpy:CheckNeedReset();

HonorSpyGUI:PrepareGUI()
PrintWelcomeMsg();
end

local inspectedPlayers = {}; -- stores last_checked time of all players met
Expand Down Expand Up @@ -403,4 +404,13 @@ function DrawMinimapIcon()
tooltip:AddLine("|cFFCFCFCFRight Click: |r" .. L['Report Me']);
end
}), HonorSpy.db.factionrealm.minimapButton);
end

function PrintWelcomeMsg()
local realm = GetRealmName()
local msg = format("|cffAAAAAAversion: %s, bugs & features: github.com/kakysha/honorspy|r\n|cff209f9b", GetAddOnMetadata("HonorSpy", "Version"))
if (realm == "Flamelash") then
msg = msg .. format("You are lucky enough to play with HonorSpy author on one |cffFFFFFF%s |cff209f9brealm! Feel free to mail me (|cff8787edKakysha|cff209f9b) a supportive gold tip or kind word!", realm)
end
HonorSpy:Print(msg .. "|r")
end
2 changes: 1 addition & 1 deletion honorspy.toc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

## Author: kakysha
## OptionalDeps: Ace3
## Version: 1.1.2
## Version: 1.1.3

## X-Category: Battlegrounds/PvP
## SavedVariables: HonorSpyDB
Expand Down

0 comments on commit 4d2311f

Please sign in to comment.