-
Notifications
You must be signed in to change notification settings - Fork 0
/
database_editor.py
1121 lines (1049 loc) · 35.9 KB
/
database_editor.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import os
import ast
import csv
import psycopg2
import tkinter as tk
from configparser import ConfigParser
from tkinter import ttk
from tkinter import filedialog as fd
#TKINTER SETUP
def kinter():
global root
global tab1
global tab2
global tab3
global tab4
global tab5
global tab6
global tab7
global tab8
root = tk.Tk()
root.title("Database Edit")
tabControl = ttk.Notebook(root,height=400,width=300,padding=10)
tab2 = ttk.Frame(tabControl)
tab3 = ttk.Frame(tabControl)
tab1 = ttk.Frame(tabControl)
tab4 = ttk.Frame(tabControl)
tab5 = ttk.Frame(tabControl)
tab6 = ttk.Frame(tabControl)
tab7 = ttk.Frame(tabControl)
tab8 = ttk.Frame(tabControl)
tabControl.add(tab2, text ='Course')
tabControl.add(tab3, text ='GCP')
tabControl.add(tab1, text ='mog')
tabControl.add(tab4, text ='gacha')
tabControl.add(tab5, text ='guild')
tabControl.add(tab6, text ='login')
tabControl.add(tab7, text ='road')
tabControl.add(tab8, text ='save')
tabControl.pack(expand = 2, fill ="both")
#POSTGRAS SETUP
def config(filename='database.ini', section='postgresql'):
# create a parser
parser = ConfigParser()
# read config file
parser.read(filename)
# get section, default to postgresql
db = {}
if parser.has_section(section):
params = parser.items(section)
for param in params:
db[param[0]] = param[1]
else:
raise Exception('Section {0} not found in the {1} file'.format(section, filename))
return db
def setup():
global conn
global cur
try:
param = config()
conn = psycopg2.connect(**param)
cur = conn.cursor()
state0[0]=0
except (Exception, psycopg2.DatabaseError) as error:
state0[0]=1
l.config(text="database error")
# Call Funnction
def join_int(tuple_of_string):
global numb
numb = []
for i in range(len(tuple_of_string)):
numb.append(''.join(str(y) for y in tuple_of_string[i]))
for i in range(len(numb)):
numb[i]=int(numb[i])
def join_int2(tuple_of_string):
global numb2
numb2 = []
for i in range(len(tuple_of_string)):
numb2.append(''.join(str(y) for y in tuple_of_string[i]))
for i in range(len(numb2)):
numb2[i]=int(numb2[i])
def join_str(tuple_of_string):
global text
text = []
for i in range(len(tuple_of_string)):
text.append(''.join(tuple_of_string[i]))
def gcp_name():
sql = 'SELECT name FROM public.characters WHERE gcp IS NOT NULL'
cur.execute(sql)
global gcp_n
gcp_n = cur.fetchall();
def gcp_all():
sql = 'SELECT gcp FROM public.characters WHERE gcp IS NOT NULL'
cur.execute(sql)
global gcp_a
gcp_a = cur.fetchall();
def gcp_search(inp):
sql = '''SELECT gcp FROM public.characters where id = %s '''
global gcp_s
cur.execute(sql % inp)
gcp_s = cur.fetchall();
def gcp_ch(idn,value):
sql = """ UPDATE public.characters SET gcp = %s WHERE id = %s """
cur.execute(sql % (str(value),idn))
conn.commit()
def rg_name():
sql = 'SELECT username FROM public.users'
cur.execute(sql)
global rg_n
rg_n = cur.fetchall();
def rg_search(name):
sql = '''SELECT rights FROM public.users where username = '%s' '''
global rg_s
cur.execute(sql % name)
rg_s = cur.fetchall();
def rg_ch(name,value):
sql = """ UPDATE public.users SET rights = %s WHERE username = '%s' """
cur.execute(sql % (str(value),name))
conn.commit()
def rg_ch_all(value):
sql = """ UPDATE public.users SET rights = %s """
cur.execute(sql % str(value))
conn.commit()
def rg_def(value):
sql="""ALTER TABLE public.users ALTER COLUMN rights SET DEFAULT %s """
cur.execute(sql % str(value))
conn.commit()
def tra_ind(idn):
hexa = open(cwd,'rb').read().hex()
sql = '''UPDATE characters SET skin_hist=(decode('%s','hex')) WHERE id= %s '''
cur.execute(sql % (hexa,idn))
conn.commit()
def tra_all():
hexa = open(cwd,'rb').read().hex()
sql = '''UPDATE characters SET skin_hist=(decode('%s','hex')) '''
cur.execute(sql % hexa)
conn.commit()
def prem_ind(idn,value):
sql = """ UPDATE public.characters SET gacha_prem = %s WHERE id = %s """
cur.execute(sql % (str(value),idn))
conn.commit()
def trial_ind(idn,value):
sql = """ UPDATE public.characters SET gacha_trial = %s WHERE id = %s """
cur.execute(sql % (str(value),idn))
conn.commit()
def prem_all(value):
sql = """ UPDATE public.characters SET gacha_prem = %s """
cur.execute(sql % str(value))
conn.commit()
def trial_all(value):
sql = """ UPDATE public.characters SET gacha_trial = %s """
cur.execute(sql % str(value))
conn.commit()
def guild_ind(inp,value):
sql = """ UPDATE public.guilds SET rank_rp = %s WHERE id = %s """
cur.execute(sql % (str(value),inp))
conn.commit()
def guild_all(value):
sql = """ UPDATE public.guilds SET rank_rp = %s"""
cur.execute(sql % str(value))
conn.commit()
def guild_name():
sql = 'SELECT name FROM public.guilds'
cur.execute(sql)
global guild_n
guild_n = cur.fetchall();
def guild_id(inp):
sql = '''SELECT id FROM public.guilds WHERE name = '%s' '''
cur.execute(sql % inp)
global guild_i
guild_i = cur.fetchall();
join_int2(guild_i)
guild_i=numb2[0]
def guild_info(inp):
sql1='''SELECT character_id FROM public.guild_characters WHERE guild_id = %s '''
sql='''SELECT id FROM public.guild_characters '''
cur.execute(sql1 % inp)
global gd_char
global gd_index
gd_char = cur.fetchall();
cur.execute(sql)
gd_index = cur.fetchall();
def leader(inp,gd):
sql='''UPDATE public.guilds SET leader_id=%s WHERE id=%s '''
sql1 = ''' INSERT INTO guild_characters (id,guild_id,character_id,joined_at,avoid_leadership,order_index) VALUES (%s,%s,%s,DEFAULT,DEFAULT,DEFAULT)'''
sql3='''UPDATE public.guild_characters SET avoid_leadership=false WHERE character_id=%s '''
join_int2(gd_index)
numb2.sort()
idg=numb2[-1]+1
cur.execute(sql % (inp,gd))
if ( cb_guild.get()==0):
cur.execute(sql1 % (idg,inp,gd))
elif ( cb_guild.get()==1):
cur.execute(sql3 % inp)
conn.commit()
def member(inp,gd):
sql = ''' INSERT INTO guild_characters (id,guild_id,character_id,joined_at,avoid_leadership,order_index) VALUES (%s,%s,%s,DEFAULT,true,DEFAULT)'''
join_int2(gd_index)
numb2.sort()
idg=numb2[-1]+1
cur.execute(sql % (idg,gd,inp))
conn.commit()
def log_id(name):
sql = '''SELECT id FROM public.characters WHERE name='%s' '''
cur.execute(sql % name)
global log_i
log_i = cur.fetchall();
def log_tof(idn):
sql = ''' UPDATE public.login_boost_state SET end_time = 1 WHERE char_id= %s '''
cur.execute(sql % str(idn))
conn.commit()
def log_ton(idn):
sql = '''UPDATE public.login_boost_state SET week_count = 5 WHERE char_id= %s'''
sql1= '''UPDATE public.login_boost_state SET available = true WHERE char_id= %s'''
sql2 = ''' UPDATE public.login_boost_state SET end_time = 0 WHERE char_id= %s '''
cur.execute(sql % str(idn))
cur.execute(sql2 % str(idn))
cur.execute(sql1 % str(idn))
conn.commit()
def log_tof_all():
sql = ''' UPDATE public.login_boost_state SET end_time = 1'''
cur.execute(sql)
conn.commit()
def log_ton_all():
sql = '''UPDATE public.login_boost_state SET week_count = 5 '''
sql1= '''UPDATE public.login_boost_state SET available = true'''
sql2= '''UPDATE public.login_boost_state SET end_time = 0'''
cur.execute(sql)
cur.execute(sql1)
cur.execute(sql2)
conn.commit()
def road_up():
file = open(road_dir)
csvrd = csv.reader(file)
sql2 = '''TRUNCATE TABLE public.normal_shop_items RESTART IDENTITY'''
sql = ''' INSERT INTO normal_shop_items (shoptype,shopid,itemhash,itemid,points,tradequantity,rankreqlow,rankreqhigh,rankreqg,storelevelreq,maximumquantity,boughtquantity,roadfloorsrequired,weeklyfataliskills) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'''
sql1 = ''' INSERT INTO normal_shop_items (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'''
if ( cb_head.get()==1):
header_id = []
header_id = next(csvrd)
cur.execute(sql2)
for row in csvrd:
a = []
a.append(row)
cur.execute(sql1 % (header_id[0],header_id[1],header_id[2],header_id[3],header_id[4],header_id[5],header_id[6],header_id[7],header_id[8],header_id[9],header_id[10],header_id[11],header_id[12],header_id[13],a[0][0],a[0][1],a[0][2],a[0][3],a[0][4],a[0][5],a[0][6],a[0][7],a[0][8],a[0][9],a[0][10],a[0][11],a[0][12],a[0][13]))
else:
cur.execute(sql2)
for row in csvrd:
a = []
a.append(row)
cur.execute(sql % (a[0][0],a[0][1],a[0][2],a[0][3],a[0][4],a[0][5],a[0][6],a[0][7],a[0][8],a[0][9],a[0][10],a[0][11],a[0][12],a[0][13]))
conn.commit()
def save_save(idn):
hexa = open(savefile,'rb').read().hex()
sql = '''UPDATE characters SET savedata=(decode('%s','hex')) WHERE id= %s '''
cur.execute(sql % (hexa,idn))
conn.commit()
def save_partner(idn):
hexa = open(partner,'rb').read().hex()
sql = '''UPDATE characters SET partner=(decode('%s','hex')) WHERE id= %s '''
cur.execute(sql % (hexa,idn))
conn.commit()
def road_scan():
sql = 'SELECT itemhash FROM public.normal_shop_items'
cur.execute(sql)
global road_s
global road_v
road_s = cur.fetchall();
global road_i
join_int2(road_s)
numb2.sort()
road_i=numb2[-1]+1
road_v=len(road_s)
def road_add(item,price,quant,floor,fata):
sql = ''' INSERT INTO normal_shop_items (shoptype,shopid,itemhash,itemid,points,tradequantity,rankreqlow,rankreqhigh,rankreqg,storelevelreq,maximumquantity,boughtquantity,roadfloorsrequired,weeklyfataliskills) VALUES (10,5,%s,%s,%s,%s,0,0,1,1,0,1,%s,%s)'''
cur.execute(sql % (road_i,item,price,quant,floor,fata))
conn.commit()
def check_id(idnumb):
sql = '''SELECT name FROM public.characters WHERE id=%s '''
sql1= '''SELECT user_id FROM public.characters WHERE id=%s'''
sql2 = '''SELECT username FROM public.users WHERE id= %s '''
cur.execute(sql % idnumb)
global nm
nm = cur.fetchall();
join_str(nm)
nm = text[0]
cur.execute(sql1 % idnumb)
global nd
uid = cur.fetchall();
join_int2(uid)
cur.execute(sql2 % numb2[0])
nd = cur.fetchall();
join_str(nd)
nd = text[0]
###tkinter function
##ERROR define
def multiple_err(name):
log_id(name)
join_int(log_i)
a = len(numb)
global cid
if a>=2 :
l.config(text='same name with id = '+str([numb[i] for i in range(a)]))
pick_id()
elif (a==0):
l.config(text='name not found')
elif (a==1):
l.config(text=name+' found with id '+str(numb[0]))
cid = numb[0]
def timeout():
try:
sql = 'SELECT username FROM public.users'
cur.execute(sql)
except psycopg2.OperationalError as error:
l.config(text='connection timed out or failed to connect')
def drop_c(ch):
ch = variable.get()
numb[0] = ch
l.config(text='you selected id = '+str(numb[0]))
global cid
cid = numb[0]
root1.destroy()
def pick_id():
global root1
root1 = tk.Tk()
root1.title("pick id")
tabControl = ttk.Notebook(root1)
a = len(numb)
for i in range(a):
check_id(numb[i])
tk.Label(root1, text='id '+str(numb[i])+' have c_name ='+nm+' u_name ='+nd
,fg='white',bg='black').pack()
global variable
variable = tk.StringVar()
variable.set(numb[a-1])
tk.OptionMenu(root1,variable,*numb,command=drop_c).pack()
root1.mainloop()
#root
def connect():
setup()
if (state0[0]==0):
l.config(text='reconnected to database')
#Tab 1
def search_tra():
t_state[0]=1
state1[0]=1
global inp3
inp3 = latexxxx.get(1.0, "end-1c")
multiple_err(inp3)
def set_tra_ind():
if (t_state[0]==1):
if (state1[0]==1):
tra_ind(cid)
l.config(text="set specific success")
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def set_tra_all():
tra_all()
l.config(text='updating all mog success')
#Tab 2
def search_rg():
t_state[0]=2
state2[0]=1
global inp
inp = latex.get(1.0, "end-1c")
rg_search(inp)
join_int(rg_s)
if (len(numb)==0):
l.config(text="name not found, its case sensitive")
else:
l.config(text="found "+inp+" with rights = "+str(numb[0]))
def set_rg_ind():
if (t_state[0]==2):
if (state2[0]==1):
rg_ch(inp,intend)
l.config(text="set specific success")
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def set_rg_all():
rg_ch_all(intend)
l.config(text="set all success")
def set_rg_def():
rg_def(intend)
l.config(text="set dafault success")
#Tab 3
def scan_gcp():
state3[0]=2
t_state[0]=3
gcp_name()
gcp_all()
a = len(gcp_a)
l.config(text ="scanned "+str(a)+" not null characters")
join_str(gcp_n)
join_int(gcp_a)
def search_gcp():
state3[0]=1
t_state[0]=3
global inp2
inp2 = latexx.get(1.0, "end-1c")
multiple_err(inp2)
gcp_search(cid)
join_int(gcp_s)
if (len(numb)==0):
l.config(text="name not found, its case sensitive")
else:
if (gcp_s[0]==(None,)):
l.config(text="you have no gcp")
else:
l.config(text="found "+inp2+" with "+str(numb[0])+" gcp")
def set_gcp_all():
if (t_state[0]==3):
if (state3[0]==2):
ber = latexxx.get(1.0, "end-1c")
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
for i in range(len(numb)):
gcp_ch(text[i],a)
l.config(text="set all success")
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def add_gcp_all():
if (t_state[0]==3):
if (state3[0]==2):
ber = latexxx.get(1.0, "end-1c")
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
for i in range(len(numb)):
numb[i] = a +numb[i]
gcp_ch(text[i],numb[i])
l.config(text="add all success")
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def sub_gcp_all():
if (t_state[0]==3):
if (state3[0]==2):
ber = latexxx.get(1.0, "end-1c")
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
for i in range(len(numb)):
numb[i] = numb[i]- a
if (numb[i]<0):
numb[i]=0
gcp_ch(text[i],numb[i])
l.config(text="substract all success")
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def set_gcp_ind():
if (t_state[0]==3):
if (state3[0]==1):
ber = latexxx.get(1.0, "end-1c")
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
gcp_ch(cid,a)
l.config(text="set specific success")
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def add_gcp_ind():
if (t_state[0]==3):
if (state3[0]==1):
ber = latexxx.get(1.0, "end-1c")
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
x = a + numb[0]
gcp_ch(cid,x)
l.config(text="add specific success")
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def sub_gcp_ind():
if (t_state[0]==3):
if (state3[0]==1):
ber = latexxx.get(1.0, "end-1c")
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
x = numb[0]-a
if (x<0):
x=0
gcp_ch(cid,x)
l.config(text="substract specific success")
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
#Tab 4
def search_gacha():
t_state[0]=4
state4[0]=1
ber = latex4.get(1.0, "end-1c")
multiple_err(ber)
def set_prem_ind():
inp = latex5.get(1.0, "end-1c")
if (t_state[0]==4):
if (state4[0]==1):
if (inp!=''):
try:
a = int(inp)
except ValueError as error:
l.config(text='input must be integer')
return None
prem_ind(cid,a)
l.config(text="set specific success")
else:
l.config(text='fill your value input')
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def set_trial_ind():
ber = latex5.get(1.0, "end-1c")
if (t_state[0]==4):
if (state4[0]==1):
if (ber!=''):
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
trial_ind(cid,a)
l.config(text="set specific success")
else:
l.config(text='fill your value input')
else:
l.config(text="subject isnt scanned yet")
else:
l.config(text= "properties in wrong tab or not used yet")
def set_prem_all():
ber = latex5.get(1.0, "end-1c")
if (ber!=''):
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
prem_all(a)
l.config(text='set gacha all prem success')
else:
l.config(text='parameter not inserted yet')
def set_trial_all():
ber = latex5.get(1.0, "end-1c")
if (ber!=''):
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
trial_all(a)
l.config(text='set gacha all trial success')
else:
l.config(text='parameter not inserted yet')
#Tab 5
def search_gid():
t_state[0]=5
state5[0]=1
ber = latex51.get(1.0, "end-1c")
multiple_err(ber)
def scan_gid():
t_state[0]=5
state5[1]=1
guild_name()
join_str(guild_n)
a = len(text)
global variable51
variable51 = tk.StringVar()
variable51.set(text[a-1])
global drop
drop = tk.OptionMenu(tab5,variable51,*text,command=drop_g).place(x=150,y=20)
def drop_g(ch):
ch = variable51.get()
inp = ch
search_git(inp)
def search_git(ber):
guild_id(ber)
guild_info(guild_i)
a = len(gd_char)
l.config(text=ber+'found with id='+str(guild_i)+' and '+str(a)+' member')
def add_mem():
if t_state[0]==5:
if state5[0]==1:
if state5[1]==1:
member(cid,guild_i)
l.config(text='succesfully added to guild')
else:
l.config(text='select guild first')
else:
l.config(text='character id empty')
else:
l.config(text='properties in wrong tab')
def change_lead():
if t_state[0]==5:
if state5[1]==1:
leader(cid,guild_i)
l.config(text='succesfully changed leader')
else:
l.config(text='select guild first')
else:
l.config(text='properties in wrong tab')
def set_guild_ind():
ber = latex52.get(1.0, "end-1c")
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
if t_state[0]==5:
if ber!='':
if state5[1]==1:
guild_ind(guild_i,a)
l.config(text='set rp success')
else:
l.config(text='select guild first')
else:
l.config(text='rp value empty')
else:
l.config(text='properties in wrong tab')
def set_guild_all():
ber = latex52.get(1.0, "end-1c")
try:
a = int(ber)
except ValueError as error:
l.config(text='input must be integer')
return None
if t_state[0]==5:
if ber!='':
guild_all(a)
l.config(text='succesfully changed leader')
else:
l.config(text='rp value empty')
else:
l.config(text='properties in wrong tab')
#Tab 6
def id_search():
t_state[0]=6
state6[0]=1
global inp6
inp6 = latex8.get(1.0, "end-1c")
log_id(inp6)
join_int(log_i)
a = len(log_i)
if (a==0):
l.config(text='name not found')
else :
l.config(text=inp6+' found with id='+str(numb[0]))
def tof_log_ind():
if (t_state[0]==6):
if (state6[0]==1):
log_tof(numb[0])
l.config(text='turn off boost specific success')
else:
l.config(text='name not scanned yet')
else:
l.config(text='properties in wrong tab or not used yet')
def ton_log_ind():
if (t_state[0]==6):
if (state6[0]==1):
log_ton(numb[0])
l.config(text='make boost available specific success')
else:
l.config(text='name not scanned yet')
else:
l.config(text='properties in wrong tab or not used yet')
def tof_log_all():
log_tof_all()
l.config(text='turn off all boost success')
def ton_log_all():
log_ton_all()
l.config(text='make all boost available success')
#Tab 7
def up_road():
filetypes = (
('csv files', '*.csv'),
('All files', '*.*')
)
global road_dir
road_dir = fd.askopenfilename(
title='Open a file',
initialdir='/',
filetypes=filetypes)
road_up()
l.config(text='road csv success')
def scan_road():
state7[1]=1
road_scan()
l.config(text='road shop has '+str(road_v)+' item')
def add_road():
if (state7[1]==1):
if (state7[0]==1):
i2 = latex72.get(1.0, "end-1c")
i3 = latex73.get(1.0, "end-1c")
i4 = latex74.get(1.0, "end-1c")
i5 = latex75.get(1.0, "end-1c")
if (i2!='' and i3!='' and i4!='' and i5!=''):
try:
i2 = int(i2)
i3 = int(i3)
i4 = int(i4)
i5 = int(i5)
except ValueError as error:
l.config(text='input must be integer')
return None
road_add(item_id,i2,i3,i4,i5)
l.config(text='item added')
state7[1]=0
else:
l.config(text='input blank')
else:
l.config(text='input blank')
else:
l.config(text='scan first')
def calc_f():
state7[0]=1
i1 = latex71.get(1.0, "end-1c")
a = len(list(i1))
if (a == 4):
ferias(i1)
l71.config(text=str(item_id))
else:
l.config(text= "format false")
def calc_u():
state7[0]=1
i1 = latex71.get(1.0, "end-1c")
a = len(list(i1))
if (a == 4):
untranslated(i1)
l71.config(text=str(item_id))
else:
l.config(text= "format false")
#Tab 8
def search_save():
t_state[0]=8
state8[0]=1
inp8 = latex81.get(1.0, "end-1c")
multiple_err(inp8)
def insert_save():
if (t_state[0]==8):
if (state8[0]==1):
filetypes = (
('binary files', '*.bin'),
('All files', '*.*')
)
global savefile
savefile = fd.askopenfilename(
title='Open a file',
initialdir='/',
filetypes=filetypes)
save_save(cid)
l.config(text='upload savefile success')
else:
l.config(text='name not scanned yet')
else:
l.config(text='properties in wrong tab or not used yet')
def insert_partner():
if (t_state[0]==8):
if (state8[0]==1):
filetypes = (
('binary files', '*.bin'),
('All files', '*.*')
)
global partner
partner = fd.askopenfilename(
title='Open a file',
initialdir='/',
filetypes=filetypes)
save_partner(cid)
l.config(text='upload partner success')
else:
l.config(text='name not scanned yet')
else:
l.config(text='properties in wrong tab or not used yet')
#Error State
t_state = [0]
state0 = [0]
state1 = [0]
state2 = [0]
state3 = [0]
state4 = [0]
state5 = [0,0,0]
state6 = [0]
state8 = [0]
state7 = [0,0]
#Course Calculator aset
def ferias(inp):
x = list(inp)
y = '0x'+x[0]+x[1]+x[2]+x[3]
try:
z = ast.literal_eval(y)
except SyntaxError as error:
l.config(text='you are not inputing hexa')
global item_id
item_id = z
def untranslated(inp):
x = list(inp)
y = '0x'+x[2]+x[3]+x[0]+x[1]
global item_id
try:
z = ast.literal_eval(y)
except SyntaxError as error:
l.config(text='you are not inputing hexa')
item_id = z
def calc():
global intend
intend = 2 + var0.get()+ var1.get()+ var2.get()+ var3.get()+ var4.get()+ var5.get()+ var6.get()+ var7.get()
z.config(text= str(intend))
cal=['Hunter Course','Extra Course','Premium Course','Assist Course','N Course',
'Hiden Course','Support Course','N boost Course']
val=[4,8,64,256,512,1024,2048,4096]
####START CODE
kinter()
cwd = os.getcwd()
cwd = cwd + '\\skin_hist.bin'
cwe = os.getcwd() + '\\road\\road.csv'
###TKINTER OBJECT
cb_head = tk.IntVar()
cb_guild=tk.IntVar()
##Root
#Button and Label
l = tk.Label(root, bg='black',fg='white', width=40, text='connected to database')
tk.Button(root,bg='green',fg='white',width=10,height=2,text='reconnect',
command=connect).pack()
setup()
#Position
l.pack()
##Tab 1
#button and label
tk.Label(tab1, text="character name",fg='blue').place(x=50,y=20)
latexxxx = tk.Text(tab1, height = 1, width = 20)
but1_ind=tk.Button(tab1,bg='red',fg='white',width=10,text='set specific',
command=set_tra_ind)
but1_all=tk.Button(tab1,bg='red',fg='white',width=10,text='set all',
command=set_tra_all)
but11= tk.Button(tab1,bg='blue',fg='white',width=10,text='search',
command=search_tra)
#position
latexxxx.place(x=50,y=50)
but11.place(x=50,y=80)
but1_ind.place(x=50,y=110)
but1_all.place(x=50,y=140)
##Tab 2
tk.Label(tab2, text="username",fg='blue').place(x=50,y=20)
for i in range(len(cal)):
exec(f'''var{i} = tk.IntVar()''')
exec(f'''ck_but{i} = tk.Checkbutton(tab2, text=cal[i] ,variable=var{i}, onvalue=val[i], offvalue=0, command=calc) ''')
exec(f'''ck_but{i}.place(x=10,y=200+i*20)''')
#Button and Label
z = tk.Label(tab2, bg='black',fg='white', width=10, text='empty')
latex = tk.Text(tab2, height = 1, width = 20)
but2_sc=tk.Button(tab2,bg='blue',fg='white',width=10,text='search',
command=search_rg)
but2_set=tk.Button(tab2,bg='red',fg='white',width=10,text='set specific',
command=set_rg_ind)
but2_all=tk.Button(tab2,bg='red',fg='white',width=10,text='set all',
command=set_rg_all)
but2_def=tk.Button(tab2,bg='red',fg='white',width=10,text='set default',
command=set_rg_def)
#position
z.place(x=150,y=300)
latex.place(x=50,y=50)
but2_sc.place(x=50,y=100)
but2_set.place(x=150,y=210)
but2_all.place(x=150,y=240)
but2_def.place(x=150,y=270)
##Tab 3
#Button and Label
tk.Label(tab3, text="character name",fg='blue').place(x=70,y=20)
tk.Label(tab3, text="gcp value",fg='blue').place(x=70,y=120)
latexx = tk.Text(tab3, height = 1, width = 20)
latexxx = tk.Text(tab3, height = 1, width = 20)
but3_sc=tk.Button(tab3,bg='blue',fg='white',width=10,text='search',
command=search_gcp)
but3_sc_a=tk.Button(tab3,bg='blue',fg='white',width=10,text='scan all',
command=scan_gcp)
but3_set=tk.Button(tab3,bg='red',fg='white',width=10,text='set specific',
command=set_gcp_ind)
but3_set_a=tk.Button(tab3,bg='red',fg='white',width=10,text='set all',
command=set_gcp_all)
but3_add=tk.Button(tab3,bg='red',fg='white',width=10,text='add specific',
command=add_gcp_ind)
but3_add_a=tk.Button(tab3,bg='red',fg='white',width=10,text='add all',
command=add_gcp_all)
but3_sub=tk.Button(tab3,bg='red',fg='white',width=10,text='sub specific',
command=sub_gcp_ind)
but3_sub_a=tk.Button(tab3,bg='red',fg='white',width=10,text='sub all',
command=sub_gcp_all)
#position
latexx.place(x=70,y=50)
latexxx.place(x=70,y=150)
but3_sc.place(x=40,y=80)
but3_sc_a.place(x=190,y=80)
but3_set.place(x=40,y=180)
but3_set_a.place(x=190,y=180)
but3_add.place(x=40,y=210)
but3_add_a.place(x=190,y=210)
but3_sub.place(x=40,y=240)
but3_sub_a.place(x=190,y=240)
##Tab 4
#Button and Label
tk.Label(tab4, text="character name",fg='blue').place(x=70,y=20)
tk.Label(tab4, text="coin value",fg='blue').place(x=70,y=120)
latex4 = tk.Text(tab4, height = 1, width = 20)
latex5 = tk.Text(tab4, height = 1, width = 20)
but4_prem=tk.Button(tab4,bg='red',fg='white',width=10,text='set spe prem',
command=set_prem_ind)
but4_prem_a=tk.Button(tab4,bg='red',fg='white',width=10,text='set all prem',