diff options
author | syeyoung <cyong06@naver.com> | 2021-05-08 17:23:08 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-05-08 17:23:08 +0900 |
commit | b34b217f44c0c5ae7e69a4d7b830a8607f5fc13a (patch) | |
tree | 6467fd8dbec016cc63b27dad05c4060e59f70d2b /src/main/java/kr/syeyoung/dungeonsguide/features | |
parent | 5f5e168df2abd0f168ae780d1ffeb4b7dab6c0a8 (diff) | |
download | Skyblock-Dungeons-Guide-b34b217f44c0c5ae7e69a4d7b830a8607f5fc13a.tar.gz Skyblock-Dungeons-Guide-b34b217f44c0c5ae7e69a4d7b830a8607f5fc13a.tar.bz2 Skyblock-Dungeons-Guide-b34b217f44c0c5ae7e69a4d7b830a8607f5fc13a.zip |
cosmetics.
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features')
6 files changed, 283 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java index 3710eff6..3429a4df 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java @@ -94,4 +94,8 @@ public abstract class AbstractFeature { }); return "base." + key ; } + + public boolean isDisyllable() { + return true; + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 4f859e2b..50fe1218 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -25,6 +25,8 @@ import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomDebugInfo; import kr.syeyoung.dungeonsguide.features.impl.boss.*; import kr.syeyoung.dungeonsguide.features.impl.boss.terminal.FeatureSimonSaysSolver; import kr.syeyoung.dungeonsguide.features.impl.boss.terminal.FeatureTerminalSolvers; +import kr.syeyoung.dungeonsguide.features.impl.cosmetics.FeatureNicknameColor; +import kr.syeyoung.dungeonsguide.features.impl.cosmetics.FeatureNicknamePrefix; import kr.syeyoung.dungeonsguide.features.impl.dungeon.*; import kr.syeyoung.dungeonsguide.features.impl.etc.*; import kr.syeyoung.dungeonsguide.features.impl.etc.ability.FeatureAbilityCooldown; @@ -152,4 +154,7 @@ public class FeatureRegistry { public static final SimpleFeature SECRET_NEXT_KEY = register(new SimpleFeature("Secret", "Auto browse next secret upon pressing a key", "Auto browse the best next secret when you press key.\nChange key at your key settings (Settings -> Controls)", "secret.keyfornext", false)); public static final SimpleFeature SECRET_TOGGLE_KEY = register(new SimpleFeature("Secret", "Press a key to toggle pathfind lines", "A key for toggling pathfound line visibility.\nChange key at your key settings (Settings -> Controls)", "secret.togglePathfind")); public static final SimpleFeature SECRET_FREEZE_LINES = register(new FeatureFreezePathfind()); + + public static final FeatureNicknamePrefix COSMETIC_PREFIX = register(new FeatureNicknamePrefix()); + public static final FeatureNicknameColor COSMETIC_NICKNAMECOLOR = register(new FeatureNicknameColor()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java new file mode 100644 index 00000000..02bad9f1 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java @@ -0,0 +1,49 @@ +/* + * 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.cosmetics; + +import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; + +public class FeatureNicknameColor extends SimpleFeature { + public FeatureNicknameColor() { + super("Cosmetics", "Nickname Color", "Click on Edit to choose nickname color cosmetic", "cosmetic.nickname"); + this.parameters.put("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", "string")); + } + + @Override + public String getEditRoute(final GuiConfig config) { + ConfigPanelCreator.map.put("base." + getKey() , () -> new PrefixSelectorGUI(config, "color", new String[] { + "§9Party §8> §r§a[RANK§6+§a] %prefix%%name%§f: TEST", + "§2Guild > §r§a[RANK§6+§a] %prefix%%name% §3[Vet]§f: TEST", + "§dTo §r§r§a[RANK§r§6+§r§a] %prefix%%name%§r§7: §r§7TEST§r", + "§dFrom §r§r§a[RANK§r§6+§r§a] %prefix%%name%§r§7: §r§7TEST§r", + "§r§b[RANK§c+§b] %prefix%%name%§f: TEST", + "§r§bCo-op > §r§a[RANK§6+§a] %prefix%%name%§f: §rTEST§r" + })); + return "base." + getKey(); + } + + @Override + public boolean isDisyllable() { + return false; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java new file mode 100644 index 00000000..5ffcc26b --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java @@ -0,0 +1,57 @@ +/* + * 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.cosmetics; + +import com.google.common.base.Supplier; +import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.config.guiconfig.PanelDefaultParameterConfig; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.DataRendererEditor; +import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin; +import kr.syeyoung.dungeonsguide.gui.MPanel; + +import java.util.Arrays; +import java.util.Collections; + +public class FeatureNicknamePrefix extends SimpleFeature { + public FeatureNicknamePrefix() { + super("Cosmetics", "Nickname Prefix", "Click on Edit to choose prefix cosmetic", "cosmetic.prefix"); + this.parameters.put("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", "string")); + } + + @Override + public String getEditRoute(final GuiConfig config) { + ConfigPanelCreator.map.put("base." + getKey() , () -> new PrefixSelectorGUI(config, "prefix", new String[] { + "§9Party §8> §r%prefix% §a[RANK§6+§a] %name%§f: TEST", + "§2Guild > §r%prefix% §a[RANK§6+§a] %name% §3[Vet]§f: TEST", + "§dTo §r%prefix% §r§a[RANK§r§6+§r§a] %name%§r§7: §r§7TEST§r", + "§dFrom §r%prefix% §r§a[RANK§r§6+§r§a] %name%§r§7: §r§7TEST§r", + "§r%prefix% §b[RANK§c+§b] %name%§f: TEST", + "§r§bCo-op > §r%prefix% §a[RANK§6+§a] %name%§f: §rTEST§r" + })); + return "base." + getKey(); + } + + @Override + public boolean isDisyllable() { + return false; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java new file mode 100644 index 00000000..dd0dc387 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java @@ -0,0 +1,163 @@ +/* + * 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.cosmetics; + +import kr.syeyoung.dungeonsguide.DungeonsGuide; +import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.gui.MPanel; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +public class PrefixSelectorGUI extends MPanel { + private GuiConfig config; + private String cosmeticType; + + public PrefixSelectorGUI(GuiConfig config, String cosmeticType, String[] previews) { + this.config = config; + this.cosmeticType = cosmeticType; + this.previews = previews; + CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); + List<ActiveCosmetic> activeCosmeticList = cosmeticsManager.getActiveCosmeticByPlayer().computeIfAbsent(Minecraft.getMinecraft().thePlayer.getGameProfile().getId(), (a) -> new ArrayList<>()); + for (ActiveCosmetic activeCosmetic : activeCosmeticList) { + CosmeticData cosmeticData = cosmeticsManager.getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); + if (cosmeticData != null && cosmeticData.getCosmeticType().equals(cosmeticType)) { + selected = cosmeticData; + return; + } + } + } + + @Override + public void resize(int parentWidth, int parentHeight) { + this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); + } + + private CosmeticData selected; + // §9Party §8> §a[VIP§6+§a] syeyoung§f: ty + // §2Guild > §a[VIP§6+§a] syeyoung §3[Vet]§f + // §dTo §r§a[VIP§r§6+§r§a] SlashSlayer§r§7: §r§7what§r + // §dFrom §r§a[VIP§r§6+§r§a] SlashSlayer§r§7: §r§7?§r + // §7Rock_Bird§7§r§7: SELLING 30 DIAMOD BLOCK /p me§r + // §b[MVP§c+§b] Probutnoobgamer§f: quitting skyblock! highe + // §r§bCo-op > §a[VIP§6+§a] syeyoung§f: §rwhat§r + String[] previews; + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); + + Set<UUID> activeCosmeticList = cosmeticsManager.getActiveCosmeticByPlayer().computeIfAbsent(Minecraft.getMinecraft().thePlayer.getGameProfile().getId(), (a) -> new ArrayList<>()).stream().map(ActiveCosmetic::getCosmeticData).collect(Collectors.toSet()); + + + + GlStateManager.translate(0,2,0); + Gui.drawRect(0,0,getBounds().width, getBounds().height-2, 0xFF444444); + Gui.drawRect(5,5,265, getBounds().height-7, 0xFF222222); + Gui.drawRect(6,17,264, getBounds().height-8, 0xFF555555); + fr.drawString("Preview", (270 - fr.getStringWidth("Preview")) / 2, 7, 0xFFFFFFFF); + + { + String prefix = selected != null ? selected.getData() : "[DG]"; + GlStateManager.pushMatrix(); + GlStateManager.translate(6,17,0); + for (int i = 0; i < previews.length; i++) { + fr.drawString(previews[i].replace("%name%", Minecraft.getMinecraft().getSession().getUsername()).replace("%prefix%", prefix), 0, i*fr.FONT_HEIGHT, -1); + } + GlStateManager.popMatrix(); + } + { + GlStateManager.pushMatrix(); + GlStateManager.translate(270,17,0); + int relX = relMousex0 - 270, relY = relMousey0 - 19; + int cnt = 0; + for (CosmeticData value : cosmeticsManager.getCosmeticDataMap().values()) { + if (value.getCosmeticType().equals(cosmeticType)) { + Gui.drawRect(0,0,220, fr.FONT_HEIGHT+3, 0xFF222222); + Gui.drawRect(1,1, 219, fr.FONT_HEIGHT+2, 0xFF555555); + fr.drawString(value.getData(), 2, 2, -1); + Gui.drawRect(120,1,160, fr.FONT_HEIGHT+2, new Rectangle(120,cnt * (fr.FONT_HEIGHT+4) + 2,40,fr.FONT_HEIGHT+1).contains(relX, relY) ? 0xFF859DF0 : 0xFF7289da); + fr.drawString("TEST", (280-fr.getStringWidth("TEST"))/2, 2, -1); + + if (cosmeticsManager.getPerms().contains(value.getReqPerm())) { + Gui.drawRect(161,1,219, fr.FONT_HEIGHT+2, new Rectangle(161,cnt * (fr.FONT_HEIGHT+4) + 2,58,fr.FONT_HEIGHT+1).contains(relX, relY) ? 0xFF859DF0 : 0xFF7289da); + + if (activeCosmeticList.contains(value.getId())) { + fr.drawString("UNSELECT", (381 - fr.getStringWidth("UNSELECT")) / 2, 2, -1); + } else { + fr.drawString("SELECT", (381 - fr.getStringWidth("SELECT")) / 2, 2, -1); + } + } else { + Gui.drawRect(161,1,219, fr.FONT_HEIGHT+2, 0xFFFF3333); + fr.drawString("Locked", (381 - fr.getStringWidth("Locked")) / 2, 2, -1); + } + GlStateManager.translate(0,fr.FONT_HEIGHT+4, 0); + + cnt++; + } + } + GlStateManager.popMatrix(); + } + } + + @Override + public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); + + int relX = relMouseX - 270, relY = relMouseY - 19; + int cnt = 0; + + List<ActiveCosmetic> activeCosmeticList = cosmeticsManager.getActiveCosmeticByPlayer().computeIfAbsent(Minecraft.getMinecraft().thePlayer.getGameProfile().getId(), (a) -> new ArrayList<>()); + + for (CosmeticData value : cosmeticsManager.getCosmeticDataMap().values()) { + if (value.getCosmeticType().equals(cosmeticType)) { + if (new Rectangle(120,cnt * (fr.FONT_HEIGHT+4) + 2,40,fr.FONT_HEIGHT+1).contains(relX, relY)) { + selected = value; + return; + } + if (new Rectangle(161,cnt * (fr.FONT_HEIGHT+4) + 2,58,fr.FONT_HEIGHT+1).contains(relX, relY) && cosmeticsManager.getPerms().contains(value.getReqPerm())) { + for (ActiveCosmetic activeCosmetic : activeCosmeticList) { + if (activeCosmetic.getCosmeticData().equals(value.getId())) { + cosmeticsManager.removeCosmetic(activeCosmetic); + return; + } + } + cosmeticsManager.setCosmetic(value); + selected = value; + } + + cnt++; + } + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java index 96562f02..a0f681a1 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java @@ -31,7 +31,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; public class APIKey extends SimpleFeature implements ChatListenerGlobal { public APIKey() { - super("Party Kicker", "API KEY", "Set api key. Disabling this feature does nothing","partykicker.apikey"); + super("Party Kicker", "API KEY", "Sets api key","partykicker.apikey"); parameters.put("apikey", new FeatureParameter<String>("apikey", "API Key", "API key", "","string")); } @@ -49,6 +49,10 @@ public class APIKey extends SimpleFeature implements ChatListenerGlobal { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fAutomatically Configured Hypixel API Key")); this.<String>getParameter("apikey").setValue(apiKeys); } + } + @Override + public boolean isDisyllable() { + return false; } } |