Jump to content

ILOVEPIE

Member
  • Posts

    43
  • Joined

  • Last visited

Posts posted by ILOVEPIE

  1. The Normal PRNG:

    class pkmgen4prng(object):
       def __init__(self,seed):
          self.seed =(seed * 0x41C64E6D + 0x6073)
          if self._bitLen(self.seed)>32:
              self.seed = self.seed>>self._bitLen(self.seed)-32
          object.__init__(self)
       def prngenerate16(self):
           seed = self.seed
           self.seed = (self.seed * 0x41C64E6D + 0x6073)
           if self._bitLen(self.seed)>32:
              self.seed = self.seed>>self._bitLen(self.seed)-32
           return seed>>self._bitLen(seed)-16
       def prngenerate32(self):
           firstrandom16 = self.prngenerate16()
           secondrandom16 = self.prngenerate16()
           return ((firstrandom16<<16)|secondrandom16)
    
       def _bitLen(self,int_type):
           length = 0
           while (int_type):
               int_type >>= 1
               length += 1
           return(length)
    

    The GTS PRNG:

    class pkmgen4gtsprng(object):
       def __init__(self,seed):
          self.seed =(seed * 0x45 + 0x1111)
          if self._bitLen(self.seed)>31:
              self.seed = self.seed>>self._bitLen(self.seed)-31
          object.__init__(self)
       def prngenerate16(self):
           seed = self.seed
           self.seed = (self.seed * 0x41C64E6D + 0x6073)
           if self._bitLen(self.seed)>31:
              self.seed = self.seed>>self._bitLen(self.seed)-31
           return seed>>self._bitLen(seed)-16
       def prngenerate32(self):
           firstrandom16 = self.prngenerate16()
           secondrandom16 = self.prngenerate16()
           return ((firstrandom16<<16)|secondrandom16)
    
       def _bitLen(self,int_type):
           length = 0
           while (int_type):
               int_type >>= 1
               length += 1
           return(length)
    

    Credits:

    LexyEvee/Evee (veekun.com) - for helping me fix my code and providing the gts prng constants

  2. IN ALL MAPS TWEAKING LOCATIONS ARE MARKED BY WHERE THE BLUE LOAD LINES CROSS

    Azalea Town:

    map

    The Left tweaking location allows for access to the void, The right one lets you skip slowpoke well team rocket battles entirely.

    New Bark Town:

    Only reason to do this is to get HM waterfall early by walking to the dragon's den, you can't enter the void here.

    Violet City:

    [url="http://www.halloforigin.com/w/images/2/29/HGSS_Violet_City_Tweaking_Map.png'>map

    All tweaks here are blocked except the one in the water, and you can't ride your bike there, so no need to look for them.

    Cherrygrove City:

    map

    All tweaks here are blocked except the one in the water, and you can't ride your bike there, so no need to look for them.

    Saffron City:

    saffron%20city%20tweak%20map.png

    This tweak map I made myself. The unblocked tweak locations are highlighted in red. Both locations give access to the void.

    More to come! :biggrin:

  3. ok... it is now writing to file... exept the filesize is now chainging

    :mad:

    import random
    import time
    import os
    import struct
    import binascii
    import array
    class bf(object):
       def __init__(self,value=0):
           self._d = value
    
       def __getitem__(self, index):
           return (self._d >> index) & 1 
    
       def __setitem__(self,index,value):
           value    = (value&1L)<<index
           mask     = (1L)<<index
           self._d  = (self._d & ~mask) | value
    
       def __getslice__(self, start, end):
           mask = 2L**(end - start) -1
           return (self._d >> start) & mask
    
       def __setslice__(self, start, end, value):
           mask = 2L**(end - start) -1
           value = (value & mask) << start
           mask = mask << start
           self._d = (self._d & ~mask) | value
           return (self._d >> start) & mask
    
       def __int__(self):
           return self._d
    
    def _shinygen(pokemonid):
    """Returns Tuple of Shiny TID and SID for given PID"""
    shiny=False
    n=0
    while shiny == False:
    	tid=bf(random.getrandbits(16))
    	sid=bf(random.getrandbits(16))
    	pid=bf(pokemonid)
    	n +=1
    	shiny = True
    	for i in range(0,13):
    		if int(pid[15-i]) + int(pid[31-i])+ int(tid[15-i])+ int(sid[15-i])== 3:
    				shiny = False
    				break
    		elif int(pid[15-i])+ int(pid[31-i])+ int(tid[15-i])+ int(sid[15-i])== 1:
    				shiny = False
    				break
    if shiny:
    	return (tid,sid)
    else:
    	return False
    
    print "Please type in the file address of the pokemon"
    path = raw_input("-")
    path = os.path.normpath(path)
    file = open(path, "rb")
    pkm = array.array("i",file.read())
    file.close()
    #TID,SID =_shinygen(int(pkm[0x00:0x04].tostring()))
    TID,SID =_shinygen(int(binascii.hexlify(pkm[0x00:0x04]),16))
    print bin(int(TID))
    pkm[0x0C:0x0E]=array.array("i",struct.pack("i",int(TID)))
    pkm[0x0E:0x10]=array.array("i",struct.pack("i",int(SID)))
    file = open(path,"wb")
    pkm.tofile(file)
    file.close()
    print "Your Pokemon is now Shiny!"
    time.sleep(20)
    

  4. this is the code i am having problems with ... it won't work it just keeps giving errors about how you cant use bitwize operations on type slice with a mask of type int

    import random
    import time
    import os
    #import struct
    import array
    class bf(object):
       def __init__(self,value=0):
           self._d = value
    
       def __getitem__(self, index):
           return (self._d >> index) & 1 
    
       def __setitem__(self,index,value):
           value    = (value&1L)<<index
           mask     = (1L)<<index
           self._d  = (self._d & ~mask) | value
    
       def __getslice__(self, start, end):
           mask = 2L**(end - start) -1
           return (self._d >> start) & mask
    
       def __setslice__(self, start, end, value):
           mask = 2L**(end - start) -1
           value = (value & mask) << start
           mask = mask << start
           self._d = (self._d & ~mask) | value
           return (self._d >> start) & mask
    
       def __int__(self):
           return self._d
    
    def _shinygen(pokemonid):
    """Returns Tuple of Shiny TID and SID for given PID"""
    shiny=False
    n=0
    while shiny == False:
    	tid=bf(random.getrandbits(16))
    	sid=bf(random.getrandbits(16))
    	pid=bf(pokemonid)
    	n +=1
    	shiny = True
    	for i in range(0,13):
    		if int(pid[15-i]) + int(pid[31-i])+ int(tid[15-i])+ int(sid[15-i])== 3:
    				shiny = False
    				break
    		elif int(pid[15-i])+ int(pid[31-i])+ int(tid[15-i])+ int(sid[15-i])== 1:
    				shiny = False
    				break
    if shiny:
    	return (tid,sid)
    else:
    	return False
    
    print "Please type in the file address of the pokemon"
    path = raw_input("-")
    path = os.path.normpath(path)
    file = open(path, "rb")
    pkm = array.array("i",file.read())
    file.close()
    TID,SID =_shinygen(pkm[0x00:0x04])
    pkm[0x0C:0x0E]=int(TID)
    pkm[0x0E:0x10]=int(SID)
    file = open(path,"wb")
    pkm.tofile(file)
    file.close()
    print "Your Pokemon is now Shiny!"
    time.sleep(20)
    

  5. Requires this class:

    class bf(object):
    def __init__(self,value=0):
    	self._d = value
    
    def __getitem__(self, index):
    	return (self._d >> index) & 1 
    
    def __setitem__(self,index,value):
    	value    = (value&1L)<<index
    	mask     = (1L)<<index
    	self._d  = (self._d & ~mask) | value
    
    def __getslice__(self, start, end):
    	mask = 2L**(end - start) -1
    	return (self._d >> start) & mask
    
    def __setslice__(self, start, end, value):
    	mask = 2L**(end - start) -1
    	value = (value & mask) << start
    	mask = mask << start
    	self._d = (self._d & ~mask) | value
    	return (self._d >> start) & mask
    
    def __int__(self):
    	return self._d

    Function:

    def shinygen(pokemonid):
    """Returns Tuple of Shiny TID and SID for given PID"""
    shiny=False
    n=0
    while shiny == False:
    	tid=bf(random.getrandbits(16))
    	sid=bf(random.getrandbits(16))
    	pid=bf(pokemonid)
    	n +=1
    	shiny = True
    	for i in range(0,13):
    		if int(pid[15-i]) + int(pid[31-i])+ int(tid[15-i])+ int(sid[15-i])== 3:
    				shiny = False
    				break
    		elif int(pid[15-i])+ int(pid[31-i])+ int(tid[15-i])+ int(sid[15-i])== 1:
    				shiny = False
    				break
    if shiny:
    	return (tid,sid)
    else:
    	return False

    Demo Program that generates shiny TID/SIDs:

    (on dropbox because py2exe is too big to upload [barely])

    http://dl.dropbox.com/u/20328726/MakeShiny.zip

  6. (U)

    Action replay code for team rocket outfit:

    Male:

    62111880 00000000

    B2111880 00000000

    10025D90 00000102

    D2000000 00000000

    Female:

    62111880 00000000

    B2111880 00000000

    10025D90 00000103

    D2000000 00000000

    Bonus-

    Be MewTwo(glitchy):

    WARNING

    DO NOT:

    1. Use the Pokemon Center
    2. Go to the Pokeathalon dome
    3. Surf
    4. Fly
    5. Rock Climb
    6. Do anything that requires a special animation

    Anything mentioned above will crash the game.

    An alternative to the Pokemon center can be found in prof. elm's lab.

    62111880 00000000

    B2111880 00000000

    10025D90 00000243

    D2000000 00000000

×
×
  • Create New...