Skip to content

Commit

Permalink
refactor: Use common tooling from external library
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversalzburg committed Oct 30, 2023
1 parent 0921699 commit 82ea3fe
Show file tree
Hide file tree
Showing 58 changed files with 103 additions and 170 deletions.
1 change: 1 addition & 0 deletions packages/kitten-scientists/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"types": "./build/index.ts",
"dependencies": {
"@oliversalzburg/js-utils": "0.0.4",
"date-fns": "2.30.0",
"semver": "7.5.4",
"tslib": "2.6.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/kitten-scientists/source/BonfireManager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isNil, mustExist } from "@oliversalzburg/js-utils/nil.js";
import { Automation, TickContext } from "./Engine.js";
import { TabManager } from "./TabManager.js";
import { UserScript } from "./UserScript.js";
Expand All @@ -9,7 +10,6 @@ import {
BonfireSettings,
} from "./settings/BonfireSettings.js";
import { cwarn } from "./tools/Log.js";
import { isNil, mustExist } from "./tools/Maybe.js";
import {
BuildButton,
Building,
Expand Down
8 changes: 4 additions & 4 deletions packages/kitten-scientists/source/ReligionManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { isNil, mustExist } from "@oliversalzburg/js-utils/nil.js";
import { BonfireManager } from "./BonfireManager.js";
import { Automation, TickContext } from "./Engine.js";
import { TabManager } from "./TabManager.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";
import { BulkPurchaseHelper } from "./helper/BulkPurchaseHelper.js";
import { BonfireBuildingSetting } from "./settings/BonfireSettings.js";
import {
Expand All @@ -8,9 +12,7 @@ import {
ReligionSettingsItem,
UnicornItem,
} from "./settings/ReligionSettings.js";
import { TabManager } from "./TabManager.js";
import { cwarn } from "./tools/Log.js";
import { isNil, mustExist } from "./tools/Maybe.js";
import {
BuildButton,
ButtonModernController,
Expand All @@ -24,8 +26,6 @@ import {
ZiggurathUpgradeInfo,
ZiggurathUpgrades,
} from "./types/index.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";

export class ReligionManager implements Automation {
private readonly _host: UserScript;
Expand Down
8 changes: 4 additions & 4 deletions packages/kitten-scientists/source/ScienceManager.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { isNil } from "@oliversalzburg/js-utils/nil.js";
import { TickContext } from "./Engine.js";
import { ScienceSettings } from "./settings/ScienceSettings.js";
import { TabManager } from "./TabManager.js";
import { cerror } from "./tools/Log.js";
import { isNil } from "./tools/Maybe.js";
import { PolicyInfo, ScienceTab, TechInfo } from "./types/index.js";
import { UpgradeManager } from "./UpgradeManager.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";
import { ScienceSettings } from "./settings/ScienceSettings.js";
import { cerror } from "./tools/Log.js";
import { PolicyInfo, ScienceTab, TechInfo } from "./types/index.js";

export class ScienceManager extends UpgradeManager {
readonly manager: TabManager<ScienceTab>;
Expand Down
8 changes: 4 additions & 4 deletions packages/kitten-scientists/source/SpaceManager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { mustExist } from "@oliversalzburg/js-utils/nil.js";
import { Automation, TickContext } from "./Engine.js";
import { TabManager } from "./TabManager.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";
import { BulkPurchaseHelper } from "./helper/BulkPurchaseHelper.js";
import { SpaceBuildingSetting, SpaceSettings } from "./settings/SpaceSettings.js";
import { TabManager } from "./TabManager.js";
import { cwarn } from "./tools/Log.js";
import { mustExist } from "./tools/Maybe.js";
import {
BuildButton,
ButtonModernController,
Expand All @@ -12,8 +14,6 @@ import {
SpaceBuildings,
SpaceTab,
} from "./types/index.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";

export class SpaceManager implements Automation {
private readonly _host: UserScript;
Expand Down
4 changes: 2 additions & 2 deletions packages/kitten-scientists/source/TabManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isNil } from "./tools/Maybe.js";
import { GameTab, TabId } from "./types/index.js";
import { isNil } from "@oliversalzburg/js-utils/nil.js";
import { UserScript } from "./UserScript.js";
import { GameTab, TabId } from "./types/index.js";

export class TabManager<TTab extends GameTab = GameTab> {
private readonly _host: UserScript;
Expand Down
8 changes: 4 additions & 4 deletions packages/kitten-scientists/source/TimeControlManager.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { isNil, mustExist } from "@oliversalzburg/js-utils/nil.js";
import { BonfireManager } from "./BonfireManager.js";
import { Engine, TickContext } from "./Engine.js";
import { ReligionManager } from "./ReligionManager.js";
import { CycleIndices, TimeControlSettings } from "./settings/TimeControlSettings.js";
import { SpaceManager } from "./SpaceManager.js";
import { TabManager } from "./TabManager.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";
import { CycleIndices, TimeControlSettings } from "./settings/TimeControlSettings.js";
import { objectEntries } from "./tools/Entries.js";
import { isNil, mustExist } from "./tools/Maybe.js";
import {
BuildButton,
ButtonModernController,
Expand All @@ -18,8 +20,6 @@ import {
VoidSpaceUpgradeInfo,
VoidSpaceUpgrades,
} from "./types/index.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";

export class TimeControlManager {
private readonly _host: UserScript;
Expand Down
8 changes: 4 additions & 4 deletions packages/kitten-scientists/source/TimeManager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { mustExist } from "@oliversalzburg/js-utils/nil.js";
import { TickContext } from "./Engine.js";
import { TabManager } from "./TabManager.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";
import { BulkPurchaseHelper } from "./helper/BulkPurchaseHelper.js";
import { TimeItem, TimeSettings, TimeSettingsItem } from "./settings/TimeSettings.js";
import { TabManager } from "./TabManager.js";
import { cwarn } from "./tools/Log.js";
import { mustExist } from "./tools/Maybe.js";
import {
BuildButton,
ButtonModernController,
Expand All @@ -16,8 +18,6 @@ import {
VoidSpaceUpgradeInfo,
VoidSpaceUpgrades,
} from "./types/index.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";

export class TimeManager {
private readonly _host: UserScript;
Expand Down
8 changes: 4 additions & 4 deletions packages/kitten-scientists/source/TradeManager.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Maybe, isNil, mustExist } from "@oliversalzburg/js-utils/nil.js";
import { Automation, TickContext } from "./Engine.js";
import { TabManager } from "./TabManager.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";
import { MaterialsCache } from "./helper/MaterialsCache.js";
import { TradeSettings } from "./settings/TradeSettings.js";
import { TabManager } from "./TabManager.js";
import { objectEntries } from "./tools/Entries.js";
import { ucfirst } from "./tools/Format.js";
import { cwarn } from "./tools/Log.js";
import { isNil, Maybe, mustExist } from "./tools/Maybe.js";
import { BuildButton, Race, RaceInfo, Resource, TradeInfo, TradeTab } from "./types/index.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";

export class TradeManager implements Automation {
private readonly _host: UserScript;
Expand Down
4 changes: 2 additions & 2 deletions packages/kitten-scientists/source/UpgradeManager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mustExist } from "@oliversalzburg/js-utils/nil.js";
import { TabManager } from "./TabManager.js";
import { mustExist } from "./tools/Maybe.js";
import { BuildButton, ScienceTab } from "./types/index.js";
import { UserScript } from "./UserScript.js";
import { BuildButton, ScienceTab } from "./types/index.js";

export abstract class UpgradeManager {
protected readonly _host: UserScript;
Expand Down
4 changes: 2 additions & 2 deletions packages/kitten-scientists/source/UserScript.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ReleaseChannel, ReleaseInfoSchema } from "@kitten-science/action-release-info";
import { Maybe, isNil, mustExist } from "@oliversalzburg/js-utils/nil.js";
import { sleep } from "@oliversalzburg/js-utils/sleep.js";
import JQuery from "jquery";
import gt from "semver/functions/gt.js";
import { Engine, EngineState, GameLanguage, SupportedLanguage } from "./Engine.js";
import { ScienceSettings } from "./settings/ScienceSettings.js";
import { SpaceSettings } from "./settings/SpaceSettings.js";
import { WorkshopSettings } from "./settings/WorkshopSettings.js";
import { cdebug, cerror, cinfo, cwarn } from "./tools/Log.js";
import { Maybe, isNil, mustExist } from "./tools/Maybe.js";
import { sleep } from "./tools/Sleep.js";
import { GamePage } from "./types/index.js";
import { UserInterface } from "./ui/UserInterface.js";

Expand Down
8 changes: 4 additions & 4 deletions packages/kitten-scientists/source/VillageManager.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { isNil, mustExist } from "@oliversalzburg/js-utils/nil.js";
import { Automation, TickContext } from "./Engine.js";
import { TabManager } from "./TabManager.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";
import { MaterialsCache } from "./helper/MaterialsCache.js";
import { VillageSettings } from "./settings/VillageSettings.js";
import { TabManager } from "./TabManager.js";
import { objectEntries } from "./tools/Entries.js";
import { isNil, mustExist } from "./tools/Maybe.js";
import { Resource } from "./types/index.js";
import { JobInfo, VillageTab } from "./types/village.js";
import { UserScript } from "./UserScript.js";
import { WorkshopManager } from "./WorkshopManager.js";

export class VillageManager implements Automation {
private readonly _host: UserScript;
Expand Down
2 changes: 1 addition & 1 deletion packages/kitten-scientists/source/WorkshopManager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isNil, mustExist } from "@oliversalzburg/js-utils/nil.js";
import { Automation, TickContext } from "./Engine.js";
import { TabManager } from "./TabManager.js";
import { UpgradeManager } from "./UpgradeManager.js";
Expand All @@ -6,7 +7,6 @@ import { MaterialsCache } from "./helper/MaterialsCache.js";
import { CraftSettingsItem, WorkshopSettings } from "./settings/WorkshopSettings.js";
import { objectEntries } from "./tools/Entries.js";
import { cerror } from "./tools/Log.js";
import { isNil, mustExist } from "./tools/Maybe.js";
import { CraftableInfo, ResourceInfo } from "./types/craft.js";
import { Resource, ResourceCraftable, UpgradeInfo } from "./types/index.js";
import { VillageTab } from "./types/village.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/kitten-scientists/source/helper/ActivitySummary.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { roundToTwo, ucfirst } from "../tools/Format.js";
import { mustExist } from "../tools/Maybe.js";
import { mustExist } from "@oliversalzburg/js-utils/nil.js";
import { UserScript } from "../UserScript.js";
import { roundToTwo, ucfirst } from "../tools/Format.js";

/**
* The different sections of the summary.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { isNil, mustExist } from "@oliversalzburg/js-utils/nil.js";
import { UserScript } from "../UserScript.js";
import { WorkshopManager } from "../WorkshopManager.js";
import { BonfireItem } from "../settings/BonfireSettings.js";
import { AllItems } from "../settings/Settings.js";
import { objectEntries } from "../tools/Entries.js";
import { isNil, mustExist } from "../tools/Maybe.js";
import {
AllBuildings,
BuildButton,
Expand All @@ -22,8 +24,6 @@ import {
VoidSpaceUpgradeInfo,
ZiggurathUpgradeInfo,
} from "../types/index.js";
import { UserScript } from "../UserScript.js";
import { WorkshopManager } from "../WorkshopManager.js";

export type BulkBuildListItem = {
count: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { Building } from "../types/index.js";
import { BuildingUpgradeSettings } from "./BuildingUpgradeSettings.js";
import { Setting, SettingMax, SettingTrigger } from "./Settings.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { StagedBuilding } from "../types/index.js";
import { Setting } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil, Maybe } from "../tools/Maybe.js";
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { Job, Trait } from "../types/index.js";
import { Setting, SettingOptions } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { Race } from "../types/index.js";
import { SettingMax, SettingTrigger } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { SupportedLanguage } from "../Engine.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { FallbackLanguage } from "../UserScript.js";
import { LogFilterSettings } from "./LogFilterSettings.js";
import { ResourcesSettings } from "./ResourcesSettings.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { Setting } from "./Settings.js";

export enum LogFilterItemVariant {
Expand Down
4 changes: 2 additions & 2 deletions packages/kitten-scientists/source/settings/MissionSettings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { difference } from "../tools/Array.js";
import { difference } from "@oliversalzburg/js-utils/array.js";
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { cwarn } from "../tools/Log.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { GamePage, Missions } from "../types/index.js";
import { Setting } from "./Settings.js";

Expand Down
4 changes: 2 additions & 2 deletions packages/kitten-scientists/source/settings/PolicySettings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { difference } from "../tools/Array.js";
import { difference } from "@oliversalzburg/js-utils/array.js";
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { cwarn } from "../tools/Log.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { GamePage, Policy } from "../types/index.js";
import { Setting } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { UnicornItemVariant } from "../types/index.js";
import { Setting, SettingMax, SettingTrigger } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { BonfireItem } from "./BonfireSettings.js";
import { Setting, SettingTrigger } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { UnicornItemVariant } from "../types/index.js";
import { FaithItem, UnicornItem } from "./ReligionSettings.js";
import { Setting, SettingTrigger } from "./Settings.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { Resource } from "../types/index.js";
import { Setting } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil, Maybe } from "../tools/Maybe.js";
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { ResetBonfireSettings } from "./ResetBonfireSettings.js";
import { ResetReligionSettings } from "./ResetReligionSettings.js";
import { ResetResourcesSettings } from "./ResetResourcesSettings.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { SpaceBuildings } from "../types/index.js";
import { Setting, SettingTrigger } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { TimeItemVariant } from "../types/index.js";
import { Setting, SettingTrigger } from "./Settings.js";
import { TimeItem } from "./TimeSettings.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { Upgrade } from "../types/index.js";
import { Setting } from "./Settings.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { WorkshopManager } from "../WorkshopManager.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { Resource } from "../types/index.js";
import { WorkshopManager } from "../WorkshopManager.js";
import { Setting } from "./Settings.js";

export class ResourcesSettingsItem extends Setting {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil, Maybe } from "../tools/Maybe.js";
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { GamePage } from "../types/index.js";
import { PolicySettings } from "./PolicySettings.js";
import { Setting } from "./Settings.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/kitten-scientists/source/settings/Settings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil, Maybe } from "../tools/Maybe.js";
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { Resource, SpaceBuildings } from "../types/index.js";
import { BonfireItem } from "./BonfireSettings.js";
import { FaithItem, ReligionItem } from "./ReligionSettings.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Maybe, isNil } from "@oliversalzburg/js-utils/nil.js";
import { consumeEntriesPedantic } from "../tools/Entries.js";
import { isNil, Maybe } from "../tools/Maybe.js";
import { GamePage, SpaceBuildings } from "../types/index.js";
import { MissionSettings } from "./MissionSettings.js";
import { SettingMax, SettingTrigger } from "./Settings.js";
Expand Down
Loading

0 comments on commit 82ea3fe

Please sign in to comment.