Пример #1
0
def stage_2(otId: int,
            address: int,
            pairs,
            sub=0,
            script=3,
            a1=0,
            a2=None,
            a3=None):
    # Pack in priority, address, n arguments, and next script in order
    raw = struct.pack('<BIBBB', script, address, a1, a2 if a2 else 0,
                      a3 if a3 else 0)
    w0, w1 = struct.unpack('<II', raw)  # Unpack into two 32 bit words
    for i, pid in pairs:
        if perms[pid %
                 24][2] != sub:  # EV substruct must be in proper position
            continue
        mon = BoxMon()
        mon.personality = pid
        mon.otId = otId
        mon.secure.raw[sub * 3] = w0  # Set first and second words
        mon.secure.raw[sub * 3 + 1] = w1
        mon.decrypt()
        sub2 = mon.sub(2).type2
        if a2 is not None and sub2.cool != 0:  # Decrypted COOL must be 0
            continue
        elif a3 is not None and sub2.beauty != 0:  # Decrypted BEAUTY must be 0
            continue
        evs = tuple(getattr(sub2, e) for e in EVS)
        if sum(evs) > 510:
            continue
        yield i, pid, sum(evs), evs
Пример #2
0
def test_double_corrupt(pid: int, otId: int) -> bool:
    """ Determine if the pid, OTId pair can be used for double corruption.

    Args:
        pid (int): PID of pokemon to corrupt.
        otId (int): OTId of trainer.

    Returns:
        bool: True if the pair can be used, False otherwise.
    """
    box_mon = BoxMon()
    box_mon.personality = pid
    box_mon.otId = otId
    box_mon.sub(0).type0.species = 308
    box_mon.sub(0).type0.experience = 2195
    box_mon.sub(0).type0.friendship = 70
    sub1 = box_mon.sub(1).type1
    sub1.moves[0] = 33
    sub1.moves[1] = 253
    sub1.moves[2] = 185
    sub1.pp[0] = 35
    sub1.pp[1] = 10
    sub1.pp[2] = 20
    sub2 = box_mon.sub(2).type2
    sub2.attackEV = 22
    sub2.hpEV = 8
    sub3 = box_mon.sub(3).type3
    sub3.metLocation = 28
    sub3.metLevel = 14
    sub3.metGame = 3
    sub3.pokeBall = 2
    sub3.otGender = 1
    sub3.unk = 977594907
    box_mon.checksum = box_mon.calc_checksum()
    sum1 = box_mon.checksum
    box_mon.encrypt()
    box_mon.personality |= 0x40000000
    box_mon.decrypt()
    sum2 = box_mon.calc_checksum()
    box_mon.encrypt()
    box_mon.otId |= 0x40000000
    box_mon.decrypt()
    sum3 = box_mon.calc_checksum()
    if sum1 == sum2 == sum3 and box_mon.sub(3).type3.isEgg == 0:
        box_mon.encrypt()
        return True
    return False
Пример #3
0
def test_double_corrupt(pid, otId):  # Test double corruption of Mudkip
    mon = BoxMon()
    mon.personality = pid
    mon.otId = otId
    mon.sub(0).type0.species = 283
    mon.sub(0).type0.experience = 135
    mon.sub(0).type0.friendship = 70
    sub1 = mon.sub(1).type1
    sub1.moves[0] = 33
    sub1.moves[1] = 45
    sub1.pp[0] = 35
    sub1.pp[1] = 40
    sub2 = mon.sub(2).type2
    sub2.attackEV = 0x31
    sub2.hpEV = 0x10
    sub3 = mon.sub(3).type3
    sub3.metLocation = 16
    sub3.metLevel = 5
    sub3.metGame = 3
    sub3.pokeBall = 4
    sub3.otGender = 1
    mon.checksum = mon.calc_checksum()
    sum1 = mon.checksum
    mon.encrypt()
    mon.personality |= 0x40000000
    mon.decrypt()
    sum2 = mon.calc_checksum()
    mon.encrypt()
    mon.otId |= 0x40000000
    mon.decrypt()
    sum3 = mon.calc_checksum()
    if sum1 == sum2 == sum3 and mon.sub(3).type3.isEgg == 0:
        move = mon.sub(1).type1.moves[0]
        if move != 0x3110:
            mon.export()
        return move == 0x3110
    return False