Skip to content

Commit

Permalink
Merge branch 'main' into patch/nameplate-settings-fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Solanya authored Nov 6, 2023
2 parents 3e508a8 + bab439d commit d88aa7e
Show file tree
Hide file tree
Showing 70 changed files with 1,813 additions and 574 deletions.
4 changes: 2 additions & 2 deletions Scripts/localization.py → .github/scripts/localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ def cf_download_localization(locale: Locale, path: Path, *, dry_run: bool):
-- THIS FILE IS AUTOMATICALLY GENERATED.
-- ALL MODIFICATIONS TO THIS FILE WILL BE LOST.
local _, TRP3 = ...;
local _, TRP3_API = ...;
TRP3.loc:RegisterNewLocale("{locale.value}", "{locale.name()}", {contents[4:]});
TRP3_API.loc:RegisterNewLocale("{locale.value}", "{locale.name()}", {contents[4:]});
""")


Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion requirements.txt → .github/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
luaparser==3.1.1
requests==2.28.1
requests==2.31.0
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/update_translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
cache: 'pip'

- name: Install Python dependencies
run: pip install -r requirements.txt
run: pip install -r .github/scripts/requirements.txt

- name: Upload CurseForge Translations
run: make translations/upload
Expand Down
14 changes: 12 additions & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ stds.wow = {
},
},

C_Texture = {
fields = {
"GetAtlasInfo",
},
},

C_Timer = {
fields = {
"After",
Expand Down Expand Up @@ -352,6 +358,7 @@ stds.wow = {
ScrollUtil = {
fields = {
"AddManagedScrollBarVisibilityBehavior",
"InitScrollBoxListWithScrollBar",
"RegisterScrollBoxWithScrollBar",
},
},
Expand Down Expand Up @@ -387,6 +394,8 @@ stds.wow = {
"CreateFrame",
"CreateFramePool",
"CreateFromMixins",
"CreateIndexRangeDataProvider",
"CreateScrollBoxListGridView",
"CreateTextureMarkup",
"CreateVector2D",
"DisableAddOn",
Expand Down Expand Up @@ -430,15 +439,16 @@ stds.wow = {
"GetNormalizedRealmName",
"GetNumLanguages",
"GetPlayerInfoByGUID",
"GetUnitName",
"GetRealmName",
"GetSpellDescription",
"GetSpellInfo",
"GetSpellTexture",
"GetStablePetInfo",
"GetSubZoneText",
"GetTickTime",
"GetTime",
"GetTimePreciseSec",
"GetUnitName",
"GetZonePVPInfo",
"GetZoneText",
"HideUIPanel",
Expand Down Expand Up @@ -510,7 +520,6 @@ stds.wow = {
"UIDROPDOWNMENU_INIT_MENU",
"UIDROPDOWNMENU_MENU_LEVEL",
"UIDROPDOWNMENU_MENU_VALUE",
"UIPanelCloseButton_SetBorderAtlas",
"UnitAffectingCombat",
"UnitAura",
"UnitBattlePetLevel",
Expand Down Expand Up @@ -577,6 +586,7 @@ stds.wow = {
"TargetFrame",
"UIErrorsFrame",
"UIParent",
"UISpecialFrames",
"WorldFrame",
"WorldMapFrame",

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ repos:

- id: xmllint
name: check xml
entry: xmllint --noout --quiet --schema Scripts/UI.xsd
entry: xmllint --noout --quiet --schema .github/scripts/ui.xsd
language: system
types: [xml]
exclude: ^(Scripts/UI\.xsd|totalRP3/Bindings\.xml)$
exclude: ^(.github/scripts/ui\.xsd|totalRP3/Bindings\.xml)$
require_serial: true
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
# Changelog version 2.5.5

## Added

- Added 3 musics, 4 images and 76 icons from patch 10.1.7.
- Added setting to crop long guild names on RP nameplates.

## Fixed

- Improved icon browser performance to deal with an occasional addon loading issue.
- Fixed a recycling issue with RP nameplates when using Plater Nameplates.

# Changelog version 2.5.4

## Added

- Added 53 musics, 45 images and 169 icons from patch 10.1.5 and before (some previously encrypted icons).

## Fixed

- Fixed close/minimize/resize buttons positions for Retail.
- Fixed a bug with the dashboard potentially related to Prat.

# Changelog version 2.5.3

## Fixed

- Prevented invalid dice roll messages from showing.
- Updated TaintLess library for patch 3.4.2.

# Changelog version 2.5.2

## Fixed

- Fixed an issue with the Plater RP nameplates getting stuck on screen.

# Changelog version 2.5.1

## Fixed

- Fixed an error with the Prat module out if a player had no custom color.
- Fixed an error with chat links.
- Empty guild rank/name fields will now display default values in the tooltip.
- Fixed an issue with "No player named..." messages appearing when hovering players on realms with non-latin characters.

# Changelog version 2.5.0

## Added
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LOCALE_DIR := totalRP3/Locales

all: dist

check: Scripts/UI.xsd
check: .github/scripts/ui.xsd
pre-commit run --all-files

dist:
Expand All @@ -29,10 +29,10 @@ libs:
translations: translations/upload translations/download

translations/download:
$(PYTHON) Scripts/localization.py --project-id=$(CF_PROJECT_ID) --locale-dir=$(LOCALE_DIR) download
$(PYTHON) .github/scripts/localization.py --project-id=$(CF_PROJECT_ID) --locale-dir=$(LOCALE_DIR) download

translations/upload:
$(PYTHON) Scripts/localization.py --project-id=$(CF_PROJECT_ID) --locale-dir=$(LOCALE_DIR) upload
$(PYTHON) .github/scripts/localization.py --project-id=$(CF_PROJECT_ID) --locale-dir=$(LOCALE_DIR) upload

Scripts/UI.xsd: .FORCE
.github/scripts/ui.xsd: .FORCE
curl -s $(SCHEMA_URL) -o $@
2 changes: 1 addition & 1 deletion totalRP3/Core/CommunicationProtocolBroadcast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Comm.broadcast.broadcast = broadcast;

local function onBroadcastReceived(message, sender)
local header, command, arg1, arg2, arg3, arg4, arg5, arg6, arg7 = strsplit(BROADCAST_SEPARATOR, message);
if not header == BROADCAST_HEADER or not command then
if header ~= BROADCAST_HEADER or not command then
return; -- If not RP protocol or don't have a command
end
Comm.totalBroadcastR = Comm.totalBroadcastR + BROADCAST_HEADER:len() + message:len();
Expand Down
7 changes: 7 additions & 0 deletions totalRP3/Core/Configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ TRP3_API.RegisterCallback(TRP3_Addon, TRP3_Addon.Events.WORKFLOW_ON_LOAD, functi
registerConfigKey("ui_sounds", true);
registerConfigKey("ui_animations", true);
registerConfigKey("disable_welcome_message", false);
registerConfigKey("hide_maximize_button", false);
registerConfigKey("default_color_picker", false);
registerConfigKey("color_contrast_level", TRP3_API.ColorContrastOption.Default);
registerConfigKey("date_format", "");
Expand Down Expand Up @@ -425,6 +426,12 @@ TRP3_API.RegisterCallback(TRP3_Addon, TRP3_Addon.Events.WORKFLOW_ON_LOAD, functi
configKey = "disable_welcome_message",
help = loc.CO_GENERAL_DISABLE_WELCOME_MESSAGE_HELP,
},
{
inherit = "TRP3_ConfigCheck",
title = loc.CO_GENERAL_HIDE_MAXIMIZE_BUTTON,
configKey = "hide_maximize_button",
help = loc.CO_GENERAL_HIDE_MAXIMIZE_BUTTON_HELP,
},
{
inherit = "TRP3_ConfigCheck",
title = loc.CO_GENERAL_DEFAULT_COLOR_PICKER,
Expand Down
2 changes: 1 addition & 1 deletion totalRP3/Core/Core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ https://raw.githubusercontent.com/Meorawr/wow-ui-schema/main/UI.xsd">

<Include file="UIMain.lua"/>

<Include file="..\UI\Browsers\Icons.xml"/>
<Include file="..\UI\Browsers\IconBrowser.xml"/>
<Include file="..\UI\Browsers\Companions.xml"/>
<Include file="..\UI\Browsers\Musics.xml"/>
<Include file="..\UI\Browsers\Colors.xml"/>
Expand Down
2 changes: 1 addition & 1 deletion totalRP3/Core/Globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TRP3_API.globals = {
addon_name_me = "Total RP 3",
addon_id_length = 15,

version = 115,
version = 120,

--@debug@
version_display = "-dev",
Expand Down
82 changes: 16 additions & 66 deletions totalRP3/Core/Popup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local initList = TRP3_API.ui.list.initList;
local tinsert, tremove, _G, pairs, wipe, math, assert = tinsert, tremove, _G, pairs, wipe, math, assert;
local handleMouseWheel = TRP3_API.ui.list.handleMouseWheel;
local setTooltipForFrame, setTooltipForSameFrame = TRP3_API.ui.tooltip.setTooltipForFrame, TRP3_API.ui.tooltip.setTooltipForSameFrame;
local getIconList, getIconListSize, getImageList, getImageListSize, getMusicList, getMusicListSize;
local getImageList, getImageListSize, getMusicList, getMusicListSize;
local displayDropDown = TRP3_API.ui.listbox.displayDropDown;
local max = math.max;
local TRP3_Enums = AddOn_TotalRP3.Enums;
Expand Down Expand Up @@ -394,83 +394,35 @@ end
-- Icon browser
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

local TRP3_IconBrowser = TRP3_IconBrowser;
local iconWidgetTab = {};
local filteredIconList;
local ui_IconBrowserContent = TRP3_IconBrowserContent;
local IconBrowserCallbackOwner = {}; -- Dummy owner for callback registrations.

local function decorateIcon(icon, index)
icon:SetNormalTexture("Interface\\ICONS\\"..filteredIconList[index]);
icon:SetPushedTexture("Interface\\ICONS\\"..filteredIconList[index]);
setTooltipForFrame(icon, TRP3_IconBrowser, "RIGHT", 0, -100, Utils.str.icon(filteredIconList[index], 75), filteredIconList[index]);
icon.index = index;
end

local function onIconClick(icon)
TRP3_API.popup.hideIconBrowser();
if ui_IconBrowserContent.onSelectCallback then
ui_IconBrowserContent.onSelectCallback(filteredIconList[icon.index], icon);
end
end
local function OnIconBrowserSelection(onSelectCallback, _, iconInfo)
TRP3_IconBrowserUtil.UnregisterAllCallbacks(IconBrowserCallbackOwner);
hidePopups();

local function onIconClose()
TRP3_API.popup.hideIconBrowser();
if ui_IconBrowserContent.onCancelCallback then
ui_IconBrowserContent.onCancelCallback();
if onSelectCallback then
onSelectCallback(iconInfo.name, iconInfo);
end
end

local function filteredIconBrowser()
local filter = TRP3_IconBrowserFilterBox:GetText();
if filteredIconList and filteredIconList ~= getIconList() then -- Remove previous filtering if is not full list
wipe(filteredIconList);
filteredIconList = nil;
end
filteredIconList = getIconList(filter);
TRP3_IconBrowserTotal:SetText(string.format(GENERIC_FRACTION_STRING, #filteredIconList, getIconListSize()));
initList(
{
widgetTab = iconWidgetTab,
decorate = decorateIcon
},
filteredIconList,
TRP3_IconBrowserContentSlider
);
end
local function OnIconBrowserClosed(onCancelCallback)
TRP3_IconBrowserUtil.UnregisterAllCallbacks(IconBrowserCallbackOwner);
hidePopups();

local function initIconBrowser()
handleMouseWheel(ui_IconBrowserContent, TRP3_IconBrowserContentSlider);
TRP3_IconBrowserContentSlider:SetValue(0);
-- Create icons
for row = 0, 5 do
for column = 0, 7 do
local button = CreateFrame("Button", "TRP3_IconBrowserButton_"..row.."_"..column, ui_IconBrowserContent, "TRP3_IconBrowserButton");
button:ClearAllPoints();
button:SetPoint("TOPLEFT", ui_IconBrowserContent, "TOPLEFT", 15 + (column * 45), -15 + (row * (-45)));
button:SetScript("OnClick", onIconClick);
tinsert(iconWidgetTab, button);
end
if onCancelCallback then
onCancelCallback();
end

TRP3_IconBrowserFilterBox:SetScript("OnTextChanged", filteredIconBrowser);
TRP3_IconBrowserClose:SetScript("OnClick", onIconClose);

TRP3_IconBrowserTitle:SetText(loc.UI_ICON_BROWSER);
TRP3_IconBrowserFilterBoxText:SetText(loc.UI_FILTER);
filteredIconBrowser();
end

local function showIconBrowser(onSelectCallback, onCancelCallback, scale)
ui_IconBrowserContent.onSelectCallback = onSelectCallback;
ui_IconBrowserContent.onCancelCallback = onCancelCallback;
TRP3_IconBrowserFilterBox:SetText("");
TRP3_IconBrowserFilterBox:SetFocus();
TRP3_IconBrowserUtil.RegisterCallback(IconBrowserCallbackOwner, "OnBrowserIconSelected", OnIconBrowserSelection, onSelectCallback);
TRP3_IconBrowserUtil.RegisterCallback(IconBrowserCallbackOwner, "OnBrowserClosed", OnIconBrowserClosed, onCancelCallback);
TRP3_IconBrowserUtil.OpenBrowser();
TRP3_IconBrowser:SetScale(scale or 1);
end

function TRP3_API.popup.hideIconBrowser()
hidePopups();
TRP3_IconBrowser:Hide();
TRP3_IconBrowserUtil.CloseBrowser();
end

--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Expand Down Expand Up @@ -1161,11 +1113,9 @@ end
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

function TRP3_API.popup.init()
getIconList, getIconListSize = TRP3_API.utils.resources.getIconList, TRP3_API.utils.resources.getIconListSize;
getImageList, getImageListSize = TRP3_API.utils.resources.getImageList, TRP3_API.utils.resources.getImageListSize;
getMusicList, getMusicListSize = TRP3_API.utils.resources.getMusicList, TRP3_API.utils.resources.getMusicListSize;

initIconBrowser();
initCompanionBrowser();
initMusicBrowser();
initColorBrowser();
Expand Down
38 changes: 27 additions & 11 deletions totalRP3/Core/Slash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,22 @@ function TRP3_API.slash.rollDices(...)
return total, i;
end

local function isValidDiceObject(diceObject)
if type(diceObject) ~= "table" then
return false;
elseif type(diceObject.t) ~= "number" then -- Roll total
return false;
elseif diceObject.c ~= nil and type(diceObject.c) ~= "number" then -- Sides
return false;
elseif diceObject.d ~= nil and type(diceObject.d) ~= "number" then -- Count
return false;
elseif diceObject.m ~= nil and type(diceObject.m) ~= "number" then -- Modifier (+/-)
return false;
else
return true;
end
end

TRP3_API.RegisterCallback(TRP3_Addon, TRP3_Addon.Events.WORKFLOW_ON_LOADED, function()
TRP3_API.slash.registerCommand({
id = "roll",
Expand All @@ -157,17 +173,17 @@ TRP3_API.RegisterCallback(TRP3_Addon, TRP3_Addon.Events.WORKFLOW_ON_LOADED, func
});

AddOn_TotalRP3.Communications.registerSubSystemPrefix(DICE_SIGNAL, function(arg, sender)
if sender ~= Globals.player_id then
if type(arg) == "table" then
if arg.c and arg.d and arg.t then
local modifierString = (arg.m == 0) and "" or format("%+d", arg.m); -- we add a + to positive modifiers and don't render a 0 value
Utils.message.displayMessage(loc.DICE_ROLL_T:format(Utils.str.icon(TRP3_InterfaceIcons.DiceRoll, 20), sender, arg.c, arg.d, modifierString, arg.t));
elseif arg.t then
local totalMessage = loc.DICE_TOTAL_T:format(Utils.str.icon(TRP3_InterfaceIcons.DiceRoll, 20), sender, arg.t);
Utils.message.displayMessage(totalMessage);
end
Utils.music.playSoundID(36629, "SFX", sender);
end
if sender == Globals.player_id or not isValidDiceObject(arg) then
return;
end

if arg.c and arg.d and arg.t then
local modifierString = (arg.m == 0) and "" or format("%+d", arg.m); -- we add a + to positive modifiers and don't render a 0 value
Utils.message.displayMessage(loc.DICE_ROLL_T:format(Utils.str.icon(TRP3_InterfaceIcons.DiceRoll, 20), sender, arg.c, arg.d, modifierString, arg.t));
elseif arg.t then
local totalMessage = loc.DICE_TOTAL_T:format(Utils.str.icon(TRP3_InterfaceIcons.DiceRoll, 20), sender, arg.t);
Utils.message.displayMessage(totalMessage);
end
Utils.music.playSoundID(36629, "SFX", sender);
end);
end);
Loading

0 comments on commit d88aa7e

Please sign in to comment.