aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/constants.js20
-rw-r--r--util/helperFunctions.js30
-rw-r--r--util/renderUtil.js101
3 files changed, 139 insertions, 12 deletions
diff --git a/util/constants.js b/util/constants.js
index 776f3f7..16a0e6e 100644
--- a/util/constants.js
+++ b/util/constants.js
@@ -1,4 +1,6 @@
import PogObject from "PogData"
+import axios from "../../axios"
+import settings from "../settings"
let PogData = new PogObject("Coleweight", {
"api_key": "",
@@ -39,20 +41,28 @@ let AbilityData = new PogObject("Coleweight", {
}, "config/.ability_data.json")
const PREFIX = "&2[CW] "
-export default
-{
+export default constants = {
PREFIX: PREFIX,
CALCULATEERRORMESSAGE: `${PREFIX}&cInvalid arguments. '/cw calculate help' for more information.`,
INVALIDARGS: `${PREFIX}&cInvalid arguments. '/cw help' for more information.`,
VERSION: (JSON.parse(FileLib.read("Coleweight", "metadata.json"))).version,
+ CWINFO: undefined,
data: PogData,
powderdata: PowderData,
timerdata: TimerData,
downtimedata: DowntimeData,
collectiondata: CollectionData,
abilitydata: AbilityData,
- throneValues: [],
- spiralValues: [],
beta: false,
serverData: {}
-} \ No newline at end of file
+}
+
+register("gameLoad", () => {
+ axios.get(`https://ninjune.dev/api/cwinfo?new=true`)
+ .then((res) => {
+ constants.CWINFO = res.data
+ })
+ .catch((e) => {
+ if(settings.debug) console.log(`[CW] Error loading CWINFO: ${e}`)
+ })
+}) \ No newline at end of file
diff --git a/util/helperFunctions.js b/util/helperFunctions.js
index d2f07d4..d1d3c00 100644
--- a/util/helperFunctions.js
+++ b/util/helperFunctions.js
@@ -172,8 +172,9 @@ export class trackerGui
this.collectionMoveGui = new Gui()
}
- renderGui(x, y, notation = false, renderGui = true) // can only be called in renderOverlay
+ renderGui(x, y, toggle = true, notation = false, alwaysShow = false) // can only be called in renderOverlay
{
+ if(!toggle) return
let leftValues = [`${this.itemStringed}`, `${this.itemStringed}/hr`, `${this.itemStringed} gained`, "Uptime"]
this.itemGui.x = x
this.itemGui.y = y
@@ -189,8 +190,8 @@ export class trackerGui
return this.itemGui.renderGui()
}
- if(!renderGui) return
- if(this.itemValues[0] != undefined && /*this.trackingItem && */this.calcItemPerHour)
+ if(!toggle || !(alwaysShow || this.trackingItem || this.trackedItem == "")) return
+ if(this.itemValues[0] != undefined && this.calcItemPerHour)
{
this.itemValuesSum = 0
for(let i = 0; i < this.itemValues.length; i++)
@@ -277,15 +278,14 @@ export class trackerGui
}
-function getObjectValue(obj, path, def)
+export function getObjectValue(obj, path, def)
{
let current = obj
-
+ if(path == undefined) return undefined
for (let i = 0; i < path.length; i++)
- current = current[path[i]] // could be source of issues
+ current = current[path[i]]
return current
-
}
@@ -384,4 +384,20 @@ export function checkInDwarven()
}
}
return false
+}
+
+const foragingLocations = ["Dark", "Birch", "Spruce", "Savanna", "Jungle", "Forest"]
+export function checkInPark()
+{
+ const scoreboard = Scoreboard.getLines()
+
+ for(let lineIndex = 0; lineIndex < scoreboard.length; lineIndex++)
+ {
+ for(let locationsIndex = 0; locationsIndex < foragingLocations.length; locationsIndex++)
+ {
+ if(scoreboard[lineIndex].toString().includes(foragingLocations[locationsIndex]))
+ return true
+ }
+ }
+ return false
} \ No newline at end of file
diff --git a/util/renderUtil.js b/util/renderUtil.js
new file mode 100644
index 0000000..1290938
--- /dev/null
+++ b/util/renderUtil.js
@@ -0,0 +1,101 @@
+export function trace(x, y, z, red, green, blue, alpha)
+{
+ GL11.glLineWidth(2.0)
+ GlStateManager.func_179090_x() // disableTexture2D
+
+ Tessellator.begin(1).colorize(red, green, blue, alpha)
+ if(Player.isSneaking())
+ Tessellator.pos(Player.getRenderX(), Player.getRenderY()+1.54, Player.getRenderZ()).tex(0, 0)
+ else
+ Tessellator.pos(Player.getRenderX(), Player.getRenderY()+1.6203, Player.getRenderZ()).tex(0, 0)
+ Tessellator.pos(x, y, z).tex(0, 0)
+ Tessellator.draw()
+
+ GlStateManager.func_179098_w() // enableTexture2D
+}
+
+
+export function drawEspBox (x, y, z, red, green, blue, alpha, phase = true) // thanks to renderlib, don't need the whole module so I'm not adding it.
+{
+ Tessellator.pushMatrix()
+ GL11.glLineWidth(2.0)
+ GlStateManager.func_179129_p() // disableCullFace
+ GlStateManager.func_179147_l() // enableBlend
+ GlStateManager.func_179112_b(770, 771) // blendFunc
+ GlStateManager.func_179132_a(false) // depthMask
+ GlStateManager.func_179090_x() // disableTexture2D
+
+ if(phase)
+ GlStateManager.func_179097_i() // disableDepth
+
+ const locations = [
+ // x, y, z x, y, z
+ [
+ [0, 0, 0],
+ [1, 0, 0],
+ ],
+ [
+ [0, 0, 0],
+ [0, 0, 1],
+ ],
+ [
+ [1, 0, 1],
+ [1, 0, 0],
+ ],
+ [
+ [1, 0, 1],
+ [0, 0, 1],
+ ],
+
+ [
+ [0, 1, 0],
+ [1, 1, 0],
+ ],
+ [
+ [0, 1, 0],
+ [0, 1, 1],
+ ],
+ [
+ [1, 1, 1],
+ [1, 1, 0],
+ ],
+ [
+ [1, 1, 1],
+ [0, 1, 1],
+ ],
+
+ [
+ [0, 0, 0],
+ [0, 1, 0],
+ ],
+ [
+ [1, 0, 0],
+ [1, 1, 0],
+ ],
+ [
+ [0, 0, 1],
+ [0, 1, 1],
+ ],
+ [
+ [1, 0, 1],
+ [1, 1, 1],
+ ],
+ ]
+
+ locations.forEach((loc) => {
+ Tessellator.begin(3).colorize(red, green, blue, alpha);
+ Tessellator.pos(x + loc[0][0] - 1 / 2, y + loc[0][1], z + loc[0][2] - 1 / 2).tex(0, 0)
+ Tessellator.pos(x + loc[1][0] - 1 / 2, y + loc[1][1], z + loc[1][2] - 1 / 2).tex(0, 0)
+ Tessellator.draw()
+ })
+
+ GlStateManager.func_179089_o() // enableCull
+ GlStateManager.func_179084_k() // disableBlend
+ GlStateManager.func_179132_a(true) // depthMask
+ GlStateManager.func_179098_w() // enableTexture2D
+
+ if(phase)
+ GlStateManager.func_179126_j() // enableDepth
+
+ Tessellator.popMatrix()
+} \ No newline at end of file