Skip to content

Commit

Permalink
Merge branch 'release/2.17.0-Release'
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Jan 14, 2020
2 parents 82e16e4 + 71ab69a commit 892ce82
Show file tree
Hide file tree
Showing 16 changed files with 333 additions and 27 deletions.
16 changes: 16 additions & 0 deletions .atom-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmd: "sh .scripts/deploy.sh"
name: "Deploy Retail"
args:
- "{FILE_ACTIVE_PATH}"

errorMatch:
- <ERROR>(?<message>.+)
warningMatch:
- <WARNING>(?<message>.+)

targets:
PTR:
name: "Deploy PTR"
cmd: "sh .scripts/deploy.sh"
args:
- "-p"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.atom-build.yml
notes.txt
wip
sv_to_process.lua
luacov.report.out
.env
1 change: 1 addition & 0 deletions .pkgmeta
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ ignore:
- LICENSE.md
- __tests
- .luacov
- .scripts

enable-nolib-creation: no
56 changes: 56 additions & 0 deletions .scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!usr/bin/sh
# This file will copy files located in the toplevel folder of the caller, and paste them in WoW Addon directory.
# Assumes a ".env" located next to this file or at top level which contains a variable "WOW_LOCATION" pointing
# to the WoW install location. It also assumes the toplevel folder is named after the addon.
#
# All files and folders starting with "." or "__" are exluded from the deploy, and only updates are copied.
# Files that no longer exists in the SOURCE are deleted from the DESTINATION.
#
# It uses `robocopy` to do the file/folder filtering, however a `cp` without filtering is commented out.
echo "Executing $0" >&2

# Process command-line options
usage() {
echo "Usage: test.sh [-cp]" >&2
echo " -c Pack to _classic_ WoW edition." >&2
echo " -p Pack to _ptr_ WoW edition." >&2
}

ADDON_LOC="$(pwd)"
ADDON="$(basename $ADDON_LOC)"
WOWEDITION="_retail_"

# Commandline inputs
while getopts ":cp" opt; do
case $opt in
c)
WOWEDITION="_classic_";;
p)
WOWEDITION="_ptr_";;
/?)
usage ;;
esac
done

# Check .env
if [ -f ".env" ]; then
. "./.env"
elif [[ -f ".scripts/.env" ]]; then
. ".scripts/.env"
else
echo "<WARNING> Couldn't find \".env\" file. This should contain a WOW_LOCATION variable with the game path.">&2
fi

if [ -z "$WOW_LOCATION" ]; then
echo "<ERROR> Expected \$WOW_LOCATION to be set, cannot deploy." >&2
echo "Exiting..."
exit;
fi

DEST="$WOW_LOCATION$WOWEDITION/Interface/AddOns/$ADDON"

# Deploy:
# cp "$ADDON_LOC" "$DEST" -ruv
robocopy "$ADDON_LOC" "$DEST" //s //purge //xo //XD .* __* //XF ?.* __*

echo "Finished deploying $ADDON"
24 changes: 16 additions & 8 deletions Core/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ addon.OPT_MORE_BUTTONS_VALUES = {
INVTYPE_TRINKET = _G.INVTYPE_TRINKET,
WEAPON = _G.WEAPON,
TOKEN = L["Armor Token"],
CORRUPTED = _G.CORRUPTION_TOOLTIP_TITLE,
}

