Display adventure difficulty
This commit is contained in:
parent
7d477ba35a
commit
251a616fa4
@ -14,7 +14,7 @@ import DashboardApp from './Dashboard/Dashboard.vue';
|
|||||||
import { createStore } from './Dashboard/Store';
|
import { createStore } from './Dashboard/Store';
|
||||||
import { ConsoleLogger, Logger } from './Logger';
|
import { ConsoleLogger, Logger } from './Logger';
|
||||||
import { DataStorage } from './Storage/DataStorage';
|
import { DataStorage } from './Storage/DataStorage';
|
||||||
import { getBuildingPageAttributes, isBuildingPage } from './Page/PageDetector';
|
import { getBuildingPageAttributes, isAdventurePage, isBuildingPage } from './Page/PageDetector';
|
||||||
import { ExecutionStorage } from './Storage/ExecutionStorage';
|
import { ExecutionStorage } from './Storage/ExecutionStorage';
|
||||||
import { VillageState } from './Village/VillageState';
|
import { VillageState } from './Village/VillageState';
|
||||||
import { VillageFactory } from './Village/VillageFactory';
|
import { VillageFactory } from './Village/VillageFactory';
|
||||||
@ -25,6 +25,7 @@ import { Action } from './Queue/Action';
|
|||||||
import { Task } from './Queue/Task';
|
import { Task } from './Queue/Task';
|
||||||
import { HeroAttributes } from './Core/Hero';
|
import { HeroAttributes } from './Core/Hero';
|
||||||
import { HeroStorage } from './Storage/HeroStorage';
|
import { HeroStorage } from './Storage/HeroStorage';
|
||||||
|
import { showAdventureDifficulty } from './Page/AdventurePage';
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
|
|
||||||
@ -148,6 +149,10 @@ export class ControlPanel {
|
|||||||
buildPage.run();
|
buildPage.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isAdventurePage()) {
|
||||||
|
showAdventureDifficulty();
|
||||||
|
}
|
||||||
|
|
||||||
this.createControlPanel(state, villageFactory);
|
this.createControlPanel(state, villageFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
src/Page/AdventurePage.ts
Normal file
11
src/Page/AdventurePage.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { getNumber, trimPrefix } from '../Helpers/Convert';
|
||||||
|
|
||||||
|
export function showAdventureDifficulty() {
|
||||||
|
jQuery('td.difficulty').each((index, el) => {
|
||||||
|
const $el = jQuery(el);
|
||||||
|
const $img = $el.find('img');
|
||||||
|
const imgClass = $img.attr('class') || '';
|
||||||
|
const level = getNumber(trimPrefix(imgClass, 'adventureDifficulty'));
|
||||||
|
$img.after(` - ${level}`);
|
||||||
|
});
|
||||||
|
}
|
@ -21,6 +21,11 @@ export function isHeroPage() {
|
|||||||
return p.pathname === '/hero.php';
|
return p.pathname === '/hero.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isAdventurePage() {
|
||||||
|
const p = parseLocation();
|
||||||
|
return p.pathname === '/hero.php' && p.query.t === '3';
|
||||||
|
}
|
||||||
|
|
||||||
export function getBuildingPageAttributes(): BuildingPageAttributes {
|
export function getBuildingPageAttributes(): BuildingPageAttributes {
|
||||||
if (!isBuildingPage()) {
|
if (!isBuildingPage()) {
|
||||||
throw Error('Not building page');
|
throw Error('Not building page');
|
||||||
|
Loading…
Reference in New Issue
Block a user