From c4a6dd9bfc40ee02f59923f2a35859d942c32b2d Mon Sep 17 00:00:00 2001 From: PhoenixFire6879 Date: Fri, 15 Jan 2021 14:24:24 +0200 Subject: [PATCH] improvements --- Logic/Player.py | 1 + Logic/Shop.py | 11 +++++------ Packets/Commands/Client/Buy_Offer.py | 15 +++++++++++++++ .../Messages/Server/Home/Own_Home_Data_Message.py | 8 +++----- config.json | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Logic/Player.py b/Logic/Player.py index f7baa7ee..acac406e 100644 --- a/Logic/Player.py +++ b/Logic/Player.py @@ -62,6 +62,7 @@ class Players: gems = settings['Gems'] gold = settings['Gold'] tickets = settings['Tickets'] + theme_id = 41000000 + settings['ThemeID'] tokens = 0 diff --git a/Logic/Shop.py b/Logic/Shop.py index 97d2e3d4..83fd5fc5 100644 --- a/Logic/Shop.py +++ b/Logic/Shop.py @@ -26,22 +26,21 @@ class Shop: offers = [ - # Star Shop { - 'ID': 14, # Big Box + 'ID': 6, 'OfferTitle': 'SPECIAL OFFER', - 'Cost': 0, + 'Cost': 20, 'Multiplier': 1, 'SkinID': 0, - 'ShopType': 3, + 'ShopType': 0, 'ShopDisplay': 0, 'Timer': 99999 }, { - 'ID': 10, # Mega Box + 'ID': 10, 'OfferTitle': 'SPECIAL OFFER', - 'Cost': 0, + 'Cost': 1500, 'Multiplier': 1, 'SkinID': 0, 'ShopType': 3, diff --git a/Packets/Commands/Client/Buy_Offer.py b/Packets/Commands/Client/Buy_Offer.py index 0ac231a2..e8422fe1 100644 --- a/Packets/Commands/Client/Buy_Offer.py +++ b/Packets/Commands/Client/Buy_Offer.py @@ -1,5 +1,6 @@ from Packets.Commands.Server.Buy_Brawl_Box_Callback import BuyBrawlBoxCallback from Packets.Messages.Server.Out_Of_Sync_Message import OutOfSyncMessage +from Database.DataBase import DataBase from Logic.Shop import Shop from Utils.Reader import BSMessageReader @@ -20,6 +21,18 @@ def decode(self): def process(self): id = Shop.offers[self.offer_index]['ID'] + type = Shop.offers[self.offer_index]['ShopType'] + cost = Shop.offers[self.offer_index]['Cost'] + + 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) if id in [0, 6, 10, 14]: @@ -32,6 +45,8 @@ def process(self): elif id == 10: self.player.box_id = 3 + res(type) + BuyBrawlBoxCallback(self.client, self.player).send() else: diff --git a/Packets/Messages/Server/Home/Own_Home_Data_Message.py b/Packets/Messages/Server/Home/Own_Home_Data_Message.py index fe3cedbc..9c198f24 100644 --- a/Packets/Messages/Server/Home/Own_Home_Data_Message.py +++ b/Packets/Messages/Server/Home/Own_Home_Data_Message.py @@ -28,7 +28,7 @@ def encode(self): self.writeVint(500) # Starting Level (exp points) - self.writeScId(28, self.player.profile_icon) # Player Icon ID + self.writeScId(28, self.player.profile_icon) # Player Icon ID self.writeScId(43, self.player.name_color) # Player Name Color ID self.writeVint(0) # array @@ -223,11 +223,9 @@ def encode(self): self.writeVint(0) # array - self.writeVint(2) # Menu Theme - self.writeInt(1) - self.writeInt(41000011) # Theme ID - self.writeInt(30) + self.writeVint(1) # Menu Theme self.writeInt(1) + self.writeInt(self.player.theme_id) self.writeVint(0) # array diff --git a/config.json b/config.json index a8785aee..a114b0b5 100644 --- a/config.json +++ b/config.json @@ -1 +1 @@ -{"Gems": 99999, "Gold": 99999, "Tickets": 99999, "Starpoints": 99999, "BrawlBoxTokens": 5000, "BigBoxTokens": 5000, "Trophies": 5000, "BrawlerTrophies": 500, "BrawlerTrophiesForRank": 500, "BrawlerPowerLevel": 8, "BrawlerUpgradePoints": 0, "ShowPacketsInLog": false, "Maintenance": false, "MaintenanceTime": 3600, "Patch": false, "PatchUrl": "http://192.168.0.103:8080/", "UpdateUrl": "https://github.com/PhoenixFire6879/Classic-Brawl"} \ No newline at end of file +{"Gems": 99999, "Gold": 99999, "Tickets": 99999, "Starpoints": 99999, "BrawlBoxTokens": 5000, "BigBoxTokens": 5000, "Trophies": 5000, "BrawlerTrophies": 500, "BrawlerTrophiesForRank": 500, "BrawlerPowerLevel": 8, "BrawlerUpgradePoints": 0, "ThemeID": 11, "ShowPacketsInLog": false, "Maintenance": false, "MaintenanceTime": 3600, "Patch": false, "PatchUrl": "http://192.168.0.103:8080/", "UpdateUrl": "https://github.com/PhoenixFire6879/Classic-Brawl"} \ No newline at end of file