Exemplo n.º 1
0
    def __init__(self):
        self.citra = Citra()

        self.partyAddress = None
        self.wildAddress = None
        self.sosAddress = None

        self.mainSeedAddress = None
        self.mainSFMTStart = None
        self.mainSFMTIndex = None

        self.sosSeedAddress = None
        self.sosSFMTStart = None
        self.sosSFMTIndex = None
        self.sosChainLength = None

        self.eggReady = None
        self.eggAddress = None
        self.parent1Address = None
        self.parent2Address = None

        self.trainerID = None

        self.mainInitialSeed = None
        self.sosInitialSeed = None

        self.getOffsets()
Exemplo n.º 2
0
def run():

    try:
        c = Citra()
        if c.is_connected():
            while True:
                value = read_sos_count(c)
                print("PokeStreamer-Tools SOS Counter Tool\n\n")
                print("SOS count: %d" % (value))

                with open("sos_count.txt", "w") as f:
                    f.write(str(value))

                time.sleep(1)
        else:
            print("Failed to connect to Citra RPC Server")

    finally:
        print("   ")
Exemplo n.º 3
0
    def __init__(self):
        self.citra = Citra()

        self.partyAddress = None
        self.wildAddress = None

        self.initialSeed = None
        self.seedAddress = None
        self.mtStart = None
        self.mtIndex = None

        self.tinyStart = None

        self.eggReady = None
        self.eggAddress = None
        self.parent1Address = None
        self.parent2Address = None

        self.saveVariable = None

        self.getOffsets()
Exemplo n.º 4
0
def run():
    win = curses.initscr()

    try:
        c = Citra()
        if c.is_connected():
            while True:
                value = read_sos_count(c)
                win.clear()
                win.addstr("PokeStreamer-Tools SOS Counter Tool\n\n")
                win.addstr("SOS count: %d" % (value))
                win.refresh()

                with open("sos_count.txt", "w") as f:
                    f.write(str(value))

                time.sleep(1)
        else:
            print("Failed to connect to Citra RPC Server")
    finally:
        curses.endwin()
Exemplo n.º 5
0
class Manager7:
    def __init__(self):
        self.citra = Citra()

        self.partyAddress = None
        self.wildAddress = None

        self.initialSeed = None
        self.seedAddress = None
        self.sfmtStart = None
        self.sfmtIndex = None

        self.eggReady = None
        self.eggAddress = None
        self.parent1Address = None
        self.parent2Address = None

        self.sosSeedAddress = None
        self.sosSFMTStart = None
        self.sosSFMTIndex = None
        self.sosChainLength = None
        self.sosInitialSeed = None
        self.sosAddress = None

        self.getOffsets()

    def getOffsets(self):
        pass
            
    def partyPokemon(self, index):
        address = self.partyAddress + (index * 484)

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def wildPokemon(self):
        address = self.wildAddress

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def getParent(self, num):
        if num == 1:
            address = self.parent1Address
        else:
            address = self.parent2Address

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def eggStatus(self):
        ready = readDWord(self.citra, self.eggReady)

        seed0 = readDWord(self.citra, self.eggAddress)
        seed1 = readDWord(self.citra, self.eggAddress + 4)
        seed2 = readDWord(self.citra, self.eggAddress + 8)
        seed3 = readDWord(self.citra, self.eggAddress + 12)

        return ready, seed3, seed2, seed1, seed0

    def readInitialSeed(self):
        self.initialSeed = readDWord(self.citra, self.seedAddress)
        self.sfmt = SFMT(self.initialSeed)
        self.currentSeed = self.initialSeed
        self.frameCount = -1

        return self.initialSeed

    def updateFrameCount(self):        
        currSeed = self.getCurrentSeed()
        difference = self.frameCount
        count = 0

        while currSeed != self.currentSeed:
            self.currentSeed = self.sfmt.nextULong()
            count += 1

            # Probably stuck in an infinite loop
            if count > 1000000:
                return None

        self.frameCount += count
        difference = self.frameCount - difference
        return difference, self.initialSeed, self.currentSeed, self.frameCount

    def getCurrentSeed(self):
        index = readDWord(self.citra, self.sfmtIndex)
        pointer = self.sfmtStart if index == 624 else self.sfmtStart + (index * 4)

        seed1 = readDWord(self.citra, pointer)
        seed2 = readDWord(self.citra, pointer + 4)

        return (seed2 << 32) | seed1

    def sosPokemon(self, index):
        address = self.sosAddress + (index * 484)

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def readSOSInitialSeed(self):
        self.sosInitialSeed = readDWord(self.citra, self.sosSeedAddress)
        self.sosSFMT = SFMT(self.sosInitialSeed)
        self.sosCurrentSeed = self.sosInitialSeed
        self.sosFrameCount = -1

        return self.sosInitialSeed

    def updateSOSFrameCount(self):        
        currSeed = self.getSOSCurrentSeed()
        difference = self.sosFrameCount
        count = 0

        if currSeed == self.sosInitialSeed:
            difference = -2

        while currSeed != self.sosCurrentSeed:
            self.sosCurrentSeed = self.sosSFMT.nextUInt()
            count += 1

            # Probably stuck in an infinite loop
            if count > 100000:
                return None            
            
        self.sosFrameCount += count
        difference = self.sosFrameCount - difference
        return difference, self.sosInitialSeed, self.sosCurrentSeed, self.sosFrameCount, self.sosChainCount()

    def getSOSCurrentSeed(self):
        index = readDWord(self.citra, self.sosSFMTIndex)
        pointer = self.sosSFMTStart if index == 624 else self.sosSFMTStart + (index * 4)
        seed = readDWord(self.citra, pointer)

        return seed

    def sosChainCount(self):
        return readByte(self.citra, self.sosChainLength)
