Browse Source

API now parses race information for types and ships

master
Chris Smith 15 years ago
parent
commit
3ae87b87eb

+ 3
- 1
src/uk/co/md87/evetool/api/wrappers/ShipList.java View File

@@ -28,6 +28,7 @@ import java.util.List;
28 28
 import java.util.Map;
29 29
 
30 30
 import uk.co.md87.evetool.api.parser.ApiElement;
31
+import uk.co.md87.evetool.api.wrappers.data.BasicRaceInfo;
31 32
 import uk.co.md87.evetool.api.wrappers.data.BasicShipInfo;
32 33
 import uk.co.md87.evetool.api.wrappers.data.SkillRequirement;
33 34
 import uk.co.md87.evetool.api.wrappers.data.TypeGroup;
@@ -54,6 +55,7 @@ public class ShipList {
54 55
                 final int typeID = ship.getNumericAttribute("typeID");
55 56
                 final String typeName = ship.getStringAttribute("typeName");
56 57
                 final int graphicID = ship.getNumericAttribute("graphicID");
58
+                final int raceID = ship.getNumericAttribute("raceID");
57 59
                 final List<SkillRequirement> reqs = new ArrayList<SkillRequirement>();
58 60
                 
59 61
                 final int[][] values = new int[ship.getRowset("attributes").size() / 2][2];
@@ -77,7 +79,7 @@ public class ShipList {
77 79
                 }
78 80
 
79 81
                 final BasicShipInfo info = new BasicShipInfo(typeID, typeName,
80
-                        group, graphicID, reqs);
82
+                        new BasicRaceInfo(raceID), group, graphicID, reqs);
81 83
                 group.add(info);
82 84
                 ships.put(typeID, info);
83 85
             }

+ 46
- 0
src/uk/co/md87/evetool/api/wrappers/data/BasicRaceInfo.java View File

@@ -0,0 +1,46 @@
1
+/*
2
+ * Copyright (c) 2009 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package uk.co.md87.evetool.api.wrappers.data;
24
+
25
+import uk.co.md87.evetool.ui.listable.Retrievable;
26
+
27
+/**
28
+ *
29
+ * TODO: Document BasicRaceInfo
30
+ * TODO: Add ability to resolve race
31
+ * @author chris
32
+ */
33
+public class BasicRaceInfo {
34
+
35
+    private final int id;
36
+
37
+    public BasicRaceInfo(final int id) {
38
+        this.id = id;
39
+    }
40
+
41
+    @Retrievable
42
+    public int getId() {
43
+        return id;
44
+    }
45
+
46
+}

+ 4
- 3
src/uk/co/md87/evetool/api/wrappers/data/BasicShipInfo.java View File

@@ -34,9 +34,10 @@ public class BasicShipInfo extends BasicType {
34 34
     private final int graphicID;
35 35
     private final List<SkillRequirement> requirements;
36 36
 
37
-    public BasicShipInfo(final int id, final String name, final TypeGroup group,
38
-            final int graphicID, final List<SkillRequirement> requirements) {
39
-        super(id, name, group);
37
+    public BasicShipInfo(final int id, final String name, final BasicRaceInfo race,
38
+            final TypeGroup group, final int graphicID,
39
+            final List<SkillRequirement> requirements) {
40
+        super(id, name, race, group);
40 41
 
41 42
         this.graphicID = graphicID;
42 43
         this.requirements = requirements;

+ 10
- 1
src/uk/co/md87/evetool/api/wrappers/data/BasicType.java View File

@@ -35,11 +35,15 @@ public class BasicType {
35 35
 
36 36
     private final String name;
37 37
 
38
+    private final BasicRaceInfo race;
39
+
38 40
     private final TypeGroup group;
39 41
 
40
-    public BasicType(final int id, final String name, final TypeGroup group) {
42
+    public BasicType(final int id, final String name, final BasicRaceInfo race,
43
+            final TypeGroup group) {
41 44
         this.id = id;
42 45
         this.name = name;
46
+        this.race = race;
43 47
         this.group = group;
44 48
     }
45 49
 
@@ -58,4 +62,9 @@ public class BasicType {
58 62
         return name;
59 63
     }
60 64
 
65
+    @Retrievable(deferred=true,name="race")
66
+    public BasicRaceInfo getRace() {
67
+        return race;
68
+    }
69
+
61 70
 }

Loading…
Cancel
Save