1
|
|
|
/* |
2
|
|
|
* This file is part of ArakneLangLoader. |
3
|
|
|
* |
4
|
|
|
* ArakneLangLoader is free software: you can redistribute it and/or modify |
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
* (at your option) any later version. |
8
|
|
|
* |
9
|
|
|
* ArakneLangLoader is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU Lesser General Public License for more details. |
13
|
|
|
* |
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
15
|
|
|
* along with ArakneLangLoader. If not, see <https://www.gnu.org/licenses/>. |
16
|
|
|
* |
17
|
|
|
* Copyright (c) 2020 Vincent Quatrevieux |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
package fr.arakne.swflangloader.lang.lang; |
21
|
|
|
|
22
|
|
|
import fr.arakne.swflangloader.lang.BaseLangFile; |
23
|
|
|
import fr.arakne.swflangloader.loader.SwfFileLoader; |
24
|
|
|
import fr.arakne.swflangloader.parser.mapper.MapperHydrator; |
25
|
|
|
|
26
|
|
|
import java.io.File; |
27
|
|
|
import java.io.IOException; |
28
|
|
|
import java.net.URL; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* The lang_xx_xxx.swf file |
32
|
|
|
* Contains translations and global configurations |
33
|
|
|
*/ |
34
|
|
|
final public class LangFile extends BaseLangFile { |
35
|
1 |
|
final static private MapperHydrator<LangFile> HYDRATOR = MapperHydrator.parseAnnotations(LangFile.class); |
36
|
|
|
|
37
|
1 |
|
public LangFile(URL file, SwfFileLoader loader) throws IOException, InterruptedException { |
38
|
1 |
|
loader.load(file, this, HYDRATOR); |
39
|
1 |
|
} |
40
|
|
|
|
41
|
|
|
public LangFile(URL file) throws IOException, InterruptedException { |
42
|
1 |
|
this(file, new SwfFileLoader()); |
43
|
1 |
|
} |
44
|
|
|
|
45
|
|
|
public LangFile(File file) throws IOException, InterruptedException { |
46
|
|
|
this(file.toURI().toURL(), new SwfFileLoader()); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Get an error message (packet Im1) |
51
|
|
|
* |
52
|
|
|
* @param id The error message id |
53
|
|
|
* |
54
|
|
|
* @return The message |
55
|
|
|
*/ |
56
|
|
|
public String error(int id) { |
57
|
1 |
|
return string("ERROR_" + id); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Get an info message (packet Im0) |
62
|
|
|
* |
63
|
|
|
* @param id The info message id |
64
|
|
|
* |
65
|
|
|
* @return The message |
66
|
|
|
*/ |
67
|
|
|
public String info(int id) { |
68
|
1 |
|
return string("INFOS_" + id); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get an pvp message (packet Im0) |
73
|
|
|
* |
74
|
|
|
* @param id The pvp message id |
75
|
|
|
* |
76
|
|
|
* @return The message |
77
|
|
|
*/ |
78
|
|
|
public String pvp(int id) { |
79
|
1 |
|
return string("PVP_" + id); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|