diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1de2f79512..6efffa9b17 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -12,6 +12,7 @@ import { MainWindowModule } from './components/main-window/main-window.module'; import { ComingSoonModule } from './components/editors/coming-soon/coming-soon.module'; import { QuestModule } from './components/editors/quest/quest.module'; import { GameobjectModule } from './components/editors/gameobject/gameobject.module'; +import { ItemModule } from './components/editors/item/item.module'; @NgModule({ @@ -27,7 +28,8 @@ import { GameobjectModule } from './components/editors/gameobject/gameobject.mod /* Editors */ CreatureModule, QuestModule, - GameobjectModule + GameobjectModule, + ItemModule, ], bootstrap: [ AppComponent ] }) diff --git a/src/app/components/editors/item/item.module.ts b/src/app/components/editors/item/item.module.ts new file mode 100644 index 0000000000..f27c555cb5 --- /dev/null +++ b/src/app/components/editors/item/item.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; + +const modules = [ + +]; + +@NgModule({ + imports: [modules], + exports: [modules], +}) +export class ItemModule {} diff --git a/src/app/services/editors/item/disenchant-loot-template.service.spec.ts b/src/app/services/editors/item/disenchant-loot-template.service.spec.ts new file mode 100644 index 0000000000..12c6e7d454 --- /dev/null +++ b/src/app/services/editors/item/disenchant-loot-template.service.spec.ts @@ -0,0 +1,23 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { instance } from 'ts-mockito'; + +import { DisenchantLootTemplateService } from './disenchant-loot-template.service'; +import { QueryService } from '../../query.service'; +import { MockedQueryService } from '../../../test-utils/mocks'; + +describe('DisenchantLootTemplateService', () => { + beforeEach(() => TestBed.configureTestingModule({ + imports: [ + RouterTestingModule, + ], + providers: [ + { provide: QueryService, useValue: instance(MockedQueryService) }, + ], + })); + + it('should be created', () => { + const service: DisenchantLootTemplateService = TestBed.get(DisenchantLootTemplateService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/editors/item/disenchant-loot-template.service.ts b/src/app/services/editors/item/disenchant-loot-template.service.ts new file mode 100644 index 0000000000..b0c6db18be --- /dev/null +++ b/src/app/services/editors/item/disenchant-loot-template.service.ts @@ -0,0 +1,32 @@ +import { Injectable } from '@angular/core'; + +import { ItemHandlerService } from '../../handlers/item-handler.service'; +import { QueryService } from '../../query.service'; +import { + DISENCHANT_LOOT_TEMPLATE_TABLE, + DisenchantLootTemplate, +} from '../../../types/disenchant-loot-template.type'; +import { LootEditorService } from '../loot-editor.service'; +import { DISENCHANT_TEMPLATE_LOOT_ID, ITEM_TEMPLATE_ID, ITEM_TEMPLATE_TABLE } from '../../../types/item-template.type'; + +@Injectable({ + providedIn: 'root' +}) +export class DisenchantLootTemplateService extends LootEditorService { + + /* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690 + constructor( + protected handlerService: ItemHandlerService, + protected queryService: QueryService, + ) { + super( + DisenchantLootTemplate, + DISENCHANT_LOOT_TEMPLATE_TABLE, + ITEM_TEMPLATE_TABLE, + ITEM_TEMPLATE_ID, + DISENCHANT_TEMPLATE_LOOT_ID, + handlerService, + queryService, + ); + } +} diff --git a/src/app/services/editors/item/item-enchantment-template.service.spec.ts b/src/app/services/editors/item/item-enchantment-template.service.spec.ts new file mode 100644 index 0000000000..e48981600c --- /dev/null +++ b/src/app/services/editors/item/item-enchantment-template.service.spec.ts @@ -0,0 +1,23 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { instance } from 'ts-mockito'; + +import { QueryService } from '../../query.service'; +import { MockedQueryService } from '../../../test-utils/mocks'; +import { ItemEnchantmentTemplateService } from './item-enchantment-template.service'; + +describe('ItemEnchantmentTemplateService', () => { + beforeEach(() => TestBed.configureTestingModule({ + imports: [ + RouterTestingModule, + ], + providers: [ + { provide: QueryService, useValue: instance(MockedQueryService) }, + ], + })); + + it('should be created', () => { + const service: ItemEnchantmentTemplateService = TestBed.get(ItemEnchantmentTemplateService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/editors/item/item-enchantment-template.service.ts b/src/app/services/editors/item/item-enchantment-template.service.ts new file mode 100644 index 0000000000..335d7e32e1 --- /dev/null +++ b/src/app/services/editors/item/item-enchantment-template.service.ts @@ -0,0 +1,31 @@ +import { Injectable } from '@angular/core'; + +import { MultiRowEditorService } from '../multi-row-editor.service'; +import { QueryService } from '../../query.service'; +import { + ITEM_ENCHANTMENT_TEMPLATE_ID, ITEM_ENCHANTMENT_TEMPLATE_ID_2, + ITEM_ENCHANTMENT_TEMPLATE_TABLE, + ItemEnchantmentTemplate +} from '../../../types/item-enchantment-template.type'; +import { ItemHandlerService } from '../../handlers/item-handler.service'; + +@Injectable({ + providedIn: 'root' +}) +export class ItemEnchantmentTemplateService extends MultiRowEditorService { + + /* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690 + constructor( + protected handlerService: ItemHandlerService, + protected queryService: QueryService, + ) { + super( + ItemEnchantmentTemplate, + ITEM_ENCHANTMENT_TEMPLATE_TABLE, + ITEM_ENCHANTMENT_TEMPLATE_ID, + ITEM_ENCHANTMENT_TEMPLATE_ID_2, + handlerService, + queryService, + ); + } +} diff --git a/src/app/services/editors/item/item-loot-template.service.spec.ts b/src/app/services/editors/item/item-loot-template.service.spec.ts new file mode 100644 index 0000000000..d8761f91ae --- /dev/null +++ b/src/app/services/editors/item/item-loot-template.service.spec.ts @@ -0,0 +1,23 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { instance } from 'ts-mockito'; + +import { ItemLootTemplateService } from './item-loot-template.service'; +import { QueryService } from '../../query.service'; +import { MockedQueryService } from '../../../test-utils/mocks'; + +describe('ItemLootTemplateService', () => { + beforeEach(() => TestBed.configureTestingModule({ + imports: [ + RouterTestingModule, + ], + providers: [ + { provide: QueryService, useValue: instance(MockedQueryService) }, + ], + })); + + it('should be created', () => { + const service: ItemLootTemplateService = TestBed.get(ItemLootTemplateService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/editors/item/item-loot-template.service.ts b/src/app/services/editors/item/item-loot-template.service.ts new file mode 100644 index 0000000000..c442b06960 --- /dev/null +++ b/src/app/services/editors/item/item-loot-template.service.ts @@ -0,0 +1,28 @@ +import { Injectable } from '@angular/core'; + +import { MultiRowEditorService } from '../multi-row-editor.service'; +import { QueryService } from '../../query.service'; +import { ITEM_LOOT_TEMPLATE_TABLE, ItemLootTemplate } from '../../../types/item-loot-template.type'; +import { ItemHandlerService } from '../../handlers/item-handler.service'; +import { LOOT_TEMPLATE_ID, LOOT_TEMPLATE_ID_2 } from '../../../components/editors/shared/loot-template/loot-template.type'; + +@Injectable({ + providedIn: 'root' +}) +export class ItemLootTemplateService extends MultiRowEditorService { + + /* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690 + constructor( + protected handlerService: ItemHandlerService, + protected queryService: QueryService, + ) { + super( + ItemLootTemplate, + ITEM_LOOT_TEMPLATE_TABLE, + LOOT_TEMPLATE_ID, + LOOT_TEMPLATE_ID_2, + handlerService, + queryService, + ); + } +} diff --git a/src/app/services/editors/item/item-template.service.spec.ts b/src/app/services/editors/item/item-template.service.spec.ts new file mode 100644 index 0000000000..6a56d572c4 --- /dev/null +++ b/src/app/services/editors/item/item-template.service.spec.ts @@ -0,0 +1,23 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { instance } from 'ts-mockito'; + +import { ItemTemplateService } from './item-template.service'; +import { QueryService } from '../../query.service'; +import { MockedQueryService } from '../../../test-utils/mocks'; + +describe('ItemTemplateService', () => { + beforeEach(() => TestBed.configureTestingModule({ + imports: [ + RouterTestingModule, + ], + providers: [ + { provide: QueryService, useValue: instance(MockedQueryService) }, + ], + })); + + it('should be created', () => { + const service: ItemTemplateService = TestBed.get(ItemTemplateService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/editors/item/item-template.service.ts b/src/app/services/editors/item/item-template.service.ts new file mode 100644 index 0000000000..579956e921 --- /dev/null +++ b/src/app/services/editors/item/item-template.service.ts @@ -0,0 +1,33 @@ +import { Injectable } from '@angular/core'; + +import { SingleRowEditorService } from '../single-row-editor.service'; +import { + ITEM_TEMPLATE_ID, + ITEM_TEMPLATE_NAME, + ITEM_TEMPLATE_TABLE, + ItemTemplate +} from '../../../types/item-template.type'; +import { QueryService } from '../../query.service'; +import { ItemHandlerService } from '../../handlers/item-handler.service'; + +@Injectable({ + providedIn: 'root' +}) +export class ItemTemplateService extends SingleRowEditorService { + + /* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690 + constructor( + protected handlerService: ItemHandlerService, + protected queryService: QueryService, + ) { + super( + ItemTemplate, + ITEM_TEMPLATE_TABLE, + ITEM_TEMPLATE_ID, + ITEM_TEMPLATE_NAME, + true, + handlerService, + queryService, + ); + } +} diff --git a/src/app/services/editors/item/milling-loot-template.service.spec.ts b/src/app/services/editors/item/milling-loot-template.service.spec.ts new file mode 100644 index 0000000000..67885bff97 --- /dev/null +++ b/src/app/services/editors/item/milling-loot-template.service.spec.ts @@ -0,0 +1,23 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { instance } from 'ts-mockito'; + +import { QueryService } from '../../query.service'; +import { MockedQueryService } from '../../../test-utils/mocks'; +import { MillingLootTemplateService } from './milling-loot-template.service'; + +describe('MillingLootTemplateService', () => { + beforeEach(() => TestBed.configureTestingModule({ + imports: [ + RouterTestingModule, + ], + providers: [ + { provide: QueryService, useValue: instance(MockedQueryService) }, + ], + })); + + it('should be created', () => { + const service: MillingLootTemplateService = TestBed.get(MillingLootTemplateService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/editors/item/milling-loot-template.service.ts b/src/app/services/editors/item/milling-loot-template.service.ts new file mode 100644 index 0000000000..bb4ac08415 --- /dev/null +++ b/src/app/services/editors/item/milling-loot-template.service.ts @@ -0,0 +1,28 @@ +import { Injectable } from '@angular/core'; + +import { MultiRowEditorService } from '../multi-row-editor.service'; +import { QueryService } from '../../query.service'; +import { MILLING_LOOT_TEMPLATE_TABLE, MillingLootTemplate } from '../../../types/milling-loot-template.type'; +import { ItemHandlerService } from '../../handlers/item-handler.service'; +import { LOOT_TEMPLATE_ID, LOOT_TEMPLATE_ID_2 } from '../../../components/editors/shared/loot-template/loot-template.type'; + +@Injectable({ + providedIn: 'root' +}) +export class MillingLootTemplateService extends MultiRowEditorService { + + /* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690 + constructor( + protected handlerService: ItemHandlerService, + protected queryService: QueryService, + ) { + super( + MillingLootTemplate, + MILLING_LOOT_TEMPLATE_TABLE, + LOOT_TEMPLATE_ID, + LOOT_TEMPLATE_ID_2, + handlerService, + queryService, + ); + } +} diff --git a/src/app/services/editors/item/prospecting-loot-template.service.spec.ts b/src/app/services/editors/item/prospecting-loot-template.service.spec.ts new file mode 100644 index 0000000000..3fc197545b --- /dev/null +++ b/src/app/services/editors/item/prospecting-loot-template.service.spec.ts @@ -0,0 +1,23 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { instance } from 'ts-mockito'; + +import { QueryService } from '../../query.service'; +import { MockedQueryService } from '../../../test-utils/mocks'; +import { ProspectingLootTemplateService } from './prospecting-loot-template.service'; + +describe('ProspectingLootTemplateService', () => { + beforeEach(() => TestBed.configureTestingModule({ + imports: [ + RouterTestingModule, + ], + providers: [ + { provide: QueryService, useValue: instance(MockedQueryService) }, + ], + })); + + it('should be created', () => { + const service: ProspectingLootTemplateService = TestBed.get(ProspectingLootTemplateService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/editors/item/prospecting-loot-template.service.ts b/src/app/services/editors/item/prospecting-loot-template.service.ts new file mode 100644 index 0000000000..4478174aa2 --- /dev/null +++ b/src/app/services/editors/item/prospecting-loot-template.service.ts @@ -0,0 +1,28 @@ +import { Injectable } from '@angular/core'; + +import { MultiRowEditorService } from '../multi-row-editor.service'; +import { QueryService } from '../../query.service'; +import { PROSPECTING_LOOT_TEMPLATE_TABLE, ProspectingLootTemplate } from '../../../types/prospecting-loot-template.type'; +import { ItemHandlerService } from '../../handlers/item-handler.service'; +import { LOOT_TEMPLATE_ID, LOOT_TEMPLATE_ID_2 } from '../../../components/editors/shared/loot-template/loot-template.type'; + +@Injectable({ + providedIn: 'root' +}) +export class ProspectingLootTemplateService extends MultiRowEditorService { + + /* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690 + constructor( + protected handlerService: ItemHandlerService, + protected queryService: QueryService, + ) { + super( + ProspectingLootTemplate, + PROSPECTING_LOOT_TEMPLATE_TABLE, + LOOT_TEMPLATE_ID, + LOOT_TEMPLATE_ID_2, + handlerService, + queryService, + ); + } +} diff --git a/src/app/services/handlers/item-handler.service.spec.ts b/src/app/services/handlers/item-handler.service.spec.ts new file mode 100644 index 0000000000..bee1489e09 --- /dev/null +++ b/src/app/services/handlers/item-handler.service.spec.ts @@ -0,0 +1,17 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; + +import { ItemHandlerService } from './item-handler.service'; + +describe('ItemHandlerService', () => { + beforeEach(() => TestBed.configureTestingModule({ + imports: [ + RouterTestingModule, + ] + })); + + it('should be created', () => { + const service: ItemHandlerService = TestBed.get(ItemHandlerService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/handlers/item-handler.service.ts b/src/app/services/handlers/item-handler.service.ts new file mode 100644 index 0000000000..f6f9d8e146 --- /dev/null +++ b/src/app/services/handlers/item-handler.service.ts @@ -0,0 +1,20 @@ +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; + +import { HandlerService } from './handler.service'; +import { ItemTemplate } from '../../types/item-template.type'; + +@Injectable({ + providedIn: 'root' +}) +export class ItemHandlerService extends HandlerService { + /* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690 + constructor( + protected router: Router, + ) { + super( + 'item/item-template', + router, + ); + } +} diff --git a/src/app/types/disenchant-loot-template.type.ts b/src/app/types/disenchant-loot-template.type.ts new file mode 100644 index 0000000000..fe23c4ad05 --- /dev/null +++ b/src/app/types/disenchant-loot-template.type.ts @@ -0,0 +1,4 @@ +import { LootTemplate } from '../components/editors/shared/loot-template/loot-template.type'; + +export const DISENCHANT_LOOT_TEMPLATE_TABLE = 'disenchant_loot_template'; +export class DisenchantLootTemplate extends LootTemplate {} diff --git a/src/app/types/item-enchantment-template.type.ts b/src/app/types/item-enchantment-template.type.ts new file mode 100644 index 0000000000..182b385af8 --- /dev/null +++ b/src/app/types/item-enchantment-template.type.ts @@ -0,0 +1,11 @@ +import { TableRow } from './general'; + +export const ITEM_ENCHANTMENT_TEMPLATE_TABLE = 'item_enchantment_template'; +export const ITEM_ENCHANTMENT_TEMPLATE_ID = 'entry'; +export const ITEM_ENCHANTMENT_TEMPLATE_ID_2 = 'ench'; + +export class ItemEnchantmentTemplate extends TableRow { + entry: number = 0; + ench: number = 0; + chance: number = 0; +} diff --git a/src/app/types/item-loot-template.type.ts b/src/app/types/item-loot-template.type.ts new file mode 100644 index 0000000000..f5d282a1cb --- /dev/null +++ b/src/app/types/item-loot-template.type.ts @@ -0,0 +1,4 @@ +import { LootTemplate } from '../components/editors/shared/loot-template/loot-template.type'; + +export const ITEM_LOOT_TEMPLATE_TABLE = 'item_loot_template'; +export class ItemLootTemplate extends LootTemplate {} diff --git a/src/app/types/item-template.type.ts b/src/app/types/item-template.type.ts index de035a7ac5..f5d0bd5647 100644 --- a/src/app/types/item-template.type.ts +++ b/src/app/types/item-template.type.ts @@ -8,6 +8,8 @@ export const ITEM_TEMPLATE_SEARCH_FIELDS = [ ITEM_TEMPLATE_NAME, ]; +export const DISENCHANT_TEMPLATE_LOOT_ID = 'DisenchantID'; + export class ItemTemplate extends TableRow { entry: number = 0; class: number = 0; diff --git a/src/app/types/milling-loot-template.type.ts b/src/app/types/milling-loot-template.type.ts new file mode 100644 index 0000000000..d901092d49 --- /dev/null +++ b/src/app/types/milling-loot-template.type.ts @@ -0,0 +1,4 @@ +import { LootTemplate } from '../components/editors/shared/loot-template/loot-template.type'; + +export const MILLING_LOOT_TEMPLATE_TABLE = 'milling_loot_template'; +export class MillingLootTemplate extends LootTemplate {} diff --git a/src/app/types/prospecting-loot-template.type.ts b/src/app/types/prospecting-loot-template.type.ts new file mode 100644 index 0000000000..3ce6e6e52f --- /dev/null +++ b/src/app/types/prospecting-loot-template.type.ts @@ -0,0 +1,4 @@ +import { LootTemplate } from '../components/editors/shared/loot-template/loot-template.type'; + +export const PROSPECTING_LOOT_TEMPLATE_TABLE = 'prospecting_loot_template'; +export class ProspectingLootTemplate extends LootTemplate {}