Jump to content
Korean Random
Vampire_BY

Онлайн игроков в клане.

Recommended Posts

Может кто знает как вывести сколько человек онлайн в клане.

p.s Глаза уже слипаются не могу найти нужную часть кода (нашел ID игроков клана общий список и т.д но только не то что надо )

 

Если нет конкретного решения, подскажите в каких файлах искать если есть идеи.

Edited by DannyGreene

Share this post


Link to post

Short link
Share on other sites

в каких файлах искать если есть идеи.

В таких случаях можно отталкиваться от файлов локализации.

 

tooltips.mo:

...
msgid "Contact/status/online"
msgstr "В сети"
...
Значит возможно в питоне/AS3 есть строка, содержащая #tooltips:Contact/status/online

 

В нашем случае мы находим эту строку в файле tooltips.py

Вот она:

CONTACT_STATUS_ONLINE = '#tooltips:Contact/status/online'

 

Теперь ищем строку CONTACT_STATUS_ONLINE

Находим её в файле contacts_vo_converter.py

...
def makeContactStatusDescription(isOnline, tags, clientInfo = None):
    name, description = ('', '')
    if isOnline:
        if clientInfo:
            gameHost = clientInfo.gameHost
            arenaLabel = clientInfo.arenaLabel
        else:
            gameHost, arenaLabel = ('', '')
        if gameHost:
            item = g_preDefinedHosts.byUrl(gameHost)
            name = item.shortName or item.name
        if USER_TAG.PRESENCE_DND in tags:
            key = None
            if arenaLabel:
                key = TOOLTIPS.contact_status_inbattle(arenaLabel)
            if not key:
                key = TOOLTIPS.CONTACT_STATUS_INBATTLE_UNKNOWN
            description = i18n.makeString(key)
        else:
            description = i18n.makeString(TOOLTIPS.CONTACT_STATUS_ONLINE)
        if name:
            description = '{0}, {1}'.format(description, name)
    return description
...
Далее ищем использование функции makeContactStatusDescription

находим её в common.py

...

Edited by ShadowHunterRUS
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

Может кто знает как вывести сколько человек онлайн в клане.

from messenger.MessengerEntry import g_instance as msgEntry

uStorage = msgEntry.protos.XMPP.contacts.usersStorage

class ClanFindCriteria(object):
    def filter(self, entity):
        return "ownClanMember" in entity.getTags() and entity.isOnline()

players = len(uStorage.getList(ClanFindCriteria()))

players - твой онлайн.

  • Upvote 2

Share this post


Link to post

Short link
Share on other sites
from messenger.MessengerEntry import g_instance as msgEntry

uStorage = msgEntry.protos.XMPP.contacts.usersStorage

class ClanFindCriteria(object):
    def filter(self, entity):
        return "ownClanMember" in entity.getTags() and entity.isOnline()

players = len(uStorage.getList(ClanFindCriteria()))

players - твой онлайн.

 

 

спасибо, актуальный пример.

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...