Exemplo n.º 6
0
class Manager6:
    def __init__(self):
        self.citra = Citra()

        self.partyAddress = None
        self.wildAddress = None

        self.initialSeed = None
        self.seedAddress = None
        self.mtStart = None
        self.mtIndex = None

        self.tinyStart = None

        self.eggReady = None
        self.eggAddress = None
        self.parent1Address = None
        self.parent2Address = None

        self.saveVariable = None

        self.getOffsets()

    def getOffsets(self):
        pass

    def partyPokemon(self, index: int):
        address = self.partyAddress + (index * 484)

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def wildPokemon(self):
        address = self.getWildOffset()

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def getWildOffset(self):
        pass

    def getParent(self, num):
        address = self.parent1Address if num == 1 else self.parent2Address

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def eggStatus(self):
        ready = readDWord(self.citra, self.eggReady)

        seed0 = readDWord(self.citra, self.eggAddress)
        seed1 = readDWord(self.citra, self.eggAddress + 4)

        return ready, seed1, seed0

    def readInitialSeed(self):
        self.initialSeed = readDWord(self.citra, self.seedAddress)
        self.mt = MT(self.initialSeed)
        self.currentSeed = self.initialSeed
        self.frameCount = -1

        return self.initialSeed

    def updateFrameCount(self):
        # Reseed check
        if readDWord(self.citra, self.seedAddress) != self.initialSeed:
            self.initialSeed = readDWord(self.citra, self.seedAddress)
            self.mt = MT(self.initialSeed)
            self.currentSeed = self.initialSeed
            self.frameCount = -1

        currSeed = self.getCurrentSeed()
        difference = self.frameCount
        count = 0

        while currSeed != self.currentSeed:
            self.currentSeed = self.mt.nextUInt()
            count += 1

            # Probably stuck in an infinite loop
            if count > 1000000:
                return None

        self.frameCount += count
        difference = self.frameCount - difference

        tiny0 = readDWord(self.citra, self.tinyStart)
        tiny1 = readDWord(self.citra, self.tinyStart + 4)
        tiny2 = readDWord(self.citra, self.tinyStart + 8)
        tiny3 = readDWord(self.citra, self.tinyStart + 12)

        save = readDWord(self.citra, self.saveVariable)

        return difference, self.initialSeed, self.currentSeed, self.frameCount, save, tiny3, tiny2, tiny1, tiny0

    def getCurrentSeed(self):
        index = readDWord(self.citra, self.mtIndex)
        pointer = self.mtStart if index == 624 else self.mtStart + (index * 4)
        seed = readDWord(self.citra, pointer)

        return seed
