diff options
-rw-r--r-- | featureClass/class.js | 7 | ||||
-rw-r--r-- | featureClass/featureManager.js | 9 | ||||
-rw-r--r-- | features/betterGuis/index.js | 5 | ||||
-rw-r--r-- | features/hud/index.js | 42 | ||||
-rw-r--r-- | metadata.json | 2 |
5 files changed, 63 insertions, 2 deletions
diff --git a/featureClass/class.js b/featureClass/class.js index 1cfdd8b..11b3492 100644 --- a/featureClass/class.js +++ b/featureClass/class.js @@ -94,6 +94,13 @@ class Feature { return theEvent } + registerActionBar(criteria, func){ + let theEvent = this.FeatureManager.registerActionBar(criteria, func, this) + + this.customEvents[theEvent.id] = theEvent + + return theEvent + } registerStep(isFps, interval, func){ let theEvent = this.FeatureManager.registerStep(isFps, interval, func, this) diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js index 99f5483..d323397 100644 --- a/featureClass/featureManager.js +++ b/featureClass/featureManager.js @@ -224,6 +224,15 @@ class FeatureManager { return event } + + registerActionBar(criteria, func, context){ + + let event = this.registerCustom("actionBar", func, context) + + event.trigger.setChatCriteria(criteria) + + return event + } registerCommand(commandName, func, context){ let event = this.registerCustom("command", func, context) diff --git a/features/betterGuis/index.js b/features/betterGuis/index.js index 18135a4..2f22b04 100644 --- a/features/betterGuis/index.js +++ b/features/betterGuis/index.js @@ -1,6 +1,7 @@ /// <reference types="../../../CTAutocomplete" /> /// <reference lib="es2015" /> import Feature from "../../featureClass/class"; +import logger from "../../logger"; import ToggleSetting from "../settings/settingThings/toggle"; // import MuseumGui from "./museumGui"; @@ -109,7 +110,9 @@ class BetterGuis extends Feature { if(!hoveredSlot) return let hoveredSlotId = hoveredSlot.field_75222_d - console.log(hoveredSlotId) + + // logger.logMessage(hoveredSlotId, 4) + if(this.guiSlotClicked(ChatLib.removeFormatting(Player.getOpenedInventory().getName()), hoveredSlotId)){ cancel(event) } diff --git a/features/hud/index.js b/features/hud/index.js index b6db8c6..e8dc604 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -49,6 +49,12 @@ class Hud extends Feature { this.numberUtils = undefined this.petText = undefined + + this.lastWitherImpact = undefined + this.aup = undefined + this.lastTickEventEpochTimestamp = undefined + this.lastAbsorbtion = undefined + this.impactTest = undefined } onEnable(){ @@ -91,6 +97,8 @@ class Hud extends Feature { .requires(this.soulflowEnabledSetting)) this.hudElements.push(this.soulflowElement) + this.witherImpactCooldownSetting = new ToggleSetting("Show Wither Impact Cooldown", "This will render a small cooldown above your crosshair", true, "wither_impact_cooldown_enabled", this) + // this.showDragonDamages = new ToggleSetting("Show dragon damages", "This will render the top 3 damages + your damage during a dragon fight", true, "dragon_dmg_enable", this).requires(this.soulflowEnabledSetting) // this.dragonDamageElement = new HudTextElement() // .setToggleSetting(this.showDragonDamages) @@ -106,6 +114,12 @@ class Hud extends Feature { this.lastframe = 0 this.slowestFrameTime = 0 + this.lastWitherImpact = 0 + this.aup = 0 + this.lastTickEventEpochTimestamp = 0 + this.lastAbsorbtion = 0 + this.impactTest = false + this.lastFrameRates = [0,0,0,0,0,0,0,0,0,0] this.lastFrameRatesS = [0,0,0,0,0,0,0,0,0,0] @@ -142,6 +156,8 @@ class Hud extends Feature { if(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock){ this.apiLoad(this.FeatureManager.features["dataLoader"].class.lastApiData.skyblock, "skyblock", true, true) } + + this.registerActionBar("${m}", this.actionbarMessage) } onDisable(){ @@ -165,6 +181,11 @@ class Hud extends Feature { for(let element of this.hudElements){ element.render() } + + + if (this.witherImpactCooldownSetting.getValue() && Date.now()-this.lastWitherImpact < 10000) { + Renderer.drawString(Math.max(0,Math.ceil((5000-(Date.now()-this.lastWitherImpact))/1000)) + "s", Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(Math.max(0,Math.ceil((5000-(Date.now()-this.lastWitherImpact))/1000)) + "s") / 2, Renderer.screen.getHeight() / 2 - 15) + } } renderWorld(){ @@ -183,6 +204,17 @@ class Hud extends Feature { this.lastFrame = time } + actionbarMessage(m){ + if(ChatLib.removeFormatting(m).includes("(Wither Impact)")){ + if(Date.now()-this.aup < 750){ + this.lastWitherImpact = Date.now() + this.aup = 0 + }else{ + this.impactTest = Date.now() + } + } + } + step(){ let fps = 0 @@ -234,6 +266,16 @@ class Hud extends Feature { } } } + + if(Player.getPlayer().func_110139_bj() > this.lastAbsorbtion){ + if(Date.now()-this.impactTest < 750){ + this.lastWitherImpact = Date.now() + this.impactTest = 0 + }else{ + this.aup = Date.now() + } + } + this.lastAbsorbtion = Player.getPlayer().func_110139_bj() } step_5second(){ diff --git a/metadata.json b/metadata.json index 6552e03..ea416d3 100644 --- a/metadata.json +++ b/metadata.json @@ -6,7 +6,7 @@ "description": "Soopy addons v2", "name": "SoopyV2", "version": "2.0.2", - "versionId": 112, + "versionId": 113, "requires": [ "soopyApis", "soopyAddonsData", |