def encode(self):
        DataBase.CountClub(self, 1, 100, 2, 50)

        self.writeVint(self.AllianceCount)

        for i in self.club_list:
            DataBase.loadClub(self, i)
            self.writeInt(0)  # ClubHighID
            self.writeInt(i)  # ClubLowID
            self.writeString(self.clubName)  # Club name

            self.writeVint(8)  # BadgeID type
            self.writeVint(self.clubbadgeID)  # Club badge number

            self.writeVint(self.clubtype)  # Club type

            self.writeVint(self.clubmembercount)  # Member count

            self.writeVint(self.clubtrophies)  # Trophies total
            self.writeVint(self.clubtrophiesneeded)  # Trophies needed
            self.writeVint(0)  # Unknown

            self.writeString(self.clubregion)  # Region
            self.writeVint(self.clubmembercount)  # Members online
            self.writeVint(self.clubfriendlyfamily)  # Family friendly
Exemplo n.º 2
0
    def process(self):

        # Removing member
        DataBase.loadClub(self, self.player.club_low_id)

        if self.clubmembercount == 1:
            DataBase.AddMember(self, self.player.club_low_id,
                               self.player.low_id, self.player.name, 0)

        else:
            DataBase.AddMember(self, self.player.club_low_id,
                               self.player.low_id, self.player.name, 2)
            DataBase.Addmsg(self, self.player.club_low_id, 4, 0,
                            self.player.low_id, self.player.name,
                            self.player.club_role, 4)

        # Info

        AllianceLeaveOkMessage(self.client, self.player).send()
        MyAllianceMessage(self.client, self.player, 0).send()
        for player in self.plrids:
            if player != self.player.low_id:
                AllianceDataMessage(
                    self.client, self.player, 0,
                    self.player.club_low_id).sendWithLowID(player)
                AllianceChatServerMessage(self.client, self.player,
                                          4).sendWithLowID(player)

        DataBase.replaceValue(self, 'clubID', 0)
        self.player.club_low_id = 0
        DataBase.replaceValue(self, 'clubRole', 0)
        self.player.club_role = 0
