diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-12-14 15:07:28 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-12-14 15:07:28 +0800 |
commit | d7c90e5a10ec1518974cdb1ee85506c28d31b2a1 (patch) | |
tree | 070b7d1c63740c71455bf98f8d89f4f0970d4119 | |
parent | 35b89852096c48945e55e9d550a417a963a9ad74 (diff) | |
download | SoopyV2-d7c90e5a10ec1518974cdb1ee85506c28d31b2a1.tar.gz SoopyV2-d7c90e5a10ec1518974cdb1ee85506c28d31b2a1.tar.bz2 SoopyV2-d7c90e5a10ec1518974cdb1ee85506c28d31b2a1.zip |
dropdown setting + stat next to name choose stat type + dragon wings fix
-rw-r--r-- | features/cosmetics/cosmetic/dragon/dragonWings.js | 20 | ||||
-rw-r--r-- | features/settings/settingThings/dropdownSetting.js | 32 | ||||
-rw-r--r-- | features/stat_next_to_name/index.js | 24 |
3 files changed, 63 insertions, 13 deletions
diff --git a/features/cosmetics/cosmetic/dragon/dragonWings.js b/features/cosmetics/cosmetic/dragon/dragonWings.js index d387672..52b1d0f 100644 --- a/features/cosmetics/cosmetic/dragon/dragonWings.js +++ b/features/cosmetics/cosmetic/dragon/dragonWings.js @@ -25,6 +25,8 @@ class DragonWings extends Cosmetic { this.lastFlapSound = this.animOffset this.i = 0 + + this.flying = false } onRenderEntity(ticks, isInGui){ @@ -70,7 +72,7 @@ class DragonWings extends Cosmetic { // if((this.player === Player &&this.player.getPlayer().field_71075_bZ.field_75100_b) || (this.player !== Player && Math.abs(verticleSpeed)<0.2 && !this.player.getPlayer().field_70122_E)){//playerCapabilities.isFlying - if((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity] && !isInGui){ //flying + if(this.flying){ //flying this.animOffset += 5*timeSince //flap in mid air flapAmountMultiplyer *= 1.75 //flap harder @@ -152,7 +154,7 @@ class DragonWings extends Cosmetic { let changeStandingStillWingThing = 0 if(horisontalSpeed < 0.01){ - if(!((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity])){ //not flying + if(!(this.flying)){ //not flying let amt = (this.animOffset+Math.PI/2)%(20*Math.PI) if(amt < 1*Math.PI){ this.animOffset += 2*timeSince*Math.min(1,(amt/(1*Math.PI))*2) @@ -305,7 +307,7 @@ class DragonWings extends Cosmetic { // if((this.player === Player &&this.player.getPlayer().field_71075_bZ.field_75100_b) || (this.player !== Player && Math.abs(verticleSpeed)<0.2 && !this.player.getPlayer().field_70122_E)){//playerCapabilities.isFlying - if((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity]){ //flying + if(this.flying){ //flying if(this.animOffset-this.lastFlapSound > 2*Math.PI){ @@ -317,7 +319,7 @@ class DragonWings extends Cosmetic { } if(horisontalSpeed < 0.01){ - if(!((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity])){ //not flying + if(!(this.flying)){ //not flying let amt = (this.animOffset+Math.PI/2)%(20*Math.PI) if(amt < 1*Math.PI){ if(amt > 0.65*Math.PI && (2*Math.PI+this.animOffset)-this.lastFlapSound > 2*Math.PI){ @@ -333,6 +335,7 @@ class DragonWings extends Cosmetic { } onTick(){ + this.updateIfNotRendering() this.testPlaySound() @@ -360,6 +363,10 @@ class DragonWings extends Cosmetic { } updateIfNotRendering(){ + let verticleSpeed = this.player.getPlayer()[f.posY.Entity]-this.player.getPlayer()[f.lastTickPosY] + + this.flying = (verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity] + let timeSince = (Date.now()-this.lastRender)/1000 if(timeSince < 0.020){ @@ -370,7 +377,6 @@ class DragonWings extends Cosmetic { let horisontalSpeed = Math.sqrt((this.player.getPlayer()[f.posX.Entity]-this.player.getPlayer()[f.lastTickPosX])**2+(this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ])**2) - let verticleSpeed = this.player.getPlayer()[f.posY.Entity]-this.player.getPlayer()[f.lastTickPosY] this.animOffset += Math.min(1, horisontalSpeed)*10*timeSince+1*timeSince @@ -380,7 +386,7 @@ class DragonWings extends Cosmetic { // if((this.player === Player &&this.player.getPlayer().field_71075_bZ.field_75100_b) || (this.player !== Player && Math.abs(verticleSpeed)<0.2 && !this.player.getPlayer().field_70122_E)){//playerCapabilities.isFlying - if((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround]){ //flying + if(this.flying){ //flying this.animOffset += 5*timeSince //flap in mid air if(verticleSpeed > 0){ @@ -392,7 +398,7 @@ class DragonWings extends Cosmetic { } if(horisontalSpeed < 0.01){ - if(!((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround])){ //not flying + if(!(this.flying)){ //not flying let amt = (this.animOffset+Math.PI/2)%(20*Math.PI) if(amt < 1*Math.PI){ this.animOffset += 2*timeSince*Math.min(1,(amt/(1*Math.PI))*2) diff --git a/features/settings/settingThings/dropdownSetting.js b/features/settings/settingThings/dropdownSetting.js new file mode 100644 index 0000000..6681d68 --- /dev/null +++ b/features/settings/settingThings/dropdownSetting.js @@ -0,0 +1,32 @@ + +import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent"; +import SettingBase from "./settingBase"; +import Dropdown from "../../../../guimanager/GuiElement/Dropdown"; + +class DropdownSetting extends SettingBase { + constructor(name, description, defaultVal, settingId, module, optionsData){ + super(name, description, defaultVal, settingId, module) + + this.dropdownObject = new Dropdown().setLocation(0, 0.2, 0.9, 0.6).setOptions(optionsData).setSelectedOption(this.getValue()) + this.settingObject.addChild(this.dropdownObject) + + this.settingObject.setLocation(0.6, 0, 0.4, 1) + this.guiObject.text.setLocation(0, 0, 0.6, 0.6) + this.guiObject.description.setLocation(0, 0.6, 0.55, 0.4) + + this.dropdownObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ + this.setValue(newVal) + })) + + } + + setValue(newVal){ + super.setValue(newVal) + + this.dropdownObject.setSelectedOption(newVal) + + return this + } +} + +export default DropdownSetting
\ No newline at end of file diff --git a/features/stat_next_to_name/index.js b/features/stat_next_to_name/index.js index 586c4ba..1c1b2ab 100644 --- a/features/stat_next_to_name/index.js +++ b/features/stat_next_to_name/index.js @@ -4,6 +4,7 @@ import Feature from "../../featureClass/class"; import soopyV2Server from "../../socketConnection"; import SettingBase from "../settings/settingThings/settingBase"; import * as numberUtils from "../../utils/numberUtils"; +import DropdownSetting from "../settings/settingThings/dropdownSetting"; class StatNextToName extends Feature { constructor() { @@ -11,15 +12,25 @@ class StatNextToName extends Feature { } onEnable(){ - new SettingBase("(ONLY WEIGHT ATM) NOTE: A pink star thing (&d⚝§0)", "Means that player is also using SoopyV2", true, "stat_next_to_name_description", this) + new SettingBase("NOTE: A pink star thing (&d⚝§0)", "Means that player is also using SoopyV2", true, "stat_next_to_name_description", this) + this.statToShow = new DropdownSetting("Stat to show", "", "weight", "stat_selected_nexttoname", this, { + "weight": "Weight", + "catacombsLevel": "Catacombs Level", + "skillAvg": "Skill Average", + "totalSlayer": "Total Slayer Exp" + }) + + this.decimals = { + "weight": 0, + "catacombsLevel": 2, + "skillAvg": 2, + "totalSlayer": 0 + } this.userStats = {} this.loadingStats = [] - this.statsThing = "weight" - this.decimalPlaces = 0 - soopyV2Server.onPlayerStatsLoaded = (stats)=>{this.playerStatsLoaded.call(this, stats)} this.registerStep(false, 5, this.loadPlayerStatsTick) @@ -66,8 +77,8 @@ class StatNextToName extends Feature { nameTagString += " &2[" if(stats.usingSoopyv2) nameTagString += "&d⚝&2" - if(stats.exists && stats[this.statsThing]){ - nameTagString += numberUtils.numberWithCommas(stats[this.statsThing].toFixed(this.decimalPlaces)) + if(stats.exists && stats[this.statToShow.getValue()]){ + nameTagString += numberUtils.numberWithCommas(stats[this.statToShow.getValue()].toFixed(this.decimals[this.statToShow.getValue()])) }else{ nameTagString += "?" } @@ -84,6 +95,7 @@ class StatNextToName extends Feature { playerStatsLoaded(stats){ // console.log(JSON.stringify(stats, undefined, 2)) this.userStats[stats.uuid] = stats + } onDisable(){ |