Skip to content

Commit

Permalink
Integrating performance fixes (#162)
Browse files Browse the repository at this point in the history
* adding fixes for duplicate name (#149)

* fixes #135 in EN

* Handle racial/rep duplicate names

* fix typo in debug string

---------

Co-authored-by: whiterabbit963 <[email protected]>

* fixes #145 in EN

(cherry picked from commit 7c11fb8)

* fixes #145 in FR

(cherry picked from commit f5d2a71)

* fixes #145 in DE

(cherry picked from commit fde4be5)

* metadata for v1.2.0

(cherry picked from commit 1f12547)

* updated v1.2.0 metadata again

* Update integration branch (#158)

* preparing release v1.2.0 (#150)

* adding fixes for duplicate name (#149)

* fixes #135 in EN

* Handle racial/rep duplicate names

* fix typo in debug string

---------

Co-authored-by: whiterabbit963 <[email protected]>

* fixes #145 in EN

(cherry picked from commit 7c11fb8)

* fixes #145 in FR

(cherry picked from commit f5d2a71)

* fixes #145 in DE

(cherry picked from commit fde4be5)

* metadata for v1.2.0

(cherry picked from commit 1f12547)

* updated v1.2.0 metadata again

* Update assign_project.yml to start working again

* Update assign_project.yml

* Update assign_project.yml

* Update assign_project.yml

* Update assign_project.yml

* Delete .github/workflows/assign_project.yml

* store all skills in the dictionary based on the label

* add missing descriptions for Dol Amroth class skills for EN

* add some skill descriptions in DE

* fix single quote issue in "Zum Blutigen Adler" for DE (#161)

Updated reputation, warden, and hunter skill names.
The raw value in the game files shows the double quote as an escaped
letter q, eg. '\q'. These are the only places I have observed this
behavior.

* fix typo in warden skill id for DE

* add missing descriptions in FR

Removed duplicate/copy/paste mariner locations

* add visual skill scanner

New skills must be visually inspected, and this will help speed up the
process for finding new skills as they are added.

* specify ShortcutType instead of using raw int

* replace raw Action value with UI_Toggle enumeration

* hide options window on escape and ui_toggle

* remove excess spacing

* remove custom resize logic

* add TravelListTab:SetSize() overload

* handle starting size and position when creating settings for the first time

* save width/height on a resize to Settings

* when the settingsmenu item is selected, set the min opacity

* set min window opacity when opening from toggle button

* Performance Improvements (#142)

This was done by skipping the FindSkill() operation, which searches
every trained skill (hundreds). Since the trained skills list is
never updated, it is completely unnecessary to repeat the search.
If skills are updated, it would be necessary to reacquire this list
and perform a single additional search.
Added a found cache value to TravelShortcut.
Add a CheckSkills() call when opening the window.
Until auto-detection scanning is completed this should suffice.

* fixup and improve options panel performance

In SetMapHome() remove call to SetShortcuts().
This method should rarely be called because it is effectively
an init method using static data.

* improve layout and resizing for pulldown tab

* improve combobox resizing

* improve consistency with setting the opacity on a hover leave

* fixup and enforce minimum window sizes

* only resize and save dimensions for list & grid tabs

* remove unused default init settings for carousel quickslots

* allow right-click menu to show up when clicking around the window edges

* pulldown list updates

fixup initialization of pulldown tab
auto select the first item in the pulldown list
added more cases to auto-close the pulldown

* allow window to go behind other windows

Normalizes expected behavior.

* startup window with min opacity setting

* fixup various alpha values for backcolors

* remove unnecesary zorder, opacity, and visibility settings

Without this, the shortcut cannot be clicked or tooltip viewed.

* set min opacity when travel window is under a window on leave

Opening the right-click context menu will set min opacity now,
but in retrospect this seems fine.

* optimize bubble sort

* fix #161

* improved comments in dictionary

* adding 1.3.0 metadata

---------

Co-authored-by: whiterabbit963 <[email protected]>
  • Loading branch information
wduda and whiterabbit963 authored Jan 7, 2024
1 parent 477b1d2 commit 6d220f1
Show file tree
Hide file tree
Showing 20 changed files with 809 additions and 649 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## v1.3.0
- fixed Warden Muster to Dale in DE client
- fixed Bloody Eagle Tavern skill in DE client
- fixed more sorting issues for Hunter, Warden and DE/FR clients caused by duplicate skillnames - thanks to @whiterabbit963
- options window now hides on pressing Esc or UI toggle button - thanks to @whiterabbit963
- spacing around borders of window reduced to look nicer when resizing into a small window - thanks to @whiterabbit963
- improved layout and resizing for pulldown tab - thanks to @whiterabbit963
- more consistent and performant setting of window opacity and options window opacity - thanks to @whiterabbit963
- vast amounts of code quality improvements that should result in stability, faster loading and no stutters when resizing TW II - thanks to @whiterabbit963
## v1.2.0
- fixed U38 allegiance travel skills in EN/FR/DE client
- added new U38.1.1 skill in EN/FR/DE client
Expand Down
2 changes: 1 addition & 1 deletion TravelWindowII.plugin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Information>
<Name>Travel Window II</Name>
<Author>Hyoss</Author>
<Version>v1.2.0</Version>
<Version>v1.3.0</Version>
<Description>
This plugin creates a single window that contains all the available travel skills, including the race, class and reputation skills.
It is a further development of Travel Window, that has been worked on by multiple authors before.
Expand Down
2 changes: 1 addition & 1 deletion TravelWindowII.plugincompendium
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PluginConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Id>1113</Id>
<Name>Travel Window II</Name>
<Version>v1.2.0</Version>
<Version>v1.3.0</Version>
<Author>Hyoss</Author>
<InfoUrl>http://www.lotrointerface.com/downloads/info1113</InfoUrl>
<DownloadUrl>http://www.lotrointerface.com/downloads/download1113</DownloadUrl>
Expand Down
14 changes: 9 additions & 5 deletions doc/lotroforums.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
A new version is available!

v1.2.0
- fixed U38 allegiance travel skills in EN/FR/DE client
- added new U38.1.1 skill in EN/FR/DE client
- fixed duplicate skillnames causing all kinds of sorting issues - thanks to @whiterabbit963
- minor performance improvement - thanks to @whiterabbit963
v1.3.0
- fixed Warden Muster to Dale in DE client
- fixed Bloody Eagle Tavern skill in DE client
- fixed more sorting issues for Hunter, Warden and DE/FR clients caused by duplicate skillnames - thanks to @whiterabbit963
- options window now hides on pressing Esc or UI toggle button - thanks to @whiterabbit963
- spacing around borders of window reduced to look nicer when resizing into a small window - thanks to @whiterabbit963
- improved layout and resizing for pulldown tab - thanks to @whiterabbit963
- more consistent and performant setting of window opacity and options window opacity - thanks to @whiterabbit963
- vast amounts of code quality improvements that should result in stability, faster loading and no stutters when resizing TW II - thanks to @whiterabbit963

Download it at [url=https://www.lotrointerface.com/downloads/fileinfo.php?id=1113]Lotrointerface[/url], [url=https://github.com/wduda/TravelWindowII/releases]GitHub[/url], via [url=https://github.com/JeremyStepp/OneLauncher]OneLauncher[/url] or via [url=https://www.lotrointerface.com/downloads/info663-LOTROPluginCompendium.html]Plugin Compendium[/url].
14 changes: 9 additions & 5 deletions doc/lotrointerface.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ Use the mousewheel while hovering over the travel skill icon to change the selec
[/LIST]

Version history:
v1.2.0
- fixed U38 allegiance travel skills in EN/FR/DE client
- added new U38.1.1 skill in EN/FR/DE client
- fixed duplicate skillnames causing all kinds of sorting issues - thanks to @whiterabbit963
- minor performance improvement - thanks to @whiterabbit963
v1.3.0
- fixed Warden Muster to Dale in DE client
- fixed Bloody Eagle Tavern skill in DE client
- fixed more sorting issues for Hunter, Warden and DE/FR clients caused by duplicate skillnames - thanks to @whiterabbit963
- options window now hides on pressing Esc or UI toggle button - thanks to @whiterabbit963
- spacing around borders of window reduced to look nicer when resizing into a small window - thanks to @whiterabbit963
- improved layout and resizing for pulldown tab - thanks to @whiterabbit963
- more consistent and performant setting of window opacity and options window opacity - thanks to @whiterabbit963
- vast amounts of code quality improvements that should result in stability, faster loading and no stutters when resizing TW II - thanks to @whiterabbit963

Rest of changelog found [URL="https://github.com/wduda/TravelWindowII/blob/master/CHANGELOG.md"]here[/URL].
161 changes: 71 additions & 90 deletions src/IndexedDictionary.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--[[ use a modified table to maintain data for travel skills
specifically skill name, ID and label ]]
specifically skill name, ID, label, description substring]]
IndexedDictionary = class()

function IndexedDictionary:Constructor()
Expand All @@ -8,7 +8,7 @@ function IndexedDictionary:Constructor()
self.skillIds = {};
self.skillIdList = {};
self.skillLabels = {};
self.skillDesc = {}; -- used to disambiguate identical skillNames
self.skillDesc = {}; -- description substring used to disambiguate identical skillNames
self.numberOfItems = 0;
end

Expand All @@ -17,130 +17,115 @@ function IndexedDictionary:GetCount()
return self.numberOfItems;
end

-- function to add a skills name, ID and label to the end of the dictionary
-- function to add a skills data to the end of the dictionary
function IndexedDictionary:AddSkill(name, id, label, desc)
if label == nil then
if self.skillLabels[name] ~= nil then
Turbine.Shell.WriteLine("Invalid label: " .. name);
return
end
label = name;
end

-- increase the number of datasets
self.numberOfItems = self.numberOfItems + 1;

if desc == nil then
-- insert the skill into the list of skills
table.insert(self.skillNames, name);

-- add the skill id and label into the table with name as index
self.skillIds[name] = id;
self.skillLabels[name] = label;
else
-- insert the unique label into the list of skills
table.insert(self.skillNames, label);
-- insert the unique label into the list of skills
table.insert(self.skillLabels, label);

-- add the skill id, name, and description into the table with label as index
self.skillIds[label] = id;
self.skillLabels[label] = name;
self.skillDesc[label] = desc;
end
-- add the skill id, name, and description into the table with label as index
self.skillIds[label] = id;
self.skillNames[label] = name;
self.skillDesc[label] = desc;

-- add the skill id to a list of Ids
self.skillIdList[id] = true;
end

-- function to add a skills name, and data pair of ID and label, to the dictionary at a specific index
-- function to add a skills data to the dictionary at a specific index
function IndexedDictionary:InsertSkill(index, name, id, label, desc)
if label == nil then
if self.skillLabels[name] ~= nil then
Turbine.Shell.WriteLine("Invalid label: " .. name);
return
end
label = name;
end

-- increase the number of datasets
self.numberOfItems = self.numberOfItems + 1;

if desc == nil then
-- add the skill name to the list of skills at the specified index
table.insert(self.skillNames, index, name);
-- insert the unique label into the list of skills at the specified index
table.insert(self.skillLabels, index, label);

-- add the skill id and label into the table with name as index
self.skillIds[name] = id;
self.skillLabels[name] = label;
else
-- insert the unique label into the list of skills at the specified index
table.insert(self.skillNames, index, label);
-- add the skill id, name, and description into the table with label as index
self.skillIds[label] = id;
self.skillNames[label] = name;
self.skillDesc[label] = desc;

-- add the skill id, name, and description into the table with label as index
self.skillIds[label] = id;
self.skillLabels[label] = name;
self.skillDesc[label] = desc;
end
-- add the skill id to a list of Ids
self.skillIdList[id] = true;
end

-- function to remove a skills name, ID and label from the dictionary at a specific index
-- function to remove a skills data from the dictionary at a specific index
function IndexedDictionary:RemoveSkillAtIndex(index)

local location = 0;
local counter = 0;
local label = self.skillLabels[index];
local id = self.skillIds[label];

-- loop through the main table
for k, v in pairs(self.skillIds) do
counter = counter + 1;

-- if the keys match, set the location to remove from the table
if (k == self.skillNames[index]) then
location = counter;
end
end

-- remove the name, ID and label from the tables
table.remove(self.skillIds, location);
table.remove(self.skillLabels, location);
table.remove(self.skillNames, index);
table.remove(self.skillDesc, location);
-- remove the data from the tables
table.remove(self.skillLabels, index);
self.skillIds[label] = nil;
self.skillNames[label] = nil;
self.skillDesc[label] = nil;
self.skillIdList[id] = nil;

-- decrease the counters
self.numberOfItems = self.numberOfItems - 1;
end

-- function to get the skill name at a specified index
function IndexedDictionary:NameAtIndex(index)
local string = self.skillNames[index];
if self.skillDesc[string] ~= nil then
string = self.skillLabels[string];
end
return string;
local label = self.skillLabels[index];
local name = self.skillNames[label];
return name;
end

-- function to return the ID at a specified index
function IndexedDictionary:IdAtIndex(index)
local string = self.skillNames[index];
local data = self.skillIds[string];

return data;
local label = self.skillLabels[index];
local id = self.skillIds[label];
return id;
end

-- function to return the label at a specified index
function IndexedDictionary:LabelAtIndex(index)
local string = self.skillNames[index];
local data = string;
if self.skillDesc[string] == nil then
data = self.skillLabels[string];
end

return data;
local label = self.skillLabels[index];
return label;
end

function IndexedDictionary:DescAtIndex(index)
local string = self.skillNames[index];
local data = self.skillDesc[string];

return data;
local label = self.skillLabels[index];
local desc = self.skillDesc[label];
return desc;
end

-- function to return the skill name and ID at a specified index
function IndexedDictionary:PairAtIndex(index)
local string = self.skillNames[index];
local data = self.skillIds[string];
if self.skillDesc[string] ~= nil then
string = self.skillLabels[string];
end

return string, data;
local label = self.skillLabels[index];
local id = self.skillIds[label];
local name = self.skillNames[label];
return name, id;
end

-- function to get the ID by a name value
function IndexedDictionary:IdByName(name)
return self.skillIds[name];
for k, v in pairs(self.skillNames) do
if v == name then
return self.skillIds[k];
end
end
return nil;
end

-- function to check if ID exists
Expand All @@ -154,17 +139,13 @@ end

-- function to find the index value based on a key
function IndexedDictionary:IndexByName(name)

-- return if the list of keys is empty
if (self.skillNames == {}) then
return -1;
end

-- loop through the list of names and search for the given value
for i = 1, #self.skillNames, 1 do
-- return the index value if a match is made
if (self.skillNames[i] == name) then
return i;
for k, v in pairs(self.skillNames) do
if v == name then
for i = 1, #self.skillLabels, 1 do
if self.skillLabels[i] == k then
return i;
end
end
end
end

Expand Down
Loading

0 comments on commit 6d220f1

Please sign in to comment.