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() { function init_map_maps() {
for (const [terr,data] of Object.entries(terrdata)) { for (const [terr,data] of Object.entries(terrdata)) {
terrs.set(data.territory,data.location); terrs.set(data.territory,data.location);
claims.set(data.territory,data.guild); // claims.set(data.territory,data.guild);
if (!guilds.includes(data.guild)) { // if (!guilds.includes(data.guild)) {
guilds.push(data.guild); // guilds.push(data.guild);
} // }
neighbors.set(data.territory,data.neighbors); 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}); 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 * TESTING SECTION
@ -116,7 +111,7 @@ function init_map(){ //async just in case we need async stuff
map_elem.style.background = "#121516"; map_elem.style.background = "#121516";
try { try {
//refreshData(); refreshData();
pullguilds(); pullguilds();
//save_map_data(); //save_map_data();
} catch (error) { } catch (error) {
@ -204,8 +199,9 @@ function toggleButton(elemID) {
* *
*/ */
async function refreshData() { async function refreshData() {
terrs = new Map(); //terrs = new Map();
claims = new Map(); claims = new Map();
terrdata;
guilds = []; guilds = [];
@ -214,7 +210,6 @@ async function refreshData() {
.then(data => {return data.json()}) .then(data => {return data.json()})
.then(res => { //success .then(res => { //success
terrdata = Object.entries(res['territories']); terrdata = Object.entries(res['territories']);
console.log(terrdata);
guilds = []; guilds = [];
for (const terr of terrdata) { for (const terr of terrdata) {
//terrs.set(terr[0], terr[1].location) //bounds shouldnt change //terrs.set(terr[0], terr[1].location) //bounds shouldnt change