Beispiel #1
0
 def decode(self):
     self.iscommand = False
     self.string = self.read_string()
     if self.string.lower() == 'reset':
         DataBase.replaceValue(self, 'gold', 99999)
         DataBase.replaceValue(self, 'gems', 99999)
         self.iscommand = True
def get_more_restaurants(query,num):
    db=DataBase()

    morequery = query.replace('DESC LIMIT 5',f'DESC LIMIT 5 OFFSET {num}')
    df=db.fetch_restaurants_by_sql(morequery)
    print("SQL Query: " + morequery)
    return df   
Beispiel #3
0
    def encode(self):
        self.writeVint(1)
        self.writeVint(0)
        self.writeVint(1)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)

        if (self.player.roomID == 0):
            self.player.roomID = random.randint(0, 2147483647)
            self.writeInt(self.player.roomID)
            DataBase.replaceValue(self, 'roomID', self.player.roomID)

        else:
            self.writeInt(self.player.roomID)

        self.writeVint(1557129593)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(15)
        self.writeVint(self.player.mapID)  # map ID
        self.writeVint(1)
        self.writeVint(1)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)  # high id
        self.writeInt(1)  # low id
        self.writeVint(16)
        self.writeVint(self.player.brawlerID)
        self.writeVint(0)
        self.writeVint(99999)
        self.writeVint(99999)
        self.writeVint(1)
        self.writeVint(3)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)
        self.writeString(self.player.name)  # player name
        self.writeVint(100)
        self.writeVint(28000000)
        self.writeVint(43000000)
        self.writeVint(23)
        self.writeVint(self.player.starpower)
        if self.player.useGadget == 1:
            self.writeVint(23)
            self.writeVint(self.player.gadget)
        else:
            self.writeVint(0)
            self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(0)
        self.writeVint(6)
        self.writeHexa('''FF-FF-00-00-00-00-00''')
        print("[INFO] Message GameroomData has been sent.")
def get_restaurant(type,region,aspects):
    db=DataBase()
    query = "SELECT rest_name, rest_address, rest_region, AVG(rest_food_rating) as rest_food_rating, AVG(rest_srvc_rating) as rest_srvc_rating, AVG(rest_ambi_rating) as rest_ambi_rating, AVG(rest_prce_rating) as rest_prce_rating, AVG(w_rest_rating) as w_rest_rating FROM restaurant"
    query = query + searchby_foodtype_region(type,region) + sort_by_aspect(aspects)
    df=db.fetch_restaurants_by_sql(query)
    print("SQL Query: " + query)

    return df,query
Beispiel #5
0
    def encode(self):
        self.writeVInt(1)
        self.writeVInt(0)
        self.writeVInt(1)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)

        if self.player.roomID == 0:
            self.player.roomID = random.randint(0, 2147483647)
            self.writeInt(self.player.roomID)
            DataBase.replaceValue(self, 'roomID', self.player.roomID)

        else:
            self.writeInt(self.player.roomID)

        self.writeVInt(1557129593)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeScID(15, self.player.mapID)  # map ID
        self.writeVInt(1)
        self.writeVInt(1)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)  # high id
        self.writeInt(1)  # low id
        self.writeScID(16, self.player.brawlerID)
        self.writeVInt(0)
        self.writeVInt(99999)
        self.writeVInt(99999)
        self.writeVInt(1)
        self.writeVInt(3)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeString(self.player.name)  # player name
        self.writeVInt(100)
        self.writeVInt(28000000)
        self.writeVInt(43000000)
        self.writeVInt(23)
        self.writeVInt(self.player.starpower)
        if self.player.useGadget == 1:
            self.writeVInt(23)
            self.writeVInt(self.player.gadget)
        else:
            self.writeVInt(0)
            self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(6)
        print("[*] Message TeamMessage has been sent.")
Beispiel #6
0
 def encode(self):
     self.writeVint(201)
     self.writeString(self.player.name)
     self.writeVint(0)
     self.writeVint(1)
     self.writeVint(-1)
     self.writeVint(-1)
     self.writeVint(0)
     self.writeVint(0)
     DataBase.replaceValue(self, 'name', self.player.name)
     print("[INFO] Message SetNameResponse has been sent.")
 def encode(self):
     self.writeVInt(201)
     self.writeString(self.player.name)
     self.writeVInt(0)
     self.writeVInt(1)
     self.writeVInt(-1)
     self.writeVInt(-1)
     self.writeVInt(0)
     self.writeVInt(0)
     DataBase.replaceValue(self, 'name', self.player.name)
     print("[*] Message SetNameCallback has been sent.")
    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 #9
0
 def process(self, crypter):
     if len(self.player.Token) == 40:
         LoginOkMessage(self.client, self.player).send(crypter)
         DataBase.loadAccount(self)
         OwnHomeDataMessage(self.client, self.player).send(crypter)
         MyAllianceMessage(self.client, self.player).send(crypter)
     else:
         self.player.LowID = random.randint(0, 2147483647)
         self.player.HighID = 0
         self.player.Token = Helpers.randomStringDigits(self)
         LoginOkMessage(self.client, self.player).send(crypter)
         DataBase.createAccount(self)
         OwnHomeDataMessage(self.client, self.player).send(crypter)
         MyAllianceMessage(self.client, self.player).send(crypter)
 def process(self):
     if self.commandID == 506:
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.read_Vint()
         self.player.brawlerID = self.read_Vint()
         DataBase.replaceValue(self, 'brawlerID', self.player.brawlerID)
Beispiel #11
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()
Beispiel #12
0
 def process(self):
     if self.mapID == 1:
         self.player.mapID = 7
     elif self.mapID == 2:
         self.player.mapID = 32
     elif self.mapID == 3:
         self.player.mapID = 17
     elif self.mapID == 4:
         self.player.mapID = 57
     elif self.mapID == 5:
         self.player.mapID = 38
     elif self.mapID == 6:
         self.player.mapID = 24
     elif self.mapID == 7:
         self.player.mapID = 202
     elif self.mapID == 8:
         self.player.mapID = 97
     elif self.mapID == 9:
         self.player.mapID = 167
     DataBase.replaceValue(self, 'mapID', self.player.mapID)
     GameroomData(self.client, self.player).send()
