Esempio n. 1
0
    def __updatePrebattleInvites(self, prbInvites):
        receiver = BigWorld.player().name
        receiverDBID = getPlayerDatabaseID()
        receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)
        added = []
        changed = []
        deleted = []
        modified = False
        rosterGetter = self.users.getUser
        for (prebattleID, peripheryID), data in prbInvites.iteritems():
            inviteID = self._makeInviteID(prebattleID, peripheryID)
            if data is None:
                if self._delInvite(inviteID):
                    modified = True
                    deleted.append(inviteID)
                continue
            invite = PrbInviteWrapper(id=inviteID,
                                      receiver=receiver,
                                      receiverDBID=receiverDBID,
                                      receiverClanAbbrev=receiverClanAbbrev,
                                      peripheryID=peripheryID,
                                      **data)
            inList = inviteID in self.__receivedInvites
            if not inList:
                if self._addInvite(invite, rosterGetter):
                    modified = True
                    added.append(inviteID)
            elif self._updateInvite(invite, rosterGetter):
                modified = True
                changed.append(inviteID)

        if modified:
            self.onReceivedInviteListModified(added, changed, deleted)
        return
Esempio n. 2
0
    def __updatePrebattleInvites(self, prbInvites):
        receiver = BigWorld.player().name
        receiverDBID = getPlayerDatabaseID()
        receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)
        added = []
        changed = []
        deleted = []
        modified = False
        rosterGetter = self.users.getUser
        for (prebattleID, peripheryID), data in prbInvites.iteritems():
            inviteID = self._makeInviteID(prebattleID, peripheryID)
            if data is None:
                if self._delInvite(inviteID):
                    modified = True
                    deleted.append(inviteID)
                continue
            invite = PrbInviteWrapper(id=inviteID, receiver=receiver, receiverDBID=receiverDBID, receiverClanAbbrev=receiverClanAbbrev, peripheryID=peripheryID, **data)
            inList = inviteID in self.__receivedInvites
            if not inList:
                if self._addInvite(invite, rosterGetter):
                    modified = True
                    added.append(inviteID)
            elif self._updateInvite(invite, rosterGetter):
                modified = True
                changed.append(inviteID)

        if modified:
            self.onReceivedInviteListModified(added, changed, deleted)
        return
Esempio n. 3
0
 def _buildReceivedInvitesList(self, invitesData):
     self.__isInvitesListBuild = True
     self.__receivedInvites.clear()
     self.__unreadInvitesCount = 0
     receiver = BigWorld.player().name
     receiverDBID = getPlayerDatabaseID()
     receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)
     userGetter = self.users.getUser
     for (prebattleID, peripheryID), data in invitesData.iteritems():
         inviteID = self._makeInviteID(prebattleID, peripheryID)
         invite = PrbInviteWrapper(id=inviteID, receiver=receiver, receiverDBID=receiverDBID, receiverClanAbbrev=receiverClanAbbrev, peripheryID=peripheryID, **data)
         self._addInvite(invite, userGetter)
Esempio n. 4
0
 def _buildReceivedInvitesList(self, invitesData):
     if self.__inited & PRB_INVITES_INIT_STEP.DATA_BUILD == 0:
         self.__inited |= PRB_INVITES_INIT_STEP.DATA_BUILD
     self.__receivedInvites.clear()
     self.__unreadInvitesCount = 0
     receiver = getattr(BigWorld.player(), 'name', '')
     receiverDBID = getPlayerDatabaseID()
     receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)
     userGetter = self.users.getUser
     for (prebattleID, peripheryID), data in invitesData.iteritems():
         inviteID = self._makeInviteID(prebattleID, peripheryID)
         invite = PrbInviteWrapper(id=inviteID, receiver=receiver, receiverDBID=receiverDBID, receiverClanAbbrev=receiverClanAbbrev, peripheryID=peripheryID, prebattleID=prebattleID, **data)
         self._addInvite(invite, userGetter)