Exemplo n.º 3
0
    def encode(self):
        DataBase.CountClub(self, 1, 100, 2, 30)
        self.writeString(self.requestedName)
        self.writeVint(self.count)

        for i in self.club_list:
            if self.requestedName.lower() in self.club_data[self.club_list.index(i)]['name'].lower():
                DataBase.loadClub(self, i)
                self.writeInt(0)  # ClubHighID
                self.writeInt(i)  # ClubLowID
                self.writeString(self.clubName)  # Club name

                self.writeVint(8)  # BadgeID type
                self.writeVint(self.clubbadgeID)  # Club badge number

                self.writeVint(self.clubtype)  # Club type

                self.writeVint(self.clubmembercount)  # Member count

                self.writeVint(self.clubtrophies)  # Trophies total
                self.writeVint(self.clubtrophiesneeded)  # Trophies needed
                self.writeVint(0)  # Unknown

                self.writeString(self.clubregion)  # Region
                self.writeVint(self.clubmembercount)  # Members online
                self.writeVint(self.clubfriendlyfamily)  # Family friendly
    def encode(self):
        DataBase.loadClub(self, self.clubLowID)

        if self.player.club_low_id != 0:
            self.writeVint(0)
        else:
            self.writeVint(2)

        # ClubID
        self.writeInt(0)  # Club high id
        self.writeInt(self.clubLowID)  # Club low id

        self.writeString(self.clubName)  # Club name

        # Badge
        self.writeVint(8)
        self.writeVint(self.clubbadgeID)  # Club badge id

        # Club settings
        self.writeVint(
            self.clubtype)  # Club type [1 = open, 2 = invite only, 3 = closed]
        self.writeVint(len(self.plrids))  # Club members count

        # Club trophies
        self.writeVint(self.clubtrophies)  # Club total trophies
        self.writeVint(self.clubtrophiesneeded)  # Club required trophies

        # Club Info
        self.writeVint(0)
        self.writeString(self.clubregion)  # Region
        self.writeVint(0)
        self.writeVint(
            self.clubfriendlyfamily
        )  # Family friendly status | 0 = Can be activated, 1 = Activated

        self.writeString(self.clubdescription)  # Description

        # Members list
        self.writeVint(len(self.plrids))  # Members list count

        for id in self.plrids:
            DataBase.GetMemberData(self, id)

            self.writeInt(0)  # High Id
            self.writeInt(id)  # Low Id

            self.writeVint(
                self.plrrole
            )  # player club role | 0 = Nothing, 1 = Member, 2 = President, 3 = Senior, 4 = Vice President
            self.writeVint(self.plrtrophies)  # trophies
            self.writeVint(
                8
            )  # Player states | 0 = last online 1 hour ago, 1 = battling, 2 = menu, 4 = matchmaking, 6 = last online 1 month ago, 7 = spectating, 8 = practicing
            self.writeVint(0)  # Player states Timer
            self.writeVint(0)
            self.writeString(self.plrname)
            self.writeVint(self.plrexperience)
            self.writeVint(28000000 + self.plricon)
            self.writeVint(43000000 + self.plrnamecolor)
    def encode(self):
        self.indexOfPlayer = 1

        self.writeInt(len(self.players))  # Playera Count
        for player in self.players:
            if player["lowID"] == self.player.low_id:
                self.indexOfPlayer = self.players.index(player) + 1

            self.writeInt(0)  # Games Played Together Recently

            self.writeInt(0)  # HighID
            self.writeInt(player["lowID"])  # LowID

            self.writeString()
            self.writeString()
            self.writeString()
            self.writeString()
            self.writeString()
            self.writeString()

            self.writeInt(
                player['trophies']
            )  # Friend state 0 = friend, 1 = not friend, 2 = request sent, 3 = you have an invite from him??, 4 = friend list
            self.writeInt(4)
            self.writeInt(0)
            self.writeInt(0)
            self.writeInt(0)

            if player["clubID"] != 0:
                DataBase.loadClub(self, player["clubID"])

                self.writeBoolean(True)  # Is in club

                self.writeInt(0)
                self.writeInt(0)
                self.writeInt(0)
                self.writeString(self.clubName)
                self.writeInt(0)
                self.writeInt(0)

            else:
                self.writeBoolean(False)  # Is in club

            self.writeString()
            self.writeInt(0)

            self.writeBoolean(True)  # ?? is a player?

            self.writeString(player['name'])
            self.writeVint(100)
            self.writeVint(28000000 + player["profileIcon"])
            self.writeVint(43000000 + player["namecolor"])
Exemplo n.º 6
0
    def process(self):
        if self.IsAcmd == False:
            DataBase.Addmsg(self, 2, 0, self.player.low_id, self.player.name,
                            self.player.club_role, self.msg)
            DataBase.loadClub(self, self.player.club_low_id)
            for i in self.plrids:
                AllianceChatServerMessage(self.client, self.player,
                                          self.msg).sendWithLowID(i)

        if self.bot_msg != '':
            AllianceBotChatServerMessage(self.client, self.player,
                                         self.bot_msg).send()

        if self.send_ofs:
            OutOfSyncMessage(self.client, self.player,
                             'Changes have been applied').send()
Exemplo n.º 7
0
    def process(self):
        self.player.club_role = 1
        DataBase.replaceValue(self, 'clubRole', 1)
        DataBase.replaceValue(self, 'clubID', self.player.club_low_id)

        # Member adding
        DataBase.AddMember(self, self.player.club_low_id, self.player.low_id,
                           self.player.name, 1)
        DataBase.Addmsg(self, self.player.club_low_id, 4, 0,
                        self.player.low_id, self.player.name,
                        self.player.club_role, 3)

        # Info
        AllianceJoinOkMessage(self.client, self.player).send()
        MyAllianceMessage(self.client, self.player,
                          self.player.club_low_id).send()
        AllianceStreamMessage(self.client, self.player,
                              self.player.club_low_id, 0).send()
        DataBase.loadClub(self, self.player.club_low_id)
        for i in self.plrids:
            AllianceChatServerMessage(self.client, self.player,
                                      3).sendWithLowID(i)
