Skip to content

Commit

Permalink
Add summoning eye alert.
Browse files Browse the repository at this point in the history
  • Loading branch information
orchidalloy authored and biscuut committed Sep 5, 2019
1 parent 99a563d commit 2aca842
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void initGui() {
Feature.IGNORE_ITEM_FRAME_CLICKS, Feature.HIDE_FOOD_ARMOR_BAR, Feature.HIDE_HEALTH_BAR,
Feature.AVOID_BREAKING_STEMS, Feature.MAGMA_WARNING,
Feature.DROP_CONFIRMATION, Feature.HIDE_PLAYERS_IN_LOBBY, Feature.MINION_STOP_WARNING,
Feature.SHOW_ITEM_ANVIL_USES, Feature.LOCK_SLOTS, Feature.DONT_RESET_CURSOR_INVENTORY};
Feature.SHOW_ITEM_ANVIL_USES, Feature.LOCK_SLOTS, Feature.DONT_RESET_CURSOR_INVENTORY,
Feature.MAKE_ENDERCHESTS_GREEN_IN_END, Feature.SUMMONING_EYE_ALERT};
} else if (tab == EnumUtils.SkyblockAddonsGuiTab.FIXES) {
array = new Feature[]{Feature.HIDE_BONES, Feature.DISABLE_EMBER_ROD, Feature.HIDE_AUCTION_HOUSE_PLAYERS,
Feature.STOP_BOW_CHARGE_FROM_RESETTING, Feature.AVOID_PLACING_ENCHANTED_ITEMS, Feature.PREVENT_MOVEMENT_ON_DEATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class PlayerListener {
private long lastBoss = -1;
private int magmaTick = 1;
private int timerTick = 1;
private long lastScreenOpen = -1;
private long lastMinionSound = -1;
private Integer healthUpdate = null;
private long lastHealthUpdate;
Expand Down Expand Up @@ -271,8 +272,10 @@ public void onTick(TickEvent.ClientTickEvent e) {
sentUpdate = true;
}

if (main.getConfigValues().isEnabled(Feature.ITEM_PICKUP_LOG) && mc.currentScreen == null
&& main.getPlayerListener().didntRecentlyJoinWorld()) {
if (mc.currentScreen != null) {
lastScreenOpen = System.currentTimeMillis();
} else if (main.getConfigValues().isEnabled(Feature.ITEM_PICKUP_LOG)
&& main.getPlayerListener().didntRecentlyJoinWorld()) {
main.getInventoryUtils().getInventoryDifference(p.inventory.mainInventory);
}
}
Expand Down Expand Up @@ -542,6 +545,10 @@ public boolean shouldResetMouse() {
return System.currentTimeMillis() - lastClosedInv > 100;
}

public boolean didntRecentlyCloseScreen() {
return System.currentTimeMillis() - lastScreenOpen > 500;
}

public boolean didntRecentlyJoinWorld() {
return System.currentTimeMillis() - lastWorldJoin > 3000;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ private void renderWarnings(ScaledResolution scaledResolution) {
case FULL_INVENTORY_WARNING:
message = Message.MESSAGE_FULL_INVENTORY;
break;
case SUMMONING_EYE_ALERT:
message = Message.MESSAGE_SUMMONING_EYE_FOUND;
break;
}
if (message != null) {
String text = message.getMessage();
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/codes/biscuit/skyblockaddons/utils/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public enum Feature {
DARK_AUCTION_TIMER(28, Message.SETTING_DARK_AUCTION_TIMER),
ITEM_PICKUP_LOG(29, Message.SETTING_ITEM_PICKUP_LOG),
AVOID_PLACING_ENCHANTED_ITEMS(30, Message.SETTING_AVOID_PLACING_ENCHANTED_ITEMS),
MAKE_ENDERCHESTS_GREEN_IN_END(31, Message.SETTING_MAKE_ENDERMEN_HOLDING_ITEMS_PINK), //TODO change this message
MAKE_ENDERCHESTS_GREEN_IN_END(31, Message.SETTING_MAKE_ENDERCHESTS_IN_END_GREEN), //TODO change this message
AVOID_BREAKING_STEMS(32, Message.SETTING_AVOID_BREAKING_STEMS),
STOP_BOW_CHARGE_FROM_RESETTING(31, Message.SETTING_STOP_BOW_CHARGE_FROM_RESETTING),
SHOW_MAGMA_TIMER_IN_OTHER_GAMES(32, Message.SETTING_SHOW_MAGMA_TIMER_IN_OTHER_GAMES),
Expand All @@ -41,6 +41,7 @@ public enum Feature {
LOCK_SLOTS(36, Message.SETTING_LOCK_SLOTS),
DONT_RESET_CURSOR_INVENTORY(37, Message.SETTING_DONT_RESET_CURSOR_INVENTORY),
HIDE_HUD_BARS(38, null), //TODO migrate this
SUMMONING_EYE_ALERT(39, Message.SETTING_SUMMONING_EYE_ALERT),


DISABLE_DOUBLE_DROP_AUTOMATICALLY(14, Message.SETTING_DISABLE_DOUBLE_DROP),
Expand All @@ -66,9 +67,9 @@ public enum Feature {
private int id;
private Message message;

Feature(int id, Message message) {
Feature(int id, Message settingMessage) {
this.id = id;
this.message = message;
this.message = settingMessage;
}

public int getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*/
public class InventoryUtils {

private static final String SUMMONING_EYE_DISPLAY_NAME = "\u00A75Summoning Eye";

/**
* Display name of the Quiver Arrow item
*/
Expand Down Expand Up @@ -63,7 +65,7 @@ public void getInventoryDifference(ItemStack[] currentInventory) {
Map<String, Integer> previousInventoryMap = new HashMap<>();
Map<String, Integer> newInventoryMap = new HashMap<>();

if(previousInventory != null) {
if (previousInventory != null) {

for(int i = 0; i < newInventory.size(); i++) {
ItemStack previousItem = previousInventory.get(i);
Expand Down Expand Up @@ -114,7 +116,21 @@ public void getInventoryDifference(ItemStack[] currentInventory) {
} else {
itemPickupLog.put(diff.getDisplayName(), diff);
}
if (main.getConfigValues().isEnabled(Feature.SUMMONING_EYE_ALERT)
&& diff.getAmount() == 1 && diff.getDisplayName().equals(SUMMONING_EYE_DISPLAY_NAME)
&& (main.getUtils().getLocation() == EnumUtils.Location.THE_END || main.getUtils().getLocation() == EnumUtils.Location.DRAGONS_NEST)
&& main.getPlayerListener().didntRecentlyCloseScreen()){
main.getUtils().playSound("random.orb", 0.5);
main.getRenderListener().setTitleFeature(Feature.SUMMONING_EYE_ALERT);
new Timer().schedule(new TimerTask() {
@Override
public void run() {
main.getRenderListener().setTitleFeature(null);
}
}, main.getConfigValues().getWarningSeconds() * 1000);
}
}

}

previousInventory = newInventory;
Expand Down

0 comments on commit 2aca842

Please sign in to comment.