aki vai tutorais pro pokemon start kit
e se sua pokedex estiver dando erro use script no lugar da dela
classWindow_Pokedex<SpriteWindow_Selectable attr_reader :baseColor attr_reader :shadowColor def initialize(x,y,width,height) @starting=true super(x,y,width,height) @selarrow=AnimatedBitmap.new("Graphics/Pictures/selarrow") @pokeball=AnimatedBitmap.new("Graphics/Pictures/pokeball") @baseColor=Color.new(9<<3,9<<3,9<<3) @shadowColor=Color.new(26<<3,26<<3,26<<3) self.index=0 @commands=[] @item_max=0 @starting=false refresh enddef commands=(value) @commands=value refresh enddef dispose @selarrow.dispose @pokeball.dispose superenddef species return@commands.length==0?0:@commands[self.index][0]enddef refresh returnif@starting @item_max=@commands.length dheight=self.height-32 dwidth=self.width-32 if!self.contents ||self.contents.disposed?|| self.contents.height<dheight ||self.contents.width<dwidth self.contents.dispose ifself.contents self.contents=Bitmap.new([1,dwidth].max,[1,dheight].max) pbSetSystemFont(self.contents) end self.contents.clear contentsWidth=self.contents.width ypos=0 for i in0...@item_max if i<self.top_row || i>self.top_row+self.page_row_max next end pbCopyBitmap(self.contents,@selarrow.bitmap,0,ypos)ifself.index==i indexNumber=@commands[i][4] species=@commands[i][0] if $Trainer.seen[species] j=self.top_row if $Trainer.owned[species] pbCopyBitmap(self.contents,@pokeball.bitmap,210,(i-j)*32) end text=_ISPRINTF("No.{1:03d} {2:s}",indexNumber,@commands[i][1]) else text=_ISPRINTF("No.{1:03d} ----------",indexNumber) end self.contents.font.color=@shadowColor pbDrawShadow(self.contents,center=+1,ypos,self.contents.width-16,32,text) self.contents.font.color=@baseColor self.contents.draw_text(center=+1,ypos,self.contents.width-16,32,text) ypos+=32 endenddef update dorefresh=false oldindex=self.index super dorefresh=(self.index!=oldindex) refresh if dorefresh endendclassWindow_ComplexCommandPokemon<SpriteWindow_Selectable attr_reader :baseColor attr_reader :shadowColor attr_reader :commands def getAutoDims(commands,dims,width=nil) windowheight=commands.length*32+32 windowheight=33if windowheight<33 if!width || width<0 width=0 tmpbitmap=Bitmap.new(1,1) pbSetSystemFont(tmpbitmap) for i in commands width=[width,tmpbitmap.text_size(i).width].max end width+=64 tmpbitmap.dispose else width=[33,width].max end dims[0]=width dims[1]=windowheight enddef initialize(commands,width=nil) @starting=true @commands=commands dims=[] getAutoDims(commands,dims,width) super(0,0,dims[0],dims[1]) @item_max=commands.length @selarrow=AnimatedBitmap.new("Graphics/Pictures/selarrow") @index=0 self.active=true @baseColor=Color.new(12*8,12*8,12*8) @shadowColor=Color.new(26*8,26*8,25*8) refresh @starting=falseenddefself.newEmpty(x,y,width,height,viewport=nil) ret=self.new([],width) ret.x=x ret.y=y ret.width=width ret.height=height ret.viewport=viewport return ret enddef index=(value) super refresh if!@startingenddef indexToCommand(index) curindex=0 i=0; loop dobreakunless i<@commands.length return[i/2,-1]if index==curindex curindex+=1 return[i/2,index-curindex]if index-curindex<commands[i+1].length curindex+=commands[i+1].length i+=2 end return[-1,-1]enddef getText(array,index) cmd=indexToCommand(index) return""if cmd[0]==-1 return array[cmd[0]*2]if cmd[1]<0 return array[cmd[0]*2+1][cmd[1]]enddef commands=(value) @commands=value @item_max=commands.length self.index=self.index enddef width=(value) super if!@starting self.index=self.index endenddef height=(value) super if!@starting self.index=self.index endenddef resizeToFit(commands) dims=[] getAutoDims(commands,dims) self.width=dims[0] self.height=dims[1]enddef dispose @selarrow.dispose superenddef baseColor=(value) @baseColor=value refresh enddef shadowColor=(value) @shadowColor=value refresh enddef refresh dwidth=self.width-32 dheight=self.height-32 @item_max=0 i=0; loop dobreakunless i<@commands.length @item_max+=1+@commands[i+1].length i+=2 end if!self.contents ||self.contents.disposed?|| self.contents.width<dwidth || self.contents.height<dheight self.contents.dispose ifself.contents self.contents=Bitmap.new([1,dwidth].max,[1,dheight].max) pbSetSystemFont(self.contents) end self.contents.clear contentsWidth=self.contents.width ypos=0 icommand=0 i=0; loop dobreakunless i<@commands.length if icommand>=self.top_row && icommand<self.top_row+self.page_row_max self.contents.font.color=self.shadowColor pbDrawShadow(self.contents,0,ypos,contentsWidth,32,@commands[i]) self.contents.font.color=self.baseColor self.contents.draw_text(0,ypos,contentsWidth,32,@commands[i]) ypos+=32 end icommand+=1 for j in0...@commands[i+1].length if icommand>=self.top_row && icommand<self.top_row+self.page_row_max pbCopyBitmap(self.contents,@selarrow.bitmap,0,ypos)ifself.index==icommand self.contents.font.color=self.shadowColor pbDrawShadow(self.contents,16,ypos,contentsWidth-16,32,@commands[i+1][j]) self.contents.font.color=self.baseColor self.contents.draw_text(16,ypos,contentsWidth-16,32,@commands[i+1][j]) ypos+=32 end icommand+=1 end i+=2 endenddef update oldindex=self.index super refresh ifself.index!=oldindex endendclassPokemonPokedexScenedef setIconBitmap(file)@sprites["icon"].setBitmap(file)if@sprites["icon"].bitmap @sprites["icon"].ox=@sprites["icon"].bitmap.width/2 @sprites["icon"].oy=@sprites["icon"].bitmap.height/2endend## Gets the region used for displaying Pokédex entries.# Species will be listed according to the given region's# numbering and the returned region can have any value# defined in the town map data file. It's currently# set to the return value of pbGetCurrentRegion, # and thus will change according to the current map's # MapPosition metadata setting.#def pbGetPokedexRegion return pbGetCurrentRegion()enddef pbStartScene @sprites={}@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)@viewport.z=99999@sprites["pokedex"]=Window_Pokedex.new( 160,0,Graphics.width-160,Graphics.height)@sprites["pokedex"].viewport=@viewport@sprites["dexentry"]=IconSprite.new(0,0,@viewport)@sprites["dexentry"].setBitmap("Graphics/Pictures/dexentry")@sprites["dexentry"].visible=false@sprites["overlay"]=SpriteWrapper.new(@viewport)@sprites["overlay"].bitmap=Bitmap.new(Graphics.width,Graphics.height) pbSetSystemFont(@sprites["overlay"].bitmap)@sprites["overlay"].x=0@sprites["overlay"].y=0@sprites["overlay"].visible=false@sprites["iconback"]=IconWindow.new(0,0,160,160)@sprites["iconback"].viewport=@viewport@sprites["auxlist"]=Window_CommandPokemon.newEmpty(272,0,208,224,@viewport)@sprites["searchlist"]=Window_ComplexCommandPokemon.newEmpty(0,0,272,224,@viewport)@sprites["infowindow"]=Window_UnformattedTextPokemon.newWithSize("",0,160,160,160,@viewport)@sprites["messagebox"]=Window_UnformattedTextPokemon.new("") pbBottomLeftLines(@sprites["messagebox"],2)@sprites["messagebox"].letterbyletter=false@sprites["messagebox"].visible=false@sprites["messagebox"].viewport=@viewport@sprites["auxlist"].visible=false@sprites["searchlist"].visible=false addBackgroundPlane(@sprites,"searchbg","searchbg",@viewport)=begin# Suggestion for changing the background depending on region. You# can change the line below with the following:if pbGetPokedexRegion()==-1# Using national Pokédex addBackgroundPlane(@sprites,"background","pokedexbg_national",@viewport)elsif pbGetPokedexRegion()==0# Using regional Pokédex addBackgroundPlane(@sprites,"background","pokedexbg_regional",@viewport)end=end addBackgroundPlane(@sprites,"background","pokedexbg",@viewport)@sprites["searchbg"].visible=false@sprites["icon"]=IconSprite.new(80,80,@viewport)@searchResults=false pbRefreshDexList($PokemonGlobal.pokedexIndex) pbFadeInAndShow(@sprites)enddef pbDexSearchCommands(commands,selitem,helptexts=nil) ret=-1 auxlist=@sprites["auxlist"] messagebox=@sprites["messagebox"] auxlist.commands=commands auxlist.index=selitem messagebox.text=helptexts ? helptexts[auxlist.index]:"" loop do Graphics.update Input.update oldindex=auxlist.index auxlist.update if auxlist.index!=oldindex && helptexts messagebox.text=helptexts[auxlist.index] end ifInput.trigger?(Input::B) ret=selitem break end ifInput.trigger?(Input::C) ret=auxlist.index break endend@sprites["auxlist"].commands=[]Input.update return ret enddef pbCanAddForModeList?(mode,nationalSpecies)case mode when0 returntrue when1 return $Trainer.seen[nationalSpecies] when2,3,4,5 return $Trainer.owned[nationalSpecies]endenddef pbCanAddForModeSearch?(mode,nationalSpecies)case mode when0,1 return $Trainer.seen[nationalSpecies] when2,3,4,5 return $Trainer.owned[nationalSpecies]endenddef pbGetDexList() dexlist=[] dexdata=pbOpenDexData region=pbGetPokedexRegion() regionalSpecies=pbAllRegionalSpecies(region)if regionalSpecies.length==1 # No regional species defined, # use national Pokédex order for i in1..PBSpecies.getCount regionalSpecies.push(i) endendfor i in1...regionalSpecies.length nationalSpecies=regionalSpecies[i] if pbCanAddForModeList?($PokemonGlobal.pokedexMode,nationalSpecies) pbDexDataOffset(dexdata,nationalSpecies,33) height=dexdata.fgetw weight=dexdata.fgetw # Pushing national species, name, height, weight, index number dexlist.push([nationalSpecies, PBSpecies.getName(nationalSpecies),height,weight,i]) endend dexdata.close return dexlist enddef pbRefreshDexList(index=0) dexlist=pbGetDexList()case $PokemonGlobal.pokedexMode when0# Numerical mode # Remove species not seen from the list i=0; loop dobreakunless i<dexlist.length breakif $Trainer.seen[dexlist[i][0]] dexlist[i]=nil i+=1 end i=dexlist.length-1; loop dobreakunless i>=0 breakif!dexlist[i]|| $Trainer.seen[dexlist[i][0]] dexlist[i]=nil i-=1 end dexlist.compact! # Sort species in ascending order by # index number, not national species dexlist.sort!{|a,b| a[4]<=>b[4]} when1# Alphabetical mode dexlist.sort!{|a,b| a[1]<=>b[1]} when2# Heaviest mode dexlist.sort!{|a,b| b[3]<=>a[3]} when3# Lightest mode dexlist.sort!{|a,b| a[3]<=>b[3]} when4# Tallest mode dexlist.sort!{|a,b| b[2]<=>a[2]} when5# Smallest mode dexlist.sort!{|a,b| a[2]<=>b[2]}endif!@searchResults @sprites["infowindow"].text=_ISPRINTF("SEEN: {1:d}\r\nOWN: {2:d}\r\nZ: MENU\r\nF5: SEARCH",$Trainer.pokedexSeen,$Trainer.pokedexOwned)else @sprites["infowindow"].text=_INTL("X: BACK\r\nZ: MENU\r\nF5: SEARCH")end@dexlist=dexlist @sprites["pokedex"].commands=@dexlist@sprites["pokedex"].index=index @sprites["pokedex"].refresh iconspecies=@sprites["pokedex"].species iconspecies=0if!$Trainer.seen[iconspecies] setIconBitmap(pbPokemonBitmapFile(iconspecies,false))enddef pbSearchDexList(params) dexlist=pbGetDexList()ifparams[0]!=0# Filter by name nameCommands=[ "",_INTL("ABC"),_INTL("DEF"),_INTL("GHI"), _INTL("JKL"),_INTL("MNO"),_INTL("PQR"), _INTL("STU"),_INTL("VWX"),_INTL("YZ") ] scanNameCommand=nameCommands[params[0]].scan(/./) dexlist=dexlist.find_all {|item| firstChar=item[1][0,1] next scanNameCommand.any?{|v| v==firstChar } }endifparams[1]!=0# Filter by color dexlist=dexlist.find_all {|item| dexdata.pos=76*(item[0]-1)+6 color=dexdata.fgetb next color==params[1]-1 }endifparams[2]!=0||params[3]!=0# Filter by type typeCommands=[ -1,0,1,2,3,4,5,6,7,8, 10,11,12,13,14,15,16,17 ] stype1=typeCommands[params[2]] stype2=typeCommands[params[3]] dexlist=dexlist.find_all {|item| dexdata.pos=76*(item[0]-1)+8 type1=dexdata.fgetb type2=dexdata.fgetb if stype1>=0<
Este post foi editado por Laura Mendes em 29 de maio de 2015 16:34:42 ART"