--[[
Expand Down Expand Up @@ -71,27 +72,34 @@ addon.INVTYPE_Slots = {
-- Each function receives the following parameters:
-- item, db (addon:Getdb()), itemID, itemEquipLoc,itemClassID, itemSubClassID
addon.RESPONSE_CODE_GENERATORS = {
-- Corrupted Items
function (item, db, itemEquipLoc)
return db.enabledButtons.CORRUPTED and GetCorruption and IsCorruptedItem(item) and "CORRUPTED" or nil
end,

-- Check for token
[1] = function (_, db, itemID)
function (_, db, itemID)
if RCTokenTable[itemID] and db.enabledButtons["TOKEN"] then
return "TOKEN"
end
end,

-- Check for Weapon
function (_, db, _, itemEquipLoc)
if db.enabledButtons.WEAPON and addon.BTN_SLOTS[itemEquipLoc] == "WEAPON" then
return "WEAPON"
end
end,

-- Check for Azerite Gear
[2] = function (_, db, _, itemEquipLoc)
function (_, db, _, itemEquipLoc)
-- To use Azerite Buttons, the item must be one of the 3 azerite items, and no other button group must be set for those equipLocs
if db.enabledButtons.AZERITE and not db.enabledButtons[itemEquipLoc] then
if addon.BTN_SLOTS[itemEquipLoc] == "AZERITE" then
return "AZERITE"
end
end
end,
-- Check for Weapon
[3] = function (_, db, _, itemEquipLoc)
if db.enabledButtons.WEAPON and addon.BTN_SLOTS[itemEquipLoc] == "WEAPON" then
return "WEAPON"
end
end,
}


Expand Down
2 changes: 2 additions & 0 deletions Locale/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ L["Could not find 'player' in the group."] = "Could not find %s in the group."
L["Couldn't find any councilmembers in the group"] = true
L["council"] = true
L["Council"] = true
L["Corruption if awarded:"] = true
L["Current Council"] = true
L["current_council_desc"] = "\nClick to remove certain people from the council\n"
L["Customize appearance"] = true
Expand Down Expand Up @@ -391,6 +392,7 @@ L["Socket"] = true
L["Sort Items"] = true
L["sort_items_desc"] = "Sort sessions by item type and item level."
L["Standard .csv output."] = "Standard CSV export that can be edited and reimported."
L["Standard JSON output."] = "JSON array containing one JSON object per history entry."
L["Status texts"] = true
L["Store in bag and award later"] = true
L["Succesfully deleted %d entries"] = true
Expand Down
5 changes: 1 addition & 4 deletions Modules/History/CSVImport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function His:ImportNew (import, delimiter)
-- Ensure error free lines
if length ~= private.numFields then
private:AddError(i, length, string.format("Row has the wrong number of fields - expected %d", private.numFields))
printtable(line)

else
private:ValidateLine(i, line)
Expand Down Expand Up @@ -238,7 +237,7 @@ function private:RebuildResponseID(data,t, line)
type = addon.BTN_SLOTS[type]
end
-- Check for custom responses
if not db.responses[type] then
if #db.responses[type] == 0 then
type = "default"
end
-- and finally validate
Expand Down Expand Up @@ -286,9 +285,7 @@ function private:RebuildTime (data, t, line)
t.time = date("%H:%M:%S", secs)
elseif dato then
local d, m, y = strsplit("/", dato or "", 3)
print(d,m,y)
local secs = His:DateTimeToSeconds(d,m,y) -- Will provide 0:0:0
print(secs)
t.date = date("%d/%m/%y", secs)
t.time = date("%H:%M:%S", secs)
t.id = secs .. "-"..private.idCount
Expand Down
61 changes: 61 additions & 0 deletions Modules/History/lootHistory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function LootHistory:OnInitialize()
eqxml = {func = self.ExportEQXML, name = "EQdkp-Plus XML", tip = L["EQdkp-Plus XML output, tailored for Enjin import."]},
player = {func = self.PlayerExport, name = "Player Export", tip = L["A format to copy/paste to another player."]},
discord = {func = self.ExportDiscord, name = "Discord", tip = L["Discord friendly output."]},
json = {func = self.ExportJSON, name = "JSON", tip = L["Standard JSON output."]},
--html = self.ExportHTML
}
self.scrollCols = {
Expand Down Expand Up @@ -1417,6 +1418,66 @@ do
return table.concat(ret)
end

function LootHistory:ExportJSON()
wipe(export)
wipe(ret)
local subType, equipLoc, rollType, _
local eligibleEntries = 0;

for player, v in pairs(lootDB) do
if selectedName and selectedName == player or not selectedName then
for i, d in pairs(v) do
if selectedDate and selectedDate == d.date or not selectedDate then
eligibleEntries = eligibleEntries + 1;
end
end
end
end

local processedEntries = 0;

for player, v in pairs(lootDB) do
if selectedName and selectedName == player or not selectedName then
for i, d in pairs(v) do
if selectedDate and selectedDate == d.date or not selectedDate then
_,_,subType, equipLoc = GetItemInfoInstant(d.lootWon)
if d.tierToken then subType = L["Armor Token"] end
rollType = (d.tokenRoll and "token") or (d.relicRoll and "relic") or "normal"
tinsert(export, string.format("\"%s\":\"%s\"", "player", tostring(player)))
tinsert(export, string.format("\"%s\":\"%s\"", "date", tostring(self:GetLocalizedDate(d.date))))
tinsert(export, string.format("\"%s\":\"%s\"", "time", tostring(d.time)))
tinsert(export, string.format("\"%s\":%s", "itemID", addon:GetItemIDFromLink(d.lootWon)))
tinsert(export, string.format("\"%s\":\"%s\"", "itemString", addon:GetItemStringFromLink(d.lootWon)))
tinsert(export, string.format("\"%s\":\"%s\"", "response", tostring(d.response)))
tinsert(export, string.format("\"%s\":%s", "votes", tostring(d.votes or 0)))
tinsert(export, string.format("\"%s\":\"%s\"", "class", tostring(d.class)))
tinsert(export, string.format("\"%s\":\"%s\"", "instance", tostring(d.instance)))
tinsert(export, string.format("\"%s\":\"%s\"", "boss", tostring(d.boss)))
tinsert(export, string.format("\"%s\":\"%s\"", "gear1", tostring(d.itemReplaced1 or "")))
tinsert(export, string.format("\"%s\":\"%s\"", "gear2", tostring(d.itemReplaced2 or "")))
tinsert(export, string.format("\"%s\":\"%s\"", "responseID", tostring(d.responseID)))
tinsert(export, string.format("\"%s\":\"%s\"", "isAwardReason", tostring(d.isAwardReason or false)))
tinsert(export, string.format("\"%s\":\"%s\"", "rollType", rollType))
tinsert(export, string.format("\"%s\":\"%s\"", "subType", tostring(subType)))
tinsert(export, string.format("\"%s\":\"%s\"", "equipLoc", tostring(getglobal(equipLoc) or "")))
tinsert(export, string.format("\"%s\":\"%s\"", "note", (d.note or "")))
tinsert(export, string.format("\"%s\":\"%s\"", "owner", tostring(d.owner or "Unknown")))

processedEntries = processedEntries + 1;

if processedEntries < eligibleEntries then
tinsert(ret, "{" .. table.concat(export, ",") .. "},")
else
tinsert(ret, "{" .. table.concat(export, ",") .. "}")
end
wipe(export)
end
end
end
end
return "[" .. table.concat(ret) .. "]"
end

--- Simplified BBCode, as supported by CurseForge
-- ~24 ms (84%) improvement by switching to table and concat
function LootHistory:ExportBBCode()
Expand Down
2 changes: 1 addition & 1 deletion Modules/lootFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ do
if item.isRoll then
entry = self:Get("roll")
else
entry = self:Get(item.equipLoc)
entry = self:Get(item.typeCode or item.equipLoc)
end
if entry then -- We restored a previously trashed entry, so just update it to the new item
entry:Update(item)
Expand Down
2 changes: 2 additions & 0 deletions Modules/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ function addon:OptionsTable()
type = "select",
width = "double",
values = {
[1579593600] = "Ny'alotha the Waking City raid",
[1578988800] = "Patch 8.3.0 (Visions of N'Zoth)",
[1562644800] = "Azshara's Eternal Palace raid",
[1561521600] = "Patch 8.2.0 (Rise of Azshara)",
[1544515200] = "Patch 8.1.0",
Expand Down
89 changes: 88 additions & 1 deletion Modules/votingFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function RCVotingFrame:OnInitialize()
{ name = L["Vote"], DoCellUpdate = RCVotingFrame.SetCellVote, colName = "vote", sortnext = 10, width = 60, align = "CENTER", }, -- 11 Vote button
{ name = L["Notes"], DoCellUpdate = RCVotingFrame.SetCellNote, colName = "note", width = 50, align = "CENTER", }, -- 12 Note icon
{ name = _G.ROLL, DoCellUpdate = RCVotingFrame.SetCellRoll, colName = "roll", sortnext = 10, width = 50, align = "CENTER", }, -- 13 Roll
{ name = "", DoCellUpdate = RCVotingFrame.SetCellCorruption, colName = "corruption", sortnext = 10, width = 30, align = "CENTER",}, -- 14 Corruption (Patch 8.3)
}
-- The actual table being worked on, new entries should be added to this table "tinsert(RCVotingFrame.scrollCols, data)"
-- If you want to add or remove columns, you should do so on your OnInitialize. See RCVotingFrame:RemoveColumn() for removal.
Expand Down Expand Up @@ -209,8 +210,9 @@ function RCVotingFrame:OnCommReceived(prefix, serializedMsg, distri, sender)

elseif command == "lootAck" then
-- v2.7.4: Extended to contain playerName, specID, ilvl, data
-- v2.17.0: Added CorruptionData table
-- data contains: diff, gear1[, gear2, response] - each a table for each session
local name, specID, ilvl, sessionData = unpack(data)
local name, specID, ilvl, sessionData, corruptionData = unpack(data)
if not specID then -- Old lootAck
for i = 1, #lootTable do
self:SetCandidateData(i, name, "response", "WAIT")
Expand All @@ -224,6 +226,13 @@ function RCVotingFrame:OnCommReceived(prefix, serializedMsg, distri, sender)
for i = 1, #lootTable do
self:SetCandidateData(i, name, "specID", specID)
self:SetCandidateData(i, name, "ilvl", ilvl)
if corruptionData then
local corruption, corruptionResistance = unpack(corruptionData)
local totalCorruption = math.max(corruption - corruptionResistance, 0);
self:SetCandidateData(i, name, "corruption", corruption)
self:SetCandidateData(i, name, "corruptionResistance", corruptionResistance)
self:SetCandidateData(i, name, "totalCorruption", totalCorruption)
end
if not sessionData.response[i] then
-- We might already have an response, so don't override unless it's announced
if self:GetCandidateData(i, name, "response") == "ANNOUNCED" then
Expand Down Expand Up @@ -733,6 +742,15 @@ function RCVotingFrame:GetFrame()
st:EnableSelection(true)
f.st = st
f:SetWidth(f.st.frame:GetWidth() + 20)

-- Set texture for corruption header, if present
local corruptionHeaderID = self:GetColumnIndexFromName("corruption")
if corruptionHeaderID then
local tex = st.head.cols[corruptionHeaderID]:CreateTexture()
tex:SetAtlas("Nzoth-tooltip-topper")
tex:SetAllPoints(st.head.cols[corruptionHeaderID])
tex:SetTexCoord(0.28,0.72,0,1)
end
end
f.UpdateSt()

Expand Down Expand Up @@ -1271,6 +1289,75 @@ function RCVotingFrame.SetCellRoll(rowFrame, frame, data, cols, row, realrow, co
data[realrow].cols[column].value = lootTable[session].candidates[name].roll or ""
end



local function CorruptionCellOnEnter (player)
-- Use cached data if available
if not RCVotingFrame.corruptionEffects then
-- Cache some corruption related data
local corruptionEffects = GetNegativeCorruptionEffectInfo()
table.sort(corruptionEffects, function(a, b)
return a.minCorruption < b.minCorruption
end)
RCVotingFrame.corruptionEffects = corruptionEffects
end
local corruption = RCVotingFrame:GetCandidateData(session, player, "corruption")
local corruptionResistance = RCVotingFrame:GetCandidateData(session, player, "corruptionResistance")
local totalCorruption = RCVotingFrame:GetCandidateData(session, player, "totalCorruption")

-- Setup corruption tooltip
GameTooltip_SetBackdropStyle(GameTooltip, _G.GAME_TOOLTIP_BACKDROP_STYLE_CORRUPTED_ITEM);
GameTooltip:SetOwner(RCVotingFrame.frame.content, "ANCHOR_RIGHT");
GameTooltip:SetMinimumWidth(250);
GameTooltip:AddLine(addon:GetUnitClassColoredName(player))
GameTooltip:AddLine("")
GameTooltip_AddColoredDoubleLine(GameTooltip, _G.CORRUPTION_TOOLTIP_LINE, corruption, _G.HIGHLIGHT_FONT_COLOR, _G.HIGHLIGHT_FONT_COLOR);
GameTooltip_AddColoredDoubleLine(GameTooltip, _G.CORRUPTION_RESISTANCE_TOOLTIP_LINE, corruptionResistance, _G.HIGHLIGHT_FONT_COLOR, _G.HIGHLIGHT_FONT_COLOR);
GameTooltip_AddColoredDoubleLine(GameTooltip, _G.TOTAL_CORRUPTION_TOOLTIP_LINE, totalCorruption, _G.CORRUPTION_COLOR, _G.CORRUPTION_COLOR)
if IsCorruptedItem(lootTable[session].link) then
GameTooltip_AddBlankLineToTooltip(GameTooltip);
local newTotalCorruption, currentItemCorruption = totalCorruption, 0
currentItemCorruption = addon:GetCorruptionFromTooltip(lootTable[session].link)
newTotalCorruption = totalCorruption + currentItemCorruption
GameTooltip_AddColoredDoubleLine(GameTooltip, lootTable[session].link, currentItemCorruption == 0 and 0 or "+"..currentItemCorruption, _G.WHITE_FONT_COLOR, _G.CORRUPTION_COLOR)
GameTooltip_AddColoredDoubleLine(GameTooltip, L["Corruption if awarded:"], newTotalCorruption, _G.WHITE_FONT_COLOR, _G.CORRUPTION_COLOR)
end
GameTooltip_AddBlankLineToTooltip(GameTooltip);

-- Corruption info - Mostly copied from CharacterFrame.lua
for i, corruptionInfo in ipairs(RCVotingFrame.corruptionEffects) do
if i > 1 then
GameTooltip_AddBlankLineToTooltip(GameTooltip);
end
-- We only show 1 effect above the player's current corruption.
local lastEffect = (corruptionInfo.minCorruption > totalCorruption);
GameTooltip_AddColoredLine(GameTooltip, _G.CORRUPTION_EFFECT_HEADER:format(corruptionInfo.name, corruptionInfo.minCorruption), lastEffect and _G.GRAY_FONT_COLOR or _G.HIGHLIGHT_FONT_COLOR);
GameTooltip_AddColoredLine(GameTooltip, corruptionInfo.description, lastEffect and _G.GRAY_FONT_COLOR or _G.CORRUPTION_COLOR, wrap, 10);
if lastEffect then
break;
end
end
GameTooltip:SetAnchorType("ANCHOR_RIGHT", 0, -GameTooltip:GetHeight())
GameTooltip:Show()
end

function RCVotingFrame.SetCellCorruption(rowFrame, frame, data, cols, row, realrow, column, fShow, table, ...)
local name = data[realrow].name
local corruption = RCVotingFrame:GetCandidateData(session, name, "corruption") or ""
frame.text:SetText(corruption)
if _G.CORRUPTION_COLOR then
frame.text:SetTextColor(_G.CORRUPTION_COLOR:GetRGBA())
end
data[realrow].cols[column].value = corruption

-- Tooltip
frame:SetScript("OnEnter", function()
CorruptionCellOnEnter(name)
end)
frame:SetScript("OnLeave", function() addon:HideTooltip() end)
frame:SetScript("OnClick", function() PlaySound(SOUNDKIT.NZOTH_EYE_SQUISH) end) -- Bonus :)
end

function RCVotingFrame.filterFunc(table, row)
if not db.modules["RCVotingFrame"].filters then return true end -- db hasn't been initialized, so just show it
local name = row.name
Expand Down
Loading

0 comments on commit 892ce82

Please sign in to comment.