diff --git a/eos/db/gamedata/item.py b/eos/db/gamedata/item.py index 761921906..34a1a6189 100644 --- a/eos/db/gamedata/item.py +++ b/eos/db/gamedata/item.py @@ -30,6 +30,7 @@ items_table = Table("invtypes", gamedata_meta, Column("typeName", String, index=True), Column("description", String), Column("raceID", Integer), + Column("factionID", Integer), Column("volume", Float), Column("mass", Float), Column("capacity", Float), diff --git a/eos/gamedata.py b/eos/gamedata.py index f1a970bdd..4472469f3 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -235,46 +235,25 @@ class Item(EqBase): requiredSkills[item] = skillLvl return self.__requiredSkills + factionMap = { + 500001: "caldari", + 500002: "minmatar", + 500003: "amarr", + 500004: "gallente", + 500005: "jove", + 500010: "guristas", + 500011: "angel", + 500012: "blood", + 500014: "ore", + 500016: "sisters", + 500018: "mordu", + 500019: "sansha", + 500020: "serpentis" + } + @property def race(self): - if self.__race is None: - # Define race map - map = {1: "caldari", - 2: "minmatar", - 4: "amarr", - 5: "sansha", # Caldari + Amarr - 6: "blood", # Minmatar + Amarr - 8: "gallente", - 9: "guristas", # Caldari + Gallente - 10: "angelserp", # Minmatar + Gallente, final race depends on the order of skills - 12: "sisters", # Amarr + Gallente - 16: "jove", - 32: "sansha", # Incrusion Sansha - 128: "ore"} - # Race is None by default - race = None - # Check primary and secondary required skills' races - if race is None: - # Currently Assault Frigates skill has raceID set, which is actually - # EVE's bug - ignoredSkills = ('Assault Frigates',) - skills = tuple(filter(lambda i: i.name not in ignoredSkills, self.requiredSkills.keys())) - skillRaces = tuple(filter(lambda rid: rid, (s.raceID for s in skills))) - if sum(skillRaces) in map: - race = map[sum(skillRaces)] - if race == "angelserp": - if skillRaces == (2, 8): - race = "angel" - else: - race = "serpentis" - - # Rely on item's own raceID as last resort - if race is None: - race = map.get(self.raceID, None) - - # Store our final value - self.__race = race - return self.__race + return self.factionMap.get(self.factionID) @property def assistive(self): diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index ac98c8e31..06ed53a16 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -707,7 +707,12 @@ class ShipBrowser(wx.Panel): self.raceselect.Show(False) self.Layout() - RACE_ORDER = ["amarr", "caldari", "gallente", "minmatar", "sisters", "ore", "serpentis", "angel", "blood", "sansha", "guristas", "jove", None] + RACE_ORDER = [ + "amarr", "caldari", "gallente", "minmatar", + "sisters", "ore", + "serpentis", "angel", "blood", "sansha", "guristas", "mordu", + "jove", None + ] def raceNameKey(self, ship): return self.RACE_ORDER.index(ship.race), ship.name diff --git a/icons/race_mordu_small.png b/icons/race_mordu_small.png new file mode 100644 index 000000000..6804d7660 Binary files /dev/null and b/icons/race_mordu_small.png differ diff --git a/scripts/jsonToSql.py b/scripts/jsonToSql.py index eb1678fd2..23f037db6 100755 --- a/scripts/jsonToSql.py +++ b/scripts/jsonToSql.py @@ -131,6 +131,21 @@ def main(db, json_path): newData.append(newRow) return newData + def convertTypes(typesData): + """ + Add factionID column to invtypes table. + """ + factionMap = {} + with open(os.path.join(jsonPath, "fsdTypeOverrides.json")) as f: + overridesData = json.load(f) + for typeID, typeData in overridesData.items(): + factionID = typeData.get("factionID") + if factionID is not None: + factionMap[int(typeID)] = factionID + for row in typesData: + row['factionID'] = factionMap.get(int(row['typeID'])) + return typesData + data = {} # Dump all data to memory so we can easely cross check ignored rows @@ -141,27 +156,21 @@ def main(db, json_path): tableData = convertIcons(tableData) if jsonName == "phbtraits": tableData = convertTraits(tableData) + if jsonName == "invtypes": + tableData = convertTypes(tableData) data[jsonName] = tableData - # 1306 - group Ship Modifiers, for items like tactical t3 ship modes - - # Do some preprocessing to make our job easier + # Set with typeIDs which we will have in our database invTypes = set() for row in data["invtypes"]: + # 1306 - group Ship Modifiers, for items like tactical t3 ship modes if (row["published"] or row['groupID'] == 1306): invTypes.add(row["typeID"]) # ignore checker def isIgnored(file, row): - if file == "invtypes" and not (row["published"] or row['groupID'] == 1306): + if file in ("invtypes", "dgmtypeeffects", "dgmtypeattribs", "invmetatypes") and row['typeID'] not in invTypes: return True - elif file == "dgmtypeeffects" and not row["typeID"] in invTypes: - return True - elif file == "dgmtypeattribs" and not row["typeID"] in invTypes: - return True - elif file == "invmetatypes" and not row["typeID"] in invTypes: - return True - return False # Loop through each json file and write it away, checking ignored rows diff --git a/scripts/prep_data.py b/scripts/prep_data.py index e13415a74..df98489d9 100644 --- a/scripts/prep_data.py +++ b/scripts/prep_data.py @@ -65,7 +65,7 @@ if not args.nojson: list = "dgmexpressions,dgmattribs,dgmeffects,dgmtypeattribs,dgmtypeeffects,"\ "dgmunits,icons,invcategories,invgroups,invmetagroups,invmetatypes,"\ - "invtypes,mapbulk_marketGroups,phbmetadata,phbtraits" + "invtypes,mapbulk_marketGroups,phbmetadata,phbtraits,fsdTypeOverrides" FlowManager(miners, writers).run(list, "multi") @@ -91,4 +91,4 @@ sys.stdout = open(diff_file, 'w') itemDiff.main(old=old_db, new=db_file) sys.stdout = old_stdout -print "\nAll done." \ No newline at end of file +print "\nAll done." diff --git a/staticdata/eve.db b/staticdata/eve.db index 0fc75bf9b..e52adba6a 100644 Binary files a/staticdata/eve.db and b/staticdata/eve.db differ