Beispiel #13
0
def routine():
    # url = ['https://store.steampowered.com/app/578080/PLAYERUNKNOWNS_BATTLEGROUNDS/',
    #        'https://store.steampowered.com/app/570/Dota_2/']
    HC = HeadLessChrome()
    SP = SoupParser()
    DB = DataBase()

    # TEST HERE
    # HC.get_soup('https://store.steampowered.com/app/671210/FINAL_FANTASY_XV_WINDOWS_EDITION_PLAYABLE_DEMO/')

    applist = DB.get_applist(table='watching_games')
    num_applist = len(applist)
    for idx, app in enumerate(applist):
        appid, name = app
        if idx % 50 == 0: HC.reconn()
        print('--------------', idx, '/', num_applist, '--------------')
        try:
            print(appid, name)
            url = 'https://store.steampowered.com/app/' + str(appid)
            soup = HC.get_soup(url)
            if soup is None:
                continue

            result = SP.parse(soup)
            result['appid'] = appid
            result['name'] = name
            try:
                DB.insert_data(result)
            except:
                # logging
                print('DB ERROR')
        except:
            print("skip ", appid, name, '\n')
            HC.reconn()
            continue

    print(datetime.now())
 def process(self, crypter):
     DataBase.replaceValue(self, 'name', self.player.name)
     LogicChangeAvatarNameCommand(self.client, self.player).send(crypter)
Beispiel #15
0
    def encode(self):
        reward_list = [2, 3, 8]

        if self.player.boxID == 5:
            newBrawlBox = self.player.brawlBoxes - 100
            DataBase.replaceValue(self, 'brawlBoxes', newBrawlBox)

            self.writeVint(203)
            self.writeVint(0)
            self.writeVint(1)
            self.writeVint(10)
            self.writeVint(2)
            GoldValue = random.randrange(1, 1000)
            self.writeVint(GoldValue)

            newGold = self.player.gold + GoldValue
            DataBase.replaceValue(self, 'gold', newGold)

            self.writeVint(0)
            self.writeVint(7)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(1)
            value = random.randrange(1, 20)
            self.writeVint(value)
            self.writeVint(0)
            reward = random.choice(reward_list)
            self.writeVint(reward)

            if reward == 8:
                newGems = self.player.gems + value
                DataBase.replaceValue(self, 'gems', newGems)
            elif reward == 3:
                newTickets = self.player.tickets + value
                DataBase.replaceValue(self, 'tickets', newTickets)

            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(1)
            self.writeVint(-1)
            self.writeVint(-1)
            self.writeVint(0)
            self.writeVint(0)

        if self.player.boxID == 4:
            newBigBox = self.player.bigBoxes - 10
            DataBase.replaceValue(self, 'bigBoxes', newBigBox)
            self.writeVint(203)
            self.writeVint(0)
            self.writeVint(1)
            self.writeVint(12)
            self.writeVint(2)
            GoldValue = random.randrange(1, 2500)
            self.writeVint(GoldValue)

            newGold = self.player.gold + GoldValue
            DataBase.replaceValue(self, 'gold', newGold)

            self.writeVint(0)
            self.writeVint(7)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(1)
            value = random.randrange(1, 50)
            self.writeVint(value)
            self.writeVint(0)
            reward = random.choice(reward_list)
            self.writeVint(reward)

            if reward == 8:
                newGems = self.player.gems + value
                DataBase.replaceValue(self, 'gems', newGems)
            elif reward == 3:
                newTickets = self.player.tickets + value
                DataBase.replaceValue(self, 'tickets', newTickets)

            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(1)
            self.writeVint(-1)
            self.writeVint(-1)
            self.writeVint(0)
            self.writeVint(0)

        if self.player.boxID == 3 or self.player.boxID == 9:
            self.writeVint(203)
            self.writeVint(0)
            self.writeVint(1)
            self.writeVint(11)
            self.writeVint(2)

            GoldValue = random.randrange(1, 5000)
            self.writeVint(GoldValue)

            newGold = self.player.gold + GoldValue
            DataBase.replaceValue(self, 'gold', newGold)

            self.writeVint(0)
            self.writeVint(7)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(1)
            value = random.randrange(1, 100)
            self.writeVint(value)
            self.writeVint(0)
            reward = random.choice(reward_list)
            self.writeVint(reward)

            if reward == 8:
                newGems = self.player.gems + value - 80
                DataBase.replaceValue(self, 'gems', newGems)
            elif reward == 3:
                newTickets = self.player.tickets + value
                newGems = self.player.gems - 80
                DataBase.replaceValue(self, 'tickets', newTickets)
                DataBase.replaceValue(self, 'gems', newGems)
            else:
                newGems = self.player.gems - 80
                DataBase.replaceValue(self, 'gems', newGems)

            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(1)
            self.writeVint(-1)
            self.writeVint(-1)
            self.writeVint(0)
            self.writeVint(0)

        if self.player.boxID == 1 or self.player.boxID == 10:
            self.writeVint(203)
            self.writeVint(0)
            self.writeVint(1)
            self.writeVint(12)
            self.writeVint(2)

            GoldValue = random.randrange(1, 2500)
            self.writeVint(GoldValue)

            newGold = self.player.gold + GoldValue
            DataBase.replaceValue(self, 'gold', newGold)

            self.writeVint(0)
            self.writeVint(7)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(1)
            value = random.randrange(1, 50)
            self.writeVint(value)
            self.writeVint(0)
            reward = random.choice(reward_list)
            self.writeVint(reward)

            if reward == 8:
                newGems = self.player.gems + value - 30
                DataBase.replaceValue(self, 'gems', newGems)
            elif reward == 3:
                newTickets = self.player.tickets + value
                newGems = self.player.gems - 30
                DataBase.replaceValue(self, 'tickets', newTickets)
                DataBase.replaceValue(self, 'gems', newGems)
            else:
                newGems = self.player.gems - 30
                DataBase.replaceValue(self, 'gems', newGems)

            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(0)
            self.writeVint(1)
            self.writeVint(-1)
            self.writeVint(-1)
            self.writeVint(0)
            self.writeVint(0)
Beispiel #16
0
from database.DataBase import DataBase
from generator.Simulator import Simulator
from acqusition.Station import Station
from storage.Storage import Storage
from query.Query import Query
from analysis.Analysis import Analysis

db = DataBase()
# generate dataset
generators = []
for i in range(2):
    generator = Simulator(type='simulator', item='item_A', name='Temperature')
    generator.encode()
    generators.append(generator)

# acqusition
station = Station(generators)
station.collect_station_datas()
# storage
storage = Storage(db, station)
storage.storage()

# query
query = Query(storage.session)
query.query()

