def process(self): TeamLeftMessage(self.client, self.player).sendWithLowID(self.player.low_id) DataBase.replaceGameroomValue(self, str(self.player.room_id), self.player.low_id, "removePlayer") DataBase.replaceValue(self, 'roomID', self.player.room_id) self.player.room_id = 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
def res(type): if type == 0 or type == 2: newGems = self.player.gems - cost self.player.gems = newGems DataBase.replaceValue(self, 'gems', newGems) elif type == 3: newStarPoints = self.player.star_points - cost self.player.star_points = newStarPoints DataBase.replaceValue(self, 'starpoints', newStarPoints)
def process(self): cost = Shop.gold[self.gold]['Cost'] value = Shop.gold[self.gold]['Amount'] newGold = self.player.gold + value self.player.gold = newGold newGems = self.player.gems - cost self.player.gems = newGems DataBase.replaceValue(self, 'gold', newGold) DataBase.replaceValue(self, 'gems', newGems)
def process(self): cost = Shop.token_doubler['Cost'] value = Shop.token_doubler['Amount'] newGems = self.player.gems - cost self.player.gems = newGems DataBase.replaceValue(self, 'gems', newGems) newTokens = self.player.tokens + value self.player.tokens = newTokens DataBase.replaceValue(self, 'tokens', newTokens)
def process(self): DataBase.replaceValue(self, 'clubID', self.clubLowID) self.player.club_low_id = self.clubLowID DataBase.replaceValue(self, 'clubRole', 2) self.player.club_role = 2 # Club creation DataBase.createClub(self, self.clubLowID) # Club data AllianceJoinOkMessage(self.client, self.player).send() MyAllianceMessage(self.client, self.player, self.clubLowID).send()
def process(self): DataBase.replaceValue(self, 'skinID', self.player.skin_id) self.player.brawlers_skins[str( self.player.brawler_id)] = self.player.skin_id DataBase.replaceValue(self, 'brawlersSkins', self.player.brawlers_skins) self.player.starpower = Cards.get_spg_by_brawler_id( self, self.player.brawler_id, 4) self.player.gadget = Cards.get_spg_by_brawler_id( self, self.player.brawler_id, 5) DataBase.replaceValue(self, 'starpower', self.player.starpower) DataBase.replaceValue(self, 'gadget', self.player.gadget) DataBase.replaceValue(self, 'brawlerID', self.player.brawler_id)
def process(self): if self.csv_id == 29: self.player.brawler_id = Characters.get_brawler_by_skin_id( self, self.BrawlerSkinId) self.player.starpower = Cards.get_spg_by_brawler_id( self, self.player.brawler_id, 4) self.player.gadget = Cards.get_spg_by_brawler_id( self, self.player.brawler_id, 5) else: self.player.starpower = self.StarpowerID self.player.gadget = Cards.get_spg_by_brawler_id( self, self.player.brawler_id, 5) DataBase.replaceValue(self, 'starpower', self.player.starpower) DataBase.replaceValue(self, 'gadget', self.player.gadget) DataBase.UpdateGameroomPlayerInfo(self, self.player.low_id) TeamGameroomDataMessage(self.client, self.player).send()
def process(self): self.player.IsFacebookLinked = 1 DataBase.replaceValue(self, 'isFBLinked', 1) DataBase.replaceValue(self, 'facebookID', self.player.FacebookID) DataBase.replaceValue(self, 'facebookToken', self.player.FacebookToken) FacebookBindOKMessage(self.client, self.player).send()
def process(self): if self.player.box_id == 5: DataBase.replaceValue(self, 'brawlBoxes', self.player.brawl_boxes - 100) LogicBoxDataCommand(self.client, self.player).send() elif self.player.box_id == 4: DataBase.replaceValue(self, 'bigBoxes', self.player.big_boxes - 10) LogicBoxDataCommand(self.client, self.player).send() elif self.player.box_id == 3: DataBase.replaceValue(self, 'gems', self.player.gems - 80) LogicBoxDataCommand(self.client, self.player).send() elif self.player.box_id == 2: DataBase.replaceValue(self, 'gems', self.player.gems - 30) LogicBoxDataCommand(self.client, self.player).send()
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)
def process(self): if self.player.IsFacebookLinked == 1: self.player.IsFacebookLinked = 0 DataBase.replaceValue(self, 'isFBLinked', 0) DataBase.replaceValue(self, 'facebookID', "None") DataBase.replaceValue(self, 'facebookToken', "None") FBAccountDisconnectedOKMessage(self.client, self.player).send()
def get_id(id): if id == 5: # Brawl Box DataBase.replaceValue(self, 'brawlBoxes', self.player.brawl_boxes - 100) return 10 elif id == 4: # Big Box self.box_index = 1 DataBase.replaceValue(self, 'bigBoxes', self.player.big_boxes - 10) return 12 elif id == 3: # Shop Mega Box self.box_index = 3 DataBase.replaceValue(self, 'gems', self.player.gems - 80) return 11 elif id == 1: # Shop Big Box self.box_index = 2 DataBase.replaceValue(self, 'gems', self.player.gems - 30) return 12
def get_id(id): if id == 5: # Brawl Box return 10 elif id == 4: # Big Box self.box_index = 1 return 12 elif id == 3: # Shop Mega Box self.box_index = 3 DataBase.replaceValue(self, 'gems', self.player.gems - 80) return 11 elif id == 1: # Shop Big Box self.box_index = 2 DataBase.replaceValue(self, 'gems', self.player.gems - 30) return 12 elif id == 6: # Trophy Road Brawl Box DataBase.replaceValue(self, 'leagueReward', self.player.trophyroad + 1) return 10
def process(self): self.player.Brawler_level[str(self.BrawlerID)] += 1 DataBase.replaceValue(self, 'brawlerPowerLevel', self.player.Brawler_level)
def encode(self): self.writeVint(201) self.writeString(self.player.name) self.writeVint(self.state) DataBase.replaceValue(self, 'name', self.player.name)
def process(self): self.player.room_id = random.randint(0, 2147483647) DataBase.replaceValue(self, 'roomID', self.player.room_id) DataBase.createGameroomDB(self) TeamGameroomDataMessage(self.client, self.player).send()
def encode(self): # Stuff brawler_trophies = self.player.brawlers_trophies[str(self.player.brawler_id)] brawler_trophies_for_rank = self.player.brawlers_trophies_in_rank[str(self.player.brawler_id)] if self.player.Brawler_starPower[str(self.player.brawler_id)] >= 1: brawler_level = self.player.Brawler_level[str(self.player.brawler_id)] + 2 else: brawler_level = self.player.Brawler_level[str(self.player.brawler_id)] + 1 # Rewards if self.player.tutorial <= 1: exp_reward = [0, 0, 0] token_list = [0, 0, 0] practice_exp_reward = [0, 0, 0] practice_token_list = [0, 0, 0] mvp_exp_reward = [0, 0] else: exp_reward = [8, 6, 4] token_list = [20, 15, 10] practice_exp_reward = [4, 3, 2] practice_token_list = [10, 8, 5] mvp_exp_reward = [10] # Trophy Balance if 0 <= brawler_trophies <= 49: win_val = 8 lose_val = 0 else: if 50 <= brawler_trophies <= 99: win_val = 8 lose_val = -1 if 100 <= brawler_trophies <= 199: win_val = 8 lose_val = -2 if 200 <= brawler_trophies <= 299: win_val = 8 lose_val = -3 if 300 <= brawler_trophies <= 399: win_val = 8 lose_val = -4 if 400 <= brawler_trophies <= 499: win_val = 8 lose_val = -5 if 500 <= brawler_trophies <= 599: win_val = 8 lose_val = -6 if 600 <= brawler_trophies <= 699: win_val = 8 lose_val = -7 if 700 <= brawler_trophies <= 799: win_val = 8 lose_val = -8 if 800 <= brawler_trophies <= 899: win_val = 7 lose_val = -9 if 900 <= brawler_trophies <= 999: win_val = 6 lose_val = -10 if 1000 <= brawler_trophies <= 1099: win_val = 5 lose_val = -11 if 1100 <= brawler_trophies <= 1199: win_val = 4 lose_val = -12 if brawler_trophies >= 1200: win_val = 3 lose_val = -12 # Result Rewards if self.player.result == 0: if self.player.battle_tokens <= 0 and self.player.collected_experience >= self.player.maximum_experience: result = self.player.result + 6 elif self.player.battle_tokens <= 0: result = self.player.result + 4 elif self.player.collected_experience >= self.player.maximum_experience: result = self.player.result + 2 else: result = self.player.result gainedtrophies = 0 if self.player.battle_result == 0: gainedtokens = practice_token_list[0] gainedexperience = practice_exp_reward[0] self.player.ThreeVSThree_wins += 1 DataBase.replaceValue(self, '3vs3Wins', self.player.ThreeVSThree_wins) if self.player.battle_result == 1: gainedtokens = practice_token_list[2] gainedexperience = practice_exp_reward[2] if self.player.battle_result == 2: gainedtokens = practice_token_list[1] gainedexperience = practice_exp_reward[1] else: if self.player.battle_result == 0: if self.player.battle_tokens <= 0 and self.player.collected_experience >= self.player.maximum_experience: result = self.player.result + 7 elif self.player.battle_tokens <= 0: result = self.player.result + 5 elif self.player.collected_experience >= self.player.maximum_experience: result = self.player.result + 3 else: result = self.player.result + 1 gainedtokens = token_list[0] gainedexperience = exp_reward[0] gainedtrophies = win_val self.player.ThreeVSThree_wins += 1 DataBase.replaceValue(self, '3vs3Wins', self.player.ThreeVSThree_wins) if self.player.battle_result in [1, 2]: if self.player.battle_tokens <= 0 and self.player.collected_experience >= self.player.maximum_experience: result = self.player.result + 6 elif self.player.battle_tokens <= 0: result = self.player.result + 4 elif self.player.collected_experience >= self.player.maximum_experience: result = self.player.result + 2 else: result = self.player.result if self.player.battle_result == 1: gainedtokens = token_list[2] gainedexperience = exp_reward[2] gainedtrophies = lose_val if self.player.battle_result == 2: gainedtokens = token_list[1] gainedexperience = exp_reward[1] gainedtrophies = 0 if self.player.battle_result in [0, 2]: if 0 <= result <= 15: starplayer = 1 else: starplayer = 5 else: if 0 <= result <= 15: starplayer = 1 else: starplayer = 1 # Star Player Info if starplayer == 5: starplayerexperience = mvp_exp_reward[0] else: starplayerexperience = 0 # Results Balance if result in [0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27]: tokens = gainedtokens if result in [4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31]: tokens = 0 if result in [0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29]: mvpexperience = starplayerexperience experience = gainedexperience if result in [2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31]: mvpexperience = 0 experience = 0 if result in [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]: startoken = 1 if result in [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]: startoken = 0 if 0 <= result <= 31: trophies = gainedtrophies # DataBase Stuff self.player.player_experience += experience + mvpexperience self.player.collected_experience += experience + mvpexperience if self.player.battle_tokens <= 0: token = 0 if self.player.battle_tokens > tokens: token = tokens if tokens >= self.player.battle_tokens: token = self.player.battle_tokens if self.player.tokenevent == 'true': tokenevent = token else: tokenevent = 0 if self.player.tokensdoubler <= 0: doubledtokens = 0 if self.player.tokensdoubler > token + tokenevent: doubledtokens = token + tokenevent if token + tokenevent >= self.player.tokensdoubler: doubledtokens = self.player.tokensdoubler battle_tokens = self.player.battle_tokens - token remainingtokens = (self.player.tokensdoubler) - doubledtokens totaltokens = token + tokenevent + doubledtokens if self.player.coinevent == 'true': coinevent = totaltokens else: coinevent = 0 new_gold = self.player.gold + coinevent new_trophies = self.player.trophies + trophies new_tokens = self.player.brawl_boxes + totaltokens new_startokens = self.player.big_boxes + startoken self.player.brawlers_trophies[str(self.player.brawler_id)] = brawler_trophies + trophies if self.player.brawlers_trophies_in_rank[str(self.player.brawler_id)] < self.player.brawlers_trophies[str(self.player.brawler_id)]: self.player.brawlers_trophies_in_rank[str(self.player.brawler_id)] = brawler_trophies_for_rank - brawler_trophies_for_rank + brawler_trophies + trophies if self.player.tutorial <= 1: pass else: DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', new_trophies) DataBase.replaceValue(self, 'brawlBoxes', new_tokens) DataBase.replaceValue(self, 'bigBoxes', new_startokens) DataBase.replaceValue(self, 'availableTokens', battle_tokens) DataBase.replaceValue(self, 'tokensdoubler', remainingtokens) DataBase.replaceValue(self, 'playerExp', self.player.player_experience) DataBase.replaceValue(self, 'cappedExp', self.player.collected_experience) DataBase.replaceValue(self, 'gold', new_gold) self.writeVint(1) # Battle End Game Mode self.writeVint(self.player.battle_result) # Result self.writeVint(token) # Tokens Gained if self.player.result < 16: self.writeVint(0) # Trophies Result if self.player.result >= 16: if gainedtrophies >= 0: self.writeVint(gainedtrophies) # Trophies Result if gainedtrophies < 0: self.writeVint(-65 - (gainedtrophies)) # Trophies Result self.writeVint(0) # Unknown (Power Play Related) self.writeVint(doubledtokens) # Doubled Tokens self.writeVint(tokenevent) # Double Token Event self.writeVint(remainingtokens) # Token Doubler Remaining self.writeVint(0) # Big Game/Robo Rumble Time self.writeVint(0) # Unknown (Championship Related) self.writeVint(0) # Championship Level Passed self.writeVint(0) # Challenge Reward Type (0 = Star Points, 1 = Star Tokens) self.writeVint(0) # Challenge Reward Ammount self.writeVint(0) # Championship Losses Left self.writeVint(0) # Championship Maximun Losses self.writeVint(coinevent) # Coin Shower Event self.writeVint(0) # Underdog Trophies if self.player.tutorial <= 1: self.writeVint(32) # Battle Result Type else: self.writeVint(result) # Battle Result Type self.writeVint(-64) # Championship Challenge Type self.writeVint(0) # Championship Cleared and Beta Quests # Players Array self.writeVint(self.player.players) # Battle End Screen Players self.writeVint(starplayer) # Team and Star Player Type self.writeScId(16, self.player.brawler_id) # Player Brawler self.writeScId(29, self.player.skin_id) # Player Skin self.writeVint(brawler_trophies) # Your Brawler Trophies self.writeVint(0) # Unknown (Power Play Related) if self.player.tutorial <= 1: self.writeVint(brawler_level) # Your Brawler Power Level else: self.writeVint(10) # Your Brawler Power Level self.writeBoolean(True) # HighID and LowID Array self.writeInt(self.player.high_id) # HighID self.writeInt(self.player.low_id) # LowID self.writeString(self.player.name) # Your Name self.writeVint(self.player.player_experience -experience -mvpexperience) # Player Experience Level self.writeVint(28000000 + self.player.profile_icon) # Player Profile Icon self.writeVint(43000000 + self.player.name_color) # Player Name Color if self.player.team == 0: if self.player.bot1_team == 0: self.writeVint(0) # Team and Star Player Type else: self.writeVint(2) # Team and Star Player Type else: if self.player.bot1_team == 0: self.writeVint(2) # Team and Star Player Type else: self.writeVint(0) # Team and Star Player Type self.writeScId(16, self.player.bot1) # Bot 1 Brawler self.writeVint(0) # Bot 1 Skin self.writeVint(0) # Brawler Trophies self.writeVint(0) # Unknown (Power Play Related) if self.player.tutorial <= 1: self.writeVint(1) # Brawler Power Level else: self.writeVint(10) # Brawler Power Level self.writeBoolean(False) # HighID and LowID Array self.writeString(self.player.bot1_n) # Bot 1 Name self.writeVint(0) # Player Experience Level self.writeVint(28000000) # Player Profile Icon self.writeVint(43000000) # Player Name Color if self.player.team == 0: if self.player.bot2_team == 0: self.writeVint(0) # Team and Star Player Type else: self.writeVint(2) # Team and Star Player Type else: if self.player.bot2_team == 0: self.writeVint(2) # Team and Star Player Type else: self.writeVint(0) # Team and Star Player Type self.writeScId(16, self.player.bot2) # Bot 2 Brawler self.writeVint(0) # Bot 2 Skin self.writeVint(0) # Brawler Trophies self.writeVint(0) # Unknown (Power Play Related) if self.player.tutorial <= 1: self.writeVint(1) # Brawler Power Level else: self.writeVint(10) # Brawler Power Level self.writeBoolean(False) # HighID and LowID Array self.writeString(self.player.bot2_n) # Bot 2 Name self.writeVint(0) # Player Experience Level self.writeVint(28000000) # Player Profile Icon self.writeVint(43000000) # Player Name Color if self.player.team == 0: if self.player.bot3_team == 0: self.writeVint(0) # Team and Star Player Type else: self.writeVint(2) # Team and Star Player Type else: if self.player.bot3_team == 0: self.writeVint(2) # Team and Star Player Type else: self.writeVint(0) # Team and Star Player Type self.writeScId(16, self.player.bot3) # Bot 3 Brawler self.writeVint(0) # Bot 3 Skin self.writeVint(0) # Brawler Trophies self.writeVint(0) # Unknown (Power Play Related) if self.player.tutorial <= 1: self.writeVint(1) # Brawler Power Level else: self.writeVint(10) # Brawler Power Level self.writeBoolean(False) # HighID and LowID Array self.writeString(self.player.bot3_n) # Bot 3 Name self.writeVint(0) # Player Experience Level self.writeVint(28000000) # Player Profile Icon self.writeVint(43000000) # Player Name Color if self.player.team == 0: if self.player.bot4_team == 0: self.writeVint(0) # Team and Star Player Type else: self.writeVint(2) # Team and Star Player Type else: if self.player.bot4_team == 0: self.writeVint(2) # Team and Star Player Type else: self.writeVint(0) # Team and Star Player Type self.writeScId(16, self.player.bot4) # Bot 4 Brawler self.writeVint(0) # Bot 4 Skin self.writeVint(0) # Brawler Trophies self.writeVint(0) # Unknown (Power Play Related) if self.player.tutorial <= 1: self.writeVint(1) # Brawler Power Level else: self.writeVint(10) # Brawler Power Level self.writeBoolean(False) # HighID and LowID Array self.writeString(self.player.bot4_n) # Bot 4 Name self.writeVint(0) # Player Experience Level self.writeVint(28000000) # Player Profile Icon self.writeVint(43000000) # Player Name Color if self.player.team == 0: if self.player.bot5_team == 0: self.writeVint(0) # Team and Star Player Type else: self.writeVint(2) # Team and Star Player Type else: if self.player.bot5_team == 0: self.writeVint(2) # Team and Star Player Type else: self.writeVint(0) # Team and Star Player Type self.writeScId(16, self.player.bot5) # Bot 5 Brawler self.writeVint(0) # Bot 5 Skin self.writeVint(0) # Brawler Trophies self.writeVint(0) # Unknown (Power Play Related) if self.player.tutorial <= 1: self.writeVint(1) # Brawler Power Level else: self.writeVint(10) # Brawler Power Level self.writeBoolean(False) # HighID and LowID Array self.writeString(self.player.bot5_n) # Bot 5 Name self.writeVint(0) # Player Experience Level self.writeVint(28000000) # Player Profile Icon self.writeVint(43000000) # Player Name Color # Experience Array self.writeVint(2) # Count self.writeVint(0) # Normal Experience ID self.writeVint(experience) # Normal Experience Gained self.writeVint(8) # Star Player Experience ID self.writeVint(mvpexperience) # Star Player Experience Gained # Rank Up and Level Up Bonus Array self.writeVint(0) # Count # Trophies and Experience Bars Array self.writeVint(2) # Count self.writeVint(1) # Trophies Bar Milestone ID self.writeVint(brawler_trophies) # Brawler Trophies self.writeVint(brawler_trophies_for_rank) # Brawler Trophies for Rank self.writeVint(5) # Experience Bar Milestone ID self.writeVint(self.player.player_experience -experience -mvpexperience) # Player Experience self.writeVint(self.player.player_experience -experience -mvpexperience) # Player Experience for Level self.writeScId(28, self.player.profile_icon) # Player Profile Icon (Unused since 2017) if 16 <= result <= 23: self.writeBoolean(True) # Play Again else: self.writeBoolean(False) # Play Again if self.player.battle_result == 0: if self.player.tutorial <= 1: self.player.tutorial += 1 DataBase.replaceValue(self, 'tutorial', self.player.tutorial) self.player.ThreeVSThree_wins -= 1 DataBase.replaceValue(self, '3vs3Wins', self.player.ThreeVSThree_wins) else: self.player.tutorial = 0
def process(self): if self.player.Brawler_newTag[str(self.BrawlerID)] == 1: self.player.Brawler_newTag[str(self.BrawlerID)] = 0 DataBase.replaceValue(self, 'brawlerNewTag', self.player.Brawler_newTag)
def process(self): DataBase.replaceValue(self, 'profileIcon', self.player.profile_icon)
def encode(self): self.writeVint(2) self.writeVint(self.player.rank) # player rank brawler_trophies = self.player.brawlers_trophies[str( self.player.brawler_id)] brawler_trophies_for_rank = self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] exp_reward = [15, 12, 9, 6, 5, 4, 3, 2, 1, 0] win = 0 if 0 <= brawler_trophies <= 49: win = 8 rank_1_val = 10 rank_2_val = 8 rank_3_val = 7 rank_4_val = 6 rank_5_val = 4 rank_6_val = 2 rank_7_val = 2 rank_8_val = 1 rank_9_val = 0 rank_10_val = 0 else: if 50 <= brawler_trophies <= 99: win = 7 rank_1_val = 10 rank_2_val = 8 rank_3_val = 7 rank_4_val = 6 rank_5_val = 3 rank_6_val = 2 rank_7_val = 2 rank_8_val = 0 rank_9_val = -1 rank_10_val = -2 if 100 <= brawler_trophies <= 199: win = 6 rank_1_val = 10 rank_2_val = 8 rank_3_val = 7 rank_4_val = 6 rank_5_val = 3 rank_6_val = 1 rank_7_val = 0 rank_8_val = -1 rank_9_val = -2 rank_10_val = -2 if 200 <= brawler_trophies <= 299: win = 6 rank_1_val = 10 rank_2_val = 8 rank_3_val = 6 rank_4_val = 5 rank_5_val = 3 rank_6_val = 1 rank_7_val = 0 rank_8_val = -2 rank_9_val = -3 rank_10_val = -3 if 300 <= brawler_trophies <= 399: win = 5 rank_1_val = 10 rank_2_val = 8 rank_3_val = 6 rank_4_val = 5 rank_5_val = 2 rank_6_val = 0 rank_7_val = 0 rank_8_val = -3 rank_9_val = -4 rank_10_val = -4 if 400 <= brawler_trophies <= 499: win = 5 rank_1_val = 10 rank_2_val = 8 rank_3_val = 6 rank_4_val = 5 rank_5_val = 2 rank_6_val = -1 rank_7_val = -2 rank_8_val = -3 rank_9_val = -5 rank_10_val = -5 if 500 <= brawler_trophies <= 599: win = 5 rank_1_val = 10 rank_2_val = 8 rank_3_val = 6 rank_4_val = 4 rank_5_val = 2 rank_6_val = -1 rank_7_val = -2 rank_8_val = -5 rank_9_val = -6 rank_10_val = -6 if 600 <= brawler_trophies <= 699: win = 5 rank_1_val = 10 rank_2_val = 8 rank_3_val = 6 rank_4_val = 4 rank_5_val = 1 rank_6_val = -2 rank_7_val = -2 rank_8_val = -5 rank_9_val = -7 rank_10_val = -8 if 700 <= brawler_trophies <= 799: win = 5 rank_1_val = 10 rank_2_val = 8 rank_3_val = 6 rank_4_val = 4 rank_5_val = 1 rank_6_val = -3 rank_7_val = -4 rank_8_val = -5 rank_9_val = -8 rank_10_val = -9 if 800 <= brawler_trophies <= 899: win = 4 rank_1_val = 9 rank_2_val = 7 rank_3_val = 5 rank_4_val = 2 rank_5_val = 0 rank_6_val = -3 rank_7_val = -4 rank_8_val = -7 rank_9_val = -9 rank_10_val = -10 if 900 <= brawler_trophies <= 999: win = 4 rank_1_val = 8 rank_2_val = 6 rank_3_val = 4 rank_4_val = 1 rank_5_val = -1 rank_6_val = -3 rank_7_val = -6 rank_8_val = -8 rank_9_val = -10 rank_10_val = -11 if 1000 <= brawler_trophies <= 1099: win = 4 rank_1_val = 6 rank_2_val = 5 rank_3_val = 3 rank_4_val = 1 rank_5_val = -2 rank_6_val = -5 rank_7_val = -6 rank_8_val = -9 rank_9_val = -11 rank_10_val = -12 if 1100 <= brawler_trophies <= 1199: win = 3 rank_1_val = 5 rank_2_val = 4 rank_3_val = 1 rank_4_val = 0 rank_5_val = -2 rank_6_val = -6 rank_7_val = -7 rank_8_val = -10 rank_9_val = -12 rank_10_val = -13 if brawler_trophies >= 1200: win = 2 rank_1_val = 5 rank_2_val = 3 rank_3_val = 0 rank_4_val = -1 rank_5_val = -2 rank_6_val = -6 rank_7_val = -8 rank_8_val = -11 rank_9_val = -12 rank_10_val = -13 self.player.player_experience += exp_reward[self.player.rank - 1] DataBase.replaceValue(self, 'playerExp', self.player.player_experience) if self.player.rank >= win: self.player.solo_wins += 1 DataBase.replaceValue(self, 'soloWins', self.player.solo_wins) if self.player.rank == 1: self.player.trophies += rank_1_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_1_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_1_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_1_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 2: self.player.trophies += rank_2_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_2_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_2_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_2_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 3: self.player.trophies += rank_3_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_3_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_3_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_3_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 4: self.player.trophies += rank_4_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_4_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_4_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_4_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 5: self.player.trophies += rank_5_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_5_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_5_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_5_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 6: self.player.trophies += rank_6_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_6_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_6_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_6_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 7: self.player.trophies += rank_7_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_7_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_7_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_7_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 8: self.player.trophies += rank_8_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_8_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_8_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_8_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 9: self.player.trophies += rank_9_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_9_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_9_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_9_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) elif self.player.rank == 10: self.player.trophies += rank_10_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + rank_10_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)] and rank_10_val > 0: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + rank_10_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(32) self.writeVint(0) self.writeVint(0) self.writeVint(10) self.writeVint(1) self.writeVint(16) self.writeVint(self.player.brawler_id) self.writeVint(29) self.writeVint(self.player.skin_id) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeString(self.player.name) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(11) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(49) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(35) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(50) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(31) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(51) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(3) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(52) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(26) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(53) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(34) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(54) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(25) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(55) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(8) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(56) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(30) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(1) self.writeVint(57) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(28) self.writeVint(0) self.writeVint(0) self.writeVint(-1040385) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0)
def decode(self): self.msg = self.read_string() if self.msg.lower() == '/stats': self.bot_msg = f'Server status:\nBuild version: 1.1 (for v26.165)\nFingerprint SHA: {self.player.patch_sha}' self.IsAcmd = True elif self.msg.lower() == '/reset': self.send_ofs = True DataBase.replaceValue(self, 'gold', 99999) DataBase.replaceValue(self, 'gems', 99999) DataBase.replaceValue(self, 'tickets', 99999) self.IsAcmd = True elif self.msg.lower().startswith('/gems'): try: newGems = self.msg.split(" ", 4)[1:] DataBase.replaceValue(self, 'gems', int(newGems[0])) self.send_ofs = True self.IsAcmd = True except: pass elif self.msg.lower().startswith('/gold'): try: newGold = self.msg.split(" ", 4)[1:] DataBase.replaceValue(self, 'gold', int(newGold[0])) self.send_ofs = True self.IsAcmd = True except: pass elif self.msg.lower().startswith('/tickets'): try: newTickets = self.msg.split(" ", 7)[1:] DataBase.replaceValue(self, 'tickets', int(newTickets[0])) self.send_ofs = True self.IsAcmd = True except: pass elif self.msg.lower().startswith('/starpoints'): try: newStarpoints = self.msg.split(" ", 10)[1:] DataBase.replaceValue(self, 'starpoints', int(newStarpoints[0])) self.send_ofs = True self.IsAcmd = True except: pass elif self.msg.lower() == '/help': self.bot_msg = 'Club Commands\n/stats - show server status\n/reset - reset all resources\n/gems [int] - add gems to your account, where int is the number of gems\n/gold [int] - add gold to your account, where int is the number of gold\n/tickets [int] - add tickets to your account, where int is the number of tickets\n/starpoints [int] - add starpoints to your account, where int is the number of starpoints' self.IsAcmd = True
def process(self): DataBase.replaceValue(self, 'starpower', self.player.starpower) if self.player.room_id > 0: TeamGameroomDataMessage(self.client, self.player).send()
def process(self): DataBase.replaceValue(self, 'DoNotDistrub', self.player.DoNotDistrubMessage) DoNotDistrubOkMessage(self.client, self.player).send()
def encode(self): self.writeVint(0) self.writeVint(self.player.battle_result) brawler_trophies = self.player.brawlers_trophies[str( self.player.brawler_id)] brawler_trophies_for_rank = self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] exp_reward = [8, 6, 4] player_tokens_reward = [20, 15, 10] if 0 <= brawler_trophies <= 49: win_val = 8 lose_val = 0 else: if 50 <= brawler_trophies <= 99: win_val = 8 lose_val = -1 if 100 <= brawler_trophies <= 199: win_val = 8 lose_val = -2 if 200 <= brawler_trophies <= 299: win_val = 8 lose_val = -3 if 300 <= brawler_trophies <= 399: win_val = 8 lose_val = -4 if 400 <= brawler_trophies <= 499: win_val = 8 lose_val = -5 if 500 <= brawler_trophies <= 599: win_val = 8 lose_val = -6 if 600 <= brawler_trophies <= 699: win_val = 8 lose_val = -7 if 700 <= brawler_trophies <= 799: win_val = 8 lose_val = -8 if 800 <= brawler_trophies <= 899: win_val = 7 lose_val = -9 if 900 <= brawler_trophies <= 999: win_val = 6 lose_val = -10 if 1000 <= brawler_trophies <= 1099: win_val = 5 lose_val = -11 if 1100 <= brawler_trophies <= 1199: win_val = 4 lose_val = -12 if brawler_trophies >= 1200: win_val = 3 lose_val = -12 if self.player.battle_result == 0: self.player.ThreeVSThree_wins += 1 self.player.player_experience += exp_reward[0] if self.player.tokensdoubler > 0: if self.player.tokensdoubler <= player_tokens_reward[0]: print("OLD", player_tokens_reward[0]) player_tokens_reward[0] += self.player.tokensdoubler self.player.tokensdoubler = 0 self.player.brawl_boxes += player_tokens_reward[0] DataBase.replaceValue(self, "tokensdoubler", self.player.tokensdoubler) DataBase.replaceValue(self, "brawlBoxes", self.player.brawl_boxes) print("NEW", player_tokens_reward[0]) else: print("OLD", player_tokens_reward[0]) self.player.tokensdoubler -= player_tokens_reward[0] player_tokens_reward[0] += player_tokens_reward[0] self.player.brawl_boxes += player_tokens_reward[0] DataBase.replaceValue(self, "tokensdoubler", self.player.tokensdoubler) DataBase.replaceValue(self, "brawlBoxes", self.player.brawl_boxes) print("NEW", player_tokens_reward[0]) else: print("OLD", player_tokens_reward[0]) self.player.brawl_boxes += player_tokens_reward[0] print("NEW", player_tokens_reward[0]) self.player.trophies += win_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + win_val if self.player.brawlers_trophies_in_rank[str( self.player.brawler_id)] < self.player.brawlers_trophies[ str(self.player.brawler_id)]: self.player.brawlers_trophies_in_rank[str( self.player.brawler_id )] = brawler_trophies_for_rank + win_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) DataBase.replaceValue(self, '3vs3Wins', self.player.ThreeVSThree_wins) DataBase.replaceValue(self, 'playerExp', self.player.player_experience) else: self.player.player_experience += exp_reward[2] if self.player.tokensdoubler > 0: if self.player.tokensdoubler <= player_tokens_reward[2]: print("OLD", player_tokens_reward[2]) player_tokens_reward[2] += self.player.tokensdoubler self.player.tokensdoubler = 0 self.player.brawl_boxes += player_tokens_reward[2] DataBase.replaceValue(self, "tokensdoubler", self.player.tokensdoubler) DataBase.replaceValue(self, "brawlBoxes", self.player.brawl_boxes) print("NEW", player_tokens_reward[2]) else: print("OLD", player_tokens_reward[2]) self.player.tokensdoubler -= player_tokens_reward[2] player_tokens_reward[2] += player_tokens_reward[2] self.player.brawl_boxes += player_tokens_reward[2] DataBase.replaceValue(self, "tokensdoubler", self.player.tokensdoubler) DataBase.replaceValue(self, "brawlBoxes", self.player.brawl_boxes) print("NEW", player_tokens_reward[2]) else: print("OLD", player_tokens_reward[2]) self.player.brawl_boxes += player_tokens_reward[2] print("NEW", player_tokens_reward[2]) self.player.trophies -= lose_val self.player.brawlers_trophies[str( self.player.brawler_id)] = brawler_trophies + lose_val DataBase.replaceValue(self, 'brawlersTrophies', self.player.brawlers_trophies) DataBase.replaceValue(self, 'brawlersTrophiesForRank', self.player.brawlers_trophies_in_rank) DataBase.replaceValue(self, 'trophies', self.player.trophies) DataBase.replaceValue(self, 'playerExp', self.player.player_experience) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(0) self.writeVint(32) self.writeVint(0) self.writeVint(0) self.writeVint(6) self.writeVint(5) self.writeVint(16) self.writeVint(self.player.brawler_id) self.writeVint(29) self.writeVint(self.player.skin_id) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeString(self.player.name) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(0) self.writeVint(16) self.writeVint(self.player.bot1) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeString(self.player.bot1_n) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(0) self.writeVint(16) self.writeVint(self.player.bot2) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeString(self.player.bot2_n) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(self.player.bot3) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeString(self.player.bot3_n) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(self.player.bot4) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeString(self.player.bot4_n) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000) self.writeVint(2) self.writeVint(16) self.writeVint(self.player.bot5) self.writeVint(0) self.writeVint(99999) self.writeVint(0) self.writeVint(10) self.writeVint(0) self.writeString(self.player.bot5_n) self.writeVint(100) self.writeVint(28000000) self.writeVint(43000000)
def encode(self): reward_list = [ "Nothing", "Brawler", "Tickets", "Gems", "TokensDoubler" ] unlocked_brawlers = [] unlockable_brawlers = [] for brawlers_id in self.player.BrawlersUnlockedState: if self.player.BrawlersUnlockedState[brawlers_id] == 0: unlockable_brawlers.append(int(brawlers_id)) elif self.player.BrawlersUnlockedState[ brawlers_id] == 1 and self.player.Brawler_level[ brawlers_id] != 8: unlocked_brawlers.append(int(brawlers_id)) self.box_index = 0 def get_id(id): if id == 5: # Brawl Box return 10 elif id == 4: # Big Box self.box_index = 1 return 12 elif id == 3: # Shop Mega Box self.box_index = 3 DataBase.replaceValue(self, 'gems', self.player.gems - 80) return 11 elif id == 1: # Shop Big Box self.box_index = 2 DataBase.replaceValue(self, 'gems', self.player.gems - 30) return 12 elif id == 6: # Trophy Road Brawl Box DataBase.replaceValue(self, 'leagueReward', self.player.trophyroad + 1) return 10 self.box_skin_id = get_id(self.player.box_id) box_content = { "RewardType": "", "RewardCount": 1, "Gold": randint(self.BoxData[self.box_index]["Coins"][0], self.BoxData[self.box_index]["Coins"][1]) } reward = choices(reward_list, weights=[0.5, 0.18, 0.15, 0.09, 0.05], k=1) if reward[0] == "Brawler" and len(unlockable_brawlers) == 0: reward_list.pop(1) reward = choices(reward_list, weights=[0.5, 0.15, 0.09, 0.05], k=1) brawlers_rewarded = [] choosed_brawler = choice(unlocked_brawlers) # Brawler randomizer while len(brawlers_rewarded) != self.BoxData[ self.box_index]["MaxUpgradePoints"]: if len(unlocked_brawlers) < self.BoxData[ self.box_index]["MaxUpgradePoints"]: for i in range(len(unlocked_brawlers)): brawlers_rewarded.append(unlocked_brawlers[i]) break elif choosed_brawler not in brawlers_rewarded: brawlers_rewarded.append(choosed_brawler) else: choosed_brawler = choice(unlocked_brawlers) # Reward manager if reward[0] == "Brawler": box_content["RewardType"] = reward[0] if self.BoxData[self.box_index]["NewCharPosition"] == "Start": box_content["RewardCount"] = 1 elif self.BoxData[self.box_index]["NewCharPosition"] == "Middle": brawlers_rewarded.pop(len(brawlers_rewarded) - 1) box_content["RewardCount"] = 2 + len(brawlers_rewarded) for i in range(len(brawlers_rewarded)): box_content["Powerpoints" + str(i + 1)] = brawlers_rewarded[i] else: box_content["RewardCount"] = 2 + len(brawlers_rewarded) for i in range(len(brawlers_rewarded)): box_content["Powerpoints" + str(i + 1)] = brawlers_rewarded[i] box_content["Brawler"] = choice(unlockable_brawlers) self.player.BrawlersUnlockedState[str(box_content["Brawler"])] = 1 DataBase.replaceValue(self, 'UnlockedBrawlers', self.player.BrawlersUnlockedState) elif reward[0] == "Nothing": box_content["RewardType"] = "OnlyPowerpoints" for i in range(len(brawlers_rewarded)): box_content["RewardCount"] += 1 box_content["Powerpoints" + str(i + 1)] = brawlers_rewarded[i] else: box_content["RewardType"] = "Bonus" for i in range(len(brawlers_rewarded)): box_content["RewardCount"] += 1 box_content["Powerpoints" + str(i + 1)] = brawlers_rewarded[i] box_content["RewardCount"] += 1 box_content[reward[0]] = self.BoxData[self.box_index][reward[0]] # Box info self.writeVint(203) # CommandID self.writeVint(0) # Unknown self.writeVint(1) # Multipler self.writeVint(self.box_skin_id) # BoxID # Box info end # Reward start self.writeVint(box_content["RewardCount"]) # Reward count if box_content["RewardType"] == "Brawler" and self.BoxData[ self.box_index]["NewCharPosition"] == "Start": # Brawler start self.writeVint(1) # Reward amount self.writeScId(16, box_content["Brawler"]) # CsvID self.writeVint(1) # RewardID self.writeVint(0) self.writeVint(0) self.writeVint(0) # Brawler end else: DataBase.replaceValue(self, 'gold', self.player.gold + box_content["Gold"]) # Gold start self.writeVint(box_content["Gold"]) # Reward amount self.writeVint(0) # SCID self.writeVint(7) # RewardID self.writeVint(0) self.writeVint(0) self.writeVint(0) # Gold end powerpoints_ammount = [ randint(self.BoxData[self.box_index]["UpgradePoints"][0], self.BoxData[self.box_index]["UpgradePoints"][1]) for _ in range(len(brawlers_rewarded)) ] powerpoints_ammount.sort() for i in range(len(brawlers_rewarded)): self.player.brawlers_upgradium[str( brawlers_rewarded[i])] += powerpoints_ammount[i] DataBase.replaceValue(self, 'brawlersUpgradePoints', self.player.brawlers_upgradium) # Upgrade points start self.writeVint(powerpoints_ammount[i]) # Reward amount self.writeScId(16, box_content["Powerpoints" + str(i + 1)]) # BrawlerID self.writeVint(6) # RewardID self.writeVint(0) self.writeVint(0) self.writeVint(0) # Upgrade points end if box_content["RewardType"] == "Brawler": if self.BoxData[self.box_index][ "NewCharPosition"] == "End" or self.BoxData[ self.box_index]["NewCharPosition"] == "Middle": # Brawler start self.writeVint(1) # Reward amount self.writeScId(16, box_content["Brawler"]) # CsvID self.writeVint(1) # RewardID self.writeVint(0) self.writeVint(0) self.writeVint(0) # Brawler end if box_content["RewardType"] == "Bonus": for i in range(len(Boxes.reward_id)): if Boxes.reward_id[i]["Name"] == reward[0]: if reward[0] == "Gems": ammountrewarded = choice(box_content[reward[0]]) self.player.gems = self.player.gems + ammountrewarded DataBase.replaceValue(self, 'gems', self.player.gems) elif reward[0] == "Tickets": ammountrewarded = choice(box_content[reward[0]]) self.player.tickets = self.player.tickets + ammountrewarded DataBase.replaceValue(self, 'tickets', self.player.tickets) else: ammountrewarded = choice(box_content[reward[0]]) self.player.tokensdoubler = self.player.tokensdoubler + ammountrewarded DataBase.replaceValue(self, 'tokensdoubler', self.player.tokensdoubler) self.writeVint(ammountrewarded) # Reward ammount self.writeScId(0, Boxes.reward_id[i]['ID']) # RewardID break # Box end for i in range(13): self.writeVint(0)