Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #00 145 10100
- #00 155 10200
- #01 000 00157
- #0103 5 01000
- #10 060 01530
- #0103 6 11000
- #010 1 0 10115
- #01096 10500
- #01082 10101
- #01010 10115
- loginNo = input("Login To TamaTown: ").replace(" ","")
- def CheckBit(code,verify=True,bit=9):
- checkBit = []
- checkBit += code
- codeArr = []
- for i in range(0,len(code)):
- if i == bit:
- continue
- codeArr.append(int(checkBit[i]))
- print(codeArr)
- checksum = sum(codeArr) % 10
- # if code[bit] == "0":
- # return checksum
- if verify == False:
- return checksum
- if code[bit] == str(checksum):
- return 10
- else:
- return checksum
- def FindType(code):
- if code[:4] == "0100" and CheckBit(code,True,9) == 10:
- return 0
- elif code[:2] == "10":
- return 1
- elif code[:3] == "011":
- return 2
- elif code[:2] == "00":
- return 3
- elif code[:4] == "0101" and CheckBit(code,True,9) == 10:
- return 5
- elif code[:2] == "01" and CheckBit(code,True,4) == 10:
- return 4
- else:
- return 6
- def GetTamaIndex(code, type):
- tamaIndex = []
- if type == 0: #01 check 9 variant
- tamaIndex.append(code[6])
- tamaIndex.append(code[8])
- elif type == 1: #"10" variant
- tamaIndex.append(code[5])
- tamaIndex.append(code[7])
- elif type == 2: #"0103 check 6" variant
- tamaIndex.append(code[2])
- tamaIndex.append(code[4])
- elif type == 3: #"00" variant
- tamaIndex.append(code[8])
- tamaIndex.append(code[4])
- elif type == 4: #"01" variant
- tamaIndex.append(code[9])
- tamaIndex.append(code[7])
- elif type == 5: #"0101" variant
- tamaIndex.append(code[7])
- tamaIndex.append(code[8])
- return tamaIndex
- def GetTamaRegion(code, type):
- if type == 0: #"01 check 9"
- return code[7]
- elif type == 1: #"10" variant
- return code[6]
- elif type == 2: #"0103 check 4" variant
- return code[6]
- elif type == 3: #"00" variant
- return code[5]
- elif type == 4: #"01 check 4:8" variant
- return code[5]
- elif type == 5: #"0101" variant
- return code[5]
- type = FindType(loginNo)
- if type != 6:
- tIndex = GetTamaIndex(loginNo,type)
- tRegion = GetTamaRegion(loginNo,type)
- print("Recognized Type! " + str(type))
- print("Tama Index: "+str(tIndex))
- print("Tama Region: "+str(tRegion))
- win = input("Are you a WINNER? [y/n] ").lower()
- if win == "y":
- what = input("What did you win? [item/money] ").lower()
- if what == "item":
- which = input("What item did you win? (enter id) [000:999] ").lower()
- while len(which) < 3:
- which = "0"+which
- logout = "3"+str(tRegion)+str(which)+"\n"+str(tIndex[0])+"01"+str(tIndex[1])
- logout += str(CheckBit(logout.replace("\n",""),False))
- print("OK Good day sir! \n"+logout)
- if what == "money":
- howmuch = input("How much did you win? (01=100GP, 02=200GP, 03=500GP, 04=700GP, 05=1000GP)").lower()
- if len(howmuch) == 1:
- howmuch = "0"+howmuch
- logout = "2"+str(tRegion)+"000\n"+str(tIndex[0])+str(howmuch)+str(tIndex[1])
- logout += str(CheckBit(logout.replace("\n",""),False))
- print("OK Good day sir! \n"+logout)
- else:
- logout = "1"+str(tRegion)+"000\n"+str(tIndex[0])+"01"+str(tIndex[1])
- logout += str(CheckBit(logout.replace("\n",""),False))
- print("OK Good day sir! \n"+logout)
- else:
- print("Invalid Type! (or unrecognized)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement