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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/assets/edenmod/textures/gui/icons/nol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/assets/edenmod/textures/gui/icons/notg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/assets/edenmod/textures/gui/icons/tcc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/assets/edenmod/textures/gui/icons/tna.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/assets/edenmod/textures/gui/icons/wtp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 53 additions & 3 deletions src/tel/eden/mod/EdenModClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,35 @@ public void openCenteredEmotePicker() {
});
}

private volatile String currentWynnWorld = "";
private volatile boolean festivalEnabled = false;
private volatile boolean annihilationActive = false;

public String currentWynnWorld() {
return currentWynnWorld;
}

public boolean isFestivalEnabled() {
return festivalEnabled;
}

public boolean isAnnihilationActive() {
return annihilationActive;
}

public PartyInfo activeParty() {
String ign = playerName();
if (ign == null || ign.isBlank()) {
return null;
}
for (PartyInfo party : knownParties) {
if (party.host().equalsIgnoreCase(ign) || party.members().stream().anyMatch(m -> m.equalsIgnoreCase(ign))) {
return party;
}
}
return null;
}

/** An immutable snapshot of the currently known parties, safe to read off-thread. */
public java.util.List<PartyInfo> knownParties() {
return knownParties;
Expand Down Expand Up @@ -1134,6 +1163,12 @@ public void onPartyUpdate(String event, String actor, PartyInfo party, String co
}
}

@Override
public void onPartyConfig(boolean festivalEnabled, boolean annihilationActive) {
EdenModClient.this.festivalEnabled = festivalEnabled;
EdenModClient.this.annihilationActive = annihilationActive;
}

