Issues (44)

fr/arakne/swfmaploader/swf/SwfMapStructure.java (2 issues)

1
/*
2
 * This file is part of Swf Map Loader.
3
 *
4
 * Swf Map Loader 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
 * Swf Map Loader 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 Swf Map Loader.  If not, see <https://www.gnu.org/licenses/>.
16
 *
17
 * Copyright (c) 2020-2020 Vincent Quatrevieux
18
 */
19
20
package fr.arakne.swfmaploader.swf;
21
22
/**
23
 * Data structure of the swf map file
24
 */
25 1
final public class SwfMapStructure {
0 ignored issues
show
Add a constructor to the class.
Loading history...
26
    private int id;
27
    private int width;
28
    private int height;
29
    private int backgroundNum;
30
    private int ambianceId;
31
    private int musicId;
32
    private boolean outdoor;
33
    private int capabilities;
34
    private String mapData;
35
    private String version;
36
37
    /**
38
     * @return The map id. This is the primary key
39
     */
40
    public int id() {
41 1
        return id;
42
    }
43
44
    public void setId(int id) {
45 1
        this.id = id;
46 1
    }
47
48
    /**
49
     * @return The map width. positive integer
50
     */
51
    public int width() {
52 1
        return width;
53
    }
54
55
    public void setWidth(int width) {
56 1
        this.width = width;
57 1
    }
58
59
    /**
60
     * @return The map height. positive integer
61
     */
62
    public int height() {
63 1
        return height;
64
    }
65
66
    public void setHeight(int height) {
67 1
        this.height = height;
68 1
    }
69
70
    /**
71
     * @return The background image number. Can be zero for no background
72
     */
73
    public int backgroundNum() {
74 1
        return backgroundNum;
75
    }
76
77
    public void setBackgroundNum(int backgroundNum) {
78 1
        this.backgroundNum = backgroundNum;
79 1
    }
80
81
    /**
82
     * @return The ambiance sound id
83
     */
84
    public int ambianceId() {
85 1
        return ambianceId;
86
    }
87
88
    public void setAmbianceId(int ambianceId) {
89 1
        this.ambianceId = ambianceId;
90 1
    }
91
92
    /**
93
     * @return The music id
94
     */
95
    public int musicId() {
96 1
        return musicId;
97
    }
98
99
    public void setMusicId(int musicId) {
100 1
        this.musicId = musicId;
101 1
    }
102
103
    /**
104
     * @return true if the map is outdoor
105
     */
106
    public boolean isOutdoor() {
107 1
        return outdoor;
108
    }
109
110
    public void setOutdoor(boolean outdoor) {
111 1
        this.outdoor = outdoor;
112 1
    }
113
114
    /**
115
     * Bitset for allowing actions
116
     *
117
     * https://github.com/Emudofus/Dofus/blob/1.29/dofus/managers/MapsServersManager.as#L141
118
     * @return The bitset as integer
119
     */
120
    public int capabilities() {
121 1
        return capabilities;
122
    }
123
124
    public void setCapabilities(int capabilities) {
125 1
        this.capabilities = capabilities;
126 1
    }
127
128
    /**
129
     * The map data. If the map is encrypted (ends with X.swf), the map data will be encrypted.
130
     *
131
     * @return The raw map data as string
132
     */
133
    public String mapData() {
134 1
        return mapData;
135
    }
136
137
    public void setMapData(String mapData) {
138 1
        this.mapData = mapData;
139 1
    }
140
141
    /**
142
     * @return The map version string
143
     */
144
    public String version() {
145 1
        return version;
146
    }
147
148
    public void setVersion(String version) {
149 1
        this.version = version;
150 1
    }
151
152
    /**
153
     * Check if the structure contains valid data
154
     *
155
     * @return true if valid
156
     */
157
    public boolean valid() {
158 1
        return id > 0 && width > 0 && height > 0 && mapData != null && !mapData.isEmpty();
0 ignored issues
show
Comprehensibility introduced by
Reduce the number of conditional operators (4) used in the expression (maximum allowed 3).
Loading history...
159
    }
160
161
    @Override
162
    public String toString() {
163 1
        return "MapStructure{" +
164
            "id=" + id +
165
            ", width=" + width +
166
            ", height=" + height +
167
            ", backgroundNum=" + backgroundNum +
168
            ", ambianceId=" + ambianceId +
169
            ", musicId=" + musicId +
170
            ", outdoor=" + outdoor +
171
            ", capabilities=" + capabilities +
172
            ", mapData='" + mapData + '\'' +
173
            '}'
174
        ;
175
    }
176
}
177