Mandrew

ShinyIDGenerator.ahk

Jun 8th, 2012
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ShinyIDGenerator.ahk - asks for a PID and generates a text file of all possible TID/SID combinations that would make that Pokémon shiny
  2. ; © M.andrew 1 Jan 2012
  3.  
  4. GUI, New
  5. GUI, Add, Text, R1 x5 y5, PID:
  6. GUI, Add, Edit, R1 x30 y5 vPID Number, 2259878931
  7. GUI, Add, Button, x45 y30 Default, OK
  8.  
  9. Display:
  10. GUI, Show
  11. Return
  12.  
  13. ButtonOK:
  14. GUI, Submit
  15. Progress, M R0-65535, Go grab a drink - this will take a while., Instead of calculating to its full potential, your CPU is drawing this progress bar, Generating...
  16. Loop, 65536 {
  17.     TID := A_Index - 1
  18.     Loop, 65536 {
  19.         SID := A_Index -1
  20.         If (ShinyFactor(TID, SID, PID) < 8)
  21.             FileAppend, SHINY!!! %TID%/%SID%`n, %PID%.txt
  22.     }
  23.     TIDLoop += 1
  24.     Progress, %TIDLoop%
  25. }
  26. MsgBox All done! The results can be found in %PID%.txt.
  27. ExitApp
  28.  
  29. ShinyFactor(TID, SID, PID) {
  30. ; Determining a Pokémon's shininess uses three xor operators on the TID, SID, and PID and an inequality check. This function returns the result of the last xor operation.
  31.  
  32. Xor_Trainer := TID ^ SID ; FIRST XOR
  33.  
  34. ; Before performing the second calculation, we must split the PID into its most and least significant halves
  35. PIDFirstHalf := (PID & 0x00000000FFFF0000) >> 16
  36. PIDSecondHalf := PID & 0x000000000000FFFF
  37.  
  38. Xor_Pokemon := PIDFirstHalf ^ PIDSecondHalf ; SECOND XOR
  39.  
  40. Return Xor_Trainer ^ Xor_Pokemon ; THIRD XOR
  41. }
Advertisement
Add Comment
Please, Sign In to add comment