Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- emu = emu or VBA
- if not emu then
- error("Run under VBA.")
- end
- ransuu = {}
- shouhi = {}
- seed = {0, 0, 0, 0, 0}
- futureseed = {}
- frand = {}
- ran = 3 -- 0 or 3
- textcri = {}
- function ransuuhyouji()
- f = emu.framecount()
- ransuu[f] = memory.readdword(0x03005040)
- for i = 1, 4 do
- shouhi[6 - i] = shouhi[5 - i]
- seed[6 - i] = seed[5 - i]
- end
- shouhi[1] = 0
- if seed[1] == nil then
- seed[1] = ransuu[f]
- shouhi[1] = 1
- end
- for i = 1, 80 do
- if seed[1] ~= ransuu[f] then
- seed1 = seed[1] % (2 ^ 16)
- seed2 = math.floor(seed[1] / (2 ^ 16))
- seed[1] = (((seed1 * 0x41C64E6D) + 0x6073) + ((seed2 * 0x41C64E6D) % (2 ^ 16) * (2 ^ 16))) % (2 ^ 32)
- shouhi[1] = shouhi[1] + 1
- rand = math.floor(seed[1] / 65536)
- if rand % 100 == 99 then
- colori = "red"
- elseif rand % 100 == 98 then
- colori = "yellow"
- elseif rand % 100 > 93 then
- colori = "purple"
- elseif rand % 100 > 89 then
- colori = "blue"
- else
- colori = "white"
- end
- if i < 17 then
- gui.text(2 ,40 + (i * 7) ,string.format("%x", rand))
- gui.text(24 ,40 + (i * 7) ,string.format(rand),colori)
- elseif i < 33 then
- gui.text(46 ,40 + ((i - 16) * 7) ,string.format(rand),colori)
- elseif i < 49 then
- gui.text(68 ,40 + ((i - 32) * 7) ,string.format(rand),colori)
- elseif i < 65 then
- gui.text(80 ,40 + ((i - 48) * 7) ,string.format(rand),colori)
- end
- end
- end
- if seed[1] ~= ransuu[f] then
- seed[1] = ransuu[f]
- shouhi[1] = 0
- end
- futureseed[1] = seed[1]
- for j = 2, 1001 do
- fseed1 = futureseed[j - 1] % (2 ^ 16)
- fseed2 = math.floor(futureseed[j - 1] / (2 ^ 16))
- futureseed[j] = (((fseed1 * 0x41C64E6D) + 0x6073) + ((fseed2 * 0x41C64E6D) % (2 ^ 16) * (2 ^ 16))) % (2 ^ 32)
- frand[j - 1] = math.floor(futureseed[j] / 65536)
- end
- pid = {}
- upper = {}
- downer = {}
- seibetuti = {}
- tokuseiti = {}
- kotaia = {}
- kotaib = {}
- kotaih = {}
- kotaic = {}
- kotaid = {}
- kotais = {}
- for i = 1, 5 do
- gui.text(2, 2 + (i * 7), shouhi[i])
- for j = 1, 4 do
- gui.text(0 + (18 * j), 2 + (i * 7), math.floor(seed[i] / 256 ^ (j - 1)) % 256)
- end
- end
- -- kakushukeisan
- --hitrate
- for m = 1, 10 do
- gui.text(115, 80 + (7 * m), frand[m] % 100)
- end
- gui.text (115, 73, "hit")
- --critical
- cri = {}
- percent = {}
- l = 1
- for i = 1, 500 do
- if frand[i] % 16 == 0 then
- cri[l] = i
- percent[l] = 100 - (frand[i+7+ran] % 16)
- l = l + 1
- end
- end
- for k = 1, 10 do
- if cri[k] % 3 == 1 then
- textcri[k] = "*"
- else textcri[k] = ""
- end
- gui.text(130, 80 + (7 * k), cri[k] .. textcri[k])
- gui.text(146, 80 + (7 * k), percent[k].."%")
- end
- gui.text(130, 73, "crit")
- --monohiroi
- hiroi = {}
- item = {}
- n = 1
- for i = 1, 499 do
- if frand[i] % 10 == 0 then
- hiroi[n] = i
- item[n] = frand[i + 1] % 100
- n = n + 1
- end
- end
- for o = 1, 10 do
- gui.text(160, 80 + (7 * o), hiroi[o])
- gui.text(180, 80 + (7 * o), item[o])
- end
- gui.text(160, 73, "mono")
- gui.text(180, 73, "item")
- -- pokerus
- poke = {}
- p = 1
- col = "white"
- for i = 1, 1000 do
- if frand[i] % 0x4000 == 0 and frand[i] ~=0 then
- poke[p] = i
- p = p + 1
- col = "green"
- end
- end
- gui.text(200, 73, "pokerus")
- gui.text(200, 87, poke[1], col)
- end
- function damagekeisan()
- local tekinumber = math.floor(memory.readbyte(0x02000073) / 16) + 1
- local mikatanumber = math.floor(memory.readbyte(0x02000070) / 16) + 1
- adamagemax = {}
- adamagemin = {}
- sdamagemax = {}
- sdamagemin = {}
- settei = {20, 30, 40, 50, 60, 80, 90, 95, 120, 135, 142, 150, 180, 225}
- level = memory.readbyte(0x020241E4 + 0x54+ (0x64 * (mikatanumber - 1)))
- kougeki = memory.readword(0x020241EA + 0x54+ (0x64 * (mikatanumber - 1)))
- tokukou = memory.readword(0x020241F0 + 0x54+ (0x64 * (mikatanumber - 1)))
- bougyo = memory.readword(0x02023FE8 + (0x64 * (tekinumber - 1)))
- tokubou = memory.readword(0x02023FEE + (0x64 * (tekinumber - 1)))
- function keisan(iryoku)
- adamagemax[iryoku] = (math.floor(math.floor((math.floor(level * 2 / 5) + 2) * iryoku * kougeki / bougyo) / 50) + 2)
- adamagemin[iryoku] = math.floor((math.floor(math.floor((math.floor(level * 2 / 5) + 2) * iryoku * kougeki / bougyo) / 50) + 2) * 85 / 100)
- sdamagemax[iryoku] = (math.floor(math.floor((math.floor(level * 2 / 5) + 2) * iryoku * tokukou / tokubou) / 50) + 2)
- sdamagemin[iryoku] = math.floor((math.floor(math.floor((math.floor(level * 2 / 5) + 2) * iryoku * tokukou / tokubou) / 50) + 2) * 85 / 100)
- end
- for i = 1, 14 do
- keisan(settei[i])
- gui.text(2, 55 + (i * 7), string.format("iryoku%d %d %d %d %d",settei[i], adamagemax[settei[i]], adamagemin[settei[i]], sdamagemax[settei[i]], sdamagemin[settei[i]]))
- end
- end
- function kotaiseisei()
- for i = 1, 3 do
- pid[i] = math.floor(futureseed[4] / 65536) + (math.floor(futureseed[5 + math.floor(i / 3)] / 65536) * 65536) -- pid analyze
- gui.text(40 + 40 * math.floor(i / 3) ,49 ,string.format("%x",pid[i]))
- -- seikaku
- seikakuti = pid[i] % 25
- seikakuti24 = pid[i] % 24
- if 0 <= seikakuti and seikakuti <= 4 then
- upper[i] = "A"
- elseif 5 <= seikakuti and seikakuti <= 9 then
- upper[i] = "B"
- elseif 9 <= seikakuti and seikakuti <= 14 then
- upper[i] = "S"
- elseif 14 <= seikakuti and seikakuti <= 19 then
- upper[i] = "C"
- else
- upper[i] = "D"
- end
- if seikakuti % 5 == 0 then
- downer[i] = "A"
- elseif seikakuti % 5 == 1 then
- downer[i] = "B"
- elseif seikakuti % 5 == 2 then
- downer[i] = "S"
- elseif seikakuti % 5 == 3 then
- downer[i] = "C"
- else
- downer[i] = "D"
- end
- gui.text(22, 49 + (25 * i), seikakuti24)
- -- seibetu
- seibetuti[i] = pid[i] % 256
- gui.text(22, 56 + (25 * i), seibetuti[i])
- -- tokusei
- tokuseiti[i] = pid[i] % 2
- gui.text(22 , 63 + (25 * i), tokuseiti[i])
- -- kotaiti
- kotaib[i] = math.floor(math.floor(futureseed[6 + AND(i, 2)] / 65536) / (2 ^ 10)) % 32
- kotaia[i] = math.floor(math.floor(futureseed[6 + AND(i, 2)] / 65536) / (2 ^ 5)) % 32
- kotaih[i] = math.floor(math.floor(futureseed[6 + AND(i, 2)] / 65536) / (2 ^ 0)) % 32
- kotaid[i] = math.floor(math.floor(futureseed[7 + AND(i, 2)] / 65536) / (2 ^ 10)) % 32
- kotaic[i] = math.floor(math.floor(futureseed[7 + AND(i, 2)] / 65536) / (2 ^ 5)) % 32
- kotais[i] = math.floor(math.floor(futureseed[7 + AND(i, 2)] / 65536) / (2 ^ 0)) % 32
- gui.text(40, 56 + (i * 25), string.format("%d %d %d %d %d %d", kotaih[i], kotaia[i], kotaib[i], kotaic[i], kotaid[i], kotais[i]))
- gui.text(40, 49 + (i * 25), upper[i], "red")
- gui.text(40, 63 + (i * 25), downer[i], "blue")
- end
- end
- function enemykotaiti()
- local tekinumber = math.floor(memory.readbyte(0x02000073) / 16) + 1
- local mikatanumber = math.floor(memory.readbyte(0x02000070) / 16) + 1
- local natureorder={"Atk","Def","Spd","SpAtk","SpDef"}
- local naturename={
- "Hardy","Lonely","Brave","Adamant","Naughty",
- "Bold","Docile","Relaxed","Impish","Lax",
- "Timid","Hasty","Serious","Jolly","Naive",
- "Modest","Mild","Quiet","Bashful","Rash",
- "Calm","Gentle","Sassy","Careful","Quirky"}
- local typeorder={
- "Fighting","Flying","Poison","Ground",
- "Rock","Bug","Ghost","Steel",
- "Fire","Water","Grass","Electric",
- "Psychic","Ice","Dragon","Dark"}
- local personality
- local trainerid
- local magicword
- local growthoffset
- local miscoffset
- local i
- local species
- local ivs
- local hpiv
- local atkiv
- local defiv
- local spdiv
- local spatkiv
- local spdefiv
- local nature
- local natinc
- local natdec
- local hidpowbase
- local hidpowtype
- personality=memory.readdwordunsigned(start)
- trainerid=memory.readdwordunsigned(start+4)
- magicword=bit.bxor(personality, trainerid)
- i=personality%24
- if i<=5 then
- growthoffset=0
- elseif i%6<=1 then
- growthoffset=12
- elseif i%2==0 then
- growthoffset=24
- else
- growthoffset=36
- end
- if i>=18 then
- miscoffset=0
- elseif i%6>=4 then
- miscoffset=12
- elseif i%2==1 then
- miscoffset=24
- else
- miscoffset=36
- end
- species=bit.band(bit.bxor(memory.readdwordunsigned(start+32+growthoffset),magicword),0xFFF)
- ivs=bit.bxor(memory.readdwordunsigned(start+32+miscoffset+4),magicword)
- hpiv=bit.band(ivs,0x1F)
- atkiv=bit.band(ivs,0x1F*0x20)/0x20
- defiv=bit.band(ivs,0x1F*0x400)/0x400
- spdiv=bit.band(ivs,0x1F*0x8000)/0x8000
- spatkiv=bit.band(ivs,0x1F*0x100000)/0x100000
- spdefiv=bit.band(ivs,0x1F*0x2000000)/0x2000000
- nature=personality%25
- natinc=math.floor(nature/5)
- natdec=nature%5
- hidpowtype=math.floor(((hpiv%2 + 2*(atkiv%2) + 4*(defiv%2) + 8*(spdiv%2) + 16*(spatkiv%2) + 32*(spdefiv%2))*15)/63)
- 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)
- gui.text(90,10,string.format("HP IV=%d H%d/%d", hpiv, memory.readword(0x56 + start), memory.readword(0x58 + start)), "yellow")
- gui.text(90,17,string.format("Atk IV=%d A%d", atkiv, memory.readword(0x5A + start)), "red")
- gui.text(90,24,string.format("Def IV=%d B%d", defiv, memory.readword(0x5C + start)), "blue")
- gui.text(160,10,string.format("Spd IV=%d S%d",spdiv, memory.readword(0x5E + start)), "green")
- gui.text(160,17,string.format("SpAtk IV=%d C%d",spatkiv, memory.readword(0x60 + start)), "red")
- gui.text(160,24,string.format("SpDef IV=%d D%d",spdefiv, memory.readword(0x62 + start)), "blue")
- gui.text(90,35,"Species "..species)
- gui.text(90,45,"Nature: "..naturename[nature+1])
- gui.text(90,55,natureorder[natinc+1].."+ "..natureorder[natdec+1].."-")
- gui.text(90,65,"Hidden Power: "..typeorder[hidpowtype+1].." "..hidpowbase)
- end
- function button1()
- local text
- local tekinumber = math.floor(memory.readbyte(0x02000073) / 16) + 1
- local mikatanumber = math.floor(memory.readbyte(0x02000070) / 16) + 1
- local inp = input.get()
- if (29 < inp.xmouse and 88 > inp.xmouse and 0 < inp.ymouse and 9 > inp.ymouse) then
- a = 192
- if inp.leftclick then
- start=0x02023F38 + 0x54 + ((tekinumber - 1) * 0x64)
- enemykotaiti()
- text = "enemykotaiti"
- elseif inp.rightclick then
- start = 0x02024190 + 0x54+ ((mikatanumber - 1) * 0x64)
- enemykotaiti()
- text = "mikatakotai"
- else
- text = "kotaitihyouji?"
- end
- else
- text = "kotaitihyouji?"
- end
- gui.box(29,0,88,9,64,64,255)
- gui.text(32,1,text)
- end
- function button2()
- local text2
- local inp = input.get()
- if (99 < inp.xmouse and 158 > inp.xmouse and 0 < inp.ymouse and 9 > inp.ymouse) then
- a = 192
- if inp.leftclick then
- damagekeisan()
- text = "damage"
- elseif inp.rightclick then
- kotaiseisei()
- text = "kotaiseisei"
- else
- text = "kotai/damage"
- end
- else
- text = "kotai/damage"
- end
- gui.box(99,0,158,9,64,64,255)
- gui.text(102,1,text)
- end
- while true do
- ransuuhyouji()
- button1()
- button2()
- emu.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment