Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/BANNERMOD_ALMANAC.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h3>Stances and combat rules</h3>
<section class="spread">
<article class="page" id="en-state" data-page="EN 9">
<h2>9. States And Government</h2>
<p>A state is the political actor behind settlements, claims, wars, and allies. Create one with <code>/bannermod state create &lt;name&gt;</code>, inspect with <code>list</code> and <code>info</code>, set capital with <code>setcapital</code>, and change status with <code>status</code>. War Room state screens now show a visible ledger line for waiting-sync, select-first, read-only authority, and next server-checked steps. If you only want another player to share claim and settlement access, use the claim editor's <code>Trusted Members</code> list instead of making them a co-leader.</p>
<p>A state is the political actor behind settlements, claims, wars, and allies. Create one with <code>/bannermod state create &lt;name&gt;</code>, inspect with <code>list</code> and <code>info</code>, set capital with <code>setcapital</code>, and change status with <code>status</code>. War Room state screens now show a visible ledger line for waiting-sync, select-first, read-only authority, and next server-checked steps. <code>Charter</code> opens a dedicated editor that explains where the text appears, and <code>Add co-leader</code> now opens an online player picker while keeping manual nickname or UUID entry for offline targets. If you only want another player to share claim and settlement access, use the claim editor's <code>Trusted Members</code> list instead of making them a co-leader.</p>
<h3>Government forms</h3>
<p><strong>Monarchy</strong> keeps core political authority leader-only. <strong>Republic</strong> lets co-leaders share authority for status, capital, colors, charter, claim edits, ally invites, siege placement, and legal war outcomes. Operators can perform explicitly admin-only outcomes. Trusted Members are different: they may build and manage local work areas in the claim, but they do not get claim-edit or war/state authority.</p>
<h3>Promotion</h3>
Expand Down Expand Up @@ -273,7 +273,7 @@ <h3>Стойки и правила боя</h3>
<section class="spread">
<article class="page" id="ru-state" data-page="RU 9">
<h2>9. Государство и правление</h2>
<p>Государство — политическое лицо поселений, участков, войн и союзов. Создание: <code>/bannermod state create &lt;название&gt;</code>. Просмотр: <code>list</code> и <code>info</code>. Столица: <code>setcapital</code>. Статус: <code>status</code>. Если нужно просто поделиться доступом к клейму и поселению, используй список <code>Доверенные игроки</code> в редакторе клейма, а не со-лидера.</p>
<p>Государство — политическое лицо поселений, участков, войн и союзов. Создание: <code>/bannermod state create &lt;название&gt;</code>. Просмотр: <code>list</code> и <code>info</code>. Столица: <code>setcapital</code>. Статус: <code>status</code>. Кнопка <code>Хартия</code> теперь открывает отдельный редактор и сразу объясняет, где будет виден текст, а <code>Добавить со-лидера</code> открывает список онлайн-игроков, но сохраняет ручной ввод ника или UUID для оффлайн-целей. Если нужно просто поделиться доступом к клейму и поселению, используй список <code>Доверенные игроки</code> в редакторе клейма, а не со-лидера.</p>
<h3>Формы правления</h3>
<p><strong>Монархия</strong> оставляет основные решения лидеру. <strong>Республика</strong> даёт соправителям общие полномочия: статус, столица, цвета, устав, правки участков, приглашение союзников, постановка осады и законные итоги войны. Операторы сервера могут выполнять действия, явно отмеченные как административные. Доверенные игроки работают иначе: они могут строить и управлять местными рабочими зонами в клейме, но не получают власти над государством, дипломатией или войной.</p>
<h3>Повышение</h3>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
package com.talhanation.bannermod.client.military.gui.war;

import com.talhanation.bannermod.client.military.gui.MilitaryGuiStyle;
import com.talhanation.bannermod.client.military.gui.component.RecruitsMultiLineEditBox;
import com.talhanation.bannermod.war.registry.PoliticalRegistryValidation;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;

import java.util.List;
import java.util.function.Consumer;

