coh-content-db 2.0.0-rc.4 → 2.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -7
- package/dist/coh-content-db.d.ts +353 -185
- package/dist/coh-content-db.js +460 -300
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +448 -294
- package/dist/coh-content-db.mjs.map +1 -1
- package/package.json +1 -4
- package/src/main/api/alternate-data.ts +2 -2
- package/src/main/api/badge-data.ts +21 -19
- package/src/main/api/badge-requirement-data.ts +82 -0
- package/src/main/api/badge-requirement-type.ts +11 -0
- package/src/main/api/change.ts +5 -2
- package/src/main/api/contact-data.ts +46 -0
- package/src/main/api/content-bundle.ts +12 -7
- package/src/main/api/markdown-string.ts +4 -0
- package/src/main/api/zone-data.ts +20 -0
- package/src/main/changelog.ts +7 -2
- package/src/main/db/alignments.ts +17 -0
- package/src/main/db/alternates.ts +8 -14
- package/src/main/db/badge-index.ts +93 -0
- package/src/main/db/badge-requirement.ts +102 -0
- package/src/main/db/badge-search-options.ts +51 -0
- package/src/main/db/badge.ts +55 -48
- package/src/main/db/bundle-metadata.ts +5 -6
- package/src/main/db/coh-content-database.ts +65 -40
- package/src/main/db/contact.ts +59 -0
- package/src/main/db/paged.ts +7 -0
- package/src/main/db/zone.ts +28 -0
- package/src/main/index.ts +15 -11
- package/src/main/util.ts +68 -7
- package/src/test/api/alignments.test.ts +40 -0
- package/src/test/api/badge-data.fixture.ts +9 -7
- package/src/test/api/badge-requirement-data.fixture.ts +17 -0
- package/src/test/api/badge-requirement-type.test.ts +31 -0
- package/src/test/api/contact-data.fixture.ts +13 -0
- package/src/test/api/content-bundle.fixture.ts +2 -2
- package/src/test/api/content-bundle.test.ts +1 -1
- package/src/test/api/zone-data.fixture.ts +8 -0
- package/src/test/db/alternates.test.ts +16 -74
- package/src/test/db/badge-index.test.ts +520 -0
- package/src/test/db/badge-requirement.test.ts +180 -0
- package/src/test/db/badge.test.ts +190 -15
- package/src/test/db/coh-content-database.test.ts +125 -18
- package/src/test/db/contact.test.ts +96 -0
- package/src/test/db/zone.test.ts +36 -0
- package/src/test/index.test.ts +6 -2
- package/src/test/util.test.ts +91 -18
- package/src/main/api/badge-partial-data.ts +0 -65
- package/src/main/api/badge-partial-type.ts +0 -8
- package/src/main/api/game-map-data.ts +0 -26
- package/src/main/api/vidiot-map-data.ts +0 -18
- package/src/main/api/vidiot-map-point-of-interest-data.ts +0 -30
- package/src/main/db/badge-partial.ts +0 -35
- package/src/main/db/badge-search-document.ts +0 -16
- package/src/main/db/game-map.ts +0 -33
- package/src/main/db/vidiot-map-point-of-interest.ts +0 -40
- package/src/main/db/vidiot-map.ts +0 -25
- package/src/test/api/badge-partial-data.fixture.ts +0 -17
- package/src/test/api/badge-partial-type.test.ts +0 -31
- package/src/test/api/game-map-data.fixture.ts +0 -10
- package/src/test/api/vidiot-map-point-of-interest.fixture.ts +0 -10
- package/src/test/api/vidiot-map.fixture.ts +0 -9
- package/src/test/db/badge-search-document.test.ts +0 -35
- package/src/test/db/coh-content-database-search.test.ts +0 -119
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Contact } from '../../main'
|
|
2
|
+
import { contactDataFixture } from '../api/contact-data.fixture'
|
|
3
|
+
|
|
4
|
+
describe(Contact.name, () => {
|
|
5
|
+
describe('Constructor', () => {
|
|
6
|
+
test(`should accept the test fixture`, () => {
|
|
7
|
+
new Contact(contactDataFixture.create())
|
|
8
|
+
})
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
describe('key', () => {
|
|
12
|
+
test(`should should be set from the data`, () => {
|
|
13
|
+
const contact = new Contact(contactDataFixture.create({ key: 'foo' }))
|
|
14
|
+
expect(contact.key).toEqual('foo')
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
describe('name', () => {
|
|
19
|
+
test(`should should be set from the data`, () => {
|
|
20
|
+
const contact = new Contact(contactDataFixture.create({ name: 'foo' }))
|
|
21
|
+
expect(contact.name).toEqual('foo')
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('title', () => {
|
|
26
|
+
test(`should should be set from the data`, () => {
|
|
27
|
+
const contact = new Contact(contactDataFixture.create({ title: 'foo' }))
|
|
28
|
+
expect(contact.title).toEqual('foo')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test(`should should be optional`, () => {
|
|
32
|
+
const contact = new Contact(contactDataFixture.omit('title').create())
|
|
33
|
+
expect(contact.title).toBeUndefined()
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('zoneKey', () => {
|
|
38
|
+
test(`should should be set from the data`, () => {
|
|
39
|
+
const contact = new Contact(contactDataFixture.create({ zoneKey: 'foo' }))
|
|
40
|
+
expect(contact.zoneKey).toEqual('foo')
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test(`should should be optional`, () => {
|
|
44
|
+
const contact = new Contact(contactDataFixture.omit('zoneKey').create())
|
|
45
|
+
expect(contact.zoneKey).toBeUndefined()
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
describe('loc', () => {
|
|
50
|
+
test(`should should be set from the data`, () => {
|
|
51
|
+
const contact = new Contact(contactDataFixture.create({ loc: [1, 2, 3] }))
|
|
52
|
+
expect(contact.loc).toStrictEqual([1, 2, 3])
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test(`should should be optional`, () => {
|
|
56
|
+
const contact = new Contact(contactDataFixture.omit('loc').create())
|
|
57
|
+
expect(contact.loc).toBeUndefined()
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
describe('levelRange', () => {
|
|
62
|
+
test(`should should be set from the data`, () => {
|
|
63
|
+
const contact = new Contact(contactDataFixture.create({ levelRange: [1, 2] }))
|
|
64
|
+
expect(contact.levelRange).toStrictEqual([1, 2])
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test(`should should be optional`, () => {
|
|
68
|
+
const contact = new Contact(contactDataFixture.omit('levelRange').create())
|
|
69
|
+
expect(contact.levelRange).toBeUndefined()
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
describe('notes', () => {
|
|
74
|
+
test(`should should be set from the data`, () => {
|
|
75
|
+
const contact = new Contact(contactDataFixture.create({ notes: 'foo' }))
|
|
76
|
+
expect(contact.notes).toEqual('foo')
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test(`should should be optional`, () => {
|
|
80
|
+
const contact = new Contact(contactDataFixture.omit('notes').create())
|
|
81
|
+
expect(contact.notes).toBeUndefined()
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
describe('links', () => {
|
|
86
|
+
test(`should should be set from the data`, () => {
|
|
87
|
+
const contact = new Contact(contactDataFixture.create({ links: [{ title: 'foo', href: 'bar' }] }))
|
|
88
|
+
expect(contact.links).toStrictEqual([{ title: 'foo', href: 'bar' }])
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test(`should should be optional`, () => {
|
|
92
|
+
const contact = new Contact(contactDataFixture.omit('links').create())
|
|
93
|
+
expect(contact.links).toHaveLength(0)
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Zone } from '../../main'
|
|
2
|
+
import { zoneDataFixture } from '../api/zone-data.fixture'
|
|
3
|
+
|
|
4
|
+
describe(Zone.name, () => {
|
|
5
|
+
describe('Constructor', () => {
|
|
6
|
+
test(`should accept the test fixture`, () => {
|
|
7
|
+
new Zone(zoneDataFixture.create())
|
|
8
|
+
})
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
describe('key', () => {
|
|
12
|
+
test(`should should be set from the data`, () => {
|
|
13
|
+
const zone = new Zone(zoneDataFixture.create({ key: 'foo' }))
|
|
14
|
+
expect(zone.key).toEqual('foo')
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
describe('name', () => {
|
|
19
|
+
test(`should should be set from the data`, () => {
|
|
20
|
+
const zone = new Zone(zoneDataFixture.create({ name: 'foo' }))
|
|
21
|
+
expect(zone.name).toEqual('foo')
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('links', () => {
|
|
26
|
+
test(`should should be set from the data`, () => {
|
|
27
|
+
const zone = new Zone(zoneDataFixture.create({ links: [{ title: 'foo', href: 'bar' }] }))
|
|
28
|
+
expect(zone.links).toStrictEqual([{ title: 'foo', href: 'bar' }])
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test(`should should be optional`, () => {
|
|
32
|
+
const zone = new Zone(zoneDataFixture.omit('links').create())
|
|
33
|
+
expect(zone.links).toHaveLength(0)
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
})
|
package/src/test/index.test.ts
CHANGED
|
@@ -5,6 +5,10 @@ test('should export the changelog', () => {
|
|
|
5
5
|
})
|
|
6
6
|
|
|
7
7
|
test('should export badge reference utils', () => {
|
|
8
|
-
expect(index).toHaveProperty('
|
|
9
|
-
expect(index).toHaveProperty('
|
|
8
|
+
expect(index).toHaveProperty('badgeUri')
|
|
9
|
+
expect(index).toHaveProperty('badgeLink')
|
|
10
|
+
expect(index).toHaveProperty('contactUri')
|
|
11
|
+
expect(index).toHaveProperty('contactLink')
|
|
12
|
+
expect(index).toHaveProperty('zoneUri')
|
|
13
|
+
expect(index).toHaveProperty('zoneLink')
|
|
10
14
|
})
|
package/src/test/util.test.ts
CHANGED
|
@@ -1,39 +1,112 @@
|
|
|
1
|
-
import { Badge,
|
|
1
|
+
import { Badge, badgeLink, badgeUri, Contact, contactLink, contactUri, Zone, zoneLink, zoneUri } from '../main'
|
|
2
2
|
import { badgeDataFixture } from './api/badge-data.fixture'
|
|
3
|
-
import {
|
|
3
|
+
import { zoneDataFixture } from './api/zone-data.fixture'
|
|
4
|
+
import { contactDataFixture } from './api/contact-data.fixture'
|
|
4
5
|
|
|
5
|
-
describe(
|
|
6
|
+
describe(badgeUri.name, () => {
|
|
6
7
|
test('should return the expected pattern', () => {
|
|
7
|
-
expect(
|
|
8
|
-
expect(
|
|
9
|
-
expect(
|
|
8
|
+
expect(badgeUri('foo')).toBe('badge://foo')
|
|
9
|
+
expect(badgeUri('bar')).toBe('badge://bar')
|
|
10
|
+
expect(badgeUri('foo-bar')).toBe('badge://foo-bar')
|
|
10
11
|
})
|
|
11
12
|
|
|
12
13
|
test('should accept a Badge object', () => {
|
|
13
14
|
const badge = new Badge(badgeDataFixture.create({ key: 'foo' }))
|
|
14
|
-
expect(
|
|
15
|
+
expect(badgeUri(badge)).toBe('badge://foo')
|
|
15
16
|
})
|
|
16
17
|
|
|
17
18
|
test('should accept a BadgeData object', () => {
|
|
18
19
|
const badge = badgeDataFixture.create({ key: 'foo' })
|
|
19
|
-
expect(
|
|
20
|
+
expect(badgeUri(badge)).toBe('badge://foo')
|
|
20
21
|
})
|
|
21
22
|
})
|
|
22
23
|
|
|
23
|
-
describe(
|
|
24
|
+
describe(badgeLink.name, () => {
|
|
24
25
|
test('should return the expected pattern', () => {
|
|
25
|
-
expect(
|
|
26
|
-
expect(
|
|
27
|
-
expect(
|
|
26
|
+
expect(badgeLink('foo')).toBe('[foo](badge://foo)')
|
|
27
|
+
expect(badgeLink('bar')).toBe('[bar](badge://bar)')
|
|
28
|
+
expect(badgeLink('foo-bar')).toBe('[foo-bar](badge://foo-bar)')
|
|
28
29
|
})
|
|
29
30
|
|
|
30
|
-
test('should accept a
|
|
31
|
-
const
|
|
32
|
-
expect(
|
|
31
|
+
test('should accept a Badge object', () => {
|
|
32
|
+
const badge = new Badge(badgeDataFixture.create({ key: 'foo' }))
|
|
33
|
+
expect(badgeLink(badge)).toBe('[foo](badge://foo)')
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test('should accept a BadgeData object', () => {
|
|
37
|
+
const badge = badgeDataFixture.create({ key: 'foo' })
|
|
38
|
+
expect(badgeLink(badge)).toBe('[foo](badge://foo)')
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe(contactUri.name, () => {
|
|
43
|
+
test('should return the expected pattern', () => {
|
|
44
|
+
expect(contactUri('foo')).toBe('contact://foo')
|
|
45
|
+
expect(contactUri('bar')).toBe('contact://bar')
|
|
46
|
+
expect(contactUri('foo-bar')).toBe('contact://foo-bar')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('should accept a Contact object', () => {
|
|
50
|
+
const contact = new Contact(contactDataFixture.create({ key: 'foo' }))
|
|
51
|
+
expect(contactUri(contact)).toBe('contact://foo')
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test('should accept a ContactData object', () => {
|
|
55
|
+
const contact = contactDataFixture.create({ key: 'foo' })
|
|
56
|
+
expect(contactUri(contact)).toBe('contact://foo')
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
describe(contactLink.name, () => {
|
|
61
|
+
test('should return the expected pattern', () => {
|
|
62
|
+
expect(contactLink('foo')).toBe('[foo](contact://foo)')
|
|
63
|
+
expect(contactLink('bar')).toBe('[bar](contact://bar)')
|
|
64
|
+
expect(contactLink('foo-bar')).toBe('[foo-bar](contact://foo-bar)')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('should accept a Contact object', () => {
|
|
68
|
+
const contact = new Contact(contactDataFixture.create({ key: 'foo' }))
|
|
69
|
+
expect(contactLink(contact)).toBe('[foo](contact://foo)')
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
test('should accept a ContactData object', () => {
|
|
73
|
+
const contact = contactDataFixture.create({ key: 'foo' })
|
|
74
|
+
expect(contactLink(contact)).toBe('[foo](contact://foo)')
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
describe(zoneUri.name, () => {
|
|
79
|
+
test('should return the expected pattern', () => {
|
|
80
|
+
expect(zoneUri('foo')).toBe('zone://foo')
|
|
81
|
+
expect(zoneUri('bar')).toBe('zone://bar')
|
|
82
|
+
expect(zoneUri('foo-bar')).toBe('zone://foo-bar')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('should accept a Zone object', () => {
|
|
86
|
+
const zone = new Zone(zoneDataFixture.create({ key: 'foo' }))
|
|
87
|
+
expect(zoneUri(zone)).toBe('zone://foo')
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('should accept a ZoneData object', () => {
|
|
91
|
+
const zone = zoneDataFixture.create({ key: 'foo' })
|
|
92
|
+
expect(zoneUri(zone)).toBe('zone://foo')
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
describe(zoneLink.name, () => {
|
|
97
|
+
test('should return the expected pattern', () => {
|
|
98
|
+
expect(zoneLink('foo')).toBe('[foo](zone://foo)')
|
|
99
|
+
expect(zoneLink('bar')).toBe('[bar](zone://bar)')
|
|
100
|
+
expect(zoneLink('foo-bar')).toBe('[foo-bar](zone://foo-bar)')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('should accept a Zone object', () => {
|
|
104
|
+
const zone = new Zone(zoneDataFixture.create({ key: 'foo' }))
|
|
105
|
+
expect(zoneLink(zone)).toBe('[foo](zone://foo)')
|
|
33
106
|
})
|
|
34
107
|
|
|
35
|
-
test('should accept a
|
|
36
|
-
const
|
|
37
|
-
expect(
|
|
108
|
+
test('should accept a ZoneData object', () => {
|
|
109
|
+
const zone = zoneDataFixture.create({ key: 'foo' })
|
|
110
|
+
expect(zoneLink(zone)).toBe('[foo](zone://foo)')
|
|
38
111
|
})
|
|
39
112
|
})
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { EnhancementCategory } from './enhancement-category'
|
|
2
|
-
import { BadgePartialType } from './badge-partial-type'
|
|
3
|
-
import { PlaqueType } from './plaque-type'
|
|
4
|
-
|
|
5
|
-
export interface BadgePartialData {
|
|
6
|
-
/**
|
|
7
|
-
* Key.
|
|
8
|
-
*/
|
|
9
|
-
readonly key: string
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Type of partial.
|
|
13
|
-
*/
|
|
14
|
-
readonly type: BadgePartialType | string
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Map the partial is located on.
|
|
18
|
-
*/
|
|
19
|
-
readonly mapKey?: string
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* /loc coordinates.
|
|
23
|
-
*/
|
|
24
|
-
readonly loc?: number[]
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Is it a wall plaque or a physical monument?
|
|
28
|
-
*/
|
|
29
|
-
readonly plaqueType?: PlaqueType | string
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Plaque inscription.
|
|
33
|
-
*/
|
|
34
|
-
readonly inscription?: string
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The number or letter the partial appears as on Vidiot Maps.
|
|
38
|
-
*/
|
|
39
|
-
readonly vidiotMapKey?: string
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The badge required for this partial.
|
|
43
|
-
*/
|
|
44
|
-
readonly badgeKey?: string
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Level of the invention required.
|
|
48
|
-
*/
|
|
49
|
-
readonly inventionLevel?: number
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The types of enhancements required to be crafted.
|
|
53
|
-
*/
|
|
54
|
-
readonly inventionTypes?: (EnhancementCategory | string)[]
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Number of invention crafts required.
|
|
58
|
-
*/
|
|
59
|
-
readonly inventionCount?: number
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Any additional notes.
|
|
63
|
-
*/
|
|
64
|
-
readonly notes?: string
|
|
65
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const BADGE_PARTIAL_TYPE = [
|
|
2
|
-
'PLAQUE',
|
|
3
|
-
'BADGE',
|
|
4
|
-
'INVENTION',
|
|
5
|
-
'INVENTION_PLUS_ONE', // Some invention badges require you to build x of two different invention levels, 'plus one of either level'.
|
|
6
|
-
] as const
|
|
7
|
-
|
|
8
|
-
export type BadgePartialType = typeof BADGE_PARTIAL_TYPE[number]
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Link } from './link'
|
|
2
|
-
import { VidiotMapData } from './vidiot-map-data'
|
|
3
|
-
|
|
4
|
-
export interface GameMapData {
|
|
5
|
-
/**
|
|
6
|
-
* Unique key used to reference this badge.
|
|
7
|
-
*
|
|
8
|
-
* Keys can only contain lowercase letters, numbers and hyphens (`-`).
|
|
9
|
-
*/
|
|
10
|
-
readonly key: string
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The name of the map as it appears in-game.
|
|
14
|
-
*/
|
|
15
|
-
readonly name: string
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* List of external links for this Map. Wiki, forums, etc.
|
|
19
|
-
*/
|
|
20
|
-
readonly links?: Link[]
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* List of Vidiot Map assets for this map.
|
|
24
|
-
*/
|
|
25
|
-
readonly vidiotMaps?: VidiotMapData[]
|
|
26
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { VidiotMapPointOfInterestData } from './vidiot-map-point-of-interest-data'
|
|
2
|
-
|
|
3
|
-
export interface VidiotMapData {
|
|
4
|
-
/**
|
|
5
|
-
* URL of the map image.
|
|
6
|
-
*/
|
|
7
|
-
readonly imageUrl: string
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Name to display for the Vidiot map.
|
|
11
|
-
*/
|
|
12
|
-
readonly name?: string
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* List of Points of Interest labelled on the image.
|
|
16
|
-
*/
|
|
17
|
-
readonly pointsOfInterest?: VidiotMapPointOfInterestData[]
|
|
18
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface VidiotMapPointOfInterestData {
|
|
2
|
-
/**
|
|
3
|
-
* The pixel-space position of the PoI on the map graphic.
|
|
4
|
-
*
|
|
5
|
-
* Screen-space, pixels from top-left `[0, 0]`.
|
|
6
|
-
*/
|
|
7
|
-
readonly pos?: [number, number]
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Freeform notes about the PoI.
|
|
11
|
-
*
|
|
12
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
13
|
-
*/
|
|
14
|
-
readonly notes?: string
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* If the POI is a zone transfer, the map it transfers to.
|
|
18
|
-
*/
|
|
19
|
-
readonly mapKey?: string
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* If the POI is a badge, the badge.
|
|
23
|
-
*/
|
|
24
|
-
readonly badgeKey?: string
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* If the POI is a partial for a badge, the partial key.
|
|
28
|
-
*/
|
|
29
|
-
readonly badgePartialKey?: string
|
|
30
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BadgePartialData } from '../api/badge-partial-data'
|
|
2
|
-
import { PlaqueType } from '../api/plaque-type'
|
|
3
|
-
import { BadgePartialType } from '../api/badge-partial-type'
|
|
4
|
-
import { EnhancementCategory } from '../api/enhancement-category'
|
|
5
|
-
import { Key } from './key'
|
|
6
|
-
|
|
7
|
-
export class BadgePartial {
|
|
8
|
-
readonly key: string
|
|
9
|
-
readonly type: BadgePartialType | string
|
|
10
|
-
readonly mapKey?: string
|
|
11
|
-
readonly loc?: number[]
|
|
12
|
-
readonly plaqueType?: PlaqueType | string
|
|
13
|
-
readonly inscription?: string
|
|
14
|
-
readonly vidiotMapKey?: string
|
|
15
|
-
readonly badgeKey?: string
|
|
16
|
-
readonly inventionLevel?: number
|
|
17
|
-
readonly inventionTypes?: (EnhancementCategory | string)[]
|
|
18
|
-
readonly inventionCount?: number
|
|
19
|
-
readonly notes?: string
|
|
20
|
-
|
|
21
|
-
constructor(data: BadgePartialData) {
|
|
22
|
-
this.key = new Key(data.key).value
|
|
23
|
-
this.type = data.type
|
|
24
|
-
this.mapKey = data.mapKey
|
|
25
|
-
this.loc = data.loc
|
|
26
|
-
this.plaqueType = data.plaqueType
|
|
27
|
-
this.inscription = data.inscription
|
|
28
|
-
this.vidiotMapKey = data.vidiotMapKey
|
|
29
|
-
this.badgeKey = data.badgeKey
|
|
30
|
-
this.inventionLevel = data.inventionLevel
|
|
31
|
-
this.inventionTypes = data.inventionTypes
|
|
32
|
-
this.inventionCount = data.inventionCount
|
|
33
|
-
this.notes = data.notes
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Badge } from './badge'
|
|
2
|
-
|
|
3
|
-
export class BadgeSearchDocument {
|
|
4
|
-
id: string
|
|
5
|
-
key: string
|
|
6
|
-
name: string
|
|
7
|
-
badgeText: string
|
|
8
|
-
acquisition: string
|
|
9
|
-
|
|
10
|
-
constructor(badge: Badge) {
|
|
11
|
-
this.id = this.key = badge.key
|
|
12
|
-
this.name = badge.name.toString(', ')
|
|
13
|
-
this.badgeText = badge.badgeText.toString(', ')
|
|
14
|
-
this.acquisition = badge.acquisition ?? ''
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src/main/db/game-map.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { VidiotMap } from './vidiot-map'
|
|
2
|
-
import { Link } from '../api/link'
|
|
3
|
-
import { GameMapData } from '../api/game-map-data'
|
|
4
|
-
import { Key } from './key'
|
|
5
|
-
|
|
6
|
-
export class GameMap {
|
|
7
|
-
/**
|
|
8
|
-
* The database key for this map.
|
|
9
|
-
*/
|
|
10
|
-
readonly key: string
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The name of the map as it appears in-game.
|
|
14
|
-
*/
|
|
15
|
-
readonly name: string
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* List of external links for this Map. Wiki, forums, etc.
|
|
19
|
-
*/
|
|
20
|
-
readonly links?: Link[]
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* List of Vidiot Map assets for this map.
|
|
24
|
-
*/
|
|
25
|
-
readonly vidiotMaps?: VidiotMap[]
|
|
26
|
-
|
|
27
|
-
constructor(data: GameMapData) {
|
|
28
|
-
this.key = new Key(data.key).value
|
|
29
|
-
this.name = data.name
|
|
30
|
-
this.links = data.links
|
|
31
|
-
this.vidiotMaps = data.vidiotMaps?.map(data => new VidiotMap(data))
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { VidiotMapPointOfInterestData } from '../api/vidiot-map-point-of-interest-data'
|
|
2
|
-
|
|
3
|
-
export class VidiotMapPointOfInterest {
|
|
4
|
-
/**
|
|
5
|
-
* The pixel-space position of the PoI on the map graphic.
|
|
6
|
-
*
|
|
7
|
-
* Screen-space, pixels from top-left `[0, 0]`.
|
|
8
|
-
*/
|
|
9
|
-
readonly pos?: [number, number]
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Freeform notes about the PoI.
|
|
13
|
-
*
|
|
14
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
15
|
-
*/
|
|
16
|
-
readonly notes?: string
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* If the POI is a zone transfer, the map it transfers to.
|
|
20
|
-
*/
|
|
21
|
-
readonly mapKey?: string
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* If the POI is a badge, the badge.
|
|
25
|
-
*/
|
|
26
|
-
readonly badgeKey?: string
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* If the POI is a partial for a badge, the partial key.
|
|
30
|
-
*/
|
|
31
|
-
readonly badgePartialKey?: string
|
|
32
|
-
|
|
33
|
-
constructor(data: VidiotMapPointOfInterestData) {
|
|
34
|
-
this.pos = data.pos
|
|
35
|
-
this.notes = data.notes
|
|
36
|
-
this.mapKey = data.mapKey
|
|
37
|
-
this.badgeKey = data.badgeKey
|
|
38
|
-
this.badgePartialKey = data.badgePartialKey
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { VidiotMapData } from '../api/vidiot-map-data'
|
|
2
|
-
import { VidiotMapPointOfInterest } from './vidiot-map-point-of-interest'
|
|
3
|
-
|
|
4
|
-
export class VidiotMap {
|
|
5
|
-
/**
|
|
6
|
-
* URL of the map image.
|
|
7
|
-
*/
|
|
8
|
-
readonly imageUrl: string
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Name to display for the Vidiot map.
|
|
12
|
-
*/
|
|
13
|
-
readonly name?: string
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* List of Points of Interest labelled on the image.
|
|
17
|
-
*/
|
|
18
|
-
readonly pointsOfInterest?: VidiotMapPointOfInterest[]
|
|
19
|
-
|
|
20
|
-
constructor(data: VidiotMapData) {
|
|
21
|
-
this.imageUrl = data.imageUrl
|
|
22
|
-
this.name = data.name
|
|
23
|
-
this.pointsOfInterest = data.pointsOfInterest?.map(data => new VidiotMapPointOfInterest(data))
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineFixture } from 'efate'
|
|
2
|
-
import { BADGE_PARTIAL_TYPE, BadgePartialData, ENHANCEMENT_CATEGORY, PLAQUE_TYPE } from '../../main'
|
|
3
|
-
|
|
4
|
-
export const badgePartialDataFixture = defineFixture<BadgePartialData>((t) => {
|
|
5
|
-
t.key.as(index => `badge-partial-${index}`)
|
|
6
|
-
t.type.pickFrom([...BADGE_PARTIAL_TYPE])
|
|
7
|
-
t.mapKey?.asString()
|
|
8
|
-
t.loc?.asArray()
|
|
9
|
-
t.plaqueType?.pickFrom([...PLAQUE_TYPE])
|
|
10
|
-
t.inscription?.asLoremIpsum()
|
|
11
|
-
t.vidiotMapKey?.asString()
|
|
12
|
-
t.badgeKey?.as(index => `badge-${index}`)
|
|
13
|
-
t.inventionLevel?.asNumber()
|
|
14
|
-
t.inventionTypes?.pickFrom([...ENHANCEMENT_CATEGORY])
|
|
15
|
-
t.inventionCount?.asNumber()
|
|
16
|
-
t.notes?.asLoremIpsum()
|
|
17
|
-
})
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { BADGE_PARTIAL_TYPE, BadgePartialType } from '../../main'
|
|
2
|
-
|
|
3
|
-
describe('BADGE_PARTIAL_TYPE', () => {
|
|
4
|
-
test('should be an array', () => {
|
|
5
|
-
expect(Array.isArray(BADGE_PARTIAL_TYPE)).toBeTruthy()
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
test('should not be empty', () => {
|
|
9
|
-
expect(BADGE_PARTIAL_TYPE).not.toHaveLength(0)
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
test('should contain only strings', () => {
|
|
13
|
-
for (const entry of BADGE_PARTIAL_TYPE) {
|
|
14
|
-
expect(typeof entry).toBe('string')
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
test('should contain all known badge partial types', () => {
|
|
19
|
-
const expected = ['PLAQUE', 'BADGE', 'INVENTION', 'INVENTION_PLUS_ONE']
|
|
20
|
-
for (const category of expected) {
|
|
21
|
-
expect(BADGE_PARTIAL_TYPE).toContain(category)
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
describe('BadgePartialType', () => {
|
|
27
|
-
test('should be a usable type', () => {
|
|
28
|
-
const field: BadgePartialType = 'PLAQUE'
|
|
29
|
-
expect(field).toBe('PLAQUE')
|
|
30
|
-
})
|
|
31
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { GameMapData } from '../../main'
|
|
2
|
-
import { defineFixture } from 'efate'
|
|
3
|
-
import { vidiotMapFixture } from './vidiot-map.fixture'
|
|
4
|
-
|
|
5
|
-
export const gameMapDataFixture = defineFixture<GameMapData>((t) => {
|
|
6
|
-
t.key.as(index => `map-${index}`)
|
|
7
|
-
t.name.as(index => `Map ${index}`)
|
|
8
|
-
t.links?.asArray([{ href: 'https://nouri.org' }])
|
|
9
|
-
t.vidiotMaps?.arrayOfFixture({ fixture: vidiotMapFixture })
|
|
10
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { defineFixture } from 'efate'
|
|
2
|
-
import { VidiotMapPointOfInterest } from '../../main'
|
|
3
|
-
|
|
4
|
-
export const vidiotMapPointOfInterestFixture = defineFixture<VidiotMapPointOfInterest>((t) => {
|
|
5
|
-
t.pos?.as(index => [index, index])
|
|
6
|
-
t.notes?.asLoremIpsum()
|
|
7
|
-
t.mapKey?.as(index => `map-${index}`)
|
|
8
|
-
t.badgeKey?.as(index => `badge-${index}`)
|
|
9
|
-
t.badgePartialKey?.as(index => `partial-${index}`)
|
|
10
|
-
})
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { defineFixture } from 'efate'
|
|
2
|
-
import { VidiotMap } from '../../main'
|
|
3
|
-
import { vidiotMapPointOfInterestFixture } from './vidiot-map-point-of-interest.fixture'
|
|
4
|
-
|
|
5
|
-
export const vidiotMapFixture = defineFixture<VidiotMap>((t) => {
|
|
6
|
-
t.imageUrl.as(index => `https://nouri.org?id=${index}`)
|
|
7
|
-
t.name?.as(index => `Vidiot Map ${index}`)
|
|
8
|
-
t.pointsOfInterest?.arrayOfFixture({ fixture: vidiotMapPointOfInterestFixture })
|
|
9
|
-
})
|