# Analysis
analysis = Analysis(query.data_frame)
analysis.analysis()
Beispiel #17
0
    def process(self):
        if self.Unk != 23:
            if self.BrawlerSkinId == 0:
                self.player.brawlerID = 0

            elif self.BrawlerSkinId == 29:
                self.player.brawlerID = 0

            elif self.BrawlerSkinId == 52:
                self.player.brawlerID = 0

            elif self.BrawlerSkinId == 122:
                self.player.brawlerID = 0

            elif self.BrawlerSkinId == 159:
                self.player.brawlerID = 0

            elif self.BrawlerSkinId == 14:
                self.player.brawlerID = 8

            elif self.BrawlerSkinId == 15:
                self.player.brawlerID = 8

            elif self.BrawlerSkinId == 60:
                self.player.brawlerID = 8

            elif self.BrawlerSkinId == 79:
                self.player.brawlerID = 8

            elif self.BrawlerSkinId == 148:
                self.player.brawlerID = 8

            elif self.BrawlerSkinId == 1:
                self.player.brawlerID = 1

            elif self.BrawlerSkinId == 2:
                self.player.brawlerID = 1

            elif self.BrawlerSkinId == 69:
                self.player.brawlerID = 1

            elif self.BrawlerSkinId == 103:
                self.player.brawlerID = 1

            elif self.BrawlerSkinId == 135:
                self.player.brawlerID = 1

            elif self.BrawlerSkinId == 3:
                self.player.brawlerID = 2

            elif self.BrawlerSkinId == 25:
                self.player.brawlerID = 2

            elif self.BrawlerSkinId == 64:
                self.player.brawlerID = 2

            elif self.BrawlerSkinId == 102:
                self.player.brawlerID = 2

            elif self.BrawlerSkinId == 178:
                self.player.brawlerID = 2

            elif self.BrawlerSkinId == 13:
                self.player.brawlerID = 7

            elif self.BrawlerSkinId == 44:
                self.player.brawlerID = 7

            elif self.BrawlerSkinId == 47:
                self.player.brawlerID = 7

            elif self.BrawlerSkinId == 123:
                self.player.brawlerID = 7

            elif self.BrawlerSkinId == 162:
                self.player.brawlerID = 7

            elif self.BrawlerSkinId == 174:
                self.player.brawlerID = 7

            elif self.BrawlerSkinId == 4:
                self.player.brawlerID = 3

            elif self.BrawlerSkinId == 5:
                self.player.brawlerID = 3

            elif self.BrawlerSkinId == 58:
                self.player.brawlerID = 3

            elif self.BrawlerSkinId == 72:
                self.player.brawlerID = 3

            elif self.BrawlerSkinId == 91:
                self.player.brawlerID = 3

            elif self.BrawlerSkinId == 6:
                self.player.brawlerID = 9

            elif self.BrawlerSkinId == 56:
                self.player.brawlerID = 9

            elif self.BrawlerSkinId == 57:
                self.player.brawlerID = 9

            elif self.BrawlerSkinId == 97:
                self.player.brawlerID = 9

            elif self.BrawlerSkinId == 160:
                self.player.brawlerID = 9

            elif self.BrawlerSkinId == 22:
                self.player.brawlerID = 14

            elif self.BrawlerSkinId == 94:
                self.player.brawlerID = 14

            elif self.BrawlerSkinId == 98:
                self.player.brawlerID = 14

            elif self.BrawlerSkinId == 99:
                self.player.brawlerID = 14

            elif self.BrawlerSkinId == 163:
                self.player.brawlerID = 14

            elif self.BrawlerSkinId == 86:
                self.player.brawlerID = 22

            elif self.BrawlerSkinId == 106:
                self.player.brawlerID = 27

            elif self.BrawlerSkinId == 109:
                self.player.brawlerID = 27

            elif self.BrawlerSkinId == 143:
                self.player.brawlerID = 27

            elif self.BrawlerSkinId == 119:
                self.player.brawlerID = 30

            elif self.BrawlerSkinId == 167:
                self.player.brawlerID = 30

            elif self.BrawlerSkinId == 7:
                self.player.brawlerID = 10

            elif self.BrawlerSkinId == 28:
                self.player.brawlerID = 10

            elif self.BrawlerSkinId == 30:
                self.player.brawlerID = 10

            elif self.BrawlerSkinId == 128:
                self.player.brawlerID = 10

            elif self.BrawlerSkinId == 12:
                self.player.brawlerID = 6

            elif self.BrawlerSkinId == 27:
                self.player.brawlerID = 6

            elif self.BrawlerSkinId == 59:
                self.player.brawlerID = 6

            elif self.BrawlerSkinId == 90:
                self.player.brawlerID = 6

            elif self.BrawlerSkinId == 92:
                self.player.brawlerID = 6

            elif self.BrawlerSkinId == 116:
                self.player.brawlerID = 6

            elif self.BrawlerSkinId == 21:
                self.player.brawlerID = 13

            elif self.BrawlerSkinId == 71:
                self.player.brawlerID = 13

            elif self.BrawlerSkinId == 140:
                self.player.brawlerID = 13

            elif self.BrawlerSkinId == 77:
                self.player.brawlerID = 24

            elif self.BrawlerSkinId == 9:
                self.player.brawlerID = 4

            elif self.BrawlerSkinId == 26:
                self.player.brawlerID = 4

            elif self.BrawlerSkinId == 68:
                self.player.brawlerID = 4

            elif self.BrawlerSkinId == 130:
                self.player.brawlerID = 4

            elif self.BrawlerSkinId == 171:
                self.player.brawlerID = 4

            elif self.BrawlerSkinId == 34:
                self.player.brawlerID = 18

            elif self.BrawlerSkinId == 70:
                self.player.brawlerID = 18

            elif self.BrawlerSkinId == 158:
                self.player.brawlerID = 18

            elif self.BrawlerSkinId == 41:
                self.player.brawlerID = 19

            elif self.BrawlerSkinId == 61:
                self.player.brawlerID = 19

            elif self.BrawlerSkinId == 88:
                self.player.brawlerID = 19

            elif self.BrawlerSkinId == 165:
                self.player.brawlerID = 19

            elif self.BrawlerSkinId == 73:
                self.player.brawlerID = 25

            elif self.BrawlerSkinId == 93:
                self.player.brawlerID = 25

            elif self.BrawlerSkinId == 104:
                self.player.brawlerID = 25

            elif self.BrawlerSkinId == 132:
                self.player.brawlerID = 25

            elif self.BrawlerSkinId == 134:
                self.player.brawlerID = 25

            elif self.BrawlerSkinId == 142:
                self.player.brawlerID = 34

            elif self.BrawlerSkinId == 176:
                self.player.brawlerID = 34

            elif self.BrawlerSkinId == 23:
                self.player.brawlerID = 15

            elif self.BrawlerSkinId == 108:
                self.player.brawlerID = 15

            elif self.BrawlerSkinId == 120:
                self.player.brawlerID = 15

            elif self.BrawlerSkinId == 147:
                self.player.brawlerID = 15

            elif self.BrawlerSkinId == 24:
                self.player.brawlerID = 16

            elif self.BrawlerSkinId == 179:
                self.player.brawlerID = 16

            elif self.BrawlerSkinId == 42:
                self.player.brawlerID = 20

            elif self.BrawlerSkinId == 45:
                self.player.brawlerID = 20

            elif self.BrawlerSkinId == 125:
                self.player.brawlerID = 20

            elif self.BrawlerSkinId == 81:
                self.player.brawlerID = 26

            elif self.BrawlerSkinId == 146:
                self.player.brawlerID = 26

            elif self.BrawlerSkinId == 114:
                self.player.brawlerID = 29

            elif self.BrawlerSkinId == 139:
                self.player.brawlerID = 29

            elif self.BrawlerSkinId == 156:
                self.player.brawlerID = 36

            elif self.BrawlerSkinId == 18:
                self.player.brawlerID = 11

            elif self.BrawlerSkinId == 50:
                self.player.brawlerID = 11

            elif self.BrawlerSkinId == 63:
                self.player.brawlerID = 11

            elif self.BrawlerSkinId == 75:
                self.player.brawlerID = 11

            elif self.BrawlerSkinId == 173:
                self.player.brawlerID = 11

            elif self.BrawlerSkinId == 32:
                self.player.brawlerID = 17

            elif self.BrawlerSkinId == 111:
                self.player.brawlerID = 17

            elif self.BrawlerSkinId == 145:
                self.player.brawlerID = 17

            elif self.BrawlerSkinId == 67:
                self.player.brawlerID = 21

            elif self.BrawlerSkinId == 117:
                self.player.brawlerID = 21

            elif self.BrawlerSkinId == 172:
                self.player.brawlerID = 21

            elif self.BrawlerSkinId == 127:
                self.player.brawlerID = 32

            elif self.BrawlerSkinId == 137:
                self.player.brawlerID = 32

            elif self.BrawlerSkinId == 121:
                self.player.brawlerID = 31

            elif self.BrawlerSkinId == 152:
                self.player.brawlerID = 31

            elif self.BrawlerSkinId == 157:
                self.player.brawlerID = 37

            elif self.BrawlerSkinId == 177:
                self.player.brawlerID = 37

            elif self.BrawlerSkinId == 10:
                self.player.brawlerID = 5

            elif self.BrawlerSkinId == 11:
                self.player.brawlerID = 5

            elif self.BrawlerSkinId == 96:
                self.player.brawlerID = 5

            elif self.BrawlerSkinId == 19:
                self.player.brawlerID = 12

            elif self.BrawlerSkinId == 20:
                self.player.brawlerID = 12

            elif self.BrawlerSkinId == 49:
                self.player.brawlerID = 12

            elif self.BrawlerSkinId == 95:
                self.player.brawlerID = 12

            elif self.BrawlerSkinId == 100:
                self.player.brawlerID = 12

            elif self.BrawlerSkinId == 101:
                self.player.brawlerID = 12

            elif self.BrawlerSkinId == 62:
                self.player.brawlerID = 23

            elif self.BrawlerSkinId == 110:
                self.player.brawlerID = 23

            elif self.BrawlerSkinId == 126:
                self.player.brawlerID = 23

            elif self.BrawlerSkinId == 131:
                self.player.brawlerID = 23

            elif self.BrawlerSkinId == 113:
                self.player.brawlerID = 28

            elif self.BrawlerSkinId == 118:
                self.player.brawlerID = 28

            elif self.BrawlerSkinId == 155:
                self.player.brawlerID = 35

            elif self.BrawlerSkinId == 180:
                self.player.brawlerID = 35

            if self.player.brawlerID == 0:  #Shelly
                self.player.starpower = 76
                self.player.gadget = 255

            elif self.player.brawlerID == 1:  #Colt
                self.player.starpower = 77
                self.player.gadget = 273

            elif self.player.brawlerID == 2:  #Bull
                self.player.starpower = 78
                self.player.gadget = 272

            elif self.player.brawlerID == 3:  #Brock
                self.player.starpower = 79
                self.player.gadget = 245

            elif self.player.brawlerID == 4:  #Rico
                self.player.starpower = 80
                self.player.gadget = 246

            elif self.player.brawlerID == 5:  #Spike
                self.player.starpower = 81
                self.player.gadget = 247

            elif self.player.brawlerID == 6:  #Barley
                self.player.starpower = 82
                self.player.gadget = 273

            elif self.player.brawlerID == 7:  #Jessie
                self.player.starpower = 83
                self.player.gadget = 251

            elif self.player.brawlerID == 8:  #Nita
                self.player.starpower = 84
                self.player.gadget = 249

            elif self.player.brawlerID == 9:  #Dynamike
                self.player.starpower = 85
                self.player.gadget = 258

            elif self.player.brawlerID == 10:  #El Primo
                self.player.starpower = 86
                self.player.gadget = 264

            elif self.player.brawlerID == 11:  #Mortis
                self.player.starpower = 87
                self.player.gadget = 265

            elif self.player.brawlerID == 12:  #Crow
                self.player.starpower = 88
                self.player.gadget = 243

            elif self.player.brawlerID == 13:  #Poco
                self.player.starpower = 89
                self.player.gadget = 267

            elif self.player.brawlerID == 14:  #Bo
                self.player.starpower = 90
                self.player.gadget = 263

            elif self.player.brawlerID == 15:  #Piper
                self.player.starpower = 91
                self.player.gadget = 268

            elif self.player.brawlerID == 16:  #PAM
                self.player.starpower = 92
                self.player.gadget = 257

            elif self.player.brawlerID == 17:  #Tara
                self.player.starpower = 93
                self.player.gadget = 266

            elif self.player.brawlerID == 18:  #Darryl
                self.player.starpower = 94
                self.player.gadget = 260

            elif self.player.brawlerID == 19:  #Penny
                self.player.starpower = 99
                self.player.gadget = 248

            elif self.player.brawlerID == 20:  #Frank
                self.player.starpower = 104
                self.player.gadget = 261

            elif self.player.brawlerID == 21:  #Gene
                self.player.starpower = 109
                self.player.gadget = 252

            elif self.player.brawlerID == 22:  #Tick
                self.player.starpower = 114
                self.player.gadget = 253

            elif self.player.brawlerID == 23:  #Leon
                self.player.starpower = 119
                self.player.gadget = 276

            elif self.player.brawlerID == 24:  #Rosa
                self.player.starpower = 124
                self.player.gadget = 242

            elif self.player.brawlerID == 25:  #Carl
                self.player.starpower = 129
                self.player.gadget = 262

            elif self.player.brawlerID == 26:  #Bibi
                self.player.starpower = 134
                self.player.gadget = 275

            elif self.player.brawlerID == 27:  #8-Bit
                self.player.starpower = 168
                self.player.gadget = 259

            elif self.player.brawlerID == 28:  #Sandy
                self.player.starpower = 186
                self.player.gadget = 270

            elif self.player.brawlerID == 29:  #Bea
                self.player.starpower = 192
                self.player.gadget = 271

            elif self.player.brawlerID == 30:  #EMZ
                self.player.starpower = 198
                self.player.gadget = 274

            elif self.player.brawlerID == 31:  #Mr. P
                self.player.starpower = 204
                self.player.gadget = 269

            elif self.player.brawlerID == 32:  #Max
                self.player.starpower = 210
                self.player.gadget = 254

            elif self.player.brawlerID == 34:  #Jacky
                self.player.starpower = 222
                self.player.gadget = 256

            elif self.player.brawlerID == 35:  #Gale
                self.player.starpower = 228
                self.player.gadget = 277

            elif self.player.brawlerID == 36:  #Nani
                self.player.starpower = 234
                self.player.gadget = 278

            elif self.player.brawlerID == 37:  #Sprout
                self.player.starpower = 240
                self.player.gadget = 244

            DataBase.replaceValue(self, 'starpower', self.player.starpower)
            DataBase.replaceValue(self, 'gadget', self.player.gadget)

            GameroomData(self.client, self.player).send()
