Fix several miscalculations
This commit is contained in:
9
eos/effects/sensorboosttargetedhostile.py
Normal file
9
eos/effects/sensorboosttargetedhostile.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Used by:
|
||||||
|
# Drones named like: SD (3 of 3)
|
||||||
|
type = "projected", "active"
|
||||||
|
def handler(fit, container, context):
|
||||||
|
if "projected" in context:
|
||||||
|
fit.ship.multiplyItemAttr("maxTargetRange", container.getModifiedItemAttr("maxTargetRangeMultiplier"),
|
||||||
|
stackingPenalties = True, penaltyGroup="postMul")
|
||||||
|
fit.ship.multiplyItemAttr("scanResolution", container.getModifiedItemAttr("scanResolutionMultiplier"),
|
||||||
|
stackingPenalties = True, penaltyGroup="postMul")
|
||||||
@@ -4,5 +4,5 @@
|
|||||||
type = "passive"
|
type = "passive"
|
||||||
def handler(fit, ship, context):
|
def handler(fit, ship, context):
|
||||||
level = fit.character.getSkill("Gallente Battlecruiser").level
|
level = fit.character.getSkill("Gallente Battlecruiser").level
|
||||||
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Armor Repair Unit",
|
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems"),
|
||||||
"armorDamageAmount", ship.getModifiedItemAttr("shipBonusGBC2") * level)
|
"armorDamageAmount", ship.getModifiedItemAttr("shipBonusGBC2") * level)
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Used by:
|
||||||
|
# Drones named like: TD (3 of 3)
|
||||||
|
type = "projected", "active"
|
||||||
|
def handler(fit, container, context):
|
||||||
|
if "projected" in context:
|
||||||
|
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Gunnery"),
|
||||||
|
"trackingSpeed", container.getModifiedItemAttr("trackingSpeedMultiplier"),
|
||||||
|
stackingPenalties = True, penaltyGroup="postMul")
|
||||||
|
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Gunnery"),
|
||||||
|
"maxRange", container.getModifiedItemAttr("maxRangeMultiplier"),
|
||||||
|
stackingPenalties = True, penaltyGroup="postMul")
|
||||||
|
fit.modules.filteredItemMultiply(lambda mod: mod.item.requiresSkill("Gunnery"),
|
||||||
|
"falloff", container.getModifiedItemAttr("fallofMultiplier"),
|
||||||
|
stackingPenalties = True, penaltyGroup="postMul")
|
||||||
@@ -30,77 +30,77 @@ import json
|
|||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="This scripts dumps effects from an sqlite cache dump to mongo")
|
parser = argparse.ArgumentParser(description="This scripts dumps effects from an sqlite cache dump to mongo")
|
||||||
parser.add_argument("-d", "--db", required=True, type=str, help="The sqlalchemy connectionstring, example: sqlite:///c:/tq.db")
|
parser.add_argument("-d", "--db", required=True, type=str, help="The sqlalchemy connectionstring, example: sqlite:///c:/tq.db")
|
||||||
parser.add_argument("-j", "--json", required=True, type=str, help="The path to the json dum")
|
parser.add_argument("-j", "--json", required=True, type=str, help="The path to the json dum")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Import eos.config first and change it
|
# Import eos.config first and change it
|
||||||
import eos.config
|
import eos.config
|
||||||
eos.config.gamedata_connectionstring = args.db
|
eos.config.gamedata_connectionstring = args.db
|
||||||
eos.config.debug = False
|
eos.config.debug = False
|
||||||
|
|
||||||
# Now thats done, we can import the eos modules using the config
|
# Now thats done, we can import the eos modules using the config
|
||||||
import eos.db
|
import eos.db
|
||||||
import eos.gamedata
|
import eos.gamedata
|
||||||
|
|
||||||
# Create the database tables
|
# Create the database tables
|
||||||
eos.db.gamedata_meta.create_all()
|
eos.db.gamedata_meta.create_all()
|
||||||
|
|
||||||
# Config dict
|
# Config dict
|
||||||
tables = {"dgmattribs": eos.gamedata.AttributeInfo,
|
tables = {"dgmattribs": eos.gamedata.AttributeInfo,
|
||||||
"dgmeffects": eos.gamedata.EffectInfo,
|
"dgmeffects": eos.gamedata.EffectInfo,
|
||||||
"dgmtypeattribs": eos.gamedata.Attribute,
|
"dgmtypeattribs": eos.gamedata.Attribute,
|
||||||
"dgmtypeeffects": eos.gamedata.Effect,
|
"dgmtypeeffects": eos.gamedata.Effect,
|
||||||
"dgmunits": eos.gamedata.Unit,
|
"dgmunits": eos.gamedata.Unit,
|
||||||
"icons": eos.gamedata.Icon,
|
"icons": eos.gamedata.Icon,
|
||||||
"invcategories": eos.gamedata.Category,
|
"invcategories": eos.gamedata.Category,
|
||||||
"invgroups": eos.gamedata.Group,
|
"invgroups": eos.gamedata.Group,
|
||||||
"invmetagroups": eos.gamedata.MetaGroup,
|
"invmetagroups": eos.gamedata.MetaGroup,
|
||||||
"invmetatypes": eos.gamedata.MetaType,
|
"invmetatypes": eos.gamedata.MetaType,
|
||||||
"invtypes": eos.gamedata.Item,
|
"invtypes": eos.gamedata.Item,
|
||||||
"marketProxy_GetMarketGroups": eos.gamedata.MarketGroup}
|
"marketProxy_GetMarketGroups": eos.gamedata.MarketGroup}
|
||||||
|
|
||||||
fieldMapping = {"icons": {"id": "iconID"}}
|
fieldMapping = {"icons": {"id": "iconID"}}
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
# Dump all data to memory so we can easely cross check ignored rows
|
# Dump all data to memory so we can easely cross check ignored rows
|
||||||
for jsonName, cls in tables.iteritems():
|
for jsonName, cls in tables.iteritems():
|
||||||
f = open(os.path.join(args.json, "{}.json".format(jsonName)))
|
f = open(os.path.join(args.json, "{}.json".format(jsonName)))
|
||||||
data[jsonName] = json.load(f, encoding='cp1252')
|
data[jsonName] = json.load(f, encoding='cp1252')
|
||||||
|
|
||||||
# Do some preprocessing to make our job easier
|
# Do some preprocessing to make our job easier
|
||||||
invTypes = set()
|
invTypes = set()
|
||||||
for row in data["invtypes"]:
|
for row in data["invtypes"]:
|
||||||
if row["published"]:
|
if row["published"]:
|
||||||
invTypes.add(row["typeID"])
|
invTypes.add(row["typeID"])
|
||||||
|
|
||||||
# ignore checker
|
# ignore checker
|
||||||
def isIgnored(file, row):
|
def isIgnored(file, row):
|
||||||
if file == "invtypes" and not row["published"]:
|
if file == "invtypes" and not row["published"]:
|
||||||
return True
|
return True
|
||||||
elif file == "dgmtypeeffects" and not row["typeID"] in invTypes:
|
elif file == "dgmtypeeffects" and not row["typeID"] in invTypes:
|
||||||
return True
|
return True
|
||||||
elif file == "dgmtypeattribs" and not row["typeID"] in invTypes:
|
elif file == "dgmtypeattribs" and not row["typeID"] in invTypes:
|
||||||
return True
|
return True
|
||||||
elif file == "invmetatypes" and not row["typeID"] in invTypes:
|
elif file == "invmetatypes" and not row["typeID"] in invTypes:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Loop through each json file and write it away, checking ignored rows
|
# Loop through each json file and write it away, checking ignored rows
|
||||||
for jsonName, table in data.iteritems():
|
for jsonName, table in data.iteritems():
|
||||||
fieldMap = fieldMapping.get(jsonName, {})
|
fieldMap = fieldMapping.get(jsonName, {})
|
||||||
print "processing {}".format(jsonName)
|
print "processing {}".format(jsonName)
|
||||||
for row in table:
|
for row in table:
|
||||||
# We don't care about some kind of rows, filter it out if so
|
# We don't care about some kind of rows, filter it out if so
|
||||||
if not isIgnored(jsonName, row):
|
if not isIgnored(jsonName, row):
|
||||||
instance = tables[jsonName]()
|
instance = tables[jsonName]()
|
||||||
for k, v in row.iteritems():
|
for k, v in row.iteritems():
|
||||||
setattr(instance, fieldMap.get(k, k), v)
|
setattr(instance, fieldMap.get(k, k), v)
|
||||||
|
|
||||||
eos.db.gamedata_session.add(instance)
|
eos.db.gamedata_session.add(instance)
|
||||||
|
|
||||||
eos.db.gamedata_session.commit()
|
eos.db.gamedata_session.commit()
|
||||||
|
|
||||||
print("done")
|
print("done")
|
||||||
|
|||||||
Reference in New Issue
Block a user