Exemple #1
0
 def encode(self):
     DataBase.GetmsgCount(self, self.player.club_low_id)
     db = TinyDB('Database/Club/chat.db')
     query = Query()
     data = db.search(query.clubID == self.player.club_low_id)
     data = data[0]
     self.writeVint(data['info'][str(self.MessageCount)]['Event'])
     self.writeVint(0)
     self.writeVint(self.MessageCount + 1)
     self.writeVint(0)
     self.writeVint(data['info'][str(self.MessageCount)]['PlayerID'])
     self.writeString(data['info'][str(self.MessageCount)]['PlayerName'])
     self.writeVint(data['info'][str(self.MessageCount)]['PlayerRole'])
     self.writeVint(0)
     self.writeVint(0)
     if data['info'][str(self.MessageCount)]['Event'] == 4:
         self.writeVint(
             data['info'][str(self.MessageCount)]['Message']
         )  # 1 = Kicked, 2 = Join request accepted, 3 = Join the club, 4 = Leave the club
         self.writeVint(1)
         self.writeVint(0)
         self.writeVint(data['info'][str(self.MessageCount)]['PlayerID'])
         self.writeString(data['info'][str(
             self.MessageCount)]['PlayerName'])
     else:
         self.writeString(data['info'][str(self.MessageCount)]['Message'])
Exemple #2
0
 def encode(self):
     DataBase.GetmsgCount(self, self.player.club_low_id)
     self.writeVint(2)
     self.writeVint(0)
     self.writeVint(self.MessageCount)
     self.writeVint(1)
     self.writeVint(1)
     self.writeString("Club Bot")
     self.writeVint(3)
     self.writeVint(0)
     self.writeVint(0)
     self.writeString(self.bot_msg_content)
    def process(self):
        if self.major != 26:
            self.player.err_code = 8
            LoginFailedMessage(
                self.client, self.player,
                "Your client is outdated, click below to download the new version!"
            ).send()

        if self.player.maintenance:
            LoginFailedMessage(self.client, self.player, "").send()

        if self.fingerprint_sha != self.player.patch_sha and self.player.patch:
            LoginFailedMessage(self.client, self.player, "").send()

        elif self.player.low_id != 0:
            LoginOkMessage(self.client, self.player).send()
            DataBase.loadAccount(self)  # load account
            OwnHomeDataMessage(self.client, self.player).send()
            try:
                MyAllianceMessage(self.client, self.player,
                                  self.player.club_low_id).send()
                AllianceStreamMessage(self.client, self.player,
                                      self.player.club_low_id, 0).send()
                DataBase.GetmsgCount(self, self.player.club_low_id)
            except:
                MyAllianceMessage(self.client, self.player, 0).send()
                AllianceStreamMessage(self.client, self.player, 0, 0).send()
            FriendListMessage(self.client, self.player).send()

            if self.player.do_not_distrub == 1:
                DoNotDistrubOkMessage(self.client, self.player).send()
            if self.player.room_id > 0:
                TeamGameroomDataMessage(self.client, self.player).send()

        else:
            self.player.low_id = Helpers.randomID(self)
            self.player.high_id = 0
            self.player.token = Helpers.randomStringDigits(self)

            LoginOkMessage(self.client, self.player).send()
            OwnHomeDataMessage(self.client, self.player).send()
            MyAllianceMessage(self.client, self.player,
                              self.player.club_low_id).send()