Beispiel #18
0

    def classify(self, dataSet):
        """
        Recebe um dataSet e aplica o extrairFrase para o dataSet
        :param dataSet:
        :return:
        """

        return nltk.classify.apply_features(self.extrairFrase, dataSet)


from database.DataBase import DataBase


db = DataBase()

dataSet=db.get_all_data_set(['vaticannews', 'semprequestione'])

# data=db.get_all_news_from('vaticannews')

p = Process(dataSet)
sp =p.stemmerAplay()
# print(p.extrairFrase())
print(type(p.extrairFrase(dataSet)))
print(type(p.freqWords(p.buscaPalavras()).values()))

# d=p.freqWords(p.buscaPalavras()).
# classificador=nltk.NaiveBayesClassifier.train(d)
# #
# print(classificador.show_most_informative_features(10))
    def encode(self):
        DataBase.loadAccount(self)
        self.writeVInt(2020260)
        self.writeVInt(67238)

        self.writeVInt(self.player.trophies)
        self.writeVInt(self.player.trophies)

        self.writeVInt(122)
        self.writeVInt(200)

        self.writeVInt(1200) #exp

        self.writeScID(28, self.player.profileIcon) #player thumbnails.csv

        self.writeScID(43, self.player.namecolor) #name colors

        self.writeVInt(0)

        self.writeVInt(0)

        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(122)
        self.writeVInt(0)
        self.writeVInt(1)
        self.writeVInt(1)
        self.writeVInt(256)
        self.writeVInt(590552)
        self.writeVInt(50552)
        self.writeVInt(6037352)
        self.writeVInt(200)
        self.writeVInt(200)
        self.writeVInt(5)
        self.writeVInt(77)
        self.writeVInt(180)
        self.writeVInt(430)
        self.writeVInt(975)
        self.writeVInt(2238)

        self.writeVInt(4)
        self.writeVInt(2)
        self.writeVInt(2)
        self.writeVInt(2)

        self.writeVInt(60)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(200)
        self.writeVInt(-1)
        self.writeVInt(0)

        self.writeVInt(99999)

        self.writeVInt(0)

        self.writeScID(16, self.player.brawlerID)  # selected brawler

        self.writeString("CA")
        self.writeString("v29")

        self.writeVInt(0)

        self.writeVInt(0)

        self.writeVInt(1)
        for x in range(1):
            self.writeVInt(2)  # current season [0 - tara bazaar, 1 - monsters summer, 2 - STARR Park]
            self.writeVInt(0)  # brawl pass tokens
            self.writeVInt(0)
            self.writeVInt(0)
            self.writeVInt(1)
            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(0)
            self.writeVInt(1)
            self.writeVInt(0)
            self.writeVInt(0)
            self.writeVInt(0)
            self.writeVInt(4)
            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(1)
            self.writeVInt(0)
            self.writeVInt(1)
            self.writeVInt(0)

        self.writeVInt(2020260)  # shop timestamp
        self.writeVInt(100)  # 100
        self.writeVInt(10)  # 10
        self.writeVInt(30)  # big box price
        self.writeVInt(3)  # big box multiplier
        self.writeVInt(80)  # mega box price
        self.writeVInt(10)  # mega box multiplier
        self.writeVInt(40)  # token doubler price
        self.writeVInt(1000)  # token doubler amount
        self.writeVInt(550)  # ??
        self.writeVInt(0)
        self.writeVInt(999900)

        self.writeVInt(6)
        for x in [0, 30, 80, 170, 350, 0]:
            self.writeVInt(x)

        self.writeVInt(16)
        for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 21, 22, 23, 24]:
            self.writeVInt(x)

        self.writeVInt(4)
        for x in self.maps:
            self.writeVInt(1883183565)  # timestamp
            self.writeVInt(self.maps.index(x) + 1)  # slot
            self.writeVInt(0)
            self.writeVInt(75992)  # time left
            self.writeVInt(10)
            self.writeScID(15, x)  # mapID
            self.writeVInt(3)  # state
            self.writeInt(0)
            self.writeVInt(0)
            self.writeVInt(0)
            self.writeVInt(0)
            self.writeVInt(0)
            self.writeVInt(0)
            self.writeVInt(0)

        self.writeVInt(0)  # events empty

        self.writeVInt(8)
        for x in [20, 35, 75, 140, 290, 480, 800, 1250]:
            self.writeVInt(x)

        self.writeVInt(8)
        for x in [1, 2, 3, 4, 5, 10, 15, 20]:
            self.writeVInt(x)

        self.writeVInt(0)  # tickets price (useless)

        self.writeVInt(0)  # tickets count (useless)

        self.writeVInt(4)
        for x in [20, 50, 140, 280]:  # coins price
            self.writeVInt(x)

        self.writeVInt(4)
        for x in [150, 400, 1200, 2600]:  # coins count
            self.writeVInt(x)

        self.writeVInt(2)
        self.writeVInt(200)
        self.writeVInt(20)
        self.writeVInt(8640)

        self.writeVInt(10)
        self.writeVInt(5)
        self.writeVInt(6)
        self.writeVInt(50)
        self.writeVInt(604800)
        self.writeVInt(1)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(3)
        self.writeVInt(0)
        self.writeVInt(900104)
        self.writeVInt(0)
        self.writeVInt(-1)
        self.writeVInt(0)
        self.writeVInt(0)
        self.writeVInt(0)

        # LogicClientAvatar #

        self.writeVInt(0)
        self.writeVInt(1)

        self.writeVInt(0)
        self.writeVInt(0)

        self.writeVInt(0)
        self.writeVInt(0)

        if self.player.name is None:
            self.writeString("nullptr")
            self.writeBool(False)  # name set
            DataBase.createAccount(self)   # create new account
        else:
            self.writeString(self.player.name)
            self.writeBool(True)
        self.writeInt(0)

        self.writeVInt(8)  # commodity array count

        self.writeHexa(
            '''2a170001170401170801170c01171001171401171801171c01172001172401172801172c01173001173401173801173c01178001011784010117880101179f010117a4010117a9010117ae010117b3010117b8010117bd01011782020117b1020117b6020117bc02011782030117880301178e0301179a030117a0030117a6030117ac03011797040117a8040105019f9a0c05089f9a0c05099f9a0c2710009f9a0c10019f9a0c10029f9a0c10039f9a0c10049f9a0c10059f9a0c10069f9a0c10079f9a0c10089f9a0c10099f9a0c100a9f9a0c100b9f9a0c100c9f9a0c100d9f9a0c100e9f9a0c100f9f9a0c10109f9a0c10119f9a0c10129f9a0c10139f9a0c10149f9a0c10159f9a0c10169f9a0c10179f9a0c10189f9a0c10199f9a0c101a9f9a0c101b9f9a0c101c9f9a0c101d9f9a0c101e9f9a0c101f9f9a0c10209f9a0c10229f9a0c10239f9a0c10249f9a0c10259f9a0c10269f9a0c10279f9a0c2710009f9a0c10019f9a0c10029f9a0c10039f9a0c10049f9a0c10059f9a0c10069f9a0c10079f9a0c10089f9a0c10099f9a0c100a9f9a0c100b9f9a0c100c9f9a0c100d9f9a0c100e9f9a0c100f9f9a0c10109f9a0c10119f9a0c10129f9a0c10139f9a0c10149f9a0c10159f9a0c10169f9a0c10179f9a0c10189f9a0c10199f9a0c101a9f9a0c101b9f9a0c101c9f9a0c101d9f9a0c101e9f9a0c101f9f9a0c10209f9a0c10229f9a0c10239f9a0c10249f9a0c10259f9a0c10269f9a0c10279f9a0c00271000a0161001a0161002a0161003a0161004a0161005a0161006a0161007a0161008a0161009a016100aa016100ba016100ca016100da016100ea016100fa0161010a0161011a0161012a0161013a0161014a0161015a0161016a0161017a0161018a0161019a016101aa016101ba016101ca016101da016101ea016101fa0161020a0161022a0161023a0161024a0161025a0161026a0161027a01627100008100108100208100308100408100508100608100708100808100908100a08100b08100c08100d08100e08100f08101008101108101208101308101408101508101608101708101808101908101a08101b08101c08101d08101e08101f081020081022081023081024081025081026081027088402178c0101178d0101178e0101178f010117900101179101011792010117930101179401011795010117960101179701011798010117990101179a0101179b0101179c0101179d0101179e010117a3010117a8010117ad010117b2010117b7010117bc01011781020117860201178702011788020117890201178a0201178b0201178c0201178d0201178e0201178f020117900201179102011792020117930201179402011795020117960201179702011798020117990201179a0201179b0201179c0201179d0201179e0201179f020117a0020117a1020117a2020117a3020117a4020117a5020117a6020117a7020117a8020117a9020117aa020117ac020117ae020117af020117b0020117b5020117ba020117bb020117800301178103011786030117870301178c0301178d030117920301179303011798030117990301179e0301179f030117a4030117a5030117aa030117ab030117b0030117b10301179b040117ac040117b3040117b4040117b2030117b3030117b4030117b5030117b6030117b7030117b8030117b9030117ba030117bb030117bc030117bd030117be030117bf030117800401178104011782040117830401178404011785040117860401178704011788040117890401178a0401178b0401178c0401178d0401178e0401178f040117900401179104011792040117930401179404011795040117960401179d040117ae040117b5040127100002100102100202100302100402100502100602100702100802100902100a02100b02100c02100d02100e02100f02101002101102101202101302101402101502101602101702101802101902101a02101b02101c02101d02101e02101f021020021022021023021024021025021026021027029f9a0c00a301a40100000000000000''')

        self.writeVInt(2)  # tutorial state
        self.writeVInt(0)
        print("[*] Message OwnHomeData has been sent.")
