|
|
|
@@ -77,31 +77,16 @@ function renderTime(time) { |
|
|
|
return hours + ":" + minutes + ":" + seconds + " " + ampm; |
|
|
|
} |
|
|
|
|
|
|
|
function updateWorldInfo(state) { |
|
|
|
Object.entries(state.info).forEach(([key, val]) => { |
|
|
|
|
|
|
|
if (val.type == "meter") { |
|
|
|
const field = document.querySelector("#world-info-" + key + " > .stat-bar"); |
|
|
|
field.style.width = (val.value / val.max * 100) + "%"; |
|
|
|
} else if (val.type == "counter") { |
|
|
|
const field = document.querySelector("#world-info-" + key); |
|
|
|
field.innerText = val.name + ": " + val.render; |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function updatePlayerInfo(state) { |
|
|
|
Object.entries(state.player.stats).forEach(([key, val]) => { |
|
|
|
function updateStatDisplay(stats, statType) { |
|
|
|
Object.entries(stats).forEach(([key, val]) => { |
|
|
|
|
|
|
|
if (val.type == "meter") { |
|
|
|
const field = document.querySelector("#player-info-" + key + " > .stat-bar"); |
|
|
|
const field = document.querySelector("#" + statType + "-info-" + key + " > .stat-bar"); |
|
|
|
field.style.width = (val.value / val.max * 100) + "%"; |
|
|
|
} else if (val.type == "counter") { |
|
|
|
const field = document.querySelector("#player-info-" + key); |
|
|
|
field.innerText = val.name + ": " + val.value; |
|
|
|
const field = document.querySelector("#" + statType + "-info-" + key); |
|
|
|
field.innerText = val.name + ": " + (val.render !== undefined ? val.render : val.value); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|