Skip to content
Open
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
50 changes: 27 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Gradle / build output
.gradle/
build/
run/
*.class

# IDE
.idea/
*.iml
*.ipr
*.iws
.vscode/
bin/
CLAUDE.md

# OS
.DS_Store
Thumbs.db

# Backups
*.bak
resources/assets/edenmod/font/emotes.json
resources/assets/edenmod/emotes_manifest.json
# Gradle / build output
.gradle/
build/
run/
*.class

# IDE
.idea/
*.iml
*.ipr
*.iws
.vscode/
bin/
CLAUDE.md

# OS
.DS_Store
Thumbs.db

# Backups
*.bak
resources/assets/edenmod/font/emotes.json
resources/assets/edenmod/emotes_manifest.json

# Agents
.agents/
AGENTS.md
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/tel/eden/mod/EdenModClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ public boolean isChiefOwnerOrStrategist() {
public void onWorldRespawn() {
enteredWynnGameWorld = true;
guildLogSync.onWorldJoin();
tel.eden.mod.war.eco.TerritoryGuideController.reset();
}

/** Packet hooks for the invisible guild-log query (mirrors Wynntils' query path). */
Expand Down Expand Up @@ -546,6 +547,13 @@ public boolean shouldMuteBackgroundMenuClick(SoundEvent sound, SoundSource sourc
public void onInitializeClient() {
instance = this;
config = BridgeConfig.load();
if (config.territoryActivePreset != null && !config.territoryActivePreset.isBlank()) {
try {
tel.eden.mod.war.eco.TerritoryGuideController.setActivePreset(tel.eden.mod.war.eco.TerritoryPresetCodec.parse(config.territoryActivePreset));
} catch (Exception ignored) {
}
}
tel.eden.mod.gui.TerritoryMenuPanel.init();
refreshCommandKeybinds();

// Relay the guild's live reward storage to the backend counter: the exact value
Expand Down Expand Up @@ -663,6 +671,7 @@ public void release() {
GuildMenuScraper.reset();
AttackTimerMenu.reset();
tel.eden.mod.war.radiance.RadianceTracker.onJoin();
tel.eden.mod.war.eco.TerritoryGuideController.reset();
guildAllyManager.requestCancel();
// Connect if applicable; the backend reports link/membership standing via
// authOk (handleAuthStatus), which drives any "please link" prompt.
Expand Down Expand Up @@ -2371,6 +2380,7 @@ private synchronized void disconnect() {
PartyHealthTracker.reset();
ChatReplyManager.reset();
tel.eden.mod.war.radiance.RadianceTracker.onDisconnect();
tel.eden.mod.war.eco.TerritoryGuideController.reset();
guildAllyManager.requestCancel();
territoryDefendedTracker.clear();
// Before the socket goes: an outstanding deduct must not outlive the session that
Expand Down
13 changes: 13 additions & 0 deletions src/tel/eden/mod/config/BridgeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ public void sanitize() {
/** Territories excluded from playing the territory loss sound when captured. */
public List<String> territoryLossBlacklist = new ArrayList<>(DEFAULT_TERRITORY_LOSS_BLACKLIST);

// ---- Territory Preset Helper (Wynntils Add-on) ----
/** Master toggle for the Territory Preset Helper Wynntils add-on. On by default. */
public boolean territoryMenuSuite = true;

/** Active territory preset encoded Base64 or JSON string, or empty. */
public String territoryActivePreset = "";

/** Storage of saved territory presets: name -> encoded string or JSON. */
public Map<String, String> territorySavedPresets = new java.util.LinkedHashMap<>();

/**
* Run {@code /stream} automatically on entering a Wynncraft world. Off by default:
* it changes what the server shows you, so it should be an opt-in.
Expand Down Expand Up @@ -492,6 +502,9 @@ public static BridgeConfig load() {
} else {
config.radianceAdvanceNoticeSeconds = Math.max(0.0, Math.min(3.0, Math.round(config.radianceAdvanceNoticeSeconds * 4.0) / 4.0));
}
if (config.territorySavedPresets == null) {
config.territorySavedPresets = new java.util.LinkedHashMap<>();
}
return config;
}
} catch (IOException | RuntimeException e) {
Expand Down
1 change: 1 addition & 0 deletions src/tel/eden/mod/gui/BridgeConfigScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ protected void init() {
config.save();
EdenModClient.syncRadianceGroup(config);
});
addToggleRow(Category.WAR, "Territory preset helper", () -> config.territoryMenuSuite, v -> config.territoryMenuSuite = v, "On", "Off", true);

// Visuals & QoL
if (config.isSecretUnlocked(BridgeConfig.SECRET_BABY_PLAYERS)) {
Expand Down
85 changes: 85 additions & 0 deletions src/tel/eden/mod/gui/RenamePresetScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package tel.eden.mod.gui;

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.input.KeyEvent;
import net.minecraft.network.chat.Component;
import org.lwjgl.glfw.GLFW;
import tel.eden.mod.war.eco.TerritoryGuideController;

/**
* Modal dialog allowing the user to rename a saved territory preset.
*/
public class RenamePresetScreen extends Screen {
private final Screen parent;
private final String oldName;
private EditBox nameField;

public RenamePresetScreen(Screen parent, String oldName) {
super(Component.literal("Rename Preset"));
this.parent = parent;
this.oldName = oldName;
}

@Override
protected void init() {
int panelW = 220;
int panelH = 92;
int x = (this.width - panelW) / 2;
int y = (this.height - panelH) / 2;

nameField = new EditBox(this.font, x + 15, y + 30, panelW - 30, 20, Component.literal("Preset Name"));
nameField.setValue(oldName != null ? oldName : "");
nameField.setMaxLength(32);
this.addRenderableWidget(nameField);
this.setInitialFocus(nameField);

int btnW = (panelW - 36) / 2;
this.addRenderableWidget(Button.builder(Component.literal("Save"), b -> commit()).bounds(x + 15, y + 58, btnW, 20).build());
this.addRenderableWidget(Button.builder(Component.literal("Cancel"), b -> onClose()).bounds(x + 21 + btnW, y + 58, btnW, 20).build());
}

private void commit() {
if (nameField != null) {
String newName = nameField.getValue().trim();
if (newName.isEmpty()) {
newName = "Default";
}
if (!newName.equalsIgnoreCase(oldName)) {
TerritoryGuideController.renameSavedPreset(oldName, newName);
}
}
onClose();
}

@Override
public boolean keyPressed(KeyEvent event) {
if (event.key() == GLFW.GLFW_KEY_ENTER || event.key() == GLFW.GLFW_KEY_KP_ENTER) {
commit();
return true;
}
return super.keyPressed(event);
}

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

@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
int panelW = 220;
int panelH = 92;
int x = (this.width - panelW) / 2;
int y = (this.height - panelH) / 2;

graphics.fill(x, y, x + panelW, y + panelH, 0xF012161E);
graphics.renderOutline(x, y, panelW, panelH, 0xFF3E4A5B);
graphics.drawString(this.font, "§6Rename Preset", x + 15, y + 14, 0xFFFFFFFF);
super.render(graphics, mouseX, mouseY, delta);
}
}
Loading
Loading