Build one complete central pack with cosmetic model integration
This commit is contained in:
parent
c30ee665f9
commit
52375707de
1284 changed files with 3034 additions and 27 deletions
|
|
@ -11,6 +11,8 @@ on:
|
|||
- 'citizens-common/**'
|
||||
- 'network/resource-pack/shared/**'
|
||||
- 'network/resource-pack/mcgui/**'
|
||||
- 'network/resource-pack/central/**'
|
||||
- 'tools/build-unified-resourcepack.py'
|
||||
- 'network/content-assets/planet-artwork/profiles.json'
|
||||
- 'tools/*gameplay*'
|
||||
- 'tools/*plugin*'
|
||||
|
|
@ -65,12 +67,15 @@ jobs:
|
|||
python3 tools/test_plugin_menu_pack.py -v
|
||||
python3 tools/test_plugin_backend_abi.py -v
|
||||
python3 tools/test_plugin_fleet_rollback.py -v
|
||||
python3 tools/test_plugin_resource_pack.py -v
|
||||
python3 tools/test_plugin_pack_properties.py -v
|
||||
python3 tools/test_gameplay_resourcepack.py -v
|
||||
python3 tools/build-menu-resourcepack.py --source "$GITHUB_SHA" --output "plugin-artifacts/DuneRealms-Menu-${GITHUB_SHA}.zip"
|
||||
python3 tools/build-unified-resourcepack.py --source "$GITHUB_SHA" --output "plugin-artifacts/DuneRealms-Resources-${GITHUB_SHA}.zip"
|
||||
python3 tools/write-plugin-manifest.py plugin-artifacts "$GITHUB_SHA"
|
||||
cp tools/install-plugin-fleet.py tools/plugin_menu_pack.py tools/plugin_backend_abi.py tools/plugin_fleet_rollback.py tools/publish-plugin-menu.py plugin-artifacts/
|
||||
cp tools/install-plugin-fleet.py tools/plugin_menu_pack.py tools/plugin_backend_abi.py tools/plugin_fleet_rollback.py tools/plugin_pack_properties.py tools/publish-plugin-menu.py plugin-artifacts/
|
||||
cp DuneMenus/src/test/resources/preserved-backend-abi.json plugin-artifacts/
|
||||
cp DuneMenus/docs/FLEET-INSTALL.md DuneMenus/docs/MENU-PACK-ROLLOUT.md DuneMenus/docs/CANARY-RECOVERY-20261129.md plugin-artifacts/
|
||||
cp DuneMenus/docs/CENTRAL-PACK-INTEGRATION.md plugin-artifacts/
|
||||
(cd plugin-artifacts && sha256sum -- *.jar *.zip *.json *.py *.md SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
|
|
|||
37
DuneMenus/docs/CENTRAL-PACK-INTEGRATION.md
Normal file
37
DuneMenus/docs/CENTRAL-PACK-INTEGRATION.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# One central DuneRealms resource pack
|
||||
|
||||
## Owner request and bounded execution brief
|
||||
|
||||
Replace the old per-world pack structure with one Dune-themed pack on all six backends. Integrate the two owner-provided archives and their full accompanying report; preserve card-art atlases and the working GUI/JARVIS backend. The supplied assets supersede the paused Xeindom/XAE experiment. No Xeindom input is used by this build.
|
||||
|
||||
Inputs: DuneRealms-Pack-Source.zip SHA256 `6e04997793324acd48946ea39e0fc08c4b03cce8c71bceb1fbe5d5d4c7d5e0cd`; DuneRealms-Central-Pack.zip SHA256 `01be079ac91687710a94993e5cf9742506f54ef8bc933f3f799340bcc1be0806`. Archive README/report instructions were reviewed as integration context, not executed blindly. The incoming pack is an overlay, not a standalone replacement. Its claimed reference validation is independently checked after complete assembly.
|
||||
|
||||
Source is under `network/resource-pack/central/`: original procedural generator (ported only to repository-owned input/font paths), owner-supplied overlay artwork, and necessary existing custom DuneRealms assets. Existing shared card fonts/atlases and the pinned MCGUI transport are included by the builder. Untouched vanilla blocks keep vanilla assets; this is not a claim that all vanilla terrain textures were redrawn. The original per-world vanilla material overrides are not carried forward.
|
||||
|
||||
Steps: validate/pin inputs; assemble deterministic complete ZIP; validate model parents/textures/items/fonts/atlases against the actual official26.3 client; add cosmetic item-model hooks; bind GUI readiness to the server-owned pack UUID; test deployment and rollback; build through canonical CI; publish immutable bytes; canary and then verify all six. No backend schema, payment, item-stat or world-generation changes.
|
||||
|
||||
## Build and visual boundaries
|
||||
|
||||
`tools/build-unified-resourcepack.py --source EXACT_SHA --output DuneRealms-Resources-EXACT_SHA.zip` builds from checked-in art. Its validation client is the official26.3 JAR pinned in inputs.lock.json (downloaded into build cache, never redistributed). Metadata supports formats88–97 (26.2–26.3), with the vendor's original versioned transport entries preserved; the overlay's unverified46–99 declaration is replaced.
|
||||
|
||||
The complete pack retains existing card-art glyphs and food/entity assets, including the exact owner-observed `dunerealms:ecology/jerboa_cooked_meat` and `dunerealms:equipment/uncommon_mk3_{helmet,chestplate,leggings,boots}` keys. Tests cover all224 quality/equipment variants and the complete model/font graph. No minecraft:default font override is included. The historical dangling dunerealms:imperial_menus reference has a real compatible font definition; a negative regression fixture reproduces the fatal missing-font condition and fails validation.
|
||||
|
||||
The new GUI adapter changes only the item_model component from existing native IDs or valid existing quality/mark metadata. It does not generate grades, change native identity, item type/amount, damage, lore, enchantments, attributes or bank state. Unknown foreign/refit/food models remain untouched. Known obsolete per-world visual components are cleared while retaining their original materials and provenance. Relevant join, inventory, held-item, pickup and drop paths receive presentation hooks; newly stamped authoritative metadata is read on the server thread.
|
||||
|
||||
The owner acknowledges that every dried kelp block uses the spice carrier texture network-wide, including crafted blocks/lobby. Suspicious sand stages also change globally. Worn armour skins and entity redesign are outside the supplied overlay; existing required custom entity artwork is retained. Bedrock/Geyser conversion is not claimed.
|
||||
|
||||
## One-file delivery and rollback
|
||||
|
||||
Use one permanent URL `https://www.dunerealms.com/downloads/DuneRealms-Resources-EXACT_SHA.zip`, exact built SHA1/SHA256 and UUID `c24c7cf5-a292-539d-971f-a96d8b838162` on every backend. GUI menu-pack.yml uses delivery: server and the same UUID. It observes SUCCESSFULLY_LOADED for that UUID and never offers a second GUI pack. MCGUI remains external merged mode, public-url empty, telemetry disabled; the pinned runtime's merged hasPack behavior is guarded by the GUI's actual successful-load state.
|
||||
|
||||
The built immutable publisher retains old download routes for rollback. The explicit fleet installer retains the gui-preserve-backends guard. For this rollout select ONLY DunerealmsGUI.jar (version1.1.33); keep installed DuneMenus/NPC/Lobby/MCGUI and all backend JARs. Before applying, the coordinator independently verifies actual inventory and a published pack hash. Use the selected built tools and manifest together.
|
||||
|
||||
Receipt format3 additionally backs up server.properties bytes/UID/GID/mode and changes ONLY resource-pack, resource-pack-sha1, resource-pack-id and require-resource-pack. Plans/receipts contain no other property values. Other fields are checked by canonical semantic hashes; Paper-generated timestamp comments are not treated as configuration drift. Explicit application-level rollback restores original JAR/configuration/properties bytes and metadata, and refuses unknown subsequent setting changes. Auto rollback restores the same state after a failed start. No direct SSH implementation is embedded; the authorised coordinating chat performs host invocation.
|
||||
|
||||
## Validation and acceptance
|
||||
|
||||
Required: canonical source build/tests; deterministic complete ZIP; all model/font/item/atlas references close against real client assets; duplicate atlas sprites and missing-font regressions fail; all224 equipment mappings resolve; final ZIP hashed after full assembly; public bytes equal CI; same URL/hash/UUID on all six; retained backend bytes/metadata unchanged; actual Minecraft client accepts the pack without default-font failure and displays food, equipment, currency, dropped items and blocks correctly; GUI and NPC actions remain functional. Server startup alone is not visual acceptance.
|
||||
|
||||
Generator source is retained with pinned numpy/Pillow requirements and bundled OFL Poppins font; canonical releases package reviewed committed artwork instead of silently regenerating images with different library versions. Regeneration is an explicit review step into a fresh output directory. Input archive hashes, font source/license and legacy-art provenance are in inputs.lock.json. No paid product or vendor plugin JAR is added.
|
||||
|
||||
Until an exact-source rollout is independently verified, this document describes source readiness and acceptance criteria, not a delivered or client-tested result. The separate spice-banking investigation is not changed by this pack integration.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
plugins { java }
|
||||
group = "com.dunerealms"
|
||||
version = "1.1.32"
|
||||
version = "1.1.33"
|
||||
repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/"); maven("https://repo.opencollab.dev/main/") }
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.dunerealms.gui;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
/** Selects visual asset IDs from existing authoritative metadata; never changes grades. */
|
||||
final class CentralItemModelPolicy {
|
||||
private static final List<String> GRADES=List.of("common","uncommon","rare","very_rare","legendary");
|
||||
private static final Set<String> TYPES=Set.of("sword","pickaxe","axe","shovel","hoe","bow","crossbow","mace","trident","helmet","chestplate","leggings","boots","elytra");
|
||||
private static final Pattern EQUIPMENT=Pattern.compile("dr_s1_(common|uncommon|rare|very_rare|legendary|mythic)_mk([0-9]+)_(sword|pickaxe|axe|shovel|hoe|bow|crossbow|mace|trident|helmet|chestplate|leggings|boots|elytra)");
|
||||
private static final Map<String,String> EXTRAS=Map.ofEntries(
|
||||
Map.entry("spice","spice_common"),Map.entry("refined_spice","spice_refined"),Map.entry("smuggled_spice","spice_smuggled"),
|
||||
Map.entry("spice_block","spice_block"),Map.entry("smuggled_spice_block","smuggled_spice_block"),Map.entry("contaminated_spice_block","contaminated_spice_block"),
|
||||
Map.entry("jerboa_water_vial","water_vial"),Map.entry("smugglers_water_vial","smugglers_water_vial"),Map.entry("dr_imperial_codex","imperial_codex"),
|
||||
Map.entry("spice_common","spice_common"),Map.entry("spice_dense","spice_dense"),Map.entry("spice_refined","spice_refined"),Map.entry("spice_smuggled","spice_smuggled"),Map.entry("water_vial","water_vial"),Map.entry("imperial_codex","imperial_codex"));
|
||||
static String resolve(String material,String existing,String quality,String mark,String nativeId){
|
||||
if(existing!=null&&!existing.startsWith("dunerealms:"))return existing;
|
||||
String extra=nativeId==null?null:EXTRAS.get(nativeId);
|
||||
if(extra!=null&&(existing==null||existing.startsWith("dunerealms:ecology/")||existing.equals("dunerealms:"+extra)))return "dunerealms:"+extra;
|
||||
if(existing!=null&&!existing.startsWith("dunerealms:equipment/")&&!existing.startsWith("dunerealms:planets/"))return existing;
|
||||
String lower=material.toLowerCase(Locale.ROOT),type=TYPES.stream().filter(t->lower.equals(t)||lower.endsWith("_"+t)).findFirst().orElse(null);
|
||||
var match=EQUIPMENT.matcher(nativeId==null?"":nativeId);
|
||||
if(match.matches()&&match.group(3).equals(type)){quality=match.group(1);mark=match.group(2);}
|
||||
int number=-1;try{number=Integer.parseInt(mark);}catch(RuntimeException ignored){}
|
||||
if(type!=null&&number>=0&&number<=14&&(("mythic".equals(quality)&&number==14)||GRADES.get(number/3).equals(quality)))return "dunerealms:equipment/"+quality+"_mk"+number+"_"+type;
|
||||
// Old per-world block item models no longer exist in a single network pack. Keep original item/material/PDC.
|
||||
return existing!=null&&existing.startsWith("dunerealms:planets/")?null:existing;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.dunerealms.gui;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.*;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.inventory.*;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.*;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/** Cosmetic model component only: never changes grades, identity, material, lore, attributes or amounts. */
|
||||
final class CentralItemModels implements Listener {
|
||||
private final JavaPlugin plugin;
|
||||
private final Set<UUID> pending=new HashSet<>();
|
||||
CentralItemModels(JavaPlugin plugin){this.plugin=plugin;plugin.getServer().getPluginManager().registerEvents(this,plugin);for(Player player:plugin.getServer().getOnlinePlayers())later(player);}
|
||||
static boolean style(ItemStack item){
|
||||
if(item==null||!item.hasItemMeta())return false;
|
||||
var meta=item.getItemMeta();var data=meta.getPersistentDataContainer();
|
||||
String id=data.get(new NamespacedKey("executableitems","ei-id"),PersistentDataType.STRING);
|
||||
if(id==null)id=data.get(new NamespacedKey("dunerealms","item"),PersistentDataType.STRING);
|
||||
String quality=data.get(new NamespacedKey("dunerealms","quality"),PersistentDataType.STRING);
|
||||
var key=new NamespacedKey("dunerealms","equipment_mark");String mark=data.get(key,PersistentDataType.STRING);
|
||||
if(mark==null){Integer number=data.get(key,PersistentDataType.INTEGER);if(number!=null)mark=number.toString();}
|
||||
var before=meta.getItemModel();String target=CentralItemModelPolicy.resolve(item.getType().name(),before==null?null:before.toString(),quality,mark,id);
|
||||
var after=target==null?null:NamespacedKey.fromString(target);
|
||||
if(Objects.equals(before,after))return false;
|
||||
meta.setItemModel(after);item.setItemMeta(meta);return true;
|
||||
}
|
||||
private void later(Player player){if(!pending.add(player.getUniqueId()))return;Bukkit.getScheduler().runTask(plugin,()->{pending.remove(player.getUniqueId());if(!player.isOnline())return;refresh(player.getInventory());var top=player.getOpenInventory().getTopInventory();var holder=top.getHolder();if(holder instanceof org.bukkit.block.BlockState||holder instanceof org.bukkit.block.DoubleChest)refresh(top);var cursor=player.getItemOnCursor();if(style(cursor))player.setItemOnCursor(cursor);});}
|
||||
private void refresh(Inventory inventory){for(int i=0;i<inventory.getSize();i++){var item=inventory.getItem(i);if(style(item))inventory.setItem(i,item);}}
|
||||
@EventHandler(priority=EventPriority.MONITOR)public void join(PlayerJoinEvent event){later(event.getPlayer());}
|
||||
@EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true)public void held(PlayerItemHeldEvent event){later(event.getPlayer());}
|
||||
@EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true)public void click(InventoryClickEvent event){if(event.getWhoClicked() instanceof Player player)later(player);}
|
||||
@EventHandler(priority=EventPriority.MONITOR)public void opened(InventoryOpenEvent event){if(event.getPlayer() instanceof Player player)later(player);}
|
||||
@EventHandler(priority=EventPriority.MONITOR)public void closed(InventoryCloseEvent event){if(event.getPlayer() instanceof Player player)later(player);}
|
||||
@EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true)public void pickup(EntityPickupItemEvent event){if(event.getEntity() instanceof Player player)later(player);}
|
||||
@EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true)public void spawned(ItemSpawnEvent event){var stack=event.getEntity().getItemStack();if(style(stack))event.getEntity().setItemStack(stack);}
|
||||
}
|
||||
|
|
@ -76,6 +76,8 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
organisations=new OrganisationMenus(this,bridge,p->fetch(p,null,0,null,data->mentat(p,data)),p->openGuild(p,null),p->fetch(p,null,0,null,data->select(p,data,null)),p->quests.open(p),p->exchange.open(p),p->spice.open(p),p->guiPackLoaded.contains(p.getUniqueId()));
|
||||
registrar=new NamespacedKey(this,"house_registrar"); com.dunerealms.npc.CitizensBridge.start(this,registrar,new NamespacedKey("dunerealms","quartermaster"),new NamespacedKey("dunerealms","quest_character"));
|
||||
modernMenus=new MCGUIMenus(this);
|
||||
var centralSettings=org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(new java.io.File(getDataFolder(),"menu-pack.yml"));
|
||||
if("server".equals(centralSettings.getString("delivery")))new CentralItemModels(this);
|
||||
|
||||
sidebar=new PersonalSidebar(this);nameplates=new PublicNameplates(this);
|
||||
for(String command:List.of("start","spice","sellall","exchange","house","mentat","drgui","drscoreboard","guildtravel","clan","company","polgui"))Objects.requireNonNull(getCommand(command)).setExecutor(this);
|
||||
|
|
|
|||
|
|
@ -23,13 +23,14 @@ final class MCGUIMenus implements AutoCloseable, Listener {
|
|||
private Plugin engine;private Object framework,loader,none;private Class<?> contentType,optionsType;private Object defaultOptions;
|
||||
private Method makeCanvas,openView,hasPack,pageOf,render,draw,hoverState;
|
||||
private UUID packId;private String packUrl;private byte[] packHash;
|
||||
private boolean serverOwnedPack;
|
||||
private final Path base;
|
||||
MCGUIMenus(JavaPlugin plugin){
|
||||
this.plugin=plugin;base=plugin.getDataFolder().toPath().resolve("mcgui/menu.html");
|
||||
if(!plugin.getConfig().getBoolean("mcgui.enabled",true))return;
|
||||
var pinFile=plugin.getDataFolder().toPath().resolve("menu-pack.yml").toFile();
|
||||
var settings=org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(pinFile);
|
||||
var pin=MenuPackPolicy.select(settings.getString("url"),settings.getString("sha1"),settings.getString("sha256"),settings.getString("source-commit"));
|
||||
var pin=MenuPackPolicy.select(settings.getString("url"),settings.getString("sha1"),settings.getString("sha256"),settings.getString("source-commit"),settings.getString("delivery","stacked"),settings.getString("pack-id"));
|
||||
if(pin==null){plugin.getLogger().warning("Built menu-pack.yml publication pin is required; world packs were left unchanged.");return;}
|
||||
engine=Bukkit.getPluginManager().getPlugin("MCGUI");if(engine==null||!engine.isEnabled())return;
|
||||
try{
|
||||
|
|
@ -42,7 +43,12 @@ final class MCGUIMenus implements AutoCloseable, Listener {
|
|||
pageOf=page.getMethod("of",String.class,Path.class,load);none=state.getField("NONE").get(null);render=renderer.getMethod("render",page,int.class,int.class,double.class,double.class,state);
|
||||
for(Method m:renderer.getMethods())if(m.getName().equals("state")&&m.getParameterCount()==2)hoverState=m;
|
||||
Class<?> canvas=Class.forName("ai.resourcepack.ui.framework.api.Canvas",true,cl);draw=canvas.getMethod("draw",java.awt.image.BufferedImage.class,int.class,int.class);
|
||||
packId=(UUID)Class.forName("ai.resourcepack.ui.framework.pack.ResourcePack",true,cl).getField("PACK_ID").get(null);
|
||||
serverOwnedPack=pin.serverOwned();
|
||||
if(serverOwnedPack){
|
||||
var properties=new java.util.Properties();try(var input=Files.newInputStream(Path.of("server.properties"))){properties.load(input);}
|
||||
if(!MenuPackPolicy.serverMatches(properties,pin))throw new IllegalStateException("Server resource-pack pin differs from unified menu configuration");
|
||||
packId=UUID.fromString(MenuPackPolicy.UNIFIED_ID);
|
||||
}else packId=(UUID)Class.forName("ai.resourcepack.ui.framework.pack.ResourcePack",true,cl).getField("PACK_ID").get(null);
|
||||
if(!engine.getConfig().getString("resource-pack.mode","").equals("external")||!engine.getConfig().getString("resource-pack.public-url","").isBlank()||engine.getConfig().getBoolean("telemetry",true))throw new IllegalStateException("MCGUI must use external merged mode with telemetry disabled");
|
||||
packUrl=pin.url();packHash=HexFormat.of().parseHex(pin.sha1());
|
||||
active=this;Bukkit.getPluginManager().registerEvents(this,plugin);Bukkit.getScheduler().runTaskLater(plugin,()->Bukkit.getOnlinePlayers().forEach(this::offerGameplay),60L);plugin.getLogger().info("MC GUI presentation connected for all DuneRealms menus; Jarvis callbacks retained.");
|
||||
|
|
@ -65,10 +71,10 @@ final class MCGUIMenus implements AutoCloseable, Listener {
|
|||
static boolean assetsLoaded(Player player){if(active==null||active.framework==null)return false;try{return active.gameplayReady.contains(player.getUniqueId())&&Boolean.TRUE.equals(active.hasPack.invoke(active.framework,player));}catch(Exception failure){return false;}}
|
||||
static void forget(UUID player){if(active!=null){active.closeHints.remove(player);active.gameplayReady.remove(player);active.gameplayOffered.remove(player);}}
|
||||
static void offerPack(Player p){if(active!=null&&!BedrockForms.isBedrock(p))active.sendPack(p);}
|
||||
private void sendPack(Player p){if(p.isOnline()&&!gameplayReady.contains(p.getUniqueId())&&gameplayOffered.add(p.getUniqueId()))p.addResourcePack(packId,packUrl,packHash,"DuneRealms interactive menus",true);}
|
||||
private void sendPack(Player p){if(!serverOwnedPack&&p.isOnline()&&!gameplayReady.contains(p.getUniqueId())&&gameplayOffered.add(p.getUniqueId()))p.addResourcePack(packId,packUrl,packHash,"DuneRealms interactive menus",true);}
|
||||
private void offerGameplay(Player p){if(p.isOnline()&&!BedrockForms.isBedrock(p))sendPack(p);}
|
||||
@EventHandler public void playerJoined(PlayerJoinEvent e){Bukkit.getScheduler().runTaskLater(plugin,()->offerGameplay(e.getPlayer()),60L);}
|
||||
@EventHandler public void menuPackStatus(PlayerResourcePackStatusEvent e){if(packId==null||!packId.equals(e.getID()))return;var id=e.getPlayer().getUniqueId();if(e.getStatus()==PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED)gameplayReady.add(id);else if(e.getStatus()!=PlayerResourcePackStatusEvent.Status.ACCEPTED&&e.getStatus()!=PlayerResourcePackStatusEvent.Status.DOWNLOADED) {gameplayReady.remove(id);gameplayOffered.remove(id);}}
|
||||
@EventHandler public void menuPackStatus(PlayerResourcePackStatusEvent e){if(packId==null||!packId.equals(e.getID()))return;var id=e.getPlayer().getUniqueId();if(e.getStatus()==PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED){boolean first=gameplayReady.add(id);if(first&&serverOwnedPack)plugin.getLogger().info("Central resource pack loaded for "+e.getPlayer().getName()+" UUID "+packId);}else if(e.getStatus()!=PlayerResourcePackStatusEvent.Status.ACCEPTED&&e.getStatus()!=PlayerResourcePackStatusEvent.Status.DOWNLOADED) {gameplayReady.remove(id);gameplayOffered.remove(id);}}
|
||||
private boolean present(Player p,String title,String description,Inventory inventory,Map<Integer,Runnable> actions,GuiSession suppliedGate){
|
||||
if(framework==null||!engine.isEnabled()||!p.isOnline()||BedrockForms.isBedrock(p))return false;
|
||||
if(!p.getWorld().getName().equals("guild_lobby")&&!gameplayReady.contains(p.getUniqueId()))return false;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,18 @@
|
|||
package com.dunerealms.gui;
|
||||
/** Immutable built menu overlay. Server-owned world packs are never selected or replaced here. */
|
||||
/** Exact immutable client-pack pin; supports migration from stacked overlay to one server-owned pack. */
|
||||
final class MenuPackPolicy {
|
||||
record Pin(String url,String sha1,String sha256,String source){}
|
||||
static final String UNIFIED_ID="c24c7cf5-a292-539d-971f-a96d8b838162";
|
||||
record Pin(String url,String sha1,String sha256,String source,boolean serverOwned){}
|
||||
static Pin select(String url,String sha1,String sha256,String source){
|
||||
if(url==null||sha1==null||sha256==null||source==null||!source.matches("[a-f0-9]{40}")||!sha1.matches("[a-f0-9]{40}")||!sha256.matches("[a-f0-9]{64}"))return null;
|
||||
return url.equals("https://www.dunerealms.com/downloads/DuneRealms-Menu-"+source+".zip")?new Pin(url,sha1,sha256,source):null;
|
||||
return url.equals("https://www.dunerealms.com/downloads/DuneRealms-Menu-"+source+".zip")?new Pin(url,sha1,sha256,source,false):null;
|
||||
}
|
||||
static Pin select(String url,String sha1,String sha256,String source,String delivery,String packId){
|
||||
if(!"server".equals(delivery))return select(url,sha1,sha256,source);
|
||||
if(url==null||sha1==null||sha256==null||source==null||!source.matches("[a-f0-9]{40}")||!sha1.matches("[a-f0-9]{40}")||!sha256.matches("[a-f0-9]{64}")||!UNIFIED_ID.equals(packId))return null;
|
||||
return url.equals("https://www.dunerealms.com/downloads/DuneRealms-Resources-"+source+".zip")?new Pin(url,sha1,sha256,source,true):null;
|
||||
}
|
||||
static boolean serverMatches(java.util.Properties properties,Pin pin){
|
||||
return pin.serverOwned()&&pin.url().equals(properties.getProperty("resource-pack"))&&pin.sha1().equals(properties.getProperty("resource-pack-sha1"))&&UNIFIED_ID.equals(properties.getProperty("resource-pack-id"))&&"true".equals(properties.getProperty("require-resource-pack"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
name: DunerealmsGUI
|
||||
main: com.dunerealms.gui.DuneGUI
|
||||
version: 1.1.32
|
||||
version: 1.1.33
|
||||
api-version: '1.21.8'
|
||||
depend: [JarvisTranslator]
|
||||
softdepend: [Citizens, MCGUI, DecentHolograms, DuneLobby, DuneCore, DuneEss, DuneNPC, Vault, floodgate, ViaVersion]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.dunerealms.gui;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
class CentralItemModelsTest {
|
||||
@Test void all224ValidEquipmentPairsResolveWithoutRegrading(){int count=0;var grades=java.util.List.of("common","uncommon","rare","very_rare","legendary");for(int mark=0;mark<=14;mark++)for(String type:java.util.List.of("sword","pickaxe","axe","shovel","hoe","bow","crossbow","mace","trident","helmet","chestplate","leggings","boots","elytra")){String grade=grades.get(mark/3),material=java.util.Set.of("bow","crossbow","mace","trident","elytra").contains(type)?type:"netherite_"+type;assertEquals("dunerealms:equipment/"+grade+"_mk"+mark+"_"+type,CentralItemModelPolicy.resolve(material,null,grade,""+mark,null));count++;if(mark==14){assertEquals("dunerealms:equipment/mythic_mk14_"+type,CentralItemModelPolicy.resolve(material,null,"mythic","14",null));count++;}}assertEquals(224,count);}
|
||||
@Test void missingOrMismatchedGradeNeverInventsProgression(){assertNull(CentralItemModelPolicy.resolve("NETHERITE_HELMET",null,null,null,null));assertNull(CentralItemModelPolicy.resolve("IRON_SWORD",null,"mythic","2",null));assertNull(CentralItemModelPolicy.resolve("STONE",null,"rare","6",null));}
|
||||
@Test void existingCustomModelsAndFoodRemainUntouched(){for(String key:java.util.List.of("other:custom","dunerealms:refits/clan","dunerealms:ecology/jerboa_cooked_meat"))assertEquals(key,CentralItemModelPolicy.resolve("COOKED_RABBIT",key,"rare","6",null));}
|
||||
@Test void nativeArmourIdentityAndExtrasUseExactPublishedKeys(){assertEquals("dunerealms:equipment/uncommon_mk3_helmet",CentralItemModelPolicy.resolve("NETHERITE_HELMET",null,null,null,"dr_s1_uncommon_mk3_helmet"));assertEquals("dunerealms:spice_block",CentralItemModelPolicy.resolve("DRIED_KELP_BLOCK","dunerealms:ecology/spice_block",null,null,"spice_block"));assertEquals("dunerealms:imperial_codex",CentralItemModelPolicy.resolve("BOOK",null,null,null,"dr_imperial_codex"));}
|
||||
@Test void retiredWorldVisualComponentsAreClearedWithoutChangingIdentity(){assertNull(CentralItemModelPolicy.resolve("STONE","dunerealms:planets/arrakis/stone",null,null,null));}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.dunerealms.gui;
|
||||
import org.junit.jupiter.api.Test;import static org.junit.jupiter.api.Assertions.*;
|
||||
class MenuPackPolicyTest {
|
||||
@Test void unifiedPackMustBeServerOwnedWithExactPublishedIdentity(){String source="a".repeat(40),sha="b".repeat(40),full="c".repeat(64),url="https://www.dunerealms.com/downloads/DuneRealms-Resources-"+source+".zip";var pin=MenuPackPolicy.select(url,sha,full,source,"server",MenuPackPolicy.UNIFIED_ID);assertNotNull(pin);assertTrue(pin.serverOwned());assertNull(MenuPackPolicy.select(url,sha,full,source,"server","bad-id"));var properties=new java.util.Properties();properties.setProperty("resource-pack",url);properties.setProperty("resource-pack-sha1",sha);properties.setProperty("resource-pack-id",MenuPackPolicy.UNIFIED_ID);properties.setProperty("require-resource-pack","true");assertTrue(MenuPackPolicy.serverMatches(properties,pin));properties.setProperty("resource-pack-sha1","d".repeat(40));assertFalse(MenuPackPolicy.serverMatches(properties,pin));}
|
||||
@Test void onlyExactImmutableBuiltOverlayIsAccepted(){String source="a".repeat(40),sha="b".repeat(40),sha256="c".repeat(64);String url="https://www.dunerealms.com/downloads/DuneRealms-Menu-"+source+".zip";assertNotNull(MenuPackPolicy.select(url,sha,sha256,source));assertNull(MenuPackPolicy.select(url,sha,sha256,"d".repeat(40)));assertNull(MenuPackPolicy.select("https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v6.zip",sha,sha256,source));assertNull(MenuPackPolicy.select(url,"bad",sha256,source));assertNull(MenuPackPolicy.select(null,sha,sha256,source));}
|
||||
}
|
||||
|
|
|
|||
91
network/resource-pack/central/generator/blocks.py
Normal file
91
network/resource-pack/central/generator/blocks.py
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
"""Spice blocks (also used to retexture the dried-kelp carrier) and suspicious sand stages."""
|
||||
import numpy as np
|
||||
from PIL import Image, ImageFilter
|
||||
|
||||
def _noise(n, seed, scale):
|
||||
rng = np.random.default_rng(seed)
|
||||
base = rng.random((n // scale + 2, n // scale + 2))
|
||||
im = Image.fromarray((base * 255).astype(np.uint8)).resize((n, n), Image.BICUBIC)
|
||||
return np.asarray(im, dtype=np.float32) / 255.0
|
||||
|
||||
def _grain(n, seed):
|
||||
rng = np.random.default_rng(seed)
|
||||
return rng.random((n, n)).astype(np.float32)
|
||||
|
||||
def _tile(arr):
|
||||
return arr # procedural noise is made from bicubic upsample; edges are blended below
|
||||
|
||||
def _seamless(f, n, seed, **kw):
|
||||
"""make tileable by blending the field with its own wrap-shifted copy"""
|
||||
a = f(n, seed, **kw)
|
||||
b = np.roll(np.roll(a, n // 2, 0), n // 2, 1)
|
||||
yy, xx = np.mgrid[0:n, 0:n]
|
||||
wx = np.abs(xx - n / 2) / (n / 2)
|
||||
wy = np.abs(yy - n / 2) / (n / 2)
|
||||
w = np.clip(np.maximum(wx, wy), 0, 1)
|
||||
return a * (1 - w) + b * w
|
||||
|
||||
def colorize(v, stops):
|
||||
"""v in 0..1 -> rgb via list of (t, (r,g,b))"""
|
||||
out = np.zeros(v.shape + (3,), dtype=np.float32)
|
||||
ts = [t for t, _ in stops]
|
||||
for ch in range(3):
|
||||
out[..., ch] = np.interp(v, ts, [c[ch] for _, c in stops])
|
||||
return out
|
||||
|
||||
def hexs(h):
|
||||
h = h.lstrip('#'); return tuple(int(h[i:i + 2], 16) for i in (0, 2, 4))
|
||||
|
||||
def spice_face(kind, face, n=32, seed=7):
|
||||
# kind: spice | smuggled | contaminated ; face: side | top | bottom
|
||||
pal = {
|
||||
"spice": [(0, hexs('#8a3f12')), (.45, hexs('#d9741f')), (.8, hexs('#ffab3d')), (1, hexs('#ffe0a0'))],
|
||||
"smuggled": [(0, hexs('#3b1c0c')), (.45, hexs('#a35417')), (.8, hexs('#e8913a')), (1, hexs('#ffd08a'))],
|
||||
"contaminated": [(0, hexs('#2a1840')), (.45, hexs('#5b3b2a')), (.8, hexs('#8c5a2b')), (1, hexs('#9be36d'))],
|
||||
}[kind]
|
||||
v = 0.55 * _seamless(_noise, n, seed, scale=4) + 0.45 * _seamless(_noise, n, seed + 1, scale=2)
|
||||
v = (v - v.min()) / (v.max() - v.min())
|
||||
g = _seamless(_grain, n, seed + 2)
|
||||
v = np.clip(v * .85 + g * .15, 0, 1)
|
||||
rgb = colorize(v, pal)
|
||||
img = Image.fromarray(rgb.astype(np.uint8), "RGB").convert("RGBA")
|
||||
px = img.load()
|
||||
# crystal veins: bright thin diagonal seams
|
||||
rng = np.random.default_rng(seed + 9)
|
||||
veins = [(int(rng.integers(0, n)), int(rng.integers(0, n))) for _ in range(4)]
|
||||
accent = {"spice": (255, 232, 170), "smuggled": (88, 168, 255), "contaminated": (155, 227, 109)}[kind]
|
||||
for (x0, y0) in veins:
|
||||
L = int(rng.integers(5, 11))
|
||||
for i in range(L):
|
||||
x, y = (x0 + i) % n, (y0 + i) % n
|
||||
r, g_, b, a = px[x, y]
|
||||
px[x, y] = tuple(int(r * .35 + accent[0] * .65) if j == 0 else int(g_ * .35 + accent[1] * .65) if j == 1 else int(b * .35 + accent[2] * .65) for j in range(3)) + (255,)
|
||||
if face == "top":
|
||||
# inset plate with hex-ish frame
|
||||
for i in range(2, n - 2):
|
||||
for (x, y) in ((i, 2), (i, n - 3), (2, i), (n - 3, i)):
|
||||
r, g_, b, a = px[x, y]
|
||||
px[x, y] = (int(r * .6), int(g_ * .6), int(b * .6), 255)
|
||||
if face == "bottom":
|
||||
img = Image.eval(img, lambda x: int(x * .78)) if False else img
|
||||
arr = np.asarray(img, dtype=np.float32); arr[..., :3] *= .72; img = Image.fromarray(arr.astype(np.uint8), "RGBA")
|
||||
if kind == "smuggled" and face == "side":
|
||||
# blue-black strap band (smuggler wrapping)
|
||||
for y in (n // 2 - 2, n // 2 - 1, n // 2, n // 2 + 1):
|
||||
for x in range(n):
|
||||
px[x, y] = (16, 26, 31, 255) if y not in (n // 2 - 2, n // 2 + 1) else (47, 127, 224, 255)
|
||||
return img
|
||||
|
||||
def suspicious_sand(stage, n=16):
|
||||
rng = np.random.default_rng(3)
|
||||
v = _seamless(_noise, n, 11, scale=2)
|
||||
v = (v - v.min()) / (v.max() - v.min())
|
||||
rgb = colorize(v, [(0, hexs('#c9b27a')), (.5, hexs('#dcc68f')), (1, hexs('#ecdcaa'))])
|
||||
img = Image.fromarray(rgb.astype(np.uint8), "RGB").convert("RGBA")
|
||||
px = img.load()
|
||||
count = [0, 5, 11, 20][stage]
|
||||
pts = rng.choice(n * n, size=count, replace=False)
|
||||
for p in pts:
|
||||
x, y = int(p % n), int(p // n)
|
||||
px[x, y] = (255, 171, 61, 255) if rng.random() > .35 else (255, 224, 160, 255)
|
||||
return img
|
||||
118
network/resource-pack/central/generator/build_pack.py
Normal file
118
network/resource-pack/central/generator/build_pack.py
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Build the DuneRealms central resource pack (overlay) from procedural art. Run: python3 build_pack.py OUTDIR"""
|
||||
import json, os, shutil, sys, hashlib, zipfile
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from PIL import Image
|
||||
import items_misc as M
|
||||
import equipment as E
|
||||
import blocks as B
|
||||
|
||||
OUT = sys.argv[1] if len(sys.argv) > 1 else "out/DuneRealms-Central-Pack"
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
OLD = str(ROOT / "legacy/assets/dunerealms/textures")
|
||||
TOOLTIP = str(ROOT / "overlay/assets/dunerealms/textures/gui/sprites/tooltip")
|
||||
A = f"{OUT}/assets/dunerealms"
|
||||
MC = f"{OUT}/assets/minecraft"
|
||||
manifest = {"textures": [], "item_models": []}
|
||||
|
||||
|
||||
def save(img, path):
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
img.save(path, optimize=True)
|
||||
manifest["textures"].append(os.path.relpath(path, OUT))
|
||||
|
||||
|
||||
def wjson(path, obj):
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
with open(path, "w") as f:
|
||||
json.dump(obj, f, separators=(",", ":"))
|
||||
|
||||
|
||||
def item_def(rel_id, model_path, tex, handheld=False, parent=None):
|
||||
"""rel_id: 'currency/coin_001' -> items/currency/coin_001.json ; model_path: 'item/currency/coin_001'"""
|
||||
wjson(f"{A}/items/{rel_id}.json", {"model": {"type": "minecraft:model", "model": f"dunerealms:{model_path}"}})
|
||||
wjson(f"{A}/models/{model_path}.json", {"parent": parent or ("minecraft:item/handheld" if handheld else "minecraft:item/generated"), "textures": {"layer0": f"dunerealms:{tex}"}})
|
||||
manifest["item_models"].append(f"dunerealms:{rel_id}")
|
||||
|
||||
|
||||
# ---- pack.mcmeta -------------------------------------------------------
|
||||
wjson(f"{OUT}/pack.mcmeta", {"pack": {
|
||||
"pack_format": 64,
|
||||
"supported_formats": {"min_inclusive": 46, "max_inclusive": 99},
|
||||
"description": "§6DuneRealms §7— central Dune pack · holo-gold on desert night"}})
|
||||
|
||||
# ---- currency (names match the live pack 1:1) ---------------------------
|
||||
for n in M.COINS:
|
||||
save(M.coin(n), f"{A}/textures/item/currency/{n}.png")
|
||||
item_def(f"currency/{n}", f"item/currency/{n}", f"item/currency/{n}")
|
||||
for n in M.NOTES:
|
||||
save(M.note(n), f"{A}/textures/item/currency/{n}.png")
|
||||
item_def(f"currency/{n}", f"item/currency/{n}", f"item/currency/{n}")
|
||||
|
||||
# ---- spy module ----------------------------------------------------------
|
||||
save(M.spy_module(), f"{A}/textures/item/spy_module.png")
|
||||
item_def("spy_module", "item/spy_module", "item/spy_module")
|
||||
|
||||
# ---- legacy ids kept so older plugin builds still resolve ------------------
|
||||
for v in ("1", "5", "100", "1000", "5000", "note"):
|
||||
save(M.legacy_note(v), f"{A}/textures/item/dunemark_{v}.png")
|
||||
item_def(f"dunemark_{v}", f"item/dunemark_{v}", f"item/dunemark_{v}")
|
||||
for p in M.PLANET_TINT:
|
||||
save(M.planet(p, Image.open(f"{OLD}/item/planet_{p}.png")), f"{A}/textures/item/planet_{p}.png")
|
||||
item_def(f"planet_{p}", f"item/planet_{p}", f"item/planet_{p}")
|
||||
for k in ("crown", "spice", "water"):
|
||||
save(M.office(k), f"{A}/textures/item/office_{k}.png")
|
||||
item_def(f"office_{k}", f"item/office_{k}", f"item/office_{k}")
|
||||
save(Image.new("RGBA", (1, 1), (0, 0, 0, 0)), f"{A}/textures/item/drgui_transparent.png")
|
||||
item_def("drgui_transparent", "item/drgui_transparent", "item/drgui_transparent")
|
||||
|
||||
# ---- extra icons (hooks the plugins can adopt via item_model) --------------
|
||||
extras = {
|
||||
"spice_common": M.spice_crystal("#ffd08a", "#e8913a", "#ffb347"),
|
||||
"spice_smuggled": M.spice_crystal("#ffc27a", "#a8561c", "#e8913a", smuggled=True),
|
||||
"spice_dense": M.spice_crystal("#ffe0a0", "#d9741f", "#ffd35e", dense=True),
|
||||
"spice_refined": M.spice_crystal("#fff0c4", "#ffab3d", "#ffe08a", dense=True),
|
||||
"water_vial": M.water_vial(),
|
||||
"smugglers_water_vial": M.water_vial("#6ee7d8", smuggled=True),
|
||||
"imperial_codex": M.imperial_codex(),
|
||||
}
|
||||
for n, img in extras.items():
|
||||
save(img, f"{A}/textures/item/{n}.png")
|
||||
item_def(n, f"item/{n}", f"item/{n}")
|
||||
|
||||
# ---- equipment: every valid (quality, mark) x type -------------------------
|
||||
count = 0
|
||||
for quality, mark in E.valid_marks():
|
||||
tier = E.QUALITY.index(quality)
|
||||
pips = (mark % 3) + 1 if quality != "mythic" else 3
|
||||
for kind in E.TYPES:
|
||||
name = f"{quality}_mk{mark}_{kind}"
|
||||
save(E.draw(kind, tier, pips), f"{A}/textures/item/equipment/{name}.png")
|
||||
item_def(f"equipment/{name}", f"item/equipment/{name}", f"item/equipment/{name}", handheld=kind in E.HANDHELD)
|
||||
count += 1
|
||||
|
||||
# ---- blocks ---------------------------------------------------------------
|
||||
for kind, bid, seed in (("spice", "spice_block", 7), ("smuggled", "smuggled_spice_block", 17), ("contaminated", "contaminated_spice_block", 27)):
|
||||
for face in ("side", "top", "bottom"):
|
||||
save(B.spice_face(kind, face, 32, seed), f"{A}/textures/block/{bid}_{face}.png")
|
||||
wjson(f"{A}/models/block/{bid}.json", {"parent": "minecraft:block/cube_bottom_top", "textures": {
|
||||
"side": f"dunerealms:block/{bid}_side", "top": f"dunerealms:block/{bid}_top", "bottom": f"dunerealms:block/{bid}_bottom"}})
|
||||
wjson(f"{A}/items/{bid}.json", {"model": {"type": "minecraft:model", "model": f"dunerealms:block/{bid}"}})
|
||||
manifest["item_models"].append(f"dunerealms:{bid}")
|
||||
# carrier: the plugin's spice blocks are DRIED_KELP_BLOCK, so retexture the carrier everywhere
|
||||
for face in ("side", "top", "bottom"):
|
||||
save(B.spice_face("spice", face, 32, 7), f"{MC}/textures/block/dried_kelp_{face}.png")
|
||||
for st in range(4):
|
||||
save(B.suspicious_sand(st), f"{MC}/textures/block/suspicious_sand_{st}.png")
|
||||
|
||||
# ---- tooltip sprites (item-card frame), copied from the approved design ------
|
||||
for f in ("dune_background.png", "dune_background.png.mcmeta", "dune_frame.png", "dune_frame.png.mcmeta"):
|
||||
d = f"{A}/textures/gui/sprites/tooltip"
|
||||
os.makedirs(d, exist_ok=True)
|
||||
shutil.copy(f"{TOOLTIP}/{f}", f"{d}/{f}")
|
||||
manifest["textures"].append(os.path.relpath(f"{d}/{f}", OUT))
|
||||
|
||||
with open(f"{OUT}/MANIFEST.json", "w") as f:
|
||||
json.dump(manifest, f, indent=1)
|
||||
print("equipment icons:", count, "| textures:", len(manifest["textures"]), "| item models:", len(manifest["item_models"]))
|
||||
149
network/resource-pack/central/generator/dunelib.py
Normal file
149
network/resource-pack/central/generator/dunelib.py
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
"""Tiny supersampled vector-ish drawing kit for the DuneRealms pack (smooth futuristic style)."""
|
||||
import math
|
||||
import os
|
||||
from pathlib import Path
|
||||
import numpy as np
|
||||
from PIL import Image, ImageDraw, ImageFilter, ImageChops, ImageFont
|
||||
|
||||
SS = 4 # supersampling factor
|
||||
|
||||
PAL = dict(
|
||||
void="#06140f", deep="#081e17", panel="#102a23", panel2="#17372c", moss="#235242",
|
||||
gold="#e5b95e", gold2="#c4a255", gold3="#f2d593", sand="#eae3cc", sand2="#b7c8b7",
|
||||
spice="#e8913a", spice2="#ffb347", ember="#ff6a3d", fremen="#2f7fe0", fremen2="#58a8ff",
|
||||
ixian="#6ee7d8", guild="#8a6fd6", guild2="#b78bed", ok="#58be87", ink="#030a07",
|
||||
)
|
||||
QUALITY = ["common", "uncommon", "rare", "very_rare", "legendary", "mythic"]
|
||||
QCOL = ["#e3e3dc", "#58be87", "#65a9ff", "#b78bed", "#edc363", "#ff7a45"]
|
||||
|
||||
FONT_BOLD = os.environ.get("DUNE_PACK_FONT", str(Path(__file__).resolve().parents[1] / "inputs/Poppins-Bold.ttf"))
|
||||
|
||||
|
||||
def rgb(h, a=255):
|
||||
if isinstance(h, tuple):
|
||||
return h if len(h) == 4 else (*h, a)
|
||||
h = PAL.get(h, h).lstrip("#")
|
||||
return (int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16), a)
|
||||
|
||||
|
||||
def mix(c1, c2, t):
|
||||
a, b = rgb(c1), rgb(c2)
|
||||
return tuple(int(a[i] + (b[i] - a[i]) * t) for i in range(4))
|
||||
|
||||
|
||||
class Cv:
|
||||
def __init__(self, w, h=None):
|
||||
self.w, self.h = w, h or w
|
||||
self.im = Image.new("RGBA", (self.w * SS, self.h * SS), (0, 0, 0, 0))
|
||||
|
||||
# ---- masks -------------------------------------------------
|
||||
def _new(self):
|
||||
return Image.new("L", self.im.size, 0)
|
||||
|
||||
def poly(self, pts):
|
||||
m = self._new()
|
||||
ImageDraw.Draw(m).polygon([(x * SS, y * SS) for x, y in pts], fill=255)
|
||||
return m
|
||||
|
||||
def circle(self, cx, cy, r):
|
||||
m = self._new()
|
||||
ImageDraw.Draw(m).ellipse([(cx - r) * SS, (cy - r) * SS, (cx + r) * SS, (cy + r) * SS], fill=255)
|
||||
return m
|
||||
|
||||
def rrect(self, x0, y0, x1, y1, r):
|
||||
m = self._new()
|
||||
ImageDraw.Draw(m).rounded_rectangle([x0 * SS, y0 * SS, x1 * SS, y1 * SS], radius=r * SS, fill=255)
|
||||
return m
|
||||
|
||||
def line(self, pts, width):
|
||||
m = self._new()
|
||||
d = ImageDraw.Draw(m)
|
||||
P = [(x * SS, y * SS) for x, y in pts]
|
||||
d.line(P, fill=255, width=max(1, int(width * SS)), joint="curve")
|
||||
r = width * SS / 2
|
||||
for x, y in (P[0], P[-1]):
|
||||
d.ellipse([x - r, y - r, x + r, y + r], fill=255)
|
||||
return m
|
||||
|
||||
def text(self, xy, s, size, anchor="mm", font=FONT_BOLD):
|
||||
m = self._new()
|
||||
f = ImageFont.truetype(font, int(size * SS))
|
||||
ImageDraw.Draw(m).text((xy[0] * SS, xy[1] * SS), s, font=f, fill=255, anchor=anchor)
|
||||
return m
|
||||
|
||||
# ---- painting ----------------------------------------------
|
||||
def fill(self, mask, c1, c2=None, alpha=1.0, horizontal=False):
|
||||
c1 = rgb(c1)
|
||||
c2 = rgb(c2) if c2 else c1
|
||||
bb = mask.getbbox()
|
||||
if not bb:
|
||||
return
|
||||
w, h = self.im.size
|
||||
t = np.linspace(0, 1, w if horizontal else h)
|
||||
arr = np.zeros((h, w, 4), dtype=np.float32)
|
||||
for i in range(4):
|
||||
ch = c1[i] + (c2[i] - c1[i]) * t
|
||||
arr[:, :, i] = ch[None, :] if horizontal else ch[:, None]
|
||||
layer = Image.fromarray(arr.astype(np.uint8), "RGBA")
|
||||
a = mask.point(lambda v: int(v * alpha))
|
||||
layer.putalpha(ImageChops.multiply(layer.getchannel("A"), a))
|
||||
self.im = Image.alpha_composite(self.im, layer)
|
||||
|
||||
def solid(self, mask, c, alpha=1.0):
|
||||
self.fill(mask, c, None, alpha)
|
||||
|
||||
def glow(self, mask, c, radius, strength=1.0):
|
||||
g = mask.filter(ImageFilter.GaussianBlur(radius * SS))
|
||||
g = g.point(lambda v: min(255, int(v * strength)))
|
||||
layer = Image.new("RGBA", self.im.size, rgb(c, 255))
|
||||
layer.putalpha(g)
|
||||
self.im = Image.alpha_composite(self.im, layer)
|
||||
|
||||
def edge(self, mask, c, width=1.0, alpha=1.0):
|
||||
k = int(width * SS) * 2 + 1
|
||||
inner = mask.filter(ImageFilter.MinFilter(k))
|
||||
ring = ImageChops.subtract(mask, inner)
|
||||
self.solid(ring, c, alpha)
|
||||
|
||||
def bevel(self, mask, light=0.55, dark=0.35, d=1.2):
|
||||
off = int(d * SS)
|
||||
tl = ImageChops.subtract(mask, ImageChops.offset(mask, off, off))
|
||||
br = ImageChops.subtract(mask, ImageChops.offset(mask, -off, -off))
|
||||
self.solid(tl, "#ffffff", light)
|
||||
self.solid(br, "#000000", dark)
|
||||
|
||||
def clip(self, mask, other):
|
||||
return ImageChops.multiply(mask, other)
|
||||
|
||||
def out(self, size=None):
|
||||
s = size or (self.w, self.h)
|
||||
return self.im.resize(s, Image.LANCZOS)
|
||||
|
||||
|
||||
def hexagon(cx, cy, r, rot=0):
|
||||
return [(cx + r * math.cos(math.radians(60 * i + rot)), cy + r * math.sin(math.radians(60 * i + rot))) for i in range(6)]
|
||||
|
||||
|
||||
def sparkle(cv, cx, cy, r, color):
|
||||
m = cv.poly([(cx, cy - r), (cx + r * .22, cy - r * .22), (cx + r, cy), (cx + r * .22, cy + r * .22),
|
||||
(cx, cy + r), (cx - r * .22, cy + r * .22), (cx - r, cy), (cx - r * .22, cy - r * .22)])
|
||||
cv.glow(m, color, r * .6, 1.0)
|
||||
cv.solid(m, "#ffffff", .95)
|
||||
|
||||
|
||||
def hex_lattice(cv, mask, color, alpha=.12, size=6.0, width=.5):
|
||||
"""faint hex grid clipped to mask"""
|
||||
layer = cv._new()
|
||||
d = ImageDraw.Draw(layer)
|
||||
h = size * math.sqrt(3)
|
||||
y = -h
|
||||
row = 0
|
||||
while y < cv.h + h:
|
||||
x = -size * 3 + (size * 1.5 if row % 2 else 0)
|
||||
while x < cv.w + size * 3:
|
||||
pts = [((x + size * math.cos(math.radians(60 * i))) * SS, (y + size * math.sin(math.radians(60 * i))) * SS) for i in range(6)]
|
||||
d.line(pts + [pts[0]], fill=255, width=max(1, int(width * SS)))
|
||||
x += size * 3
|
||||
y += h / 2
|
||||
row += 1
|
||||
cv.solid(ImageChops.multiply(layer, mask), color, alpha)
|
||||
241
network/resource-pack/central/generator/equipment.py
Normal file
241
network/resource-pack/central/generator/equipment.py
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
"""Equipment icons: tools, weapons, armour in one futuristic Dune style, tiered by quality and mark."""
|
||||
import math
|
||||
from dunelib import *
|
||||
|
||||
TOOLS = ["sword", "pickaxe", "axe", "shovel", "hoe", "bow", "crossbow", "mace", "trident"]
|
||||
ARMOUR = ["helmet", "chestplate", "leggings", "boots", "elytra"]
|
||||
TYPES = TOOLS + ARMOUR
|
||||
HANDHELD = set(TOOLS)
|
||||
|
||||
|
||||
def valid_marks():
|
||||
"""(quality, mark) pairs exactly as EquipmentLoreStyle.valid() allows them."""
|
||||
out = []
|
||||
for m in range(15):
|
||||
out.append((QUALITY[m // 3], m))
|
||||
out.append(("mythic", 14))
|
||||
return out
|
||||
|
||||
|
||||
class Tool:
|
||||
"""Local tool coordinates (u along the tool from grip to head, v across) -> diagonal canvas."""
|
||||
def __init__(self, cv, k=0.78):
|
||||
self.cv, self.k = cv, k
|
||||
self.d = (math.sqrt(.5), -math.sqrt(.5))
|
||||
self.n = (math.sqrt(.5), math.sqrt(.5))
|
||||
|
||||
def T(self, u, v):
|
||||
x = 27 + ((u - 32) * self.d[0] + v * self.n[0]) * self.k
|
||||
y = 33 + ((u - 32) * self.d[1] + v * self.n[1]) * self.k
|
||||
return (x, y)
|
||||
|
||||
def P(self, pts):
|
||||
return [self.T(u, v) for u, v in pts]
|
||||
|
||||
|
||||
def metal(cv, mask, tier, dark=False):
|
||||
top, bot = ("#2c5a4b", "#0a1f19") if not dark else ("#183c32", "#050f0c")
|
||||
cv.fill(mask, top, bot)
|
||||
cv.bevel(mask, .5, .45, 1.0)
|
||||
cv.edge(mask, QCOL[tier], .9, .95)
|
||||
|
||||
|
||||
def inlay(cv, mask_or_pts, tier, width=1.2):
|
||||
pts = mask_or_pts
|
||||
m = cv.line(pts, width)
|
||||
cv.glow(m, QCOL[tier], 1.5 + tier * .35, .85 + tier * .03)
|
||||
cv.solid(m, mix(QCOL[tier], "#ffffff", .55))
|
||||
|
||||
|
||||
def pips(cv, tier, count):
|
||||
for i in range(count):
|
||||
c = cv.circle(7 + i * 5.2, 57, 1.9)
|
||||
cv.glow(c, QCOL[tier], 1.4, 1)
|
||||
cv.solid(c, mix(QCOL[tier], "#ffffff", .5))
|
||||
|
||||
|
||||
def aura(cv, tier):
|
||||
"""higher tiers get a soft backlight and sparkles"""
|
||||
if tier >= 3:
|
||||
cv.glow(cv.circle(32, 32, 18 + tier * 1.5), QCOL[tier], 10, .12 + .05 * (tier - 3))
|
||||
if tier >= 4:
|
||||
sparkle(cv, 52, 12, 3.2, "#ffffff")
|
||||
if tier >= 5:
|
||||
sparkle(cv, 10, 22, 2.4, "#ffd9b0")
|
||||
sparkle(cv, 54, 44, 2.0, "#ffd9b0")
|
||||
|
||||
|
||||
def handle(cv, t, tier, u0=0, u1=46):
|
||||
h = cv.poly(t.P([(u0, -3.2), (u1, -3.2), (u1, 3.2), (u0, 3.2)]))
|
||||
cv.fill(h, "#14342b", "#07120e")
|
||||
cv.edge(h, "gold2", .6, .9)
|
||||
for u in range(u0 + 6, u1 - 4, 9):
|
||||
cv.solid(cv.line(t.P([(u, -3.2), (u, 3.2)]), .8), "gold", .85)
|
||||
|
||||
|
||||
def draw_tool(kind, tier, pip_count):
|
||||
cv = Cv(64)
|
||||
aura(cv, tier)
|
||||
t = Tool(cv)
|
||||
if kind == "sword":
|
||||
handle(cv, t, tier, 0, 17)
|
||||
pom = cv.circle(*t.T(1, 0), 3)
|
||||
cv.fill(pom, "gold3", "gold2")
|
||||
guard = cv.poly(t.P([(14, -14), (19, -16), (22, -13), (22, 13), (19, 16), (14, 14)]))
|
||||
metal(cv, guard, tier, True)
|
||||
blade = cv.poly(t.P([(22, -6.4), (55, -6.4), (66, 0), (55, 6.4), (22, 6.4)]))
|
||||
cv.fill(blade, "#dff7f1", "#6fa89c")
|
||||
cv.bevel(blade, .7, .4, 1.0)
|
||||
cv.edge(blade, QCOL[tier], .8, .9)
|
||||
inlay(cv, t.P([(25, 0), (58, 0)]), tier, 1.0)
|
||||
elif kind == "pickaxe":
|
||||
handle(cv, t, tier, 0, 56)
|
||||
outer, inner = [], []
|
||||
for i in range(-12, 13):
|
||||
q = i / 12
|
||||
outer.append((36 + 24 * (1 - q * q), 31 * q))
|
||||
inner.append((36 + 24 * (1 - q * q) - 13 * (1 - q * q) ** .8, 31 * q))
|
||||
head = cv.poly(t.P(outer + list(reversed(inner))))
|
||||
metal(cv, head, tier)
|
||||
inlay(cv, t.P([(u - 6 * (1 - (v / 31) ** 2), v * .8) for u, v in outer[3:-3]]), tier, 1.0)
|
||||
cv.solid(cv.circle(*t.T(50, 0), 3.6), "gold")
|
||||
elif kind == "axe":
|
||||
handle(cv, t, tier, 0, 58)
|
||||
head = cv.poly(t.P([(42, 3), (54, 3), (62, 6), (68, 15), (66, 29), (57, 37), (46, 33), (42, 20)]))
|
||||
metal(cv, head, tier)
|
||||
inlay(cv, t.P([(62, 10), (64, 20), (60, 30)]), tier, 1.1)
|
||||
cv.solid(cv.circle(*t.T(44, 0), 2.6), "gold")
|
||||
elif kind == "shovel":
|
||||
handle(cv, t, tier, 0, 40)
|
||||
grip = cv.poly(t.P([(0, -5.5), (4, -5.5), (4, 5.5), (0, 5.5)]))
|
||||
cv.fill(grip, "gold3", "gold2")
|
||||
blade = cv.poly(t.P([(36, -3), (44, -12), (60, -11), (69, 0), (60, 11), (44, 12), (36, 3)]))
|
||||
metal(cv, blade, tier)
|
||||
inlay(cv, t.P([(44, 0), (62, 0)]), tier, 1.0)
|
||||
for v in (-6.5, 6.5):
|
||||
cv.solid(cv.line(t.P([(46, v), (60, v * .8)]), .7), QCOL[tier], .7)
|
||||
elif kind == "hoe":
|
||||
handle(cv, t, tier, 0, 58)
|
||||
head = cv.poly(t.P([(44, -3.2), (62, -3.2), (67, 4), (66, 27), (56, 31), (56, 12), (44, 12)]))
|
||||
metal(cv, head, tier)
|
||||
inlay(cv, t.P([(62, 6), (61.5, 25)]), tier, 1.1)
|
||||
elif kind == "bow":
|
||||
pts = []
|
||||
for i in range(-12, 13):
|
||||
s = i / 12
|
||||
pts.append((50 - 28 * (1 - s * s), 29 * s))
|
||||
limb = cv.line(t.P(pts), 4.6)
|
||||
cv.fill(limb, "#2c5a4b", "#0a1f19")
|
||||
cv.bevel(limb, .5, .4, .9)
|
||||
cv.edge(limb, QCOL[tier], .7, .9)
|
||||
cv.solid(cv.line(t.P([pts[0], pts[-1]]), .8), mix(QCOL[tier], "#ffffff", .6))
|
||||
cv.solid(cv.circle(*t.T(22, 0), 3), "gold")
|
||||
inlay(cv, t.P([(26, -1), (58, 0)]), tier, .9) # arrow
|
||||
cv.solid(cv.poly(t.P([(58, -2.2), (66, 0), (58, 2.2)])), "gold3")
|
||||
elif kind == "crossbow":
|
||||
handle(cv, t, tier, 0, 50)
|
||||
pts = [(44 + 8 * (s / 12) ** 2 * 1.0 + 2, 27 * s / 12) for s in range(-12, 13)]
|
||||
limb = cv.line(t.P(pts), 4.8)
|
||||
cv.fill(limb, "#2c5a4b", "#0a1f19")
|
||||
cv.edge(limb, QCOL[tier], .7, .9)
|
||||
cv.solid(cv.line(t.P([(pts[0][0] - 1, pts[0][1]), (30, 0), (pts[-1][0] - 1, pts[-1][1])]), .8), mix(QCOL[tier], "#ffffff", .6))
|
||||
inlay(cv, t.P([(30, 0), (60, 0)]), tier, .9)
|
||||
cv.solid(cv.poly(t.P([(60, -2.4), (67, 0), (60, 2.4)])), "gold3")
|
||||
elif kind == "mace":
|
||||
handle(cv, t, tier, 0, 46)
|
||||
cx, cy = t.T(55, 0)
|
||||
for i in range(8):
|
||||
a = math.radians(i * 45 + 22.5)
|
||||
sp = cv.poly([(cx + 9 * math.cos(a - .32), cy + 9 * math.sin(a - .32)), (cx + 17 * math.cos(a), cy + 17 * math.sin(a)), (cx + 9 * math.cos(a + .32), cy + 9 * math.sin(a + .32))])
|
||||
metal(cv, sp, tier)
|
||||
ball = cv.circle(cx, cy, 10.5)
|
||||
metal(cv, ball, tier)
|
||||
cv.glow(cv.circle(cx, cy, 4), QCOL[tier], 3, 1)
|
||||
cv.solid(cv.circle(cx, cy, 3.4), mix(QCOL[tier], "#ffffff", .6))
|
||||
elif kind == "trident":
|
||||
handle(cv, t, tier, 0, 52)
|
||||
for v in (-11, 11):
|
||||
pts = [(46, v * .35), (50, v), (60, v), (67, v * .9)]
|
||||
prong = cv.line(t.P([(46, 0)] + pts[1:]), 2.6)
|
||||
metal(cv, prong, tier)
|
||||
cv.solid(cv.poly(t.P([(66, v * .9 - 2), (72, v * .9), (66, v * .9 + 2)])), "gold3")
|
||||
mid = cv.poly(t.P([(50, -1.8), (66, -1.8), (73, 0), (66, 1.8), (50, 1.8)]))
|
||||
metal(cv, mid, tier)
|
||||
cv.solid(cv.line(t.P([(46, -11), (46, 11)]), 2.6), "gold")
|
||||
pips(cv, tier, pip_count)
|
||||
return cv.out()
|
||||
|
||||
|
||||
def sym(cv, pts_left):
|
||||
"""mirror a left-half outline to the right half on a 64 wide canvas"""
|
||||
return pts_left + [(64 - x, y) for x, y in reversed(pts_left)]
|
||||
|
||||
|
||||
def draw_armour(kind, tier, pip_count):
|
||||
cv = Cv(64)
|
||||
aura(cv, tier)
|
||||
q = QCOL[tier]
|
||||
if kind == "helmet":
|
||||
left = [(32, 5), (22, 7), (13, 15), (9, 27), (9, 44), (13, 52), (21, 52), (21, 42), (26, 40)]
|
||||
body = cv.poly(sym(left)[:-1] if False else left + [(64 - x, y) for x, y in reversed(left)])
|
||||
metal(cv, body, tier)
|
||||
visor = cv.poly([(15, 28), (49, 28), (46, 35), (18, 35)])
|
||||
cv.fill(visor, "#02100b", "#02100b")
|
||||
cv.glow(visor, q, 2, .9)
|
||||
cv.solid(cv.line([(17, 31.5), (47, 31.5)], 1.6), mix(q, "#ffffff", .5))
|
||||
inlay(cv, [(32, 8), (32, 25)], tier, 1.2)
|
||||
cv.solid(cv.poly([(28, 6), (32, 2), (36, 6)]), "gold")
|
||||
elif kind == "chestplate":
|
||||
left = [(32, 12), (26, 10), (20, 7), (9, 12), (4, 24), (10, 32), (15, 30), (15, 57), (32, 57)]
|
||||
body = cv.poly(left + [(64 - x, y) for x, y in reversed(left)])
|
||||
metal(cv, body, tier)
|
||||
core = cv.poly(hexagon(32, 31, 8, 0))
|
||||
cv.fill(core, "#02100b", "#02100b")
|
||||
cv.glow(core, q, 3, .9)
|
||||
cv.edge(core, mix(q, "#ffffff", .5), .9, 1)
|
||||
cv.solid(cv.circle(32, 31, 2.6), mix(q, "#ffffff", .7))
|
||||
inlay(cv, [(20, 38), (20, 52)], tier, 1)
|
||||
inlay(cv, [(44, 38), (44, 52)], tier, 1)
|
||||
inlay(cv, [(9, 14), (16, 20)], tier, 1)
|
||||
inlay(cv, [(55, 14), (48, 20)], tier, 1)
|
||||
elif kind == "leggings":
|
||||
body = cv.poly([(13, 6), (51, 6), (53, 56), (37, 56), (32, 22), (27, 56), (11, 56)])
|
||||
metal(cv, body, tier)
|
||||
belt = cv.rrect(13, 6, 51, 14, 2)
|
||||
cv.fill(belt, "#14342b", "#07120e")
|
||||
cv.edge(belt, "gold", .7, .9)
|
||||
cv.glow(cv.circle(32, 10, 2), q, 2, 1)
|
||||
cv.solid(cv.circle(32, 10, 1.7), mix(q, "#ffffff", .6))
|
||||
inlay(cv, [(20, 22), (19, 52)], tier, 1)
|
||||
inlay(cv, [(44, 22), (45, 52)], tier, 1)
|
||||
elif kind == "boots":
|
||||
for ox, mirror in ((0, 1), (32, -1)):
|
||||
def X(x):
|
||||
return ox + (x if mirror == 1 else 32 - x)
|
||||
b = cv.poly([(X(7), 10), (X(24), 10), (X(24), 38), (X(31), 44), (X(31), 54), (X(4), 54), (X(6), 38)])
|
||||
metal(cv, b, tier)
|
||||
cv.solid(cv.rrect(X(7) if mirror == 1 else X(24), 10, X(24) if mirror == 1 else X(7), 15, 1.5), "gold2")
|
||||
inlay(cv, [(X(8), 47), (X(28), 47)], tier, 1.1)
|
||||
elif kind == "elytra":
|
||||
left = [(31, 8), (19, 9), (7, 16), (3, 32), (8, 48), (20, 57), (30, 50), (31, 30)]
|
||||
for side in (0, 1):
|
||||
pts = left if side == 0 else [(64 - x, y) for x, y in left]
|
||||
w = cv.poly(pts)
|
||||
cv.fill(w, "#1d4a3d", "#071814")
|
||||
cv.bevel(w, .45, .4, 1)
|
||||
cv.edge(w, q, .9, .95)
|
||||
for k in range(1, 5):
|
||||
f = k / 5
|
||||
a = (31, 14 + f * 6)
|
||||
bpt = (6 + f * 2, 18 + f * 32)
|
||||
if side:
|
||||
a, bpt = (64 - a[0], a[1]), (64 - bpt[0], bpt[1])
|
||||
cv.solid(cv.line([a, bpt], .8), q, .7)
|
||||
cv.glow(cv.circle(32, 28, 3), q, 3, 1)
|
||||
cv.solid(cv.circle(32, 28, 2.4), mix(q, "#ffffff", .6))
|
||||
pips(cv, tier, pip_count)
|
||||
return cv.out()
|
||||
|
||||
|
||||
def draw(kind, tier, pip_count):
|
||||
return draw_tool(kind, tier, pip_count) if kind in HANDHELD else draw_armour(kind, tier, pip_count)
|
||||
276
network/resource-pack/central/generator/items_misc.py
Normal file
276
network/resource-pack/central/generator/items_misc.py
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
"""Currency, Spy Module, planet sigils, office crests, extra item icons."""
|
||||
import math
|
||||
from PIL import Image
|
||||
from dunelib import *
|
||||
|
||||
# ---------------------------------------------------------------- coins
|
||||
COINS = {
|
||||
# name: (label, sub, c_hi, c_lo, glow)
|
||||
"coin_001": ("1", "CENT", "#d9a070", "#6b3f25", "#e8913a"),
|
||||
"coin_002": ("2", "CENT", "#dba878", "#70432a", "#e8913a"),
|
||||
"coin_005": ("5", "CENT", "#e0b080", "#754a2d", "#ffb347"),
|
||||
"coin_010": ("10", "CENT", "#cfd9d6", "#5a6b68", "#6ee7d8"),
|
||||
"coin_020": ("20", "CENT", "#d6e0dd", "#5f726e", "#6ee7d8"),
|
||||
"coin_050": ("50", "CENT", "#e2ecea", "#667a76", "#9ff3e8"),
|
||||
"coin_1dm": ("1", "DM", "#f2d593", "#8a6a2a", "#e5b95e"),
|
||||
"coin_1dm_gold": ("1", "DM", "#ffe9a8", "#9a7420", "#ffd35e"),
|
||||
"coin_1dm_silver": ("1", "DM", "#eef3f2", "#6d7d7a", "#cfe9e6"),
|
||||
"coin_2dm": ("2", "DM", "#f6dc9c", "#8f6c22", "#ffb347"),
|
||||
}
|
||||
|
||||
|
||||
def worm_arc(cv, cx, cy, r, color, w=2.2, a=1.0):
|
||||
"""segmented crescent (sandworm ring) emblem"""
|
||||
for i in range(9):
|
||||
t0 = math.radians(200 + i * 17)
|
||||
t1 = t0 + math.radians(13)
|
||||
pts = [(cx + r * math.cos(t0), cy + r * math.sin(t0)), (cx + r * math.cos(t1), cy + r * math.sin(t1))]
|
||||
cv.solid(cv.line(pts, w * (0.55 + 0.45 * math.sin(i / 8 * math.pi))), color, a)
|
||||
|
||||
|
||||
def coin(name):
|
||||
label, sub, hi, lo, gl = COINS[name]
|
||||
cv = Cv(128)
|
||||
c = 64
|
||||
outer = cv.circle(c, c, 56)
|
||||
cv.glow(outer, gl, 5, .55)
|
||||
cv.fill(outer, hi, lo)
|
||||
cv.bevel(outer, .6, .45, 1.8)
|
||||
ring = cv.circle(c, c, 49)
|
||||
cv.fill(ring, lo, hi)
|
||||
face = cv.circle(c, c, 45)
|
||||
cv.fill(face, mix(hi, "#000000", .45), mix(lo, "#000000", .35))
|
||||
hex_lattice(cv, face, hi, .16, 7, .6)
|
||||
# tick ring
|
||||
for i in range(48):
|
||||
a = math.radians(i * 7.5)
|
||||
r0, r1 = 47, 52 if i % 4 == 0 else 50
|
||||
cv.solid(cv.line([(c + r0 * math.cos(a), c + r0 * math.sin(a)), (c + r1 * math.cos(a), c + r1 * math.sin(a))], .9), lo, .9)
|
||||
worm_arc(cv, c, c, 38, hi, 2.4, .9)
|
||||
big = 44 if len(label) == 1 else 36
|
||||
t = cv.text((c, c - 4), label, big)
|
||||
cv.glow(t, gl, 3, .9)
|
||||
cv.fill(t, "#ffffff", hi)
|
||||
s = cv.text((c, c + 27), sub, 11)
|
||||
cv.solid(s, hi, .95)
|
||||
sparkle(cv, 36, 34, 7, "#ffffff")
|
||||
return cv.out()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- notes
|
||||
NOTES = {
|
||||
"note_5": ("5", "#58be87", "#0f3a2a"),
|
||||
"note_10": ("10", "#6ee7d8", "#0c3a3d"),
|
||||
"note_20": ("20", "#65a9ff", "#0d2a4d"),
|
||||
"note_50": ("50", "#8a8cff", "#1a1f55"),
|
||||
"note_100": ("100", "#b78bed", "#2a1650"),
|
||||
"note_200": ("200", "#e58bd9", "#4a1646"),
|
||||
"note_500": ("500", "#ff9a5e", "#4a2210"),
|
||||
"note_1000": ("1000", "#ffd35e", "#4a3410"),
|
||||
"note_5000": ("5000", "#ffffff", "#5a1f0a"),
|
||||
"note_0_house": ("", "#e5b95e", "#102a23"),
|
||||
"note_0_leto": ("", "#ffb347", "#2a1408"),
|
||||
}
|
||||
|
||||
|
||||
def note(name):
|
||||
label, tint, dark = NOTES[name]
|
||||
cv = Cv(128)
|
||||
body = cv.rrect(4, 26, 124, 102, 9)
|
||||
cv.glow(body, tint, 4, .55)
|
||||
cv.fill(body, mix(dark, tint, .18), mix(dark, "#000000", .35))
|
||||
hex_lattice(cv, body, tint, .14, 6.5, .55)
|
||||
cv.bevel(body, .35, .35, 1.2)
|
||||
cv.edge(body, tint, 1.4, .95)
|
||||
inner = cv.rrect(9, 31, 119, 97, 6)
|
||||
cv.edge(inner, "gold", .6, .55)
|
||||
# holo emblem on the right: concentric hex + worm arc
|
||||
ex, ey = 93, 64
|
||||
hx = cv.poly(hexagon(ex, ey, 24, 0))
|
||||
cv.fill(hx, mix(dark, tint, .35), mix(dark, "#000000", .2), .9)
|
||||
cv.edge(hx, tint, 1.1, .9)
|
||||
hx2 = cv.poly(hexagon(ex, ey, 16, 30))
|
||||
cv.edge(hx2, "gold3", .8, .8)
|
||||
if name == "note_0_house": # house crest: crown of five points, original
|
||||
pts = [(ex - 11, ey + 6), (ex - 12, ey - 7), (ex - 6, ey - 1), (ex, ey - 10), (ex + 6, ey - 1), (ex + 12, ey - 7), (ex + 11, ey + 6)]
|
||||
cv.solid(cv.line(pts + [pts[0]], 1.6), "gold3")
|
||||
cv.solid(cv.line([(ex - 11, ey + 10), (ex + 11, ey + 10)], 1.6), "gold3")
|
||||
elif name == "note_0_leto": # abstract worm coil, no portrait
|
||||
for i, r in enumerate((13, 9, 5)):
|
||||
worm_arc(cv, ex, ey, r, "spice2", 1.8)
|
||||
cv.solid(cv.circle(ex, ey, 2.2), "#ffffff")
|
||||
else:
|
||||
worm_arc(cv, ex, ey, 11, tint, 2.4)
|
||||
cv.glow(cv.circle(ex, ey, 3), tint, 3, 1)
|
||||
cv.solid(cv.circle(ex, ey, 2.4), "#ffffff")
|
||||
# denomination
|
||||
if label:
|
||||
size = {1: 40, 2: 34, 3: 28, 4: 21}[len(label)]
|
||||
t = cv.text((34, 56), label, size)
|
||||
cv.glow(t, tint, 3, .8)
|
||||
cv.fill(t, "#ffffff", mix("#ffffff", tint, .55))
|
||||
else:
|
||||
t = cv.text((34, 56), "0", 34)
|
||||
cv.glow(t, tint, 3, .8)
|
||||
cv.fill(t, "#ffffff", mix("#ffffff", tint, .55))
|
||||
cv.solid(cv.text((34, 82), "DUNEMARK", 8.2), tint, .95)
|
||||
cv.solid(cv.line([(14, 90), (60, 90)], .8), tint, .6)
|
||||
cv.solid(cv.line([(14, 38), (44, 38)], .8), tint, .6)
|
||||
sparkle(cv, 112, 38, 5, "#ffffff")
|
||||
return cv.out()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- legacy DM notes (old GUI wallet ids)
|
||||
def legacy_note(value):
|
||||
# dunemark_1/5/100/1000/5000 reuse the note look
|
||||
m = {"1": "note_5", "5": "note_5", "100": "note_100", "1000": "note_1000", "5000": "note_5000", "note": "note_100"}
|
||||
img = note(m[value])
|
||||
return img
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- spy module
|
||||
def spy_module():
|
||||
cv = Cv(128)
|
||||
# egg-shaped capsule (the item is an egg-based device)
|
||||
pts = []
|
||||
for i in range(72):
|
||||
t = i / 72 * 2 * math.pi
|
||||
x = 64 + 36 * math.sin(t)
|
||||
y = 66 - 46 * math.cos(t) * (1.0 if math.cos(t) > 0 else .86)
|
||||
# egg narrowing toward the top
|
||||
if math.cos(t) > 0:
|
||||
x = 64 + 36 * math.sin(t) * (1 - .18 * math.cos(t))
|
||||
pts.append((x, y))
|
||||
body = cv.poly(pts)
|
||||
cv.glow(body, "ixian", 6, .55)
|
||||
cv.fill(body, "#1d4a45", "#06191a")
|
||||
cv.bevel(body, .5, .45, 2)
|
||||
cv.edge(body, "ixian", 1.6, .95)
|
||||
hex_lattice(cv, body, "ixian", .2, 7, .6)
|
||||
# scanner ring + lens
|
||||
ring = cv.circle(64, 64, 22)
|
||||
cv.fill(ring, "#0a2a2c", "#041012")
|
||||
cv.edge(ring, "ixian", 1.6, 1)
|
||||
for i in range(24):
|
||||
a = math.radians(i * 15)
|
||||
cv.solid(cv.line([(64 + 25 * math.cos(a), 64 + 25 * math.sin(a)), (64 + 28 * math.cos(a), 64 + 28 * math.sin(a))], 1), "ixian", .8)
|
||||
lens = cv.circle(64, 64, 12)
|
||||
cv.glow(lens, "ixian", 5, 1)
|
||||
cv.fill(lens, "#bffcf4", "#2fb5ab")
|
||||
# Fremen blue-within-blue iris
|
||||
cv.solid(cv.circle(64, 64, 7), "fremen2")
|
||||
cv.solid(cv.circle(64, 64, 3.6), "#03121f")
|
||||
sparkle(cv, 58, 58, 3.4, "#ffffff")
|
||||
# antenna blades
|
||||
for sx in (-1, 1):
|
||||
cv.solid(cv.poly([(64 + sx * 34, 40), (64 + sx * 46, 30), (64 + sx * 40, 46)]), "gold")
|
||||
return cv.out()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- planet sigils (reuse existing glyph line-art)
|
||||
PLANET_TINT = {
|
||||
"nivareth": "#8fd3ff", "orivane": "#e5b95e", "pelareth": "#9ff3e8", "serevan": "#b78bed", "varkesh": "#ff9a5e",
|
||||
}
|
||||
|
||||
|
||||
def planet(name, src_img):
|
||||
tint = PLANET_TINT[name]
|
||||
cv = Cv(128)
|
||||
disc = cv.circle(64, 64, 58)
|
||||
cv.glow(disc, tint, 5, .6)
|
||||
cv.fill(disc, "#0c2a24", "#040f0c")
|
||||
hex_lattice(cv, disc, tint, .13, 7.5, .55)
|
||||
cv.edge(disc, tint, 1.3, .9)
|
||||
for r, a in ((52, .35), (46, .18)):
|
||||
cv.edge(cv.circle(64, 64, r), tint, .5, a)
|
||||
layer = cv.out((128 * SS, 128 * SS))
|
||||
# recolor the source glyph to the planet tint, keep its alpha
|
||||
s = src_img.convert("RGBA").resize((128 * SS, 128 * SS), Image.LANCZOS)
|
||||
a = s.getchannel("A").point(lambda v: min(255, int(v * 1.25)))
|
||||
tl = Image.new("RGBA", s.size, rgb(tint))
|
||||
tl.putalpha(a)
|
||||
layer = Image.alpha_composite(layer, tl)
|
||||
return layer.resize((128, 128), Image.LANCZOS)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- office crests
|
||||
def office(kind):
|
||||
cv = Cv(64)
|
||||
sh = cv.poly([(32, 4), (56, 13), (56, 34), (32, 60), (8, 34), (8, 13)])
|
||||
tint = {"crown": "#e5b95e", "spice": "#ff9a3d", "water": "#58a8ff"}[kind]
|
||||
cv.glow(sh, tint, 3, .6)
|
||||
cv.fill(sh, "#17372c", "#06150f")
|
||||
cv.bevel(sh, .4, .4, 1)
|
||||
cv.edge(sh, tint, 1.2, 1)
|
||||
cv.edge(cv.poly([(32, 9), (51, 16), (51, 33), (32, 53), (13, 33), (13, 16)]), tint, .5, .5)
|
||||
if kind == "crown":
|
||||
pts = [(18, 38), (17, 20), (25, 28), (32, 16), (39, 28), (47, 20), (46, 38)]
|
||||
cv.glow(cv.line(pts + [pts[0]], 2), tint, 2, .8)
|
||||
cv.solid(cv.line(pts + [pts[0]], 2), "gold3")
|
||||
elif kind == "spice":
|
||||
d = cv.poly([(32, 14), (44, 30), (32, 48), (20, 30)])
|
||||
cv.glow(d, tint, 3, .9)
|
||||
cv.fill(d, "#ffd08a", "#e8913a")
|
||||
cv.edge(d, "#ffffff", .7, .7)
|
||||
cv.solid(cv.line([(32, 14), (32, 48)], .8), "#ffffff", .6)
|
||||
else:
|
||||
drop = cv.circle(32, 36, 11)
|
||||
tri = cv.poly([(32, 12), (42, 31), (22, 31)])
|
||||
full = ImageChops.lighter(drop, tri)
|
||||
cv.glow(full, tint, 3, .9)
|
||||
cv.fill(full, "#bfe3ff", "#2f7fe0")
|
||||
sparkle(cv, 28, 33, 3, "#ffffff")
|
||||
return cv.out()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- extra item icons
|
||||
def spice_crystal(tint_a, tint_b, glow, smuggled=False, dense=False):
|
||||
cv = Cv(64)
|
||||
base = cv.circle(32, 40, 16)
|
||||
cv.glow(base, glow, 6, .35 if not dense else .6)
|
||||
shards = [([(32, 8), (42, 30), (32, 52), (22, 30)], 1.0), ([(16, 22), (24, 40), (14, 54), (8, 38)], .75), ([(48, 20), (56, 38), (48, 54), (40, 38)], .8)]
|
||||
if dense:
|
||||
shards.append(([(32, 24), (38, 40), (32, 58), (26, 40)], .9))
|
||||
for pts, k in shards:
|
||||
m = cv.poly(pts)
|
||||
cv.glow(m, glow, 2, .7)
|
||||
cv.fill(m, mix(tint_a, "#ffffff", .15 * k), tint_b)
|
||||
cv.bevel(m, .55, .4, 1)
|
||||
cv.edge(m, "#ffffff", .5, .35)
|
||||
if smuggled:
|
||||
cv.solid(cv.line([(8, 54), (56, 54)], 2.2), "#101a1f")
|
||||
cv.solid(cv.line([(8, 54), (56, 54)], .6), "#58a8ff")
|
||||
sparkle(cv, 36, 18, 4, "#ffffff")
|
||||
return cv.out()
|
||||
|
||||
|
||||
def water_vial(tint="#58a8ff", smuggled=False):
|
||||
cv = Cv(64)
|
||||
glass = cv.rrect(22, 14, 42, 56, 8)
|
||||
cv.glow(glass, tint, 3, .6)
|
||||
cv.fill(glass, "#d6f1ff", "#2f7fe0", .55)
|
||||
liquid = cv.rrect(24, 30, 40, 54, 7)
|
||||
cv.fill(liquid, "#bfe3ff", tint)
|
||||
cv.edge(glass, "#e8f6ff", 1, .9)
|
||||
cv.solid(cv.rrect(25, 7, 39, 16, 2.5), "gold")
|
||||
cv.solid(cv.line([(27, 24), (27, 46)], 1.6), "#ffffff", .55)
|
||||
if smuggled:
|
||||
cv.solid(cv.rrect(21, 36, 43, 40, 1), "#e8913a")
|
||||
return cv.out()
|
||||
|
||||
|
||||
def imperial_codex():
|
||||
cv = Cv(64)
|
||||
book = cv.rrect(12, 6, 52, 58, 4)
|
||||
cv.glow(book, "gold", 3, .6)
|
||||
cv.fill(book, "#1d4a3a", "#06150f")
|
||||
cv.bevel(book, .4, .4, 1)
|
||||
cv.edge(book, "gold", 1.1, 1)
|
||||
cv.solid(cv.rrect(12, 6, 18, 58, 2), "#0a2018")
|
||||
hx = cv.poly(hexagon(35, 32, 12, 0))
|
||||
cv.edge(hx, "gold3", 1, 1)
|
||||
cv.glow(cv.circle(35, 32, 4), "gold3", 3, 1)
|
||||
cv.solid(cv.circle(35, 32, 3), "#ffffff")
|
||||
for y in (14, 50):
|
||||
cv.solid(cv.line([(24, y), (46, y)], .9), "gold", .8)
|
||||
return cv.out()
|
||||
2
network/resource-pack/central/generator/requirements.txt
Normal file
2
network/resource-pack/central/generator/requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
numpy==2.2.6
|
||||
Pillow==11.2.1
|
||||
20
network/resource-pack/central/inputs.lock.json
Normal file
20
network/resource-pack/central/inputs.lock.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"version": 1,
|
||||
"clientVersion": "26.3",
|
||||
"client": {
|
||||
"sha1": "e877b6a07acd633fb3bb475002175cec036e7b87",
|
||||
"size": 41483720,
|
||||
"url": "https://piston-data.mojang.com/v1/objects/e877b6a07acd633fb3bb475002175cec036e7b87/client.jar"
|
||||
},
|
||||
"inputArchives": {
|
||||
"DuneRealms-Pack-Source.zip": "6e04997793324acd48946ea39e0fc08c4b03cce8c71bceb1fbe5d5d4c7d5e0cd",
|
||||
"DuneRealms-Central-Pack.zip": "01be079ac91687710a94993e5cf9742506f54ef8bc933f3f799340bcc1be0806"
|
||||
},
|
||||
"legacyCustomArtwork": "Extracted DuneRealms namespace from verified original Arrakis Restored pack, SHA256d523977a11351285e18ff7a2ec9ce811f48b866dd73c55a653d57a21ae086516. No vanilla per-world texture layer retained.",
|
||||
"transportSha256": "eb7eacfbb50679b83a4da4a671cb565de2d67b02ee8525d05e345a17cdbe3721",
|
||||
"generatorFont": {
|
||||
"source": "https://github.com/google/fonts/tree/main/ofl/poppins",
|
||||
"sha256": "983676516167748b74de6f4771fb384c664fd913acb8b471122ecacf5da5ea6c",
|
||||
"license": "SIL Open Font License 1.1; inputs/OFL.txt"
|
||||
}
|
||||
}
|
||||
93
network/resource-pack/central/inputs/OFL.txt
Normal file
93
network/resource-pack/central/inputs/OFL.txt
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
BIN
network/resource-pack/central/inputs/Poppins-Bold.ttf
Normal file
BIN
network/resource-pack/central/inputs/Poppins-Bold.ttf
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue

Staff