forked from unimatrix/web
Offer opt-in fullscreen Guild travel, spice sales and war reports
This commit is contained in:
parent
4abc909ed4
commit
37dc50d850
1 changed files with 106 additions and 28 deletions
|
|
@ -39,7 +39,10 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
private static final int FULL_CARD_LORE_LINES = 5;
|
||||
private static final Font FULL_CARD_LORE = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
|
||||
private static final Font CHECKOUT_TERMS = new Font(Font.SANS_SERIF, Font.BOLD, 15);
|
||||
private static final Font CODEX_CARD_TITLE = new Font(Font.SANS_SERIF, Font.BOLD, 13);
|
||||
private static final Font COMPACT_CARD_TITLE = new Font(Font.SANS_SERIF, Font.BOLD, 13);
|
||||
private static final Font SPICE_LORE = new Font(Font.SANS_SERIF, Font.PLAIN, 11);
|
||||
private static final Font GUILD_TERMS = new Font(Font.SANS_SERIF, Font.PLAIN, 11);
|
||||
private static final int GUILD_TERMS_WIDTH = 108, GUILD_TERMS_LINES = 16;
|
||||
private static final Font ARCHIVE_LORE = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
|
||||
private static final int ARCHIVE_COLUMN_LINES = 7;
|
||||
private static final int ARCHIVE_COLUMN_WIDTH = 177;
|
||||
|
|
@ -478,6 +481,8 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
case ORGANISATION -> new Palette(new Color(16, 31, 37), new Color(29, 75, 79), new Color(142, 228, 211));
|
||||
case EXCHANGE, EXCHANGE_CHECKOUT -> new Palette(new Color(42, 28, 18), new Color(91, 62, 36), new Color(245, 208, 139));
|
||||
case CODEX, ITEM_ARCHIVE -> new Palette(new Color(40, 33, 24), new Color(90, 63, 37), new Color(246, 221, 158));
|
||||
case GUILD -> new Palette(new Color(14, 28, 47), new Color(28, 58, 83), new Color(188, 224, 249));
|
||||
case SPICE -> new Palette(new Color(54, 25, 16), new Color(105, 54, 33), new Color(255, 214, 133));
|
||||
case JOURNAL -> new Palette(new Color(30, 40, 31), new Color(61, 80, 51), new Color(235, 212, 154));
|
||||
case HOUSE -> new Palette(new Color(34, 26, 39), new Color(72, 52, 79), new Color(244, 211, 152));
|
||||
case AUTO -> scene.roleplay == null
|
||||
|
|
@ -498,6 +503,11 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
var terms = checkoutTerms(graphics, document.description());
|
||||
if (terms.isEmpty() || terms.size() > 9) return false;
|
||||
}
|
||||
if (document.style() == Style.GUILD) {
|
||||
graphics.setFont(GUILD_TERMS);
|
||||
var terms = guildTerms(graphics, document);
|
||||
if (terms.lines().isEmpty() || !terms.complete()) return false;
|
||||
}
|
||||
if (document.style() == Style.ITEM_ARCHIVE) {
|
||||
long actionCount = document.cards().stream().filter(Card::actionable).count();
|
||||
if (actionCount < 1 || actionCount > 2 || actionCount == document.cards().size()) return false;
|
||||
|
|
@ -515,8 +525,8 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
}
|
||||
if (usesFullCardLore(document.style())) {
|
||||
if (!fitsFullCardTitle(graphics, document.style(), card)) return false;
|
||||
graphics.setFont(FULL_CARD_LORE);
|
||||
if (!fullCardLore(graphics, card).complete) return false;
|
||||
graphics.setFont(document.style() == Style.SPICE ? SPICE_LORE : FULL_CARD_LORE);
|
||||
if (!fullCardLore(graphics, document.style(), card).complete) return false;
|
||||
continue;
|
||||
}
|
||||
if (!wrap(graphics, card.title(), 114, seal ? 2 : 3).complete) return false;
|
||||
|
|
@ -530,17 +540,28 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
}
|
||||
|
||||
private static Font styledHeadingFont(Style style) {
|
||||
return new Font(Font.SANS_SERIF, Font.BOLD, style == Style.ITEM_ARCHIVE ? 30 : 38);
|
||||
return new Font(Font.SANS_SERIF, Font.BOLD, style == Style.ITEM_ARCHIVE || style == Style.GUILD ? 28 : 38);
|
||||
}
|
||||
|
||||
private static boolean usesFullCardLore(Style style) {
|
||||
return style == Style.JOURNAL || style == Style.CODEX || style == Style.ITEM_ARCHIVE;
|
||||
return switch (style) {
|
||||
case JOURNAL, CODEX, ITEM_ARCHIVE, GUILD, SPICE -> true;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean fitsFullCardTitle(java.awt.Graphics2D draw, Style style, Card card) {
|
||||
boolean codex = style == Style.CODEX;
|
||||
draw.setFont(codex ? CODEX_CARD_TITLE : CARD_TITLE);
|
||||
return wrap(draw, card.title(), 114, codex ? 3 : 2).complete();
|
||||
boolean compact = compactCardTitle(style);
|
||||
draw.setFont(compact ? COMPACT_CARD_TITLE : CARD_TITLE);
|
||||
return wrap(draw, card.title(), 114, compact ? 3 : 2).complete();
|
||||
}
|
||||
|
||||
private static boolean compactCardTitle(Style style) {
|
||||
return style == Style.CODEX || style == Style.GUILD || style == Style.SPICE;
|
||||
}
|
||||
|
||||
private static Wrapped guildTerms(java.awt.Graphics2D draw, Document document) {
|
||||
return wrapLore(draw, document.description().lines().toList(), GUILD_TERMS_WIDTH, GUILD_TERMS_LINES);
|
||||
}
|
||||
|
||||
private static Wrapped archiveLore(java.awt.Graphics2D draw, Card card) {
|
||||
|
|
@ -584,8 +605,8 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
return lines;
|
||||
}
|
||||
|
||||
private static Wrapped fullCardLore(java.awt.Graphics2D draw, Card card) {
|
||||
return wrapLore(draw, card.lore(), 114, FULL_CARD_LORE_LINES);
|
||||
private static Wrapped fullCardLore(java.awt.Graphics2D draw, Style style, Card card) {
|
||||
return wrapLore(draw, card.lore(), 114, style == Style.SPICE ? 6 : FULL_CARD_LORE_LINES);
|
||||
}
|
||||
|
||||
private static Wrapped wrapLore(java.awt.Graphics2D draw, List<String> entries, int width, int limit) {
|
||||
|
|
@ -629,6 +650,16 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
draw.setColor(palette.background.darker());
|
||||
draw.fillRect(644, 389, 120, 232);
|
||||
switch (document.style()) {
|
||||
case GUILD -> {
|
||||
draw.setColor(palette.accent);
|
||||
draw.setFont(GUILD_TERMS);
|
||||
int y = 406;
|
||||
for (String line : guildTerms(draw, document).lines()) {
|
||||
draw.drawString(line, 649, y);
|
||||
y += draw.getFontMetrics().getHeight();
|
||||
}
|
||||
}
|
||||
case SPICE -> drawSceneArt(draw, "npc_world_arrakis", 650, 422, 108, 162);
|
||||
case JOURNAL, CODEX -> {
|
||||
drawResource(draw, "/mcgui/dunerealms-season-logo-v2.png", 650, 449, 108, 96);
|
||||
draw.setColor(palette.accent);
|
||||
|
|
@ -669,16 +700,19 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
if (usesFullCardLore(style)) {
|
||||
draw.drawLine(x + 7, y + 48, x + 121, y + 48);
|
||||
draw.setColor(Color.WHITE);
|
||||
boolean codex = style == Style.CODEX;
|
||||
draw.setFont(codex ? CODEX_CARD_TITLE : CARD_TITLE);
|
||||
writeWrapped(draw, card.title(), x + 7, y + (codex ? 15 : 21), 114, codex ? 3 : 2);
|
||||
boolean compact = compactCardTitle(style);
|
||||
draw.setFont(compact ? COMPACT_CARD_TITLE : CARD_TITLE);
|
||||
writeWrapped(draw, card.title(), x + 7, y + (compact ? 15 : 21), 114, compact ? 3 : 2);
|
||||
draw.setColor(palette.accent);
|
||||
draw.setFont(FULL_CARD_LORE);
|
||||
int lineY = y + 64;
|
||||
for (String line : fullCardLore(draw, card).lines()) {
|
||||
draw.setFont(style == Style.SPICE ? SPICE_LORE : FULL_CARD_LORE);
|
||||
int lineY = y + (style == Style.SPICE ? 55 : 64);
|
||||
for (String line : fullCardLore(draw, style, card).lines()) {
|
||||
draw.drawString(line, x + 7, lineY);
|
||||
lineY += draw.getFontMetrics().getHeight();
|
||||
}
|
||||
if (style == Style.GUILD && card.actionable() && card.material().startsWith("guild_world_")) {
|
||||
drawSceneArt(draw, "npc_world_" + card.material().substring("guild_world_".length()), x + 70, y + 76, 51, 42);
|
||||
}
|
||||
return true;
|
||||
} else if (style == Style.ORGANISATION) {
|
||||
draw.fillRect(x, y + 3, 4, 122);
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff