Passed
Push — depfu/update/npm/lodash-4.17.1... ( c1263d )
by
unknown
04:21
created

src/app/data/savefile-expanded/fragments/SignData.ts   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 31
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3
mnd 1
bc 1
fnc 2
bpm 0.5
cpm 1.5
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A SignData.load 0 8 2
A SignData.save 0 8 1
1
import { SaveFileService } from './../../savefile.service';
2
3
export class SignData {
4
    constructor(savefile?: SaveFileService, index?: number) {
5
        if (savefile !== undefined)
6
            this.load(savefile as SaveFileService, index as number);
7
    }
8
9
    public load(savefile: SaveFileService, index: number) {
10
        const it = savefile.iterator.offsetTo((2 * index) + 0x275D);
11
        this.y = it.getByte();
12
        this.x = it.getByte();
13
14
        it.offsetTo((1 * index) + 0x277D);
15
        this.text = it.getByte();
16
    }
17
18
    public save(saveFile: SaveFileService, index: number) {
19
        const it = saveFile.iterator.offsetTo((2 * index) + 0x275D);
20
        it.setByte(this.y);
21
        it.setByte(this.x);
22
23
        it.offsetTo((1 * index) + 0x277D);
24
        it.setByte(this.text);
25
    }
26
27
    public y: number = 0;
28
    public x: number = 0;
29
    public text: number = 0;
30
}
31