Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Commit

Permalink
Fixed ts build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Apr 19, 2018
1 parent a6aa76a commit 5f1f5bb
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/generators/ViewOnlyOrb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ import Orb from './Orb';
import Item from '../containers/item';
import { Flags } from '../util';

export interface ApplicableFlags extends Flags {
not_applicable: boolean;
}
export type ApplicableFlag = keyof ApplicableFlags;

export default class ViewOnlyOrb extends Orb<Item> {
/**
* not applicable to anything
* @param item
*/
public applicableTo(item: Item): Flags {
public applicableTo(item: Item): ApplicableFlags {
return {
not_applicable: true,
};
Expand Down
8 changes: 6 additions & 2 deletions src/generators/mod_types/BestiaryAspectMods.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GeneratorDetails } from '../Generator';
import ViewOnlyOrb from '../ViewOnlyOrb';
import Item from '../../containers/item';
import { Mod } from '../../mods';
Expand Down Expand Up @@ -31,11 +32,14 @@ export default class BestiaryAspectMods extends ViewOnlyOrb {
* @returns true if the mod can only crafted with the Blood Altar from a
* Spirit Beast
*/
public static isBestiaryAspect(mod: ModProps) {
public static isBestiaryAspect(mod: ModProps): boolean {
return BestiaryAspectMods.ASPECT_MODS.has(mod.id);
}

public modsFor(item: Item, whitelist: string[] = []) {
public modsFor(
item: Item,
whitelist: string[] = [],
): Array<GeneratorDetails<Mod>> {
// omit everything spawnable related. crafting is deterministic
return super
.modsFor(item, whitelist.concat('no_matching_tags', 'spawnweight_zero'))
Expand Down
6 changes: 5 additions & 1 deletion src/generators/mod_types/ElderMods.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GeneratorDetails } from '../Generator';
import ViewOnlyOrb from '../ViewOnlyOrb';
import Item from '../../containers/item';
import { Mod } from '../../mods';
Expand Down Expand Up @@ -31,7 +32,10 @@ export default class ElderMods extends ViewOnlyOrb {
* @param item
* @param whitelist
*/
public modsFor(item: Item, whitelist: string[] = []) {
public modsFor(
item: Item,
whitelist: string[] = [],
): Array<GeneratorDetails<Mod>> {
return super.modsFor(item.asElderItem(), whitelist);
}
}
6 changes: 5 additions & 1 deletion src/generators/mod_types/MasterSignatureMods.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GeneratorDetails } from '../Generator';
import ViewOnlyOrb from '../ViewOnlyOrb';
import Item from '../../containers/item';
import { Mod } from '../../mods';
Expand Down Expand Up @@ -102,7 +103,10 @@ export default class MasterSignatureMods extends ViewOnlyOrb {
* @param item
* @param whitelist
*/
public modsFor(item: Item, whitelist: string[] = []) {
public modsFor(
item: Item,
whitelist: string[] = [],
): Array<GeneratorDetails<Mod>> {
// basically ignore spawnweight
const whitelist_spawnable = whitelist.concat(
'no_matching_tags',
Expand Down
6 changes: 5 additions & 1 deletion src/generators/mod_types/ShapedMods.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GeneratorDetails } from '../Generator';
import ViewOnlyOrb from '../ViewOnlyOrb';
import Item from '../../containers/item';
import { Mod } from '../../mods';
Expand Down Expand Up @@ -30,7 +31,10 @@ export default class ShaperMods extends ViewOnlyOrb {
*
* @param item
*/
public modsFor(item: Item, whitelist: string[] = []) {
public modsFor(
item: Item,
whitelist: string[] = [],
): Array<GeneratorDetails<Mod>> {
return super.modsFor(item.asShaperItem(), whitelist);
}
}
10 changes: 7 additions & 3 deletions src/generators/mod_types/WarbandsMods.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { GeneratorDetails } from '../Generator';
import ViewOnlyOrb from '../ViewOnlyOrb';
import Item from '../../containers/item';
import { Mod } from '../../mods';
import { ModProps } from '../../schema';

type Faction = 'brinerot' | 'mutewind' | 'redblade' | 'renegade';
export type Faction = 'brinerot' | 'mutewind' | 'redblade' | 'renegade';

/**
* Generator for all mods that can appear on items dropped by Warbands
Expand Down Expand Up @@ -53,15 +54,18 @@ export default class WarbandsMods extends ViewOnlyOrb {
* @param mod
* @returns true if the mod can spawn on Warbands drops
*/
public static isWarbands(mod: ModProps) {
public static isWarbands(mod: ModProps): boolean {
return (
Object.values(WarbandsMods.FACTION_MODS).find(mods =>
mods.has(mod.id),
) !== undefined
);
}

public modsFor(item: Item, whitelist: string[] = []) {
public modsFor(
item: Item,
whitelist: string[] = [],
): Array<GeneratorDetails<Mod>> {
const faction = this.factionOf(item);
if (faction === undefined) {
return [];
Expand Down

0 comments on commit 5f1f5bb

Please sign in to comment.