diff --git a/CHANGELOG.md b/CHANGELOG.md index ebbb378..9174e7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/TravelWindowII.plugin b/TravelWindowII.plugin index 91e45f6..4553ff5 100644 --- a/TravelWindowII.plugin +++ b/TravelWindowII.plugin @@ -3,7 +3,7 @@ Travel Window II Hyoss - v1.2.0 + v1.3.0 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. diff --git a/TravelWindowII.plugincompendium b/TravelWindowII.plugincompendium index 55c9805..2e16a8e 100644 --- a/TravelWindowII.plugincompendium +++ b/TravelWindowII.plugincompendium @@ -2,7 +2,7 @@ 1113 Travel Window II - v1.2.0 + v1.3.0 Hyoss http://www.lotrointerface.com/downloads/info1113 http://www.lotrointerface.com/downloads/download1113 diff --git a/doc/lotroforums.md b/doc/lotroforums.md index 78bdc06..03a6142 100644 --- a/doc/lotroforums.md +++ b/doc/lotroforums.md @@ -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]. \ No newline at end of file diff --git a/doc/lotrointerface.md b/doc/lotrointerface.md index 7ec95c6..0aa37a1 100644 --- a/doc/lotrointerface.md +++ b/doc/lotrointerface.md @@ -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]. \ No newline at end of file diff --git a/src/IndexedDictionary.lua b/src/IndexedDictionary.lua index f8bcbdb..d3e1720 100644 --- a/src/IndexedDictionary.lua +++ b/src/IndexedDictionary.lua @@ -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() @@ -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 @@ -17,76 +17,68 @@ 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; @@ -94,53 +86,46 @@ 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 @@ -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 diff --git a/src/IndexedDictionaryDe.lua b/src/IndexedDictionaryDe.lua index 46f5dbd..c62ba11 100644 --- a/src/IndexedDictionaryDe.lua +++ b/src/IndexedDictionaryDe.lua @@ -138,7 +138,8 @@ function TravelDictionaries:CreateDictionaries() hunterLocations:AddSkill("Führer nach Forlach", "0x70036B5D", "Forlach (Führer)"); hunterLocations:AddSkill("Führer nach Aldburg", "0x7003DC71", "Aldburg (Führer)"); hunterLocations:AddSkill("Führer nach Helms Klamm", "0x7003DC72", "Helms Klamm (Führer)"); - hunterLocations:AddSkill("Führer nach Dol Amroth", "0x70041197", "Dol Amroth (Führer)"); + hunterLocations:AddSkill("Führer nach Dol Amroth", "0x70041197", "Dol Amroth (Führer)", + "nach Dol Amroth."); hunterLocations:AddSkill("Führer nach Arnach", "0x70043A63", "Arnach (Führer)"); hunterLocations:AddSkill("Führer nach Minas Tirith", "0x70044985", "Minas Tirith (Führer)"); hunterLocations:AddSkill("Führer zum Kriegslager der Rohirrim", "0x700459AF", "Kriegslager der Rohirrim (Führer)"); @@ -170,12 +171,13 @@ function TravelDictionaries:CreateDictionaries() hunterLocations:AddSkill("Führer nach Carn Dûm", "0x70064AC8", "Carn Dûm (Führer)"); hunterLocations:AddSkill("Führer nach Clegur", "0x70064F4C", "Clegur (Führer)"); hunterLocations:AddSkill("Führer nach Pelargir", "0x700658EA", "Pelargir (Führer)"); - hunterLocations:AddSkill("Führer nach Dol Amroth", "0x70068711", "Dol Amroth (Führer U38)"); + hunterLocations:AddSkill("Führer nach Dol Amroth", "0x70068711", "Königreich Dol Amroth (Führer U38)", + "Königreich Gondor"); hunterLocations:AddSkill("Führer nach Halrax", "0x70068713", "Halrax (Führer)"); hunterLocations:AddSkill("Führer nach Lond Cirion", "0x70068717", "Lond Cirion (Führer)"); hunterLocations:AddSkill("Führer nach Umbar", "0x70068718", "Umbar (Führer)"); hunterLocations:AddSkill("Führer nach Jax Phanâl", "0x70068719", "Jax Phanâl (Führer)"); - hunterLocations:AddSkill("Führer zur Taverne 'Zum Blutigen Adler'", "0x700697EF", "Zum Blutigen Adler (Führer)"); + hunterLocations:AddSkill("Führer zur Taverne \"Zum Blutigen Adler\"", "0x700697EF", "Zum Blutigen Adler (Führer)"); -- add the Warden locations wardenLocations:AddSkill("Appell in der Feste Guruth", "0x70014786", "Feste Guruth (Appell)"); @@ -194,7 +196,8 @@ function TravelDictionaries:CreateDictionaries() wardenLocations:AddSkill("Appell in Forlach", "0x70036B5B", "Forlach (Appell)"); wardenLocations:AddSkill("Appell in Aldburg", "0x7003DC7A", "Aldburg (Appell)"); wardenLocations:AddSkill("Appell in Helms Klamm", "0x7003DC79", "Helms Klamm (Appell)"); - wardenLocations:AddSkill("Appell in Dol Amroth", "0x70041198", "Dol Amroth (Appell)"); + wardenLocations:AddSkill("Appell in Dol Amroth", "0x70041198", "Dol Amroth (Appell)", + "West-Gondor zu reisen"); wardenLocations:AddSkill("Appell in Arnach", "0x70043A66", "Arnach (Appell)"); wardenLocations:AddSkill("Appell in Minas Tirith", "0x70044982", "Minas Tirith (Appell)"); wardenLocations:AddSkill("Appell im Kriegslager", "0x700459AA", "Kriegslager der Rohirrim (Appell)"); @@ -204,7 +207,7 @@ function TravelDictionaries:CreateDictionaries() wardenLocations:AddSkill("Appell im Lager des Heeres", "0x70047BFC", "Lager des Heeres (Appell)"); wardenLocations:AddSkill("Appell in Haerondir", "0x70047C23", "Haerondir (Appell)"); wardenLocations:AddSkill("Appell am Udûn-Brückenkopf", "0x7004AE1F", "Udûn-Brückenkopf (Appell)"); - wardenLocations:AddSkill("Appell in Thal", "0x7004d73a", "Thal (Appell)"); + wardenLocations:AddSkill("Appell in Thal", "0x7004A73A", "Thal (Appell)"); wardenLocations:AddSkill("Appell in Járnfast", "0x7004FACA", "Jarnfast (Appell)"); wardenLocations:AddSkill("Appell in Skarháld", "0x7004FACD", "Skarhald (Appell)"); wardenLocations:AddSkill("Appell im Beorningerhús", "0x70052F0A", "Beorningerhús (Appell)"); @@ -229,9 +232,10 @@ function TravelDictionaries:CreateDictionaries() wardenLocations:AddSkill("Appell in Jax Phanâl","0x7006870C", "Jax Phanâl (Appell)"); wardenLocations:AddSkill("Appell in Umbar","0x7006870F","Umbar (Appell)"); wardenLocations:AddSkill("Appell in Halrax","0x70068710", "Halrax (Appell)"); - wardenLocations:AddSkill("Appell in Dol Amroth","0x70068712", "Dol Amroth (Appell)"); + wardenLocations:AddSkill("Appell in Dol Amroth","0x70068712", "Königreich Dol Amroth (Appell)", + "Königreich Gondor"); wardenLocations:AddSkill("Appell in Lond Cirion","0x70068715", "Lond Cirion (Appell)"); - wardenLocations:AddSkill("Appell in der Taverne 'Zum Blutigen Adler'","0x700697F3", "Zum Blutigen Adler (Appell)"); + wardenLocations:AddSkill("Appell in der Taverne \"Zum Blutigen Adler\"","0x700697F3", "Zum Blutigen Adler (Appell)"); -- add the Mariner locations marinerLocations:AddSkill("Segelt nach Celondim", "0x70066100", "Celondim (Segeln)") @@ -241,7 +245,8 @@ function TravelDictionaries:CreateDictionaries() marinerLocations:AddSkill("Segelt nach Seestadt.", "0x7006610C", "Seestadt (Segeln)") marinerLocations:AddSkill("Segelt zur Dunkelsenke", "0x7006610E", "Dunkelsenke (Segeln)") marinerLocations:AddSkill("Segelt nach Tinnudir", "0x7006610F", "Tinnundir (Segeln)") - marinerLocations:AddSkill("Segelt nach Dol Amroth", "0x70066117", "Dol Amroth (Segeln)") + marinerLocations:AddSkill("Segelt nach Dol Amroth", "0x70066117", "Dol Amroth (Segeln)", + "nach Dol Amroth.") marinerLocations:AddSkill("Segelt nach Bockland", "0x7006611A", "Bockland (Segeln)") marinerLocations:AddSkill("Segelt nach Pelargir", "0x7006611B", "Pelargir (Segeln)") marinerLocations:AddSkill("Segelt nach Sûri-kylä", "0x7006611C", "Sûri-kylä (Segeln)") @@ -251,13 +256,17 @@ function TravelDictionaries:CreateDictionaries() marinerLocations:AddSkill("Nach Umbar segeln", "0x700687BB", "Umbar (Segeln)") marinerLocations:AddSkill("Nach Lond Cirion segeln", "0x700687BD", "Lond Cirion (Segeln)") marinerLocations:AddSkill("Nach Jax Phanâl segeln", "0x700687C0", "Jax Phanâl (Segeln)") - marinerLocations:AddSkill("Segelt nach Dol Amroth", "0x700687C1", "Dol Amroth (Segeln)") + marinerLocations:AddSkill("Segelt nach Dol Amroth", "0x700687C1", "Königreich Dol Amroth (Segeln)", + "Königreich Gondor") marinerLocations:AddSkill("Nach Halrax segeln", "0x700687C3", "Halrax (Segeln)") - racialLocations:AddSkill("Rückkehr nach Bree", "0x700062F6", "Bree (Rasse)"); + racialLocations:AddSkill("Rückkehr nach Bree", "0x700062F6", "Bree (Rasse)", + "Ihr könnt schnell nach Bree"); racialLocations:AddSkill("Rückkehr ins Auenland", "0x700062C8", "Michelbinge (Rasse)"); - racialLocations:AddSkill("Rückkehr zu Thorins Tor", "0x70006346", "Thorins Tor (Rasse Zwerg)"); - racialLocations:AddSkill("Rückkehr nach Bruchtal", "0x7000631F", "Bruchtal (Rasse)"); + racialLocations:AddSkill("Rückkehr zu Thorins Tor", "0x70006346", "Thorins Tor (Rasse Zwerg)", + "Hiermit gelangt Ihr schnell"); + racialLocations:AddSkill("Rückkehr nach Bruchtal", "0x7000631F", "Bruchtal (Rasse)", + "Hiermit gelangt Ihr schnell"); racialLocations:AddSkill("Zum 1. Heim zurückkehren", "0x70041A22", "Grimbeorns Hütte (Rasse)"); racialLocations:AddSkill("Reise nach Caras Galadhon in Lothlórien", "0x70048C8C", "Caras Galadhon (Rasse)"); racialLocations:AddSkill("Reise zu Thorins Halle", "0x70053C0F", "Thorins Halle (Rasse Starkaxt)"); @@ -279,11 +288,14 @@ function TravelDictionaries:CreateDictionaries() genLocations:AddSkill("Reist zum Haus Eurer Sippe", "0x7000D047", "Heim Eurer Sippe"); genLocations:AddSkill("Zum Haus des Sippenmitglieds reisen", "0x70057C36", "Heim des Sippenmitglieds"); - repLocations:AddSkill("Rückkehr zu Thorins Tor", "0x7001BF91", "Thorins Tor (Ruf)"); - repLocations:AddSkill("Rückkehr nach Bree", "0x7001BF90", "Bree (Ruf)"); + repLocations:AddSkill("Rückkehr zu Thorins Tor", "0x7001BF91", "Thorins Tor (Ruf)", + "Dank Eurer Freundschaft"); + repLocations:AddSkill("Rückkehr nach Bree", "0x7001BF90", "Bree (Ruf)", + "Dank Eurer Freundschaft"); repLocations:AddSkill("Kehrt zu Lalias Markt zurück", "0x700364B1", "Lalias Markt (Mithril)"); repLocations:AddSkill("Rückkehr nach Michelbinge", "0x70023262", "Michelbinge (Shop)"); - repLocations:AddSkill("Rückkehr nach Bruchtal", "0x70023263", "Bruchtal (Shop)"); + repLocations:AddSkill("Rückkehr nach Bruchtal", "0x70023263", "Bruchtal (Shop)", + "Dank Eurer Freundschaft"); repLocations:AddSkill("Rückkehr zur Feste Guruth", "0x70020441", "Feste Guruth (Ruf)"); repLocations:AddSkill("Rückkehr zum Düsterwald", "0x7001F374", "Düsterwald (Ruf)"); repLocations:AddSkill("Rückkehr nach Enedwaith", "0x70021FA2", "Enedwaith (Ruf)"); @@ -294,7 +306,8 @@ function TravelDictionaries:CreateDictionaries() repLocations:AddSkill("Kehrt nach Aldburg zurück", "0x7003DC81", "Aldburg (Ruf)"); repLocations:AddSkill("Rückkehr ins Geheimnistal", "0x7004128F", "Geheimnistal (Ruf)"); repLocations:AddSkill("Kehrt nach Helms Klamm zurück", "0x7003DC82", "Helms Klamm (Ruf)"); - repLocations:AddSkill("Rückkehr nach Dol Amroth", "0x700411AC", "Dol Amroth (Ruf)"); + repLocations:AddSkill("Rückkehr nach Dol Amroth", "0x700411AC", "Dol Amroth (Ruf)", + "West-Gondor zurückkehren"); repLocations:AddSkill("Rückkehr nach Arnach", "0x70043A6A", "Arnach (Ruf)"); repLocations:AddSkill("Kehrt nach Minas Tirith zurück.", "0x7004497E", "Minas Tirith (Ruf)"); repLocations:AddSkill("Zurück zum Kriegslager der Rohirrim", "0x700459A9", "Kriegslager der Rohirrim (Ruf)"); @@ -335,12 +348,13 @@ function TravelDictionaries:CreateDictionaries() repLocations:AddSkill("Rückkehr nach Pelargir", "0x700658EB", "Pelargir (Ruf)"); repLocations:AddSkill("Zum Orden des Adlers reisen", "0x700686FE", "Orden des Adlers (Ruf)"); repLocations:AddSkill("Nach Umbar zurückkehren", "0x700686FF", "Umbar (Ruf)"); - repLocations:AddSkill("Rückkehr nach Dol Amroth", "0x70068700", "Dol Amroth (Ruf U38)"); + repLocations:AddSkill("Rückkehr nach Dol Amroth", "0x70068700", "Königreich Dol Amroth (Ruf U38)", + "Königreich Gondor"); repLocations:AddSkill("Nach Jax Phanâl zurückkehren", "0x70068701", "Jax Phanâl (Ruf)"); repLocations:AddSkill("Kehrt zu Halrax zurück.", "0x70068702", "Halrax (Ruf)"); repLocations:AddSkill("Nach Lond Cirion zurückkehren", "0x70068703", "Lond Cirion (Ruf)"); repLocations:AddSkill("Zu den Buchhütern reisen", "0x70068704", "Ledger-Keepers (Ruf)"); - repLocations:AddSkill("Rückkehr zur Taverne 'Zum Blutigen Adler'", "0x700697F2", "Zum Blutigen Adler (Ruf)"); + repLocations:AddSkill("Rückkehr zur Taverne \"Zum Blutigen Adler\"", "0x700697F2", "Zum Blutigen Adler (Ruf)"); -- monster player maps creepLocations:AddSkill("Kartenskizze zum Gramfuss", "0x70028BBC"); diff --git a/src/IndexedDictionaryEn.lua b/src/IndexedDictionaryEn.lua index 3207b67..695f408 100644 --- a/src/IndexedDictionaryEn.lua +++ b/src/IndexedDictionaryEn.lua @@ -138,7 +138,8 @@ function TravelDictionaries:CreateDictionaries() hunterLocations:AddSkill("Guide to Forlaw", "0x70036B5D", "Forlaw (Guide)"); hunterLocations:AddSkill("Guide to Aldburg", "0x7003DC71", "Aldburg (Guide)"); hunterLocations:AddSkill("Guide to Helm's Deep", "0x7003DC72", "Helm's Deep (Guide)"); - hunterLocations:AddSkill("Guide to Dol Amroth", "0x70041197", "Dol Amroth (Guide)"); -- TODO: add desc + hunterLocations:AddSkill("Guide to Dol Amroth", "0x70041197", "Dol Amroth (Guide)", + "Dol Amroth in western Gondor"); hunterLocations:AddSkill("Guide to Arnach", "0x70043A63", "Arnach (Guide)"); hunterLocations:AddSkill("Guide to Minas Tirith", "0x70044985", "Minas Tirith (Guide)"); hunterLocations:AddSkill("Guide to the War-stead", "0x700459AF", "War-stead (Guide)"); @@ -170,7 +171,8 @@ function TravelDictionaries:CreateDictionaries() hunterLocations:AddSkill("Guide to Carn Dûm", "0x70064AC8", "Carn Dûm (Guide)"); hunterLocations:AddSkill("Guide to Clegur", "0x70064F4C", "Clegur (Guide)"); hunterLocations:AddSkill("Guide to Pelargir", "0x700658EA", "Pelargir (Guide)"); - hunterLocations:AddSkill("Guide to Dol Amroth", "0x70068711", "King's Dol Amroth (Guide U38)"); -- TODO: add desc + hunterLocations:AddSkill("Guide to Dol Amroth", "0x70068711", "King's Dol Amroth (Guide U38)", + "King's Gondor"); hunterLocations:AddSkill("Guide to Halrax", "0x70068713", "Halrax (Guide)"); hunterLocations:AddSkill("Guide to Lond Cirion", "0x70068717", "Lond Cirion (Guide)"); hunterLocations:AddSkill("Guide to Umbar", "0x70068718", "Umbar (Guide)"); @@ -194,7 +196,8 @@ function TravelDictionaries:CreateDictionaries() wardenLocations:AddSkill("Muster in Forlaw", "0x70036B5B", "Forlaw (Muster)"); wardenLocations:AddSkill("Muster in Aldburg", "0x7003DC7A", "Aldburg (Muster)"); wardenLocations:AddSkill("Muster in Helm's Deep", "0x7003DC79", "Helm's Deep (Muster)"); - wardenLocations:AddSkill("Muster in Dol Amroth", "0x70041198", "Dol Amroth (Muster)"); -- TODO: add desc + wardenLocations:AddSkill("Muster in Dol Amroth", "0x70041198", "Dol Amroth (Muster)", + "Dol Amroth in western Gondor"); wardenLocations:AddSkill("Muster in Arnach", "0x70043A66", "Arnach (Muster)"); wardenLocations:AddSkill("Muster in Minas Tirith", "0x70044982", "Minas Tirith (Muster)"); wardenLocations:AddSkill("Muster in the War-stead", "0x700459AA", "War-stead (Muster)"); @@ -229,7 +232,8 @@ function TravelDictionaries:CreateDictionaries() wardenLocations:AddSkill("Muster at Jax Phanâl","0x7006870C", "Jax Phanâl (Muster)"); wardenLocations:AddSkill("Muster at Umbar","0x7006870F","Umbar (Muster)"); wardenLocations:AddSkill("Muster at Halrax","0x70068710", "Halrax (Muster)"); - wardenLocations:AddSkill("Muster at Dol Amroth","0x70068712", "King's Dol Amroth (Muster)"); -- TODO: add desc + wardenLocations:AddSkill("Muster at Dol Amroth","0x70068712", "King's Dol Amroth (Muster)", + "King's Gondor"); wardenLocations:AddSkill("Muster at Lond Cirion","0x70068715", "Lond Cirion (Muster)"); wardenLocations:AddSkill("Muster at the Bloody Eagle Tavern","0x700697F3", "Bloody Eagle Tavern (Muster)"); @@ -241,7 +245,8 @@ function TravelDictionaries:CreateDictionaries() marinerLocations:AddSkill("Sail to Lake-town", "0x7006610C", "Lake-town (Sail)") marinerLocations:AddSkill("Sail to the Mirk-eaves", "0x7006610E", "Mirk-eaves (Sail)") marinerLocations:AddSkill("Sail to Tinnudir", "0x7006610F", "Tinnudir (Sail)") - marinerLocations:AddSkill("Sail to Dol Amroth", "0x70066117", "Dol Amroth (Sail)") -- TODO: add desc arg + marinerLocations:AddSkill("Sail to Dol Amroth", "0x70066117", "Dol Amroth (Sail)", + "Dol Amroth with nearby") marinerLocations:AddSkill("Sail to Buckland", "0x7006611A", "Buckland (Sail)") marinerLocations:AddSkill("Sail to Pelargir", "0x7006611B", "Pelargir (Sail)") marinerLocations:AddSkill("Sail to Sûri-kylä", "0x7006611C", "Sûri-kylä (Sail)") @@ -251,7 +256,8 @@ function TravelDictionaries:CreateDictionaries() marinerLocations:AddSkill("Sail to Umbar", "0x700687BB", "Umbar (Sail)") marinerLocations:AddSkill("Sail to Lond Cirion", "0x700687BD", "Lond Cirion (Sail)") marinerLocations:AddSkill("Sail to Jax Phanâl", "0x700687C0", "Jax Phanâl (Sail)") - marinerLocations:AddSkill("Sail to Dol Amroth", "0x700687C1", "King's Dol Amroth (Sail)") -- TODO: add desc arg + marinerLocations:AddSkill("Sail to Dol Amroth", "0x700687C1", "King's Dol Amroth (Sail)", + "King's Gondor") marinerLocations:AddSkill("Sail to Halrax", "0x700687C3", "Halrax (Sail)") -- add the racial travel skills @@ -304,7 +310,7 @@ function TravelDictionaries:CreateDictionaries() repLocations:AddSkill("Return to Derndingle", "0x7004128F", "Derndingle (Rep)"); repLocations:AddSkill("Return to Helm's Deep", "0x7003DC82", "Helm's Deep (Rep)"); repLocations:AddSkill("Return to Dol Amroth", "0x700411AC", "Dol Amroth (Rep)", - "quickly return to Dol Amroth in western Gondor"); + "Dol Amroth in western Gondor"); repLocations:AddSkill("Return to Arnach", "0x70043A6A", "Arnach (Rep)"); repLocations:AddSkill("Return to Minas Tirith", "0x7004497E", "Minas Tirith (Rep)"); repLocations:AddSkill("Return to the War-stead", "0x700459A9", "War-stead (Rep)"); @@ -345,7 +351,8 @@ function TravelDictionaries:CreateDictionaries() repLocations:AddSkill("Return to Pelargir", "0x700658EB", "Pelargir (Rep)"); repLocations:AddSkill("Journey to the Order of the Eagle", "0x700686FE", "Order of the Eagle (Rep)"); repLocations:AddSkill("Return to Umbar", "0x700686FF", "Umbar (Rep)"); - repLocations:AddSkill("Return to Dol Amroth", "0x70068700", "King's Dol Amroth (Rep U38)", "King's Gondor"); + repLocations:AddSkill("Return to Dol Amroth", "0x70068700", "King's Dol Amroth (Rep U38)", + "King's Gondor"); repLocations:AddSkill("Return to Jax Phanâl", "0x70068701", "Jax Phanâl (Rep)"); repLocations:AddSkill("Return to Halrax", "0x70068702", "Halrax (Rep)"); repLocations:AddSkill("Return to Lond Cirion", "0x70068703", "Lond Cirion (Rep)"); diff --git a/src/IndexedDictionaryFr.lua b/src/IndexedDictionaryFr.lua index bf455ed..2c6c41c 100644 --- a/src/IndexedDictionaryFr.lua +++ b/src/IndexedDictionaryFr.lua @@ -137,7 +137,8 @@ function TravelDictionaries:CreateDictionaries() hunterLocations:AddSkill("Guide vers Forloi", "0x70036B5D", "Forloi (Guide)"); hunterLocations:AddSkill("Guide vers Aldburg", "0x7003DC71", "Aldburg (Guide)"); hunterLocations:AddSkill("Guide vers le Gouffre de Helm", "0x7003DC72", "Gouffre de Helm (Guide)"); - hunterLocations:AddSkill("Guide vers Dol Amroth", "0x70041197", "Dol Amroth (Guide)"); + hunterLocations:AddSkill("Guide vers Dol Amroth", "0x70041197", "Dol Amroth (Guide)", + "l'Ouest du Gondor"); hunterLocations:AddSkill("Guide pour Arnach", "0x70043A63", "Arnach (Guide)"); hunterLocations:AddSkill("Guide vers Minas Tirith", "0x70044985", "Minas Tirith (Guide)"); hunterLocations:AddSkill("Guide pour se rendre au camp militaire", "0x700459AF", "Camp militaire (Guide)"); @@ -169,7 +170,8 @@ function TravelDictionaries:CreateDictionaries() hunterLocations:AddSkill("Guide vers Carn Dûm", "0x70064AC8", "Carn Dûm (Guide)"); hunterLocations:AddSkill("Guide vers Clegur", "0x70064F4C", "Clegur (Guide)"); hunterLocations:AddSkill("Guide vers Pelargir", "0x700658EA", "Pelargir (Guide)"); - hunterLocations:AddSkill("Guide vers Dol Amroth", "0x70068711", "Dol Amroth (Guide U38)"); + hunterLocations:AddSkill("Guide vers Dol Amroth", "0x70068711", "Dol Amroth royal (Guide U38)", + "le Gondor royal"); hunterLocations:AddSkill("Guide vers Halrax", "0x70068713", "Halrax (Guide)"); hunterLocations:AddSkill("Guide vers Lond Cirion", "0x70068717", "Lond Cirion (Guide)"); hunterLocations:AddSkill("Guide vers Umbar", "0x70068718", "Umbar (Guide)"); @@ -192,7 +194,8 @@ function TravelDictionaries:CreateDictionaries() wardenLocations:AddSkill("Rassemblement : Forloi", "0x70036B5B", "Forloi (Rassemblement)"); wardenLocations:AddSkill("Rassemblement : Aldburg", "0x7003DC7A", "Aldburg (Rassemblement)"); wardenLocations:AddSkill("Rassemblement : Gouffre de Helm", "0x7003DC79", "Gouffre de Helm (Rassemblement)"); - wardenLocations:AddSkill("Rassemblement : Dol Amroth", "0x70041198", "Dol Amroth (Rassemblement)"); + wardenLocations:AddSkill("Rassemblement : Dol Amroth", "0x70041198", "Dol Amroth (Rassemblement)", + "l'Ouest du Gondor"); wardenLocations:AddSkill("Rassemblement : Arnach", "0x70043A66", "Arnach (Rassemblement)"); wardenLocations:AddSkill("Rassemblement : Minas Tirith", "0x70044982", "Minas Tirith (Rassemblement)"); wardenLocations:AddSkill("Rassemblement : Camp militaire", "0x700459AA", "Camp militaire (Rassemblement)"); @@ -227,7 +230,8 @@ function TravelDictionaries:CreateDictionaries() wardenLocations:AddSkill("Rassemblement à Jax Phanâl","0x7006870C", "Jax Phanâl (Rassemblement)"); wardenLocations:AddSkill("Rassemblement à Umbar","0x7006870F","Umbar (Rassemblement)"); wardenLocations:AddSkill("Rassemblement à Halrax","0x70068710", "Halrax (Rassemblement)"); - wardenLocations:AddSkill("Rassemblement à Dol Amroth","0x70068712", "Dol Amroth (Rassemblement)"); + wardenLocations:AddSkill("Rassemblement à Dol Amroth","0x70068712", "Dol Amroth royal (Rassemblement)", + "le Gondor royal"); wardenLocations:AddSkill("Rassemblement à Lond Cirion","0x70068715", "Lond Cirion (Rassemblement)"); wardenLocations:AddSkill("Rassemblement à la taverne de l'Aigle sanglant","0x700697F3", "Taverne de l'Aigle sanglant (Rassemblement)"); @@ -238,27 +242,8 @@ function TravelDictionaries:CreateDictionaries() marinerLocations:AddSkill("Cap sur la Ville du Lac", "0x7006610C", "Ville du Lac (Naviguer)") marinerLocations:AddSkill("Naviguer vers l'Orée Noire", "0x7006610E", "Orée Noire (Naviguer)") marinerLocations:AddSkill("Naviguer vers Tinnudir", "0x7006610F", "Tinnudir (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Dol Amroth", "0x70066117", "Dol Amroth (Naviguer)") - marinerLocations:AddSkill("Naviguer vers le Pays de Bouc", "0x7006611A", "Pays de Bouc (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Pelargir", "0x7006611B", "Pelargir (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Sûri-kylä", "0x7006611C", "Sûri-kylä (Naviguer)") - marinerLocations:AddSkill("Naviguer vers la Lothlorien", "0x7006611E", "Lothlorien (Naviguer)") - marinerLocations:AddSkill("Naviguer vers le Gué de Sarn", "0x70066120", "le Gué de Sarn (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Neigebronne", "0x70066121", "Neigebronne (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Umbar", "0x700687BB", "Umbar (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Lond Cirion", "0x70066121", "Lond Cirion (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Jax Phanâl", "0x70066121", "Jax Phanâl (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Dol Amroth", "0x70066121", "Dol Amroth (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Halrax", "0x70066121", "Halrax (Naviguer)") - - marinerLocations:AddSkill("Naviguer vers Celondim", "0x70066100", "Celondim (Naviguer)") - marinerLocations:AddSkill("Naviguer vers les Terres brunes", "0x70066101", "Terres brunes (Naviguer)") - marinerLocations:AddSkill("Naviguer vers le Quai des marchands", "0x70066105", "Quai des marchands (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Osgiliath après la bataille", "0x70066109", "Osgiliath après la bataille (Naviguer)") - marinerLocations:AddSkill("Cap sur la Ville du Lac", "0x7006610C", "Ville du Lac (Naviguer)") - marinerLocations:AddSkill("Naviguer vers l'Orée Noire", "0x7006610E", "Orée Noire (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Tinnudir", "0x7006610F", "Tinnudir (Naviguer)") - marinerLocations:AddSkill("Naviguer vers Dol Amroth", "0x70066117", "Dol Amroth (Naviguer)") + marinerLocations:AddSkill("Naviguer vers Dol Amroth", "0x70066117", "Dol Amroth (Naviguer)", + "Dol Amroth en bonne compagnie.") marinerLocations:AddSkill("Naviguer vers le Pays de Bouc", "0x7006611A", "Pays de Bouc (Naviguer)") marinerLocations:AddSkill("Naviguer vers Pelargir", "0x7006611B", "Pelargir (Naviguer)") marinerLocations:AddSkill("Naviguer vers Sûri-kylä", "0x7006611C", "Sûri-kylä (Naviguer)") @@ -268,13 +253,17 @@ function TravelDictionaries:CreateDictionaries() marinerLocations:AddSkill("Naviguer vers Umbar", "0x700687BB", "Umbar (Naviguer)"); marinerLocations:AddSkill("Naviguer vers Lond Cirion", "0x700687BD", "Lond Cirion (Naviguer)"); marinerLocations:AddSkill("Naviguer vers Jax Phanâl", "0x700687C0", "Jax Phanâl (Naviguer)"); - marinerLocations:AddSkill("Naviguer vers Dol Amroth", "0x700687C1", "Dol Amroth (Naviguer)"); + marinerLocations:AddSkill("Naviguer vers Dol Amroth", "0x700687C1", "Dol Amroth royal (Naviguer)", + "le Gondor royal"); marinerLocations:AddSkill("Naviguer vers Halrax", "0x700687C3", "Halrax (Naviguer)"); - racialLocations:AddSkill("Retour à Bree", "0x700062F6", "Bree (Race)"); + racialLocations:AddSkill("Retour à Bree", "0x700062F6", "Bree (Race)", + "Permet de retourner"); racialLocations:AddSkill("Retournez dans la Comté", "0x700062C8", "Comté (Race)"); - racialLocations:AddSkill("Retour : Porte de Thorin", "0x70006346", "Porte de Thorin (Race)"); - racialLocations:AddSkill("Retour à Fondcombe", "0x7000631F", "Fondcombe (Race)"); + racialLocations:AddSkill("Retour : Porte de Thorin", "0x70006346", "Porte de Thorin (Race)", + "Ceci vous permet de retourner"); + racialLocations:AddSkill("Retour à Fondcombe", "0x7000631F", "Fondcombe (Race)", + "Ceci vous permet de retourner"); racialLocations:AddSkill("Retour à la maison", "0x70041A22", "Maison Beorning (Race)"); racialLocations:AddSkill("Voyage vers Caras Galadhon, en Lothlórien", "0x70048C8C", "Caras Galadhon (Race)"); racialLocations:AddSkill("Aller au Palais de Thorin", "0x70053C0F", "Palais de Thorin (Race)"); @@ -296,11 +285,14 @@ function TravelDictionaries:CreateDictionaries() genLocations:AddSkill("Retour à la maison de confrérie", "0x7000D047", "Maison de confrérie"); genLocations:AddSkill("Retour à la maison d'un membre de confrérie", "0x70057C36", "Maison d'un membre de confrérie"); - repLocations:AddSkill("Retour : Porte de Thorin", "0x7001BF91", "Porte de Thorin (Rep/Shop)"); - repLocations:AddSkill("Retour à Bree", "0x7001BF90", "Retour à Bree (Rep/Shop)"); + repLocations:AddSkill("Retour : Porte de Thorin", "0x7001BF91", "Porte de Thorin (Rep/Shop)", + "Grâce à l'amitié qui vous"); + repLocations:AddSkill("Retour à Bree", "0x7001BF90", "Retour à Bree (Rep/Shop)", + "Grâce à votre amitié"); repLocations:AddSkill("Retour au Marché de Lalia", "0x700364B1", "Retour au Marché de Lalia (Mithril)"); repLocations:AddSkill("Retour à Grand'Cave", "0x70023262", "Retour à Grand'Cave (Shop)"); - repLocations:AddSkill("Retour à Fondcombe", "0x70023263", "Retour à Fondcombe (Shop)"); + repLocations:AddSkill("Retour à Fondcombe", "0x70023263", "Retour à Fondcombe (Shop)", + "Grâce à votre amitié avec"); repLocations:AddSkill("Retournez à Ost Guruth", "0x70020441", "Retournez à Ost Guruth (Rep)"); repLocations:AddSkill("Retour dans la Forêt Noire", "0x7001F374", "Retour dans la Forêt Noire (Rep)"); repLocations:AddSkill("Retour en Enedwaith", "0x70021FA2", "Retour en Enedwaith (Rep)"); @@ -311,7 +303,8 @@ function TravelDictionaries:CreateDictionaries() repLocations:AddSkill("Retour à Aldburg", "0x7003DC81", "Aldburg (Rep)"); repLocations:AddSkill("Retour à Derunant", "0x7004128F", "Derunant (Rep)"); repLocations:AddSkill("Retour au Gouffre de Helm", "0x7003DC82", "Gouffre de Helm(Rep)"); - repLocations:AddSkill("Retour à Dol Amroth", "0x700411AC", "Dol Amroth (Rep)"); + repLocations:AddSkill("Retour à Dol Amroth", "0x700411AC", "Dol Amroth (Rep)", + "l'Ouest du Gondor"); repLocations:AddSkill("Retournez à Arnach", "0x70043A6A", "Arnach (Rep)"); repLocations:AddSkill("Retour à Minas Tirith", "0x7004497E", "Retour à Minas Tirith (Rep)"); repLocations:AddSkill("Retour au camp militaire", "0x700459A9", "Camp militaire (Rep)"); @@ -352,7 +345,8 @@ function TravelDictionaries:CreateDictionaries() repLocations:AddSkill("Retournez à Pelargir", "0x700658EB", "Pelargir (Rep)"); repLocations:AddSkill("Voyager vers l'Ordre de l'Aigle", "0x700686FE", "L'Ordre de l'Aigle (Rep)"); repLocations:AddSkill("Retour à Umbar", "0x700686FF", "Umbar (Rep)"); - repLocations:AddSkill("Retour à Dol Amroth", "0x70068700", "Dol Amroth (Rep U38)"); + repLocations:AddSkill("Retour à Dol Amroth", "0x70068700", "Dol Amroth royal (Rep U38)", + "le Gondor royal"); repLocations:AddSkill("Retour à Jax Phanâl", "0x70068701", "Jax Phanâl (Rep)"); repLocations:AddSkill("Retournez voir Halrax", "0x70068702", "Halrax (Rep)"); repLocations:AddSkill("Retour à Lond Cirion", "0x70068703", "Lond Cirion (Rep)"); diff --git a/src/Main.lua b/src/Main.lua index 5ca2102..eb6f1e7 100644 --- a/src/Main.lua +++ b/src/Main.lua @@ -14,6 +14,7 @@ TravelCommand = Turbine.ShellCommand(); -- handle the travel commands function TravelCommand:Execute(command, arguments) if (arguments == "show") then + _G.travel:CheckSkills(false); _G.travel:SetVisible(true); elseif (arguments == "hide") then _G.travel:SetVisible(false); @@ -21,6 +22,8 @@ function TravelCommand:Execute(command, arguments) _G.travel:SetVisible(not _G.travel:IsVisible()); elseif (arguments == "dump") then _G.travel:DoDump(); + elseif (arguments == "scan") then + _G.travel:ManualSkillScan(); elseif (arguments ~= nil) then TravelCommand:GetHelp(); end diff --git a/src/OptionsPanel.lua b/src/OptionsPanel.lua index 838b232..83a1c3d 100644 --- a/src/OptionsPanel.lua +++ b/src/OptionsPanel.lua @@ -41,7 +41,7 @@ function OptionsPanel:Constructor(parent) self.OptionTabs:SetPosition(10, 0); self.OptionTabs:SetParent(self); self.OptionTabs:SetBlendMode(Turbine.UI.BlendMode.Overlay); - self.OptionTabs:SetBackColor(Turbine.UI.Color(0.87, 0, 0, 0)); + self.OptionTabs:SetBackColor(Turbine.UI.Color(DefAlpha, 0, 0, 0)); self.OptionTabs:SetVisible(true); -- create the tabs @@ -298,7 +298,6 @@ function OptionsPanel:AddGeneralItems() else Settings.hideOnStart = 0; end - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); end @@ -309,7 +308,6 @@ function OptionsPanel:AddGeneralItems() else Settings.hideOnCombat = 0; end - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); end @@ -320,7 +318,6 @@ function OptionsPanel:AddGeneralItems() else Settings.hideOnTravel = 0; end - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); end @@ -331,7 +328,6 @@ function OptionsPanel:AddGeneralItems() else Settings.showButton = 0; end - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); self.mainWindow.ToggleButton:SetVisible(sender:IsChecked()); end @@ -343,7 +339,6 @@ function OptionsPanel:AddGeneralItems() else Settings.pulldownTravel = 0; end - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); end @@ -497,9 +492,10 @@ function OptionsPanel:AddSkillItemForEnabling(index, id, label) self.checks[index].CheckedChanged = function(sender, args) -- change the setting on the main window Settings.enabled[id] = sender:IsChecked(); + shortcutIndex = self.mainWindow:TableIndex(Settings.order, id); + TravelShortcuts[shortcutIndex]:SetEnabled(sender:IsChecked()); - -- reset the shortcuts on the main window - self.mainWindow:SetShortcuts(); + self.mainWindow.dirty = true; -- update the main window settings self.mainWindow:UpdateSettings(); @@ -565,7 +561,7 @@ function OptionsPanel:AddBoxes() -- do the check skills self.checkSkillsButton.Click = function(sender, args) - TravelWindow:CheckSkills(); + TravelWindow:CheckSkills(true); end end @@ -586,14 +582,14 @@ function OptionsPanel:AddSortList() local tempLabel = Turbine.UI.Label(); tempLabel:SetText(v:GetSkillLabel()); tempLabel:SetSize(280, 20); - tempLabel:SetBackColor(Turbine.UI.Color(0.87, 0.1, 0.1, 0.1)); + tempLabel:SetBackColor(Turbine.UI.Color(DefAlpha, 0.1, 0.1, 0.1)); tempLabel:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft); tempLabel:SetZOrder(90); -- highlight the item that is selected by changing the colour of the -- the label when it is clicked tempLabel.MouseClick = function(sender, args) - self.sortListBox:GetItem(self.sortSelectedIndex):SetBackColor(Turbine.UI.Color(0.87, 0.1, 0.1, 0.1)); + self.sortListBox:GetItem(self.sortSelectedIndex):SetBackColor(Turbine.UI.Color(DefAlpha, 0.1, 0.1, 0.1)); sender:SetBackColor(Turbine.UI.Color(0.95, 0.1, 0.1, 0.6)); self.sortSelectedIndex = self.sortListBox:IndexOfItem(sender); end @@ -607,7 +603,7 @@ function OptionsPanel:AddSortList() end -- set the first item as selected - self.sortListBox:GetItem(self.sortSelectedIndex):SetBackColor(Turbine.UI.Color(0.87, 0.1, 0.1, 0.6)); + self.sortListBox:GetItem(self.sortSelectedIndex):SetBackColor(Turbine.UI.Color(DefAlpha, 0.1, 0.1, 0.6)); -- set up the scrollbar for the list self.listBoxScrollBar = self.sortListBox:GetVerticalScrollBar(); @@ -616,7 +612,7 @@ function OptionsPanel:AddSortList() self.listBoxScrollBar = Turbine.UI.Lotro.ScrollBar(); end - self.listBoxScrollBar:SetBackColor(Turbine.UI.Color(0.87, 0.1, 0.1, 0.1)); + self.listBoxScrollBar:SetBackColor(Turbine.UI.Color(DefAlpha, 0.1, 0.1, 0.1)); self.listBoxScrollBar:SetOrientation(Turbine.UI.Orientation.Vertical); self.listBoxScrollBar:SetSize(10, self.height - 120); self.listBoxScrollBar:SetPosition(270, 0); @@ -671,7 +667,6 @@ function OptionsPanel:AddSortButtons() end -- update the main window shortcuts and settings - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); end @@ -686,7 +681,6 @@ function OptionsPanel:AddSortButtons() self:SwapShortcuts(self.sortSelectedIndex, self.sortSelectedIndex - 1); -- update the main window shortcuts and settings - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); -- decrease the selected index @@ -704,7 +698,6 @@ function OptionsPanel:AddSortButtons() self:SwapShortcuts(self.sortSelectedIndex, self.sortSelectedIndex + 1); -- update the main window shortcuts and settings - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); -- increase the selected index @@ -723,7 +716,6 @@ function OptionsPanel:AddSortButtons() end -- update the main window shortcuts and settings - self.mainWindow:SetShortcuts(); self.mainWindow:UpdateSettings(); end end @@ -745,5 +737,12 @@ function OptionsPanel:SwapShortcuts(first, second) local tempItem = self.sortListBox:GetItem(first); self.sortListBox:RemoveItemAt(first); self.sortListBox:InsertItem(second, tempItem); + + TravelShortcuts[first]:SetIndex(second); + TravelShortcuts[second]:SetIndex(first); + local tempShortcut = TravelShortcuts[first]; + TravelShortcuts[first] = TravelShortcuts[second]; + TravelShortcuts[second] = tempShortcut; + self.mainWindow.dirty = true; end end diff --git a/src/OrendarUIMods/ComboBox.lua b/src/OrendarUIMods/ComboBox.lua index f2f7531..d004ea1 100644 --- a/src/OrendarUIMods/ComboBox.lua +++ b/src/OrendarUIMods/ComboBox.lua @@ -21,6 +21,7 @@ function ComboBox:Constructor(toplevel) self:SetBackColor(ComboBox.DisabledColor); self.quickslots = {}; self.labels = {}; + self.hoverIndex = 0; self.topLevelWindow = toplevel; @@ -74,6 +75,17 @@ function ComboBox:Constructor(toplevel) self.listBox.MouseWheel = function(sender, args) self:DoScroll(sender, args); end + + self.FocusLost = function(sender, args) + if self.dropped then + if self.hoverIndex > 0 then + local msArgs = { Button = Turbine.UI.MouseButton.None }; + self.labels[self.hoverIndex]:MouseClick(sender, args) + else + self:CloseDropDown() + end + end + end end function ComboBox:SetTravelOnSelect(value) self.travelOnSelect = value; end @@ -173,6 +185,7 @@ function ComboBox:AddItem(shortcut, index, value) sender:SetFontStyle(Turbine.UI.FontStyle.Outline); sender:SetForeColor(ComboBox.ItemColor); sender:SetText(sender:GetText()); + self.hoverIndex = index; end self.labels[index].MouseLeave = function(sender, args) @@ -181,6 +194,7 @@ function ComboBox:AddItem(shortcut, index, value) sender:SetForeColor(ComboBox.SelectionColor); end sender:SetText(sender:GetText()); + self.hoverIndex = 0; end self.labels[index].MouseClick = function(sender, args) @@ -314,9 +328,25 @@ function ComboBox:Layout() self.label:SetSize(width - 4, height - 4); self.label:SetPosition(2, 2); self.arrow:SetPosition(width - 2 - 16, 2 + ((height - 4 - 16) / 2)); + + local scrollSize = 0; + local itemCount = #self.labels; + if itemCount > 10 then + scrollSize = 10; + end + local listWidth, listHeight = self.listBox:GetSize(); + self.listBox:SetSize(width - 4 - scrollSize, listHeight); + self.dropDownWindow:SetSize(width, listHeight + 4); + self.scrollBar:SetPosition(width - 12, 2); + + for i = 1, #self.quickslots, 1 do + self.quickslots[i]:SetSize(width, 20); + self.labels[i]:SetSize(width, 20); + end end function ComboBox:ShowDropDown() + self:Focus(); local itemCount = #self.labels; if ((itemCount > 0) and not (self.dropped)) then @@ -336,11 +366,10 @@ function ComboBox:ShowDropDown() -- list item sizes local listHeight = 0; + local itemHeight = self.labels[1]:GetHeight(); for i = 1, itemCount do - local item = self.labels[1]; - item:SetWidth(width - 14); if (i <= maxItems) then - listHeight = listHeight + item:GetHeight(); + listHeight = listHeight + itemHeight; end end @@ -355,10 +384,17 @@ function ComboBox:ShowDropDown() self.scrollBar:SetMaximum(itemCount * 20 - 200); -- position - local x, y = self:GetPosition(); - local parentX, parentY = self:GetParent():GetParent():GetParent() - :GetPosition(); - self.dropDownWindow:SetPosition(parentX + 10, parentY + 93); + local parent = self:GetParent(); + local screenX, screenY = self:GetPosition(); + while parent ~= nil do + local x, y = parent:GetPosition(); + screenX = screenX + x; + screenY = screenY + y; + if parent:GetParent() == nil then break end + parent = parent:GetParent(); + end + local cbWidth, cbHeight = self:GetSize(); + self.dropDownWindow:SetPosition(screenX, screenY + cbHeight + 3); self.dropDownWindow:SetVisible(true); @@ -400,13 +436,11 @@ function ComboBox:UpdateSubWindow() -- loop through all the quickslots for i = 1, #self.quickslots, 1 do -- get the number of rows - self.row = math.ceil(i / 1); + local row = math.ceil(i / 1); -- set the top position of the quickslots based on row -- number and the value of the scrollbar - self.quickslots[i]:SetTop((self.row - 1) * 20 - - self.scrollBar:GetValue()); - self.labels[i]:SetTop((self.row - 1) * 20 - self.scrollBar:GetValue()); + self.quickslots[i]:SetTop((row - 1) * 20 - self.scrollBar:GetValue()); + self.labels[i]:SetTop((row - 1) * 20 - self.scrollBar:GetValue()); end end - diff --git a/src/SettingsMenu.lua b/src/SettingsMenu.lua index d03f9cf..520d8de 100644 --- a/src/SettingsMenu.lua +++ b/src/SettingsMenu.lua @@ -180,7 +180,7 @@ function SettingsMenu:Update(string) elseif (string == menuOptionsString) then self.parent:OpenOptions(); elseif (string == menuSkillsString) then - self.parent:CheckSkills(); + self.parent:CheckSkills(true); elseif (string == moorMapString) then self.parent:OpenMoorMap(); elseif (string == eriadorMapString) then @@ -195,6 +195,8 @@ function SettingsMenu:Update(string) self:SetSelections(); -- update the main window settings + self.parent.dirty = true; self.parent:UpdateSettings(); + self.parent:SetOpacity(Settings.mainMinOpacity); end diff --git a/src/TravelButton.lua b/src/TravelButton.lua index 3efa209..f5fb0f1 100644 --- a/src/TravelButton.lua +++ b/src/TravelButton.lua @@ -94,6 +94,10 @@ function TravelButton:Constructor(parent) self:SetBackColor(Turbine.UI.Color(0, 0.5, 0.5, 0.5)); else + if not self.mainWindow:IsVisible() then + self.mainWindow:CheckSkills(false); + self.mainWindow:SetOpacity(Settings.mainMinOpacity); + end self.mainWindow:SetVisible(not self.mainWindow:IsVisible()); end else diff --git a/src/TravelCaroTab.lua b/src/TravelCaroTab.lua index eb43d9d..d06b2ea 100644 --- a/src/TravelCaroTab.lua +++ b/src/TravelCaroTab.lua @@ -20,7 +20,6 @@ function TravelCaroTab:Constructor(toplevel) self.quickslots = {}; self.shortcuts = {}; self.selectedIndex = 1; - -- self.rationCount = 0; -- need top level window in order to close it self.parent = toplevel; @@ -33,7 +32,6 @@ function TravelCaroTab:Constructor(toplevel) -- create the quickslots, then set up the shortcuts self:CreateQuickslots(); - self:SetItems(); --[[ EVENT HANDLERS ]] -- @@ -89,6 +87,10 @@ end function TravelCaroTab:SetItems() + if self.tabId ~= self.parent.MainPanel.selectedPage or not(self.parent.dirty) then + return + end + -- clear the shortcut table and set the selected -- item to 1 self.shortcuts = {}; @@ -100,7 +102,7 @@ function TravelCaroTab:SetItems() -- apply skill type filter if set in options if (hasbit(Settings.filters, bit(TravelShortcuts[i]:GetTravelType()))) then -- make sure skill is trained, lookup by ingame name - if (TravelWindow:FindSkill(TravelShortcuts[i])) then + if TravelShortcuts[i].found then table.insert(self.shortcuts, TravelShortcuts[i]); end end @@ -197,29 +199,6 @@ function TravelCaroTab:CreateQuickslots() end end end - - --[[ Set the size and position for the 5 quickslots ]] -- - - self.quickslots[1]:SetSize(22, 22); - self.quickslots[1]:SetPosition(25, 81); - self.quickslots[1]:SetZOrder(98); - - self.quickslots[2]:SetSize(36, 36); - self.quickslots[2]:SetPosition(45, 78); - self.quickslots[2]:SetZOrder(99); - - self.quickslots[3]:SetSize(36, 36); - self.quickslots[3]:SetPosition(72, 75); - self.quickslots[3]:SetMouseVisible(true); - self.quickslots[3]:SetZOrder(100); - - self.quickslots[4]:SetSize(36, 36); - self.quickslots[4]:SetPosition(99, 78); - self.quickslots[4]:SetZOrder(99); - - self.quickslots[5]:SetSize(36, 36); - self.quickslots[5]:SetPosition(119, 81); - self.quickslots[5]:SetZOrder(98); end -- function to adjust the size of the tab and all items in the tab @@ -236,7 +215,7 @@ function TravelCaroTab:SetSize(width, height) self.quickslots[2]:SetSize(28, 28); self.quickslots[2]:SetPosition(self:GetWidth() / 2 - 45, (self:GetHeight() - 20) / 2 + 3); - self.quickslots[3]:SetStretchMode(1); + self.quickslots[3]:SetStretchMode(1); -- makes fuzzy but keeps lack of opacity consistent with other icons showing self.quickslots[3]:SetSize(36, 36); self.quickslots[3]:SetPosition(self:GetWidth() / 2 - 18, (self:GetHeight() - 20) / 2 + 5); diff --git a/src/TravelGridTab.lua b/src/TravelGridTab.lua index 303865b..e5314b2 100644 --- a/src/TravelGridTab.lua +++ b/src/TravelGridTab.lua @@ -18,26 +18,60 @@ function TravelGridTab:Constructor(toplevel) -- set the default values self.quickslots = {}; - -- self.rationCount = 0; + self.selected = {}; self.numOfCols = 0; - self.max = 1; + self.maxScroll = 0; - -- need top level window in order to close it - self.parent = toplevel; + if self.parent == nil then + -- need top level window in order to close it + self.parent = toplevel; + end -- a subwindow (now a control) for containing all the quickslots self.SubWindow = Turbine.UI.Control(); - self.SubWindow:SetZOrder(99); - self.SubWindow:SetPosition(0, 25); - self.SubWindow:SetSize(self:GetWidth(), self:GetHeight() - 35); - self.SubWindow:SetBackColor(Turbine.UI.Color(0.87, 0, 0, 0)); + self.SubWindow:SetPosition(0, 0); self.SubWindow:SetParent(self); self.SubWindow:SetMouseVisible(true); - self.SubWindow:SetOpacity(1); - self.SubWindow:SetVisible(true); - -- set up all the quickslots - self:SetItems(); + -- set up the scrollbar for the list + self.myScrollBar = Turbine.UI.Lotro.ScrollBar(); + self.myScrollBar:SetOrientation(Turbine.UI.Orientation.Vertical); + self.myScrollBar:SetMinimum(0); + self.myScrollBar:SetVisible(false); + + self.myScrollBar.MouseClick = function(sender, args) + if (args.Button == Turbine.UI.MouseButton.Right) then + Menu:ShowMenu(); + end + end + + -- call the routine to update the + -- sub window when the value of the + -- scrollbar is changed. + self.myScrollBar.ValueChanged = function(sender, args) + self:UpdateSubWindow(); + end + + -- add an invisible label to intercept mouse events + self.myLabel = Turbine.UI.Label(); + self.myLabel:SetSize(self:GetWidth() - 10, self:GetHeight()); + self.myLabel:SetPosition(0, 0); + + -- show the menu when right clicked + self.myLabel.MouseClick = function(sender, args) + if (args.Button == Turbine.UI.MouseButton.Right) then + Menu:ShowMenu(); + end + end + + -- handle the mouse wheel scrolls + self.myLabel.MouseWheel = function(sender, args) + self:DoScroll(sender, args); + end + + self.myLabel.MouseUp = function(sender, args) + self.parent:MouseUp(sender, args); + end --[[ EVENT HANDLERS ]] -- @@ -50,7 +84,6 @@ function TravelGridTab:Constructor(toplevel) Menu:ShowMenu(); end end - end -- function to handle mouse scrollwheel events @@ -60,144 +93,142 @@ function TravelGridTab:DoScroll(sender, args) local newValue = self.myScrollBar:GetValue() - args.Direction * 20; -- make sure the value does not go below zero - if (newValue < 0) then + if newValue < 0 then newValue = 0; end - - -- set the new value self.myScrollBar:SetValue(newValue); - -- hide the scrollbar if the max value is 0, meaning we don't need a - -- scrollbar - if (self.max == 0) then - self.myScrollBar:SetVisible(false); - else - self.myScrollBar:SetVisible(true); - end + -- hide the scrollbar if the max value is 0, we don't need it + self.myScrollBar:SetVisible(self.maxScroll > 0); end --- function to force the tab to update the subwindow control +-- function to force the tab to update the subwindow control function TravelGridTab:UpdateSubWindow() -- loop through all the quickslots for i = 1, #self.quickslots, 1 do -- get the number of rows - self.row = math.ceil(i / self.numOfCols); + local row = math.ceil(i / self.numOfCols); -- set the top position of the quickslots based on row -- number and the value of the scrollbar - self.quickslots[i]:SetTop((self.row - 1) * 38 - self.myScrollBar:GetValue()); + self.quickslots[i]:SetTop((row - 1) * 38 - self.myScrollBar:GetValue()); end end -- function to set all the quickslot items to show function TravelGridTab:SetItems() - -- clear all the old quickslots from the Sub Window - if (self.SubWindow ~= nil) then - self.controlList = self.SubWindow:GetControls(); + if self.tabId ~= self.parent.MainPanel.selectedPage then + return + end - if (self.controlList:GetCount() > 0) then - for i = self.controlList:GetCount(), 1, -1 do - self.controlList:RemoveAt(i); - end + if not(self.parent.dirty) then + local prevNumOfCols = self.numOfCols; + self:UpdateBounds(#self.selected); + if self.parent.MainPanel.selectedPage == 2 and self.numOfCols ~= prevNumOfCols then + self.parent.dirty = true; end end - -- create a new sub window - self.SubWindow = Turbine.UI.Control(); - self.SubWindow:SetZOrder(99); - self.SubWindow:SetPosition(0, 25); - self.SubWindow:SetSize(self:GetWidth(), self:GetHeight() - 35); - self.SubWindow:SetBackColor(Turbine.UI.Color(0.87, 0, 0, 0)); - self.SubWindow:SetParent(self); - self.SubWindow:SetMouseVisible(true); - self.SubWindow:SetOpacity(1); - self.SubWindow:SetVisible(true); - - -- clear the quickslots table, and set row and column to 1 - self.quickslots = {}; self.row = 1; self.col = 1; - - -- loop through all the shortcuts and add those that are enabled - local shortcutIndex = 1; - for i = 1, #TravelShortcuts, 1 do - if (TravelShortcuts[i]:IsEnabled()) then - -- apply skill type filter if set in options - if (hasbit(Settings.filters, bit(TravelShortcuts[i]:GetTravelType()))) then - -- make sure skill is trained, lookup by ingame name - if (TravelWindow:FindSkill(TravelShortcuts[i])) then - self:AddItem(TravelShortcuts[i]); - shortcutIndex = shortcutIndex + 1; + if self.parent.dirty then + -- clear all the old quickslots from the SubWindow + self.controlList = self.SubWindow:GetControls(); + self.controlList:Clear(); + + -- collect shortcuts for display + self.selected = {} + for i = 1, #TravelShortcuts, 1 do + local shortcut = TravelShortcuts[i]; + -- make sure skill is trained and enabled + if shortcut.found and shortcut:IsEnabled() then + -- apply skill type filter if set in options + if hasbit(Settings.filters, bit(shortcut:GetTravelType())) then + self.selected[#self.selected + 1] = shortcut; end end end - end - - -- add an invisible label to intercept mouse events - self.myLabel = Turbine.UI.Label(); - self.myLabel:SetSize(self:GetWidth(), self:GetHeight() - 35); - self.myLabel:SetPosition(0, 0); - self.myLabel:SetParent(self.SubWindow); - -- show the menu when right clicked - self.myLabel.MouseClick = function(sender, args) - if (args.Button == Turbine.UI.MouseButton.Right) then - Menu:ShowMenu(); - end + -- update controls + self:UpdateBounds(#self.selected); + self.SubWindow:SetSize(self:GetWidth(), self:GetHeight()); + self.myScrollBar:SetParent(self.SubWindow); + self.myScrollBar:SetSize(10, self:GetHeight()); + self.myScrollBar:SetPosition(self:GetWidth() - 10, 0); + self.myScrollBar:SetSmallChange(24); + self.myScrollBar:SetLargeChange(24); + self.myScrollBar:SetMaximum(self.maxScroll); + self.myScrollBar:SetVisible(self.maxScroll > 0); + self.myLabel:SetParent(self.SubWindow); + self.myLabel:SetSize(self:GetWidth() - 10, self:GetHeight()); + + -- clear the quickslots table + self.quickslots = {}; + else + self.SubWindow:SetSize(self:GetWidth(), self:GetHeight()); + self.myScrollBar:SetSize(10, self:GetHeight()); + self.myScrollBar:SetPosition(self:GetWidth() - 10, 0); + self.myScrollBar:SetSmallChange(24); + self.myScrollBar:SetLargeChange(24); + self.myScrollBar:SetMaximum(self.maxScroll); + self.myScrollBar:SetVisible(self.maxScroll > 0); + self.myLabel:SetSize(self:GetWidth() - 10, self:GetHeight()); end - -- handle the mouse wheel scrolls - self.myLabel.MouseWheel = function(sender, args) - self:DoScroll(sender, args); + local margin = self:GetMargin(#self.selected); + for i = 1, #self.selected, 1 do + self:AddItem(self.selected[i], margin); end - -- set the scrollbar up - self:SetScrollBar(); + self.parent.dirty = false; end -- function to add a single shortcut to the tab -function TravelGridTab:AddItem(shortcut) - -- figure out the column width - self.numOfCols = math.floor((self:GetWidth() - 36) / 36); - - self.index = (self.row - 1) * self.numOfCols + self.col; - - -- create new quickslots setting the position - -- based on the row and column locations - self.quickslots[self.index] = Turbine.UI.Lotro.Quickslot(); - self.quickslots[self.index]:SetSize(36, 36); - self.quickslots[self.index]:SetPosition(10 + ((self.col - 1) * 38), ((self.row - 1) * 38)); - self.quickslots[self.index]:SetZOrder(90); - self.quickslots[self.index]:SetOpacity(1); - self.quickslots[self.index]:SetUseOnRightClick(false); - self.quickslots[self.index]:SetParent(self.SubWindow); - - -- attempt to create the shortcut - pcall(function() - self.quickslots[self.index]:SetShortcut(shortcut); - end) - - -- set all quickslots to be visible and - -- disable dropping new shortcuts onto them - self.quickslots[self.index]:SetAllowDrop(false); - self.quickslots[self.index]:SetVisible(true); +function TravelGridTab:AddItem(shortcut, margin) - -- show the menu when right clicked - self.quickslots[self.index].MouseClick = function(sender, args) - if (args.Button == Turbine.UI.MouseButton.Right) then - Menu:ShowMenu(); - else - if (Settings.hideOnTravel == 1) then - self.parent:SetVisible(false); + local index = (self.row - 1) * self.numOfCols + self.col; + + if not(self.parent.dirty) then + self.quickslots[index]:SetPosition(margin + ((self.col - 1) * 38), + ((self.row - 1) * 38 - self.myScrollBar:GetValue())); + else + -- create new quickslots setting the position + -- based on the row and column locations + self.quickslots[index] = Turbine.UI.Lotro.Quickslot(); + self.quickslots[index]:SetSize(36, 36); + self.quickslots[index]:SetPosition(margin + ((self.col - 1) * 38), + ((self.row - 1) * 38 - self.myScrollBar:GetValue())); + self.quickslots[index]:SetZOrder(90); + self.quickslots[index]:SetUseOnRightClick(false); + self.quickslots[index]:SetParent(self.SubWindow); + + -- attempt to create the shortcut + pcall(function() + self.quickslots[index]:SetShortcut(shortcut); + end) + + -- set all quickslots to be visible and + -- disable dropping new shortcuts onto them + self.quickslots[index]:SetAllowDrop(false); + self.quickslots[index]:SetVisible(true); + + -- show the menu when right clicked + self.quickslots[index].MouseClick = function(sender, args) + if (args.Button == Turbine.UI.MouseButton.Right) then + Menu:ShowMenu(); + else + if (Settings.hideOnTravel == 1) then + self.parent:SetVisible(false); + end end end - end - -- handle the mouse wheel scroll - self.quickslots[self.index].MouseWheel = function(sender, args) - self:DoScroll(sender, args); + -- handle the mouse wheel scroll + self.quickslots[index].MouseWheel = function(sender, args) + self:DoScroll(sender, args); + end end -- increase the row number when the column @@ -210,47 +241,39 @@ function TravelGridTab:AddItem(shortcut) end end -function TravelGridTab:SetScrollBar() - - -- set up the scrollbar for the list - self.myScrollBar = Turbine.UI.Lotro.ScrollBar(); - self.myScrollBar:SetBackColor(Turbine.UI.Color(0.87, 0, 0, 0)); - self.myScrollBar:SetOrientation(Turbine.UI.Orientation.Vertical); - self.myScrollBar:SetSize(10, self:GetHeight() - 35); - self.myScrollBar:SetPosition(self:GetWidth() - 15, 0); - self.myScrollBar:SetMinimum(0); - - -- set the maximum value of the scrollbar - -- based on the number of rows in the subwindow - NumberOfSlots = #self.quickslots; - NumberOfRows = math.ceil(NumberOfSlots / self.numOfCols); - - self.max = NumberOfRows * 38 - self:GetHeight() + 35; - if (self.max < 0) then - -- the max cannot be less than one - self.max = 0; - self.myScrollBar:SetMaximum(self.max); - self.myScrollBar:SetParent(self.SubWindow); - self.myScrollBar:SetVisible(false); +function TravelGridTab:UpdateBounds(numOfShortcuts) + -- calculate number of columns + local padding = 4; + local marginOffset = 1; + self.numOfCols = math.floor((self:GetWidth() - padding) / 38); + local numOfRows = math.ceil(numOfShortcuts / self.numOfCols); + + -- set the maximum scroll of the scrollbar + self.maxScroll = numOfRows * 38 - self:GetHeight(); + if self.maxScroll < 1 then + self.maxScroll = 0; else - self.myScrollBar:SetMaximum(self.max); - self.myScrollBar:SetParent(self.SubWindow); - self.myScrollBar:SetVisible(true); + -- include scrollbar width + self.numOfCols = math.floor((self:GetWidth() - padding - 10) / 38); + numOfRows = math.ceil(numOfShortcuts / self.numOfCols); + self.maxScroll = numOfRows * 38 - self:GetHeight(); end +end - -- show the menu when right clicked - self.myScrollBar.MouseClick = function(sender, args) - if (args.Button == Turbine.UI.MouseButton.Right) then - Menu:ShowMenu(); - end +function TravelGridTab:GetMargin(numOfShortcuts) + -- center the grid icons by calculating start position + local cols = self.numOfCols; + if numOfShortcuts < cols then + cols = numOfShortcuts; end - - -- call the routine to update the - -- sub window when the value of the - -- scrollbar is changed. - self.myScrollBar.ValueChanged = function(sender, args) - self:UpdateSubWindow(); + local width = self:GetWidth(); + local marginOffset = 1; + if self.maxScroll < 1 then + marginOffset = 0; + else + width = width - 12; -- remove width of scrollbar end + return math.floor((width - cols * 38) / 2.0) - marginOffset; end -- function to adjust the size of the tab and all items in the tab @@ -261,6 +284,4 @@ function TravelGridTab:SetSize(width, height) -- reset all the quickslots of the tab self:SetItems(); - - Turbine.UI.Control.SetOpacity(self, 1); end diff --git a/src/TravelListTab.lua b/src/TravelListTab.lua index 1f9221e..9157c1f 100644 --- a/src/TravelListTab.lua +++ b/src/TravelListTab.lua @@ -17,146 +17,148 @@ import "TravelWindowII.src.utils.BitOps"; TravelListTab = class(TravelGridTab); function TravelListTab:Constructor(toplevel) - TravelGridTab.Constructor(self); - -- need top level window in order to close it self.parent = toplevel; -end - -function TravelListTab:SetItems() - self.labels = {}; - TravelGridTab.SetItems(self); -end - -function TravelListTab:AddItem(shortcut, i) - -- set the column width to 1 - self.numOfCols = 1; + TravelGridTab.Constructor(self); - -- determine the width and height of the shortcuts and labels to be added - itemWidth = self:GetWidth() - 30; - itemHeight = 22; + self.itemHeight = 22; - -- set the index value based on the row and column - local index = (self.row - 1) * self.numOfCols + self.col; - - -- create new quickslots setting the position - -- based on the row and column locations - self.quickslots[index] = Turbine.UI.Lotro.Quickslot(); - self.quickslots[index]:SetSize(itemWidth, itemHeight); - self.quickslots[index]:SetPosition(10 + ((self.col - 1) * (itemWidth + 2)), ((self.row - 1) * (itemHeight))); - self.quickslots[index]:SetZOrder(90); - self.quickslots[index]:SetOpacity(1); - self.quickslots[index]:SetUseOnRightClick(false); - self.quickslots[index]:SetParent(self.SubWindow); - - pcall(function() - self.quickslots[index]:SetShortcut(shortcut); - end) - - -- create the label that will cover the shortcut - self.labels[index] = Turbine.UI.Label(); - self.labels[index]:SetSize(itemWidth, itemHeight); - self.labels[index]:SetPosition(10 + ((self.col - 1) * (itemWidth + 2)), ((self.row - 1) * (itemHeight))); - self.labels[index]:SetZOrder(100); - self.labels[index]:SetMouseVisible(false); - self.labels[index]:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft); - self.labels[index]:SetBackColor(Turbine.UI.Color(0.87, 0, 0, 0)); - self.labels[index]:SetText(shortcut:GetSkillLabel()); - self.labels[index]:SetParent(self.SubWindow); - - -- set all quickslots to be visible and - -- disable dropping new shortcuts onto them - self.quickslots[index]:SetAllowDrop(false); - self.quickslots[index]:SetVisible(true); + -- set up the scrollbar for the list + self.myScrollBar = Turbine.UI.Lotro.ScrollBar(); + self.myScrollBar:SetOrientation(Turbine.UI.Orientation.Vertical); + self.myScrollBar:SetMinimum(0); -- show the menu when right clicked - self.quickslots[index].MouseClick = function(sender, args) + self.myScrollBar.MouseClick = function(sender, args) if (args.Button == Turbine.UI.MouseButton.Right) then Menu:ShowMenu(); - else - if (Settings.hideOnTravel == 1) then - self.parent:SetVisible(false); - end end end - -- handle the mouse wheel scroll - self.quickslots[index].MouseWheel = function(sender, args) - self:DoScroll(sender, args); - end - - -- change the background colour of the label with the mouse enters - self.quickslots[index].MouseEnter = function(sender, args) - self.labels[index]:SetBackColor(Turbine.UI.Color(0.87, 0.17, 0.17, 0.17)); + -- call the routine to update the + -- sub window when the value of the + -- scrollbar is changed. + self.myScrollBar.ValueChanged = function(sender, args) + self:UpdateSubWindow(); end +end - -- return the background colour when the mouse leaves the label - self.quickslots[index].MouseLeave = function(sender, args) - self.labels[index]:SetBackColor(Turbine.UI.Color(0.87, 0, 0, 0)); +function TravelListTab:SetItems() + if self.tabId ~= self.parent.MainPanel.selectedPage then + return end - -- increase the row number when the column - -- number is greater than the number of columns - -- for the size of the window - self.col = self.col + 1; - if (self.col > self.numOfCols) then - self.col = 1; - self.row = self.row + 1; - end + self.itemWidth = self:GetWidth() - 30; + TravelGridTab.SetItems(self); end -function TravelListTab:SetScrollBar() +function TravelListTab:AddItem(shortcut) - -- set up the scrollbar for the list - self.myScrollBar = Turbine.UI.Lotro.ScrollBar(); - self.myScrollBar:SetBackColor(Turbine.UI.Color(0.87, 0, 0, 0)); - self.myScrollBar:SetOrientation(Turbine.UI.Orientation.Vertical); - self.myScrollBar:SetSize(10, self:GetHeight() - 35); - self.myScrollBar:SetPosition(self:GetWidth() - 15, 0); - self.myScrollBar:SetMinimum(0); + -- set the index value based on the row and column + local index = (self.row - 1) + self.col; - -- set the maximum value of the scrollbar - -- based on the number of rows in the subwindow - NumberOfSlots = #self.quickslots; - NumberOfRows = math.ceil(NumberOfSlots / self.numOfCols); - - self.max = NumberOfRows * 22 - self:GetHeight() + 35; - if (self.max < 0) then - -- the max cannot be less than one - self.max = 0; - self.myScrollBar:SetMaximum(self.max); - self.myScrollBar:SetParent(self.SubWindow); - self.myScrollBar:SetVisible(false); + if not(self.parent.dirty) then + self.quickslots[index]:SetSize(self.itemWidth, self.itemHeight); + self.labels[index]:SetSize(self.itemWidth, self.itemHeight); else - self.myScrollBar:SetMaximum(self.max); - self.myScrollBar:SetParent(self.SubWindow); - self.myScrollBar:SetVisible(true); - end + if index == 1 then + self.labels = {}; + end + -- create new quickslots setting the position + -- based on the row and column locations + self.quickslots[index] = Turbine.UI.Lotro.Quickslot(); + self.quickslots[index]:SetSize(self.itemWidth, self.itemHeight); + self.quickslots[index]:SetPosition(10 + ((self.col - 1) * (self.itemWidth + 2)), + (self.row - 1) * self.itemHeight); + self.quickslots[index]:SetZOrder(90); + self.quickslots[index]:SetOpacity(1); + self.quickslots[index]:SetUseOnRightClick(false); + self.quickslots[index]:SetParent(self.SubWindow); + + pcall(function() + self.quickslots[index]:SetShortcut(shortcut); + end) + + -- create the label that will cover the shortcut + self.labels[index] = Turbine.UI.Label(); + self.labels[index]:SetSize(self.itemWidth, self.itemHeight); + self.labels[index]:SetPosition(10 + ((self.col - 1) * (self.itemWidth + 2)), + (self.row - 1) * self.itemHeight); + self.labels[index]:SetZOrder(100); + self.labels[index]:SetMouseVisible(false); + self.labels[index]:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft); + self.labels[index]:SetBackColor(Turbine.UI.Color(DefAlpha, 0, 0, 0)); + self.labels[index]:SetText(shortcut:GetSkillLabel()); + self.labels[index]:SetParent(self.SubWindow); + + -- set all quickslots to be visible and + -- disable dropping new shortcuts onto them + self.quickslots[index]:SetAllowDrop(false); + self.quickslots[index]:SetVisible(true); + + -- show the menu when right clicked + self.quickslots[index].MouseClick = function(sender, args) + if (args.Button == Turbine.UI.MouseButton.Right) then + Menu:ShowMenu(); + else + if (Settings.hideOnTravel == 1) then + self.parent:SetVisible(false); + end + end + end - -- show the menu when right clicked - self.myScrollBar.MouseClick = function(sender, args) - if (args.Button == Turbine.UI.MouseButton.Right) then - Menu:ShowMenu(); + -- handle the mouse wheel scroll + self.quickslots[index].MouseWheel = function(sender, args) + self:DoScroll(sender, args); + end + + -- change the background colour of the label with the mouse enters + self.quickslots[index].MouseEnter = function(sender, args) + self.labels[index]:SetBackColor(Turbine.UI.Color(DefAlpha, 0.17, 0.17, 0.17)); + end + + -- return the background colour when the mouse leaves the label + self.quickslots[index].MouseLeave = function(sender, args) + self.labels[index]:SetBackColor(Turbine.UI.Color(DefAlpha, 0, 0, 0)); end end - -- call the routine to update the - -- sub window when the value of the - -- scrollbar is changed. - self.myScrollBar.ValueChanged = function(sender, args) - self:UpdateSubWindow(); + -- increase the row number + self.row = self.row + 1; +end + +function TravelListTab:UpdateBounds(numOfShortcuts) + -- set the maximum value of the scrollbar + -- based on the number of rows in the subwindow + self.maxScroll = numOfShortcuts * 22 - self:GetHeight(); + if self.maxScroll < 0 then + -- the maxScroll cannot be less than one + self.maxScroll = 0; end end +function TravelListTab:GetMargin(numOfShortcuts) + return 0; +end + function TravelListTab:UpdateSubWindow() -- loop through all the quickslots for i = 1, #self.quickslots, 1 do - -- get the number of rows - self.row = math.ceil(i / self.numOfCols); -- set the top position of the quickslots based on row -- number and the value of the scrollbar - self.quickslots[i]:SetTop((self.row - 1) * 22 - self.myScrollBar:GetValue()); - self.labels[i]:SetTop((self.row - 1) * 22 - self.myScrollBar:GetValue()); + self.quickslots[i]:SetTop((i - 1) * 22 - self.myScrollBar:GetValue()); + self.labels[i]:SetTop((i - 1) * 22 - self.myScrollBar:GetValue()); end end + +-- function to adjust the size of the tab and all items in the tab +function TravelListTab:SetSize(width, height) + + -- set the size of the tab + Turbine.UI.Control.SetSize(self, width, height); + + self:SetItems(); + + Turbine.UI.Control.SetOpacity(self, 1); +end diff --git a/src/TravelPulldownTab.lua b/src/TravelPulldownTab.lua index f5e2b3d..5194095 100644 --- a/src/TravelPulldownTab.lua +++ b/src/TravelPulldownTab.lua @@ -23,27 +23,25 @@ function TravelPulldownTab:Constructor(toplevel) -- this label is used to catch wheel moves self.scrollLabel = Turbine.UI.Label(); self.scrollLabel:SetSize(180, 155); - self.scrollLabel:SetPosition(0, 20); + self.scrollLabel:SetPosition(0, 0); self.scrollLabel:SetParent(self); -- the pulldown box - self.pulldown = TravelWindowII.src.OrendarUIMods.ComboBox(); - self.pulldown:SetPosition(0, 20); - self.pulldown:SetSize(200, 30); + self.pulldown = TravelWindowII.src.OrendarUIMods.ComboBox(self); + self.pulldown:SetPosition(10, 20); + self.pulldown:SetSize(self:GetWidth() - 20, 30); self.pulldown:SetParent(self); self.pulldown:SetVisible(true); + self.pulldown:SetTravelOnSelect(Settings.pulldownTravel); -- the quickslot for the shortcut self.quickslot = Turbine.UI.Lotro.Quickslot(); self.quickslot:SetSize(36, 36); - self.quickslot:SetPosition(82, 55); self.quickslot:SetZOrder(98); self.quickslot:SetUseOnRightClick(false); self.quickslot:SetParent(self); self.quickslot:SetVisible(true); - self:SetItems(); - --[[ EVENT HANDLERS ]] -- -- make sure we listen for key presses @@ -82,6 +80,13 @@ function TravelPulldownTab:Constructor(toplevel) self:DoScroll(sender, args); end + -- handle the event if the selected item changes + self.pulldown.SelectedIndexChanged = function(sender, args) + pcall(function() + self.quickslot:SetShortcut(TravelShortcuts[sender:GetSelection()]); + end) + end + -- open the option window if the quickslot is right-clicked self.quickslot.MouseClick = function(sender, args) if (args.Button == Turbine.UI.MouseButton.Right) then @@ -100,34 +105,26 @@ end function TravelPulldownTab:SetItems() - -- create the combo box to use in the tab - self.pulldown = TravelWindowII.src.OrendarUIMods.ComboBox(self.parent); - self.pulldown:SetPosition(0, 20); - self.pulldown:SetSize(200, 30); - self.pulldown:SetParent(self); - self.pulldown:SetVisible(true); - self.pulldown:SetTravelOnSelect(Settings.pulldownTravel); + if self.tabId ~= self.parent.MainPanel.selectedPage or not(self.parent.dirty) then + return + end + + self.pulldown:ClearItems(); -- add the shortcuts to the combo box local shortcutIndex = 1; for i = 1, #TravelShortcuts, 1 do - if (TravelShortcuts[i]:IsEnabled()) then - -- apply skill type filter if set in options + if TravelShortcuts[i].found and TravelShortcuts[i]:IsEnabled() then if (hasbit(Settings.filters, bit(TravelShortcuts[i]:GetTravelType()))) then - -- make sure skill is trained, lookup by ingame name - if (TravelWindow:FindSkill(TravelShortcuts[i])) then - self.pulldown:AddItem(TravelShortcuts[i], shortcutIndex, i); - shortcutIndex = shortcutIndex + 1; - end + self.pulldown:AddItem(TravelShortcuts[i], shortcutIndex, i); + shortcutIndex = shortcutIndex + 1; end end end - -- handle the event if the selected item changes - self.pulldown.SelectedIndexChanged = function(sender, args) - pcall(function() - self.quickslot:SetShortcut(TravelShortcuts[sender:GetSelection()]); - end) + if #self.pulldown.quickslots > 0 then + self.pulldown:ItemSelected(1); + self.pulldown:FireEvent(); end end @@ -138,8 +135,10 @@ function TravelPulldownTab:SetSize(width, height) Turbine.UI.Control.SetSize(self, width, height); -- set the size of the labels - -- self.rationLabel:SetSize(self:GetWidth(),20); + self.pulldown:SetSize(self:GetWidth() - 20, 30); self.scrollLabel:SetSize(self:GetWidth(), self:GetHeight()); + -- center the quickslot + self.quickslot:SetPosition(self:GetWidth() / 2.0 - 18, 55); Turbine.UI.Control.SetOpacity(self, 1); end diff --git a/src/TravelShortcut.lua b/src/TravelShortcut.lua index 725aa4a..23ced10 100644 --- a/src/TravelShortcut.lua +++ b/src/TravelShortcut.lua @@ -13,6 +13,7 @@ function TravelShortcut:Constructor(sType, data, name, tType, index, enabled, sk self.Index = index; self.Enabled = enabled; self.skillLabel = skillLabel; + self.found = false; self:SetType(sType); self:SetData(data); diff --git a/src/TravelWindow.lua b/src/TravelWindow.lua index fb9f66d..e480877 100644 --- a/src/TravelWindow.lua +++ b/src/TravelWindow.lua @@ -18,16 +18,17 @@ TravelWindow = class(Turbine.UI.Lotro.Window); function TravelWindow:Constructor() Turbine.UI.Lotro.Window.Constructor(self); + DefAlpha = 0.92; Settings = {}; SettingsStrings = {}; TravelShortcuts = {}; -- put all the shortcuts into one table - TrainedSkills = Turbine.Gameplay.SkillList; + TrainedSkills = Turbine.Gameplay.SkillList; -- TODO: update list on window open or maybe a timer - self.minWidth = 240; - self.minHeight = 150; - self.disableResize = false; self.reloadGVMap = false; self.options = nil; + self.dirty = true; + self.isMouseDown = false; + self.isResizing = false; -- create the lists of travel locations and the shortcuts -- that are used to execute them @@ -39,10 +40,9 @@ function TravelWindow:Constructor() -- configure the main window self:SetPosition(Settings.positionX, Settings.positionY); self:SetSize(Settings.width, Settings.height); - self:SetBackColor(Turbine.UI.Color(0.0, 0, 0, 0)); self:SetText(mainTitleString); - self:SetZOrder(97); - self:SetOpacity(1); + self:SetOpacity(Settings.mainMinOpacity); + self:SetResizable(true); if (Settings.hideOnStart == 1) then self:SetVisible(false); else @@ -109,27 +109,18 @@ function TravelWindow:Constructor() self.MainPanel:AddTab(self.GridTab); self.MainPanel:AddTab(self.CaroTab); self.MainPanel:AddTab(self.PullTab); - - -- create a control for resizing the window - self.sizeControl = Turbine.UI.Control(); - self.sizeControl:SetParent(self); - self.sizeControl:SetZOrder(100); - self.sizeControl:SetSize(20, 20); - self.sizeControl:SetBackColorBlendMode(Turbine.UI.BlendMode.Screen) - self.sizeControl:SetBackColor(Turbine.UI.Color(0.1, 1, 1, 1)); - self.sizeControl:SetPosition(self:GetWidth() - self.sizeControl:GetWidth(), - self:GetHeight() - self.sizeControl:GetHeight()); + self.ListTab.tabId = 1; + self.GridTab.tabId = 2; + self.CaroTab.tabId = 3; + self.PullTab.tabId = 4; -- display the tab that was last selected self.MainPanel:SetTab(Settings.mode); self.MainPanel:SetSize(self:GetWidth() - 20, self:GetHeight() - 60); self.MainPanel:UpdateTabs(); + self:CheckSkills(false); self:UpdateSettings(); - -- timers for events - self.lastTime = 0; - self.lastMove = 0; - -- track the hidden state of the UI, manage previous states for window and -- the button self.hidden = false; @@ -173,6 +164,7 @@ function TravelWindow:Constructor() self.KeyDown = function(sender, args) if (args.Action == Turbine.UI.Lotro.Action.Escape) then self:SetVisible(false); + self.optionsWindow:SetVisible(false); self:CloseOptions(); self:CloseGondorMap(); self:CloseMoorMap(); @@ -183,11 +175,12 @@ function TravelWindow:Constructor() self:SetVisible(self.currentVisState); self.ToggleButton:SetVisible(Settings.showButton == 1); end - elseif (args.Action == 268435635) then + elseif (args.Action == Turbine.UI.Lotro.Action.UI_Toggle) then if (self.hidden == false) then self.currentVisState = self:IsVisible(); self.hidden = true; self:SetVisible(false); + self.optionsWindow:SetVisible(false); self.ToggleButton:SetVisible(false); else self.hidden = false; @@ -241,6 +234,16 @@ function TravelWindow:Constructor() end end + self.MouseClick = function(sender, args) + if args.Button == Turbine.UI.MouseButton.Right then + Menu:ShowMenu(); + end + + if Settings.mode == 4 then + self.PullTab:ClosePulldown(); + end + end + -- go to full opacity if mouse is over self.MouseEnter = function(sender, args) self:SetOpacity(Settings.mainMaxOpacity); @@ -248,63 +251,42 @@ function TravelWindow:Constructor() -- go to low opacity when mouse is not over self.MouseLeave = function(sender, args) - self:SetOpacity(Settings.mainMinOpacity); - end + local mX, mY = self:GetMousePosition(); + local winX, winY = self:GetSize(); - -- change the background color of the resize button on entry to help - -- show exactly where the button is - self.sizeControl.MouseEnter = function(sender, args) - self.sizeControl:SetBackColor(Turbine.UI.Color(0.9, 1, 1, 1)); + if not self.isMouseDown then + self:SetOpacity(Settings.mainMinOpacity); + end end - -- return background color to normal on mouse leave - self.sizeControl.MouseLeave = function(sender, args) - self.sizeControl:SetBackColor(Turbine.UI.Color(0.1, 1, 1, 1)); + self.MouseDown = function(sender, args) + self.isMouseDown = true; end - -- check if someone is going to start dragging the resize control - self.sizeControl.MouseDown = function(sender, args) + self.MouseUp = function(sender, args) + local mX, mY = self:GetMousePosition(); + local winX, winY = self:GetSize(); + local outsideWindow = mX < 1 or mY < 1 or mX > winX - 1 or mY > winY - 1; - -- check if resize has been disabled - if (self.disableResize) then - return; + if outsideWindow then + self:SetOpacity(Settings.mainMinOpacity); end - -- set start location of resize and enable dragging - sender.dragStartX = args.X; - sender.dragStartY = args.Y; - sender.dragging = true; - end - - self.sizeControl.MouseUp = function(sender, args) - -- disable dragging, then update settings - sender.dragging = false; - - Settings.width = self:GetWidth(); - Settings.height = self:GetHeight(); - self:UpdateSettings(); + self.isMouseDown = false; + self.isResizing = false; end - -- perform the resize - self.sizeControl.MouseMove = function(sender, args) - local width, height = self:GetSize(); - - -- if resize dragging, then resize the window - if (sender.dragging) then - self:SetSize(width + (args.X - sender.dragStartX), height + (args.Y - sender.dragStartY)); + self.SizeChanged = function(sender, args) + if self.isMouseDown then + self.isResizing = true; end - - -- update the size of the window - self:UpdateSize(); - - -- check time since last move - if (Turbine.Engine.GetGameTime() - self.lastMove > 0.1 and self:IsVisible() or self.lastMove == 0) then - - -- update the tabbed panels - self.MainPanel:SetSize(self:GetWidth() - 20, self:GetHeight() - 60); - self.MainPanel:UpdateTabs(); - self.lastMove = Turbine.Engine.GetGameTime(); + if Settings.mode == 1 or Settings.mode == 2 then + -- only save dimensions for list & grid tabs + Settings.width = self:GetWidth(); + Settings.height = self:GetHeight(); end + self.MainPanel:SetSize(self:GetWidth() - 20, self:GetHeight() - 60); + self.MainPanel:UpdateTabs(); end Plugins["Travel Window II"].Load = function(sender, args) @@ -336,27 +318,57 @@ function TravelWindow:SetPlayerRaceKey() end end -function TravelWindow:UpdateSize() - -- check that the window is not smaller than min width - if (self:GetWidth() < self.minWidth) then - self:SetWidth(self.minWidth); +function TravelWindow:SetItems() + if Settings.mode == 1 then + self.ListTab:SetItems(); + elseif Settings.mode == 2 then + self.GridTab:SetItems(); + elseif Settings.mode == 3 then + self.CaroTab:SetItems(); + else + self.PullTab:SetItems(); end +end - -- check that the window is not smaller than min height - if (self:GetHeight() < self.minHeight) then - self:SetHeight(self.minHeight); +function TravelWindow:UpdateSize() + -- update the page that is showing + if Settings.mode == 1 then + self.minWidth = 245; + self.minHeight = 150; + elseif Settings.mode == 2 then + self.minWidth = 200; + self.minHeight = 100; + elseif Settings.mode == 3 then + self.minWidth = 200; + self.minHeight = 110; + else + self.minWidth = 360; + self.minHeight = 150; end - -- set the new location of the resize control - self.sizeControl:SetPosition(self:GetWidth() - self.sizeControl:GetWidth(), - self:GetHeight() - self.sizeControl:GetHeight()); + self:SetMinimumSize(self.minWidth, self.minHeight); + + if Settings.mode == 3 or Settings.mode == 4 then + self:SetResizable(false); + self:SetSize(self.minWidth, self.minHeight); + else + self:SetResizable(true); + + -- check that the window is not smaller than min width + if (self:GetWidth() < self.minWidth) then + self:SetWidth(self.minWidth); + end + + -- check that the window is not smaller than min height + if (self:GetHeight() < self.minHeight) then + self:SetHeight(self.minHeight); + end + end end function TravelWindow:SetMapHome() - -- disable the resize while the map update window is open -- also close the options window - self.disableResize = true; self:CloseOptions(); -- create the window used to add the map @@ -407,12 +419,7 @@ function TravelWindow:SetMapHome() self:SaveMapHome(self.mapQuickSlot1:GetShortcut()); end - -- enable resize again - self.disableResize = false; - -- update the shortcuts list - self:CheckEnabledSettings() - self:SetShortcuts(); self:UpdateSettings(); -- close this window @@ -451,6 +458,7 @@ end function TravelWindow:SetShortcuts() -- set default values TravelShortcuts = {}; + local sType = Turbine.UI.Lotro.ShortcutType.Skill; local shortcutIndex = 1; -- set the either the travel skills for free people or monsters @@ -463,13 +471,14 @@ function TravelWindow:SetShortcuts() -- set the shortcut for the quickslot, check -- if the shortcut is the glan vraig map or not if (string.len(genLocations:IdAtIndex(i)) > 12) then + local sItem = Turbine.UI.Lotro.ShortcutType.Item; table.insert(TravelShortcuts, - TravelShortcut(2.0, genLocations:IdAtIndex(i), genLocations:NameAtIndex(i), 1, + TravelShortcut(sItem, genLocations:IdAtIndex(i), genLocations:NameAtIndex(i), 1, shortcutIndex, Settings.enabled[genLocations:IdAtIndex(i)], genLocations:LabelAtIndex(i))); else table.insert(TravelShortcuts, - TravelShortcut(6.0, genLocations:IdAtIndex(i), genLocations:NameAtIndex(i), 1, + TravelShortcut(sType, genLocations:IdAtIndex(i), genLocations:NameAtIndex(i), 1, shortcutIndex, Settings.enabled[genLocations:IdAtIndex(i)], genLocations:LabelAtIndex(i))); end @@ -478,7 +487,7 @@ function TravelWindow:SetShortcuts() -- add the race travel to the list local racialShortcutIndex = self:TableIndex(Settings.order, racialLocations:IdAtIndex(PlayerRaceKey)); table.insert(TravelShortcuts, - TravelShortcut(6.0, racialLocations:IdAtIndex(PlayerRaceKey), + TravelShortcut(sType, racialLocations:IdAtIndex(PlayerRaceKey), racialLocations:NameAtIndex(PlayerRaceKey), 2, racialShortcutIndex, Settings.enabled[racialLocations:IdAtIndex(PlayerRaceKey)], racialLocations:LabelAtIndex(PlayerRaceKey))); @@ -487,7 +496,7 @@ function TravelWindow:SetShortcuts() for i = 1, travelCount[4], 1 do shortcutIndex = self:TableIndex(Settings.order, repLocations:IdAtIndex(i)); table.insert(TravelShortcuts, - TravelShortcut(6.0, repLocations:IdAtIndex(i), repLocations:NameAtIndex(i), 3, shortcutIndex, + TravelShortcut(sType, repLocations:IdAtIndex(i), repLocations:NameAtIndex(i), 3, shortcutIndex, Settings.enabled[repLocations:IdAtIndex(i)], repLocations:LabelAtIndex(i), repLocations:DescAtIndex(i))); end @@ -496,7 +505,7 @@ function TravelWindow:SetShortcuts() for i = 1, travelCount[6], 1 do shortcutIndex = self:TableIndex(Settings.order, creepLocations:IdAtIndex(i)); table.insert(TravelShortcuts, - TravelShortcut(6.0, creepLocations:IdAtIndex(i), creepLocations:NameAtIndex(i), 3, + TravelShortcut(sType, creepLocations:IdAtIndex(i), creepLocations:NameAtIndex(i), 3, shortcutIndex, Settings.enabled[creepLocations:IdAtIndex(i)], creepLocations:LabelAtIndex(i))); end @@ -507,7 +516,7 @@ function TravelWindow:SetShortcuts() for i = 1, travelCount[1], 1 do shortcutIndex = self:TableIndex(Settings.order, hunterLocations:IdAtIndex(i)); table.insert(TravelShortcuts, - TravelShortcut(6.0, hunterLocations:IdAtIndex(i), hunterLocations:NameAtIndex(i), 4, + TravelShortcut(sType, hunterLocations:IdAtIndex(i), hunterLocations:NameAtIndex(i), 4, shortcutIndex, Settings.enabled[hunterLocations:IdAtIndex(i)], hunterLocations:LabelAtIndex(i), hunterLocations:DescAtIndex(i))); end @@ -518,7 +527,7 @@ function TravelWindow:SetShortcuts() for i = 1, travelCount[2], 1 do shortcutIndex = self:TableIndex(Settings.order, wardenLocations:IdAtIndex(i)); table.insert(TravelShortcuts, - TravelShortcut(6.0, wardenLocations:IdAtIndex(i), wardenLocations:NameAtIndex(i), 4, + TravelShortcut(sType, wardenLocations:IdAtIndex(i), wardenLocations:NameAtIndex(i), 4, shortcutIndex, Settings.enabled[wardenLocations:IdAtIndex(i)], wardenLocations:LabelAtIndex(i), wardenLocations:DescAtIndex(i))); end @@ -529,7 +538,7 @@ function TravelWindow:SetShortcuts() for i = 1, travelCount[7], 1 do shortcutIndex = self:TableIndex(Settings.order, marinerLocations:IdAtIndex(i)); table.insert(TravelShortcuts, - TravelShortcut(6.0, marinerLocations:IdAtIndex(i), marinerLocations:NameAtIndex(i), 4, + TravelShortcut(sType, marinerLocations:IdAtIndex(i), marinerLocations:NameAtIndex(i), 4, shortcutIndex, Settings.enabled[marinerLocations:IdAtIndex(i)], marinerLocations:LabelAtIndex(i), marinerLocations:DescAtIndex(i))); end @@ -752,24 +761,21 @@ function TravelWindow:TableIndex(tableToSearch, elementToSearchFor) end function TravelWindow:SortShortcuts() - -- do not sort if there is one or less shortcuts - if #TravelShortcuts < 2 then - return; - end - - -- perform a bubble sort - for i = 1, #TravelShortcuts do - for j = 2, #TravelShortcuts do - -- if the index of the second shortcut is lower than the index of - -- the first, switch the shortcuts - if TravelShortcuts[j]:GetIndex() < TravelShortcuts[j - 1]:GetIndex() then - local temp = TravelShortcuts[j - 1]; - TravelShortcuts[j - 1] = TravelShortcuts[j]; - TravelShortcuts[j] = temp; + -- perform an optimized bubble sort + local n = #TravelShortcuts; + while n > 2 do + local new_n = 1; + for i = 2, n do + if TravelShortcuts[i - 1]:GetIndex() > TravelShortcuts[i]:GetIndex() then + self.dirty = true; + local temp = TravelShortcuts[i - 1]; + TravelShortcuts[i - 1] = TravelShortcuts[i]; + TravelShortcuts[i] = temp; + new_n = i; end end + n = new_n; end - end function TravelWindow:UpdateOpacity() @@ -812,19 +818,21 @@ function TravelWindow:LoadSettings() end if (not SettingsStrings.width or SettingsStrings.width == "nil") then + if self.minWidth == nil then self.minWidth = 245; end SettingsStrings.width = tostring(self.minWidth); end if (not SettingsStrings.height or SettingsStrings.height == "nil") then + if self.minHeight == nil then self.minHeight = 150; end SettingsStrings.height = tostring(self.minHeight); end if (not SettingsStrings.positionX or SettingsStrings.positionX == "nil") then - SettingsStrings.positionX = tostring(Turbine.UI.Display.GetWidth() - self:GetWidth() - 50); + SettingsStrings.positionX = tostring((Turbine.UI.Display.GetWidth() - self:GetWidth()) * 0.75); end if (not SettingsStrings.positionY or SettingsStrings.positionY == "nil") then - SettingsStrings.positionY = tostring(Turbine.UI.Display.GetHeight() - self:GetHeight() - 50 * 1.5); + SettingsStrings.positionY = tostring((Turbine.UI.Display.GetHeight() - self:GetHeight()) * 0.75); end if (not SettingsStrings.buttonPositionX or SettingsStrings.buttonPositionX == "nil") then @@ -846,7 +854,7 @@ function TravelWindow:LoadSettings() if (not SettingsStrings.pulldownTravel or SettingsStrings.pulldownTravel == "nil") then SettingsStrings.pulldownTravel = tostring(0); end - + if (not SettingsStrings.hideOnTravel or SettingsStrings.hideOnTravel == "nil") then SettingsStrings.hideOnTravel = tostring(0); end @@ -1048,31 +1056,20 @@ end function TravelWindow:UpdateSettings() -- get some settings from the menu + local prevMode = Settings.mode; Settings.mode, Settings.filters = Menu:GetSettings(); + if prevMode ~= Settings.mode then + self.dirty = true; + if (prevMode == 3 or prevMode == 4) and (Settings.mode == 1 or Settings.mode == 2) then + -- restore previous size + self:SetSize(Settings.width, Settings.height); + end + end -- set which page of the tab panel to show self.MainPanel:SetTab(Settings.mode); - - -- update the page that is showing - if (Settings.mode == 1) then - self.minWidth = 245; - self.minHeight = 150; - self.ListTab:SetItems(); - elseif (Settings.mode == 2) then - self.minWidth = 120; - self.minHeight = 130; - self.GridTab:SetItems(); - elseif (Settings.mode == 3) then - self.minWidth = 120; - self.minHeight = 130; - self.CaroTab:SetItems(); - else - self.minWidth = 220; - self.minHeight = 150; - self.PullTab:SetItems(); - end - self:UpdateSize(); + self:SetItems(); self.MainPanel:SetSize(self:GetWidth() - 20, self:GetHeight() - 60); self.MainPanel:UpdateTabs(); @@ -1122,6 +1119,7 @@ function TravelWindow:ResetSettings() -- update everything self:CheckEnabledSettings() self:SetShortcuts(); + self:CheckSkills(false) self:UpdateSettings(); end @@ -1151,34 +1149,42 @@ function TravelWindow:AddGVMap() end end -function TravelWindow:CheckSkills() +function TravelWindow:CheckSkills(report) + local newShortcut = false; -- loop through all the shortcuts and list those those that are not learned for i = 1, #TravelShortcuts, 1 do + local wasFound = TravelShortcuts[i].shortcut; if (TravelWindow:FindSkill(TravelShortcuts[i])) then - -- do nothing, skill is known - else + if not wasFound then + newShortcut = true; + end + elseif report then Turbine.Shell.WriteLine(skillNotTrainedString .. TravelShortcuts[i]:GetName()) end end - -- make sure list of shortcuts is rescanned and new skills added - self:SetShortcuts(); + if newShortcut then + self.dirty = true; -- reset list of shortcuts + self:SetItems(); -- redraw current window + end end function TravelWindow:FindSkill(shortcut) + if shortcut.found then + return true; + end + for i = 1, TrainedSkills:GetCount(), 1 do - local skill = Turbine.Gameplay.Skill; - skill = TrainedSkills:GetItem(i); - local skillInfo = skill:GetSkillInfo(); - local name = shortcut:GetName(); - local desc = shortcut:GetDescription(); - if desc ~= nil then - if string.match(skillInfo:GetDescription(), desc) and - (skillInfo:GetName() == name) then - return true; - end - else - if (skillInfo:GetName() == name) then + local skillInfo = TrainedSkills:GetItem(i):GetSkillInfo(); + if skillInfo:GetName() == shortcut:GetName() then + local desc = shortcut:GetDescription(); + if desc ~= nil then + if string.match(skillInfo:GetDescription(), desc) then + shortcut.found = true; + return true; + end + else + shortcut.found = true; return true; end end @@ -1218,3 +1224,100 @@ function AddCallback(object, event, callback) end return callback; end + +-- for debug purposes +function TravelWindow:ManualSkillScan() + local last = 0; + skillWindow=Turbine.UI.Lotro.Window() + skillWindow.cols=math.floor((Turbine.UI.Display:GetWidth()-10)/100) + skillWindow.rows=math.floor((Turbine.UI.Display:GetHeight()-105)/62) + skillWindow:SetSize(Turbine.UI.Display:GetWidth(),Turbine.UI.Display:GetHeight()) + skillWindow:SetText("Skill Explorer") + skillWindow.StartCaption=Turbine.UI.Label() + skillWindow.StartCaption:SetParent(skillWindow) + skillWindow.StartCaption:SetText("Start:") + skillWindow.StartCaption:SetPosition(10,45) + skillWindow.StartCaption:SetSize(50,20) + skillWindow.Start=Turbine.UI.Lotro.TextBox() + skillWindow.Start:SetParent(skillWindow) + skillWindow.Start:SetPosition(65,45) + skillWindow.Start:SetSize(100,20) + skillWindow.Start:SetFont(Turbine.UI.Lotro.Font.Verdana16) + skillWindow.Prev=Turbine.UI.Lotro.Button() + skillWindow.Prev:SetParent(skillWindow) + skillWindow.Prev:SetSize(100,20) + skillWindow.Prev:SetPosition(170,45) + skillWindow.Prev:SetText("Previous") + skillWindow.Prev.Click=function() + local start=tonumber(skillWindow.Start:GetText()) + if start==nil then start=0 end + start=start-skillWindow.rows*skillWindow.cols + if start<0 then start=0 end + skillWindow.Start:SetText(string.format("0x%x",start)) + skillWindow.refresh() + end + skillWindow.Show=Turbine.UI.Lotro.Button() + skillWindow.Show:SetParent(skillWindow) + skillWindow.Show:SetSize(100,20) + skillWindow.Show:SetPosition(275,45) + skillWindow.Show:SetText("Refresh") + skillWindow.Show.Click=function() + skillWindow.refresh() + end + skillWindow.Next=Turbine.UI.Lotro.Button() + skillWindow.Next:SetParent(skillWindow) + skillWindow.Next:SetSize(100,20) + skillWindow.Next:SetPosition(380,45) + skillWindow.Next:SetText("Next") + skillWindow.Next.Click=function() + local start=tonumber(skillWindow.Start:GetText()) + if start==nil then start=0 end + if last == 0 then + start=start+skillWindow.rows*skillWindow.cols + else + start = last + end + skillWindow.Start:SetText(string.format("0x%x",start)) + skillWindow.refresh() + end + skillWindow:SetVisible(true) + skillWindow.QS={} + for row=1,skillWindow.rows do + skillWindow.QS[row]={} + for col=1,skillWindow.cols do + skillWindow.QS[row][col]=Turbine.UI.Lotro.Quickslot() + local qs=skillWindow.QS[row][col] + qs:SetParent(skillWindow) + qs:SetSize(34,34) + qs:SetPosition(col*100-32, row*62+23) + qs.label=Turbine.UI.Label() + qs.label:SetParent(skillWindow) + qs.label:SetSize(100,20) + qs.label:SetPosition(col*100-32, row*62+57) + end + end + skillWindow.refresh=function() + local start=tonumber(skillWindow.Start:GetText()) + if start==nil then start=0 end + + for row=1,skillWindow.rows do + local err = 0; + for col=1,skillWindow.cols do + repeat + local qs=skillWindow.QS[row][col] + local sc=Turbine.UI.Lotro.Shortcut(); + sc:SetType(Turbine.UI.Lotro.ShortcutType.Skill) + local val=string.format("0x%x",start); + start = start + 1; + sc:SetData(val) + local success, result=pcall(Turbine.UI.Lotro.Quickslot.SetShortcut,qs,sc) + qs:SetVisible(success) + qs.label:SetText(val) + if not success then err = err + 1 end + until success or err > 10000 + end + end + last = start; + end + skillWindow.Start:SetText("0x700697F2") +end