Beispiel #20
0
 def process(self, crypter):
     if self.player.tutorial < 2:
         self.player.tutorial += 1
         DataBase.replaceValue(self, 'tutorial', self.player.tutorial)
     OwnHomeDataMessage(self.client, self.player).send(crypter)
            print("Starting to re-populate DB.")
        else:
            print("Bye!")
            sys.exit()
    else:
        print("Bye!")
        sys.exit()

    db = None
    _i = None
    try:
        # create BERT model for Sentiment Analysis
        bert_sentiment = BertSentiment()

        # create DataBase object
        db = DataBase()

        # empty table before (re)populating data
        db.empty_table()

        # read the file with reviews and respective aspects
        df = pd.read_csv('./data/reviews_with_aspects_full.csv',
                         engine='python')
        #df = pd.read_csv('./data/aspects-top55k.csv', engine='python')
        #df = pd.read_csv('./data/test.csv', engine='python')
        df = df.reset_index(drop=True)
        print(df.shape)

        df = df.iloc[55800:len(df), :]

        df = df.reset_index(drop=True)
Beispiel #22
0
 def process(self):
     self.player.roomID = 0
     DataBase.replaceValue(self, 'roomID', self.player.roomID)
     TeamLeaveOkMessage(self.client, self.player).send()
Beispiel #23
0
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 24 21:05:15 2020