Esempio n. 5
0
    def _getOldInviteMaker(self, rosterGetter):
        receiver = getPlayerName()
        receiverDBID = getPlayerDatabaseID()
        receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)

        def _inviteMaker(item):
            (prebattleID, peripheryID), data = item
            inviteID = self._makeInviteID(prebattleID, peripheryID, data['creatorDBID'], receiverDBID)
            if data is not None:
                invite = PrbInviteWrapper(clientID=inviteID, receiver=receiver, receiverDBID=receiverDBID, receiverClanAbbrev=receiverClanAbbrev, peripheryID=peripheryID, prebattleID=prebattleID, **data)
            else:
                invite = None
            return (inviteID, invite)

        return _inviteMaker
Esempio n. 6
0
    def _setClanInfo(self, clanInfo):
        self.__clanInfo = clanInfo
        if not self.__isUsersRostersInited:
            return
        receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)
        changed = []
        for inviteID, (invite, _) in self.__receivedInvites.iteritems():
            if invite.receiverClanAbbrev != receiverClanAbbrev:
                invite = invite._replace(receiverClanAbbrev=receiverClanAbbrev)
                link = self.__linkFormatter.format(invite)
                self.__receivedInvites[inviteID] = (invite, link)
                changed.append(inviteID)

        if len(changed) > 0:
            self.onReceivedInviteListModified([], changed, [])
Esempio n. 7
0
    def _setClanInfo(self, clanInfo):
        self.__clanInfo = clanInfo
        if not self.__isUsersRostersInited:
            return
        receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)
        changed = []
        for inviteID, (invite, _) in self.__receivedInvites.iteritems():
            if invite.receiverClanAbbrev != receiverClanAbbrev:
                invite = invite._replace(receiverClanAbbrev=receiverClanAbbrev)
                link = self.__linkFormatter.format(invite)
                self.__receivedInvites[inviteID] = (invite, link)
                changed.append(inviteID)

        if len(changed) > 0:
            self.onReceivedInviteListModified([], changed, [])
Esempio n. 8
0
 def _buildReceivedInvitesList(self, invitesData):
     self.__isInvitesListBuild = True
     self.__receivedInvites.clear()
     self.__unreadInvitesCount = 0
     receiver = BigWorld.player().name
     receiverDBID = getPlayerDatabaseID()
     receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)
     userGetter = self.users.getUser
     for (prebattleID, peripheryID), data in invitesData.iteritems():
         inviteID = self._makeInviteID(prebattleID, peripheryID)
         invite = PrbInviteWrapper(id=inviteID,
                                   receiver=receiver,
                                   receiverDBID=receiverDBID,
                                   receiverClanAbbrev=receiverClanAbbrev,
                                   peripheryID=peripheryID,
                                   **data)
         self._addInvite(invite, userGetter)
Esempio n. 9
0
    def _getOldInviteMaker(self, rosterGetter):
        receiver = getPlayerName()
        receiverDBID = getPlayerDatabaseID()
        receiverClanAbbrev = g_lobbyContext.getClanAbbrev(self.__clanInfo)

        def _inviteMaker(item):
            (prebattleID, peripheryID), data = item
            inviteID = self._makeInviteID(prebattleID, peripheryID,
                                          data['creatorDBID'], receiverDBID)
            if data is not None:
                invite = PrbInviteWrapper(
                    clientID=inviteID,
                    receiver=receiver,
                    receiverDBID=receiverDBID,
                    receiverClanAbbrev=receiverClanAbbrev,
                    peripheryID=peripheryID,
                    prebattleID=prebattleID,
                    **data)
            else:
                invite = None
            return (inviteID, invite)

        return _inviteMaker
Esempio n. 10
0
 def getClanAbbrev(self):
     return g_lobbyContext.getClanAbbrev(self.clanInfo)
Esempio n. 11
0
 def getClanAbbrev(self):
     return g_lobbyContext.getClanAbbrev(self.clanInfo)