Beispiel #1
0
    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()

        elif self.player.low_id != 0:

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

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

            LoginOkMessage(self.client, self.player).send()
            DataBase.loadAccount(self)  # load account
            OwnHomeDataMessage(self.client, self.player).send()
            MyAllianceMessage(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).send()
Beispiel #2
0
    def process(self):
        if self.major != 26:
            LoginFailedMessage(
                self.client, self.player,
                "The server does not support your version").send()

        elif self.player.LowID != 0:

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

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

            LoginOkMessage(self.client, self.player).send()
            DataBase.loadAccount(self)  # load account
            OwnHomeDataMessage(self.client, self.player).send()
            MyAllianceMessage(self.client, self.player).send()
            if self.player.DoNotDistrub == 1:
                DoNotDistrubOkMessage(self.client, self.player).send()
            if self.player.roomID > 0:
                TeamGameroomDataMessage(self.client, self.player).send()

        else:
            self.player.LowID = Helpers.randomID(self)
            self.player.HighID = 0
            self.player.Token = Helpers.randomStringDigits(self)
            LoginOkMessage(self.client, self.player).send()
            OwnHomeDataMessage(self.client, self.player).send()
            MyAllianceMessage(self.client, self.player).send()
class LoginMessage(Reader):
    def __init__(self, client, player, initial_bytes):
        super().__init__(initial_bytes)
        self.player = player
        self.client = client
        self.helpers = Helpers()

    def decode(self):

        self.account_id = self.readLong()
        self.account_token = self.readString()
        self.game_major = self.readInt()
        self.game_minor = self.readInt()
        self.game_build = self.readInt()

        self.fingerprint_sha = self.readString()

    def process(self, db):

        if self.player.maintenance:
            self.player.err_code = 10
            LoginFailedMessage(self.client, self.player, '').send()

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

        if self.account_id == 0:
            self.player.ID = self.helpers.randomID()
            self.player.token = self.helpers.randomToken()
            db.create_player_account(self.player.ID, self.player.token)

        else:
            self.player.ID = self.account_id
            self.player.token = self.account_token

            player_data = db.load_player_account(self.player.ID,
                                                 self.player.token)

            if player_data:
                Helpers.load_account(self, player_data)
                club_data = db.load_club(self.player.club_id)
                Helpers.load_club(self, club_data)
            else:
                self.player.err_code = 1
                LoginFailedMessage(
                    self.client, self.player,
                    "Account not found in database!\nPlease clear app data."
                ).send()

        LoginOkMessage(self.client, self.player, self.player.ID,
                       self.player.token).send()
        OwnHomeDataMessage(self.client, self.player).send()

        if self.player.club_id != 0:
            club_data = db.load_club(self.player.club_id)
            MyAllianceMessage(self.client, self.player, club_data).send()
            AllianceStreamMessage(self.client, self.player,
                                  club_data['Messages']).send()
    def process(self):
        if self.player.LowID != 0:
            LoginOkMessage(self.client, self.player).send()
            DataBase.loadAccount(self)  # load account
            OwnHomeData(self.client, self.player).send()

        else:
            self.player.LowID = Helpers.randomID(self)
            self.player.HighID = 0
            self.player.Token = Helpers.randomStringDigits(self)
            LoginOkMessage(self.client, self.player).send()
            OwnHomeData(self.client, self.player).send()
Beispiel #5
0
    def process(self):
        if self.major != 27:
            LoginFailed(self.client, self.player).send()
        elif self.player.LowID != 0:
            LoginOk(self.client, self.player).send()
            DataBase.loadAccount(self)  # load account
            OwnHomeData(self.client, self.player).send()
            if self.player.DoNotDistrub == 1:
                DoNotDistrubServer(self.client, self.player).send()
            if self.player.roomID > 0:
                GameroomData(self.client, self.player).send()

        else:
            self.player.LowID = Helpers.randomID(self)
            self.player.HighID = 0
            self.player.Token = Helpers.randomStringDigits(self)
            LoginOk(self.client, self.player).send()
            OwnHomeData(self.client, self.player).send()
    def process(self, db):
        data = {
            "Name":
            self.club_name,
            "Description":
            self.club_desc,
            "Region":
            self.club_region,
            "BadgeID":
            self.club_badge,
            "Type":
            self.club_type,
            "Trophies":
            self.player.trophies,
            "RequiredTrophies":
            self.club_req_trophies,
            "FamilyFriendly":
            self.club_family_friendly,
            "Members": [{
                'Name': self.player.name,
                'ID': self.player.ID,
                'Role': 2,
                'Trophies': self.player.trophies,
                'ProfileIcon': self.player.profile_icon,
                'NameColor': self.player.name_color
            }],
            "Messages": []
        }

        self.player.club_id = Helpers.randomID(self)
        self.player.club_role = 2

        db.create_club(self.player.club_id, data)
        db.update_player_account(self.player.token, 'ClubID',
                                 self.player.club_id)
        db.update_player_account(self.player.token, 'ClubRole',
                                 self.player.club_role)

        club_data = db.load_club(self.player.club_id)

        MyAllianceMessage(self.client, self.player, club_data).send()
        AllianceResponseMessage(self.client, self.player, 20).send()
        AllianceDataMessage(self.client, self.player, club_data).send()