Advertisement
Guest User

pokemon iv and nature display

a guest
Feb 17th, 2011
697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.95 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   3004290 J
  5. -- emerald 0x02024190 J 0x020244EC U
  6. -- firered 0x02024284
  7. -- leafgreen 0x020241e4
  8. -- http://pastebin.com/ZHxPYDsN
  9.  
  10. -- 64
  11. -- 4360 43C4 4428 448C 44F0 4554
  12. -- 45C0 4624
  13.  
  14.  
  15. local natureorder={"Atk","Def","Spd","SpAtk","SpDef"}
  16. local naturename={
  17.  "Hardy","Lonely","Brave","Adamant","Naughty",
  18.  "Bold","Docile","Relaxed","Impish","Lax",
  19.  "Timid","Hasty","Serious","Jolly","Naive",
  20.  "Modest","Mild","Quiet","Bashful","Rash",
  21.  "Calm","Gentle","Sassy","Careful","Quirky"}
  22. local typeorder={
  23.  "Fighting","Flying","Poison","Ground",
  24.  "Rock","Bug","Ghost","Steel",
  25.  "Fire","Water","Grass","Electric",
  26.  "Psychic","Ice","Dragon","Dark"}
  27.  
  28. local start=0x03004360
  29. local personality
  30. local trainerid
  31. local magicword
  32. local growthoffset
  33. local miscoffset
  34. local i
  35.  
  36. local species
  37. local ivs
  38. local hpiv
  39. local atkiv
  40. local defiv
  41. local spdiv
  42. local spatkiv
  43. local spdefiv
  44. local nature
  45. local natinc
  46. local natdec
  47. local hidpowbase
  48. local hidpowtype
  49.  
  50. while true do
  51.  
  52.  personality=memory.readdwordunsigned(start)
  53.  trainerid=memory.readdwordunsigned(start+4)
  54.  magicword=bit.bxor(personality, trainerid)
  55.  
  56.  i=personality%24
  57.  
  58.  if i<=5 then
  59.   growthoffset=0
  60.  elseif i%6<=1 then
  61.   growthoffset=12
  62.  elseif i%2==0 then
  63.   growthoffset=24
  64.  else
  65.   growthoffset=36
  66.  end
  67.  
  68.  if i>=18 then
  69.   miscoffset=0
  70.  elseif i%6>=4 then
  71.   miscoffset=12
  72.  elseif i%2==1 then
  73.   miscoffset=24
  74.  else
  75.   miscoffset=36
  76.  end
  77.  
  78.  species=bit.band(bit.bxor(memory.readdwordunsigned(start+32+growthoffset),magicword),0xFFF)
  79.  
  80.  ivs=bit.bxor(memory.readdwordunsigned(start+32+miscoffset+4),magicword)
  81.  
  82.  hpiv=bit.band(ivs,0x1F)
  83.  atkiv=bit.band(ivs,0x1F*0x20)/0x20
  84.  defiv=bit.band(ivs,0x1F*0x400)/0x400
  85.  spdiv=bit.band(ivs,0x1F*0x8000)/0x8000
  86.  spatkiv=bit.band(ivs,0x1F*0x100000)/0x100000
  87.  spdefiv=bit.band(ivs,0x1F*0x2000000)/0x2000000
  88.  
  89.  nature=personality%25
  90.  natinc=math.floor(nature/5)
  91.  natdec=nature%5
  92.  
  93.  hidpowtype=math.floor(((hpiv%2 + 2*(atkiv%2) + 4*(defiv%2) + 8*(spdiv%2) + 16*(spatkiv%2) + 32*(spdefiv%2))*15)/63)
  94.  hidpowbase=math.floor(((bit.band(hpiv,2)/2 + bit.band(atkiv,2) + 2*bit.band(defiv,2) + 4*bit.band(spdiv,2) + 8*bit.band(spatkiv,2) + 16*bit.band(spdefiv,2))*40)/63 + 30)
  95.  
  96.  
  97.  gui.text(0,0,"HP IV="..hpiv, "yellow")
  98.  gui.text(0,10,"Atk IV="..atkiv, "red")
  99.  gui.text(0,20,"Def IV="..defiv, "blue")
  100.  gui.text(50,0,"Spd IV="..spdiv, "green")
  101.  gui.text(50,10,"SpAtk IV="..spatkiv, "red")
  102.  gui.text(50,20,"SpDef IV="..spdefiv, "blue")
  103.  
  104.  gui.text(0,30,"Species "..species)
  105.  gui.text(0,40,"Nature: "..naturename[nature+1])
  106.  gui.text(0,50,natureorder[natinc+1].."+ "..natureorder[natdec+1].."-")
  107.  gui.text(0,60,"Hidden Power: "..typeorder[hidpowtype+1].." "..hidpowbase)
  108.  
  109.  emu.frameadvance()
  110.  
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement