class Numeric
def separate(sep=".")
self.to_s.reverse.scan(/(?:\d*\.)?\d{1,3}-?/).join(sep).reverse
end
end
class PokemonTrainerCardScene
def update
pbUpdateSpriteHash(@sprites)
end
def pbStartScene
@front=true
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
background=pbResolveBitmap(sprintf("Graphics/Pictures/trainercardbgf"))
if $Trainer.gender==1 && background
addBackgroundPlane(@sprites,"bg","trainercardbgf",@viewport)
else
addBackgroundPlane(@sprites,"bg","trainercardbg",@viewport)
end
cardexists=pbResolveBitmap(sprintf("Graphics/Pictures/trainercardf"))
@sprites["card"]=IconSprite.new(0,0,@viewport)
if $game_variables[30]==0 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_0")
elsif $game_variables[30]==1 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_1")
elsif $game_variables[30]==2 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_2")
elsif $game_variables[30]==3 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_3")
elsif $game_variables[30]==4 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_4")
elsif $game_variables[30]==5 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_5")
else
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_6")
end
@sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
@sprites["trainer"]=IconSprite.new(446,102,@viewport) #336,112
@sprites["trainer"].setBitmap(sprintf("Graphics/Characters/trainer%03d",$Trainer.trainertype))
@sprites["trainer"].x-=(@sprites["trainer"].bitmap.width-128)/2
@sprites["trainer"].y-=(@sprites["trainer"].bitmap.height-128)
@sprites["trainer"].z=2
pbSetSystemFont(@sprites["overlay"].bitmap)
pbDrawTrainerCardFront
if $PokemonGlobal.trainerRecording
$PokemonGlobal.trainerRecording.play
end
pbFadeInAndShow(@sprites) { update }
end
def pbDrawTrainerCardFront
overlay=@sprites["overlay"].bitmap
overlay.clear
totalsec = Graphics.frame_count / Graphics.frame_rate
hour = totalsec / 60 / 60
min = totalsec / 60 % 60
time=_ISPRINTF("{1:02d}:{2:02d}",hour,min)
starttime=_INTL("{1}. {2} {3} {4}:{5}",
$PokemonGlobal.startTime.day,
pbGetAbbrevMonthName($PokemonGlobal.startTime.mon),
$PokemonGlobal.startTime.year,
$PokemonGlobal.startTime.hour,
$PokemonGlobal.startTime.min)
pubid=sprintf("%05d",$Trainer.publicID($Trainer.id))
if $game_variables[30]==5
baseColor=Color.new(241,241,241)
shadowColor=Color.new(70,70,70)
elsif $game_variables[30]==6
baseColor=Color.new(246,225,99)
shadowColor=Color.new(70,70,70)
else
baseColor=Color.new(72,72,72)
shadowColor=Color.new(160,160,160)
end
textPositions=[
[_INTL("Name"),26,92,0,baseColor,shadowColor], #34,64,0
[_INTL("{1}",$Trainer.fullname),358,92,1,baseColor,shadowColor], #302,64,1
[_INTL("ID. Nr."),26,54,0,baseColor,shadowColor], #332,64,0
[_INTL("{1}",pubid),358,54,1,baseColor,shadowColor], #468,64,1
[_INTL("Geld"),26,130,0,baseColor,shadowColor], #34,112,0
[_INTL("{1} $",$Trainer.money.separate),358,130,1,baseColor,shadowColor], #302,112,1
[_INTL("Gesehen"),26,168,0,baseColor,shadowColor], #34,160,0
[_INTL("{1} von {2}",$Trainer.pokedexSeen,PBSpecies.maxValue),358,168,1,baseColor,shadowColor], #302,160,1
[_INTL("Gefangen"),26,206,0,baseColor,shadowColor], #34,160,0
[_INTL("{1} von {2}",$Trainer.pokedexOwned,PBSpecies.maxValue),358,206,1,baseColor,shadowColor], #302,160,1
[_INTL("Punkte"),26,244,0,baseColor,shadowColor], #34,160,0
[_INTL("{1}",PokemonPoints().separate),358,244,1,baseColor,shadowColor], #302,160,1
[_INTL("Spielzeit"),26,282,0,baseColor,shadowColor], #34,208,0
[time,358,282,1,baseColor,shadowColor], #302,208,1
[_INTL("Abgeschlossene Kapitel"),26,320,0,baseColor,shadowColor], #34,160,0
[_INTL("{1}",$game_variables[65]),584,320,1,baseColor,shadowColor], #302,160,1
[_INTL("Abenteuer gestartet"),26,358,0,baseColor,shadowColor], #32,256,0
[starttime,584,358,1,baseColor,shadowColor] #302,256,1
]
pbDrawTextPositions(overlay,textPositions)
x=40 #72
region=pbGetCurrentRegion(0) # Get the current region
imagePositions=[]
for i in 0...8
if $Trainer.badges[i+region*8]
imagePositions.push(["Graphics/Pictures/badges",x,400,i*32,region*32,32,32]) #310 #32
end
x+=48
end
pbDrawImagePositions(overlay,imagePositions)
end
def pbStartSceneBack
@front=false
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
background=pbResolveBitmap(sprintf("Graphics/Pictures/trainercardbgf"))
if $Trainer.gender==1 && background
addBackgroundPlane(@sprites,"bg","trainercardbgf",@viewport)
else
addBackgroundPlane(@sprites,"bg","trainercardbg",@viewport)
end
cardexists=pbResolveBitmap(sprintf("Graphics/Pictures/trainercardf"))
@sprites["card"]=IconSprite.new(0,0,@viewport)
if $game_variables[30]==0 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_back_0")
elsif $game_variables[30]==1 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_back_1")
elsif $game_variables[30]==2 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_back_2")
elsif $game_variables[30]==3 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_back_3")
elsif $game_variables[30]==4 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_back_4")
elsif $game_variables[30]==5 && cardexists
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_back_5")
else
@sprites["card"].setBitmap("Graphics/Pictures/trainerpass_back_6")
end
@sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
pbSetSystemFont(@sprites["overlay"].bitmap)
pbDrawTrainerCardBack
pbFadeInAndShow(@sprites) { update }
end
def pbDrawTrainerCardBack
if $fametime
fametime=_INTL("{2}. {1} {3} {4}:{5}",
pbGetAbbrevMonthFullName($fametime.mon),
$fametime.day,
$fametime.year,
$fametime.hour,
$fametime.min)
end
overlay=@sprites["overlay"].bitmap
overlay.clear
fortschritt= (($Trainer.pokedexOwned * 100) / PBSpecies.maxValue).to_i
battlewins = (($game_variables[45] * 100) / $game_variables[44]).to_i
if $game_variables[30]==5
baseColor=Color.new(241,241,241)
shadowColor=Color.new(70,70,70)
elsif $game_variables[30]==6
baseColor=Color.new(246,225,99)
shadowColor=Color.new(70,70,70)
else
baseColor=Color.new(72,72,72)
shadowColor=Color.new(160,160,160)
end
textPositions=[
[_INTL("Pokédex Fortschritt"),26,56,0,baseColor,shadowColor], #332,64,0
[_INTL("{1}%",fortschritt),584,56,1,baseColor,shadowColor], #468,64,1
[_INTL("Gewonnene Trainerkämpfe"),26,132,0,baseColor,shadowColor], #34,160,0
[_INTL("{1} von {2} ({3} %)",$game_variables[45],$game_variables[44],battlewins),584,132,1,baseColor,shadowColor], #302,160,1
[_INTL("Gefangene Pokémon"),26,170,0,baseColor,shadowColor], #34,160,0
[_INTL("{1}",$game_variables[47]),584,170,1,baseColor,shadowColor], #302,160,1
[_INTL("Begegnete Shinys"),26,208,0,baseColor,shadowColor], #34,160,0
[_INTL("{1}",$game_variables[49]),584,208,1,baseColor,shadowColor], #302,160,1
[_INTL("Pokémon getauscht"),26,246,0,baseColor,shadowColor], #34,208,0
[_INTL("---"),584,246,1,baseColor,shadowColor] #302,208,1
]
if fametime
textPositions <<
[_INTL("Debüt Ruhmeshalle"),26,18,0,baseColor,shadowColor] <<
[_INTL("{1}",fametime),584,18,1,baseColor,shadowColor]
end
if $game_switches[100]
textPositions <<
[_INTL("Gefangene Crypto Pokémon"),26,94,0,baseColor,shadowColor] <<
[_INTL("{1} von 999",$game_variables[100]),584,94,1,baseColor,shadowColor]
end
pbDrawTextPositions(overlay,textPositions)
end
def pbTrainerCard
loop do
Graphics.update
Input.update
self.update
if Input.trigger?(Input::B)
break
end
if Input.trigger?(Input::C)
(@front) ? pbStartSceneBack : pbStartScene
end
end
end
def pbEndScene
pbFadeOutAndHide(@sprites) { update }
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
end
class PokemonTrainerCard
def initialize(scene)
@scene=scene
end
def pbStartScreen
@scene.pbStartScene
@scene.pbTrainerCard
@scene.pbEndScene
end
end