@Override
public void onPartyList(java.util.List<PartyInfo> parties, String color) {
replaceKnownParties(parties);
Expand Down Expand Up @@ -2588,14 +2623,27 @@ private void setInGameWorld(boolean active) {
/** Returns true when the Wynncraft tab list is visible (game world or /class screen). */
private boolean checkWynncraftTabActive(Minecraft mc) {
net.minecraft.client.multiplayer.ClientPacketListener conn = mc.getConnection();
if (conn == null)
if (conn == null) {
currentWynnWorld = "";
return false;
}
for (net.minecraft.client.multiplayer.PlayerInfo info : conn.getOnlinePlayers()) {
net.minecraft.network.chat.Component name = info.getTabListDisplayName();
if (name != null && (name.getString().contains("Global [") || name.getString().contains("Island Info"))) {
return true;
if (name != null) {
String str = name.getString();
if (str.contains("Global [") || str.contains("Island Info")) {
if (str.contains("Global [")) {
int start = str.indexOf("Global [") + 8;
int end = str.indexOf(']', start);
if (end > start) {
currentWynnWorld = str.substring(start, end).trim();
}
}
return true;
}
}
}
currentWynnWorld = "";
return false;
}

Expand Down Expand Up @@ -2690,6 +2738,7 @@ private synchronized void disconnect() {
partyCommandGeneration.incrementAndGet();
onWynncraft = false;
loginPending = false;
currentWynnWorld = "";
bridgeStatus = BridgeStatus.UNKNOWN;
liveGuildRank = "";
liveDiscordRank = "";
Expand Down Expand Up @@ -2854,6 +2903,7 @@ public void handleSystemChat(Component message) {
// Annihilation world-event warning (the only advance timing signal we get).
java.util.OptionalInt anni = AnnihilationParser.parse(message);
if (anni.isPresent()) {
annihilationActive = true;
int seconds = anni.getAsInt();
if (annihilationRelay.shouldSend(new CapturedMessage("annihilation", null, String.valueOf(seconds)))) {
current.sendAnnihilation(seconds);
Expand Down
55 changes: 51 additions & 4 deletions src/tel/eden/mod/chat/PartyFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ private PartyFormatter() {

/** "<host> wants to raid <raid> (n/max) [JOIN #id]" with the open note, if any. */
public static Component partyOpen(PartyInfo party) {
MutableComponent body = Component.empty().append(Component.literal(party.host()).withStyle(ChatFormatting.AQUA)).append(Component.literal(" wants to raid ").withStyle(ChatFormatting.GREEN)).append(Component.literal(party.raid()).withStyle(ChatFormatting.YELLOW)).append(Component.literal(" (" + party.size() + "/" + party.max() + ") ").withStyle(ChatFormatting.GRAY)).append(joinButton(party.id()));
MutableComponent body = Component.empty();
if (party.ally()) {
body.append(Component.literal("[Ally] ").withStyle(ChatFormatting.LIGHT_PURPLE));
}
String action = "Festival Minigames".equalsIgnoreCase(party.raid()) ? " wants to play " : " wants to raid ";
Style countStyle = Style.EMPTY.withColor(ChatFormatting.GRAY).withHoverEvent(new HoverEvent.ShowText(playerListHover(party)));
body.append(Component.literal(party.host()).withStyle(ChatFormatting.AQUA)).append(Component.literal(action).withStyle(ChatFormatting.GREEN)).append(Component.literal(party.raid()).withStyle(ChatFormatting.YELLOW)).append(Component.literal(" (" + party.size() + "/" + party.max() + ") ").setStyle(countStyle));
if (party.world() != null && !party.world().isBlank()) {
body.append(Component.literal("[" + party.world() + "] ").withStyle(ChatFormatting.DARK_AQUA));
}
body.append(joinButton(party.id()));
if (!party.note().isBlank()) {
body.append(Component.literal(" — ").withStyle(ChatFormatting.GRAY)).append(Component.literal("\"" + party.note() + "\"").withStyle(Style.EMPTY.withColor(ChatFormatting.WHITE).withItalic(true)));
}
Expand All @@ -43,7 +53,12 @@ public static Component partyLeave(String actor, PartyInfo party) {

/** "Party #id (<raid>) is full! [Create party]" (the button shows for the host). */
public static Component partyFull(PartyInfo party) {
MutableComponent body = Component.empty().append(Component.literal("Party #" + party.id() + " ").withStyle(ChatFormatting.GOLD)).append(Component.literal("(" + party.raid() + ") ").withStyle(ChatFormatting.YELLOW)).append(Component.literal("is full! ").withStyle(ChatFormatting.GREEN)).append(Component.literal(String.join(", ", party.members())).withStyle(ChatFormatting.GRAY));
MutableComponent body = Component.empty();
if (party.ally()) {
body.append(Component.literal("[Ally] ").withStyle(ChatFormatting.LIGHT_PURPLE));
}
List<String> realMembers = party.members().stream().filter(m -> !m.equals("*filled*")).toList();
body.append(Component.literal("Party #" + party.id() + " ").withStyle(ChatFormatting.GOLD)).append(Component.literal("(" + party.raid() + ") ").withStyle(ChatFormatting.YELLOW)).append(Component.literal("is full! ").withStyle(ChatFormatting.GREEN)).append(Component.literal(String.join(", ", realMembers)).withStyle(ChatFormatting.GRAY));
// Offer the host a one-click "make the in-game party" prompt.
String self = localName();
if (self != null && self.equalsIgnoreCase(party.host()) && !party.members().isEmpty()) {
Expand All @@ -54,7 +69,8 @@ public static Component partyFull(PartyInfo party) {

/** Clickable that runs {@code /eden party makeingame <igns...>} to form the in-game party. */
private static Component createButton(PartyInfo party) {
Style style = Style.EMPTY.withColor(ChatFormatting.GOLD).withUnderlined(true).withClickEvent(new ClickEvent.RunCommand("/eden party makeingame " + String.join(" ", party.members()))).withHoverEvent(new HoverEvent.ShowText(Component.literal("Click to create the in-game party and invite everyone")));
List<String> realMembers = party.members().stream().filter(m -> !m.equals("*filled*")).toList();
Style style = Style.EMPTY.withColor(ChatFormatting.GOLD).withUnderlined(true).withClickEvent(new ClickEvent.RunCommand("/eden party makeingame " + String.join(" ", realMembers))).withHoverEvent(new HoverEvent.ShowText(Component.literal("Click to create the in-game party and invite everyone")));
return Component.literal("[Create party]").setStyle(style);
}

Expand All @@ -71,8 +87,17 @@ public static Component listing(List<PartyInfo> parties) {
MutableComponent out = line(Component.literal("Open Eden parties (" + parties.size() + "):").withStyle(ChatFormatting.GREEN));
for (PartyInfo party : parties) {
out.append("\n");
if (party.ally()) {
out.append(Component.literal("[Ally] ").withStyle(ChatFormatting.LIGHT_PURPLE));
} else {
out.append(Component.literal("[Guild] ").withStyle(ChatFormatting.DARK_GREEN));
}
out.append(Component.literal(" " + party.raid() + " ").withStyle(ChatFormatting.YELLOW));
out.append(Component.literal(party.size() + "/" + party.max() + " | ").withStyle(ChatFormatting.GRAY));
Style countStyle = Style.EMPTY.withColor(ChatFormatting.GRAY).withHoverEvent(new HoverEvent.ShowText(playerListHover(party)));
out.append(Component.literal(party.size() + "/" + party.max() + " | ").setStyle(countStyle));
if (party.world() != null && !party.world().isBlank()) {
out.append(Component.literal("[" + party.world() + "] ").withStyle(ChatFormatting.DARK_AQUA));
}
out.append(Component.literal(party.host() + " ").withStyle(ChatFormatting.AQUA));
out.append(joinButton(party.id()));
if (!party.note().isBlank()) {
Expand All @@ -95,4 +120,26 @@ private static Component joinButton(int id) {
Style style = Style.EMPTY.withColor(ChatFormatting.GREEN).withUnderlined(true).withClickEvent(new ClickEvent.RunCommand("/eden party join " + id)).withHoverEvent(new HoverEvent.ShowText(Component.literal("Click to join party #" + id)));
return Component.literal("[JOIN #" + id + "]").setStyle(style);
}

private static Component playerListHover(PartyInfo party) {
MutableComponent tooltip = Component.literal("Party Members (" + party.size() + "/" + party.max() + "):").withStyle(ChatFormatting.GOLD);
for (int i = 0; i < party.size(); i++) {
tooltip.append("\n");
String raw = party.members().get(i);
if ("*filled*".equals(raw)) {
tooltip.append(Component.literal("• ").withStyle(ChatFormatting.DARK_GRAY)).append(Component.literal("*filled slot*").withStyle(ChatFormatting.GRAY));
} else {
String display = party.displayMember(i);
tooltip.append(Component.literal("• ").withStyle(ChatFormatting.DARK_GRAY)).append(Component.literal(display).withStyle(i == 0 ? ChatFormatting.AQUA : ChatFormatting.WHITE));
if (i == 0) {
tooltip.append(Component.literal(" (Host)").withStyle(ChatFormatting.YELLOW));
}
}
}
int open = party.max() - party.size();
if (open > 0) {
tooltip.append("\n").append(Component.literal("+ " + open + " open slot" + (open == 1 ? "" : "s")).withStyle(ChatFormatting.DARK_GRAY));
}
return tooltip;
}
}
13 changes: 3 additions & 10 deletions src/tel/eden/mod/gui/EdenMenuScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,11 @@ protected void init() {
}).bounds(metrics.buttonX, metrics.startY + metrics.buttonPitch, metrics.buttonWidth, metrics.buttonHeight).build());

this.addRenderableWidget(Button.builder(Component.literal("Manage Party"), button -> {
String ign = EdenModClient.instance().playerName();
tel.eden.mod.net.PartyInfo myParty = null;
for (tel.eden.mod.net.PartyInfo p : EdenModClient.instance().knownParties()) {
if (ign != null && p.host().equalsIgnoreCase(ign)) {
myParty = p;
break;
}
}
tel.eden.mod.net.PartyInfo myParty = EdenModClient.instance() != null ? EdenModClient.instance().activeParty() : null;
if (myParty != null) {
this.minecraft.setScreen(new PartyManageScreen(this, EdenModClient.instance(), myParty));
} else {
this.minecraft.player.displayClientMessage(Component.literal("You are not hosting a party!").withStyle(net.minecraft.ChatFormatting.RED), false);
} else if (this.minecraft.player != null) {
this.minecraft.player.displayClientMessage(Component.literal("You are not in an active party!").withStyle(net.minecraft.ChatFormatting.RED), false);
}
}).bounds(metrics.buttonX, metrics.startY + (metrics.buttonPitch * 2), metrics.buttonWidth, metrics.buttonHeight).build());

Expand Down
Loading
Loading