Improve hero village detection

This commit is contained in:
2020-04-25 21:19:45 +03:00
parent 3f4534a72e
commit 2137e7e684
3 changed files with 15 additions and 4 deletions

View File

@ -53,9 +53,10 @@ function heroResourceTypeToNumber(type: HeroResourceType): number {
}
export function grabHeroVillage(): string | undefined {
const status = jQuery('.heroStatusMessage').text();
const hrefText = jQuery('.heroStatusMessage a').text();
if (status.toLowerCase().includes('в родной деревне')) {
const statusSpan = jQuery('.heroStatusMessage span:not(.titleExtra)');
const statusText = statusSpan.text();
const hrefText = statusSpan.find('a').text();
if (statusText.toLowerCase().includes('в родной деревне')) {
return hrefText || undefined;
} else {
return undefined;