fr.arakne.swflangloader.lang.hints.Hint   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 156
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 104
c 1
b 0
f 0
dl 0
loc 156
ccs 14
cts 14
cp 1
rs 10
wmc 13

10 Methods

Rating   Name   Duplication   Size   Complexity  
A equals(Object) 0 6 4
A is(int) 0 2 1
A categoryId() 0 2 1
A setHints(HintsFile) 0 2 1
A toString() 0 3 1
A name() 0 2 1
A type() 0 2 1
A mapId() 0 2 1
A hashCode() 0 3 1
A category() 0 2 1
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.hints;
21
22
import java.util.Objects;
23
24
/**
25
 * A map hint
26
 */
27 1
final public class Hint {
28
    final static public int TYPE_PLACE_FECA = 10;
29
    final static public int TYPE_PLACE_OSAMODA = 20;
30
    final static public int TYPE_PLACE_ENUTROF = 30;
31
    final static public int TYPE_PLACE_SRAM = 40;
32
    final static public int TYPE_PLACE_XELOR = 50;
33
    final static public int TYPE_PLACE_ECAFLIP = 60;
34
    final static public int TYPE_PLACE_ENIRIPSA = 70;
35
    final static public int TYPE_PLACE_IOP = 80;
36
    final static public int TYPE_PLACE_CRA = 90;
37
    final static public int TYPE_PLACE_SADIDA = 100;
38
    final static public int TYPE_PLACE_SACRIEUR = 110;
39
    final static public int TYPE_PLACE_PANDAWA = 120;
40
41
    final static public int TYPE_SALE_HOTEL_ALCHEMIST = 201;
42
    final static public int TYPE_SALE_HOTEL_JEWELER = 202;
43
    final static public int TYPE_SALE_HOTEL_BUTCHER = 203;
44
    final static public int TYPE_SALE_HOTEL_BAKER = 204;
45
    final static public int TYPE_SALE_HOTEL_LUMBERJACK = 205;
46
    final static public int TYPE_SALE_HOTEL_HUNTER = 206;
47
    final static public int TYPE_SALE_HOTEL_SHOEMAKER = 207;
48
    final static public int TYPE_SALE_HOTEL_BLACKSMITH = 208;
49
    final static public int TYPE_SALE_HOTEL_MINER = 209;
50
    final static public int TYPE_SALE_HOTEL_FARMER = 210;
51
    final static public int TYPE_SALE_HOTEL_SINNER = 211;
52
    final static public int TYPE_SALE_HOTEL_FISHMONGER = 212;
53
    final static public int TYPE_SALE_HOTEL_RESOURCE = 213;
54
    final static public int TYPE_SALE_HOTEL_SCULPTOR = 214;
55
    final static public int TYPE_SALE_HOTEL_TAILOR = 215;
56
    final static public int TYPE_SALE_HOTEL_SHIELD = 216;
57
    final static public int TYPE_SALE_HOTEL_SOUL = 217;
58
    final static public int TYPE_SALE_HOTEL_PET = 218;
59
    final static public int TYPE_SALE_HOTEL_PARCHMENT = 219;
60
    final static public int TYPE_SALE_HOTEL_RUNE = 220;
61
    final static public int TYPE_SALE_HOTEL_DOCUMENT = 221;
62
    final static public int TYPE_SALE_HOTEL_HANDYMAN = 222;
63
    final static public int TYPE_SALE_HOTEL_FIREWORK = 223;
64
65
    final static public int TYPE_WORKSHOP_ALCHEMIST = 301;
66
    final static public int TYPE_WORKSHOP_JEWELER = 302;
67
    final static public int TYPE_WORKSHOP_BUTCHER = 303;
68
    final static public int TYPE_WORKSHOP_BAKER = 304;
69
    final static public int TYPE_WORKSHOP_LUMBERJACK = 305;
70
    final static public int TYPE_WORKSHOP_HUNTER = 306;
71
    final static public int TYPE_WORKSHOP_SHOEMAKER = 307;
72
    final static public int TYPE_WORKSHOP_SMITHMAGIC = 308;
73
    final static public int TYPE_WORKSHOP_BLACKSMITH = 309;
74
    final static public int TYPE_WORKSHOP_MINER = 310;
75
    final static public int TYPE_WORKSHOP_FARMER = 311;
76
    final static public int TYPE_WORKSHOP_SINNER = 312;
77
    final static public int TYPE_WORKSHOP_SCULPTOR = 314;
78
    final static public int TYPE_WORKSHOP_TAILOR = 315;
79
    final static public int TYPE_WORKSHOP_SHIELD = 316;
80
    final static public int TYPE_WORKSHOP_HANDYMAN = 317;
81
    final static public int TYPE_WORKSHOP_FIREWORK = 318;
82
83
    final static public int TYPE_BANK = 401;
84
    final static public int TYPE_MOON_CANNON = 402;
85
    final static public int TYPE_CHURCH = 403;
86
    final static public int TYPE_KENNEL = 404;
87
    final static public int TYPE_GUILD_TEMPLE = 405;
88
    final static public int TYPE_KANOJEDO = 406;
89
    final static public int TYPE_MILITIA = 407;
90
    final static public int TYPE_TAVERN = 408;
91
    final static public int TYPE_ZAAP = 410;
92
    final static public int TYPE_ARENA = 411;
93
    final static public int TYPE_AIR_TRANSPORT = 412;
94
    final static public int TYPE_BOAT = 413;
95
    final static public int TYPE_DOJO = 414;
96
    final static public int TYPE_MARKET_PLACE = 415;
97
    final static public int TYPE_TOWER = 416;
98
    final static public int TYPE_LIBRARY = 417;
99
    final static public int TYPE_JOB_HOTEL = 418;
100
    final static public int TYPE_PUBLIC_PADDOCK = 419;
101
    final static public int TYPE_DUNGEON = 422;
102
    final static public int TYPE_EMOTE_STONE = 423;
103
104
    private HintsFile hints;
105
106
    /* final */ private String n;
107
    /* final */ private int c;
108
    /* final */ private int g;
109
    /* final */ private int m;
110
111
    /**
112
     * @return The hint name
113
     */
114
    public String name() {
115 1
        return n;
116
    }
117
118
    /**
119
     * @return The hint color id
120
     * @see HintCategory#id()
121
     */
122
    public int categoryId() {
123 1
        return c;
124
    }
125
126
    /**
127
     * @return The hint category instance
128
     */
129
    public HintCategory category() {
130 1
        return hints.category(c);
131
    }
132
133
    /**
134
     * @return The map id
135
     */
136
    public int mapId() {
137 1
        return m;
138
    }
139
140
    /**
141
     * Get the hint type
142
     * The type is one of the Hint.TYPE_* constant
143
     *
144
     * @return The type id
145
     * @see Hint#is(int) To check the type
146
     */
147
    public int type() {
148 1
        return g;
149
    }
150
151
    /**
152
     * Check if the hint is of the given type
153
     *
154
     * @param type The type id. Can be one of the Hint.TYPE_* constant
155
     *
156
     * @return true if the type match
157
     * @see Hint#type() To get the type
158
     */
159
    public boolean is(int type) {
160 1
        return g == type;
161
    }
162
163
    @Override
164
    public boolean equals(Object o) {
165 1
        if (this == o) return true;
166 1
        if (o == null || getClass() != o.getClass()) return false;
167 1
        Hint hint = (Hint) o;
168 1
        return g == hint.g && m == hint.m;
169
    }
170
171
    @Override
172
    public int hashCode() {
173 1
        return Objects.hash(g, m);
174
    }
175
176
    @Override
177
    public String toString() {
178 1
        return "Hint{" + n + " (" + g + "), map=" + m + "}";
179
    }
180
181
    void setHints(HintsFile hints) {
182 1
        this.hints = hints;
183 1
    }
184
}
185