[REL] PA Chat

Discussion in 'Released Mods' started by cola_colin, January 29, 2015.

  1. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    PA Chat is part of PA Stats. Install PA Stats to use it. If you want PA Stats but not PA Chat you can disable the automatic join of a chat channel in the settings of PA Chat.

    So with Uber constantly ignoring the dire need for a global chat system this is the 2nd time I felt inclinded to tackle the issue to at least try and create something that can replace it at least a little. The old PA Stats irc button was clunky, this is now about making it much more userfriendly and integrate it as perfectly as possible with PA's existing social features, so I am trying to show my vision of what a good chat implementation might look like.
    @Sekuraz pointed me at the fact that Uber's xmpp backend, that is used for the private chats, is in fact fully capable of everything xmpp can do. (thanks!) This includes multiuser chatrooms. The only thing that is missing is the UI part inside of PA. Within the next few days this mod will replace the PA Stats IRC button. And to calm some people: PA Stats will include an option to disable the chat, if one wants to.

    That's where this mod comes in: It extends the existing uberbar to use Uber's xmpp backend for global chatrooms (fun fact: that server serves chats for toyrush as well as for SMNC, just PA is left out :S). Features so far:

    This is the main chatwindow. You can change the width by dragging the left border:
    [​IMG]

    The chatwindow marks normal users green, admins red and moderators blue. Within the text your own name is made white. The displayed time is formatted according to your local settings. It loads the last 100 messags from the xmpp server as chat history.

    The channel "halcyon" is automatically joined and opens like this:
    [​IMG]
    [​IMG]

    the chat supports auto complete of names via tab:
    [​IMG] press tab => [​IMG]

    If you have PA minimized and somebody writes your name in the chat PA will do this:
    [​IMG]

    [​IMG]
    this list of users shows the league of active ranked players. A tooltip shows their exact position in the ladder. The green marker shows the player is "online". A player whose uberbar is hidden due to being ingame will automatically be switched to a red marker.

    Ingame there is a marker on calling of name and private messages:[​IMG]
    if PA has no focus these also trigger this:[​IMG]
    double click chat lines to select them:[​IMG]

    the chat features context menus when you right click users names:
    [​IMG]

    the context menus allow to do stuff like friendinvites, game invites, block, unblock, private chat invite, private chat initiation

    blocking a user will hide all messages in the chatroom and grey out their name:
    [​IMG]
    Messages of admins or moderators cannot be blocked

    You can join more channels via this input:
    [​IMG]
    If a channel does not exist a temporary one will be created

    It is possible to login into the chat via any xmpp client, however it is a little technical to get right so far: https://forums.uberent.com/threads/wip-pa-chat.67603/#post-1062855

    Currently moderators and admins cannot actually do anything. To moderate channels (kick and ban users) it however is possible to use for example pidgin, ingame commands are in the works.



    the code is on github: https://github.com/pamods/PAChat/tree/master

    EDIT next version released, patchnotes:

    Thanks to @Sekuraz for his work on the admin features!

    - lots of new admin functions. Check /help on how to moderate channels. Channel owners are orange, channel admins are blue. owners > admins ;)
    - kick, mute and unmute are also available via the right click context menu
    - muted users are shown dark grey and cannot write anything in a given channel.
    - the ranked badge should now be much more reliable
    - messages that mention your name case insensitive have a red background
    - if you get a message mentioning your name while the chatwindow is minimized it will turn red instead of just green
    - tab autocomplete of names improved: now is case insensitive and can match with inner parts oof the string. So writing usern<tab> will autocomplete to [CLAN]UserName
    - show the number of people currently in the channel next to the channelname
    - you can now resize chats by dragging the right or left border
    - /alignleft and /alignright change the alignment of the chatwindow
    - stole the css improvements from palobby.com for your own name and the display of the time
    - autoscroll fix @masterdigital @jorgenpt in common.js there is a knockout handler for "autoscroll". It is rather hacky and fails on unusually large lines, so basically whenever somebody writes more than a 2 line long chattext. This happens not only in global chats, but also in private messages. This version of the handler fixes that issue and works without making guesses:
    Code:
        /**
        * scrolls to the bottom if the scrollable view was at the bottom before the value changed
        */
        ko.bindingHandlers.autoscroll = {
                init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
                    // right before the value changes, check if the parent of the element was scrolled to the bottom
                    var wasAtBottom = false;
                    valueAccessor().subscribe(function() {
                        if (!element || !element.parentNode)
                            return;
                        var p = element.parentNode;
                        wasAtBottom = p.scrollHeight - p.scrollTop === p.clientHeight;
                    }, null, "beforeChange");
               
                    // right after the value changed, if the parent of the element was scrolled to the bottom, scroll it to the bottom again
                    valueAccessor().subscribe(function (value) {
                        if (!element || !element.parentNode)
                            return;
                        if (wasAtBottom) {
                            element.scrollIntoView(true);
                        }
                    });
                }
            };
    
    - removed a bug that caused a massive message spam when using the chat invite function on users in a chatroom. This was also the cause of those chatwindows becoming uncloseable.
    - added command /tryfixfriends This will attempt to repopulate your friendlist from xmpp. Try to use this if your friendlist is suddenly empty. This is not a real fix to the problem, I don't know what the problem is. After using the command you may need to restart PA to see the full effects, not sure. It helped me at least...
    - removed cpu intense animations in the background of the main menu. No more cpu wasting just to stay in the main menu while chatting
    Last edited: February 10, 2015
    tatsujb, eukanuba, guest1 and 24 others like this.
  2. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    Holy sh!t !!!!
    Remy561, Raevn and stuart98 like this.
  3. mikeyh

    mikeyh Post Master General

    Messages:
    1,869
    Likes Received:
    1,509
    Snap. Global chat via the existing server was on my list for next weekend. :)
  4. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    lol
    well a few hours before you suddenly decided to reenable faster server browser a while ago, I had written this:
    [​IMG]
    so yeah... :p
  5. Sekuraz

    Sekuraz Member

    Messages:
    33
    Likes Received:
    20
    I hope uber will include some parts (if not all) of this mod in the core game!!
  6. xankar

    xankar Post Master General

    Messages:
    752
    Likes Received:
    1,004
    This is great, thanks a bunch ColaColin

    Also: - mark ingame users as "ingame" dis is good

    One last thing, will we be able to access this through an independent client?
    killerkiwijuice and stuart98 like this.
  7. Sekuraz

    Sekuraz Member

    Messages:
    33
    Likes Received:
    20
    You already can access the uber xmpp server as follows:
    1. Open PA and log in
    2. Start Coherent Debugger from PA_Dir\Coherent\Debugger\Debugger.exe (at least at my machine)
    3. Click Go (in the Debugger)
    4. Click on UberBar
    5. Click on Console
    6. type jabber.uberId()
    7. type jabber.jabberToken()
    8. use a xmpp client to log in to uberID@xmpp.uberent.com/PA with password jabberToken
    9. join the channel halcyon

    edit:
    the connection string in 8. reads as: user : uberID, domain/server : xmpp.uberent.com resource/chatroom : PA
    Last edited by a moderator: January 31, 2015
  8. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Half and half. As Sekuraz describes you can login, but apart from the rather userunfriendly way to get there you will see only uberids as usernames. PA handles the conversion.
    There are possibilities for sure though:
    - a pidgin plugin maybe?
    - extraction of the relevant UI from PA into for example PA Hub as a plugin, similar to how palobby.com or external UI work. The whole communication with xmpp is handled in javascript, so that won't be an issue technically.
    killerkiwijuice and xankar like this.
  9. xankar

    xankar Post Master General

    Messages:
    752
    Likes Received:
    1,004
    Well, couldn't manage to join using pidgin (might have been best to use a different client) but it's not of big importance. I'll just lie in wait for it to release and figure stuff out later.

    -I blame my lack of any actualy experience

    Edit: Got it working thanks to the help of Sekuraz
    Last edited: January 30, 2015
    killerkiwijuice likes this.
  10. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    the trick when you use pidgin is that you have to do the /PA part as "PA" in the "Resource" field
    killerkiwijuice likes this.
  11. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    This is great. Had fun adding a bot to the channel. Cool thing is I can now connect users in a PA Chat room to PAStats ID to eXodus profiles and thus fun stuff can happen.
    Automatically checking attendance of all players for a tournament / updating brackets with 1 button :)
    Seeding according to official ladder @cola_colin do you write ranking to somewhere I can capture ?
    guest1, mishtakashi, Quitch and 3 others like this.
  12. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I didn't think of that, but that is a good idea, I'll add it.
    xankar and killerkiwijuice like this.
  13. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Sweet this will add the possibility to seed with official ladder.
    xankar and killerkiwijuice like this.
  14. cwarner7264

    cwarner7264 Moderator Alumni

    Messages:
    4,460
    Likes Received:
    5,390
    You guys never cease to amaze me. We have some exceedingly talented modders in this community :)
    guest1, Remy561, squishypon3 and 2 others like this.
  15. Sekuraz

    Sekuraz Member

    Messages:
    33
    Likes Received:
    20
    @proeleert , please please please don`t let the bot spam in global chat, I can create a tournament channel for you, if you want. I especially hate those !twitch !ladder etc. in irc, because you can simply look it up with one click.
    killerkiwijuice likes this.
  16. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Yeah the bot will only run in tournament channel and only before and during a tournament.
    Just like eebot in the #patournaments irc channel. But with more functions.
    xankar, killerkiwijuice and Sekuraz like this.
  17. svenbrnn

    svenbrnn New Member

    Messages:
    6
    Likes Received:
    6
    The only problem with modding PA is that you have to find out everything by yourself since there is practicly no real documentation of the whole API :(.
    killerkiwijuice and Sekuraz like this.
  18. Sekuraz

    Sekuraz Member

    Messages:
    33
    Likes Received:
    20
    I was really worried that the bot turns out to be like Commander in irc, but if this "problem" is known, there is nothing to complain :D
    killerkiwijuice likes this.
  19. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    That's @yrrep 's bot.
    killerkiwijuice likes this.
  20. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    documentation of the API is for noobs anyway :p
    squishypon3, xankar, svenbrnn and 2 others like this.

Share This Page