From 5c5670d52f9de103bc576ef9c7210e28fa0245db Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 16 Jun 2016 08:07:11 +0100 Subject: [PATCH] Autocomplete plugin filenames and Bash Tags in editor Bash Tags are hardcoded in the game settings. They could be sourced from the masterlist, but while that would be more flexible, they don't change often and hardcoding them avoids having to make a change to masterlist syntax. --- bower.json | 3 +- src/backend/game/game_settings.cpp | 154 +++++++++++++++++ src/backend/game/game_settings.h | 4 + src/gui/handler.cpp | 2 + src/gui/html/elements/editable-table.html | 11 +- src/gui/html/js/dom.js | 8 + src/gui/html/js/events.js | 3 +- src/gui/html/js/game.js | 10 ++ src/gui/html/js/initialise.js | 2 +- src/tests/backend/game/game_settings_test.h | 176 ++++++++++++++++++++ 10 files changed, 364 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index 3b2f7f45..03efe1a4 100644 --- a/bower.json +++ b/bower.json @@ -33,6 +33,7 @@ "Jed": "SlexAxton/Jed#a9d03e1bbca9211a8b29a93a298a7ee9ddb353f0", "jed-gettext-parser": "^1.0.0", "marked": "^0.3.2", - "lodash": "^4.3.0" + "lodash": "^4.3.0", + "paper-autocomplete": "loot/paper-autocomplete#master" } } diff --git a/src/backend/game/game_settings.cpp b/src/backend/game/game_settings.cpp index 12001ede..5d33b284 100644 --- a/src/backend/game/game_settings.cpp +++ b/src/backend/game/game_settings.cpp @@ -54,6 +54,73 @@ namespace loot { _masterFile = "Oblivion.esm"; _repositoryURL = "https://github.com/loot/oblivion.git"; _repositoryBranch = "v0.8"; + + bashTags = { + "Actors.ACBS", + "Actors.AIData", + "Actors.AIPackages", + "Actors.AIPackagesForceAdd", + "Actors.Animations", + "Actors.CombatStyle", + "Actors.DeathItem", + "Actors.Skeleton", + "Actors.Spells", + "Actors.SpellsForceAdd", + "Actors.Stats", + "Body-F", + "Body-M", + "Body-Size-F", + "Body-Size-M", + "C.Climate", + "C.Light", + "C.Music", + "C.Name", + "C.Owner", + "C.RecordFlags", + "C.Water", + "Creatures.Blood", + "Deactivate", + "Delev", + "Eyes", + "Factions", + "Filter", + "Graphics", + "Hair", + "IIM", + "Invent", + "InventOnly", + "Merge", + "MustBeActiveIfImported", + "Names", + "NoMerge", + "NpcFaces", + "NpcFacesForceFullImport", + "NPC.Class", + "Npc.EyesOnly", + "Npc.HairOnly", + "NPC.Race", + "Relations", + "Relev", + "Roads", + "R.AddSpells", + "R.Attributes-F", + "R.Attributes-M", + "R.ChangeSpells", + "R.Description", + "R.Ears", + "R.Head", + "R.Mouth", + "R.Relations", + "R.Skills", + "R.Teeth", + "ScriptContents", + "Scripts", + "Sound", + "SpellStats", + "Stats", + "Voice-F", + "Voice-M", + }; } else if (Id() == GameSettings::tes5) { _name = "TES V: Skyrim"; @@ -62,6 +129,78 @@ namespace loot { _masterFile = "Skyrim.esm"; _repositoryURL = "https://github.com/loot/skyrim.git"; _repositoryBranch = "v0.8"; + + bashTags = { + "Actors.ACBS", + "Actors.AIData", + "Actors.AIPackages", + "Actors.AIPackagesForceAdd", + "Actors.Animations", + "Actors.CombatStyle", + "Actors.DeathItem", + "Actors.Skeleton", + "Actors.Spells", + "Actors.SpellsForceAdd", + "Actors.Stats", + "Body-F", + "Body-M", + "Body-Size-F", + "Body-Size-M", + "C.Acoustic", + "C.Climate", + "C.ImageSpace", + "C.Light", + "C.Location", + "C.Music", + "C.Name", + "C.Owner", + "C.RecordFlags", + "C.Regions", + "C.SkyLighting", + "C.Water", + "Creatures.Blood", + "Deactivate", + "Delev", + "Eyes", + "Factions", + "Filter", + "Graphics", + "Hair", + "IIM", + "Invent", + "InventOnly", + "Merge", + "MustBeActiveIfImported", + "Names", + "NoMerge", + "NpcFaces", + "NpcFacesForceFullImport", + "NPC.Class", + "Npc.EyesOnly", + "Npc.HairOnly", + "NPC.Race", + "Relations", + "Relev", + "Roads", + "R.AddSpells", + "R.Attributes-F", + "R.Attributes-M", + "R.ChangeSpells", + "R.Description", + "R.Ears", + "R.Head", + "R.Mouth", + "R.Relations", + "R.Skills", + "R.Teeth", + "ScriptContents", + "Scripts", + "Sound", + "SpellStats", + "Stats", + "Voice-F", + "Voice-M", + }; } else if (Id() == GameSettings::fo3) { _name = "Fallout 3"; @@ -70,6 +209,11 @@ namespace loot { _masterFile = "Fallout3.esm"; _repositoryURL = "https://github.com/loot/fallout3.git"; _repositoryBranch = "v0.8"; + + bashTags = { + "Deflst", + "Destructible", + }; } else if (Id() == GameSettings::fonv) { _name = "Fallout: New Vegas"; @@ -78,6 +222,12 @@ namespace loot { _masterFile = "FalloutNV.esm"; _repositoryURL = "https://github.com/loot/falloutnv.git"; _repositoryBranch = "v0.8"; + + bashTags = { + "Deflst", + "Destructible", + "WeaponMods", + }; } else if (Id() == GameSettings::fo4) { _name = "Fallout 4"; @@ -191,6 +341,10 @@ namespace loot { return LootPaths::getLootDataPath() / _lootFolderName / "userlist.yaml"; } + std::vector GameSettings::getSupportedBashTags() const { + return bashTags; + } + GameSettings& GameSettings::SetName(const std::string& name) { BOOST_LOG_TRIVIAL(trace) << "Setting \"" << _name << "\" name to: " << name; _name = name; diff --git a/src/backend/game/game_settings.h b/src/backend/game/game_settings.h index 2d14310e..9fa767d5 100644 --- a/src/backend/game/game_settings.h +++ b/src/backend/game/game_settings.h @@ -59,6 +59,8 @@ namespace loot { boost::filesystem::path MasterlistPath() const; boost::filesystem::path UserlistPath() const; + std::vector getSupportedBashTags() const; + GameSettings& SetName(const std::string& name); GameSettings& SetMaster(const std::string& masterFile); GameSettings& SetRegistryKey(const std::string& registry); @@ -84,6 +86,8 @@ namespace loot { std::string _repositoryBranch; boost::filesystem::path _gamePath; //Path to the game's folder. + + std::vector bashTags; }; } diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index e846afb9..7f15450a 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -701,6 +701,8 @@ namespace loot { // Now store global messages. gameNode["globalMessages"] = GetGeneralMessages(); + gameNode["bashTags"] = _lootState.CurrentGame().getSupportedBashTags(); + // Now store plugin data. for (const auto& plugin : installed) { /* Each plugin has members while hold its raw masterlist and userlist data for diff --git a/src/gui/html/elements/editable-table.html b/src/gui/html/elements/editable-table.html index 090c2e89..e3321bcb 100644 --- a/src/gui/html/elements/editable-table.html +++ b/src/gui/html/elements/editable-table.html @@ -2,6 +2,7 @@ + @@ -12,7 +13,7 @@