Exemplo n.º 7
0
def run():
    win = curses.initscr()

    try:
        c = Citra()
        if c.is_connected():
            first_loop = True
            last_party = []
            while True:
                win.clear()
                win.addstr("PokeStreamer-Tools Auto-Layout Tool - Gen 6/7\n\n")
                party = read_party(c)

                if first_loop:
                    last_party = party
                    first_loop = False

                drfuji_query = ""
                if len(twitch_username
                       ) > 0 and "EverOddish" not in twitch_username:
                    drfuji_query = "/data/post.php?username="******"&"
                    slot = 1

                for pkmn in party:

                    if len(drfuji_query) > 0:
                        drfuji_query += "p" + str(slot) + "=" + pkmn.species(
                        ) + "_" + str(pkmn.species_num()) + "_" + pkmn.species(
                        ) + "_" + pkmn.ability() + "_" + pkmn.nature(
                        ) + "_" + pkmn.ev_hp() + "-" + pkmn.ev_attack(
                        ) + "-" + pkmn.ev_defense() + "-" + pkmn.ev_sp_attack(
                        ) + "-" + pkmn.ev_sp_defense() + "-" + pkmn.ev_speed(
                        ) + "_" + pkmn.iv_hp() + "-" + pkmn.iv_attack(
                        ) + "-" + pkmn.iv_defense() + "-" + pkmn.iv_sp_attack(
                        ) + "-" + pkmn.iv_sp_defense() + "-" + pkmn.iv_speed(
                        ) + "_" + pkmn.move_1() + "_" + pkmn.move_2(
                        ) + "_" + pkmn.move_3() + "_" + pkmn.move_4(
                        ) + "_" + pkmn.level() + "_" + pkmn.friendship()
                        drfuji_query += "&"
                        slot += 1

                    if 0 != pkmn.species_num():
                        win.addstr("Species: " + pkmn.species() +
                                   "  Ability: " + pkmn.ability() +
                                   "  Nature: " + pkmn.nature() + "\n")
                        win.addstr("Moves: " + pkmn.move_1() + ", " +
                                   pkmn.move_2() + ", " + pkmn.move_3() +
                                   ", " + pkmn.move_4() + "\n")
                        win.addstr("EVs: " + pkmn.ev_hp() + "/" +
                                   pkmn.ev_attack() + "/" + pkmn.ev_defense() +
                                   "/" + pkmn.ev_sp_attack() + "/" +
                                   pkmn.ev_sp_defense() + "/" +
                                   pkmn.ev_speed() + "  ")
                        win.addstr("IVs: " + pkmn.iv_hp() + "/" +
                                   pkmn.iv_attack() + "/" + pkmn.iv_defense() +
                                   "/" + pkmn.iv_sp_attack() + "/" +
                                   pkmn.iv_sp_defense() + "/" +
                                   pkmn.iv_speed() + "\n")
                        win.addstr("Stats: " + pkmn.stat_hp() + "/" +
                                   pkmn.stat_attack() + "/" +
                                   pkmn.stat_defense() + "/" +
                                   pkmn.stat_sp_attack() + "/" +
                                   pkmn.stat_sp_defense() + "/" +
                                   pkmn.stat_speed() + "\n")
                        win.addstr("Level: " + pkmn.level() +
                                   "  Friendship: " + pkmn.friendship() + "\n")
                        win.addstr("\n")
                win.refresh()

                if len(drfuji_query) > 0:
                    try:
                        drfuji_query = drfuji_query[:-1]
                        drfuji_query = re.sub(" ", "-", drfuji_query)
                        drfuji_query = re.sub("-", "%2D", drfuji_query)
                        print(drfuji_query)
                        conn = http.client.HTTPSConnection("everoddish.com")
                        conn.request("GET", drfuji_query)
                        resp = conn.getresponse()
                        conn.close()
                    except:
                        pass

                if manage_sprites:
                    for i in range(6):
                        if last_party[i].species_num() != party[i].species_num(
                        ):
                            #print(str(last_party[i].species_num()) + " -> " + str(party[i].species_num()))

                            # First, try to copy by species number
                            copied = False
                            try:
                                species_num = party[i].species_num()
                                if 0 == species_num:
                                    shutil.copyfile("000.png",
                                                    "p" + str(i + 1) + ".png")
                                    #print("000.png -> " + "p" + str(i + 1) + ".png")
                                    copied = True
                                else:
                                    shutil.copyfile(
                                        str(species_num) + ".png",
                                        "p" + str(i + 1) + ".png")
                                    #print(str(species_num) + ".png -> " + "p" + str(i + 1) + ".png")
                                    copied = True
                            except:
                                pass
                            if not copied:
                                # If that failed, try to copy by species name
                                try:
                                    shutil.copyfile(
                                        party[i].species().lower() + ".png",
                                        "p" + str(i + 1) + ".png")
                                    #print(party[i].species().lower() + ".png -> " + "p" + str(i + 1) + ".png")
                                except:
                                    pass

                last_party = party

                time.sleep(1)
        else:
            print("Failed to connect to Citra RPC Server")
    finally:
        curses.endwin()
