Implement hard constraints for All 5/0 characters with respect to skills and sec status

This commit is contained in:
blitzmann
2017-05-08 19:47:55 -04:00
parent aecbf8f86e
commit 53f589284b
2 changed files with 20 additions and 2 deletions

View File

@@ -46,6 +46,7 @@ mapper(Character, characters_table,
properties={
"_Character__alphaCloneID": characters_table.c.alphaCloneID,
"savedName" : characters_table.c.name,
"_Character__secStatus": characters_table.c.secStatus,
"_Character__owner" : relation(
User,
backref="characters"),

View File

@@ -45,7 +45,7 @@ class Character(object):
self.__skillIdMap = {}
self.dirtySkills = set()
self.alphaClone = None
self.secStatus = 0.0
self.__secStatus = 0.0
if initSkills:
for item in self.getSkillList():
@@ -130,6 +130,18 @@ class Character(object):
def ro(self):
return self == self.getAll0() or self == self.getAll5()
@property
def secStatus(self):
if self.name == "All 5":
self.__secStatus = 5.00
elif self.name == "All 0":
self.__secStatus = 0.00
return self.__secStatus
@secStatus.setter
def owner(self, sec):
self.__secStatus = sec
@property
def owner(self):
return self.__owner
@@ -321,7 +333,12 @@ class Skill(HandledItem):
@property
def level(self):
if self.character.alphaClone:
# Ensure that All 5/0 character have proper skill levels (in case database gets corrupted)
if self.character.name == "All 5":
self.activeLevel = self.__level = 5
elif self.character.name == "All 0":
self.activeLevel = self.__level = 0
elif self.character.alphaClone:
return min(self.activeLevel, self.character.alphaClone.getSkillLevel(self)) or 0
return self.activeLevel or 0