aboutsummaryrefslogtreecommitdiff
path: root/src/card_db.js
blob: 2552942647f4a03d44f5538ad0ac52419d51a08e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import ocgBanList from "./ocg_banlist.json";
import tcgBanList from "./tcg_banlist.json";
import cnocgBanList from './cnocg_banlist.json';
import genesysBanList from './genesys_banlist.json';
import mdBanList from './md_banlist.json';
import genesysPoint from './genesys_point.json';

let cardDb = {};
let altId = {};
let banList = {
    none: {
        ban: [],
        limit: [],
        semiLimit: [],
    },
    ocg: ocgBanList,
    cnocg: cnocgBanList,
    md: mdBanList,
    tcg: tcgBanList,
    genesys: genesysBanList,
};

function cardGenesysPoint(id) {
    if (genesysPoint[id] === undefined) return 0;
    return genesysPoint[id];
}

function cornerMark(id, env) {
    if (env !== 'genesys') {
        let lst = banList[env];
        if (lst.ban.includes(id)) return 0;
        if (lst.limit.includes(id)) return 1;
        if (lst.semiLimit.includes(id)) return 2;
        return -1;
    }
    let lst = banList[env];
    if (lst.ban.includes(id)) return 0;
    let point = cardGenesysPoint(id);
    if (point === 0) return -1;
    return point;
}

function cardLimit(id, env) {
    let lst = banList[env];
    if (lst.ban.includes(id)) return 0;
    if (lst.limit.includes(id)) return 1;
    if (lst.semiLimit.includes(id)) return 2;
    return 3;
}

function setCardDb(d) {
    cardDb = d;
}

function getCardDb() {
    return cardDb;
}

function getAltId() {
    return altId;
}

function setAltId(x) {
    altId = x;
}

export {
    getCardDb,
    setCardDb,
    getAltId,
    setAltId,
    cardLimit,
    cardGenesysPoint,
    cornerMark,
};