diff options
-rw-r--r-- | features/dungeonMap/index.js | 4 | ||||
-rw-r--r-- | features/dungeonMap/metadata.json | 2 | ||||
-rw-r--r-- | features/dungeonSolvers/index.js | 24 | ||||
-rw-r--r-- | features/fragBot/index.js | 7 | ||||
-rw-r--r-- | features/spamHider/index.js | 81 | ||||
-rw-r--r-- | metadata.json | 4 | ||||
-rw-r--r-- | socketConnection.js | 22 |
7 files changed, 106 insertions, 38 deletions
diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js index 7261c60..317d416 100644 --- a/features/dungeonMap/index.js +++ b/features/dungeonMap/index.js @@ -29,7 +29,7 @@ class DungeonMap extends Feature { onEnable(){ this.initVariables() - this.renderMap = new ToggleSetting("Render Map", "Toggles Rendering the map on the hud (scuffed)", false, "dmap_render", this) + this.renderMap = new ToggleSetting("Render Map", "Toggles Rendering the map on the hud", false, "dmap_render", this) this.mapLocation = new ImageLocationSetting("Map Location", "Sets the location of the map on the hud","dmap_location", this, [10,10, 1], new Image(javax.imageio.ImageIO.read(new java.io.File("./config/ChatTriggers/modules/SoopyV2/features/dungeonMap/map.png"))),100,100) this.mapBackground = new ToggleSetting("Map Background", "Puts a white background begind the map", false, "dmap_background", this) this.brBox = new ToggleSetting("Box around doors in br", "In map category because it uses map to find location (no esp)", true, "dmap_door", this) @@ -328,6 +328,7 @@ class DungeonMap extends Feature { } updateMapImage(){ + try{ World.getAllPlayers().forEach(player=>{ if(player.getPing()===-1)return if(!this.people.includes(player.getName())) return @@ -339,6 +340,7 @@ class DungeonMap extends Feature { uuid: player.getUUID().toString() } }) + }catch(_){}//cocurrent modification if(!this.mortLocation){ try{ World.getAllEntities().forEach(entity=>{ diff --git a/features/dungeonMap/metadata.json b/features/dungeonMap/metadata.json index 077f588..beef50e 100644 --- a/features/dungeonMap/metadata.json +++ b/features/dungeonMap/metadata.json @@ -1,6 +1,6 @@ { "name": "Dungeon Map", - "description": "A really good dungeon map (IN PROGRESS)", + "description": "Cool dungeon map and related features", "isHidden": false, "isTogglable": true, "defaultEnabled": false, diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js index 0ac2018..be06af9 100644 --- a/features/dungeonSolvers/index.js +++ b/features/dungeonSolvers/index.js @@ -53,6 +53,10 @@ class DungeonSolvers extends Feature { this.spiritBowDestroyTimer = new ToggleSetting("Timer for when the spirit bow will self destruct", "", true, "spirit_bow_destroy_timer", this); this.spiritBowDestroyElement = new HudTextElement().setToggleSetting(this.spiritBowDestroyTimer).setLocationSetting(new LocationSetting("Spirit bow destroy timer location", "Allows you to edit the location of the timer", "spirit_destroy_location", this, [10, 70, 3, 1]).requires(this.spiritBowDestroyTimer).editTempText("&dBow Destroyed in: &c15s")); + this.spiritBearSpawnTimer = new ToggleSetting("Timer for when the spirit bear will spawn", "", true, "spirit_bear_spawn_timer", this); + this.spiritBearSpawnElement = new HudTextElement().setToggleSetting(this.spiritBearSpawnTimer).setLocationSetting(new LocationSetting("Spirit bear spawn timer location", "Allows you to edit the location of the timer", "spirit_bear_spawn_location", this, [10, 70, 3, 1]).requires(this.spiritBearSpawnTimer).editTempText("&dBear spawned in: &c1.57s")); + + this.hudElements.push(this.spiritBearSpawnElement); this.hudElements.push(this.spiritBowDestroyElement); this.bloodCampAssist = new ToggleSetting("Assist blood camp", "Helps guess where and when blood mobs will spawn", true, "blood_camp_assist", this); @@ -101,6 +105,12 @@ class DungeonSolvers extends Feature { this.spiritBowPickUps.push(Date.now()); }); + + this.bearSpawning = 0 + this.registerChat("&r&a&lThe &r&5&lSpirit Bow &r&a&lhas dropped!&r", ()=>{ + this.bearSpawning = -Date.now() + }) + this.todoE = []; this.eMovingThing = {}; this.bloodX = -1; @@ -227,6 +237,12 @@ class DungeonSolvers extends Feature { } renderHud() { + if(this.bearSpawning && this.bearSpawning > 0){ + this.spiritBearSpawnElement.setText("&dBear spawned in: &c" + (Math.max(0,this.bearSpawning-Date.now())/1000).toFixed(2) + "s") + }else{ + this.spiritBearSpawnElement.setText("") + } + for (let element of this.hudElements) { element.render(); } @@ -378,6 +394,14 @@ class DungeonSolvers extends Feature { // return !e.getEntity()[f.isDead] // }) + + if(this.spiritBearSpawnTimer.getValue() && (this.FeatureManager.features["dataLoader"].class.dungeonFloor === "F4" || this.FeatureManager.features["dataLoader"].class.dungeonFloor === "M4")){ + let id = World.getBlockAt(7, 77, 34).type.getID() + + if((!this.bearSpawning || (this.bearSpawning<0 && this.bearSpawning>-Date.now()+500)) && id === 169){ + this.bearSpawning = Date.now()+3500 + } + } } addSkull(skull) { diff --git a/features/fragBot/index.js b/features/fragBot/index.js index c2d2d19..5662111 100644 --- a/features/fragBot/index.js +++ b/features/fragBot/index.js @@ -26,9 +26,9 @@ class FragBot extends Feature { this.registerStep(false, 5, this.step) this.registerStep(true, 2, this.step2) - this.registerChat("&9&m-----------------------------&r&9\n&r${player} &r&ehas invited you to join their party!\n&r&eYou have &r&c60 &r&eseconds to accept. &r&6Click here to join!&r&9\n&r&9&m-----------------------------&r", this.recievedPartyInvite) + this.registerChat("&9&m---------------------------${*}&r&9\n&r${player} &r&ehas invited you to join their party!\n&r&eYou have &r&c60 &r&eseconds to accept. &r&6Click here to join!&r&9\n&r&9&m----------------------------${*}&r", this.recievedPartyInvite) } - + step(){ if(!this.hostingFragBot) return @@ -52,8 +52,7 @@ class FragBot extends Feature { } } recievedPartyInvite(player){ - if(!this.hostingFragBot) return - + if(!this.hostingFragBot) return player = ChatLib.removeFormatting(player).split(" ").pop() this.fragBotQueue.push(player) diff --git a/features/spamHider/index.js b/features/spamHider/index.js index 0215896..1163116 100644 --- a/features/spamHider/index.js +++ b/features/spamHider/index.js @@ -18,6 +18,13 @@ class SpamHider extends Feature { this.moveMessages = [] this.moveMessagesRexex = [] + this.moveMessagesDict = { + all: [] + } + this.hideMessagesDict = { + all: [] + } + this.hideMessagesSetting = new ToggleSetting("Hide some messages", "This will completely remove some spammy messages from chat", true, "completely_hide_spam", this) this.moveMessagesSetting = new ToggleSetting("Move some messages to spam hider", "This will move some (potentially) usefull messages into a 'second chat'", true, "move_spam", this) this.moveChatMessages = new ToggleSetting("Move spammed chat messages to spam hider", "This will move messages spammed in hubs to spam hider\n(eg the website advertisment bots)", true, "move_spam_chat", this) @@ -34,34 +41,42 @@ class SpamHider extends Feature { this.registerEvent("renderOverlay", this.renderOverlay) - this.registerChat("&r${userandrank}&r&f: ${message}&r", this.chatPlayerMessage) + // this.registerChat("&r${userandrank}&r&f: ${message}&r", this.chatPlayerMessage) } - 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 + // 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 - let msg = sha256(message + "This is a salt PogU") + // let msg = sha256(message + "This is a salt PogU") - if(soopyV2Server.spammedMessages.includes(msg)){ - if(this.moveChatMessages.getValue()){ - this.SpamHiderMessagesRenderer.addMessage(ChatLib.getChatMessage(e, true)) - cancel(e) - } - return - } + // if(soopyV2Server.spammedMessages.includes(msg)){ + // if(this.moveChatMessages.getValue()){ + // this.SpamHiderMessagesRenderer.addMessage(ChatLib.getChatMessage(e, true)) + // cancel(e) + // } + // return + // } - if(this.FeatureManager.features["generalSettings"].class.sendChatSetting && this.FeatureManager.features["generalSettings"].class.sendChatSetting.getValue()){ - soopyV2Server.sendMessageToServer(msg, sha256(this.FeatureManager.features["dataLoader"].class.stats["Server"] + "This is a salt PogU")) - } - } + // if(this.FeatureManager.features["generalSettings"].class.sendChatSetting && this.FeatureManager.features["generalSettings"].class.sendChatSetting.getValue()){ + // soopyV2Server.sendMessageToServer(msg, sha256(this.FeatureManager.features["dataLoader"].class.stats["Server"] + "This is a salt PogU")) + // } + // } onChat(e){ let msg = ChatLib.getChatMessage(e, true).replace(/ยง/g, "&").replace(/(?:^&r)|(?:&r$)/g, "") + if(msg.length > 1000) return //performance if(this.hideMessagesSetting.getValue()){ - this.hideMessagesRexex.forEach(regex => { + // console.log("testing " + (this.hideMessagesDict[msg.substring(0,5)]?.length || 0) + this.hideMessagesDict.all.length + " hide messages") + this.hideMessagesDict[msg.substring(0,5)]?.forEach(regex => { + if(regex.test(msg)){ + cancel(e) + return + } + }) + this.hideMessagesDict.all.forEach(regex => { if(regex.test(msg)){ cancel(e) return @@ -70,7 +85,15 @@ class SpamHider extends Feature { } if(this.moveMessagesSetting.getValue()){ - this.moveMessagesRexex.forEach(regex => { + // console.log("testing " + (this.moveMessagesDict[msg.substring(0,5)]?.length || 0) + this.moveMessagesDict.all.length + " spam messages") + this.moveMessagesDict[msg.substring(0,5)]?.forEach(regex => { + if(regex.test(msg)){ + this.SpamHiderMessagesRenderer.addMessage(msg) + cancel(e) + return + } + }) + this.moveMessagesDict.all.forEach(regex => { if(regex.test(msg)){ this.SpamHiderMessagesRenderer.addMessage(msg) cancel(e) @@ -88,18 +111,38 @@ class SpamHider extends Feature { this.hideMessages = messages.hideMessages this.moveMessages = messages.moveMessages + this.hideMessagesDict = { + all: [] + } + this.hideMessagesRexex = [] this.hideMessages.forEach(message=>{ let regex = new RegExp(message.replace(/[\\^$*+?.()|[\]{}]/g, '$&') .replace(/\$\{\*\}/g, "(?:.+)")) + if(!message.substring(0,5).includes("$")){ + if(!this.hideMessagesDict[message.substring(0,5)]) this.hideMessagesDict[message.substring(0,5)] = [] + this.hideMessagesDict[message.substring(0,5)].push(regex) + }else{ + this.hideMessagesDict.all.push(regex) + } this.hideMessagesRexex.push(regex) }) + this.moveMessagesDict = { + all: [] + } + this.moveMessagesRexex = [] this.moveMessages.forEach(message=>{ let regex = new RegExp(message.replace(/[\\^$*+?.()|[\]{}]/g, '$&') .replace(/\$\{\*\}/g, "(?:.+)")) + if(!message.substring(0,5).includes("$")){ + if(!this.moveMessagesDict[message.substring(0,5)]) this.moveMessagesDict[message.substring(0,5)] = [] + this.moveMessagesDict[message.substring(0,5)].push(regex) + }else{ + this.moveMessagesDict.all.push(regex) + } this.moveMessagesRexex.push(regex) }) } diff --git a/metadata.json b/metadata.json index 91f211c..711ce97 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "Soopy addons v2", "name": "SoopyV2", - "version": "2.1.36", - "versionId": 163, + "version": "2.1.37", + "versionId": 164, "requires": [ "soopyApis", "soopyAddonsData", diff --git a/socketConnection.js b/socketConnection.js index 4e3fbda..27eafc0 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -7,7 +7,7 @@ class SoopyV2Server extends WebsiteCommunicator { constructor(){ super(socketData.serverNameToId.soopyv2) - this.spammedMessages = [] + // this.spammedMessages = [] this.errorsToReport = [] @@ -29,9 +29,9 @@ class SoopyV2Server extends WebsiteCommunicator { if(data.type === "updateCosmetics"){ if(global.soopyv2featuremanagerthing.features.cosmetics)global.soopyv2featuremanagerthing.features.cosmetics.class.setUserCosmeticsInformation(data.uuid, data.cosmetics) } - if(data.type === "spammedmessage"){ - this.spammedMessages.push(...data.messages) - } + // if(data.type === "spammedmessage"){ + // this.spammedMessages.push(...data.messages) + // } if(data.type === "playerStatsQuick"){ if(this.onPlayerStatsLoaded) this.onPlayerStatsLoaded(data.data) } @@ -70,13 +70,13 @@ class SoopyV2Server extends WebsiteCommunicator { }) } - sendMessageToServer(message, lobbyId){ - this.sendData({ - type: "chatMessage", - message: message, - lobbyId: lobbyId - }) - } + // sendMessageToServer(message, lobbyId){ + // this.sendData({ + // type: "chatMessage", + // message: message, + // lobbyId: lobbyId + // }) + // } reportError(error, description){ // ChatLib.chat(JSON.stringify(error)) |