@author: rajpaul
"""

from database.DataBase import DataBase

if __name__ == "__main__":

    db = None
    try:

        # create DataBase object
        db = DataBase()
        conn = db.connect_to_db()

        # select max record id
        id_sql = " SELECT MAX(id) FROM restaurant; "

        cur = conn.cursor()
        cur.execute(id_sql)
        rows = cur.fetchall()

        last_row_id = rows[0][0]
        print("last_row_id:", last_row_id)

        for i in range(1, last_row_id + 1):
            print("updating row with id:", i)
Beispiel #24
0
 def process(self):
     self.player.roomID = 0
     DataBase.replaceValue(self, 'roomID', self.player.roomID)
     RoomDisconnect(self.client, self.player).send()
Beispiel #25
0
 def process(self):
     DataBase.replaceValue(self, 'mapID', self.player.mapID)
     GameroomData(self.client, self.player).send()
Beispiel #26
0
 def process(self):
     DataBase.replaceValue(self, 'DoNotDistrub', self.player.DoNotDistrub)
     DoNotDistrubServer(self.client, self.player).send()
Beispiel #27
0
import nltk
from database.DataBase import DataBase
from sklearn.model_selection import train_test_split

from facebookapi.publushFacebook import PublishFacebook
from preprocess.Process import Process
from util.Character import removerAcentosECaracteresEspeciais
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.corpus import stopwords

db = DataBase()

data = db.get_all_data_set(
    ['vaticannews', 'semprequestione', 'acidigital', 'cancaonova'])

y = [clazz for (title, news, clazz) in data]
X = [news for (title, news, clazz) in data]


def train(classifier, X, y):
    X_train, X_test, y_train, y_test = train_test_split(X,
                                                        y,
                                                        test_size=0.25,
                                                        random_state=33)
    classifier.fit(X_train, y_train)
    print("Accuracy: %s" % classifier.score(X_test, y_test))
    return classifier

Beispiel #28
0
    def process(self):
        if self.commandID == 500 or self.commandID == 517 or self.commandID == 535:
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.player.boxID = self.read_Vint()
            print("Command ID", self.commandID, "has been handled")
            ServerBox(self.client, self.player).send()

        elif self.commandID == 505:
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.player.profileIcon = self.read_Vint()
            DataBase.replaceValue(self, 'profileIcon', self.player.profileIcon)
            print("Command ID", self.commandID, "has been handled")

        elif self.commandID == 506:
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.player.skinID = self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.player.brawlerID = self.read_Vint()
            DataBase.replaceValue(self, 'skinID', self.player.skinID)
            if self.player.brawlerID == 0:
                DataBase.replaceValue(self, 'shellySkin', self.player.skinID)

            elif self.player.brawlerID == 1:
                DataBase.replaceValue(self, 'coltSkin', self.player.skinID)

            elif self.player.brawlerID == 2:
                DataBase.replaceValue(self, 'bullSkin', self.player.skinID)

            elif self.player.brawlerID == 3:
                DataBase.replaceValue(self, 'brockSkin', self.player.skinID)

            elif self.player.brawlerID == 4:
                DataBase.replaceValue(self, 'ricoSkin', self.player.skinID)

            elif self.player.brawlerID == 5:
                DataBase.replaceValue(self, 'spikeSkin', self.player.skinID)

            elif self.player.brawlerID == 6:
                DataBase.replaceValue(self, 'barleySkin', self.player.skinID)

            elif self.player.brawlerID == 7:
                DataBase.replaceValue(self, 'jessieSkin', self.player.skinID)

            elif self.player.brawlerID == 8:
                DataBase.replaceValue(self, 'nitaSkin', self.player.skinID)

            elif self.player.brawlerID == 9:
                DataBase.replaceValue(self, 'dynamikeSkin', self.player.skinID)

            elif self.player.brawlerID == 10:
                DataBase.replaceValue(self, 'elprimoSkin', self.player.skinID)

            elif self.player.brawlerID == 11:
                DataBase.replaceValue(self, 'mortisSkin', self.player.skinID)

            elif self.player.brawlerID == 12:
                DataBase.replaceValue(self, 'crowSkin', self.player.skinID)

            elif self.player.brawlerID == 13:
                DataBase.replaceValue(self, 'pocoSkin', self.player.skinID)

            elif self.player.brawlerID == 14:
                DataBase.replaceValue(self, 'boSkin', self.player.skinID)

            elif self.player.brawlerID == 15:
                DataBase.replaceValue(self, 'piperSkin', self.player.skinID)

            elif self.player.brawlerID == 16:
                DataBase.replaceValue(self, 'pamSkin', self.player.skinID)

            elif self.player.brawlerID == 17:
                DataBase.replaceValue(self, 'taraSkin', self.player.skinID)

            elif self.player.brawlerID == 18:
                DataBase.replaceValue(self, 'darrylSkin', self.player.skinID)

            elif self.player.brawlerID == 19:
                DataBase.replaceValue(self, 'pennySkin', self.player.skinID)

            elif self.player.brawlerID == 20:
                DataBase.replaceValue(self, 'frankSkin', self.player.skinID)

            elif self.player.brawlerID == 21:
                DataBase.replaceValue(self, 'geneSkin', self.player.skinID)

            elif self.player.brawlerID == 22:
                DataBase.replaceValue(self, 'tickSkin', self.player.skinID)

            elif self.player.brawlerID == 23:
                DataBase.replaceValue(self, 'leonSkin', self.player.skinID)

            elif self.player.brawlerID == 24:
                DataBase.replaceValue(self, 'rosaSkin', self.player.skinID)

            elif self.player.brawlerID == 25:
                DataBase.replaceValue(self, 'carlSkin', self.player.skinID)

            elif self.player.brawlerID == 26:
                DataBase.replaceValue(self, 'bibiSkin', self.player.skinID)

            elif self.player.brawlerID == 27:
                DataBase.replaceValue(self, '8bitSkin', self.player.skinID)

            elif self.player.brawlerID == 28:
                DataBase.replaceValue(self, 'sandySkin', self.player.skinID)

            elif self.player.brawlerID == 29:
                DataBase.replaceValue(self, 'beaSkin', self.player.skinID)

            elif self.player.brawlerID == 30:
                DataBase.replaceValue(self, 'emzSkin', self.player.skinID)

            elif self.player.brawlerID == 31:
                DataBase.replaceValue(self, 'mrpSkin', self.player.skinID)

            elif self.player.brawlerID == 32:
                DataBase.replaceValue(self, 'maxSkin', self.player.skinID)

            elif self.player.brawlerID == 34:
                DataBase.replaceValue(self, 'jackySkin', self.player.skinID)

            elif self.player.brawlerID == 35:
                DataBase.replaceValue(self, 'galeSkin', self.player.skinID)

            elif self.player.brawlerID == 36:
                DataBase.replaceValue(self, 'naniSkin', self.player.skinID)

            elif self.player.brawlerID == 37:
                DataBase.replaceValue(self, 'sproutSkin', self.player.skinID)

            if self.player.brawlerID == 0:  #Shelly
                self.player.starpower = 76
                self.player.gadget = 255

            elif self.player.brawlerID == 1:  #Colt
                self.player.starpower = 77
                self.player.gadget = 273

            elif self.player.brawlerID == 2:  #Bull
                self.player.starpower = 78
                self.player.gadget = 272

            elif self.player.brawlerID == 3:  #Brock
                self.player.starpower = 79
                self.player.gadget = 245

            elif self.player.brawlerID == 4:  #Rico
                self.player.starpower = 80
                self.player.gadget = 246

            elif self.player.brawlerID == 5:  #Spike
                self.player.starpower = 81
                self.player.gadget = 247

            elif self.player.brawlerID == 6:  #Barley
                self.player.starpower = 82
                self.player.gadget = 273

            elif self.player.brawlerID == 7:  #Jessie
                self.player.starpower = 83
                self.player.gadget = 251

            elif self.player.brawlerID == 8:  #Nita
                self.player.starpower = 84
                self.player.gadget = 249

            elif self.player.brawlerID == 9:  #Dynamike
                self.player.starpower = 85
                self.player.gadget = 258

            elif self.player.brawlerID == 10:  #El Primo
                self.player.starpower = 86
                self.player.gadget = 264

            elif self.player.brawlerID == 11:  #Mortis
                self.player.starpower = 87
                self.player.gadget = 265

            elif self.player.brawlerID == 12:  #Crow
                self.player.starpower = 88
                self.player.gadget = 243

            elif self.player.brawlerID == 13:  #Poco
                self.player.starpower = 89
                self.player.gadget = 267

            elif self.player.brawlerID == 14:  #Bo
                self.player.starpower = 90
                self.player.gadget = 263

            elif self.player.brawlerID == 15:  #Piper
                self.player.starpower = 91
                self.player.gadget = 268

            elif self.player.brawlerID == 16:  #PAM
                self.player.starpower = 92
                self.player.gadget = 257

            elif self.player.brawlerID == 17:  #Tara
                self.player.starpower = 93
                self.player.gadget = 266

            elif self.player.brawlerID == 18:  #Darryl
                self.player.starpower = 94
                self.player.gadget = 260

            elif self.player.brawlerID == 19:  #Penny
                self.player.starpower = 99
                self.player.gadget = 248

            elif self.player.brawlerID == 20:  #Frank
                self.player.starpower = 104
                self.player.gadget = 261

            elif self.player.brawlerID == 21:  #Gene
                self.player.starpower = 109
                self.player.gadget = 252

            elif self.player.brawlerID == 22:  #Tick
                self.player.starpower = 114
                self.player.gadget = 253

            elif self.player.brawlerID == 23:  #Leon
                self.player.starpower = 119
                self.player.gadget = 276

            elif self.player.brawlerID == 24:  #Rosa
                self.player.starpower = 124
                self.player.gadget = 242

            elif self.player.brawlerID == 25:  #Carl
                self.player.starpower = 129
                self.player.gadget = 262

            elif self.player.brawlerID == 26:  #Bibi
                self.player.starpower = 134
                self.player.gadget = 275

            elif self.player.brawlerID == 27:  #8-Bit
                self.player.starpower = 168
                self.player.gadget = 259

            elif self.player.brawlerID == 28:  #Sandy
                self.player.starpower = 186
                self.player.gadget = 270

            elif self.player.brawlerID == 29:  #Bea
                self.player.starpower = 192
                self.player.gadget = 271

            elif self.player.brawlerID == 30:  #EMZ
                self.player.starpower = 198
                self.player.gadget = 274

            elif self.player.brawlerID == 31:  #Mr. P
                self.player.starpower = 204
                self.player.gadget = 269

            elif self.player.brawlerID == 32:  #Max
                self.player.starpower = 210
                self.player.gadget = 254

            elif self.player.brawlerID == 34:  #Jacky
                self.player.starpower = 222
                self.player.gadget = 256

            elif self.player.brawlerID == 35:  #Gale
                self.player.starpower = 228
                self.player.gadget = 277

            elif self.player.brawlerID == 36:  #Nani
                self.player.starpower = 234
                self.player.gadget = 278

            elif self.player.brawlerID == 37:  #Sprout
                self.player.starpower = 240
                self.player.gadget = 244

            DataBase.replaceValue(self, 'starpower', self.player.starpower)
            DataBase.replaceValue(self, 'gadget', self.player.gadget)

            DataBase.replaceValue(self, 'brawlerID', self.player.brawlerID)

            print("Command ID", self.commandID, "has been handled")

        elif self.commandID == 521:
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.gold = self.read_Vint()
            if self.gold == 0:
                newGold = self.player.gold + 150
                newGems = self.player.gems - 20
                DataBase.replaceValue(self, 'gold', newGold)
                DataBase.replaceValue(self, 'gems', newGems)
            elif self.gold == 1:
                newGold = self.player.gold + 400
                newGems = self.player.gems - 50
                DataBase.replaceValue(self, 'gold', newGold)
                DataBase.replaceValue(self, 'gems', newGems)
            elif self.gold == 2:
                newGold = self.player.gold + 1200
                newGems = self.player.gems - 140
                DataBase.replaceValue(self, 'gold', newGold)
                DataBase.replaceValue(self, 'gems', newGems)
            print("Command ID", self.commandID, "has been handled")

        elif self.commandID == 509:
            newGems = self.player.gems - 50
            DataBase.replaceValue(self, 'gems', newGems)
            print("Command ID", self.commandID, "has been handled")

        elif self.commandID == 527:
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.namecolor = self.read_Vint()
            DataBase.replaceValue(self, 'namecolor', self.namecolor)
            print("Command ID", self.commandID, "has been handled")

        elif self.commandID == 529:
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.read_Vint()
            self.player.starpower = self.read_Vint()
            DataBase.replaceValue(self, 'starpower', self.player.starpower)
            if self.player.roomID > 0:
                GameroomData(self.client, self.player).send()
            print("Command ID", self.commandID, "has been handled")

        elif self.commandID >= 0:
            print("Command ID", self.commandID, "is not handled!")
Beispiel #29
0
 def process(self):
     DataBase.replaceValue(self, 'mapID', self.player.mapID)
     TeamMessage(self.client, self.player).send()
Beispiel #30
0
    # Prompt user before re-scoring DB
    _in1 = input(
        "Do you really want to re-score the current DB? Enter yes/no: ")
    if _in1.lower() == 'yes':
        print("Starting to re-score DB.")
    else:
        print("Bye!")
        sys.exit()

    db = None
    try:

        # create DataBase object
        db = DataBase(
            'C:\\NUS_ISS_MTech\Year 2\Semester 2 - Practical Natural Language Processing\PLP CA\database\gastrotommy_v3.db'
        )
        conn = db.connect_to_db()

        # select max record id
        id_sql = " SELECT MAX(id) FROM restaurant; "

        cur = conn.cursor()
        cur.execute(id_sql)
        rows = cur.fetchall()

        last_row_id = rows[0][0]
        print("last_row_id:", last_row_id)

        for i in range(1, last_row_id + 1):
            print("updating row with id:", i)