Exemplo n.º 8
0
class Manager(object):
    def __init__(self):
        self.citra = Citra()

        self.partyAddress = None
        self.wildAddress = None
        self.sosAddress = None

        self.mainSeedAddress = None
        self.mainSFMTStart = None
        self.mainSFMTIndex = None

        self.sosSeedAddress = None
        self.sosSFMTStart = None
        self.sosSFMTIndex = None
        self.sosChainLength = None

        self.eggReady = None
        self.eggAddress = None
        self.parent1Address = None
        self.parent2Address = None

        self.trainerID = None

        self.mainInitialSeed = None
        self.sosInitialSeed = None

        self.getOffsets()

    def getOffsets(self):
        pass

    def partyPokemon(self, index):
        address = self.partyAddress + (index * 484)

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def wildPokemon(self):
        address = self.wildAddress

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def sosPokemon(self, index):
        address = self.sosAddress + (index * 484)

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def getParent(self, num):
        if num == 1:
            address = self.parent1Address
        else:
            address = self.parent2Address

        blockData = self.citra.read_memory(address, 232)
        statsData = self.citra.read_memory(address + 344, 22)
        data = blockData + statsData

        return Pokemon(data)

    def eggStatus(self):
        val = readDWord(self.citra, self.eggReady)

        seed3 = readDWord(self.citra, self.eggAddress)
        seed2 = readDWord(self.citra, self.eggAddress + 4)
        seed1 = readDWord(self.citra, self.eggAddress + 8)
        seed0 = readDWord(self.citra, self.eggAddress + 12)

        return [val, seed3, seed2, seed1, seed0]

    def readMainInitialSeed(self):
        self.mainInitialSeed = readDWord(self.citra, self.mainSeedAddress)
        self.mainSFMT = SFMT(self.mainInitialSeed)
        self.mainCurrentSeed = self.mainInitialSeed
        self.mainFrameCount = -1

        return self.mainInitialSeed

    def updateMainFrameCount(self):
        currSeed = self.getMainCurrentSeed()
        difference = self.mainFrameCount
        count = 0

        while currSeed != self.mainCurrentSeed:
            self.mainCurrentSeed = self.mainSFMT.nextULong()
            count += 1

            # Probably stuck in an infinite loop
            if count > 100000:
                return None

        self.mainFrameCount += count
        difference = self.mainFrameCount - difference
        return [
            difference, self.mainInitialSeed, self.mainCurrentSeed,
            self.mainFrameCount,
            self.trainerShinyValue()
        ]

    def getMainCurrentSeed(self):
        index = readDWord(self.citra, self.mainSFMTIndex)

        if index == 624:
            pointer = self.mainSFMTStart
        else:
            pointer = self.mainSFMTStart + (index * 4)

        seed1 = readDWord(self.citra, pointer)
        seed2 = readDWord(self.citra, pointer + 4)

        return (seed2 << 32) | seed1

    def readSOSInitialSeed(self):
        self.sosInitialSeed = readDWord(self.citra, self.sosSeedAddress)
        self.sosSFMT = SFMT(self.sosInitialSeed)
        self.sosCurrentSeed = self.sosInitialSeed
        self.sosFrameCount = -1

        return self.sosInitialSeed

    def updateSOSFrameCount(self):
        currSeed = self.getSOSCurrentSeed()
        difference = self.sosFrameCount
        count = 0

        if currSeed == self.sosInitialSeed:
            difference = -2

        while currSeed != self.sosCurrentSeed:
            self.sosCurrentSeed = self.sosSFMT.nextUInt()
            count += 1

            # Probably stuck in an infinite loop
            if count > 100000:
                return None

        self.sosFrameCount += count
        difference = self.sosFrameCount - difference
        return [
            difference, self.sosInitialSeed, self.sosCurrentSeed,
            self.sosFrameCount,
            self.sosChainCount()
        ]

    def getSOSCurrentSeed(self):
        index = readDWord(self.citra, self.sosSFMTIndex)

        if index == 624:
            pointer = self.sosSFMTStart
        else:
            pointer = self.sosSFMTStart + (index * 4)

        seed = readDWord(self.citra, pointer)

        return seed

    def trainerShinyValue(self):
        val = readDWord(self.citra, self.trainerID)
        return ((val >> 16) ^ (val & 0xffff)) >> 4

    def sosChainCount(self):
        return readByte(self.citra, self.sosChainLength)
