Implement working character associations with SSO character
This commit is contained in:
@@ -205,11 +205,14 @@ class HandledImplantBoosterList(HandledList):
|
||||
HandledList.append(self, thing)
|
||||
|
||||
|
||||
class HandledSsoCharacterList(HandledList):
|
||||
class HandledSsoCharacterList(list):
|
||||
def append(self, character):
|
||||
for x in self:
|
||||
print(x)
|
||||
HandledList.append(self, character)
|
||||
old = next((x for x in self if x.client == character.client), None)
|
||||
if old is not None:
|
||||
pyfalog.warning("Removing SSO Character with same hash: {}".format(repr(old)))
|
||||
list.remove(self, old)
|
||||
|
||||
list.append(self, character)
|
||||
|
||||
|
||||
class HandledProjectedModList(HandledList):
|
||||
|
||||
@@ -163,6 +163,18 @@ class Character(object):
|
||||
def name(self, name):
|
||||
self.savedName = name
|
||||
|
||||
def setSsoCharacter(self, character, clientHash):
|
||||
if character is not None:
|
||||
self.__ssoCharacters.append(character)
|
||||
else:
|
||||
for x in self.__ssoCharacters:
|
||||
if x.client == clientHash:
|
||||
self.__ssoCharacters.remove(x)
|
||||
|
||||
|
||||
def getSsoCharacter(self, clientHash):
|
||||
return next((x for x in self.__ssoCharacters if x.client == clientHash), None)
|
||||
|
||||
@property
|
||||
def alphaCloneID(self):
|
||||
return self.__alphaCloneID
|
||||
|
||||
@@ -49,3 +49,9 @@ class SsoCharacter(object):
|
||||
self.accessTokenExpires - datetime.datetime.utcnow()
|
||||
).total_seconds()
|
||||
}
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return "SsoCharacter(ID={}, name={}, client={}) at {}".format(
|
||||
self.ID, self.characterName, self.client, hex(id(self))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user