repl.it
@AmeliaBlackwell/

Fishing Game Account Handler

Python

No description

fork
loading
Files
  • main.py
  • accounts.txt
  • fish.txt
  • hiscorers.txt
  • jsonstorestate.txt
  • newaccounts.txt
  • requirement.txt
  • rods.txt
  • treasures.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import json_store_client
from hashlib import sha512

jsonstoretoken1="c92f7b55a824b49872dfc697bdfca668409dd1a1ce6fa51e12ac15cc0c448e10"
jsonstoretoken2="1ce779efcf91c84e3f7af651a17051a023f5fa3ace41ed4345af9d03953227cd"
jsonstoretoken3="dde7c704d768a46445a863c6a7f7c5459e60a50b87b870e3925c1f838afa13ba"
client=json_store_client.Client(jsonstoretoken1)
client2=json_store_client.Client(jsonstoretoken2)
client3=json_store_client.Client(jsonstoretoken3)

# client.delete("accounts")
# client.delete("hiscorers")

def addaccounts(filename):
    accountsfile=open(filename,"r")  
    accounts=accountsfile.readlines()
    accountsfile.close()
    naccounts=[account.strip() for account in accounts]
    client.store("accounts",naccounts)

def addhiscorers(filename):
    hiscorersfile=open(filename,"r")   ##ADDS HISCORES.TXT TO JSONSTORE
    hiscorers=hiscorersfile.readlines()
    hiscorersfile.close()
    nhiscorers=[hiscorer.strip() for hiscorer in hiscorers]
    client.store("hiscorers",nhiscorers)

def hashpws():
    salt = "3d987fbc3c8146c1a4903e5d198512c9"  ##HASHES EXISTING PASSWORDS
    accounts=client.retrieve("accounts")
    for account in accounts:
        hashedpw = sha512(account.pw.encode() + salt.encode()).hexdigest()
        account.pw = hashedpw
    client.delete("accounts")
    client.store("accounts",accounts)
    

def printaccounts():
    accounts=client.retrieve("accounts")
    accountsfile = open("newaccounts.txt", "w")
    print(len(list(accounts)))
    for account in list(accounts):
        accountsfile.write(account)
    accountsfile.close()

def printhiscorers():
    hiscorers=client.retrieve("hiscorers")
    hiscorersfile = open("newhiscorers.txt", "w")
    for hiscorer in hiscorers:
        hiscorersfile.write(hiscorer)
    hiscorersfile.close()

def changeaccounts():
    b=False
    while not b:
        try:
            accounts=client2.retrieve("accounts")
            b=True
        except:
            pass
    b=False
    naccounts=[]
    for account in accounts:
        account=account.split("-")
        if account[0]=="amelia":
            print(account)
        #if account[0]=="ap" or account[0]=="jan" or account[0]=="t1" or account[0]=="t2" or account[0]=="ma" or account[0]=="mar" or account[0]=="airamelia" or account[0]=="t3" or account[0]=="bamelia" or account[0]=="camelia" or account[0]=="tester" or account[0]=="iceamelia" or account[0]=="lottie" or account[0]=="testy" or account[0]=="test1" or account[0] == "amelia3" or account[0]=="amelia4" or account[0]=="icyamelia" or account[0]=="feb" or account[0]=="dec" or account[0]=="firey" or account[0]=="ju" or account[0]=="tes" or account[0]=="aug" or account[0]=="sep" or account[0]=="oct" or account[0]=="lo" or account[0]=="pish" or account[0]=="" or account[0]=="test":
        #    pass
        #else:
        #if account[13]=="ice":
        #    account[13]="beyond the wall"
        #elif account[13]=="desert":
        #    account[13]="the dothraki plains"
        #elif account[13]=="normal":
        #    account[13]="the riverlands"
                    #account.append("normal")
        #account[2]="{},0".format(account[2])
        #n=False
        #for accountel in account[:]:
        #    if accountel=="normal":
        #        if n:
         #           account.remove(accountel)
         #       else:
         #           n=True
        naccounts.append("-".join(account))
#     naccounts=[]
#     for account in accounts[:]:
#         account=account.split("-")
#         naccount=account[:8]
#         for el in account[8:13]:
#             if el=="empty":
#                 naccount.append("empty")
#             else:
#                 nnel=[]
#                 nel=el.split("/")
#                 for elel in nel[:]:
#                     nelel=elel.split(",")
#                     nelel.pop(-1)
#                     #nelel.append("0")
#                     nnel.append(",".join(nelel))
#                 naccount.append("/".join(nnel))
#         naccount.append(account[13])
#         naccount.append(account[14])
#         naccount.append(account[15])
#     #print(naccounts)

#     for account in list(accounts):
#         naccount=account.split("-")
# #    naccount.append("fair")
#         nnaccount="-".join(naccount)
#         naccounts.append(nnaccount)
    while not b:
        try:
            client.delete("accounts")
            client.store("accounts",naccounts)
            b=True
        except:
            pass

def changehiscores():
    b=False
    while not b:
        try:
            hiscores=client.retrieve("hiscorers")
            b=True
        except:
            pass
    b=False
    nhiscores=[]
    for hiscore in hiscores[:-3]:
        print(hiscore)
        nhiscores.append(hiscore)


    #nhiscores=[]
    #for hiscore in hiscores:
    #    hiscore="{}-empty".format(hiscore)
    while not b:
        try:
            client.delete("hiscorers")
            client.store("hiscorers",nhiscores)
            b=True
        except:
            pass

def backupaccounts():
    b=False
    while not b:
        try:
            accounts=client2.retrieve("accounts")
            b=True
        except:
            pass
    b=False
    while not b:
        try:
            client.store("accounts",accounts)
            b=True
        except:
            pass

def backuphiscorers():
    b=False
    while not b:
        try:
            hiscorers=client.retrieve("hiscorers")
            b=True
        except:
            pass
    b=False
    while not b:
        try:
            client3.delete("hiscorers")
            client3.store("hiscorers",hiscorers)
            b=True
        except:
            pass


##PLEASE DO NOT USE THESE FUNCTIONS!!!

#client.delete("accounts")
#addaccounts("accounts.txt")
#changeaccounts()
#printaccounts()
#client.delete("endgame")
#client.store("endgame",[])
backupaccounts()
#changehiscores()
#backuphiscorers()