def run():
    try:
        c = Citra()
        if c.is_connected():
            first_loop = True
            last_party = []
            while True:
                print("PokeStreamer-Tools Auto-Layout Tool - Gen 6/7\n\n")
                party = read_party(c)

                if first_loop:
                    last_party = party
                    first_loop = False

                for pkmn in party:

                    if 0 != pkmn.species_num():
                        print("Species: " + pkmn.species() + "  Ability: " +
                              pkmn.ability() + "  Nature: " + pkmn.nature() +
                              "\n")
                        print("Moves: " + pkmn.move_1() + ", " +
                              pkmn.move_2() + ", " + pkmn.move_3() + ", " +
                              pkmn.move_4() + "\n")
                        print("EVs: " + pkmn.ev_hp() + "/" + pkmn.ev_attack() +
                              "/" + pkmn.ev_defense() + "/" +
                              pkmn.ev_sp_attack() + "/" +
                              pkmn.ev_sp_defense() + "/" + pkmn.ev_speed() +
                              "  ")
                        print("IVs: " + pkmn.iv_hp() + "/" + pkmn.iv_attack() +
                              "/" + pkmn.iv_defense() + "/" +
                              pkmn.iv_sp_attack() + "/" +
                              pkmn.iv_sp_defense() + "/" + pkmn.iv_speed() +
                              "\n")
                        print("Stats: " + pkmn.stat_hp() + "/" +
                              pkmn.stat_attack() + "/" + pkmn.stat_defense() +
                              "/" + pkmn.stat_sp_attack() + "/" +
                              pkmn.stat_sp_defense() + "/" +
                              pkmn.stat_speed() + "\n")
                        print("Level: " + pkmn.level() + "  Friendship: " +
                              pkmn.friendship() + "\n")
                        print("\n")

                if manage_sprites:
                    for i in range(6):
                        ##                        if last_party[i].species_num() != party[i].species_num():
                        print(
                            str(last_party[i].species_num()) + " -> " +
                            str(party[i].species_num()))

                        # First, try to copy by species number
                        copied = False
                        try:
                            species_num = party[i].species_num()
                            if 0 == species_num:
                                shutil.copyfile("000.png",
                                                "p" + str(i + 1) + ".png")
                                print("000.png -> " + "p" + str(i + 1) +
                                      ".png")
                                copied = True
                            else:
                                shutil.copyfile(
                                    str(species_num) + ".png",
                                    "p" + str(i + 1) + ".png")
                                print(
                                    str(species_num) + ".png -> " + "p" +
                                    str(i + 1) + ".png")
                                copied = True
                        except:
                            pass
                        if not copied:
                            # If that failed, try to copy by species name
                            try:
                                shutil.copyfile(
                                    party[i].species().lower() + ".png",
                                    "p" + str(i + 1) + ".png")
                                print(party[i].species().lower() + ".png -> " +
                                      "p" + str(i + 1) + ".png")
                            except:
                                print("ERROR")
                                pass

                last_party = party
                try:
                    reply = str(input('Re-run? (y/n): ')).lower().strip()
                    if reply[0] == 'n':
                        cls()
                        print("done.")
                        time.sleep(5)
                        break
                    if reply[0] == 'y':
                        time.sleep(0.1)
                        run()
                except:
                    time.sleep(0.1)

        else:
            print("Failed to connect to Citra RPC Server")

    finally:
        print("")
Exemplo n.º 10
0
def readDWord(citra: Citra, address: int):
    data = citra.read_memory(address, 4)
    return convertDWord(data, 0)
Exemplo n.º 11
0
def readByte(citra: Citra, address: int):
    data = citra.read_memory(address, 1)
    return convertByte(data, 0)