Merge branch 'master' into wx3
Conflicts: gui/characterEditor.py
This commit is contained in:
@@ -171,32 +171,49 @@ class Character(object):
|
||||
thread.start()
|
||||
|
||||
def all0(self):
|
||||
all0 = eos.types.Character.getAll0()
|
||||
eos.db.commit()
|
||||
return all0
|
||||
return eos.types.Character.getAll0()
|
||||
|
||||
def all0ID(self):
|
||||
return self.all0().ID
|
||||
|
||||
def all5(self):
|
||||
all5 = eos.types.Character.getAll5()
|
||||
eos.db.commit()
|
||||
return all5
|
||||
return eos.types.Character.getAll5()
|
||||
|
||||
def all5ID(self):
|
||||
return self.all5().ID
|
||||
|
||||
def getCharacterList(self):
|
||||
baseChars = [eos.types.Character.getAll0(), eos.types.Character.getAll5()]
|
||||
# Flush incase all0 & all5 weren't in the db yet
|
||||
eos.db.commit()
|
||||
sFit = service.Fit.getInstance()
|
||||
return map(lambda c: (c.ID, c.name, c == sFit.character), eos.db.getCharacterList())
|
||||
|
||||
return map(lambda c: (c.ID, c.name if not c.isDirty else "{} *".format(c.name), c == sFit.character), eos.db.getCharacterList())
|
||||
|
||||
def getCharacter(self, charID):
|
||||
char = eos.db.getCharacter(charID)
|
||||
return char
|
||||
|
||||
def saveCharacter(self, charID):
|
||||
"""Save edited skills"""
|
||||
if charID == self.all5ID() or charID == self.all0ID():
|
||||
return
|
||||
char = eos.db.getCharacter(charID)
|
||||
char.saveLevels()
|
||||
|
||||
def saveCharacterAs(self, charID, newName):
|
||||
"""Save edited skills as a new character"""
|
||||
char = eos.db.getCharacter(charID)
|
||||
newChar = copy.deepcopy(char)
|
||||
newChar.name = newName
|
||||
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 = []
|
||||
@@ -221,20 +238,23 @@ class Character(object):
|
||||
|
||||
def getSkillLevel(self, charID, skillID):
|
||||
skill = eos.db.getCharacter(charID).getSkill(skillID)
|
||||
return skill.level if skill.learned else "Not learned"
|
||||
return (skill.level if skill.learned else "Not learned", skill.isDirty)
|
||||
|
||||
def rename(self, charID, newName):
|
||||
char = eos.db.getCharacter(charID)
|
||||
char.name = newName
|
||||
eos.db.commit()
|
||||
def getDirtySkills(self, charID):
|
||||
return eos.db.getCharacter(charID).dirtySkills
|
||||
|
||||
def getCharName(self, charID):
|
||||
return eos.db.getCharacter(charID).name
|
||||
|
||||
def new(self):
|
||||
char = eos.types.Character("New Character")
|
||||
eos.db.save(char)
|
||||
return char.ID
|
||||
|
||||
def getCharName(self, charID):
|
||||
return eos.db.getCharacter(charID).name
|
||||
def rename(self, charID, newName):
|
||||
char = eos.db.getCharacter(charID)
|
||||
char.name = newName
|
||||
eos.db.commit()
|
||||
|
||||
def copy(self, charID):
|
||||
char = eos.db.getCharacter(charID)
|
||||
@@ -259,7 +279,7 @@ class Character(object):
|
||||
id, key, default, _ = self.getApiDetails(charID)
|
||||
return id is not "" and key is not "" and default is not ""
|
||||
|
||||
def charList(self, charID, userID, apiKey):
|
||||
def apiCharList(self, charID, userID, apiKey):
|
||||
char = eos.db.getCharacter(charID)
|
||||
|
||||
char.apiID = userID
|
||||
@@ -298,7 +318,7 @@ class Character(object):
|
||||
char.apiUpdateCharSheet(skills)
|
||||
eos.db.commit()
|
||||
|
||||
def changeLevel(self, charID, skillID, level):
|
||||
def changeLevel(self, charID, skillID, level, persist=False):
|
||||
char = eos.db.getCharacter(charID)
|
||||
skill = char.getSkill(skillID)
|
||||
if isinstance(level, basestring) or level > 5 or level < 0:
|
||||
@@ -306,8 +326,21 @@ class Character(object):
|
||||
else:
|
||||
skill.level = level
|
||||
|
||||
if persist:
|
||||
skill.saveLevel()
|
||||
|
||||
eos.db.commit()
|
||||
|
||||
def revertLevel(self, charID, skillID):
|
||||
char = eos.db.getCharacter(charID)
|
||||
skill = char.getSkill(skillID)
|
||||
skill.revert()
|
||||
|
||||
def saveSkill(self, charID, skillID):
|
||||
char = eos.db.getCharacter(charID)
|
||||
skill = char.getSkill(skillID)
|
||||
skill.saveLevel()
|
||||
|
||||
def addImplant(self, charID, itemID):
|
||||
char = eos.db.getCharacter(charID)
|
||||
implant = eos.types.Implant(eos.db.getItem(itemID))
|
||||
|
||||
@@ -932,21 +932,32 @@ class Fit(object):
|
||||
self.checkStates(fit, base)
|
||||
|
||||
# Old state : New State
|
||||
localMap = {State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.ONLINE,
|
||||
State.OFFLINE: State.ONLINE,
|
||||
State.ONLINE: State.ACTIVE}
|
||||
projectedMap = {State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.OFFLINE,
|
||||
State.OFFLINE: State.ACTIVE,
|
||||
State.ONLINE: State.ACTIVE} # Just in case
|
||||
localMap = {
|
||||
State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.ONLINE,
|
||||
State.OFFLINE: State.ONLINE,
|
||||
State.ONLINE: State.ACTIVE}
|
||||
projectedMap = {
|
||||
State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.OFFLINE,
|
||||
State.OFFLINE: State.ACTIVE,
|
||||
State.ONLINE: State.ACTIVE} # Just in case
|
||||
# For system effects. They should only ever be online or offline
|
||||
projectedSystem = {
|
||||
State.OFFLINE: State.ONLINE,
|
||||
State.ONLINE: State.OFFLINE}
|
||||
|
||||
def __getProposedState(self, mod, click, proposedState=None):
|
||||
if mod.slot is Slot.SUBSYSTEM or mod.isEmpty:
|
||||
if mod.slot == Slot.SUBSYSTEM or mod.isEmpty:
|
||||
return State.ONLINE
|
||||
|
||||
if mod.slot == Slot.SYSTEM:
|
||||
transitionMap = self.projectedSystem
|
||||
else:
|
||||
transitionMap = self.projectedMap if mod.projected else self.localMap
|
||||
|
||||
currState = mod.state
|
||||
transitionMap = self.projectedMap if mod.projected else self.localMap
|
||||
|
||||
if proposedState is not None:
|
||||
state = proposedState
|
||||
elif click == "right":
|
||||
|
||||
@@ -233,8 +233,6 @@ class Market():
|
||||
"Mobile Decoy Unit": False, # Seems to be left over test mod for deployables
|
||||
"Tournament Micro Jump Unit": False, # Normally seen only on tournament arenas
|
||||
"Council Diplomatic Shuttle": False, # CSM X celebration]
|
||||
"Imp": False, # AT13 prize
|
||||
"Fiend": False, # AT13 prize
|
||||
}
|
||||
|
||||
# do not publish ships that we convert
|
||||
|
||||
Reference in New Issue
Block a user