i honestly have no idea where to post code suggestions so i just post it in general discussions, sadly i also don't know how to test my idea :/
since many people complain "i don't want a ranked avatar but keeping my own" and whatsoever, i've taken a look into the lobby code and have an idea:
(i've only looked into the code for few hours and i'm looking at python for the first time, so i'm not quite sure if it works like i imagine)
as it looks, this code decides if you have an avatar, and will use the ranked avatar if you got two
- Code: Select all
def updateAvatar(self):
self.avatarTip = self.avatar["tooltip"]
url = self.avatar["url"]
avatarPix = util.respix(url)
if avatarPix :
self.avatarItem.setIcon(QtGui.QIcon(avatarPix))
self.avatarItem.setToolTip(self.avatarTip)
else :
if util.addcurDownloadAvatar(url, self.name) :
self.nam = QNetworkAccessManager()
self.nam.finished.connect(self.lobby.finishDownloadAvatar)
self.nam.get(QNetworkRequest(QtCore.QUrl(url)))
self.avatarItem.setToolTip(self.avatarTip)
so, adding an "avatar choice number" to each player which will decide which avatar will be loaded:
- Code: Select all
def updateAvatar(self):
self.avatarTip = self.avatar["tooltip"]
url = self.avatar["url"]
avatarPix = util.respix(url)
if avatarPix :
self.avatarItem.setIcon(QtGui.QIcon(avatarPix))
self.avatarItem.setToolTip(self.avatarTip)
else :
if util.addcurDownloadAvatar(url, self.name) :
if [playeravatarnumber] == 1:
self.nam = QNetworkAccessManager()
self.nam.finished.connect(self.lobby.finishDownloadAvatar)
self.nam.get(QNetworkRequest(QtCore.QUrl(url)))
self.avatarItem.setToolTip(self.avatarTip)
and players beeing able to decide their avatar:
- Code: Select all
# Avatar settings
if self.lobby.client.login != self.name:
actionChangeAvatarNumber.setDisabled(1)
# Actions for the Friend List
actionAddFriend = QtGui.QAction("Add friend", menu)
actionRemFriend = QtGui.QAction("Remove friend", menu)
# Don't allow self to be added or removed from friends
if self.lobby.client.login == self.name:
actionAddFriend.setDisabled(1)
actionRemFriend.setDisabled(1)
# Enable / Disable actions according to friend status
if self.lobby.client.isFriend(self.name):
actionAddFriend.setDisabled(1)
else :
actionRemFriend.setDisabled(1)
the thing left here would be to add an AvatarChoiceNumber for each player which will get saved (so the right avatar will be loaded after you relog) and very little coding to add a function which makes the AvatarChoiceNumber change between two values (like 0 and 1)