lobby code suggestion about avatars

Moderator: keyser

lobby code suggestion about avatars

Postby Myxir » 22 Aug 2012, 18:51

uploaded a .py file in this post


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)
Attachments
avswitch.zip
rename to .py
(10.43 KiB) Downloaded 142 times
Last edited by Myxir on 24 Aug 2012, 23:06, edited 2 times in total.
Unhappy with balance http://i.imgur.com/q5G2BlM.png
User avatar
Myxir
Evaluator
 
Posts: 791
Joined: 09 Apr 2012, 14:01
Has liked: 94 times
Been liked: 306 times
FAF User Name: Washy (irc)

Re: lobby code suggestion about avatars

Postby pip » 22 Aug 2012, 19:56

I have not a single clue about programming, Java, Python, Boa or whatever, but it's nice to see someone actually attempting to help Zep to add features into the lobby. I hope this can work, that would be really nice!
pip
Supreme Commander
 
Posts: 1826
Joined: 04 Oct 2011, 15:33
Has liked: 191 times
Been liked: 86 times
FAF User Name: pip

Re: lobby code suggestion about avatars

Postby Ze_PilOt » 22 Aug 2012, 20:02

There is only one avatar sent by the server either way.

Also, your solution, if it was true, will only change the avatar for you (all the other will see whatever the server send first).
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: lobby code suggestion about avatars

Postby Myxir » 23 Aug 2012, 11:23

following the idea with the AvatarNumber the player can change himself, isn't it possible that the server will check this number before he will send the avatar?

i don't know where, but there must be a function checking if the player who's logging in is in the top 3 of his division/league, so adding another if-then which will decide whether to send the ranked avatar shouldn't be a big problem
Unhappy with balance http://i.imgur.com/q5G2BlM.png
User avatar
Myxir
Evaluator
 
Posts: 791
Joined: 09 Apr 2012, 14:01
Has liked: 94 times
Been liked: 306 times
FAF User Name: Washy (irc)

Re: lobby code suggestion about avatars

Postby Ze_PilOt » 23 Aug 2012, 11:27

All this require a nice user interface. There is none currently, so no, nothing of it is possible.

First thing to do is to implement :

- A function that request all the avatars for the users (like the admin function)
- A windows that display it all and send back to the server the infos.

And lot of work server-side.

If something copy the admin function for the user, but with a nicer interface, I can make the apprioriate function.
But now that the lobby is open sourced, someone must do all the lobby work, I don't have time for this.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt


Return to FAF Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest