diff --git a/.forgejo/workflows/quest-story-arcs.yml b/.forgejo/workflows/quest-story-arcs.yml new file mode 100644 index 00000000..609adf37 --- /dev/null +++ b/.forgejo/workflows/quest-story-arcs.yml @@ -0,0 +1,51 @@ +name: Quest Arc Presentation Overlay +on: + workflow_dispatch: + push: + branches: ['feat/quest-story-arcs-*'] + +jobs: + quest-story-arcs: + runs-on: dune-ci + steps: + - name: Check out exact revision + shell: bash + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + git init . + git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/plugins.git "$GITHUB_SHA" + git checkout --detach FETCH_HEAD + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + - uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: '9.2.1' + - name: Test the journal and package only quest arc classes and art + shell: bash + run: | + set -euo pipefail + gradle --no-daemon -p DuneRealmsGUI test jar + mkdir quest-story-arcs + PYTHONPATH=tools python3 - <<'PY' + from pathlib import Path + from quest_arc_artwork import CATALOG, OVERLAY, artwork, gui_entries + from plugin_wild_update import read_archive, write_archive + source = read_archive(Path("DuneRealmsGUI/build/libs/DunerealmsGUI.jar").read_bytes()) + Path("quest-story-arcs/donor.zip").write_bytes(write_archive({entry: source[entry] for entry in gui_entries()})) + assets = artwork(Path(".")) + art = {f"{OVERLAY}/{name}": data for name, data in assets.items()} + art[CATALOG] = Path(CATALOG).read_bytes() + Path("quest-story-arcs/artwork.zip").write_bytes(write_archive(art)) + PY + cp tools/{quest_arc_artwork.py,plugin_wild_update.py} quest-story-arcs/ + printf '%s\n' "$GITHUB_SHA" > quest-story-arcs/SOURCE_COMMIT + (cd quest-story-arcs && sha256sum -- *.zip *.py SOURCE_COMMIT > SHA256SUMS) + - uses: actions/upload-artifact@v3 + with: + name: DuneRealms-Quest-Story-Arcs + path: quest-story-arcs + if-no-files-found: error diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestCategories.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestCategories.java new file mode 100644 index 00000000..a6a803d2 --- /dev/null +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestCategories.java @@ -0,0 +1,57 @@ +package com.dunerealms.gui; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.io.Reader; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.util.Set; + +/** Themed story-arc categories over the server's quest branches. Presentation only: ids, rewards and progress are never touched. */ +final class QuestCategories { + record Category(String id,String title,String tagline,String accent,String icon,List branches){} + record Group(Category category,List arcs){ + int done(){int n=0;for(var a:arcs)n+=a.done();return n;} + int total(){int n=0;for(var a:arcs)n+=a.missions().size();return n;} + int ready(){int n=0;for(var a:arcs)for(var m:a.missions())if(JournalModel.READY.equals(m.status()))n++;return n;} + boolean complete(){return total()>0&&done()==total();} + } + static final Category OTHER=new Category("other","Other Work","Quests outside the main story arcs.","#8f7a5a","quests/other",List.of()); + static final QuestCategories NONE=new QuestCategories(List.of()); + private final List categories; + QuestCategories(List categories){this.categories=List.copyOf(categories);} + boolean isEmpty(){return categories.isEmpty();} + List categories(){return categories;} + + private static String text(JsonObject o,String key){return o.has(key)&&!o.get(key).isJsonNull()?o.get(key).getAsString():"";} + /** Parses the shared catalogue. A branch may belong to one category only. */ + static QuestCategories parse(Reader reader){ + var out=new ArrayList();var seen=new HashSet();var ids=new HashSet(); + for(JsonElement e:JsonParser.parseReader(reader).getAsJsonObject().getAsJsonArray("categories")){ + var o=e.getAsJsonObject();String id=text(o,"id"); + if(id.isBlank()||!ids.add(id))throw new IllegalArgumentException("Category id missing or duplicated: "+id); + var branches=new ArrayList(); + for(JsonElement b:o.getAsJsonArray("branches")){String branch=b.getAsString();if(!seen.add(branch))throw new IllegalArgumentException("Branch listed twice: "+branch);branches.add(branch);} + out.add(new Category(id,text(o,"title"),text(o,"tagline"),text(o,"accent"),text(o,"icon"),List.copyOf(branches))); + } + return new QuestCategories(out); + } + + /** Arcs regrouped by category, in catalogue order; unmapped arcs fall to the end under {@link #OTHER}. Empty categories are omitted. */ + List group(List arcs){ + Map byId=new HashMap<>();for(var a:arcs)byId.put(a.id(),a); + Set used=new HashSet<>();var groups=new ArrayList(); + for(var category:categories){ + var members=new ArrayList(); + for(String branch:category.branches()){var arc=byId.get(branch);if(arc!=null&&used.add(branch))members.add(arc);} + if(!members.isEmpty())groups.add(new Group(category,List.copyOf(members))); + } + var rest=new ArrayList();for(var a:arcs)if(!used.contains(a.id()))rest.add(a); + if(!rest.isEmpty())groups.add(new Group(OTHER,List.copyOf(rest))); + return groups; + } +} diff --git a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestMenus.java b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestMenus.java index 2b69843e..782a5cf9 100644 --- a/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestMenus.java +++ b/DuneRealmsGUI/src/main/java/com/dunerealms/gui/QuestMenus.java @@ -21,22 +21,27 @@ final class QuestMenus implements Listener { private final MissionTracker tracker; private final Map journals=new HashMap<>(); private static final int PAGE=20; - private static final class JournalView{final String kind;final List arcs;final JsonObject data;int arc,page;String selected;JournalView(String kind,List arcs,JsonObject data){this.kind=kind;this.arcs=arcs;this.data=data;}} + private static final class JournalView{final String kind;final List all;List arcs;QuestCategories.Group group;final JsonObject data;int arc,page;String selected;JournalView(String kind,List arcs,JsonObject data){this.kind=kind;this.all=arcs;this.arcs=arcs;this.data=data;}} private final Map roleScope=new HashMap<>(); private static final class Panel implements InventoryHolder { final UUID owner;final GuiSession gate;final Map actions=new HashMap<>();final List choices=new ArrayList<>();final Inventory inventory;final String title;String description="Your current J.A.R.V.I.S. mission journal"; Panel(Player p,String title){owner=p.getUniqueId();gate=new GuiSession(owner);this.title=title;inventory=Bukkit.createInventory(this,54,Component.text(title,NamedTextColor.GOLD));} public Inventory getInventory(){return inventory;} } - QuestMenus(JavaPlugin plugin,HouseBridge bridge,Consumer back){this.plugin=plugin;this.bridge=bridge;this.back=back;tracker=new MissionTracker(plugin,bridge);Bukkit.getPluginManager().registerEvents(this,plugin);} + private final QuestCategories categories; + QuestMenus(JavaPlugin plugin,HouseBridge bridge,Consumer back){this.plugin=plugin;this.bridge=bridge;this.back=back;categories=loadCategories(plugin);tracker=new MissionTracker(plugin,bridge);Bukkit.getPluginManager().registerEvents(this,plugin);} + private static QuestCategories loadCategories(JavaPlugin plugin){try(var in=plugin.getResource("quest-categories.json")){if(in==null)return QuestCategories.NONE;return QuestCategories.parse(new java.io.InputStreamReader(in,java.nio.charset.StandardCharsets.UTF_8));}catch(Exception invalid){plugin.getLogger().warning("Quest categories unavailable; using the plain branch journal.");return QuestCategories.NONE;}} void quartermaster(Player p,Runnable exchange,Runnable kits){var s=panel(p,"Gurney · Quartermaster");put(s,20,"Exchange","Buy and sell individual items",Material.EMERALD,exchange);put(s,22,"Missions & turn-ins","Collect your House T0 kit or repair its original armour.\nPrepare four parts: one iron ingot, leather, copper ingot and quartz.\nOther missions and rewards use your current central journal.",Material.WRITABLE_BOOK,()->open(p));put(s,24,"Stillsuit kits","Published clan, company and office kits",Material.NETHERITE_CHESTPLATE,kits);put(s,31,"Organisation workshop","Upgrade your held original with researched MK and rarity templates",Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE,()->workshop(p,0));put(s,34,"Gurney\u0027s missions","Current bounty, campaign and ongoing duty missions",Material.BOOK,()->openRole(p,new PolQuestNpc.Role("gurney_halleck","Gurney Halleck",p.getWorld().getName(),"*",Set.of("bounty-jobs","war-service","repeatables","rd"),0)));put(s,49,"Close","Return to the world",Material.ARROW,p::closeInventory);show(p,s);} private static String text(JsonObject row,String key,String fallback){return row.has(key)&&!row.get(key).isJsonNull()?row.get(key).getAsString():fallback;} private static String dialogue(JsonObject row,String field,String fallback){return row.has("dialogue")&&row.get("dialogue").isJsonObject()?text(row.getAsJsonObject("dialogue"),field,fallback):fallback;} private static boolean yes(JsonObject row,String key){return row.has(key)&&!row.get(key).isJsonNull()&&row.get(key).getAsBoolean();} private static boolean website(JsonObject row){return row.has("executionRequirements")&&!row.get("executionRequirements").isJsonNull()&&yes(row.getAsJsonObject("executionRequirements"),"website")&&!yes(row.getAsJsonObject("executionRequirements"),"minecraft");} private Panel panel(Player p,String title){var screen=new Panel(p,title);var filler=new ItemStack(Material.GRAY_STAINED_GLASS_PANE);var meta=filler.getItemMeta();meta.displayName(Component.empty());filler.setItemMeta(meta);for(int i=0;i<54;i++)screen.inventory.setItem(i,filler);return screen;} - private void put(Panel panel,int slot,String title,String description,Material material,Runnable action){ - var item=new ItemStack(material);var meta=item.getItemMeta();meta.displayName(Component.text(title,NamedTextColor.GOLD));meta.lore(Arrays.stream(description.split("\n")).map(line->Component.text(line,NamedTextColor.GRAY)).toList());item.setItemMeta(meta);panel.inventory.setItem(slot,item); + private void put(Panel panel,int slot,String title,String description,Material material,Runnable action){put(panel,slot,title,description,material,null,action);} + /** Same as {@link #put} but uses a pack item model when the player has the artwork loaded. */ + private void put(Panel panel,int slot,String title,String description,Material material,String model,Runnable action){ + var viewer=model==null?null:Bukkit.getPlayer(panel.owner);boolean art=viewer!=null&&MCGUIMenus.assetsLoaded(viewer); + var item=new ItemStack(art?Material.PAPER:material);var meta=item.getItemMeta();if(art)meta.setItemModel(new NamespacedKey("dunerealms",model));meta.displayName(Component.text(title,NamedTextColor.GOLD));meta.lore(Arrays.stream(description.split("\n")).map(line->Component.text(line,NamedTextColor.GRAY)).toList());item.setItemMeta(meta);panel.inventory.setItem(slot,item); if(action==null)panel.description+="\n\n"+title+"\n"+description; if(action!=null){panel.actions.put(slot,action);panel.choices.add(new BedrockForms.Choice(title,description,action));} } @@ -75,15 +80,36 @@ final class QuestMenus implements Listener { private void divider(Panel screen,int slot){var item=new ItemStack(Material.BLACK_STAINED_GLASS_PANE);var meta=item.getItemMeta();meta.displayName(Component.empty());item.setItemMeta(meta);screen.inventory.setItem(slot,item);} private void openJournal(Player p,String kind,JsonObject data,String preferred){ var arcs=JournalModel.arcs(data);var view=new JournalView(kind,arcs,data); - view.selected=JournalModel.pick(arcs,preferred,tracker.tracked(p.getUniqueId(),kind));focus(view); + if(preferred==null&&!categories.isEmpty()){journals.put(p.getUniqueId(),view);tracker.observe(p,kind,arcs);renderCategories(p,view);return;} + view.selected=JournalModel.pick(arcs,preferred,tracker.tracked(p.getUniqueId(),kind));scope(view);focus(view); journals.put(p.getUniqueId(),view);tracker.observe(p,kind,arcs);renderJournal(p,view); } + /** Narrow the journal to the story arc that holds the selected mission. */ + private void scope(JournalView view){ + if(categories.isEmpty()||view.selected==null)return; + for(var g:categories.group(view.all))if(JournalModel.find(g.arcs(),view.selected)!=null){view.arcs=g.arcs();view.group=g;return;} + } + private void renderCategories(Player p,JournalView view){ + var screen=panel(p,(view.kind.equals("pol")?"Reputation":"Personal")+" missions · story arcs"); + var groups=categories.group(view.all); + if(groups.isEmpty()){put(screen,22,"No missions yet","Your journal fills as the season opens.",Material.BARRIER,null);put(screen,49,"Back","Mission journal",Material.ARROW,()->open(p));show(p,screen);return;} + String tracked=tracker.tracked(p.getUniqueId(),view.kind); + for(int i=0;i0?"\n"+g.ready()+" reward"+(g.ready()==1?"":"s")+" ready":"")+(g.complete()?"\nStory arc complete":""); + put(screen,slot,g.category().title(),lore,g.ready()>0?Material.ENCHANTED_BOOK:Material.WRITABLE_BOOK,g.category().icon(),()->{ + view.arcs=g.arcs();view.group=g;view.arc=0;view.page=0;view.selected=JournalModel.pick(g.arcs(),null,tracked);focus(view);renderJournal(p,view);}); + } + if(tracked!=null&&JournalModel.find(view.all,tracked)!=null)put(screen,48,"Continue tracked mission","Jump back to the mission on your boss bar.",Material.COMPASS,()->{view.selected=tracked;scope(view);focus(view);renderJournal(p,view);}); + put(screen,49,"Back","Mission journal",Material.ARROW,()->open(p));put(screen,53,"Website journal","Open your full online journal",Material.MAP,()->website(p)); + show(p,screen); + } private void focus(JournalView view){ for(int a=0;aopen(p));show(p,screen);return;} var arc=view.arcs.get(view.arc);var missions=arc.missions();int pages=Math.max(1,(missions.size()+PAGE-1)/PAGE);view.page=Math.max(0,Math.min(view.page,pages-1)); String tracked=tracker.tracked(p.getUniqueId(),view.kind); @@ -103,7 +129,7 @@ final class QuestMenus implements Listener { if(!sel.rewardConfigured())reward+="\nReward not configured yet"; put(screen,23,"Rewards",reward,Material.CHEST,null); boolean isTracked=sel.id().equals(tracked); - if(!sel.finished()&&!JournalModel.LOCKED.equals(sel.status()))put(screen,41,isTracked?"Tracking":"Track",isTracked?"Shown on your boss bar.":"Show this mission on your boss bar.",Material.COMPASS,isTracked?null:()->{tracker.track(p.getUniqueId(),view.kind,sel.id());tracker.observe(p,view.kind,view.arcs);renderJournal(p,view);}); + if(!sel.finished()&&!JournalModel.LOCKED.equals(sel.status()))put(screen,41,isTracked?"Tracking":"Track",isTracked?"Shown on your boss bar.":"Show this mission on your boss bar.",Material.COMPASS,isTracked?null:()->{tracker.track(p.getUniqueId(),view.kind,sel.id());tracker.observe(p,view.kind,view.all);renderJournal(p,view);}); if(!sel.finished()&&!JournalModel.LOCKED.equals(sel.status())&&!sel.webOnly())put(screen,33,"Mission steps","Briefings, turn-ins and special steps\nfor this mission.",Material.BELL,()->{ JsonObject row=null;for(var entry:view.data.getAsJsonArray("quests"))if(sel.id().equals(text(entry.getAsJsonObject(),"id","")))row=entry.getAsJsonObject(); if(row!=null)details(p,view.kind,view.data,text(row,"branch",""),0,row);}); @@ -123,6 +149,7 @@ final class QuestMenus implements Listener { if(view.page>0)put(screen,50,"Previous page","Page "+view.page+" of "+pages,Material.PAPER,()->{view.page--;renderJournal(p,view);}); if(view.page{view.page++;renderJournal(p,view);}); } + if(!categories.isEmpty())put(screen,48,"Story arcs","Choose another story arc",Material.BOOKSHELF,()->{view.arcs=view.all;view.group=null;renderCategories(p,view);}); put(screen,49,"Back","Mission journal",Material.ARROW,()->open(p));put(screen,53,"Website journal","Open your full online journal",Material.MAP,()->website(p)); show(p,screen); } diff --git a/DuneRealmsGUI/src/main/resources/quest-categories.json b/DuneRealmsGUI/src/main/resources/quest-categories.json new file mode 100644 index 00000000..9f588c56 --- /dev/null +++ b/DuneRealmsGUI/src/main/resources/quest-categories.json @@ -0,0 +1,19 @@ +{ + "version": 1, + "note": "Presentation only. Groups existing quest branches into themed story arcs. Quest ids, rewards, prerequisites and progress are untouched. Branches not listed here appear under 'Other Work'.", + "categories": [ + {"id":"arrival","title":"Arrival","tagline":"First steps beneath a foreign sun.","accent":"#d9b66a","icon":"quests/arrival","branches":["a"]}, + {"id":"coin","title":"Coin of the Realm","tagline":"Solari, ledgers and honest weights.","accent":"#cfa24a","icon":"quests/coin","branches":["b"]}, + {"id":"melange","title":"The Melange Path","tagline":"From raw sand to refined spice.","accent":"#e29a3f","icon":"quests/melange","branches":["c","spice-harvesting","spice-upgrading"]}, + {"id":"deep-desert","title":"Deep Desert","tagline":"Walk where the worms walk.","accent":"#c98b54","icon":"quests/deep-desert","branches":["d","discoveries"]}, + {"id":"place","title":"A Place in the Realm","tagline":"Earn a name, a trade and a seat at the table.","accent":"#bfa77a","icon":"quests/place","branches":["e","f","g"]}, + {"id":"armoury","title":"The Armoury","tagline":"Stillsuits, steel and good design.","accent":"#a89572","icon":"quests/armoury","branches":["h","i","acquisitions"]}, + {"id":"landsraad","title":"The Landsraad Game","tagline":"Four Houses. One game. No mercy.","accent":"#b9863f","icon":"quests/landsraad","branches":["atreides","harkonnen","corrino","ordos"]}, + {"id":"sons","title":"Sons of the Sand","tagline":"Water discipline, worm-sign and tribe.","accent":"#d28b3c","icon":"quests/sons","branches":["fremen","fremen-husbandry"]}, + {"id":"prophecy","title":"The Prophecy","tagline":"Faith, fear and the long game.","accent":"#d8c79a","icon":"quests/prophecy","branches":["faith-sisterhood","faith-church","bene"]}, + {"id":"lanes","title":"Lanes and Shadows","tagline":"Guild lanes, smugglers' routes and hunted bounties.","accent":"#b07a4a","icon":"quests/lanes","branches":["guild","smugglers","bounty-jobs"]}, + {"id":"contracts","title":"Contracts of the Realm","tagline":"Work for clan and company.","accent":"#c3a060","icon":"quests/contracts","branches":["clan","company"]}, + {"id":"wings","title":"Wings across the Realms","tagline":"Five worlds. One elytra.","accent":"#e0c27c","icon":"quests/wings","branches":["elytra"]}, + {"id":"campaign","title":"Campaign Banners","tagline":"Banners raised, ground held.","accent":"#b5653f","icon":"quests/campaign","branches":["war-service"]} + ] +} diff --git a/DuneRealmsGUI/src/test/java/com/dunerealms/gui/QuestCategoriesTest.java b/DuneRealmsGUI/src/test/java/com/dunerealms/gui/QuestCategoriesTest.java new file mode 100644 index 00000000..4d603c8d --- /dev/null +++ b/DuneRealmsGUI/src/test/java/com/dunerealms/gui/QuestCategoriesTest.java @@ -0,0 +1,66 @@ +package com.dunerealms.gui; + +import static org.junit.jupiter.api.Assertions.*; + +import com.google.gson.JsonParser; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import org.junit.jupiter.api.Test; + +class QuestCategoriesTest { + private static final List PERSONAL=List.of("a","b","c","d","e","f","g","h","i","discoveries","acquisitions"); + private static final List POL=List.of("atreides","harkonnen","corrino","ordos","fremen","bene","guild","smugglers","clan","company","faith-sisterhood","faith-church","fremen-husbandry","bounty-jobs","spice-upgrading","elytra","war-service","spice-harvesting"); + + private static QuestCategories shipped(){ + var in=QuestCategoriesTest.class.getResourceAsStream("/quest-categories.json");assertNotNull(in,"quest-categories.json must ship with the plugin"); + return QuestCategories.parse(new InputStreamReader(in,StandardCharsets.UTF_8)); + } + private static List arcs(String... branches){ + var quests=new StringBuilder(); + for(int i=0;i0?",":"").append("{\"id\":\"").append(branches[i]).append("-1\",\"title\":\"T\",\"branch\":\"").append(branches[i]).append("\",\"metric\":\"m\",\"target\":1,\"progress\":0,\"state\":\"not-started\"}"); + return JournalModel.arcs(JsonParser.parseString("{\"state\":\"active\",\"quests\":["+quests+"]}").getAsJsonObject()); + } + + @Test void shippedCatalogueIsWellFormedAndCoversEveryKnownBranch(){ + var c=shipped();assertEquals(13,c.categories().size()); + var ids=new java.util.HashSet();var branches=new java.util.HashSet(); + for(var cat:c.categories()){ + assertTrue(ids.add(cat.id()));assertFalse(cat.title().isBlank());assertFalse(cat.tagline().isBlank()); + assertEquals("quests/"+cat.id(),cat.icon());assertTrue(cat.accent().matches("#[0-9a-f]{6}")); + assertFalse(cat.branches().isEmpty());branches.addAll(cat.branches()); + } + var known=new ArrayList<>(PERSONAL);known.addAll(POL); + for(String branch:known)assertTrue(branches.contains(branch),"unmapped branch "+branch); + } + @Test void groupsFollowTheCatalogueNotTheDataOrder(){ + var groups=shipped().group(arcs("elytra","atreides","a","c","spice-upgrading","ordos")); + assertEquals(List.of("arrival","melange","landsraad","wings"),groups.stream().map(g->g.category().id()).toList()); + assertEquals(List.of("c","spice-upgrading"),groups.get(1).arcs().stream().map(JournalModel.Arc::id).toList()); + assertEquals(List.of("atreides","ordos"),groups.get(2).arcs().stream().map(JournalModel.Arc::id).toList()); + } + @Test void unmappedBranchesAreNeverHidden(){ + var groups=shipped().group(arcs("a","brand-new-branch")); + assertEquals("other",groups.get(groups.size()-1).category().id()); + assertEquals(List.of("brand-new-branch"),groups.get(groups.size()-1).arcs().stream().map(JournalModel.Arc::id).toList()); + } + @Test void everyMissionAppearsExactlyOnce(){ + var all=new ArrayList<>(PERSONAL);all.addAll(POL);all.add("mystery"); + var input=arcs(all.toArray(String[]::new));var seen=new java.util.HashSet();int total=0; + for(var g:shipped().group(input))for(var a:g.arcs())for(var m:a.missions()){assertTrue(seen.add(m.id()));total++;} + assertEquals(all.size(),total); + } + @Test void progressCountsComeFromTheMissions(){ + var data=JsonParser.parseString("{\"state\":\"active\",\"quests\":[{\"id\":\"x1\",\"title\":\"A\",\"branch\":\"guild\",\"metric\":\"m\",\"target\":1,\"progress\":1,\"state\":\"claimed\"},{\"id\":\"x2\",\"title\":\"B\",\"branch\":\"guild\",\"metric\":\"m\",\"target\":1,\"progress\":1,\"state\":\"completed\",\"canClaim\":true,\"requires\":[\"x1\"]},{\"id\":\"x3\",\"title\":\"C\",\"branch\":\"smugglers\",\"metric\":\"m\",\"target\":1,\"progress\":0,\"state\":\"not-started\"}]}").getAsJsonObject(); + var g=shipped().group(JournalModel.arcs(data)).get(0); + assertEquals("lanes",g.category().id());assertEquals(1,g.done());assertEquals(3,g.total());assertEquals(1,g.ready());assertFalse(g.complete()); + } + @Test void duplicateBranchOrCategoryIsRejected(){ + assertThrows(IllegalArgumentException.class,()->QuestCategories.parse(new StringReader("{\"categories\":[{\"id\":\"x\",\"title\":\"X\",\"branches\":[\"a\"]},{\"id\":\"y\",\"title\":\"Y\",\"branches\":[\"a\"]}]}"))); + assertThrows(IllegalArgumentException.class,()->QuestCategories.parse(new StringReader("{\"categories\":[{\"id\":\"x\",\"title\":\"X\",\"branches\":[\"a\"]},{\"id\":\"x\",\"title\":\"Y\",\"branches\":[\"b\"]}]}"))); + } + @Test void missingCatalogueFallsBackToThePlainJournal(){assertTrue(QuestCategories.NONE.isEmpty());} +} diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/armoury.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/armoury.json new file mode 100644 index 00000000..c40de394 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/armoury.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/armoury"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/arrival.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/arrival.json new file mode 100644 index 00000000..f1158bc0 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/arrival.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/arrival"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/campaign.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/campaign.json new file mode 100644 index 00000000..ffb2dbd5 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/campaign.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/campaign"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/coin.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/coin.json new file mode 100644 index 00000000..ffa12ab7 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/coin.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/coin"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/contracts.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/contracts.json new file mode 100644 index 00000000..43dd8b88 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/contracts.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/contracts"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/deep-desert.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/deep-desert.json new file mode 100644 index 00000000..b4984f58 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/deep-desert.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/deep-desert"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/landsraad.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/landsraad.json new file mode 100644 index 00000000..2e6578fc --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/landsraad.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/landsraad"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/lanes.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/lanes.json new file mode 100644 index 00000000..550d4069 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/lanes.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/lanes"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/melange.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/melange.json new file mode 100644 index 00000000..7eeeee84 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/melange.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/melange"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/other.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/other.json new file mode 100644 index 00000000..fc9b0bdb --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/other.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/other"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/place.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/place.json new file mode 100644 index 00000000..21d8e728 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/place.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/place"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/prophecy.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/prophecy.json new file mode 100644 index 00000000..3fa6c7d5 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/prophecy.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/prophecy"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/sons.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/sons.json new file mode 100644 index 00000000..97fef9f7 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/sons.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/sons"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/items/quests/wings.json b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/wings.json new file mode 100644 index 00000000..54261b2b --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/items/quests/wings.json @@ -0,0 +1 @@ +{"model": {"type": "minecraft:model", "model": "dunerealms:item/quests/wings"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/armoury.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/armoury.json new file mode 100644 index 00000000..cd4a37f2 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/armoury.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/armoury"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/arrival.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/arrival.json new file mode 100644 index 00000000..ab8eeb51 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/arrival.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/arrival"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/campaign.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/campaign.json new file mode 100644 index 00000000..ed1f19e9 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/campaign.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/campaign"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/coin.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/coin.json new file mode 100644 index 00000000..dd1d698b --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/coin.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/coin"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/contracts.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/contracts.json new file mode 100644 index 00000000..73286cb1 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/contracts.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/contracts"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/deep-desert.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/deep-desert.json new file mode 100644 index 00000000..50786d4f --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/deep-desert.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/deep-desert"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/landsraad.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/landsraad.json new file mode 100644 index 00000000..ddc264bd --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/landsraad.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/landsraad"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/lanes.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/lanes.json new file mode 100644 index 00000000..1657580a --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/lanes.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/lanes"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/melange.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/melange.json new file mode 100644 index 00000000..02d8738a --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/melange.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/melange"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/other.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/other.json new file mode 100644 index 00000000..a70d68be --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/other.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/other"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/place.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/place.json new file mode 100644 index 00000000..2c1c99ef --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/place.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/place"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/prophecy.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/prophecy.json new file mode 100644 index 00000000..1abc1829 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/prophecy.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/prophecy"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/sons.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/sons.json new file mode 100644 index 00000000..afd9ee8e --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/sons.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/sons"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/wings.json b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/wings.json new file mode 100644 index 00000000..cc569476 --- /dev/null +++ b/network/resource-pack/central/overlay/assets/dunerealms/models/item/quests/wings.json @@ -0,0 +1 @@ +{"parent": "minecraft:item/generated", "textures": {"layer0": "dunerealms:item/quests/wings"}} \ No newline at end of file diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/armoury.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/armoury.png new file mode 100644 index 00000000..d25aaf7c Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/armoury.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/arrival.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/arrival.png new file mode 100644 index 00000000..ee6256f3 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/arrival.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/campaign.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/campaign.png new file mode 100644 index 00000000..38a09728 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/campaign.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/coin.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/coin.png new file mode 100644 index 00000000..d9c1b09b Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/coin.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/contracts.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/contracts.png new file mode 100644 index 00000000..aa13f813 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/contracts.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/deep-desert.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/deep-desert.png new file mode 100644 index 00000000..d20c30b4 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/deep-desert.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/landsraad.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/landsraad.png new file mode 100644 index 00000000..d9ac9627 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/landsraad.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/lanes.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/lanes.png new file mode 100644 index 00000000..8cbf2a29 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/lanes.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/melange.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/melange.png new file mode 100644 index 00000000..bfce44b4 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/melange.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/other.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/other.png new file mode 100644 index 00000000..aa13f813 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/other.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/place.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/place.png new file mode 100644 index 00000000..68e4b16b Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/place.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/prophecy.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/prophecy.png new file mode 100644 index 00000000..240b87d4 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/prophecy.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/sons.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/sons.png new file mode 100644 index 00000000..cbfb465d Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/sons.png differ diff --git a/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/wings.png b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/wings.png new file mode 100644 index 00000000..e8d63e45 Binary files /dev/null and b/network/resource-pack/central/overlay/assets/dunerealms/textures/item/quests/wings.png differ diff --git a/tools/quest_arc_artwork.py b/tools/quest_arc_artwork.py new file mode 100644 index 00000000..11f4d441 --- /dev/null +++ b/tools/quest_arc_artwork.py @@ -0,0 +1,104 @@ +"""Add the reviewed quest arc artwork to the retained network pack or DuneMenus artwork cache.""" +import argparse +import json +from pathlib import Path +import struct + +from plugin_wild_update import digest, read_archive, write_archive + +NETWORK_SHA256 = "8a1bd9c2784be4231ffd2f29e9dbcb43a04eb69a5c14966077084a916769fd84" +ASSETS = "assets/dunerealms/" +CATALOG = "DuneRealmsGUI/src/main/resources/quest-categories.json" +OVERLAY = "network/resource-pack/central/overlay" +GUI_PREFIX = "com/dunerealms/gui/" +GUI_CHANGED = ("QuestMenus.class", "QuestMenus$JournalView.class") +GUI_ADDED = ("QuestCategories.class", "QuestCategories$Category.class", "QuestCategories$Group.class") +GUI_CATALOG = "quest-categories.json" +GUI_BASELINES = { + "e015af5c7f063b4ec2be51ce586376cf3a350be4dfa832032a027e8d9513b429", + "19157b96c1802ece522e0560020a93ec87ca78815c7a823406ac61650c999e5d", +} +MENU_BASELINES = { + "75bf2b32df6f516079c8ef53c49e58db7fc415e7306043073ca378988a7c4838", + "4f5a9f9c4ddb4f0c76e3d7565aa4ba58064b18ee6675ba9400f855a9329e81fd", +} +MENU_PREFIX = "menu-art/pack/" + + +def artwork(source): + catalog = json.loads((source / CATALOG).read_text(encoding="utf-8")) + ids = {category["id"] for category in catalog["categories"]} | {"other"} + if len(ids) != 14: + raise ValueError("Expected the thirteen story arcs and Other Work") + overlay = source / OVERLAY + paths = {} + for arc in sorted(ids): + model = f"{ASSETS}models/item/quests/{arc}.json" + definition = f"{ASSETS}items/quests/{arc}.json" + image = f"{ASSETS}textures/item/quests/{arc}.png" + definition_data = (overlay / definition).read_bytes() + model_data = (overlay / model).read_bytes() + image_data = (overlay / image).read_bytes() + if json.loads(definition_data)["model"] != { + "type": "minecraft:model", + "model": f"dunerealms:item/quests/{arc}", + }: + raise ValueError(f"Unexpected item definition for {arc}") + if json.loads(model_data)["textures"]["layer0"] != f"dunerealms:item/quests/{arc}": + raise ValueError(f"Unexpected texture reference for {arc}") + if image_data[:16] != b"\x89PNG\r\n\x1a\n\x00\x00\x00\x0dIHDR" or struct.unpack( + ">II", image_data[16:24] + ) != (32, 32): + raise ValueError(f"Expected a 32px PNG for {arc}") + paths.update({definition: definition_data, model: model_data, image: image_data}) + return paths + + +def gui_entries(): + return [*(GUI_PREFIX + name for name in (*GUI_CHANGED, *GUI_ADDED)), GUI_CATALOG] + + +def assemble(source, baseline, output, target, baseline_sha=None, donor=None, donor_sha=None): + existing = baseline.read_bytes() + accepted = {"network": {NETWORK_SHA256}, "menus": MENU_BASELINES, "gui": GUI_BASELINES} + actual = digest(existing) + if actual not in accepted[target] or baseline_sha is not None and actual != baseline_sha: + raise ValueError("Unexpected retained archive checksum") + base = read_archive(existing) + if target == "gui": + compiled = donor.read_bytes() + if digest(compiled) != donor_sha: + raise ValueError("Unexpected quest journal donor checksum") + payload = read_archive(compiled) + if set(payload) != set(gui_entries()) or payload[GUI_CATALOG] != (source / CATALOG).read_bytes(): + raise ValueError("Unexpected quest journal donor entries") + expected_overlap = {GUI_PREFIX + name for name in GUI_CHANGED} + if set(payload) & set(base) != expected_overlap: + raise ValueError("Unexpected existing quest journal entries") + base.update(payload) + count = len(payload) + else: + added = artwork(source) + if target == "menus": + if "com/dunerealms/menus/MenuArt.class" not in base: + raise ValueError("Expected the retained DuneMenus artwork resolver") + added = {MENU_PREFIX + name: contents for name, contents in added.items()} + if set(added) & set(base): + raise ValueError("Quest artwork already exists in the retained archive") + base.update(added) + count = len(added) + with output.open("xb") as candidate: + candidate.write(write_archive(base)) + print(f"{target}: applied {count} files, SHA256 {digest(output.read_bytes())}") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("source", type=Path) + parser.add_argument("baseline", type=Path) + parser.add_argument("output", type=Path) + parser.add_argument("target", choices=("network", "menus", "gui")) + parser.add_argument("--baseline-sha") + parser.add_argument("--donor", type=Path) + parser.add_argument("--donor-sha") + assemble(**vars(parser.parse_args())) diff --git a/tools/test_plugin_resource_pack.py b/tools/test_plugin_resource_pack.py index 49397327..7d74bd76 100644 --- a/tools/test_plugin_resource_pack.py +++ b/tools/test_plugin_resource_pack.py @@ -94,7 +94,12 @@ class CompletePackTests(unittest.TestCase): from plugin_spice_cookers import ASSETS as COOKER_ASSETS for asset in COOKER_ASSETS: self.assertEqual(files[asset],(pack.SOURCE/'overlay'/asset).read_bytes()) - self.assertEqual(set(files),set(baseline)|set(changes)|{'CREDITS-Excalibur.txt'}|native_items|ASSETS|COOKER_ASSETS) + from quest_arc_artwork import artwork as quest_artwork + quest_assets=quest_artwork(pack.ROOT) + self.assertEqual(len(quest_assets),42) + for asset,payload in quest_assets.items(): + self.assertEqual(files[asset],payload,asset) + self.assertEqual(set(files),set(baseline)|set(changes)|{'CREDITS-Excalibur.txt'}|native_items|ASSETS|COOKER_ASSETS|set(quest_assets)) else:self.assertEqual(set(files),set(baseline)) # Only the approved redesigned jerboa models and texture replace the owner baseline. changes.update({