Advertisement
Guest User

pokemon iv and nature display

a guest
Feb 14th, 2011
7,907
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.35 KB | None | 0 0
  1. -- http://tasvideos.org/forum/viewtopic.php?t=4101
  2. -- http://tasvideos.org/forum/viewtopic.php?t=4101&postdays=0&postorder=asc&start=100 me post
  3. -- http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_structure_in_Generation_III
  4. -- ruby/sapphire 0x03004360
  5. -- emerald 0x02024190 J 0x020244EC U
  6. -- firered 0x02024284
  7. -- leafgreen 0x020241e4
  8.  
  9. -- 64
  10. -- 4360 43C4 4428 448C 44F0 4554
  11. -- 45C0 4624
  12.  
  13. local natureorder={"Atk","Def","Spd","SpAtk","SpDef"}
  14. local naturename={
  15.  "Hardy","Lonely","Brave","Adamant","Naughty",
  16.  "Bold","Docile","Relaxed","Impish","Lax",
  17.  "Timid","Hasty","Serious","Jolly","Naive",
  18.  "Modest","Mild","Quiet","Bashful","Rash",
  19.  "Calm","Gentle","Sassy","Careful","Quirky"}
  20.  
  21. local start=0x03004360
  22. local personality
  23. local trainerid
  24. local magicword
  25. local growthoffset
  26. local miscoffset
  27. local i
  28.  
  29. local species
  30. local ivs
  31. local hpiv
  32. local atkiv
  33. local defiv
  34. local spdiv
  35. local spatkiv
  36. local spdefiv
  37. local nature
  38. local natinc
  39. local natdec
  40.  
  41. while true do
  42.  
  43.  personality=memory.readdwordunsigned(start)
  44.  trainerid=memory.readdwordunsigned(start+4)
  45.  magicword=bit.bxor(personality, trainerid)
  46.  
  47.  i=personality%24
  48.  
  49.  if i<=5 then
  50.   growthoffset=0
  51.  elseif i%6<=1 then
  52.   growthoffset=12
  53.  elseif i%2==0 then
  54.   growthoffset=24
  55.  else
  56.   growthoffset=36
  57.  end
  58.  
  59.  if i>=18 then
  60.   miscoffset=0
  61.  elseif i%6>=4 then
  62.   miscoffset=12
  63.  elseif i%2==1 then
  64.   miscoffset=24
  65.  else
  66.   miscoffset=36
  67.  end
  68.  
  69.  species=bit.band(bit.bxor(memory.readdwordunsigned(start+32+growthoffset),magicword),0xFFF)
  70.  
  71.  ivs=bit.bxor(memory.readdwordunsigned(start+32+miscoffset+4),magicword)
  72.  
  73.  hpiv=bit.band(ivs,0x1F)
  74.  atkiv=bit.band(ivs,0x1F*0x20)/0x20
  75.  defiv=bit.band(ivs,0x1F*0x400)/0x400
  76.  spdiv=bit.band(ivs,0x1F*0x8000)/0x8000
  77.  spatkiv=bit.band(ivs,0x1F*0x100000)/0x100000
  78.  spdefiv=bit.band(ivs,0x1F*0x2000000)/0x2000000
  79.  
  80.  nature=personality%25
  81.  natinc=math.floor(nature/5)
  82.  natdec=nature%5
  83.  
  84.  
  85.  gui.text(0,0,"HP IV="..hpiv, "yellow")
  86.  gui.text(0,10,"Atk IV="..atkiv, "red")
  87.  gui.text(50,10,"Def IV="..defiv, "blue")
  88.  gui.text(50,0,"Spd IV="..spdiv, "green")
  89.  gui.text(0,20,"SpAtk IV="..spatkiv, "red")
  90.  gui.text(50,20,"SpDef IV="..spdefiv, "blue")
  91.  
  92.  gui.text(0,30,"Species "..species)
  93.  gui.text(0,40,"Nature: "..naturename[nature+1])
  94.  gui.text(0,50,natureorder[natinc+1].."+ "..natureorder[natdec+1].."-")
  95.  
  96.  
  97.  
  98.  emu.frameadvance()
  99.  
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement