def __init__(self, client, player, msg):
        super().__init__(client)
        self.id = 20103
        self.player = player
        self.msg = msg
        self.fingerprint = Fingerprint.loadFinger_full("GameAssets/fingerprint.json")

        """
        << Error Code List >>
        # 1  = Custom Message
        # 7  = Patch
        # 8  = Update Available
        # 9  = Redirect
        # 10 = Maintenance
        # 11 = Banned
        # 13 = Acc Locked PopUp
        # 16 = Updating Cr/Maintenance/Too high version
        # 18 = Chinese Text?

        """

        if self.player.err_code == 7 or self.player.err_code == 8:
            self.isPatching = True
        else:
            self.isPatching = False
Пример #2
0
 def __init__(self, client, player, msg):
     super().__init__(client)
     self.id = 20103
     self.player = player
     self.msg = msg
     self.fingerprint = Fingerprint.loadFinger_full(
         "GameAssets/fingerprint.json")
     """
Пример #3
0
    def encode(self):
        self.writeInt(self.player.err_code)  # error code
        self.writeString(
            Fingerprint.loadFinger_full(
                "GameAssets/fingerprint.json"))  # fingerprint

        self.writeString()  # null

        self.writeString(self.player.patch_url)  # patch url
        self.writeString(self.player.update_url)  # update url
        self.writeString(self.msg)  # message

        self.writeHexa('''00 00 00 00 00 FF FF FF FF 00 00 00 02''')  # unknown

        self.writeString(self.player.patch_url)  # patch url
        self.writeString()  # rackcdn url

        self.writeInt(0)
        self.writeInt(0)  # time left ?

        self.writeString()  # null
        self.writeString()  # null

        self.writeHexa('''02 00 00 00 00 00 00 00 00 00''')  # unknown
Пример #4
0
class Players:
    config = open('config.json', 'r')
    content = config.read()
    settings = json.loads(content)

    # Player data
    high_id = 0
    low_id = 0
    token = "None"
    IsFacebookLinked = 0
    FacebookID = "None"
    FacebookToken = "None"
    box_id = 0
    map_id = 7
    slot_index = 0
    room_id = 0
    brawler_id = 0
    skin_id = 0

    # Socket
    ClientDict = {}

    # Brawler data
    skins_id = Skins.get_skins_id()
    brawlers_id = Characters.get_brawlers_id()
    card_skills_id = Cards.get_spg_id()
    card_unlock_id = Cards.get_brawler_unlock()

    # General player (Brawler, Currency, etc..)
    UnlockType = settings['UnlockedBrawlersOption']
    BrawlersDict = json.loads(json.dumps(settings['UnlockedBrawler'][0]))
    BrawlersUnlockedState = {}

    if UnlockType == "All":
        for i in brawlers_id:
            BrawlersUnlockedState[str(i)] = 1
    elif UnlockType == "SpecifiedOnly":
        index = 0
        for brawlers_name in BrawlersDict:
            BrawlersUnlockedState[str(index)] = BrawlersDict[brawlers_name]
            if index == 34:
                index += 3
            elif index == 32:
                index += 2
            else:
                index += 1
    elif UnlockType == "StarterOnly":
        starter = [0, 1, 2, 3, 7, 8, 9, 14, 22, 27, 30]
        for i in brawlers_id:
            if i in starter:
                BrawlersUnlockedState[str(i)] = 1
            else:
                BrawlersUnlockedState[str(i)] = 0

    brawler_power_level = settings['BrawlerPowerLevel']
    brawler_trophies_for_rank = settings['BrawlerTrophiesForRank']
    brawler_trophies = settings['BrawlerTrophies']
    brawler_upgrade_points = settings['BrawlerUpgradePoints']
    brawlers_spg_unlock = {}  # For starpower and gadget
    gadget = 255
    starpower = 76

    brawlers_trophies = {}
    for id in brawlers_id:
        brawlers_trophies.update({f'{id}': brawler_trophies_for_rank})

    brawlers_skins = {}
    for id in brawlers_id:
        brawlers_skins.update({f'{id}': 0})

    name = "Guest"
    player_experience = 0
    profile_icon = 0
    name_color = 0
    do_not_distrub = 0
    brawl_boxes = settings['BrawlBoxTokens']
    big_boxes = settings['BigBoxTokens']
    star_points = settings['Starpoints']
    highest_trophies = 0
    trophies = settings['Trophies']
    solo_wins = 0
    duo_wins = 0
    ThreeVSThree_wins = 0
    gems = settings['Gems']
    gold = settings['Gold']
    tickets = settings['Tickets']
    tokensdoubler = 0
    player_tokens = 0

    # Alliances
    club_high_id = 0
    club_low_id = 0
    club_role = 0

    # Message stuff...
    update_url = settings['UpdateUrl']
    patch_url = settings['PatchUrl']
    patch_sha = Fingerprint.loadFinger("GameAssets/fingerprint.json")
    maintenance_time = 0

    err_code = 7
    maintenance = False
    patch = False

    if settings['Patch']:
        error_code = 7
        patch = True

    if settings['Maintenance']:
        err_code = 10
        maintenance = True
        maintenance_time = settings['MaintenanceTime']

    # Chat data
    message_tick = 0
    bot_message_tick = 0

    brawlers_trophies_in_rank = {
        '0': brawler_trophies_for_rank,
        '1': brawler_trophies_for_rank,
        '2': brawler_trophies_for_rank,
        '3': brawler_trophies_for_rank,
        '4': brawler_trophies_for_rank,
        '5': brawler_trophies_for_rank,
        '6': brawler_trophies_for_rank,
        '7': brawler_trophies_for_rank,
        '8': brawler_trophies_for_rank,
        '9': brawler_trophies_for_rank,
        '10': brawler_trophies_for_rank,
        '11': brawler_trophies_for_rank,
        '12': brawler_trophies_for_rank,
        '13': brawler_trophies_for_rank,
        '14': brawler_trophies_for_rank,
        '15': brawler_trophies_for_rank,
        '16': brawler_trophies_for_rank,
        '17': brawler_trophies_for_rank,
        '18': brawler_trophies_for_rank,
        '19': brawler_trophies_for_rank,
        '20': brawler_trophies_for_rank,
        '21': brawler_trophies_for_rank,
        '22': brawler_trophies_for_rank,
        '23': brawler_trophies_for_rank,
        '24': brawler_trophies_for_rank,
        '25': brawler_trophies_for_rank,
        '26': brawler_trophies_for_rank,
        '27': brawler_trophies_for_rank,
        '28': brawler_trophies_for_rank,
        '29': brawler_trophies_for_rank,
        '30': brawler_trophies_for_rank,
        '31': brawler_trophies_for_rank,
        '32': brawler_trophies_for_rank,
        '34': brawler_trophies_for_rank,
        '37': brawler_trophies_for_rank
    }

    brawlers_upgradium = {
        '0': brawler_upgrade_points,
        '1': brawler_upgrade_points,
        '2': brawler_upgrade_points,
        '3': brawler_upgrade_points,
        '4': brawler_upgrade_points,
        '5': brawler_upgrade_points,
        '6': brawler_upgrade_points,
        '7': brawler_upgrade_points,
        '8': brawler_upgrade_points,
        '9': brawler_upgrade_points,
        '10': brawler_upgrade_points,
        '11': brawler_upgrade_points,
        '12': brawler_upgrade_points,
        '13': brawler_upgrade_points,
        '14': brawler_upgrade_points,
        '15': brawler_upgrade_points,
        '16': brawler_upgrade_points,
        '17': brawler_upgrade_points,
        '18': brawler_upgrade_points,
        '19': brawler_upgrade_points,
        '20': brawler_upgrade_points,
        '21': brawler_upgrade_points,
        '22': brawler_upgrade_points,
        '23': brawler_upgrade_points,
        '24': brawler_upgrade_points,
        '25': brawler_upgrade_points,
        '26': brawler_upgrade_points,
        '27': brawler_upgrade_points,
        '28': brawler_upgrade_points,
        '29': brawler_upgrade_points,
        '30': brawler_upgrade_points,
        '31': brawler_upgrade_points,
        '32': brawler_upgrade_points,
        '34': brawler_upgrade_points,
        '37': brawler_upgrade_points
    }

    Brawler_level = {
        '0': brawler_power_level,
        '1': brawler_power_level,
        '2': brawler_power_level,
        '3': brawler_power_level,
        '4': brawler_power_level,
        '5': brawler_power_level,
        '6': brawler_power_level,
        '7': brawler_power_level,
        '8': brawler_power_level,
        '9': brawler_power_level,
        '10': brawler_power_level,
        '11': brawler_power_level,
        '12': brawler_power_level,
        '13': brawler_power_level,
        '14': brawler_power_level,
        '15': brawler_power_level,
        '16': brawler_power_level,
        '17': brawler_power_level,
        '18': brawler_power_level,
        '19': brawler_power_level,
        '20': brawler_power_level,
        '21': brawler_power_level,
        '22': brawler_power_level,
        '23': brawler_power_level,
        '24': brawler_power_level,
        '25': brawler_power_level,
        '26': brawler_power_level,
        '27': brawler_power_level,
        '28': brawler_power_level,
        '29': brawler_power_level,
        '30': brawler_power_level,
        '31': brawler_power_level,
        '32': brawler_power_level,
        '34': brawler_power_level,
        '37': brawler_power_level
    }

    # Friendly game (Teams, info, result)
    battle_result = 0
    game_type = 0
    use_gadget = 1
    rank = 0
    team = 0
    isReady = 0

    bot1 = 0
    bot1_n = None
    bot2 = 0
    bot2_n = None
    bot3 = 0
    bot3_n = None
    bot4 = 0
    bot4_n = None
    bot5 = 0
    bot5_n = None

    def CreateNewBrawlersList():
        Players.BrawlersUnlockedState = {}
        for id in Players.brawlers_id:
            if id == 0:
                Players.BrawlersUnlockedState[str(id)] = 1
            else:
                Players.BrawlersUnlockedState[str(id)] = 0
        return Players.BrawlersUnlockedState

    def __init__(self, device):
        self.device = device
Пример #5
0
class Player:
    try:
        config = open('config.json', 'r')
        content = config.read()
    except FileNotFoundError:
        Helpers().create_config()
        config = open('config.json', 'r')
        content = config.read()

    settings = json.loads(content)

    skins_id = Skins().get_skins_id()
    brawlers_id = Characters().get_brawlers_id()

    ID = 0
    token = None

    trophies = settings['Trophies']
    tickets = settings['Tickets']
    gems = settings['Gems']
    resources = [{
        'ID': 1,
        'Amount': settings['BrawlBoxTokens']
    }, {
        'ID': 8,
        'Amount': settings['Gold']
    }, {
        'ID': 9,
        'Amount': settings['BigBoxTokens']
    }, {
        'ID': 10,
        'Amount': settings['StarPoints']
    }]
    high_trophies = 999999
    trophy_reward = 300
    exp_points = settings['ExperiencePoints']
    profile_icon = 0
    name_color = 0
    selected_brawler = 0
    region = settings['Region']
    content_creator = "Modern Brawl"
    name_set = False
    name = 'Guest'
    map_id = 0
    use_gadget = True
    starpower = 76
    gadget = 255
    home_brawler = 0
    home_skin = 0
    leaderboard_type = 0
    leaderboard_is_global = False
    bp_activated = False
    token_doubler = 0
    welcome_msg_viewed = False
    theme_id = settings['ThemeID']
    content_creator_codes = settings['ContentCreatorCodes']
    maintenance = settings['Maintenance']
    maintenance_time = settings['SecondsTillMaintenanceOver']
    patch = settings['Patch']
    patch_url = settings['PatchURL']
    patch_sha = Fingerprint.loadFinger("GameAssets/fingerprint.json")
    update_url = settings['UpdateURL']

    delivery_items = {}
    box_rewards = {}

    db = None

    battle_tick = 0

    emotes_id = Emotes().get_emotes_id()

    unlocked_skins = skins_id

    selected_skins = {}
    for id in brawlers_id:
        selected_skins.update({f"{id}": 0})

    brawlers_unlocked = [0, 1]

    brawlers_card_id = []
    for x in brawlers_unlocked:
        brawlers_card_id.append(Cards().get_unlock_by_brawler_id(x))

    brawlers_spg = Cards().get_spg_id()

    def_trophies = 0
    def_high_trophies = 99999

    brawlers_trophies = {}
    for x in brawlers_id:
        brawlers_trophies.update({f'{x}': def_trophies})

    brawlers_high_trophies = {}
    for x in brawlers_id:
        brawlers_high_trophies.update({f'{x}': def_high_trophies})

    def_level = 0

    brawlers_level = {}
    for x in brawlers_id:
        brawlers_level.update({f'{x}': def_level})

    def_pp = 0

    brawlers_powerpoints = {}
    for x in brawlers_id:
        brawlers_powerpoints.update({f'{x}': def_pp})

    club_id = 0
    club_role = 0

    message_tick = 0

    clients = {}

    def __init__(self, device):
        self.device = device
Пример #6
0
class Players:

    try:
        config = open('config.json', 'r')
        content = config.read()
    except FileNotFoundError:
        print("Creating config.json...")
        Config.create_config()
        config = open('config.json', 'r')
        content = config.read()

    settings = json.loads(content)

    HighID = 0
    LowID = 0
    Token = None
    boxID = 0
    mapID = 7
    roomID = 0
    brawlerID = 0
    skinID = 0

    SkinsCount = Skins.get_skins_id()
    BrawlersCount = Characters.get_brawlers_id()
    CardSkillsID = Cards.get_spg_id()
    CardUnlockID = Cards.get_brawler_unlock()

    brawler_power_level = settings['BrawlerPowerLevel']
    brawler_trophies_for_rank = settings['BrawlerTrophiesForRank']
    brawler_trophies = settings['BrawlerTrophies']
    brawler_upgrade_points = settings['BrawlerUpgradePoints']
    trophies = settings['Trophies']
    gems = settings['Gems']
    gold = settings['Gold']
    tickets = settings['Tickets']
    name = None
    profileIcon = 0
    brawlBoxes = settings['BrawlBoxTokens']
    bigBoxes = settings['BigBoxTokens']
    starPoints = settings['Starpoints']

    Resources = {
        'brawlbox': {
            'id': 1,
            'amount': brawlBoxes
        },
        'gold': {
            'id': 8,
            'amount': gold
        },
        'bigbox': {
            'id': 9,
            'amount': bigBoxes
        },
        'starpoints': {
            'id': 10,
            'amount': starPoints
        },
    }

    updateUrl = settings['UpdateUrl']
    patchUrl = settings['PatchUrl']
    patch_sha = Fingerprint.loadFinger("GameAssets/fingerprint.json")

    err_code = 7
    maintenance = False
    patch = False

    patching = settings['Patch']

    if patching:
        error_code = 7
        patch = True

    if settings['Maintenance']:
        err_code = 10
        maintenance = True

    messageTick = 0
    botMessageTick = 0

    shellySkin = 0
    nitaSkin = 0
    coltSkin = 0
    bullSkin = 0
    jessieSkin = 0
    brockSkin = 0
    dynamikeSkin = 0
    boSkin = 0
    elprimoSkin = 0
    barleySkin = 0
    pocoSkin = 0
    ricoSkin = 0
    darrylSkin = 0
    pennySkin = 0
    piperSkin = 0
    pamSkin = 0
    frankSkin = 0
    mortisSkin = 0
    taraSkin = 0
    spikeSkin = 0
    crowSkin = 0
    geneSkin = 0
    tickSkin = 0
    leonSkin = 0
    rosaSkin = 0
    carlSkin = 0
    bibiSkin = 0
    bitSkin = 0
    sandySkin = 0
    beaSkin = 0
    emzSkin = 0
    mrpSkin = 0
    maxSkin = 0
    jackySkin = 0
    galeSkin = 0
    naniSkin = 0
    sproutSkin = 0
    gadget = 255
    starpower = 76
    namecolor = 12
    GameType = 0
    Rank = 0
    Team = 0
    Bot1 = 0
    Bot1N = None
    Bot2 = 0
    Bot2N = None
    Bot3 = 0
    Bot3N = None
    Bot4 = 0
    Bot4N = None
    Bot5 = 0
    Bot5N = None
    useGadget = 1
    DoNotDistrub = 0

    def __init__(self, device):
        self.device = device
Пример #7
0
class Players:
    try:
        config = open('config.json', 'r')
        content = config.read()
    except FileNotFoundError:
        print("Creating config.json...")
        Config.create_config()
        config = open('config.json', 'r')
        content = config.read()

    settings = json.loads(content)

    # Player data
    high_id = 0
    low_id = 0
    token = None
    box_id = 0
    map_id = 7
    room_id = 0
    brawler_id = 0
    skin_id = 0

    # Brawler data
    skins_id = Skins.get_skins_id()
    brawlers_id = Characters.get_brawlers_id()
    card_skills_id = Cards.get_spg_id()
    card_unlock_id = Cards.get_brawler_unlock()
    brawler_power_level = settings['BrawlerPowerLevel']
    brawler_trophies_for_rank = settings['BrawlerTrophiesForRank']
    brawler_trophies = settings['BrawlerTrophies']
    brawler_upgrade_points = settings['BrawlerUpgradePoints']
    gadget = 255
    starpower = 76

    brawlers_trophies = {}
    for id in brawlers_id:
        brawlers_trophies.update({f'{id}': brawler_trophies_for_rank})

    brawlers_skins = {}
    for id in brawlers_id:
        brawlers_skins.update({f'{id}': 0})

    # Player info
    name = "Guest"
    profile_icon = 0
    name_color = 0
    do_not_distrub = 0
    brawl_boxes = settings['BrawlBoxTokens']
    big_boxes = settings['BigBoxTokens']
    star_points = settings['Starpoints']
    trophies = settings['Trophies']
    gems = settings['Gems']
    gold = settings['Gold']
    tickets = settings['Tickets']

    # Server config
    update_url = settings['UpdateUrl']
    patch_url = settings['PatchUrl']
    patch_sha = Fingerprint.loadFinger("GameAssets/fingerprint.json")

    err_code = 7
    maintenance = False
    patch = False

    patching = settings['Patch']

    if patching:
        error_code = 7
        patch = True

    if settings['Maintenance']:
        err_code = 10
        maintenance = True

    # Chat data
    message_tick = 0
    bot_message_tick = 0

    # Friendly game data & info
    battle_result = 0
    game_type = 0
    use_gadget = 1
    rank = 0
    team = 0

    bot1 = 0
    bot1_n = None
    bot2 = 0
    bot2_n = None
    bot3 = 0
    bot3_n = None
    bot4 = 0
    bot4_n = None
    bot5 = 0
    bot5_n = None

    def __init__(self, device):
        self.device = device