Simplified boolean check
This commit is contained in:
@@ -105,7 +105,7 @@ class Booster(HandledItem, ItemAttrShortcut):
|
|||||||
|
|
||||||
def calculateModifiedAttributes(self, fit, runTime, forceProjected = False):
|
def calculateModifiedAttributes(self, fit, runTime, forceProjected = False):
|
||||||
if forceProjected: return
|
if forceProjected: return
|
||||||
if self.active == False: return
|
if not self.active: return
|
||||||
for effect in self.item.effects.itervalues():
|
for effect in self.item.effects.itervalues():
|
||||||
if effect.runTime == runTime and effect.isType("passive"):
|
if effect.runTime == runTime and effect.isType("passive"):
|
||||||
effect.handler(fit, self, ("booster",))
|
effect.handler(fit, self, ("booster",))
|
||||||
@@ -122,7 +122,7 @@ class Booster(HandledItem, ItemAttrShortcut):
|
|||||||
"active" : lambda val: isinstance(val, bool),
|
"active" : lambda val: isinstance(val, bool),
|
||||||
"slot" : lambda val: isinstance(val, int) and val >= 1 and val <= 3}
|
"slot" : lambda val: isinstance(val, int) and val >= 1 and val <= 3}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def __deepcopy__(self, memo):
|
def __deepcopy__(self, memo):
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class Cargo(HandledItem, ItemAttrShortcut):
|
|||||||
map = {"fitID": lambda val: isinstance(val, int),
|
map = {"fitID": lambda val: isinstance(val, int),
|
||||||
"itemID" : lambda val: isinstance(val, int)}
|
"itemID" : lambda val: isinstance(val, int)}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def __deepcopy__(self, memo):
|
def __deepcopy__(self, memo):
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ class Character(object):
|
|||||||
"apiKey" : lambda val: val is None or (isinstance(val, basestring) and len(val) > 0),
|
"apiKey" : lambda val: val is None or (isinstance(val, basestring) and len(val) > 0),
|
||||||
"ownerID" : lambda val: isinstance(val, int) or val is None}
|
"ownerID" : lambda val: isinstance(val, int) or val is None}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@@ -354,7 +354,7 @@ class Skill(HandledItem):
|
|||||||
map = {"characterID": lambda val: isinstance(val, int),
|
map = {"characterID": lambda val: isinstance(val, int),
|
||||||
"skillID" : lambda val: isinstance(val, int)}
|
"skillID" : lambda val: isinstance(val, int)}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def __deepcopy__(self, memo):
|
def __deepcopy__(self, memo):
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
"amount" : lambda val: isinstance(val, int) and val >= 0,
|
"amount" : lambda val: isinstance(val, int) and val >= 0,
|
||||||
"amountActive" : lambda val: isinstance(val, int) and val <= self.amount and val >= 0}
|
"amountActive" : lambda val: isinstance(val, int) and val <= self.amount and val >= 0}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
"amount" : lambda val: isinstance(val, int) and val >= -1,
|
"amount" : lambda val: isinstance(val, int) and val >= -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ class Fit(object):
|
|||||||
"ownerID" : lambda val: isinstance(val, int) or val is None,
|
"ownerID" : lambda val: isinstance(val, int) or val is None,
|
||||||
"shipID" : lambda val: isinstance(val, int) or val is None}
|
"shipID" : lambda val: isinstance(val, int) or val is None}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def clear(self, projected=False):
|
def clear(self, projected=False):
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Fleet(object):
|
|||||||
self.broken = True
|
self.broken = True
|
||||||
|
|
||||||
#Now calculate our own if we aren't broken
|
#Now calculate our own if we aren't broken
|
||||||
if self.broken == False:
|
if not self.broken:
|
||||||
#We only get our own bonuses *Sadface*
|
#We only get our own bonuses *Sadface*
|
||||||
store.apply(leader, "fleet")
|
store.apply(leader, "fleet")
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class Wing(object):
|
|||||||
self.broken = True
|
self.broken = True
|
||||||
|
|
||||||
#Check if we aren't broken, if we aren't, boost
|
#Check if we aren't broken, if we aren't, boost
|
||||||
if self.broken == False:
|
if not self.broken:
|
||||||
store.apply(leader, "wing")
|
store.apply(leader, "wing")
|
||||||
else:
|
else:
|
||||||
#We broke, don't go up
|
#We broke, don't go up
|
||||||
@@ -165,7 +165,7 @@ class Squad(object):
|
|||||||
if len(self.members) <= 0 or leader is None or leader.character is None or leader.character.getSkill("Leadership").level * 2 < len(self.members):
|
if len(self.members) <= 0 or leader is None or leader.character is None or leader.character.getSkill("Leadership").level * 2 < len(self.members):
|
||||||
self.broken = True
|
self.broken = True
|
||||||
|
|
||||||
if self.broken == False:
|
if not self.broken:
|
||||||
for member in self.members:
|
for member in self.members:
|
||||||
store.apply(member, "squad")
|
store.apply(member, "squad")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class Implant(HandledItem, ItemAttrShortcut):
|
|||||||
|
|
||||||
def calculateModifiedAttributes(self, fit, runTime, forceProjected = False):
|
def calculateModifiedAttributes(self, fit, runTime, forceProjected = False):
|
||||||
if forceProjected: return
|
if forceProjected: return
|
||||||
if self.active == False: return
|
if not self.active: return
|
||||||
for effect in self.item.effects.itervalues():
|
for effect in self.item.effects.itervalues():
|
||||||
if effect.runTime == runTime and effect.isType("passive"):
|
if effect.runTime == runTime and effect.isType("passive"):
|
||||||
effect.handler(fit, self, ("implant",))
|
effect.handler(fit, self, ("implant",))
|
||||||
@@ -97,7 +97,7 @@ class Implant(HandledItem, ItemAttrShortcut):
|
|||||||
"itemID" : lambda val: isinstance(val, int),
|
"itemID" : lambda val: isinstance(val, int),
|
||||||
"active": lambda val: isinstance(val, bool)}
|
"active": lambda val: isinstance(val, bool)}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def __deepcopy__(self, memo):
|
def __deepcopy__(self, memo):
|
||||||
|
|||||||
@@ -561,7 +561,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
"itemID" : lambda val: val is None or isinstance(val, int),
|
"itemID" : lambda val: val is None or isinstance(val, int),
|
||||||
"ammoID" : lambda val: isinstance(val, int)}
|
"ammoID" : lambda val: isinstance(val, int)}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
|
|||||||
@@ -50,5 +50,5 @@ class User(object):
|
|||||||
"password" : lambda val: isinstance(val, basestring) and len(val) == 96,
|
"password" : lambda val: isinstance(val, basestring) and len(val) == 96,
|
||||||
"admin" : lambda val: isinstance(val, bool)}
|
"admin" : lambda val: isinstance(val, bool)}
|
||||||
|
|
||||||
if map[key](val) == False: raise ValueError(str(val) + " is not a valid value for " + key)
|
if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key)
|
||||||
else: return val
|
else: return val
|
||||||
|
|||||||
Reference in New Issue
Block a user