Improve hero village detection
This commit is contained in:
		| @@ -4,6 +4,7 @@ import { Task } from '../Queue/TaskQueue'; | ||||
| import { grabVillageList } from '../Page/VillageBlock'; | ||||
| import { grabHeroVillage } from '../Page/HeroPage'; | ||||
| import { path } from '../utils'; | ||||
| import { HeroState } from '../State/HeroState'; | ||||
|  | ||||
| @registerAction | ||||
| export class GoToHeroVillageAction extends ActionController { | ||||
| @@ -24,6 +25,6 @@ export class GoToHeroVillageAction extends ActionController { | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return undefined; | ||||
|         return new HeroState().getVillageId(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user