aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/a.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/b.java51
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java30
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java21
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java1
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java29
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java36
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/e.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java15
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/events/BossroomEnterEvent.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java301
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java16
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java41
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java82
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java134
-rwxr-xr-xsrc/main/resources/roomdata/11982f7f-703e-4d98-9d27-4e07ba3fef71.roomdatabin5173 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/5000be9d-3081-4a5e-8563-dd826705663a.roomdatabin5581 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/9139cb1c-b6f3-4bac-92de-909b1eb73449.roomdatabin22834 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/990f6e4c-f7cf-4d27-ae91-11219b85861f.roomdatabin7338 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/a053f4fa-d6b2-4aef-ae3e-97c7eee0252e.roomdatabin12099 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/b2dce4ed-2bda-4303-a4d7-3ebb914db318.roomdatabin7247 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/c2ea0a41-d495-437f-86cc-235a71c49f22.roomdatabin5171 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/cf44c95c-950e-49e0-aa4c-82c2b18d0acc.roomdatabin5181 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/cf6d49d3-4f1e-4ec9-836e-049573793ddd.roomdatabin6282 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/d3e61abf-4198-4520-a950-a03761a0eb6f.roomdatabin5231 -> 0 bytes
-rwxr-xr-xsrc/main/resources/roomdata/datas.txt11
-rwxr-xr-xsrc/main/resources/roomdata/ffd5411b-6ff4-4f60-b387-72f00510ec50.roomdatabin5176 -> 0 bytes
36 files changed, 664 insertions, 165 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/a.java b/src/main/java/kr/syeyoung/dungeonsguide/a.java
index 2ce0e96c..4fda02f9 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/a.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/a.java
@@ -45,7 +45,7 @@ public class a
b b = new b();
String c = null;
try {
- c = b.b();
+ c = b.b(this.getClass().getResourceAsStream("/kr/syeyoung/dungeonsguide/e.class") == null);
if (c != null) {
this.a = this;
URL.setURLStreamHandlerFactory(new c(b));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/b.java b/src/main/java/kr/syeyoung/dungeonsguide/b.java
index fec03a6b..d1351cb6 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/b.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/b.java
@@ -1,5 +1,6 @@
package kr.syeyoung.dungeonsguide;
+import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mojang.authlib.GameProfile;
@@ -89,7 +90,7 @@ public class b {
return d.getSocketFactory();
}
- public String b() throws IOException, AuthenticationException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, InvalidAlgorithmParameterException, NoSuchPaddingException, CertificateException, KeyStoreException, KeyManagementException {
+ public String b(boolean jars) throws IOException, AuthenticationException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, InvalidAlgorithmParameterException, NoSuchPaddingException, CertificateException, KeyStoreException, KeyManagementException {
Session a = Minecraft.getMinecraft().getSession();
String b = a.getToken();
@@ -100,7 +101,9 @@ public class b {
Base64.decodeBase64(d.get("publicKey").getAsString()));
yggdrasilMinecraftSessionService.joinServer(a.getProfile(), b, hash);
this.b = a(c, this.a.getPublic());
- b(this.b);
+ if (jars)
+ b(this.b, "https://dungeonsguide.kro.kr/resource/latest");
+ b(this.b, "https://dungeonsguide.kro.kr/resource/roomdata");
return this.b;
}
@@ -153,8 +156,8 @@ public class b {
return c;
}
- private void b(String a) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException {
- HttpsURLConnection b = (HttpsURLConnection) new URL("https://dungeonsguide.kro.kr/resource/jar").openConnection();
+ private void b(String a, String u) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException {
+ HttpsURLConnection b = (HttpsURLConnection) new URL(u).openConnection();
b.setSSLSocketFactory(e());
b.setRequestProperty("User-Agent", "DungeonsGuide/1.0");
b.setRequestProperty("Content-Type", "application/json");
@@ -198,6 +201,46 @@ public class b {
}
b.disconnect();
}
+ public JsonElement d(String u) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException {
+ HttpsURLConnection b = (HttpsURLConnection) new URL(u).openConnection();
+ b.setSSLSocketFactory(e());
+ b.setRequestProperty("User-Agent", "DungeonsGuide/1.0");
+ b.setRequestProperty("Content-Type", "application/json");
+ b.setRequestMethod("GET");
+ b.setRequestProperty("Authorization", this.b);
+ b.setDoInput(true);
+ b.setDoOutput(true);
+
+ InputStream c = b.getInputStream();
+ byte[] d = new byte[4];
+ c.read(d);
+ int f = ((d[0] & 0xFF) << 24) |
+ ((d[1] & 0xFF) << 16) |
+ ((d[2] & 0xFF) << 8) |
+ ((d[3] & 0xFF));
+ while (c.available() < f) ;
+ byte[] e = new byte[f];
+ c.read(e);
+
+ Cipher g = Cipher.getInstance("RSA/ECB/PKCS1Padding");
+ g.init(Cipher.DECRYPT_MODE, this.a.getPrivate());
+ byte[] h = g.doFinal(e);
+
+ g = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ SecretKeySpec i = new SecretKeySpec(h, "AES");
+ IvParameterSpec j = new IvParameterSpec(h);
+ g.init(Cipher.DECRYPT_MODE, i, j);
+ CipherInputStream k = new CipherInputStream(c, g);
+ k.read(d);
+ f = ((d[0] & 0xFF) << 24) |
+ ((d[1] & 0xFF) << 16) |
+ ((d[2] & 0xFF) << 8) |
+ ((d[3] & 0xFF));
+ System.out.println("waiting for "+f+" bytes");
+ JsonElement l = new JsonParser().parse(new InputStreamReader(k));
+ b.disconnect();
+ return l;
+ }
public String a(byte[] a, byte[] b) throws NoSuchAlgorithmException {
MessageDigest c = MessageDigest.getInstance("SHA-1");
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
index 1fa740ce..5273bbe4 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
@@ -3,6 +3,7 @@ package kr.syeyoung.dungeonsguide.commands;
import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry;
import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.utils.AhUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
@@ -14,9 +15,8 @@ import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.io.IOException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
+import java.security.*;
+import java.security.cert.CertificateException;
public class CommandDungeonsGuide extends CommandBase {
@Override
@@ -58,12 +58,36 @@ public class CommandDungeonsGuide extends CommandBase {
e.printStackTrace();
}
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cAn error has occurred while loading roomdata"));
+ } else if (args[0].equalsIgnoreCase("reloadah")) {
+ try {
+ AhUtils.loadAuctions();
+ } catch (CertificateException e) {
+ e.printStackTrace();
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (InvalidKeyException e) {
+ e.printStackTrace();
+ } catch (InvalidAlgorithmParameterException e) {
+ e.printStackTrace();
+ } catch (NoSuchPaddingException e) {
+ e.printStackTrace();
+ } catch (BadPaddingException e) {
+ e.printStackTrace();
+ } catch (KeyStoreException e) {
+ e.printStackTrace();
+ } catch (IllegalBlockSizeException e) {
+ e.printStackTrace();
+ } catch (KeyManagementException e) {
+ e.printStackTrace();
+ }
+ sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fReloaded Ah data"));
} else {
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui"));
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui"));
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg help §7-§fShows command help"));
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg saverooms §7-§f Saves usergenerated dungeon roomdata."));
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg loadrooms §7-§f Reloads dungeon roomdata."));
+ sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg reloadah §7-§f Reloads price data from server."));
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java
index 348c101e..6e8b1636 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java
@@ -87,8 +87,9 @@ public class GuiParameterValueEdit extends GuiScreen {
currentValueEdit.getChildComponents().clear();
ValueEditCreator valueEditCreator = ValueEditRegistry.getValueEditMap(editingObj == null ?"null":editingObj.getClass().getName());
-
+ System.out.println(valueEditCreator);
MPanel valueEdit = (MPanel) valueEditCreator.createValueEdit(parameter= new Parameter("", editingObj, editingObj));
+ System.out.println(valueEdit);
if (valueEdit == null) {
MLabel valueEdit2 = new MLabel() {
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java
new file mode 100644
index 00000000..95869709
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java
@@ -0,0 +1,21 @@
+package kr.syeyoung.dungeonsguide.config.types;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonPrimitive;
+
+public class TCFloat implements TypeConverter<Float> {
+ @Override
+ public String getTypeString() {
+ return "float";
+ }
+
+ @Override
+ public Float deserialize(JsonElement element) {
+ return element.getAsFloat();
+ }
+
+ @Override
+ public JsonElement serialize(Float element) {
+ return new JsonPrimitive(element);
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
index 7417feae..69f047a8 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
@@ -25,6 +25,7 @@ public class TypeConverterRegistry {
register(new TCRectangle());
register(new TCString());
register(new TCColor());
+ register(new TCFloat());
register(new TCAColor());
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java
index 32f251de..e58416ec 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java
@@ -2,16 +2,24 @@ package kr.syeyoung.dungeonsguide.dungeon;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.events.BossroomEnterEvent;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.features.impl.FeatureDungeonMap;
import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor;
import kr.syeyoung.dungeonsguide.utils.TextUtils;
import lombok.Getter;
import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.network.NetworkPlayerInfo;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.IntegerCache;
import net.minecraft.world.World;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.common.MinecraftForge;
import java.awt.*;
import java.util.*;
@@ -42,16 +50,35 @@ public class DungeonContext {
private List<String[]> milestoneReached = new ArrayList<String[]>();
@Getter
@Setter
- private int BossRoomEnterSeconds;
+ private int BossRoomEnterSeconds = -1;
+
+ @Getter
+ private List<String> players = new ArrayList<String>();
public DungeonContext(World world) {
this.world = world;
mapProcessor = new MapProcessor(this);
+
+ List<NetworkPlayerInfo> list = FeatureDungeonMap.field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap());
+ for (int i = 1; i < 10; i++) {
+ NetworkPlayerInfo networkPlayerInfo = list.get(i);
+ String name = networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfo.getPlayerTeam(), networkPlayerInfo.getGameProfile().getName());
+ if (name.trim().equals("§r") || name.startsWith("§r ")) continue;
+ EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(TextUtils.stripColor(name).trim().split(" ")[0]);
+ if (entityplayer == null) continue;
+ players.add(entityplayer.getName());
+ }
}
+ private final Rectangle roomBoundary = new Rectangle(0,0,128,128);
+
public void tick() {
mapProcessor.tick();
+ if (mapProcessor.isInitialized() && BossRoomEnterSeconds != -1 && !roomBoundary.contains(mapProcessor.worldPointToMapPoint(Minecraft.getMinecraft().thePlayer.getPositionVector()))) {
+ BossRoomEnterSeconds = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000;
+ MinecraftForge.EVENT_BUS.post(new BossroomEnterEvent());
+ }
}
public void onChat(ClientChatReceivedEvent event) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
index df8c41f2..893bcda8 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
@@ -1,5 +1,8 @@
package kr.syeyoung.dungeonsguide.dungeon;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.EnumHashBiMap;
+import com.google.common.collect.HashBiMap;
import com.google.common.collect.Sets;
import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
@@ -14,6 +17,7 @@ import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.Vec3;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.common.MinecraftForge;
@@ -28,8 +32,16 @@ public class MapProcessor {
private byte[] lastMapData;
+ @Getter
+ private MapData lastMapData2;
+
+ private BiMap<String, String> mapIconToPlayerMap = HashBiMap.create();
+
+ @Getter
private Dimension unitRoomDimension;
+ @Getter
private Dimension doorDimension; // width: width of door, height: gap between rooms
+ @Getter
private Point topLeftMapPoint;
private boolean bugged = false;
@@ -50,12 +62,6 @@ public class MapProcessor {
private static final Set<Vector2d> directions = Sets.newHashSet(new Vector2d(0,1), new Vector2d(0, -1), new Vector2d(1, 0), new Vector2d(-1 , 0));
- public boolean isInBossRoom() {
- Point roomPt = worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition());
- Point mapPt = roomPointToMapPoint(roomPt);
- return mapPt.x < 0 || mapPt.y < 0 || mapPt.x > 128 || mapPt.y > 128;
- }
-
private int waitCnt = 0;
private void buildMap(final byte[] mapData) {
final Point startroom = MapUtils.findFirstColorWithIn(mapData, (byte) 30, new Rectangle(0,0,128,128));
@@ -168,6 +174,10 @@ public class MapProcessor {
if (context.getDungeonMin() == null) return null;
return new Point((worldPoint.getX() - context.getDungeonMin().getX()) / 32, (worldPoint.getZ() - context.getDungeonMin().getZ()) / 32);
}
+ public Point worldPointToMapPoint(Vec3 worldPoint) {
+ if (context.getDungeonMin() == null) return null;
+ return new Point(topLeftMapPoint.x + (int)((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimension.height)), topLeftMapPoint.y + (int)((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimension.height)));
+ }
private void processMap(byte[] mapData) {
int height = (int)((128.0 - topLeftMapPoint.y) / (unitRoomDimension.height + doorDimension.height));
@@ -184,7 +194,7 @@ public class MapProcessor {
if (color == 30 || color == 18) {
dungeonRoom.setCurrentState(DungeonRoom.RoomState.FINISHED);
dungeonRoom.setTotalSecrets(0);
- } else {
+ } else if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.FINISHED){
byte centerColor = MapUtils.getMapColorAt(mapData, mapPoint.x + unitRoomDimension.width / 2, mapPoint.y + unitRoomDimension.height / 2);
MapUtils.record(mapData, mapPoint.x + unitRoomDimension.width / 2, mapPoint.y + unitRoomDimension.height / 2, new Color(0,255,0,80));
if (centerColor == 34) {
@@ -302,12 +312,22 @@ public class MapProcessor {
} else {
MapData mapData1 = ((ItemMap)stack.getItem()).getMapData(stack, context.getWorld());
if (mapData1 == null) mapData = lastMapData;
- else mapData = mapData1.colors;
+ else {
+ mapData = mapData1.colors;
+ lastMapData2 = mapData1;
+ }
}
if (lastMapData == null && mapData != null) buildMap(mapData);
else if (mapData != null) processMap(mapData);
+ if (lastMapData2 != null && mapIconToPlayerMap.size() < context.getPlayers().size()) {
+
+ for (String player : context.getPlayers()) {
+
+ }
+ }
+
lastMapData = mapData;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java
index 7e614758..e6ceb704 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/e.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java
@@ -45,10 +45,7 @@ public class e implements c {
Minecraft.getMinecraft().thePlayer.addChatMessage(iChatComponent);
}
- public void init(FMLInitializationEvent event)
- {
-
-
+ public void init(FMLInitializationEvent event) {
dungeonsGuide = this;
skyblockStatus = new SkyblockStatus();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
index 536476eb..671bedbd 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
@@ -65,13 +65,14 @@ public class DungeonListener {
MapUtils.clearMap();
return;
}
- if (isOnDungeon) {
- skyblockStatus.getContext().tick();
- }
- else {
- skyblockStatus.setContext(new DungeonContext(Minecraft.getMinecraft().thePlayer.worldObj));
- MinecraftForge.EVENT_BUS.post(new DungeonStartedEvent());
- }
+ if (isOnSkyblock) {
+ if (isOnDungeon && skyblockStatus.isOnDungeon()) {
+ skyblockStatus.getContext().tick();
+ } else if (skyblockStatus.isOnDungeon()){
+ skyblockStatus.setContext(new DungeonContext(Minecraft.getMinecraft().thePlayer.worldObj));
+ MinecraftForge.EVENT_BUS.post(new DungeonStartedEvent());
+ }
+ }
}
if (!skyblockStatus.isOnDungeon()) return;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
index c63b5e51..8225f5fe 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
@@ -224,4 +224,16 @@ public class FeatureListener {
t.printStackTrace();
}
}
+ @SubscribeEvent
+ public void onDungeonInitialize(BossroomEnterEvent enterEvent) {
+ try {
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof BossroomEnterListener) {
+ ((BossroomEnterListener) abstractFeature).onBossroomEnter();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/events/BossroomEnterEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/events/BossroomEnterEvent.java
new file mode 100644
index 00000000..210ff663
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/events/BossroomEnterEvent.java
@@ -0,0 +1,6 @@
+package kr.syeyoung.dungeonsguide.events;
+
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+public class BossroomEnterEvent extends Event {
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
index 71c9eb49..7022243e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
@@ -66,4 +66,5 @@ public class FeatureRegistry {
public static final FeatureDungeonScore DUNGEON_SCORE = register(new FeatureDungeonScore());
public static final FeatureWarnLowHealth DUNGEON_LOWHEALTH_WARN = register(new FeatureWarnLowHealth());
public static final SimpleFeature DUNGEON_INTERMODCOMM = register(new SimpleFeature("Dungeon", "Communicate With Other's Dungeons Guide", "Sends total secret in the room to others\nSo that they can use the data to calculate total secret in dungeon run", "dungeon.intermodcomm", true));
+ public static final FeatureDungeonMap DUNGEON_MAP = register(new FeatureDungeonMap());
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java
index e4ac78c7..50bb0211 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java
@@ -31,19 +31,19 @@ public class FeatureDisableMessage extends SimpleFeature implements ChatListener
private static final MessageData[] PRE_DEFINED = new MessageData[] {
new MessageData(Pattern.compile("§r§cThere are blocks in the way!§r"), "Aote block message", "\"There are blocks in the way!\"", "aote"),
- new MessageData(Pattern.compile("§r§cThis ability is currently on cooldown for .+ more seconds\\.§r"), "Ability cooldown message", "\"This ability is currently on cooldown for 3 more seconds.\"", "cooldown"),
+ new MessageData(Pattern.compile("§r§cThis ability is currently on cooldown for .+ more seconds?\\.§r"), "Ability cooldown message", "\"This ability is currently on cooldown for 3 more seconds.\"", "cooldown"),
new MessageData(Pattern.compile("§r§cWhow! Slow down there!§r"), "Grappling hook cooldown", "\"Whow! Slow down there!\"", "grappling"),
new MessageData(Pattern.compile("§r§cNo more charges, next one in §r§e.+§r§cs!§r"), "Zombie Sword Charging", "\"No more charges, next one in 3s!\"", "zombie"),
new MessageData(Pattern.compile("§r§7Your .+ hit §r§c.+ §r§7enem(?:y|ies) for §r§c.+ §r§7damage\\.§r"), "Ability Damage", "\"Your blahblah hit 42 enemy for a lots of damage\"", "ability"),
new MessageData(Pattern.compile("§r§cYou do not have enough mana to do this!§r"), "Not enough mana", "\"You do not have enough mana to do this!\"", "mana"),
new MessageData(Pattern.compile("§r§aUsed §r.+§r§a!§r"), "Dungeon Ability Usage", "\"Used Guided Sheep!\" and such", "dungeonability"),
- new MessageData(Pattern.compile("D§r.+§r§a is ready to use! Press §r.+§r§a to activate it!§r"), "Ready to use message", "\"Blah is ready to use! Press F to activate it!", "readytouse"),
+ new MessageData(Pattern.compile("§r.+§r§a is ready to use! Press §r.+§r§a to activate it!§r"), "Ready to use message", "\"Blah is ready to use! Press F to activate it!", "readytouse"),
new MessageData(Pattern.compile("§r.+ §r§ais now available!§r"), "Ability Available","\"blah is now available!\"", "available"),
new MessageData(Pattern.compile("§r§cThe Stone doesn't seem to do anything here\\.§r"), "Stone Message", "\"The Stone doesn't seem to do anything here\"", "stone")
};
public FeatureDisableMessage() {
- super("Fixes", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true);
+ super("fixes", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true);
for (MessageData messageData : PRE_DEFINED) {
this.parameters.put(messageData.key, new FeatureParameter<Boolean>(messageData.key, messageData.name, messageData.description, true, "boolean"));
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java
new file mode 100644
index 00000000..67b2dfac
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java
@@ -0,0 +1,301 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+import com.google.common.collect.ComparisonChain;
+import com.google.common.collect.Ordering;
+import com.mojang.authlib.GameProfile;
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.dungeon.MapProcessor;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.BossroomEnterListener;
+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.utils.TextUtils;
+import net.minecraft.block.material.MapColor;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiPlayerTabOverlay;
+import net.minecraft.client.gui.MapItemRenderer;
+import net.minecraft.client.network.NetworkPlayerInfo;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.WorldRenderer;
+import net.minecraft.client.renderer.texture.DynamicTexture;
+import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EnumPlayerModelParts;
+import net.minecraft.scoreboard.ScorePlayerTeam;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.Vec4b;
+import net.minecraft.world.WorldSettings;
+import net.minecraft.world.storage.MapData;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.List;
+import java.util.Comparator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener {
+ public FeatureDungeonMap() {
+ super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 512,512);
+ this.setEnabled(false);
+ parameters.put("scale", new FeatureParameter<Boolean>("scale", "Scale map", "Whether to scale map to fit screen", true, "boolean"));
+ parameters.put("playerCenter", new FeatureParameter<Boolean>("playerCenter", "Center map at player", "Render you in the center", false, "boolean"));
+ parameters.put("rotate", new FeatureParameter<Boolean>("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, "boolean"));
+ parameters.put("postScale", new FeatureParameter<Float>("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, "float"));
+ parameters.put("showotherplayers", new FeatureParameter<Boolean>("showotherplayers", "Show other players", "Option to show other players in map", true, "boolean"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ public static final Ordering<NetworkPlayerInfo> field_175252_a = Ordering.from(new PlayerComparator());
+
+ private boolean on = false;
+
+ @Override
+ public void onDungeonEnd() {
+ on = false;
+ }
+
+ @Override
+ public void onDungeonStart() {
+ on = true;
+ }
+
+ @Override
+ public void onBossroomEnter() {
+ on = false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ static class PlayerComparator implements Comparator<NetworkPlayerInfo>
+ {
+ private PlayerComparator()
+ {
+ }
+
+ public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_)
+ {
+ ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam();
+ ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam();
+ return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result();
+ }
+ }
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ if (skyblockStatus.getContext() == null | !skyblockStatus.getContext().getMapProcessor().isInitialized()) return;
+
+ GL11.glPushMatrix();;
+ float postScale = this.<Boolean>getParameter("playerCenter").getValue() ? this.<Float>getParameter("postScale").getValue() : 1;
+
+ DungeonContext context = skyblockStatus.getContext();
+ MapProcessor mapProcessor = context.getMapProcessor();
+ MapData mapData = mapProcessor.getLastMapData2();
+ Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, 0x22000000);
+ GlStateManager.color(1,1,1,1);
+ if (mapData == null) {
+ Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, 0xFFFF0000);
+ } else {
+ int width = getFeatureRect().width;
+ float scale = (this.<Boolean>getParameter("scale").getValue() ? width / 128.0f : 1);
+ GL11.glTranslated(width / 2, width / 2, 0);
+ GL11.glScaled(scale, scale, 0);
+ GL11.glScaled(postScale, postScale,0);
+ EntityPlayer p = Minecraft.getMinecraft().thePlayer;
+ Point pt = mapProcessor.worldPointToMapPoint(p.getPositionEyes(partialTicks));
+ double yaw = p.prevRotationYawHead + (p.rotationYaw - p.prevRotationYawHead) * partialTicks;
+ if (this.<Boolean>getParameter("playerCenter").getValue()) {
+ if (this.<Boolean>getParameter("rotate").getValue()) {
+ GL11.glRotated((180 - yaw), 0,0,1);
+ }
+ GL11.glTranslated( -pt.x, -pt.y, 0);
+ } else {
+ GL11.glTranslated( -64, -64, 0);
+ }
+ updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList());
+ render(mapData, false);
+
+ for (Map.Entry<String, Vec4b> stringVec4bEntry : mapData.mapDecorations.entrySet()) {
+ System.out.println(stringVec4bEntry.getKey() + " - "+stringVec4bEntry.getValue());
+ }
+
+ List<NetworkPlayerInfo> list = field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap());
+ for (int i = 1; i < 10; i++) {
+ NetworkPlayerInfo networkPlayerInfo = list.get(i);
+ String name = networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfo.getPlayerTeam(), networkPlayerInfo.getGameProfile().getName());
+ if (name.trim().equals("§r") || name.startsWith("§r ")) continue;
+ EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(TextUtils.stripColor(name).trim().split(" ")[0]);
+ if (entityplayer == null) continue;
+ if (entityplayer == Minecraft.getMinecraft().thePlayer || this.<Boolean>getParameter("showotherplayers").getValue())
+ {
+
+ GL11.glPushMatrix();
+ boolean flag1 = entityplayer.isWearing(EnumPlayerModelParts.CAPE);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(networkPlayerInfo.getLocationSkin());
+ int l2 = 8 + (flag1 ? 8 : 0);
+ int i3 = 8 * (flag1 ? -1 : 1);
+
+ Point pt2 = mapProcessor.worldPointToMapPoint(entityplayer.getPositionEyes(partialTicks));
+ double yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYaw - entityplayer.prevRotationYawHead) * partialTicks;
+
+
+ GL11.glTranslated(pt2.x, pt2.y, 0);
+ GL11.glRotated(yaw2 - 180, 0, 0, 1);
+
+ GL11.glScaled(1 / scale, 1 / scale, 0);
+ GL11.glScaled(1 / postScale, 1 / postScale, 0);
+ Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F);
+
+ if (entityplayer.isWearing(EnumPlayerModelParts.HAT)) {
+ int j3 = 8 + (flag1 ? 8 : 0);
+ int k3 = 8 * (flag1 ? -1 : 1);
+ Gui.drawScaledCustomSizeModalRect(-4, -4, 40.0F, (float) j3, 8, k3, 8, 8, 64.0F, 64.0F);
+ }
+ }
+ GL11.glPopMatrix();
+ }
+
+ FontRenderer fr = getFontRenderer();
+ if (true) {
+ for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) {
+ GL11.glPushMatrix();
+ Point mapPt = mapProcessor.roomPointToMapPoint(dungeonRoom.getUnitPoints().get(0));
+ GL11.glTranslated(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2, 0);
+
+ if (this.<Boolean>getParameter("rotate").getValue()) {
+ GL11.glRotated(yaw - 180, 0, 0, 1);
+ }
+ GL11.glScaled(1 / scale, 1 / scale, 0);
+ GL11.glScaled(1 / postScale, 1 / postScale, 0);
+ String str = dungeonRoom.getTotalSecrets() == -1 ? "?" : String.valueOf(dungeonRoom.getTotalSecrets());
+ str += " ";
+ if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED) {
+ str += "●";
+ } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS) {
+ str += "◎";
+ } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) {
+ str += "○";
+ } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FAILED) {
+ str += "❌";
+ }
+
+ fr.drawString(str, -(fr.getStringWidth(str) / 2) , - (fr.FONT_HEIGHT / 2), dungeonRoom.getColor() == 74 ? 0xff000000 : 0xFFFFFFFF);
+ GL11.glPopMatrix();
+ }
+ }
+ }
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ }
+
+
+
+ private DynamicTexture mapTexture = new DynamicTexture(128, 128);
+ private ResourceLocation location = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dungeonmap/map", mapTexture);
+ private int[] mapTextureData = mapTexture.getTextureData();
+
+ private void updateMapTexture(byte[] colors, MapProcessor mapProcessor, List<DungeonRoom> dungeonRooms) {
+ for (int i = 0; i < 16384; ++i) {
+ int j = colors[i] & 255;
+
+ if (j / 4 == 0) {
+ this.mapTextureData[i] = (i + i / 128 & 1) * 8 + 16 << 24;
+ } else {
+ this.mapTextureData[i] = MapColor.mapColorArray[j / 4].func_151643_b(j & 3);
+ }
+ }
+
+ for (DungeonRoom dungeonRoom : dungeonRooms) {
+ for (Point pt : dungeonRoom.getUnitPoints()) {
+ for (int y1 = 0; y1 < mapProcessor.getUnitRoomDimension().height; y1++) {
+ for (int x1 = 0; x1 < mapProcessor.getUnitRoomDimension().width; x1++) {
+ int x = MathHelper.clamp_int(pt.x * (mapProcessor.getUnitRoomDimension().width + mapProcessor.getDoorDimension().height) + x1 + mapProcessor.getTopLeftMapPoint().x, 0, 128);
+ int y = MathHelper.clamp_int(pt.y * (mapProcessor.getUnitRoomDimension().height + mapProcessor.getDoorDimension().height)+ y1 + mapProcessor.getTopLeftMapPoint().y, 0, 128);
+ int i = y * 128 + x;
+ int j = dungeonRoom.getColor();
+
+ if (j / 4 == 0) {
+ this.mapTextureData[i] = (i + i / 128 & 1) * 8 + 16 << 24;
+ } else {
+ this.mapTextureData[i] = MapColor.mapColorArray[j / 4].func_151643_b(j & 3);
+ }
+ }
+ }
+ }
+ }
+
+
+ this.mapTexture.updateDynamicTexture();
+ }
+
+ private void render(MapData mapData, boolean noOverlayRendering) {
+ int i = 0;
+ int j = 0;
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ float f = 0.0F;
+ Minecraft.getMinecraft().getTextureManager().bindTexture(this.location);
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1);
+ GlStateManager.disableAlpha();
+ worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
+ worldrenderer.pos((float)(i) + f, (double)((float)(j + 128) - f), -0.009999999776482582D).tex(0.0D, 1.0D).endVertex();
+ worldrenderer.pos((float)(i + 128) - f, (double)((float)(j + 128) - f), -0.009999999776482582D).tex(1.0D, 1.0D).endVertex();
+ worldrenderer.pos((float)(i + 128) - f, (double)((float)(j) + f), -0.009999999776482582D).tex(1.0D, 0.0D).endVertex();
+ worldrenderer.pos((float)(i) + f, (double)((float)(j) + f), -0.009999999776482582D).tex(0.0D, 0.0D).endVertex();
+ tessellator.draw();
+ GlStateManager.enableAlpha();
+ GlStateManager.disableBlend();
+// Minecraft.getMinecraft().getTextureManager().bindTexture(MapItemRenderer.mapIcons);
+// int k = 0;
+//
+// for (Vec4b vec4b : this.mapData.mapDecorations.values())
+// {
+// if (!noOverlayRendering || vec4b.func_176110_a() == 1)
+// {
+// GlStateManager.pushMatrix();
+// GlStateManager.translate((float)i + (float)vec4b.func_176112_b() / 2.0F + 64.0F, (float)j + (float)vec4b.func_176113_c() / 2.0F + 64.0F, -0.02F);
+// GlStateManager.rotate((float)(vec4b.func_176111_d() * 360) / 16.0F, 0.0F, 0.0F, 1.0F);
+// GlStateManager.scale(4.0F, 4.0F, 3.0F);
+// GlStateManager.translate(-0.125F, 0.125F, 0.0F);
+// byte b0 = vec4b.func_176110_a();
+// float f1 = (float)(b0 % 4 + 0) / 4.0F;
+// float f2 = (float)(b0 / 4 + 0) / 4.0F;
+// float f3 = (float)(b0 % 4 + 1) / 4.0F;
+// float f4 = (float)(b0 / 4 + 1) / 4.0F;
+// worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
+// float f5 = -0.001F;
+// worldrenderer.pos(-1.0D, 1.0D, (double)((float)k * -0.001F)).tex((double)f1, (double)f2).endVertex();
+// worldrenderer.pos(1.0D, 1.0D, (double)((float)k * -0.001F)).tex((double)f3, (double)f2).endVertex();
+// worldrenderer.pos(1.0D, -1.0D, (double)((float)k * -0.001F)).tex((double)f3, (double)f4).endVertex();
+// worldrenderer.pos(-1.0D, -1.0D, (double)((float)k * -0.001F)).tex((double)f1, (double)f4).endVertex();
+// tessellator.draw();
+// GlStateManager.popMatrix();
+// ++k;
+// }
+// }
+
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(0.0F, 0.0F, -0.04F);
+ GlStateManager.scale(1.0F, 1.0F, 1.0F);
+ GlStateManager.popMatrix();
+ }
+
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java
index 444cd85a..880efbaf 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java
@@ -76,6 +76,8 @@ public class FeatureDungeonScore extends GuiFeature {
if (!skyblockStatus.isOnDungeon()) return null;
DungeonContext context = skyblockStatus.getContext();
if (context == null) return null;
+ if (!context.getMapProcessor().isInitialized()) return null;
+
int skill = 100;
int deaths = 0;
{
@@ -107,7 +109,7 @@ public class FeatureDungeonScore extends GuiFeature {
int time = 0;
{
double timeModifier;
- if (context.getMapProcessor().isInBossRoom()) {
+ if (context.getBossRoomEnterSeconds() != -1) {
timeModifier = Math.max(0, context.getBossRoomEnterSeconds() - 1200);
} else {
timeModifier = Math.max(0, FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - 1200);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java
index 74c0cec3..db2439e5 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java
@@ -62,10 +62,10 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList
public int compare(String o1, String o2) {
String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1);
AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2);
- int price1 = (auctionData == null) ? 0 : ((Integer)auctionData.prices.first()).intValue();
+ int price1 = (auctionData == null) ? 0 : auctionData.lowestBin;
String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2);
AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3);
- int price2 = (auctionData2 == null) ? 0 : ((Integer)auctionData2.prices.first()).intValue();
+ int price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin;
return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2);
}
@@ -78,7 +78,7 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList
for (String key : actualKeys) {
String id2 = id + "::" + key + "-" + enchants.getInteger(key);
AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2);
- totalLowestPrice += auctionData.prices.first();
+ totalLowestPrice += auctionData.lowestBin;
}
return totalLowestPrice;
} else {
@@ -86,10 +86,10 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList
if (auctionData == null) {
return 0;
} else {
- if (auctionData.sellPrice == -1 && auctionData.prices.size() > 0) return auctionData.prices.first();
- else if (auctionData.sellPrice != -1 && auctionData.prices.size() == 0) return auctionData.sellPrice;
+ if (auctionData.sellPrice == -1 && auctionData.lowestBin != -1) return auctionData.lowestBin;
+ else if (auctionData.sellPrice != -1 && auctionData.lowestBin == -1) return auctionData.sellPrice;
else {
- int ahPrice = auctionData.prices.first();
+ int ahPrice = auctionData.lowestBin;
if (ahPrice > auctionData.sellPrice) return ahPrice;
else return auctionData.sellPrice;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java
index 68393ca2..ba8422af 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java
@@ -46,10 +46,10 @@ public class FeatureTooltipPrice extends SimpleFeature implements TooltipListene
public int compare(String o1, String o2) {
String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1);
AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2);
- int price1 = (auctionData == null) ? 0 : ((Integer)auctionData.prices.first()).intValue();
+ int price1 = (auctionData == null) ? 0 : auctionData.lowestBin;
String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2);
AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3);
- int price2 = (auctionData2 == null) ? 0 : ((Integer)auctionData2.prices.first()).intValue();
+ int price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin;
return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2);
}
@@ -59,7 +59,6 @@ public class FeatureTooltipPrice extends SimpleFeature implements TooltipListene
});
actualKeys.addAll(keys);
int totalLowestPrice = 0;
- int totalHighestPrice = 0;
int iterations = 0;
for (String key : actualKeys) {
iterations++;
@@ -71,24 +70,21 @@ public class FeatureTooltipPrice extends SimpleFeature implements TooltipListene
continue;
}
if (iterations < 10)
- event.toolTip.add("§f"+ key + " " + enchants.getInteger(key) + "§7: §e"+ TextUtils.format((Integer) auctionData.prices.first()) + " §7to§e "+ TextUtils.format(auctionData.prices.last()));
- totalLowestPrice += auctionData.prices.first();
- totalHighestPrice += auctionData.prices.last();
+ event.toolTip.add("§f"+ key + " " + enchants.getInteger(key) + "§7: §e"+ TextUtils.format( auctionData.lowestBin));
+ totalLowestPrice += auctionData.lowestBin;
}
if (iterations >= 10)
event.toolTip.add("§7"+ (iterations - 10) + " more enchants... ");
- event.toolTip.add("§fTotal§7: §e"+ TextUtils.format(totalLowestPrice) + " §7to§e "+ TextUtils.format(totalHighestPrice));
+ event.toolTip.add("§fTotal Lowest§7: §e"+ TextUtils.format(totalLowestPrice));
} else {
AhUtils.AuctionData auctionData = AhUtils.auctions.get(id);
event.toolTip.add("");
if (auctionData == null) {
event.toolTip.add("§fLowest ah §7: §cn/a");
- event.toolTip.add("§fHighest ah §7: §cn/a");
event.toolTip.add("§fBazaar sell price §7: §cn/a");
event.toolTip.add("§fBazaar buy price §7: §cn/a");
} else {
- event.toolTip.add("§fLowest ah §7: " + ((auctionData.prices.size() != 0) ? ("§e"+ TextUtils.format(auctionData.prices.first().intValue())) : "§cn/a"));
- event.toolTip.add("§fHighest ah §7: " + ((auctionData.prices.size() != 0) ? ("§e"+ TextUtils.format((auctionData.prices.last()).intValue())) : "§cn/a"));
+ event.toolTip.add("§fLowest ah §7: " + ((auctionData.lowestBin != -1) ? ("§e"+ TextUtils.format(auctionData.lowestBin)) : "§cn/a"));
event.toolTip.add("§fBazaar sell price §7: " + ((auctionData.sellPrice == -1) ? "§cn/a": ("§e"+ TextUtils.format(auctionData.sellPrice))));
event.toolTip.add("§fBazaar buy price §7: " + ((auctionData.buyPrice == -1) ? "§cn/a": ("§e"+ TextUtils.format(auctionData.buyPrice))));
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java
index b96841df..ab3a727d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java
@@ -28,6 +28,8 @@ public class FeatureWarnLowHealth extends GuiFeature {
public FeatureWarnLowHealth() {
super("Dungeon", "Low Health Warning", "Warn if someone is on low health", "dungeon.lowhealthwarn", false, 200, 50);
parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of playername", Color.yellow, "color"));
+ parameters.put("threshold", new FeatureParameter<Integer>("threshold", "Health Threshold", "Health Threshold for this feature to be toggled. default to 500", 500, "integer"));
+
}
@@ -64,7 +66,7 @@ public class FeatureWarnLowHealth extends GuiFeature {
}
}
}
- if (lowestHealth > 500) return;
+ if (lowestHealth > this.<Integer>getParameter("threshold").getValue()) return;
fr.drawString(lowestHealthName+": ", 0,0,this.<Color>getParameter("color").getValue().getRGB());
fr.drawString(lowestHealth+"hp", fr.getStringWidth(lowestHealthName+"DungeonsGuide: "), 0, Color.red.getRGB());
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java
new file mode 100644
index 00000000..51fecd08
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface BossroomEnterListener {
+ void onBossroomEnter();
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java
index 1dc52921..1a277cb1 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java
@@ -54,6 +54,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> {
Color color = (Color) parameter2.getNewData();
Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsv);
+ alpha = color.getAlpha() / 255.0f;
{
h = new MFloatSelectionButton(hsv[0] * 360);
@@ -99,31 +100,33 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> {
a.setOnUpdate(new Runnable() {
@Override
public void run() {
- alpha = v.getData() / 100;
+ alpha = a.getData() / 100;
update();
}
});
- MLabelAndElement mLabelAndElement = new MLabelAndElement("V", v);
+ MLabelAndElement mLabelAndElement = new MLabelAndElement("A", a);
mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20));
add(mLabelAndElement);
}
}
private float[] hsv = new float[3];
- private float alpha;
+ private float alpha = 0;
public void update() {
if (hsv[2] > 1) hsv[2] = 1;
if (hsv[2] < 0) hsv[2] = 0;
if (hsv[1] > 1) hsv[1] = 1;
if (hsv[1] < 0) hsv[1] = 0;
- parameter.setNewData(new Color(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2])));
+ parameter.setNewData(new AColor(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0xffffff | ((int)(alpha * 255)) << 24, true ));
h.setData((float) Math.floor(hsv[0] * 360));
s.setData((float) Math.floor(hsv[1] * 100));
v.setData((float) Math.floor(hsv[2] * 100));
+ a.setData((float) Math.floor(alpha * 100));
h.updateSelected();
s.updateSelected();
v.updateSelected();
+ a.updateSelected();
}
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
@@ -144,15 +147,18 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> {
float g = (rgb >> 8 & 255) / 255.0f;
float b = (rgb & 255) / 255.0f;
GL11.glBegin(GL11.GL_TRIANGLES);
- GL11.glColor4f(0,0,0,1);GL11.glVertex3i(25+width ,45, 0);
- GL11.glColor4f(0,0,0,1);GL11.glVertex3i(10+width , 45, 0);
- GL11.glColor4f(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0);
+ GL11.glColor4f(0,0,0,alpha);GL11.glVertex3i(25+width ,45, 0);
+ GL11.glColor4f(0,0,0,alpha);GL11.glVertex3i(10+width , 45, 0);
+ GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0);
- GL11.glColor4f(0,0,0,1); GL11.glVertex3i(10+width , 45, 0);
- GL11.glColor4f(r,g,b,1);GL11.glVertex3i(10+width , 45 + width, 0);
- GL11.glColor4f(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0);
+ GL11.glColor4f(0,0,0,alpha); GL11.glVertex3i(10+width , 45, 0);
+ GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(10+width , 45 + width, 0);
+ GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0);
GL11.glEnd();
-
+ rgb = Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]);
+ r = (rgb >> 16 & 255) / 255.0f;
+ g = (rgb >> 8 & 255) / 255.0f;
+ b = (rgb & 255) / 255.0f;
GL11.glBegin(GL11.GL_TRIANGLES);
GL11.glColor4f(r,g,b,0);GL11.glVertex3i(50+width ,45, 0);
GL11.glColor4f(r,g,b,0);GL11.glVertex3i(35+width , 45, 0);
@@ -169,7 +175,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> {
float cy = 45 + radius;
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
- GL11.glColor4f(1,1,1,1);
+ GL11.glColor4f(1,1,1,alpha);
GL11.glVertex3f(cx,cy,0);
for (int i = 0; i <= 360; i++) {
float rad = 3.141592653f * i / 180;
@@ -177,7 +183,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> {
float r2 = (rgb2 >> 16 & 255) / 255.0f;
float g2 = (rgb2 >> 8 & 255) / 255.0f;
float b2 = (rgb2 & 255) / 255.0f;
- GL11.glColor4f(r2,g2,b2, 1);
+ GL11.glColor4f(r2,g2,b2, alpha);
GL11.glVertex3f(MathHelper.cos(rad) * radius + cx, MathHelper.sin(rad) * radius + cy, 0);
}
GL11.glEnd();
@@ -199,6 +205,11 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> {
worldrenderer.pos(27+width, 45 + (hsv[2]) * width, 0.5).endVertex();
tessellator.draw();
+ worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
+ worldrenderer.pos(33+width, 45 + (alpha) * width, 0.5).endVertex();
+ worldrenderer.pos(52+width, 45 + (alpha) * width, 0.5).endVertex();
+ tessellator.draw();
+
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1,1,1,1);
@@ -234,7 +245,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> {
{
if (35+width <= relMouseX && relMouseX <= 50 + width &&
45 <= relMouseY && relMouseY <= 45 + width) {
- hsv[2] = (relMouseY - 45) / (float)width;
+ alpha = (relMouseY - 45) / (float)width;
selected = 3;
}
}
@@ -243,7 +254,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> {
@Override
public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) {
- int width = getBounds().width - 30;
+ int width = getBounds().width - 60;
float radius = width / 2f;
float circleX = 5 + radius;
float circleY = 45 + radius;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java
new file mode 100755
index 00000000..33520f89
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java
@@ -0,0 +1,82 @@
+package kr.syeyoung.dungeonsguide.roomedit.valueedit;
+
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MFloatSelectionButton;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MIntegerSelectionButton;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MLabel;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MLabelAndElement;
+
+import java.awt.*;
+
+public class ValueEditFloat extends MPanel implements ValueEdit<Float> {
+ private Parameter parameter;
+
+
+ @Override
+ public void renderWorld(float partialTicks) {
+
+ }
+ public ValueEditFloat(final Parameter parameter2) {
+ this.parameter = parameter2;
+ {
+ MLabel label = new MLabel() {
+ @Override
+ public String getText() {
+ return parameter.getPreviousData().toString();
+ }
+ };
+ MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label);
+ mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20));
+ add(mLabelAndElement);
+ }
+ {
+ float newData = (Float) parameter.getNewData();
+ final MFloatSelectionButton textField = new MFloatSelectionButton(newData);
+ textField.setOnUpdate(new Runnable() {
+ @Override
+ public void run() {
+ parameter.setNewData(textField.getData());
+ }
+ });
+ MLabelAndElement mLabelAndElement = new MLabelAndElement("New",textField);
+ mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20));
+ add(mLabelAndElement);
+ }
+ }
+
+ @Override
+ public void onBoundsUpdate() {
+ for (MPanel panel :getChildComponents()){
+ panel.setSize(new Dimension(getBounds().width, 20));
+ }
+ }
+
+ @Override
+ public void setParameter(Parameter parameter) {
+ this.parameter = parameter;
+ }
+
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ this.setBounds(new Rectangle(0,0,parentWidth, parentHeight));
+ }
+
+ public static class Generator implements ValueEditCreator<ValueEditFloat> {
+
+ @Override
+ public ValueEditFloat createValueEdit(Parameter parameter) {
+ return new ValueEditFloat(parameter);
+ }
+
+ @Override
+ public Object createDefaultValue(Parameter parameter) {
+ return 0;
+ }
+
+ @Override
+ public Object cloneObj(Object object) {
+ return object;
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
index 001f5bc7..33c9d61b 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
@@ -28,6 +28,7 @@ public class ValueEditRegistry {
valueEditMap.put(String.class.getName(), new ValueEditString.Generator());
valueEditMap.put(Boolean.class.getName(), new ValueEditBoolean.Generator());
valueEditMap.put(Integer.class.getName(), new ValueEditInteger.Generator());
+ valueEditMap.put(Float.class.getName(), new ValueEditFloat.Generator());
valueEditMap.put(OffsetPoint.class.getName(), new ValueEditOffsetPoint.Generator());
valueEditMap.put(OffsetPointSet.class.getName(), new ValueEditOffsetPointSet.Generator());
valueEditMap.put(Color.class.getName(), new ValueEditColor.Generator());
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java
index 1f7644bc..a1f1cbcb 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java
@@ -1,29 +1,24 @@
package kr.syeyoung.dungeonsguide.utils;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
+import java.security.*;
+import java.security.cert.CertificateException;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import kr.syeyoung.dungeonsguide.e;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
import java.util.Timer;
import java.util.TimerTask;
-import java.util.TreeSet;
-import net.minecraft.nbt.CompressedStreamTools;
-import net.minecraft.nbt.NBTTagCompound;
public class AhUtils {
public static volatile Map<String, AuctionData> auctions = new HashMap<String, AuctionData>();
- private static Map<String, AuctionData> semi_auctions = new HashMap<String, AuctionData>();
-
public static Timer timer = new Timer();
public static int totalAuctions = 0;
@@ -31,93 +26,55 @@ public class AhUtils {
public static void registerTimer() {
timer.schedule(new TimerTask() {
public void run() {
- AhUtils.loadAuctions();
+ try {
+ AhUtils.loadAuctions();
+ } catch (CertificateException e) {
+ e.printStackTrace();
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (InvalidKeyException e) {
+ e.printStackTrace();
+ } catch (InvalidAlgorithmParameterException e) {
+ e.printStackTrace();
+ } catch (NoSuchPaddingException e) {
+ e.printStackTrace();
+ } catch (BadPaddingException e) {
+ e.printStackTrace();
+ } catch (KeyStoreException e) {
+ e.printStackTrace();
+ } catch (IllegalBlockSizeException e) {
+ e.printStackTrace();
+ } catch (KeyManagementException e) {
+ e.printStackTrace();
+ }
}
}, 0L, 1800000L);
}
- public static void loadAuctions() {
+ public static void loadAuctions() throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException, NoSuchPaddingException, BadPaddingException, KeyStoreException, IllegalBlockSizeException, KeyManagementException {
+ System.out.println("I think i'm loading ah");
try {
- int i = 0;
- do {
- } while (loadPage(i++));
- loadBazaar();
+ Map<String, AuctionData> semi_auctions = new HashMap<String, AuctionData>();
+ JsonElement object = e.getDungeonsGuide().getAuthenticator().d("https://dungeonsguide.kro.kr/resource/keys");
+ for (JsonElement element : object.getAsJsonArray()) {
+ JsonObject object1 = element.getAsJsonObject();
+ AuctionData auctionData = new AuctionData(object1.get("id").getAsString());
+ auctionData.lowestBin = object1.get("lowestBin").getAsInt();
+ auctionData.sellPrice = object1.get("sellPrice").getAsInt();
+ auctionData.buyPrice = object1.get("buyPrice").getAsInt();
+ semi_auctions.put(auctionData.id, auctionData);
+ }
auctions = semi_auctions;
- semi_auctions = new HashMap<String, AuctionData>();
- } catch (IOException e) {
+ } catch (Throwable e) {
e.printStackTrace();
}
}
- public static void loadBazaar() throws IOException {
- System.out.println("Fetching bazaar data");
- URL url = new URL("https://api.hypixel.net/skyblock/bazaar");
- InputStreamReader reader = new InputStreamReader(url.openStream());
- JsonObject object = (JsonObject)(new JsonParser()).parse(reader);
- boolean success = object.get("success").getAsBoolean();
- if (!success)
- return;
- JsonObject element = object.getAsJsonObject("products");
- for (Map.Entry<String, JsonElement> product : (Iterable<Map.Entry<String, JsonElement>>)element.entrySet()) {
- String id = product.getKey();
- AuctionData auctionData = semi_auctions.get(id);
- boolean notexisted = (auctionData == null);
- if (notexisted)
- auctionData = new AuctionData(id);
- auctionData.sellPrice = ((JsonElement)product.getValue()).getAsJsonObject().getAsJsonObject("quick_status").get("sellPrice").getAsInt();
- auctionData.buyPrice = ((JsonElement)product.getValue()).getAsJsonObject().getAsJsonObject("quick_status").get("buyPrice").getAsInt();
- if (notexisted)
- semi_auctions.put(id, auctionData);
- }
- }
-
- public static boolean loadPage(int page) throws IOException {
- System.out.println("Fetching page " + page + " of auctions");
- URL url = new URL("https://api.hypixel.net/skyblock/auctions?page=" + page);
- InputStreamReader reader = new InputStreamReader(url.openStream());
- JsonObject object = (JsonObject)(new JsonParser()).parse(reader);
- boolean success = object.get("success").getAsBoolean();
- if (!success)
- return false;
- int maxPage = object.get("totalPages").getAsInt();
- int totalAuctions = object.get("totalAuctions").getAsInt();
- System.out.println("Fetched page " + page + "/" + maxPage + " of auctions! (" + totalAuctions + " total)");
- JsonArray array = object.get("auctions").getAsJsonArray();
- for (JsonElement element2 : array) {
- JsonObject element = element2.getAsJsonObject();
- JsonElement isBin = element.get("bin");
- if (isBin == null || !isBin.getAsBoolean())
- continue;
- byte[] itemData = Base64.decode(element.get("item_bytes").getAsString().replace("\\u003d", "="));
- NBTTagCompound nbtTagCompound = CompressedStreamTools.readCompressed(new ByteArrayInputStream(itemData));
- NBTTagCompound acutalItem = (NBTTagCompound)nbtTagCompound.getTagList("i", 10).get(0);
- NBTTagCompound attributes = acutalItem.getCompoundTag("tag").getCompoundTag("ExtraAttributes");
- String id = attributes.getString("id");
- if (id.equals("ENCHANTED_BOOK")) {
- NBTTagCompound enchants = attributes.getCompoundTag("enchantments");
- Set<String> keys = enchants.getKeySet();
- if (keys.size() != 1)
- continue;
- String ench = keys.iterator().next();
- int lv = enchants.getInteger(ench);
- id = id + "::" + ench + "-" + lv;
- }
- AuctionData auctionData = semi_auctions.get(id);
- boolean notexisted = (auctionData == null);
- if (notexisted)
- auctionData = new AuctionData(id);
- auctionData.prices.add(element.get("starting_bid").getAsInt());
- if (notexisted)
- semi_auctions.put(id, auctionData);
- }
- return (page < maxPage);
- }
-
public static class AuctionData {
public String id;
- public SortedSet<Integer> prices;
+ public int lowestBin = -1;
public int sellPrice = -1;
@@ -125,7 +82,6 @@ public class AhUtils {
public AuctionData(String id) {
this.id = id;
- this.prices = new TreeSet<Integer>();
}
}
} \ No newline at end of file
diff --git a/src/main/resources/roomdata/11982f7f-703e-4d98-9d27-4e07ba3fef71.roomdata b/src/main/resources/roomdata/11982f7f-703e-4d98-9d27-4e07ba3fef71.roomdata
deleted file mode 100755
index 4b1e87d7..00000000
--- a/src/main/resources/roomdata/11982f7f-703e-4d98-9d27-4e07ba3fef71.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/5000be9d-3081-4a5e-8563-dd826705663a.roomdata b/src/main/resources/roomdata/5000be9d-3081-4a5e-8563-dd826705663a.roomdata
deleted file mode 100755
index 57dd6ee5..00000000
--- a/src/main/resources/roomdata/5000be9d-3081-4a5e-8563-dd826705663a.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/9139cb1c-b6f3-4bac-92de-909b1eb73449.roomdata b/src/main/resources/roomdata/9139cb1c-b6f3-4bac-92de-909b1eb73449.roomdata
deleted file mode 100755
index c9a51fb4..00000000
--- a/src/main/resources/roomdata/9139cb1c-b6f3-4bac-92de-909b1eb73449.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/990f6e4c-f7cf-4d27-ae91-11219b85861f.roomdata b/src/main/resources/roomdata/990f6e4c-f7cf-4d27-ae91-11219b85861f.roomdata
deleted file mode 100755
index 3e1aab30..00000000
--- a/src/main/resources/roomdata/990f6e4c-f7cf-4d27-ae91-11219b85861f.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/a053f4fa-d6b2-4aef-ae3e-97c7eee0252e.roomdata b/src/main/resources/roomdata/a053f4fa-d6b2-4aef-ae3e-97c7eee0252e.roomdata
deleted file mode 100755
index a3eb8baa..00000000
--- a/src/main/resources/roomdata/a053f4fa-d6b2-4aef-ae3e-97c7eee0252e.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/b2dce4ed-2bda-4303-a4d7-3ebb914db318.roomdata b/src/main/resources/roomdata/b2dce4ed-2bda-4303-a4d7-3ebb914db318.roomdata
deleted file mode 100755
index 6189efca..00000000
--- a/src/main/resources/roomdata/b2dce4ed-2bda-4303-a4d7-3ebb914db318.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/c2ea0a41-d495-437f-86cc-235a71c49f22.roomdata b/src/main/resources/roomdata/c2ea0a41-d495-437f-86cc-235a71c49f22.roomdata
deleted file mode 100755
index e3922fac..00000000
--- a/src/main/resources/roomdata/c2ea0a41-d495-437f-86cc-235a71c49f22.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/cf44c95c-950e-49e0-aa4c-82c2b18d0acc.roomdata b/src/main/resources/roomdata/cf44c95c-950e-49e0-aa4c-82c2b18d0acc.roomdata
deleted file mode 100755
index 079649bc..00000000
--- a/src/main/resources/roomdata/cf44c95c-950e-49e0-aa4c-82c2b18d0acc.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/cf6d49d3-4f1e-4ec9-836e-049573793ddd.roomdata b/src/main/resources/roomdata/cf6d49d3-4f1e-4ec9-836e-049573793ddd.roomdata
deleted file mode 100755
index 08bc65ac..00000000
--- a/src/main/resources/roomdata/cf6d49d3-4f1e-4ec9-836e-049573793ddd.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/d3e61abf-4198-4520-a950-a03761a0eb6f.roomdata b/src/main/resources/roomdata/d3e61abf-4198-4520-a950-a03761a0eb6f.roomdata
deleted file mode 100755
index a134b720..00000000
--- a/src/main/resources/roomdata/d3e61abf-4198-4520-a950-a03761a0eb6f.roomdata
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/roomdata/datas.txt b/src/main/resources/roomdata/datas.txt
deleted file mode 100755
index 6880da63..00000000
--- a/src/main/resources/roomdata/datas.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-roomdata/990f6e4c-f7cf-4d27-ae91-11219b85861f.roomdata
-roomdata/5000be9d-3081-4a5e-8563-dd826705663a.roomdata
-roomdata/9139cb1c-b6f3-4bac-92de-909b1eb73449.roomdata
-roomdata/11982f7f-703e-4d98-9d27-4e07ba3fef71.roomdata
-roomdata/a053f4fa-d6b2-4aef-ae3e-97c7eee0252e.roomdata
-roomdata/c2ea0a41-d495-437f-86cc-235a71c49f22.roomdata
-roomdata/cf6d49d3-4f1e-4ec9-836e-049573793ddd.roomdata
-roomdata/cf44c95c-950e-49e0-aa4c-82c2b18d0acc.roomdata
-roomdata/d3e61abf-4198-4520-a950-a03761a0eb6f.roomdata
-roomdata/ffd5411b-6ff4-4f60-b387-72f00510ec50.roomdata
-roomdata/b2dce4ed-2bda-4303-a4d7-3ebb914db318.roomdata \ No newline at end of file
diff --git a/src/main/resources/roomdata/ffd5411b-6ff4-4f60-b387-72f00510ec50.roomdata b/src/main/resources/roomdata/ffd5411b-6ff4-4f60-b387-72f00510ec50.roomdata
deleted file mode 100755
index 9500e921..00000000
--- a/src/main/resources/roomdata/ffd5411b-6ff4-4f60-b387-72f00510ec50.roomdata
+++ /dev/null
Binary files differ