aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java157
3 files changed, 162 insertions, 3 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
index b8659b69..92e366c0 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
@@ -34,6 +34,7 @@ import kr.syeyoung.dungeonsguide.features.impl.etc.*;
import kr.syeyoung.dungeonsguide.features.impl.etc.ability.FeatureAbilityCooldown;
import kr.syeyoung.dungeonsguide.features.impl.party.APIKey;
import kr.syeyoung.dungeonsguide.features.impl.party.FeaturePartyList;
+import kr.syeyoung.dungeonsguide.features.impl.party.FeaturePartyReady;
import kr.syeyoung.dungeonsguide.features.impl.party.customgui.FeatureCustomPartyFinder;
import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin;
import kr.syeyoung.dungeonsguide.features.impl.secret.*;
@@ -163,6 +164,7 @@ public class FeatureRegistry {
public static final FeatureViewPlayerOnJoin PARTYKICKER_VIEWPLAYER = register(new FeatureViewPlayerOnJoin());
public static final FeatureCustomPartyFinder PARTYKICKER_CUSTOM = register(new FeatureCustomPartyFinder());
public static final FeaturePartyList PARTY_LIST = register(new FeaturePartyList());
+ public static final FeaturePartyReady PARTY_READY = register(new FeaturePartyReady());
public static final FeatureTooltipDungeonStat ETC_DUNGEONSTAT = register(new FeatureTooltipDungeonStat());
public static final FeatureTooltipPrice ETC_PRICE = register(new FeatureTooltipPrice());
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java
index 0222b97b..ddf0a34b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java
@@ -31,7 +31,7 @@ import java.util.List;
public class FeaturePartyList extends TextHUDFeature {
public FeaturePartyList() {
- super("Party","Party List", "Party List as GUI", "party.list", false, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT);
+ super("Party","Party List", "Party List as GUI", "party.list", false, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT*4);
getStyles().add(new TextStyle("name", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false));
getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false));
getStyles().add(new TextStyle("player", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false));
@@ -51,7 +51,7 @@ public class FeaturePartyList extends TextHUDFeature {
private static final List<StyledText> dummyText = new ArrayList<StyledText>();
static {
- dummyText.add(new StyledText("\nLeader","name"));
+ dummyText.add(new StyledText("Leader","name"));
dummyText.add(new StyledText(": ","separator"));
dummyText.add(new StyledText("syeyoung","player"));
dummyText.add(new StyledText("\nModerator","name"));
@@ -77,7 +77,7 @@ public class FeaturePartyList extends TextHUDFeature {
public List<StyledText> getText() {
PartyContext pc = PartyManager.INSTANCE.getPartyContext();
List<StyledText> text= new ArrayList<>();
- text.add(new StyledText("\nLeader","name"));
+ text.add(new StyledText("Leader","name"));
text.add(new StyledText(": ","separator"));
text.add(new StyledText(pc.getPartyOwner()+"","player"));
text.add(new StyledText("\nModerator","name"));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java
new file mode 100644
index 00000000..526ca37a
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java
@@ -0,0 +1,157 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.features.impl.party;
+
+import kr.syeyoung.dungeonsguide.DungeonsGuide;
+import kr.syeyoung.dungeonsguide.chat.PartyContext;
+import kr.syeyoung.dungeonsguide.chat.PartyManager;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
+import kr.syeyoung.dungeonsguide.features.listener.ChatListener;
+import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener;
+import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener;
+import kr.syeyoung.dungeonsguide.features.text.StyledText;
+import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature;
+import kr.syeyoung.dungeonsguide.features.text.TextStyle;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+
+import java.util.*;
+
+public class FeaturePartyReady extends TextHUDFeature implements ChatListener, DungeonStartListener {
+ public FeaturePartyReady() {
+ super("Party","Party Ready List", "Check if your party member have said r or not", "party.readylist", false, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT*4);
+ getStyles().add(new TextStyle("player", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false));
+ getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false));
+ getStyles().add(new TextStyle("ready", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false));
+ getStyles().add(new TextStyle("notready", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false));
+ setEnabled(true);
+ }
+
+ @Override
+ public boolean isHUDViewable() {
+ return PartyManager.INSTANCE.getPartyContext() != null && PartyManager.INSTANCE.getPartyContext().isPartyExistHypixel() && "Dungeon Hub".equals(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName());
+ }
+
+ @Override
+ public List<String> getUsedTextStyle() {
+ return Arrays.asList("name" ,"separator", "player", "allinvite");
+ }
+
+ private static final List<StyledText> dummyText = new ArrayList<StyledText>();
+ static {
+ dummyText.add(new StyledText("syeyoung","player"));
+ dummyText.add(new StyledText(": ","separator"));
+ dummyText.add(new StyledText("Ready","ready"));
+ dummyText.add(new StyledText("\nrioho","player"));
+ dummyText.add(new StyledText(": ","separator"));
+ dummyText.add(new StyledText("Ready","ready"));
+ dummyText.add(new StyledText("\nRaidShadowLegends","player"));
+ dummyText.add(new StyledText(": ","separator"));
+ dummyText.add(new StyledText("Not Ready","notready"));
+ dummyText.add(new StyledText("\nTricked","player"));
+ dummyText.add(new StyledText(": ","separator"));
+ dummyText.add(new StyledText("Ready","ready"));
+ dummyText.add(new StyledText("\nMr. Penguin","player"));
+ dummyText.add(new StyledText(": ","separator"));
+ dummyText.add(new StyledText("Not Ready","notready"));
+ }
+
+ @Override
+ public List<StyledText> getDummyText() {
+ return dummyText;
+ }
+
+ @Override
+ public boolean doesScaleWithHeight() {
+ return false;
+ }
+
+ private Set<String> ready = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
+
+ @Override
+ public List<StyledText> getText() {
+ PartyContext pc = PartyManager.INSTANCE.getPartyContext();
+ List<StyledText> text= new ArrayList<>();
+ boolean first = true;
+ for (String partyRawMember : pc.getPartyRawMembers()) {
+ text.add(new StyledText((first ? "":"\n") + partyRawMember, "player"));
+ text.add(new StyledText(": ","separator"));
+ if (ready.contains(partyRawMember))
+ text.add(new StyledText("Ready","ready"));
+ else
+ text.add(new StyledText("Not Ready","notready"));
+ first =false;
+ }
+ return text;
+ }
+
+ private static final List<String> readyPhrase = Arrays.asList("r", "rdy", "ready");
+ private static final List<String> negator = Arrays.asList("not ", "not", "n", "n ");
+ private static final Map<String, Boolean> readynessIndicator = new HashMap<>();
+ static {
+ readyPhrase.forEach(val -> readynessIndicator.put(val, true));
+ for (String s : negator) {
+ readyPhrase.forEach(val -> readynessIndicator.put(s+val, false));
+ }
+ readynessIndicator.put("dont start", false);
+ readynessIndicator.put("don't start", false);
+ readynessIndicator.put("dont go", false);
+ readynessIndicator.put("don't go", false);
+ readynessIndicator.put("start", true);
+ readynessIndicator.put("go", true);
+ }
+
+
+ @Override
+ public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) {
+ String txt = clientChatReceivedEvent.message.getFormattedText();
+ if (!txt.startsWith("§r§9Party §8>")) return;
+
+ String chat = TextUtils.stripColor(txt.substring(txt.indexOf(":")+1)).trim().toLowerCase();
+
+ Boolean status = null;
+ String longestMatch = "";
+ for (Map.Entry<String, Boolean> stringBooleanEntry : readynessIndicator.entrySet()) {
+ if (chat.startsWith(stringBooleanEntry.getKey()) || chat.endsWith(stringBooleanEntry.getKey()) || (stringBooleanEntry.getKey().length()>=3 && chat.contains(stringBooleanEntry.getKey()))) {
+ if (stringBooleanEntry.getKey().length() > longestMatch.length()) {
+ longestMatch = stringBooleanEntry.getKey();
+ status = stringBooleanEntry.getValue();
+ }
+ }
+ }
+ if (status == null) return;
+
+
+ String usernamearea = TextUtils.stripColor(txt.substring(13, txt.indexOf(":")));
+ String username = null;
+ for (String s : usernamearea.split(" ")) {
+ if (s.isEmpty()) continue;
+ if (s.startsWith("[")) continue;
+ username = s;
+ break;
+ }
+ if (status) ready.add(username);
+ else ready.remove(username);
+ }
+
+ @Override
+ public void onDungeonStart() {
+ ready.clear();
+ }
+}