Exemplo n.º 8
0
    def encode(self):
        self.indexOfClub = 0
        self.writeVint(2)
        self.writeVint(0)
        self.writeVint(0)
        self.writeString(self.player.region)  # Player Region

        DataBase.CountClub(self, 1, 100, 2, 200)

        def by_trophy(club):
            print(club)
            return club['trophies']

        self.writeVint(self.AllianceCount)
        self.club_data.sort(key=by_trophy, reverse=True)

        for club in self.club_data:
            if club["clubID"] == self.player.club_low_id:
                self.indexOfClub = self.club_data.index(club) + 1
            DataBase.loadClub(self, club['clubID'])
            self.writeVint(0)  # Club High ID
            self.writeVint(club['clubID'])  # Club Low ID

            self.writeVint(1)
            self.writeVint(self.clubtrophies)  # Club Trophies
            self.writeVint(2)

            self.writeString(self.clubName)  # Club Name
            self.writeVint(self.clubmembercount)  # Club Members Count

            self.writeVint(8)  # Club Badge
            self.writeVint(self.clubbadgeID)  # Club Name Color

        self.writeVint(0)
        self.writeVint(self.indexOfClub)  # Index of the club
        self.writeVint(0)
        self.writeVint(0)
        self.writeString(self.player.region)
Exemplo n.º 9
0
    def encode(self):
        if self.clubid != 0:
            DataBase.loadClub(self, self.clubid)
            self.writeVint(self.clubmembercount)
            self.writeVint(1)
            self.writeVint(25)

            self.writeVint(self.player.club_role)

            # Club info
            self.writeInt(0)  # Club high id
            self.writeInt(self.clubid)  # Club low id
            self.writeString(self.clubName)  # Club name

            # Badge
            self.writeVint(8)
            self.writeVint(self.clubbadgeID)  # Club badge id

            # Club settings
            self.writeVint(self.clubtype)  # Club type
            self.writeVint(self.clubmembercount)  # Club members count

            # Club trophies
            self.writeVint(self.clubtrophies)  # Club total trophies
            self.writeVint(self.clubtrophiesneeded)  # Club required trophies

            self.writeVint(0)
            self.writeString(self.clubregion)  # Region

            self.writeVint(0)
            self.writeVint(
                self.clubfriendlyfamily
            )  # Family friendly status | 0 = Can be activated, 1 = Activated

        else:
            self.writeVint(0)
            self.writeVint(0)
    def encode(self):
        self.indexOfPlayer = 1
        self.writeBoolean(True)
        self.writeVint(0)
        self.writeVint(0)
        self.writeString()

        self.writeVint(len(self.players))  # Players Count

        for player in self.players:
            if player["lowID"] == self.player.low_id:
                self.indexOfPlayer = self.players.index(player) + 1
            self.writeVint(0)  # High ID
            self.writeVint(player["lowID"])  # Low ID

            self.writeVint(1)
            self.writeVint(player['trophies'])  # Player Trophies

            self.writeVint(1)

            if player["clubID"] != 0:
                DataBase.loadClub(self, player["clubID"])
                self.writeString(self.clubName)
            else:
                self.writeString()

            self.writeString(player['name'])  # Player Name
            self.writeVint(player['playerExp'])  # Player Level
            self.writeVint(28000000 + player['profileIcon'])
            self.writeVint(43000000 + player['namecolor'])
            self.writeVint(0)

        self.writeVint(0)
        self.writeVint(self.indexOfPlayer)
        self.writeVint(0)
        self.writeVint(0)  # Leaderboard global TID
        self.writeString(self.player.region)
Exemplo n.º 11
0
    def encode(self):
        self.writeVint(2)
        self.writeVint(0)
        self.writeVint(0)
        self.writeString()

        DataBase.CountClub(self, 1, 100, 2, 200)

        def by_trophy(club):
            print(club)
            return club['trophies']

        self.writeVint(self.AllianceCount)
        self.club_data.sort(key=by_trophy, reverse=True)

        for club in self.club_data:
            DataBase.loadClub(self, club['clubID'])
            self.writeVint(0)  # Club High ID
            self.writeVint(club['clubID'])  # Club Low ID

            self.writeVint(1)
            self.writeVint(self.clubtrophies)  # Club Trophies
            self.writeVint(2)

            self.writeString(self.clubName)  # Club Name
            self.writeVint(self.clubmembercount)  # Club Members Count

            self.writeVint(8)  # Club Badge
            self.writeVint(self.clubbadgeID)  # Club Name Color

        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)

        self.writeString("RO")
