summaryrefslogtreecommitdiff
path: root/src/com/sneed/pkrandom/constants/N3DSConstants.java
blob: bc5b41d6ec516eedaa25d6653fde83ae22a261d8 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
package com.sneed.pkrandom.constants;

/*----------------------------------------------------------------------------*/
/*--  N3DSConstants.java - constants that are relevant for all of the 3DS   --*/
/*--                       games                                            --*/
/*--                                                                        --*/
/*--  Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team          --*/
/*--  Pokemon and any associated names and the like are                     --*/
/*--  trademark and (C) Nintendo 1996-2020.                                 --*/
/*--                                                                        --*/
/*--  The custom code written here is licensed under the terms of the GPL:  --*/
/*--                                                                        --*/
/*--  This program is free software: you can redistribute it and/or modify  --*/
/*--  it under the terms of the GNU General Public License as published by  --*/
/*--  the Free Software Foundation, either version 3 of the License, or     --*/
/*--  (at your option) any later version.                                   --*/
/*--                                                                        --*/
/*--  This program is distributed in the hope that it will be useful,       --*/
/*--  but WITHOUT ANY WARRANTY; without even the implied warranty of        --*/
/*--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          --*/
/*--  GNU General Public License for more details.                          --*/
/*--                                                                        --*/
/*--  You should have received a copy of the GNU General Public License     --*/
/*--  along with this program. If not, see <http://www.gnu.org/licenses/>.  --*/
/*----------------------------------------------------------------------------*/

import java.util.HashMap;
import java.util.Map;

public class N3DSConstants {

    public static final int Type_XY = 0, Type_ORAS = 1, Type_SM = 2, Type_USUM = 3;

    private static final Map<Integer,String> textVariableCodesXY = setupTextVariableCodes(Type_XY);
    private static final Map<Integer,String> textVariableCodesORAS = setupTextVariableCodes(Type_ORAS);
    private static final Map<Integer,String> textVariableCodesSM = setupTextVariableCodes(Type_SM);

    public static Map<Integer,String> getTextVariableCodes(int romType) {
        if (romType == Type_XY) {
            return textVariableCodesXY;
        } else if (romType == Type_ORAS) {
            return textVariableCodesORAS;
        } else if (romType == Type_SM || romType == Type_USUM) {
            return textVariableCodesSM;
        }
        return new HashMap<>();
    }

