Exemple #1
0
    def update(self):
        commands = [
            self.SWSHReader.readWild, self.SWSHReader.readLegend,
            self.SWSHReader.readHorse
        ]
        read_func = commands[self.type_var.get() - 1]

        try:
            pk8 = PK8(read_func())
            error = False
        except Exception as e:
            print(e)
            error = True
        while error:
            try:
                pk8 = PK8(read_func())
                error = False
            except:
                error = True

        if not pk8.isValid() or pk8.ec() == 0:
            print("Invalid or Not Present")
            self.last_info = ""
            self.image_display.config(image='')
            self.mark_display.config(image='')
            self.current_info_display.delete(1.0, tk.END)
        if pk8.isValid(
        ) and pk8.ec() != 0 and pk8.toString() != self.last_info:
            info = pk8.toString()
            s1 = pb.SpriteResource('pokemon',
                                   pk8.species(),
                                   shiny=pk8.shinyType).img_data
            if self.type_var.get() - 1 == 0:
                try:
                    print(
                        f"https://www.serebii.net/swordshield/ribbons/{pk8.mark().lower()}mark.png"
                    )
                    s2 = urllib.request.urlopen(
                        f"https://www.serebii.net/swordshield/ribbons/{pk8.mark().lower()}mark.png"
                    ).read()
                    im2 = Image.open(io.BytesIO(s2))
                    image2 = ImageTk.PhotoImage(im2)
                    self.image2 = image2
                    self.mark_display.config(image=image2)
                    info += f"Mark: {pk8.mark()}"
                    print(info)
                except Exception as e:
                    print(e)
            else:
                self.mark_display.config(image='')
            im = Image.open(io.BytesIO(s1))
            image = ImageTk.PhotoImage(im)
            self.image = image
            self.image_display.config(image=image)
            self.last_info = info
            self.current_info_display.delete(1.0, tk.END)
            self.current_info_display.insert(1.0, info)
        self.after_token = self.after(1000, self.update)
Exemple #2
0
# Go to root of PyNXReader
import sys
import json
sys.path.append('../')

from structure import PK8
from nxreader import SWSHReader

config = json.load(open("../config.json"))
r = SWSHReader(config["IP"])

for ii in range(1,7):
    print(f"Slot: {ii}")
    pk8 = PK8(r.readParty(ii))
    if pk8.isValid() and pk8.ec() != 0:
        print(pk8.toString())
    else:
        print('Empty')

print()
r.close()
Exemple #3
0
# Go to root of PyNXReader
import sys
import json
sys.path.append('../')

from structure import PK8
from nxreader import SWSHReader

config = json.load(open("../config.json"))
r = SWSHReader(config["IP"])

while True:
    empty = True
    box = int(input('Which box would you like to check? '))
    print()
    for ii in range(1,31):
        pk8 = PK8(r.readBox(box,ii))
        if pk8.isValid() and pk8.ec() != 0:
            print(f"Box: {box} Slot: {ii}")
            print(pk8.toString())
            empty = False
    if empty:
        print('Box is empty\n')
    stop = input('Continue? (y/n) ' )
    if stop != 'y' and stop != 'Y':
        break

r.close()
Exemple #4
0
# Go to root of PyNXBot
import sys
sys.path.append('../')

from structure import PK8
from nxbot import SWSHBot

b = SWSHBot('192.168.1.6')
for ii in range(1, 7):
    pk8 = PK8(b.readParty(ii))
    print(pk8.toString())
Exemple #5
0
# Go to root of PyNXReader
import sys
import json
sys.path.append('../')

from structure import PK8
from nxreader import SWSHReader

config = json.load(open("../config.json"))
r = SWSHReader(config["IP"])

while True:
    pk8 = PK8(r.readHorse())
    if pk8.isValid and pk8.ec != 0:
        print(pk8)
    else:
        print("No horse fused\n")
    stop = input("Check again? (y/n): ")
    print()
    if stop == 'n' or stop == 'N':
        r.close()
Exemple #6
0
# Go to root of PyNXReader
import sys
import json
sys.path.append('../')

from structure import PK8
from nxreader import SWSHReader

config = json.load(open("../config.json"))
r = SWSHReader(config["IP"])

while True:
    pk8 = PK8(r.readLegend())
    if pk8.isValid and pk8.ec != 0:
        print(pk8)
    else:
        print("No battle started\n")
    stop = input("Check again? (y/n): ")
    print()
    if stop == 'n' or stop == 'N':
        r.close()
Exemple #7
0
# Go to root of PyNXReader
import sys
import json
sys.path.append('../')

from structure import PK8
from nxreader import SWSHReader

config = json.load(open("../config.json"))
r = SWSHReader(config["IP"])

while True:
    pk8 = PK8(r.readWild())
    if pk8.isValid() and pk8.ec() != 0:
        print(pk8.toString())
    else:
        print("No battle started\n")
    stop = input("Check again? (y/n): ")
    print()
    if stop == 'n' or stop == 'N':
        r.close()
Exemple #8
0
# Go to root of PyNXBot
import sys
import json
sys.path.append('../')

from structure import PK8
from nxbot import SWSHBot

config = json.load(open("../config.json"))
b = SWSHBot(config["IP"])

while True:
    pk8 = PK8(b.readWild())
    if pk8.isValid() and pk8.ec() != 0:
        print(pk8.toString())
    else:
        print("No battle started\n")
    stop = input("Check again? (y/n): ")
    print()
    if stop == 'n' or stop == 'N':
        b.close()
Exemple #9
0
 def battleCheck(self):
     if PK8(self.readWild()).isValid():
         print("Battle started!")
         self.battleRun()
         return True
     return False
Exemple #10
0
# Go to root of PyNXBot
import sys
import json

sys.path.append('../')

from structure import PK8
from nxbot import SWSHBot

config = json.load(open("../config.json"))
b = SWSHBot(config["IP"])

while True:
    empty = True
    box = int(input('Which box would you like to check? '))
    print()
    for ii in range(1, 31):
        pk8 = PK8(b.readBox(box, ii))
        if pk8.isValid() and pk8.ec() != 0:
            print(f"Box: {box} Slot: {ii}")
            print(pk8.toString())
            empty = False
    if empty:
        print('Box is empty\n')
    stop = input('Continue? (y/n) ')
    if stop != 'y' and stop != 'Y':
        break

b.close()