Fix race detection

This commit is contained in:
DarkPhoenix
2014-12-10 01:01:51 +03:00
parent 20b2f1e5fc
commit da15b63831
7 changed files with 46 additions and 52 deletions

View File

@@ -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),

View File

@@ -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):

View File

@@ -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

BIN
icons/race_mordu_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

View File

@@ -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

View File

@@ -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."
print "\nAll done."

Binary file not shown.