This repository has been archived on 2023-01-26. You can view files and clone it, but cannot push or open issues or pull requests.
scripts-old/src/utils/tribalwars.js

43 lines
827 B
JavaScript

export const buildTribeURL = id => {
return (
window.location.origin +
TribalWars.buildURL('', {
screen: 'info_ally',
id,
})
);
};
export const buildPlayerURL = id => {
return (
window.location.origin +
TribalWars.buildURL('', {
screen: 'info_player',
id,
})
);
};
export const buildVillageURL = id => {
return (
window.location.origin +
TribalWars.buildURL('', {
screen: 'info_village',
id,
})
);
};
export const buildVillageName = (n = '', x = 500, y = 500) => {
const continent = 'K' + String(y)[0] + String(x)[0];
return `${n} (${x}|${y}) ${continent}`;
};
export const calcAttackDuration = (distance, baseSpeed) => {
return Math.round(distance * baseSpeed);
};
export const buildImgURL = img => {
return image_base + img;
};