aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--featureClass/featureManager.js4
-rw-r--r--features/betterGuis/index.js14
-rw-r--r--features/betterGuis/museumGui.js453
-rw-r--r--features/cosmetics/cosmetic.js2
-rw-r--r--features/globalSettings/index.js15
-rw-r--r--features/spamHider/index.js1
-rw-r--r--features/streamsGUI/index.js2
7 files changed, 417 insertions, 74 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js
index 538bd91..651ae52 100644
--- a/featureClass/featureManager.js
+++ b/featureClass/featureManager.js
@@ -20,6 +20,8 @@ class FeatureManager {
this.parent = undefined
+ this.finishedLoading = false
+
this.commandFuncs = {}
this.lastEventId = 0
@@ -53,6 +55,8 @@ class FeatureManager {
this.loadFeature(feature)
}
})
+
+ this.finishedLoading = true
}).start()
this.registerStep(false, 30, ()=>{
diff --git a/features/betterGuis/index.js b/features/betterGuis/index.js
index 7475d4a..d13cf68 100644
--- a/features/betterGuis/index.js
+++ b/features/betterGuis/index.js
@@ -1,8 +1,9 @@
/// <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.js";
+import MuseumGui from "./museumGui.js";
class BetterGuis extends Feature {
constructor() {
@@ -12,12 +13,12 @@ class BetterGuis extends Feature {
onEnable(){
this.initVariables()
- // this.museumGui = new MuseumGui()
+ this.museumGui = new MuseumGui()
this.replaceSbMenuClicks = new ToggleSetting("Improve Clicks on SBMENU", "This will change clicks to middle clicks, AND use commands where possible (eg /pets)", true, "sbmenu_clicks", this)
this.reliableSbMenuClicks = {getValue: ()=>false}//removed because hypixel fixed may add back later //new ToggleSetting("Make SBMENU clicks reliable", "This will delay clicks on sbmenu to time them so they dont get canceled", true, "sbmenu_time", this)
- this.museumGuiEnabled = {getValue: ()=>false} //Removed because not finished yet new ToggleSetting("Custom Museum GUI", "Custom gui for the Museum", true, "custom_museum_enabled", this)
+ this.museumGuiEnabled = /*{getValue: ()=>false} //Removed because not finished yet*/ new ToggleSetting("Custom Museum GUI", "Custom gui for the Museum", true, "custom_museum_enabled", this)
this.lastWindowId = 0
this.shouldHold = 10
@@ -96,9 +97,6 @@ class BetterGuis extends Feature {
this.registerEvent("guiOpened", (event)=>{
if(this.museumGuiEnabled.getValue()) this.museumGui.guiOpened.call(this.museumGui, event)
})
- this.registerEvent("tick", ()=>{
- if(this.museumGuiEnabled.getValue()) this.museumGui.tick.call(this.museumGui)
- })
this.registerStep(true, 10, this.step)
}
@@ -110,7 +108,7 @@ class BetterGuis extends Feature {
let hoveredSlotId = hoveredSlot.field_75222_d
- // logger.logMessage(hoveredSlotId, 4)
+ logger.logMessage(hoveredSlotId, 4)
if(this.guiSlotClicked(ChatLib.removeFormatting(Player.getOpenedInventory().getName()), hoveredSlotId)){
cancel(event)
@@ -119,6 +117,8 @@ class BetterGuis extends Feature {
}
step(){
+ if(this.museumGuiEnabled.getValue()) this.museumGui.tick.call(this.museumGui)
+
if(this.replaceSbMenuClicks.getValue()){
if(Player.getOpenedInventory().getName()==="SkyBlock Menu"){
if(this.lastWindowId === 0){
diff --git a/features/betterGuis/museumGui.js b/features/betterGuis/museumGui.js
index 23d9e94..b52fbf3 100644
--- a/features/betterGuis/museumGui.js
+++ b/features/betterGuis/museumGui.js
@@ -1,11 +1,13 @@
import { SoopyGui, SoopyRenderEvent } from "../../../guimanager"
import SoopyKeyPressEvent from "../../../guimanager/EventListener/SoopyKeyPressEvent"
import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent"
+import BoxWithText from "../../../guimanager/GuiElement/BoxWithText"
import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"
import ProgressBar from "../../../guimanager/GuiElement/ProgressBar"
import SoopyBoxElement from "../../../guimanager/GuiElement/SoopyBoxElement"
import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement"
import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement"
+import Notification from "../../../guimanager/Notification"
import renderLibs from "../../../guimanager/renderLibs"
import * as utils from "../../utils/utils"
@@ -43,7 +45,7 @@ class MuseumGui {
Renderer.translate(0,0,100)
Renderer.drawRect(Renderer.color(0,0,0,100), this.weaponsIndicator.location.getXExact(), this.weaponsIndicator.location.getYExact(), this.weaponsIndicator.location.getWidthExact(), this.weaponsIndicator.location.getHeightExact())
- let clicks = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"?"1":"2"
+ let clicks = Player.getOpenedInventory().getName() === "Your Museum"?"1":"2"
Renderer.translate(0,0,100)
renderLibs.drawStringCenteredFull(clicks, this.weaponsIndicator.location.getXExact()+this.weaponsIndicator.location.getWidthExact()/2, this.weaponsIndicator.location.getYExact()+this.weaponsIndicator.location.getHeightExact()/2, Math.min(this.weaponsIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.weaponsIndicator.location.getHeightExact()/4/2))
}else{
@@ -78,7 +80,7 @@ class MuseumGui {
Renderer.translate(0,0,100)
Renderer.drawRect(Renderer.color(0,0,0,100), this.armourIndicator.location.getXExact(), this.armourIndicator.location.getYExact(), this.armourIndicator.location.getWidthExact(), this.armourIndicator.location.getHeightExact())
- let clicks = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"?"1":"2"
+ let clicks = Player.getOpenedInventory().getName() === "Your Museum"?"1":"2"
Renderer.translate(0,0,100)
renderLibs.drawStringCenteredFull(clicks, this.armourIndicator.location.getXExact()+this.armourIndicator.location.getWidthExact()/2, this.armourIndicator.location.getYExact()+this.armourIndicator.location.getHeightExact()/2, Math.min(this.armourIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.armourIndicator.location.getHeightExact()/4/2))
}else{
@@ -112,7 +114,7 @@ class MuseumGui {
Renderer.translate(0,0,100)
Renderer.drawRect(Renderer.color(0,0,0,100), this.raritiesIndicator.location.getXExact(), this.raritiesIndicator.location.getYExact(), this.raritiesIndicator.location.getWidthExact(), this.raritiesIndicator.location.getHeightExact())
- let clicks = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"?"1":"2"
+ let clicks = Player.getOpenedInventory().getName() === "Your Museum"?"1":"2"
Renderer.translate(0,0,100)
renderLibs.drawStringCenteredFull(clicks, this.raritiesIndicator.location.getXExact()+this.raritiesIndicator.location.getWidthExact()/2, this.raritiesIndicator.location.getYExact()+this.raritiesIndicator.location.getHeightExact()/2, Math.min(this.raritiesIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.raritiesIndicator.location.getHeightExact()/4/2))
}else{
@@ -147,7 +149,7 @@ class MuseumGui {
Renderer.translate(0,0,100)
Renderer.drawRect(Renderer.color(0,0,0,100), this.specialIndicator.location.getXExact(), this.specialIndicator.location.getYExact(), this.specialIndicator.location.getWidthExact(), this.specialIndicator.location.getHeightExact())
- let clicks = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"?"1":"2"
+ let clicks = Player.getOpenedInventory().getName() === "Your Museum"?"1":"2"
Renderer.translate(0,0,100)
renderLibs.drawStringCenteredFull(clicks, this.specialIndicator.location.getXExact()+this.specialIndicator.location.getWidthExact()/2, this.specialIndicator.location.getYExact()+this.specialIndicator.location.getHeightExact()/2, Math.min(this.specialIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.specialIndicator.location.getHeightExact()/4/2))
@@ -169,19 +171,72 @@ class MuseumGui {
this.specialIndicator.addChild(this.specialPercentageText)
this.mainPage.addChild(this.specialIndicator)
- let box = new SoopyBoxElement().setLocation(0.5-widthPer/2, 0.25, widthPer, 0.075)
- this.pageTitle = new SoopyTextElement().setText("§5Museum").setMaxTextScale(10).setLocation(0,0,1,1)
+ let box = new SoopyBoxElement().setLocation(0.5-widthPer*0.75, 0.25, widthPer*2*0.75, 0.075)
+ this.pageTitle = new SoopyTextElement().setText("§5Your Museum").setMaxTextScale(10).setLocation(0,0,1,1)
box.addChild(this.pageTitle)
this.mainPage.addChild(box)
- this.itemsBox = new SoopyBoxElement().setLocation(0.5-widthPer*3/2, 0.35, widthPer*3, 0.6).setScrollable(true)
+ this.nextButton = new ButtonWithArrow().setLocation(0.5+widthPer*3/2-widthPer/2, 0.25, widthPer/2, 0.075).setText("§0Next Page")
+ this.nextButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ this.nextPage()
+ }))
+ this.mainPage.addChild(this.nextButton)
+
+ this.previousButton = new ButtonWithArrow().setLocation(0.5-widthPer*3/2, 0.25, widthPer/2, 0.075).setText("§0Previous Page").setDirectionRight(false)
+ this.previousButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ this.previousPage()
+ }))
+ this.mainPage.addChild(this.previousButton)
+
+ this.nextButton.visable = false
+ this.previousButton.visable = false
+
+ this.donateTitleBox = new SoopyBoxElement().setLocation(0.5+widthPer*3/2+0.025, 0.25, 0.5-widthPer*1.5-0.05, 0.075)
+ let donateTitle = new SoopyTextElement().setText("§5Donate").setMaxTextScale(10).setLocation(0,0,1,1)
+
+ this.donateTitleBox.addChild(donateTitle)
+ this.mainPage.addChild(this.donateTitleBox)
+
+ this.donateBox = new SoopyBoxElement().setLocation(0.5+widthPer*3/2+0.025, 0.35, 0.5-widthPer*1.5-0.05, 0.6).setScrollable(true)
+ this.mainPage.addChild(this.donateBox)
+
+ this.favoriteTitleBox = new SoopyBoxElement().setLocation(0.025, 0.25, 0.5-widthPer*1.5-0.05, 0.075)
+ let favoriteTitle = new SoopyTextElement().setText("§5Favourite Items").setMaxTextScale(10).setLocation(0,0,1,1)
+
+ this.favoriteTitleBox.addChild(favoriteTitle)
+ this.mainPage.addChild(this.favoriteTitleBox)
+
+ this.favoriteBox = new SoopyBoxElement().setLocation(0.025, 0.35, 0.5-widthPer*1.5-0.05, 0.6).setScrollable(true)
+ this.mainPage.addChild(this.favoriteBox)
+
+ this.itemsBox = new SoopyBoxElement().setLocation(0.5-widthPer*3/2, 0.35, widthPer*3, 0.6)
this.mainPage.addChild(this.itemsBox)
+
+ this.donateItems = []
+
+ this.confirm_temp = ""
+
+ this.replacePage = {
+ "Your Museum": "Museum",
+ " Weapons": "Weapons",
+ " Armor Sets": "Armor Sets",
+ " Rarities": "Rarities",
+ " Special Items": "Special Items"
+ }
+
+ this.tickI = 0
+
+ this.lastGuiTitle = ""
+
+ this.favoriteItems = JSON.parse(FileLib.read("soopyAddonsData","museumFavoriteData.json") || "[]") || []
+ this.favoriteIds = this.favoriteItems.map(a=>a.sb_id)
+ this.updatedFavorites(false)
}
clickedTopButton(type){
if(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())===type) return
- if(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"){
+ if(Player.getOpenedInventory().getName() === "Your Museum"){
//if on main page can just directly click on it
switch(type){
case "Weapons":
@@ -202,11 +257,37 @@ class MuseumGui {
}
}
- tickMenu(){
- this.pageTitle.setText("§5"+ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()))
- if(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"){
- if(!Player.getOpenedInventory().getStackInSlot(19)) return
+ nextPage(){
+ let itempages = ["Weapons", "Armor Sets", "Rarities", "Special Items"]
+ if(itempages.includes(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()])){
+ Player.getOpenedInventory().click(53, false, "MIDDLE")
+
+ let [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a))
+ this.regenItems(currPage+1)
+ }
+ }
+
+ previousPage(){
+ let itempages = ["Weapons", "Armor Sets", "Rarities", "Special Items"]
+ if(itempages.includes(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()])){
+ Player.getOpenedInventory().click(45, false, "MIDDLE")
+ let [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a))
+ this.regenItems(currPage-1)
+ }
+ }
+
+ tickMenu(first=false){
+ if(!first && (this.tickI++)%5!==0){
+ if(this.lastGuiTitle === Player.getOpenedInventory().getName()){
+ return
+ }
+ }
+ this.lastGuiTitle = Player.getOpenedInventory().getName()
+
+ if(Player.getOpenedInventory().getName() === "Your Museum"){//main page
+ if(Player.getOpenedInventory().getStackInSlot(19).getID() === -1) return
+
let lore = Player.getOpenedInventory().getStackInSlot(19).getLore()
lore.forEach((line, i)=>{
if(i===0) return
@@ -255,79 +336,320 @@ class MuseumGui {
}
})
this.specialIndicator.setLore(lore)
+
+ if(this.pageTitle.text !== ("§5"+Player.getOpenedInventory().getName()) || first){
+ this.itemsBox.clearChildren()
+ let rewardsButton = new ButtonWithArrow().setText("§5Rewards").setLocation(0.1,0.05,0.8,0.2)
+ rewardsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ Player.getOpenedInventory().click(40, false, "MIDDLE")
+ }))
+ this.itemsBox.addChild(rewardsButton)
+ let browserButton = new ButtonWithArrow().setText("§5Museum Browser").setLocation(0.1,0.3,0.8,0.2)
+ browserButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ Player.getOpenedInventory().click(50, false, "MIDDLE")
+ }))
+ this.itemsBox.addChild(browserButton)
+ }
}
+ this.nextButton.visable = false
+ this.previousButton.visable = false
+
+ this.donateTitleBox.visable = false
+ this.donateBox.visable = false
+
let itempages = ["Weapons", "Armor Sets", "Rarities", "Special Items"]
- if(itempages.includes(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()))){
- let page = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())
- let pageNum = 0
- Player.getOpenedInventory().getStackInSlot(45).getLore().forEach(line=>{
- if(ChatLib.removeFormatting(line).startsWith("Page ")) pageNum = parseInt(ChatLib.removeFormatting(line).split(" ")[1])+1
- })
- Player.getOpenedInventory().getStackInSlot(53).getLore().forEach(line=>{
- if(ChatLib.removeFormatting(line).startsWith("Page ")) pageNum = parseInt(ChatLib.removeFormatting(line).split(" ")[1])-1
+ if(itempages.includes(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()])){
+ let page = this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()]
+ let [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a))
+
+ if(currPage > 1){
+ this.previousButton.visable = true
+ if(Player.getOpenedInventory().getStackInSlot(45).getID() !== -1) this.previousButton.setLore(Player.getOpenedInventory().getStackInSlot(45).getLore())
+ }
+ if(currPage < pageNum){
+ this.nextButton.visable = true
+ if(Player.getOpenedInventory().getStackInSlot(53).getID() !== -1)this.nextButton.setLore(Player.getOpenedInventory().getStackInSlot(53).getLore())
+ }
+
+ this.donateTitleBox.visable = true
+ this.donateBox.visable = true
+ let oldDonateItems = JSON.stringify(this.donateItems)
+ this.donateItems = []
+ let donateArmorSets = {}
+ Player.getOpenedInventory().getItems().forEach((item, slot)=>{
+ if(!item) return
+ if(item.getID() === -1) return
+ item.getLore().forEach(line=>{
+ if(ChatLib.removeFormatting(line) === "Click to donate item!"){
+ let sb_id = utils.getSBID(item)
+
+ this.donateItems.push({
+ sb_id: sb_id || "NA",
+ name: item.getName() || "",
+ lore: item.getLore() || [],
+ slot: slot
+ })
+ }
+ if(ChatLib.removeFormatting(line) === "Click to donate armor set!"){
+ let sb_id = utils.getSBID(item)
+
+ let setId = sb_id.split("_")
+ setId.pop()
+ setId = setId.join("_")
+
+ donateArmorSets[setId] = (donateArmorSets[setId]||0)+1
+
+ if(donateArmorSets[setId] === 4){
+ this.donateItems.push({
+ sb_id: sb_id || "NA",
+ name: item.getName() || "",
+ lore: item.getLore() || [],
+ slot: slot
+ })
+ }
+
+ }
+ })
})
+ if(oldDonateItems !== JSON.stringify(this.donateItems)){
+ this.regenDonateItems()
+ }
if(!this.itemsInPages[page]) this.itemsInPages[page] = []
//10-16 43
let changed = false
- for(let i = 0;i<3;i++){
- for(let j = 10;j<16;j++){
+ for(let i = 0;i<4;i++){
+ for(let j = 10;j<17;j++){
let slot = i*9+j
let item = Player.getOpenedInventory().getStackInSlot(slot)
let sb_id = utils.getSBID(item)
- if(sb_id){
- if(!this.itemsInPages[page][pageNum]) this.itemsInPages[page][pageNum] = []
- if(!this.itemsInPages[page][pageNum][i]) this.itemsInPages[page][pageNum][i] = []
-
- let itemData = {
- sb_id: sb_id,
- name: item.getName(),
- lore: item.getLore()
- }
-
- if(JSON.stringify(this.itemsInPages[page][pageNum][i][j]) !== JSON.stringify(itemData)){
- this.itemsInPages[page][pageNum][i][j] = itemData
-
- changed = true
- }
+ if(!this.itemsInPages[page][currPage]) this.itemsInPages[page][currPage] = []
+
+ if(item && item.getID() !== -1){
+
+ let itemData = {
+ sb_id: "NA",
+ name: item.getName() || "",
+ lore: item.getLore() || []
+ }
+
+ if(sb_id){
+ itemData.sb_id = sb_id
+ }
+ if(!this.itemsInPages[page][currPage][slot] || this.itemsInPages[page][currPage][slot].sb_id !== itemData.sb_id){
+ this.itemsInPages[page][currPage][slot] = itemData
+
+ changed = true
+ }
}
}
}
- if(changed) this.regenItems()
+ if(changed || this.guiUpdated) this.regenItems(currPage)
}
+
+ if(Player.getOpenedInventory().getName() === "Confirm Donation"){
+ let this_confirm_temp_str = Player.getOpenedInventory().getStackInSlot(4).getName() +Player.getOpenedInventory().getStackInSlot(2).getName() + Player.getOpenedInventory().getStackInSlot(20).getName() + Player.getOpenedInventory().getStackInSlot(24).getName()//4, 24, 20
+ if(this.confirm_temp !== this_confirm_temp_str){
+ this.confirm_temp = this_confirm_temp_str
+
+ this.itemsBox.clearChildren()
+
+ let isArmour = utils.getSBID(Player.getOpenedInventory().getStackInSlot(4))===null
+ if(isArmour){
+ let name = Player.getOpenedInventory().getStackInSlot(2).getName()
+ let itemBox = new BoxWithText().setText(name.startsWith("§f")?"&7"+name.substr(2):name).setLocation(0.1,0.05,0.8,0.2).setLore(Player.getOpenedInventory().getStackInSlot(2).getLore())
+
+ this.itemsBox.addChild(itemBox)
+ }else{
+ let name = Player.getOpenedInventory().getStackInSlot(4).getName()
+ let itemBox = new BoxWithText().setText(name.startsWith("§f")?"&7"+name.substr(2):name).setLocation(0.1,0.05,0.8,0.2).setLore(Player.getOpenedInventory().getStackInSlot(4).getLore())
+
+ this.itemsBox.addChild(itemBox)
+ }
+
+ if(Player.getOpenedInventory().getStackInSlot(24).getID() !== -1 && Player.getOpenedInventory().getStackInSlot(20).getID() !== -1){
+
+ let cancelButton = new ButtonWithArrow().setText("§cCancel").setLocation(0.1,0.4,0.35,0.2).setDirectionRight(false).setLore(Player.getOpenedInventory().getStackInSlot(24).getLore())
+ cancelButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ Player.getOpenedInventory().click(24, false, "LEFT")
+ }))
+ this.itemsBox.addChild(cancelButton)
+
+ let confirmButton = new ButtonWithArrow().setText("§aConfirm Donation").setLocation(0.55,0.4,0.35,0.2).setLore(Player.getOpenedInventory().getStackInSlot(20).getLore())
+ confirmButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ Player.getOpenedInventory().click(20, false, "LEFT")
+ }))
+ this.itemsBox.addChild(confirmButton)
+ }
+ }
+ }
+
+ this.pageTitle.setText("§5"+Player.getOpenedInventory().getName())
+ this.guiUpdated = false
+ }
+
+ regenDonateItems(){
+ this.donateBox.clearChildren()
+ this.donateItems.forEach((item, i)=>{
+ let itemButton = new ButtonWithArrow().setText(item.name.startsWith("§f")?"&7"+item.name.substr(2):item.name).setLocation(0.1,0.05+0.125*i,0.8,0.1).setLore(item.lore)
+ itemButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ Player.getOpenedInventory().click(item.slot, false, "LEFT")
+ }))
+ this.donateBox.addChild(itemButton)
+ })
}
- regenItems(){
+ regenItems(page2){
this.itemsBox.clearChildren()
- let page = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())
+ let page = this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()]
- let y = 0.1
+ let y = 0.0325
let itemNum = 0
- let width = 2
- let widthPer = 0.9/(width+1)
+ let width = 3
+ let widthPer = 1/(width+1)
let offset = 0.0125
- this.itemsInPages[page].forEach(page=>{
- if(page === null) return
- page.forEach(row=>{
- if(row === null) return
- row.forEach(slot=>{
- if(slot === null) return
+ if(!this.itemsInPages[page][page2]) this.itemsInPages[page][page2] = []
- let child = new ButtonWithArrow().setText(slot.name.startsWith("§f")?"&7"+slot.name.substr(2):slot.name).setLore(slot.lore).setLocation(0.05+offset+widthPer*itemNum,y,widthPer*9/10,0.15)
- this.itemsBox.addChild(child)
+ this.itemsInPages[page][page2].forEach((slot, slotNum)=>{
+ if(!slot) return
- itemNum++
- if(itemNum>width){
- itemNum = 0
- y+=0.175
+ let child
+
+ if(slot.sb_id === "NA"){
+ child =new BoxWithText().setText(slot.name.startsWith("§f")?"&7"+slot.name.substr(2):slot.name).setLore(slot.lore)
+ if(slot.name.startsWith("§c")){
+ child.setColor(255, 100, 100)
+ child.setText("&0"+slot.name.substr(2))
+ }
+ if(slot.name.startsWith("§e")){
+ child.setColor(255, 255, 100)
+ child.setText("&0"+slot.name.substr(2))
+ }
+ }else{
+ child = new ButtonWithArrow().setText(slot.name.startsWith("§f")?"&7"+slot.name.substr(2):slot.name).setLore(slot.lore)
+ child.addEvent(new SoopyMouseClickEvent().setHandler((mouseX, mouseY, button)=>{
+ if(button === 2){ //middle click -> add item to favorites
+ this.addItemToFavorites(slot, page, page2, slotNum)
+ return
}
- })
- })
+ // Player.getOpenedInventory().click(slotNum, false,button===1?"RIGHT":"LEFT")
+ Player.getOpenedInventory().click(slotNum, false,"LEFT") //TODO: add right click support for viewing armour sets
+ }))
+ if(this.favoriteIds.includes(slot.sb_id)){
+ child.setColor(255, 255, 200)
+ }
+ }
+ child.setLocation(offset+widthPer*itemNum,y,widthPer*9/10,0.125)
+ this.itemsBox.addChild(child)
+
+ itemNum++
+ if(itemNum>width){
+ itemNum = 0
+ y+=0.135
+ }
+ })
+ }
+
+ addItemToFavorites(slot, page, page2, slotNum){
+ if(page === "Special Items"){
+ new Notification("§cError!", ["You cant add Special Items",["to favorites"]])
+ return
+ }
+ if(this.favoriteItems.map(a=>a.sb_id).includes(slot.sb_id)){
+ //remove from favorites
+ this.favoriteItems = this.favoriteItems.filter(a=>a.sb_id!==slot.sb_id)
+ this.favoriteIds = this.favoriteIds.filter(a=>a!==slot.sb_id)
+ this.regenItems(page2)
+ this.updatedFavorites()
+ return
+ }
+ let loreNew = []
+ slot.lore.forEach(a=>{
+ loreNew.push(a)
+ })
+ slot.lore = loreNew
+ slot.page = page //category eg: Weapons, armour sets ect
+ slot.page2 = page2 //pagenum of category
+ slot.slotNum = slotNum //slotnum
+ this.favoriteItems.push(slot)
+ this.favoriteIds.push(slot.sb_id)
+ this.regenItems(page2)
+ this.updatedFavorites()
+ }
+
+ updatedFavorites(saveToFile=true){
+ this.favoriteBox.clearChildren()
+
+ this.favoriteItems.forEach((fItem, i)=>{
+ let item = new ButtonWithArrow().setText(fItem.name.startsWith("§f")?"&7"+fItem.name.substr(2):fItem.name).setLocation(0.1,0.05+0.125*i,0.8,0.1).setLore(fItem.lore)
+
+ item.addEvent(new SoopyMouseClickEvent().setHandler((mouseX, mouseY, button)=>{
+ if(button === 2){ //middle click -> remove item from favorites (calling add will remove because it alr exists)
+ this.addItemToFavorites(fItem, fItem.page, fItem.page2, fItem.slotNum)
+ return
+ }
+ // Player.getOpenedInventory().click(item.slotNum, false,button===1?"RIGHT":"LEFT")
+
+ let currPage, pageNum
+ if(Player.getOpenedInventory().getName().includes("/")){
+ [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a))
+ }
+
+ if(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()]===fItem.page){
+ if(currPage === fItem.page2){
+ Player.getOpenedInventory().click(fItem.slotNum, false,"LEFT")
+ }else{
+ if(currPage < fItem.page2){
+ Player.getOpenedInventory().click(53, false,"MIDDLE")
+ }else{
+ Player.getOpenedInventory().click(45, false,"MIDDLE")
+ }
+ }
+ }else{
+ this.clickedTopButton(fItem.page)
+ }
+ })).addEvent(new SoopyRenderEvent().setHandler(()=>{
+ if(item.hovered){
+
+ item.setColorOffset(-20, -20, -20, 100)
+
+ Renderer.translate(0,0,100)
+ Renderer.drawRect(Renderer.color(0,0,0,100), item.location.getXExact(), item.location.getYExact(), item.location.getWidthExact(), item.location.getHeightExact())
+
+ let clicks = "?"
+ let currPage, pageNum
+ if(Player.getOpenedInventory().getName().includes("/")){
+ [currPage, pageNum] = Player.getOpenedInventory().getName().split(")")[0].split("(")[1].split("/").map(a=>parseInt(a))
+ }
+ let pageClicks = Math.abs(currPage-fItem.page2)
+ if(this.replacePage[Player.getOpenedInventory().getName().split("➜").pop()]===fItem.page){
+ clicks = (pageClicks+1) + ""
+ }else{
+ if(Player.getOpenedInventory().getName() === "Your Museum"){
+ clicks = (1+fItem.page2) + ""
+ }else{
+ clicks = (2+fItem.page2) + ""
+ }
+ }
+
+ Renderer.translate(0,0,100)
+ renderLibs.drawStringCenteredFull(clicks, item.location.getXExact()+item.location.getWidthExact()/2, item.location.getYExact()+item.location.getHeightExact()/2, Math.min(item.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, item.location.getHeightExact()/4/2))
+
+ }
+ }))
+
+ this.favoriteBox.addChild(item)
})
+
+ if(saveToFile){
+ new Thread(()=>{
+ FileLib.write("soopyAddonsData","museumFavoriteData.json", JSON.stringify(this.favoriteItems))
+ }).start()
+ }
}
guiOpened(event){
@@ -336,8 +658,20 @@ class MuseumGui {
return
}
if(this.soopyGui.ctGui.isOpen()){
- cancel(event)
- // this.soopyGui.ctGui.open()
+ if(event.gui && event.gui.field_147002_h){
+ Player.getPlayer().field_71070_bA = event.gui.field_147002_h
+
+ if(Player.getOpenedInventory().getName() === "Museum Rewards"){
+ return
+ }
+ if(Player.getOpenedInventory().getName().startsWith("Museum Browser")){
+ return
+ }
+
+ event.gui = this.soopyGui.ctGui
+ this.guiUpdated = true
+ this.soopyGui.ctGui.open()
+ }
return
}
if(this.isInMuseum){
@@ -380,6 +714,7 @@ class MuseumGui {
this.soopyGui.open()
this.guiOpenTickThing = true
+ this.tickMenu(true)
}
this.checkMenu = false
}
diff --git a/features/cosmetics/cosmetic.js b/features/cosmetics/cosmetic.js
index 4cf989f..997b219 100644
--- a/features/cosmetics/cosmetic.js
+++ b/features/cosmetics/cosmetic.js
@@ -12,6 +12,8 @@ class Cosmetic{
this.id = id
this.settings = this.parent.getPlayerCosmeticSettings(this.player, id)
+
+ this.onTick()
}
onRenderEntity(ticks, isInGui){
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js
index 88a91ea..2b09c2d 100644
--- a/features/globalSettings/index.js
+++ b/features/globalSettings/index.js
@@ -33,7 +33,7 @@ class Hud extends Feature {
this.findApiKey = new ButtonSetting("Attempt to load api key from other mods", "This will scan other mods configs to attempt to find your key", "find_key", this, "Click!", this.findKey, undefined)
- this.notifyNewVersion = new ToggleSetting("Notify when there is a new update", "Will notify you when there is a new version of soopyv2 avalible for download", false, "notify_update", this)
+ this.notifyNewVersion = new ToggleSetting("Notify when there is a new update", "Will notify you when there is a new version of soopyv2 avalible for download", true, "notify_update", this) //TODO: Make false by default when uploaded on ct website
this.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this)
@@ -49,16 +49,17 @@ class Hud extends Feature {
this.registerChat("&aYour new API key is &r&b${key}&r", this.newKey)
- this.registerEvent("worldLoad", this.worldLoad)
-
this.ranFirstLoadThing = false
- setTimeout(()=>{
- this.worldLoad.call(this)
- }, 1000)
+ if(!this.firstLoadPageData.shown){
+ while(!World || this.FeatureManager.finishedLoading){
+ Thread.sleep(100)
+ }
+ this.showFirstLoadPage.call(this)
+ }
}
- worldLoad(){
+ showFirstLoadPage(){
if(!this.ranFirstLoadThing && World && !this.firstLoadPageData.shown){
ChatLib.command("soopyv2 first_load_thing", true)
this.ranFirstLoadThing = true
diff --git a/features/spamHider/index.js b/features/spamHider/index.js
index c534dd3..c5ec5e3 100644
--- a/features/spamHider/index.js
+++ b/features/spamHider/index.js
@@ -33,6 +33,7 @@ class SpamHider extends Feature {
}
chatPlayerMessage(userandrank, message, e){
+ if(!this.FeatureManager.features["generalSettings"]) return
if(userandrank.includes(">")) return
if(message.length < 10) return //Short messages like 'LOL' are bound to get repeated
diff --git a/features/streamsGUI/index.js b/features/streamsGUI/index.js
index b62bdcd..f452806 100644
--- a/features/streamsGUI/index.js
+++ b/features/streamsGUI/index.js
@@ -79,7 +79,7 @@ class StreamPage extends GuiPage {
sidebar.addChild(new SoopyTextElement().setText("§0"+data.user_name).setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1))
- let title = new SoopyMarkdownElement().setText("§0"+data.title).setLocation(0.1, 0.15, 0.8, 0.1)
+ let title = new SoopyMarkdownElement().setText(data.title).setLocation(0.1, 0.15, 0.8, 0.1)
sidebar.addChild(title)
let image = new SoopyImageElement().setImage(data.image).setLocation(0.1, 0.15+title.getHeight(), 0.8, 0.4).loadHeightFromImage()