    private static Map<Integer,String> setupTextVariableCodes(int romType) {
        Map<Integer,String> map = new HashMap<>();

        if (romType == Type_XY) {
            map.put(0xFF00, "COLOR");
            map.put(0x0100, "TRNAME");
            map.put(0x0101, "PKNAME");
            map.put(0x0102, "PKNICK");
            map.put(0x0103, "TYPE");
            map.put(0x0105, "LOCATION");
            map.put(0x0106, "ABILITY");
            map.put(0x0107, "MOVE");
            map.put(0x0108, "ITEM1");
            map.put(0x0109, "ITEM2");
            map.put(0x010A, "sTRBAG");
            map.put(0x010B, "BOX");
            map.put(0x010D, "EVSTAT");
            map.put(0x0110, "OPOWER");
            map.put(0x0127, "RIBBON");
            map.put(0x0134, "MIINAME");
            map.put(0x013E, "WEATHER");
            map.put(0x0189, "TRNICK");
            map.put(0x018A, "1stchrTR");
            map.put(0x018B, "SHOUTOUT");
            map.put(0x018E, "BERRY");
            map.put(0x018F, "REMFEEL");
            map.put(0x0190, "REMQUAL");
            map.put(0x0191, "WEBSITE");
            map.put(0x019C, "CHOICECOS");
            map.put(0x01A1, "GSYNCID");
            map.put(0x0192, "PRVIDSAY");
            map.put(0x0193, "BTLTEST");
            map.put(0x0195, "GENLOC");
            map.put(0x0199, "CHOICEFOOD");
            map.put(0x019A, "HOTELITEM");
            map.put(0x019B, "TAXISTOP");
            map.put(0x019F, "MAISTITLE");
            map.put(0x1000, "ITEMPLUR0");
            map.put(0x1001, "ITEMPLUR1");
            map.put(0x1100, "GENDBR");
            map.put(0x1101, "NUMBRNCH");
            map.put(0x1302, "iCOLOR2");
            map.put(0x1303, "iCOLOR3");
            map.put(0x0200, "NUM1");
            map.put(0x0201, "NUM2");
            map.put(0x0202, "NUM3");
            map.put(0x0203, "NUM4");
            map.put(0x0204, "NUM5");
            map.put(0x0205, "NUM6");
            map.put(0x0206, "NUM7");
            map.put(0x0207, "NUM8");
            map.put(0x0208, "NUM9");
        } else if (romType == Type_ORAS) {
            map.put(0xFF00, "COLOR");
            map.put(0x0100, "TRNAME");
            map.put(0x0101, "PKNAME");
            map.put(0x0102, "PKNICK");
            map.put(0x0103, "TYPE");
            map.put(0x0105, "LOCATION");
            map.put(0x0106, "ABILITY");
            map.put(0x0107, "MOVE");
            map.put(0x0108, "ITEM1");
            map.put(0x0109, "ITEM2");
            map.put(0x010A, "sTRBAG");
            map.put(0x010B, "BOX");
            map.put(0x010D, "EVSTAT");
            map.put(0x0110, "OPOWER");
            map.put(0x0127, "RIBBON");
            map.put(0x0134, "MIINAME");
            map.put(0x013E, "WEATHER");
            map.put(0x0189, "TRNICK");
            map.put(0x018A, "1stchrTR");
            map.put(0x018B, "SHOUTOUT");
            map.put(0x018E, "BERRY");
            map.put(0x018F, "REMFEEL");
            map.put(0x0190, "REMQUAL");
            map.put(0x0191, "WEBSITE");
            map.put(0x019C, "CHOICECOS");
            map.put(0x01A1, "GSYNCID");
            map.put(0x0192, "PRVIDSAY");
            map.put(0x0193, "BTLTEST");
            map.put(0x0195, "GENLOC");
            map.put(0x0199, "CHOICEFOOD");
            map.put(0x019A, "HOTELITEM");
            map.put(0x019B, "TAXISTOP");
            map.put(0x019F, "MAISTITLE");
            map.put(0x1000, "ITEMPLUR0");
            map.put(0x1001, "ITEMPLUR1");
            map.put(0x1100, "GENDBR");
            map.put(0x1101, "NUMBRNCH");
            map.put(0x1302, "iCOLOR2");
            map.put(0x1303, "iCOLOR3");
            map.put(0x0200, "NUM1");
            map.put(0x0201, "NUM2");
            map.put(0x0202, "NUM3");
            map.put(0x0203, "NUM4");
            map.put(0x0204, "NUM5");
            map.put(0x0205, "NUM6");
            map.put(0x0206, "NUM7");
            map.put(0x0207, "NUM8");
            map.put(0x0208, "NUM9");
        } else if (romType == Type_SM) {
            map.put(0xFF00, "COLOR");
            map.put(0x0100, "TRNAME");
            map.put(0x0101, "PKNAME");
            map.put(0x0102, "PKNICK");
            map.put(0x0103, "TYPE");
            map.put(0x0105, "LOCATION");
            map.put(0x0106, "ABILITY");
            map.put(0x0107, "MOVE");
            map.put(0x0108, "ITEM1");
            map.put(0x0109, "ITEM2");
            map.put(0x010A, "sTRBAG");
            map.put(0x010B, "BOX");
            map.put(0x010D, "EVSTAT");
            map.put(0x0110, "OPOWER");
            map.put(0x0127, "RIBBON");
            map.put(0x0134, "MIINAME");
            map.put(0x013E, "WEATHER");
            map.put(0x0189, "TRNICK");
            map.put(0x018A, "1stchrTR");
            map.put(0x018B, "SHOUTOUT");
            map.put(0x018E, "BERRY");
            map.put(0x018F, "REMFEEL");
            map.put(0x0190, "REMQUAL");
            map.put(0x0191, "WEBSITE");
            map.put(0x019C, "CHOICECOS");
            map.put(0x01A1, "GSYNCID");
            map.put(0x0192, "PRVIDSAY");
            map.put(0x0193, "BTLTEST");
            map.put(0x0195, "GENLOC");
            map.put(0x0199, "CHOICEFOOD");
            map.put(0x019A, "HOTELITEM");
            map.put(0x019B, "TAXISTOP");
            map.put(0x019F, "MAISTITLE");
            map.put(0x1000, "ITEMPLUR0");
            map.put(0x1001, "ITEMPLUR1");
            map.put(0x1100, "GENDBR");
            map.put(0x1101, "NUMBRNCH");
            map.put(0x1302, "iCOLOR2");
            map.put(0x1303, "iCOLOR3");
            map.put(0x0200, "NUM1");
            map.put(0x0201, "NUM2");
            map.put(0x0202, "NUM3");
            map.put(0x0203, "NUM4");
            map.put(0x0204, "NUM5");
            map.put(0x0205, "NUM6");
            map.put(0x0206, "NUM7");
            map.put(0x0207, "NUM8");
            map.put(0x0208, "NUM9");
        }
        return map;
    }

    public static int getVariableCode(String name, int romType) {
        Map<Integer,String> map = getTextVariableCodes(romType);
        for (int k: map.keySet()) {
            if (map.get(k).equals(name)) {
                return k;
            }
        }
        return 0;
    }
}