Fix bug with char copy, and added char revert and save as (unfinished)

This commit is contained in:
blitzmann
2015-09-24 18:16:12 -04:00
parent ae870f9535
commit 61614553a2
4 changed files with 51 additions and 6 deletions

View File

@@ -199,6 +199,21 @@ class Character(object):
char = eos.db.getCharacter(charID)
char.saveLevels()
def saveCharacterAs(self, charID):
"""Save edited skills as a new character"""
char = eos.db.getCharacter(charID)
newChar = copy.deepcopy(char)
newChar.name = newChar.name + " (saved as)"
eos.db.save(newChar)
# revert old char
char.revertLevels()
def revertCharacter(self, charID):
"""Rollback edited skills"""
char = eos.db.getCharacter(charID)
char.revertLevels()
def getSkillGroups(self):
cat = eos.db.getCategory(16)
groups = []
@@ -251,7 +266,7 @@ class Character(object):
def getApiDetails(self, charID):
char = eos.db.getCharacter(charID)
if char.chars is not None:
if char.chars is not None:
chars = json.loads(char.chars)
else:
chars = None