fixed map guild claims not updating

This commit is contained in:
ferricles 2021-04-12 15:32:50 -07:00
parent aa0d3f0a70
commit 443b4cd79d
2 changed files with 7 additions and 12 deletions

View file

@ -190,10 +190,10 @@ function save_map_data() {
function init_map_maps() {
for (const [terr,data] of Object.entries(terrdata)) {
terrs.set(data.territory,data.location);
claims.set(data.territory,data.guild);
if (!guilds.includes(data.guild)) {
guilds.push(data.guild);
}
// claims.set(data.territory,data.guild);
// if (!guilds.includes(data.guild)) {
// guilds.push(data.guild);
// }
neighbors.set(data.territory,data.neighbors);
resources.set(data.territory,{"resources":data.resources,"storage":data.storage,"emeralds":data.emeralds,"doubleemeralds":data.doubleemeralds,"doubleresource":data.doubleresource});
}

11
map.js
View file

@ -1,8 +1,3 @@
/**TODO:
* Fix Claims (broken)
* Guild pull fails to update actual guilds on the map, which also do not save properly.
* Fix custom items saving reversed IDs in the wrong order.
*/
/*
* TESTING SECTION
@ -116,7 +111,7 @@ function init_map(){ //async just in case we need async stuff
map_elem.style.background = "#121516";
try {
//refreshData();
refreshData();
pullguilds();
//save_map_data();
} catch (error) {
@ -204,8 +199,9 @@ function toggleButton(elemID) {
*
*/
async function refreshData() {
terrs = new Map();
//terrs = new Map();
claims = new Map();
terrdata;
guilds = [];
@ -214,7 +210,6 @@ async function refreshData() {
.then(data => {return data.json()})
.then(res => { //success
terrdata = Object.entries(res['territories']);
console.log(terrdata);
guilds = [];
for (const terr of terrdata) {
//terrs.set(terr[0], terr[1].location) //bounds shouldnt change