Skip to content

Commit

Permalink
Added mana drain range
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenga8533 committed Jan 17, 2024
1 parent 7a72457 commit 8d8101f
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 6 deletions.
4 changes: 3 additions & 1 deletion changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"- Added calculator to search bar",
"- Added direction to status display",
"- Added `/va attributelist`",
"- Added mana drain range",
"- Added support for ${name} in join messages",
"- TODO: Added legion to stats display",
"- Changed item value to include dye",
"- Recoded skill tracker",
"- TODO: Recoded skill tracker",
"- Fixed valuelist only affecting base value",
"- Fixed color syntax"
]
2 changes: 1 addition & 1 deletion features/combat/EntityDetect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import settings from "../../utils/settings";
import { AMOGUS, BOLD, GRAY, DARK_RED, GREEN, RED, WHITE, LOGO } from "../../utils/constants";
import { AMOGUS, BOLD, GRAY, DARK_RED, GREEN, RED, WHITE } from "../../utils/constants";
import { convertToPascalCase, getTime, playSound, unformatNumber } from "../../utils/functions";
import { Overlay } from "../../utils/overlay";
import { data, registerWhen } from "../../utils/variables";
Expand Down
37 changes: 37 additions & 0 deletions features/combat/ManaDrain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { AQUA } from "../../utils/constants";
import settings from "../../utils/settings";
import { registerWhen } from "../../utils/variables";
import { Hitbox, renderEntities } from "../../utils/waypoints";


/**
* Register hitbox rendering
*/
let nearby = [];
let render = false;
new Hitbox(() => settings.manaDrain, (pt) => {
// Mana Blue Hitboxes
renderEntities(nearby, 0.408, 0.76, 0.96, pt);
});

registerWhen(register("renderOverlay", () => {
if (!render) return;

Client.showTitle(`${nearby.length + AQUA} nearby ${nearby.length === 1 ? "player" : "players"}!`, "", 0, 5, 1);
}), () => settings.manaDrain);

/**
* Updates nearby players
*/
const PLAYER_CLASS = Java.type("net.minecraft.client.entity.EntityOtherPlayerMP").class;
registerWhen(register("step", () => {
const heldName = Player.getHeldItem()?.getName();
render = heldName !== undefined && (heldName.includes("flux Power Orb") || heldName.endsWith("End Stone Sword"))
if (!render) {
nearby = [];
return;
}

const player = Player.asPlayerMP();
nearby = World.getAllEntitiesOfType(PLAYER_CLASS).filter(other => other.getEntity().func_110143_aJ() !== 20 && player.distanceTo(other) < 5);
}).setFps(2), () => settings.manaDrain);
10 changes: 6 additions & 4 deletions features/party/PartyCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ function setWaifu(announce) {
new TextComponent(`${DARK_GRAY}[click to regenerate]`).setClick("run_command", "/va w").setHoverValue("Click me!")).chat();
}).catch((err) => {
const error = err.data.error;
if (announce) ChatLib.chat(`${LOGO + RED}Imgur Upload Failed: ${error?.message ?? error}`);

// Attempt to use base Imgur API
ChatLib.chat(`${LOGO + DARK_GRAY}Attempting to fetch using Imgur API...`);
if (announce) {
// Attempt to use base Imgur API
ChatLib.chat(`${LOGO + RED}Imgur Upload Failed: ${error?.message ?? error}`);
ChatLib.chat(`${LOGO + DARK_GRAY}Attempting to fetch using Imgur API...`);
}

const clientID = IMGUR_KEYS[parseInt(Math.random() * (IMGUR_KEYS.length - 1))];
request({
url: "https://api.imgur.com/3/gallery/t/waifu/viral/1?showViral=true",
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import "./features/combat/EntityDetect";
import "./features/combat/GyroTimer";
import "./features/combat/HealthAlert";
import "./features/combat/KillCounter";
import "./features/combat/ManaDrain";
import "./features/combat/RagDetect";
import "./features/combat/SlayerDetect";
// Mining Features
Expand Down
8 changes: 8 additions & 0 deletions utils/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,14 @@ Move GUI with ${AQUA}/moveKills ${GRAY}or reset tracker with ${AQUA}/resetKills$
subcategory: "Combat"
})
healthAlert = 0.0;
@SwitchProperty({
name: "Mana Drain Range",
description: `${DARK_RED}NEW! ${GRAY}Highlights and displays number of players in mana drain range. Works only when holding End Stone Sword or fluxes.`,
category: "Combat",
subcategory: "Combat"
})
manaDrain = false;
@SwitchProperty({
name: "Ragnarok Detection",
Expand Down

0 comments on commit 8d8101f

Please sign in to comment.