public class PoliticalEntityCharterScreen extends Screen {
private static final int W = 320;
private static final int H = 224;

private final Screen parent;
private final Consumer<String> onSubmit;
private final String initialValue;
private int guiLeft;
private int guiTop;
private RecruitsMultiLineEditBox charterBox;

public PoliticalEntityCharterScreen(Screen parent, String initialValue, Consumer<String> onSubmit) {
super(Component.translatable("gui.bannermod.states.dialog.charter.title"));
this.parent = parent;
this.onSubmit = onSubmit;
this.initialValue = initialValue == null ? "" : initialValue;
}

@Override
protected void init() {
super.init();
this.guiLeft = (this.width - W) / 2;
this.guiTop = Math.max(8, (this.height - H) / 2);

this.charterBox = new RecruitsMultiLineEditBox(font, guiLeft + 14, guiTop + 68, W - 28, 100, Component.empty(), Component.empty());
this.charterBox.setValue(this.initialValue);
this.charterBox.setEnableEditing(true);
this.charterBox.setCharacterLimit(PoliticalRegistryValidation.MAX_CHARTER_LENGTH);
this.charterBox.setFocused(true);
addRenderableWidget(this.charterBox);
setInitialFocus(this.charterBox);

addRenderableWidget(Button.builder(Component.translatable("gui.bannermod.common.submit"), button -> submit())
.bounds(guiLeft + 14, guiTop + H - 28, 88, 20)
.build());
addRenderableWidget(Button.builder(Component.translatable("gui.bannermod.states.dialog.charter.clear"), button -> clearDraft())
.bounds(guiLeft + 116, guiTop + H - 28, 88, 20)
.build());
addRenderableWidget(Button.builder(Component.translatable("gui.bannermod.common.back"), button -> onClose())
.bounds(guiLeft + W - 102, guiTop + H - 28, 88, 20)
.build());
}

private void submit() {
this.onSubmit.accept(this.charterBox.getValue().trim());
onClose();
}

private void clearDraft() {
this.charterBox.setValue("");
this.charterBox.setFocused(true);
}

@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
graphics.fill(0, 0, width, height, 0x66000000);
MilitaryGuiStyle.parchmentPanel(graphics, guiLeft, guiTop, W, H);
MilitaryGuiStyle.titleStrip(graphics, guiLeft + 8, guiTop + 8, W - 16, 14);
MilitaryGuiStyle.parchmentInset(graphics, guiLeft + 10, guiTop + 24, W - 20, 36);
MilitaryGuiStyle.insetPanel(graphics, guiLeft + 12, guiTop + 66, W - 24, 104);

MilitaryGuiStyle.drawCenteredTitle(graphics, font, title, guiLeft, guiTop + 11, W);
drawWrapped(graphics,
Component.translatable("gui.bannermod.states.dialog.charter.subtitle"),
guiLeft + 16,
guiTop + 30,
W - 32,
MilitaryGuiStyle.TEXT_DARK);
graphics.drawString(font,
Component.translatable("gui.bannermod.states.dialog.charter.prompt", PoliticalRegistryValidation.MAX_CHARTER_LENGTH),
guiLeft + 14,
guiTop + 58,
MilitaryGuiStyle.TEXT_MUTED,
false);

if (this.charterBox != null) {
String count = Component.translatable(
"gui.bannermod.states.dialog.charter.count",
this.charterBox.getValue().length(),
PoliticalRegistryValidation.MAX_CHARTER_LENGTH).getString();
graphics.drawString(font, count, guiLeft + 14, guiTop + 176, MilitaryGuiStyle.TEXT_MUTED, false);
Component preview = this.charterBox.getValue().isBlank()
? Component.translatable("gui.bannermod.states.dialog.charter.empty")
: Component.translatable("gui.bannermod.states.dialog.charter.preview", this.charterBox.getValue().replaceAll("\\s+", " ").trim());
graphics.drawString(font,
font.plainSubstrByWidth(preview.getString(), W - 32),
guiLeft + 14,
guiTop + 188,
this.charterBox.getValue().isBlank() ? MilitaryGuiStyle.TEXT_MUTED : MilitaryGuiStyle.TEXT_DARK,
false);
}

super.render(graphics, mouseX, mouseY, partialTick);
}

private int drawWrapped(GuiGraphics graphics, Component text, int x, int y, int width, int color) {
List<net.minecraft.util.FormattedCharSequence> lines = this.font.split(text, width);
for (net.minecraft.util.FormattedCharSequence line : lines) {
graphics.drawString(this.font, line, x, y, color, false);
y += 10;
}
return y;
}

@Override
public void onClose() {
if (parent != null) {
this.minecraft.setScreen(parent);
} else {
super.onClose();
}
}

@Override
public boolean isPauseScreen() {
return false;
}
}
Loading
Loading