Exemplo n.º 12
0
    def encode(self):
        for player in self.players:
            if self.low_id == player["lowID"]:
                self.UnlockedBrawlersList = []
                for brawler_id in player["UnlockedBrawlers"]:
                    if player["UnlockedBrawlers"][str(brawler_id)] == 1:
                        self.UnlockedBrawlersList.append(int(brawler_id))

                self.writeVint(self.high_id)  # High Id
                self.writeVint(self.low_id)  # Low Id
                self.writeVint(0)  # Unknown

                self.writeVint(len(
                    self.UnlockedBrawlersList))  # Brawlers array

                for brawler_id in self.UnlockedBrawlersList:
                    self.writeScId(16, int(brawler_id))
                    self.writeVint(0)
                    self.writeVint(player["brawlersTrophiesForRank"][str(
                        brawler_id)])  # Trophies for rank
                    self.writeVint(player["brawlersTrophies"][str(
                        brawler_id)])  # Trophies
                    self.writeVint(player["brawlerPowerLevel"][str(
                        brawler_id)])  # power lvl

                self.writeVint(15)

                self.writeVint(1)
                self.writeVint(player["3vs3Wins"])  # 3v3 victories

                self.writeVint(2)
                self.writeVint(player["playerExp"])  # Player experience

                self.writeVint(3)
                self.writeVint(player["trophies"])  # Trophies

                self.writeVint(4)
                self.writeVint(player["highesttrophies"])  # Highest trophies

                self.writeVint(5)
                self.writeVint(len(self.UnlockedBrawlersList))  # Brawlers list

                self.writeVint(7)
                self.writeVint(28000000 +
                               player["profileIcon"])  # Profile icon??

                self.writeVint(8)
                self.writeVint(player["soloWins"])  # Solo victories

                self.writeVint(9)
                self.writeVint(794)  # Best robo rumble time

                self.writeVint(10)
                self.writeVint(794)  # Best time as big brawler

                self.writeVint(11)
                self.writeVint(player["duoWins"])  # Duo victories

                self.writeVint(12)
                self.writeVint(20)  # Highest boss fight lvl passed

                self.writeVint(13)
                self.writeVint(1246)  # Highest power player points

                self.writeVint(14)
                self.writeVint(1)  # Highest power play rank

                self.writeVint(15)
                self.writeVint(15)  # most challenge wins

                self.writeVint(16)
                self.writeVint(20)

                self.writeString(player["name"])
                self.writeVint(100)
                self.writeVint(28000000 +
                               player["profileIcon"])  # Profile icon
                self.writeVint(43000000 + player["namecolor"])  # Name color

                if player["clubID"] != 0:
                    DataBase.loadClub(self, player["clubID"])

                    self.writeBoolean(True)  # Is in club

                    self.writeInt(0)
                    self.writeInt(player["clubID"])
                    self.writeString(self.clubName)  # club name
                    self.writeVint(8)
                    self.writeVint(self.clubbadgeID)  # Club badgeID
                    self.writeVint(
                        self.clubtype
                    )  # club type | 1 = Open, 2 = invite only, 3 = closed
                    self.writeVint(
                        self.clubmembercount)  # Current members count
                    self.writeVint(self.clubtrophies)
                    self.writeVint(self.clubtrophiesneeded)  # Trophy required
                    self.writeVint(0)  # (Unknown)
                    self.writeString(self.clubregion)  # region
                    self.writeVint(0)  # (Unknown)
                    self.writeVint(0)  # (Unknown)
                    self.writeVint(25)
                    self.writeVint(player["clubRole"])
                else:
                    self.writeVint(0)
                    self.writeVint(0)