aboutsummaryrefslogtreecommitdiff
path: root/features/dungeonMap
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-04-09 19:44:09 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-04-09 19:44:09 +0800
commit2d85abb385e277ae41953121b1de587ea1635bb6 (patch)
treeed820ce6c3c2d13c4596473a8e2c1dc2ef07d212 /features/dungeonMap
parent46c2fd28691f3be2207445b44ff6d839ba9d17c6 (diff)
downloadSoopyV2-2d85abb385e277ae41953121b1de587ea1635bb6.tar.gz
SoopyV2-2d85abb385e277ae41953121b1de587ea1635bb6.tar.bz2
SoopyV2-2d85abb385e277ae41953121b1de587ea1635bb6.zip
make dungeon map skull images update if the player changes their skin
Diffstat (limited to 'features/dungeonMap')
-rw-r--r--features/dungeonMap/index.js18
1 files changed, 3 insertions, 15 deletions
diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js
index 0098cd1..a76f665 100644
--- a/features/dungeonMap/index.js
+++ b/features/dungeonMap/index.js
@@ -41,8 +41,7 @@ class DungeonMap extends Feature {
this.MAP_QUALITY_SCALE = 2
this.IMAGE_SIZE = 128*this.MAP_QUALITY_SCALE
- this.defaultPlayerImage = new Image("skull-steve","https://cravatar.eu/avatar/dc8c39647b294e03ae9ed13ebd65dd29")
- this.playerImages = {}
+ this.defaultPlayerImage = renderLibs.getImage("https://crafatar.com/avatars/dc8c39647b294e03ae9ed13ebd65dd29?size=8", true)
this.mapDataPlayers = {}
this.offset = []
this.people = []
@@ -152,7 +151,6 @@ class DungeonMap extends Feature {
worldLoad(){
this.mortLocation = undefined
- // this.playerImages = {}
this.mapDataPlayers = {}
this.offset = []
this.mapScale = 1
@@ -653,23 +651,13 @@ class DungeonMap extends Feature {
}
getImageForPlayer(uuid){
- if(!this.playerImages) return this.defaultPlayerImage
- uuid = uuid.replace(/-/g, "")
- if(this.playerImages[uuid] === "Loading") return this.defaultPlayerImage
- if(this.playerImages[uuid]) return this.playerImages[uuid]
-
- this.playerImages[uuid]= "Loading"
- new Thread(()=>{
- this.playerImages[uuid] = new Image("skull-" + uuid+"-v2","https://crafatar.com/avatars/" + uuid+"?size=8")
- }).start()
- return this.defaultPlayerImage
+ return renderLibs.getImage("https://crafatar.com/avatars/" + uuid.replace(/-/g, "")+"?size=8") || this.defaultPlayerImage
}
initVariables(){
this.mapImage = undefined
this.defaultPlayerImage = undefined
this.mortLocation = undefined
- this.playerImages = undefined
this.offset = undefined
this.puzzles = undefined
this.puzzlesTab = undefined
@@ -747,7 +735,7 @@ class SpiritLeapOverlay {
this.items = itemsNew
this.buttonsContainer.clearChildren()
- Object.keys(this.items).forEach((name, i)=>{ //TODO: make the button to leap to the last person to open a door a diff color AND MAKE IT UPDATE LIVE
+ Object.keys(this.items).forEach((name, i)=>{
let button = new ButtonWithArrow().setText((ChatLib.removeFormatting(name)===this.parent.lastDoorOpener?"&4":"&2")+"["+this.players[ChatLib.removeFormatting(name)]+"] "+ChatLib.removeFormatting(name)).addEvent(new SoopyMouseClickEvent().setHandler(()=>{
Player.getOpenedInventory().click(itemsNew[name])
ChatLib.chat("Leaping to " + name)