Add runtimes to command effects (defaulting to normal)
This commit is contained in:
@@ -81,15 +81,6 @@ class Fit(object):
|
||||
|
||||
self.build()
|
||||
|
||||
def addCommandBonus(self, warfareBuffID, value, module, effect):
|
||||
# oh fuck this is so janky
|
||||
# @todo should we pass in min/max to this function, or is abs okay?
|
||||
# (abs is old method, ccp now provides the aggregate function in their data)
|
||||
print "Add command bonus: ", warfareBuffID, " - value: ", value
|
||||
|
||||
if warfareBuffID not in self.commandBonuses or abs(self.commandBonuses[warfareBuffID][0]) < abs(value):
|
||||
self.commandBonuses[warfareBuffID] = (value, module, effect)
|
||||
|
||||
@reconstructor
|
||||
def init(self):
|
||||
"""Initialize a fit from the database and validate"""
|
||||
@@ -454,11 +445,23 @@ class Fit(object):
|
||||
def getOrigin(self):
|
||||
return self.__origin
|
||||
|
||||
def __runCommandBoosts(self):
|
||||
def addCommandBonus(self, warfareBuffID, value, module, effect, runTime="normal"):
|
||||
# oh fuck this is so janky
|
||||
# @todo should we pass in min/max to this function, or is abs okay?
|
||||
# (abs is old method, ccp now provides the aggregate function in their data)
|
||||
print "Add command bonus: ", warfareBuffID, " - value: ", value
|
||||
|
||||
if warfareBuffID not in self.commandBonuses or abs(self.commandBonuses[warfareBuffID][0]) < abs(value):
|
||||
self.commandBonuses[warfareBuffID] = (runTime, value, module, effect)
|
||||
|
||||
def __runCommandBoosts(self, runTime="normal"):
|
||||
logger.debug("Applying gang boosts for %r", self)
|
||||
for warfareBuffID, info in self.commandBonuses.iteritems():
|
||||
# Unpack all data required to run effect properly
|
||||
value, thing, effect = info
|
||||
effect_runTime, value, thing, effect = info
|
||||
|
||||
if runTime != effect_runTime:
|
||||
continue
|
||||
|
||||
context = ("commandRun", thing.__class__.__name__.lower())
|
||||
if isinstance(thing, Module):
|
||||
@@ -614,7 +617,7 @@ class Fit(object):
|
||||
print self.commandBonuses
|
||||
|
||||
if not withBoosters and self.commandBonuses:
|
||||
self.__runCommandBoosts()
|
||||
self.__runCommandBoosts(runTime)
|
||||
|
||||
timer.checkpoint('Done with runtime: %s'%runTime)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user