mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -11,43 +11,43 @@
|
||||
#===============================================================================
|
||||
class PokemonEggHatch_Scene
|
||||
def pbStartScene(pokemon)
|
||||
@sprites={}
|
||||
@pokemon=pokemon
|
||||
@nicknamed=false
|
||||
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z=99999
|
||||
@sprites = {}
|
||||
@pokemon = pokemon
|
||||
@nicknamed = false
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
# Create background image
|
||||
addBackgroundOrColoredPlane(@sprites,"background","hatchbg",
|
||||
Color.new(248,248,248),@viewport)
|
||||
addBackgroundOrColoredPlane(@sprites, "background", "hatchbg",
|
||||
Color.new(248, 248, 248), @viewport)
|
||||
# Create egg sprite/Pokémon sprite
|
||||
@sprites["pokemon"]=PokemonSprite.new(@viewport)
|
||||
@sprites["pokemon"] = PokemonSprite.new(@viewport)
|
||||
@sprites["pokemon"].setOffset(PictureOrigin::Bottom)
|
||||
@sprites["pokemon"].x = Graphics.width/2
|
||||
@sprites["pokemon"].y = 264+56 # 56 to offset the egg sprite
|
||||
@sprites["pokemon"].x = Graphics.width / 2
|
||||
@sprites["pokemon"].y = 264 + 56 # 56 to offset the egg sprite
|
||||
@sprites["pokemon"].setSpeciesBitmap(@pokemon.species, @pokemon.gender,
|
||||
@pokemon.form, @pokemon.shiny?,
|
||||
false, false, true) # Egg sprite
|
||||
# Load egg cracks bitmap
|
||||
crackfilename = sprintf("Graphics/Pokemon/Eggs/%s_cracks", @pokemon.species)
|
||||
crackfilename = sprintf("Graphics/Pokemon/Eggs/000_cracks") if !pbResolveBitmap(crackfilename)
|
||||
crackfilename=pbResolveBitmap(crackfilename)
|
||||
@hatchSheet=AnimatedBitmap.new(crackfilename)
|
||||
crackfilename = pbResolveBitmap(crackfilename)
|
||||
@hatchSheet = AnimatedBitmap.new(crackfilename)
|
||||
# Create egg cracks sprite
|
||||
@sprites["hatch"]=SpriteWrapper.new(@viewport)
|
||||
@sprites["hatch"] = SpriteWrapper.new(@viewport)
|
||||
@sprites["hatch"].x = @sprites["pokemon"].x
|
||||
@sprites["hatch"].y = @sprites["pokemon"].y
|
||||
@sprites["hatch"].ox = @sprites["pokemon"].ox
|
||||
@sprites["hatch"].oy = @sprites["pokemon"].oy
|
||||
@sprites["hatch"].bitmap = @hatchSheet.bitmap
|
||||
@sprites["hatch"].src_rect = Rect.new(0,0,@hatchSheet.width/5,@hatchSheet.height)
|
||||
@sprites["hatch"].src_rect = Rect.new(0, 0, @hatchSheet.width / 5, @hatchSheet.height)
|
||||
@sprites["hatch"].visible = false
|
||||
# Create flash overlay
|
||||
@sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
@sprites["overlay"].z=200
|
||||
@sprites["overlay"].bitmap=Bitmap.new(Graphics.width,Graphics.height)
|
||||
@sprites["overlay"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,
|
||||
Color.new(255,255,255))
|
||||
@sprites["overlay"].opacity=0
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@sprites["overlay"].z = 200
|
||||
@sprites["overlay"].bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||
@sprites["overlay"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height,
|
||||
Color.new(255, 255, 255))
|
||||
@sprites["overlay"].opacity = 0
|
||||
# Start up scene
|
||||
pbFadeInAndShow(@sprites)
|
||||
end
|
||||
@@ -55,46 +55,46 @@ class PokemonEggHatch_Scene
|
||||
def pbMain
|
||||
pbBGMPlay("Evolution")
|
||||
# Egg animation
|
||||
updateScene(Graphics.frame_rate*15/10)
|
||||
updateScene(Graphics.frame_rate * 15 / 10)
|
||||
pbPositionHatchMask(0)
|
||||
pbSEPlay("Battle ball shake")
|
||||
swingEgg(4)
|
||||
updateScene(Graphics.frame_rate*2/10)
|
||||
updateScene(Graphics.frame_rate * 2 / 10)
|
||||
pbPositionHatchMask(1)
|
||||
pbSEPlay("Battle ball shake")
|
||||
swingEgg(4)
|
||||
updateScene(Graphics.frame_rate*4/10)
|
||||
updateScene(Graphics.frame_rate * 4 / 10)
|
||||
pbPositionHatchMask(2)
|
||||
pbSEPlay("Battle ball shake")
|
||||
swingEgg(8,2)
|
||||
updateScene(Graphics.frame_rate*4/10)
|
||||
swingEgg(8, 2)
|
||||
updateScene(Graphics.frame_rate * 4 / 10)
|
||||
pbPositionHatchMask(3)
|
||||
pbSEPlay("Battle ball shake")
|
||||
swingEgg(16,4)
|
||||
updateScene(Graphics.frame_rate*2/10)
|
||||
swingEgg(16, 4)
|
||||
updateScene(Graphics.frame_rate * 2 / 10)
|
||||
pbPositionHatchMask(4)
|
||||
pbSEPlay("Battle recall")
|
||||
# Fade and change the sprite
|
||||
fadeTime = Graphics.frame_rate*4/10
|
||||
toneDiff = (255.0/fadeTime).ceil
|
||||
fadeTime = Graphics.frame_rate * 4 / 10
|
||||
toneDiff = (255.0 / fadeTime).ceil
|
||||
for i in 1..fadeTime
|
||||
@sprites["pokemon"].tone=Tone.new(i*toneDiff,i*toneDiff,i*toneDiff)
|
||||
@sprites["overlay"].opacity=i*toneDiff
|
||||
@sprites["pokemon"].tone = Tone.new(i * toneDiff, i * toneDiff, i * toneDiff)
|
||||
@sprites["overlay"].opacity = i * toneDiff
|
||||
updateScene
|
||||
end
|
||||
updateScene(Graphics.frame_rate*3/4)
|
||||
updateScene(Graphics.frame_rate * 3 / 4)
|
||||
@sprites["pokemon"].setPokemonBitmap(@pokemon) # Pokémon sprite
|
||||
@sprites["pokemon"].x = Graphics.width/2
|
||||
@sprites["pokemon"].x = Graphics.width / 2
|
||||
@sprites["pokemon"].y = 264
|
||||
@pokemon.species_data.apply_metrics_to_sprite(@sprites["pokemon"], 1)
|
||||
@sprites["hatch"].visible=false
|
||||
@sprites["hatch"].visible = false
|
||||
for i in 1..fadeTime
|
||||
@sprites["pokemon"].tone=Tone.new(255-i*toneDiff,255-i*toneDiff,255-i*toneDiff)
|
||||
@sprites["overlay"].opacity=255-i*toneDiff
|
||||
@sprites["pokemon"].tone = Tone.new(255 - i * toneDiff, 255 - i * toneDiff, 255 - i * toneDiff)
|
||||
@sprites["overlay"].opacity = 255 - i * toneDiff
|
||||
updateScene
|
||||
end
|
||||
@sprites["pokemon"].tone=Tone.new(0,0,0)
|
||||
@sprites["overlay"].opacity=0
|
||||
@sprites["pokemon"].tone = Tone.new(0, 0, 0)
|
||||
@sprites["overlay"].opacity = 0
|
||||
# Finish scene
|
||||
frames = (GameData::Species.cry_length(@pokemon) * Graphics.frame_rate).ceil
|
||||
@pokemon.play_cry
|
||||
@@ -120,30 +120,30 @@ class PokemonEggHatch_Scene
|
||||
end
|
||||
|
||||
def pbPositionHatchMask(index)
|
||||
@sprites["hatch"].src_rect.x = index*@sprites["hatch"].src_rect.width
|
||||
@sprites["hatch"].src_rect.x = index * @sprites["hatch"].src_rect.width
|
||||
end
|
||||
|
||||
def swingEgg(speed,swingTimes = 1)
|
||||
def swingEgg(speed, swingTimes = 1)
|
||||
@sprites["hatch"].visible = true
|
||||
speed = speed.to_f*20/Graphics.frame_rate
|
||||
speed = speed.to_f * 20 / Graphics.frame_rate
|
||||
amplitude = 8
|
||||
targets = []
|
||||
swingTimes.times do
|
||||
targets.push(@sprites["pokemon"].x+amplitude)
|
||||
targets.push(@sprites["pokemon"].x-amplitude)
|
||||
targets.push(@sprites["pokemon"].x + amplitude)
|
||||
targets.push(@sprites["pokemon"].x - amplitude)
|
||||
end
|
||||
targets.push(@sprites["pokemon"].x)
|
||||
targets.each_with_index do |target,i|
|
||||
targets.each_with_index do |target, i|
|
||||
loop do
|
||||
break if i%2==0 && @sprites["pokemon"].x>=target
|
||||
break if i%2==1 && @sprites["pokemon"].x<=target
|
||||
break if i % 2 == 0 && @sprites["pokemon"].x >= target
|
||||
break if i % 2 == 1 && @sprites["pokemon"].x <= target
|
||||
@sprites["pokemon"].x += speed
|
||||
@sprites["hatch"].x = @sprites["pokemon"].x
|
||||
updateScene
|
||||
end
|
||||
speed *= -1
|
||||
end
|
||||
@sprites["pokemon"].x = targets[targets.length-1]
|
||||
@sprites["pokemon"].x = targets[targets.length - 1]
|
||||
@sprites["hatch"].x = @sprites["pokemon"].x
|
||||
end
|
||||
|
||||
@@ -165,7 +165,7 @@ end
|
||||
#===============================================================================
|
||||
class PokemonEggHatchScreen
|
||||
def initialize(scene)
|
||||
@scene=scene
|
||||
@scene = scene
|
||||
end
|
||||
|
||||
def pbStartScreen(pokemon)
|
||||
@@ -181,8 +181,8 @@ end
|
||||
def pbHatchAnimation(pokemon)
|
||||
pbMessage(_INTL("Huh?\1"))
|
||||
pbFadeOutInWithMusic {
|
||||
scene=PokemonEggHatch_Scene.new
|
||||
screen=PokemonEggHatchScreen.new(scene)
|
||||
scene = PokemonEggHatch_Scene.new
|
||||
screen = PokemonEggHatchScreen.new(scene)
|
||||
screen.pbStartScreen(pokemon)
|
||||
}
|
||||
return true
|
||||
@@ -214,7 +214,7 @@ def pbHatch(pokemon)
|
||||
end
|
||||
end
|
||||
|
||||
Events.onStepTaken += proc { |_sender,_e|
|
||||
Events.onStepTaken += proc { |_sender, _e|
|
||||
for egg in $player.party
|
||||
next if egg.steps_to_hatch <= 0
|
||||
egg.steps_to_hatch -= 1
|
||||
|
||||
@@ -32,14 +32,14 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def initialize(viewport = nil)
|
||||
@metafile=[]
|
||||
@values=[
|
||||
@metafile = []
|
||||
@values = [
|
||||
viewport,
|
||||
Tone.new(0,0,0,0),Rect.new(0,0,0,0),
|
||||
Tone.new(0, 0, 0, 0), Rect.new(0, 0, 0, 0),
|
||||
true,
|
||||
0,0,0,0,0,100,100,
|
||||
0,false,0,255,0,
|
||||
Color.new(0,0,0,0),Color.new(0,0,0,0),
|
||||
0, 0, 0, 0, 0, 100, 100,
|
||||
0, false, 0, 255, 0,
|
||||
Color.new(0, 0, 0, 0), Color.new(0, 0, 0, 0),
|
||||
0
|
||||
]
|
||||
end
|
||||
@@ -50,12 +50,12 @@ class SpriteMetafile
|
||||
|
||||
def dispose; end
|
||||
|
||||
def flash(color,duration)
|
||||
if duration>0
|
||||
@values[FLASHCOLOR]=color.clone
|
||||
@values[FLASHDURATION]=duration
|
||||
@metafile.push([FLASHCOLOR,color])
|
||||
@metafile.push([FLASHDURATION,duration])
|
||||
def flash(color, duration)
|
||||
if duration > 0
|
||||
@values[FLASHCOLOR] = color.clone
|
||||
@values[FLASHDURATION] = duration
|
||||
@metafile.push([FLASHCOLOR, color])
|
||||
@metafile.push([FLASHDURATION, duration])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -64,8 +64,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def x=(value)
|
||||
@values[X]=value
|
||||
@metafile.push([X,value])
|
||||
@values[X] = value
|
||||
@metafile.push([X, value])
|
||||
end
|
||||
|
||||
def y
|
||||
@@ -73,8 +73,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def y=(value)
|
||||
@values[Y]=value
|
||||
@metafile.push([Y,value])
|
||||
@values[Y] = value
|
||||
@metafile.push([Y, value])
|
||||
end
|
||||
|
||||
def bitmap
|
||||
@@ -83,8 +83,8 @@ class SpriteMetafile
|
||||
|
||||
def bitmap=(value)
|
||||
if value && !value.disposed?
|
||||
@values[SRC_RECT].set(0,0,value.width,value.height)
|
||||
@metafile.push([SRC_RECT,@values[SRC_RECT].clone])
|
||||
@values[SRC_RECT].set(0, 0, value.width, value.height)
|
||||
@metafile.push([SRC_RECT, @values[SRC_RECT].clone])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,8 +93,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def src_rect=(value)
|
||||
@values[SRC_RECT]=value
|
||||
@metafile.push([SRC_RECT,value])
|
||||
@values[SRC_RECT] = value
|
||||
@metafile.push([SRC_RECT, value])
|
||||
end
|
||||
|
||||
def visible
|
||||
@@ -102,8 +102,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def visible=(value)
|
||||
@values[VISIBLE]=value
|
||||
@metafile.push([VISIBLE,value])
|
||||
@values[VISIBLE] = value
|
||||
@metafile.push([VISIBLE, value])
|
||||
end
|
||||
|
||||
def z
|
||||
@@ -111,8 +111,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def z=(value)
|
||||
@values[Z]=value
|
||||
@metafile.push([Z,value])
|
||||
@values[Z] = value
|
||||
@metafile.push([Z, value])
|
||||
end
|
||||
|
||||
def ox
|
||||
@@ -120,8 +120,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def ox=(value)
|
||||
@values[OX]=value
|
||||
@metafile.push([OX,value])
|
||||
@values[OX] = value
|
||||
@metafile.push([OX, value])
|
||||
end
|
||||
|
||||
def oy
|
||||
@@ -129,8 +129,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def oy=(value)
|
||||
@values[OY]=value
|
||||
@metafile.push([OY,value])
|
||||
@values[OY] = value
|
||||
@metafile.push([OY, value])
|
||||
end
|
||||
|
||||
def zoom_x
|
||||
@@ -138,8 +138,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def zoom_x=(value)
|
||||
@values[ZOOM_X]=value
|
||||
@metafile.push([ZOOM_X,value])
|
||||
@values[ZOOM_X] = value
|
||||
@metafile.push([ZOOM_X, value])
|
||||
end
|
||||
|
||||
def zoom_y
|
||||
@@ -147,15 +147,15 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def zoom_y=(value)
|
||||
@values[ZOOM_Y]=value
|
||||
@metafile.push([ZOOM_Y,value])
|
||||
@values[ZOOM_Y] = value
|
||||
@metafile.push([ZOOM_Y, value])
|
||||
end
|
||||
|
||||
def zoom=(value)
|
||||
@values[ZOOM_X]=value
|
||||
@metafile.push([ZOOM_X,value])
|
||||
@values[ZOOM_Y]=value
|
||||
@metafile.push([ZOOM_Y,value])
|
||||
@values[ZOOM_X] = value
|
||||
@metafile.push([ZOOM_X, value])
|
||||
@values[ZOOM_Y] = value
|
||||
@metafile.push([ZOOM_Y, value])
|
||||
end
|
||||
|
||||
def angle
|
||||
@@ -163,8 +163,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def angle=(value)
|
||||
@values[ANGLE]=value
|
||||
@metafile.push([ANGLE,value])
|
||||
@values[ANGLE] = value
|
||||
@metafile.push([ANGLE, value])
|
||||
end
|
||||
|
||||
def mirror
|
||||
@@ -172,8 +172,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def mirror=(value)
|
||||
@values[MIRROR]=value
|
||||
@metafile.push([MIRROR,value])
|
||||
@values[MIRROR] = value
|
||||
@metafile.push([MIRROR, value])
|
||||
end
|
||||
|
||||
def bush_depth
|
||||
@@ -181,8 +181,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def bush_depth=(value)
|
||||
@values[BUSH_DEPTH]=value
|
||||
@metafile.push([BUSH_DEPTH,value])
|
||||
@values[BUSH_DEPTH] = value
|
||||
@metafile.push([BUSH_DEPTH, value])
|
||||
end
|
||||
|
||||
def opacity
|
||||
@@ -190,8 +190,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def opacity=(value)
|
||||
@values[OPACITY]=value
|
||||
@metafile.push([OPACITY,value])
|
||||
@values[OPACITY] = value
|
||||
@metafile.push([OPACITY, value])
|
||||
end
|
||||
|
||||
def blend_type
|
||||
@@ -199,8 +199,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def blend_type=(value)
|
||||
@values[BLEND_TYPE]=value
|
||||
@metafile.push([BLEND_TYPE,value])
|
||||
@values[BLEND_TYPE] = value
|
||||
@metafile.push([BLEND_TYPE, value])
|
||||
end
|
||||
|
||||
def color
|
||||
@@ -208,8 +208,8 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def color=(value)
|
||||
@values[COLOR]=value.clone
|
||||
@metafile.push([COLOR,@values[COLOR]])
|
||||
@values[COLOR] = value.clone
|
||||
@metafile.push([COLOR, @values[COLOR]])
|
||||
end
|
||||
|
||||
def tone
|
||||
@@ -217,12 +217,12 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def tone=(value)
|
||||
@values[TONE]=value.clone
|
||||
@metafile.push([TONE,@values[TONE]])
|
||||
@values[TONE] = value.clone
|
||||
@metafile.push([TONE, @values[TONE]])
|
||||
end
|
||||
|
||||
def update
|
||||
@metafile.push([-1,nil])
|
||||
@metafile.push([-1, nil])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -230,11 +230,11 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class SpriteMetafilePlayer
|
||||
def initialize(metafile,sprite = nil)
|
||||
@metafile=metafile
|
||||
@sprites=[]
|
||||
@playing=false
|
||||
@index=0
|
||||
def initialize(metafile, sprite = nil)
|
||||
@metafile = metafile
|
||||
@sprites = []
|
||||
@playing = false
|
||||
@index = 0
|
||||
@sprites.push(sprite) if sprite
|
||||
end
|
||||
|
||||
@@ -247,17 +247,17 @@ class SpriteMetafilePlayer
|
||||
end
|
||||
|
||||
def play
|
||||
@playing=true
|
||||
@index=0
|
||||
@playing = true
|
||||
@index = 0
|
||||
end
|
||||
|
||||
def update
|
||||
if @playing
|
||||
for j in @index...@metafile.length
|
||||
@index=j+1
|
||||
break if @metafile[j][0]<0
|
||||
code=@metafile[j][0]
|
||||
value=@metafile[j][1]
|
||||
@index = j + 1
|
||||
break if @metafile[j][0] < 0
|
||||
code = @metafile[j][0]
|
||||
value = @metafile[j][1]
|
||||
for sprite in @sprites
|
||||
case code
|
||||
when SpriteMetafile::X then sprite.x = value
|
||||
@@ -279,7 +279,7 @@ class SpriteMetafilePlayer
|
||||
end
|
||||
end
|
||||
end
|
||||
@playing=false if @index==@metafile.length
|
||||
@playing = false if @index == @metafile.length
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -288,7 +288,7 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
def pbSaveSpriteState(sprite)
|
||||
state=[]
|
||||
state = []
|
||||
return state if !sprite || sprite.disposed?
|
||||
state[SpriteMetafile::BITMAP] = sprite.x
|
||||
state[SpriteMetafile::X] = sprite.x
|
||||
@@ -310,7 +310,7 @@ def pbSaveSpriteState(sprite)
|
||||
return state
|
||||
end
|
||||
|
||||
def pbRestoreSpriteState(sprite,state)
|
||||
def pbRestoreSpriteState(sprite, state)
|
||||
return if !state || !sprite || sprite.disposed?
|
||||
sprite.x = state[SpriteMetafile::X]
|
||||
sprite.y = state[SpriteMetafile::Y]
|
||||
@@ -332,15 +332,15 @@ end
|
||||
|
||||
def pbSaveSpriteStateAndBitmap(sprite)
|
||||
return [] if !sprite || sprite.disposed?
|
||||
state=pbSaveSpriteState(sprite)
|
||||
state[SpriteMetafile::BITMAP]=sprite.bitmap
|
||||
state = pbSaveSpriteState(sprite)
|
||||
state[SpriteMetafile::BITMAP] = sprite.bitmap
|
||||
return state
|
||||
end
|
||||
|
||||
def pbRestoreSpriteStateAndBitmap(sprite,state)
|
||||
def pbRestoreSpriteStateAndBitmap(sprite, state)
|
||||
return if !state || !sprite || sprite.disposed?
|
||||
sprite.bitmap=state[SpriteMetafile::BITMAP]
|
||||
pbRestoreSpriteState(sprite,state)
|
||||
sprite.bitmap = state[SpriteMetafile::BITMAP]
|
||||
pbRestoreSpriteState(sprite, state)
|
||||
return state
|
||||
end
|
||||
|
||||
@@ -350,8 +350,8 @@ end
|
||||
class PokemonEvolutionScene
|
||||
private
|
||||
|
||||
def pbGenerateMetafiles(s1x,s1y,s2x,s2y)
|
||||
sprite = SpriteMetafile.new
|
||||
def pbGenerateMetafiles(s1x, s1y, s2x, s2y)
|
||||
sprite = SpriteMetafile.new
|
||||
sprite.ox = s1x
|
||||
sprite.oy = s1y
|
||||
sprite.opacity = 255
|
||||
@@ -361,7 +361,7 @@ class PokemonEvolutionScene
|
||||
sprite2.zoom = 0.0
|
||||
sprite2.opacity = 255
|
||||
alpha = 0
|
||||
alphaDiff = 10*20/Graphics.frame_rate
|
||||
alphaDiff = 10 * 20 / Graphics.frame_rate
|
||||
loop do
|
||||
sprite.color.red = 255
|
||||
sprite.color.green = 255
|
||||
@@ -372,15 +372,15 @@ class PokemonEvolutionScene
|
||||
sprite2.color.alpha = 255
|
||||
sprite.update
|
||||
sprite2.update
|
||||
break if alpha>=255
|
||||
break if alpha >= 255
|
||||
alpha += alphaDiff
|
||||
end
|
||||
totaltempo = 0
|
||||
currenttempo = 25
|
||||
maxtempo = 7*Graphics.frame_rate
|
||||
while totaltempo<maxtempo
|
||||
maxtempo = 7 * Graphics.frame_rate
|
||||
while totaltempo < maxtempo
|
||||
for j in 0...currenttempo
|
||||
if alpha<255
|
||||
if alpha < 255
|
||||
sprite.color.red = 255
|
||||
sprite.color.green = 255
|
||||
sprite.color.blue = 255
|
||||
@@ -388,22 +388,22 @@ class PokemonEvolutionScene
|
||||
sprite.color = sprite.color
|
||||
alpha += 10
|
||||
end
|
||||
sprite.zoom = [1.1*(currenttempo-j-1)/currenttempo,1.0].min
|
||||
sprite2.zoom = [1.1*(j+1)/currenttempo,1.0].min
|
||||
sprite.zoom = [1.1 * (currenttempo - j - 1) / currenttempo, 1.0].min
|
||||
sprite2.zoom = [1.1 * (j + 1) / currenttempo, 1.0].min
|
||||
sprite.update
|
||||
sprite2.update
|
||||
end
|
||||
totaltempo += currenttempo
|
||||
if totaltempo+currenttempo<maxtempo
|
||||
if totaltempo + currenttempo < maxtempo
|
||||
for j in 0...currenttempo
|
||||
sprite.zoom = [1.1*(j+1)/currenttempo,1.0].min
|
||||
sprite2.zoom = [1.1*(currenttempo-j-1)/currenttempo,1.0].min
|
||||
sprite.zoom = [1.1 * (j + 1) / currenttempo, 1.0].min
|
||||
sprite2.zoom = [1.1 * (currenttempo - j - 1) / currenttempo, 1.0].min
|
||||
sprite.update
|
||||
sprite2.update
|
||||
end
|
||||
end
|
||||
totaltempo += currenttempo
|
||||
currenttempo = [(currenttempo/1.5).floor,5].max
|
||||
currenttempo = [(currenttempo / 1.5).floor, 5].max
|
||||
end
|
||||
@metafile1 = sprite
|
||||
@metafile2 = sprite2
|
||||
@@ -420,10 +420,10 @@ class PokemonEvolutionScene
|
||||
end
|
||||
|
||||
def pbUpdateNarrowScreen
|
||||
halfResizeDiff = 8*20/Graphics.frame_rate
|
||||
if @bgviewport.rect.y<80
|
||||
@bgviewport.rect.height -= halfResizeDiff*2
|
||||
if @bgviewport.rect.height<Graphics.height-64
|
||||
halfResizeDiff = 8 * 20 / Graphics.frame_rate
|
||||
if @bgviewport.rect.y < 80
|
||||
@bgviewport.rect.height -= halfResizeDiff * 2
|
||||
if @bgviewport.rect.height < Graphics.height - 64
|
||||
@bgviewport.rect.y += halfResizeDiff
|
||||
@sprites["background"].oy = @bgviewport.rect.y
|
||||
end
|
||||
@@ -431,33 +431,33 @@ class PokemonEvolutionScene
|
||||
end
|
||||
|
||||
def pbUpdateExpandScreen
|
||||
halfResizeDiff = 8*20/Graphics.frame_rate
|
||||
if @bgviewport.rect.y>0
|
||||
halfResizeDiff = 8 * 20 / Graphics.frame_rate
|
||||
if @bgviewport.rect.y > 0
|
||||
@bgviewport.rect.y -= halfResizeDiff
|
||||
@sprites["background"].oy = @bgviewport.rect.y
|
||||
end
|
||||
if @bgviewport.rect.height<Graphics.height
|
||||
@bgviewport.rect.height += halfResizeDiff*2
|
||||
if @bgviewport.rect.height < Graphics.height
|
||||
@bgviewport.rect.height += halfResizeDiff * 2
|
||||
end
|
||||
end
|
||||
|
||||
def pbFlashInOut(canceled,oldstate,oldstate2)
|
||||
def pbFlashInOut(canceled, oldstate, oldstate2)
|
||||
tone = 0
|
||||
toneDiff = 20*20/Graphics.frame_rate
|
||||
toneDiff = 20 * 20 / Graphics.frame_rate
|
||||
loop do
|
||||
Graphics.update
|
||||
pbUpdate(true)
|
||||
pbUpdateExpandScreen
|
||||
tone += toneDiff
|
||||
@viewport.tone.set(tone,tone,tone,0)
|
||||
break if tone>=255
|
||||
@viewport.tone.set(tone, tone, tone, 0)
|
||||
break if tone >= 255
|
||||
end
|
||||
@bgviewport.rect.y = 0
|
||||
@bgviewport.rect.height = Graphics.height
|
||||
@sprites["background"].oy = 0
|
||||
if canceled
|
||||
pbRestoreSpriteState(@sprites["rsprite1"],oldstate)
|
||||
pbRestoreSpriteState(@sprites["rsprite2"],oldstate2)
|
||||
pbRestoreSpriteState(@sprites["rsprite1"], oldstate)
|
||||
pbRestoreSpriteState(@sprites["rsprite2"], oldstate2)
|
||||
@sprites["rsprite1"].zoom_x = 1.0
|
||||
@sprites["rsprite1"].zoom_y = 1.0
|
||||
@sprites["rsprite1"].color.alpha = 0
|
||||
@@ -470,47 +470,47 @@ class PokemonEvolutionScene
|
||||
@sprites["rsprite2"].zoom_y = 1.0
|
||||
@sprites["rsprite2"].color.alpha = 0
|
||||
end
|
||||
(Graphics.frame_rate/4).times do
|
||||
(Graphics.frame_rate / 4).times do
|
||||
Graphics.update
|
||||
pbUpdate(true)
|
||||
end
|
||||
tone = 255
|
||||
toneDiff = 40*20/Graphics.frame_rate
|
||||
toneDiff = 40 * 20 / Graphics.frame_rate
|
||||
loop do
|
||||
Graphics.update
|
||||
pbUpdate
|
||||
tone -= toneDiff
|
||||
@viewport.tone.set(tone,tone,tone,0)
|
||||
break if tone<=0
|
||||
@viewport.tone.set(tone, tone, tone, 0)
|
||||
break if tone <= 0
|
||||
end
|
||||
end
|
||||
|
||||
def pbStartScreen(pokemon,newspecies)
|
||||
def pbStartScreen(pokemon, newspecies)
|
||||
@pokemon = pokemon
|
||||
@newspecies = newspecies
|
||||
@sprites = {}
|
||||
@bgviewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@bgviewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@bgviewport.z = 99999
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@msgviewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@msgviewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@msgviewport.z = 99999
|
||||
addBackgroundOrColoredPlane(@sprites,"background","evolutionbg",
|
||||
Color.new(248,248,248),@bgviewport)
|
||||
addBackgroundOrColoredPlane(@sprites, "background", "evolutionbg",
|
||||
Color.new(248, 248, 248), @bgviewport)
|
||||
rsprite1 = PokemonSprite.new(@viewport)
|
||||
rsprite1.setOffset(PictureOrigin::Center)
|
||||
rsprite1.setPokemonBitmap(@pokemon,false)
|
||||
rsprite1.x = Graphics.width/2
|
||||
rsprite1.y = (Graphics.height-64)/2
|
||||
rsprite1.setPokemonBitmap(@pokemon, false)
|
||||
rsprite1.x = Graphics.width / 2
|
||||
rsprite1.y = (Graphics.height - 64) / 2
|
||||
rsprite2 = PokemonSprite.new(@viewport)
|
||||
rsprite2.setOffset(PictureOrigin::Center)
|
||||
rsprite2.setPokemonBitmapSpecies(@pokemon,@newspecies,false)
|
||||
rsprite2.setPokemonBitmapSpecies(@pokemon, @newspecies, false)
|
||||
rsprite2.x = rsprite1.x
|
||||
rsprite2.y = rsprite1.y
|
||||
rsprite2.opacity = 0
|
||||
@sprites["rsprite1"] = rsprite1
|
||||
@sprites["rsprite2"] = rsprite2
|
||||
pbGenerateMetafiles(rsprite1.ox,rsprite1.oy,rsprite2.ox,rsprite2.oy)
|
||||
pbGenerateMetafiles(rsprite1.ox, rsprite1.oy, rsprite2.ox, rsprite2.oy)
|
||||
@sprites["msgwindow"] = pbCreateMessageWindow(@msgviewport)
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
@@ -527,15 +527,15 @@ class PokemonEvolutionScene
|
||||
|
||||
# Opens the evolution screen
|
||||
def pbEvolution(cancancel = true)
|
||||
metaplayer1 = SpriteMetafilePlayer.new(@metafile1,@sprites["rsprite1"])
|
||||
metaplayer2 = SpriteMetafilePlayer.new(@metafile2,@sprites["rsprite2"])
|
||||
metaplayer1 = SpriteMetafilePlayer.new(@metafile1, @sprites["rsprite1"])
|
||||
metaplayer2 = SpriteMetafilePlayer.new(@metafile2, @sprites["rsprite2"])
|
||||
metaplayer1.play
|
||||
metaplayer2.play
|
||||
pbBGMStop
|
||||
@pokemon.play_cry
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("\\se[]What? {1} is evolving!\\^",@pokemon.name)) { pbUpdate }
|
||||
pbMessageWaitForInput(@sprites["msgwindow"],50,true) { pbUpdate }
|
||||
_INTL("\\se[]What? {1} is evolving!\\^", @pokemon.name)) { pbUpdate }
|
||||
pbMessageWaitForInput(@sprites["msgwindow"], 50, true) { pbUpdate }
|
||||
pbPlayDecisionSE
|
||||
oldstate = pbSaveSpriteState(@sprites["rsprite1"])
|
||||
oldstate2 = pbSaveSpriteState(@sprites["rsprite2"])
|
||||
@@ -556,11 +556,11 @@ class PokemonEvolutionScene
|
||||
break
|
||||
end
|
||||
end while metaplayer1.playing? && metaplayer2.playing?
|
||||
pbFlashInOut(canceled,oldstate,oldstate2)
|
||||
pbFlashInOut(canceled, oldstate, oldstate2)
|
||||
if canceled
|
||||
$stats.evolutions_cancelled += 1
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("Huh? {1} stopped evolving!",@pokemon.name)) { pbUpdate }
|
||||
_INTL("Huh? {1} stopped evolving!", @pokemon.name)) { pbUpdate }
|
||||
else
|
||||
pbEvolutionSuccess
|
||||
end
|
||||
@@ -581,7 +581,7 @@ class PokemonEvolutionScene
|
||||
newspeciesname = GameData::Species.get(@newspecies).name
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("\\se[]Congratulations! Your {1} evolved into {2}!\\wt[80]",
|
||||
@pokemon.name,newspeciesname)) { pbUpdate }
|
||||
@pokemon.name, newspeciesname)) { pbUpdate }
|
||||
@sprites["msgwindow"].text = ""
|
||||
# Check for consumed item and check if Pokémon should be duplicated
|
||||
pbEvolutionMethodAfterEvolution
|
||||
@@ -596,8 +596,8 @@ class PokemonEvolutionScene
|
||||
# Learn moves upon evolution for evolved species
|
||||
movelist = @pokemon.getMoveList
|
||||
for i in movelist
|
||||
next if i[0]!=0 && i[0]!=@pokemon.level # 0 is "learn upon evolution"
|
||||
pbLearnMove(@pokemon,i[1],true) { pbUpdate }
|
||||
next if i[0] != 0 && i[0] != @pokemon.level # 0 is "learn upon evolution"
|
||||
pbLearnMove(@pokemon, i[1], true) { pbUpdate }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6,16 +6,16 @@ class PokemonTrade_Scene
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
|
||||
def pbRunPictures(pictures,sprites)
|
||||
def pbRunPictures(pictures, sprites)
|
||||
loop do
|
||||
for i in 0...pictures.length
|
||||
pictures[i].update
|
||||
end
|
||||
for i in 0...sprites.length
|
||||
if sprites[i].is_a?(IconSprite)
|
||||
setPictureIconSprite(sprites[i],pictures[i])
|
||||
setPictureIconSprite(sprites[i], pictures[i])
|
||||
else
|
||||
setPictureSprite(sprites[i],pictures[i])
|
||||
setPictureSprite(sprites[i], pictures[i])
|
||||
end
|
||||
end
|
||||
Graphics.update
|
||||
@@ -28,27 +28,27 @@ class PokemonTrade_Scene
|
||||
end
|
||||
end
|
||||
|
||||
def pbStartScreen(pokemon,pokemon2,trader1,trader2)
|
||||
def pbStartScreen(pokemon, pokemon2, trader1, trader2)
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@pokemon = pokemon
|
||||
@pokemon2 = pokemon2
|
||||
@trader1 = trader1
|
||||
@trader2 = trader2
|
||||
addBackgroundOrColoredPlane(@sprites,"background","tradebg",
|
||||
Color.new(248,248,248),@viewport)
|
||||
addBackgroundOrColoredPlane(@sprites, "background", "tradebg",
|
||||
Color.new(248, 248, 248), @viewport)
|
||||
@sprites["rsprite1"] = PokemonSprite.new(@viewport)
|
||||
@sprites["rsprite1"].setPokemonBitmap(@pokemon,false)
|
||||
@sprites["rsprite1"].setPokemonBitmap(@pokemon, false)
|
||||
@sprites["rsprite1"].setOffset(PictureOrigin::Bottom)
|
||||
@sprites["rsprite1"].x = Graphics.width/2
|
||||
@sprites["rsprite1"].x = Graphics.width / 2
|
||||
@sprites["rsprite1"].y = 264
|
||||
@sprites["rsprite1"].z = 10
|
||||
@pokemon.species_data.apply_metrics_to_sprite(@sprites["rsprite1"], 1)
|
||||
@sprites["rsprite2"] = PokemonSprite.new(@viewport)
|
||||
@sprites["rsprite2"].setPokemonBitmap(@pokemon2,false)
|
||||
@sprites["rsprite2"].setPokemonBitmap(@pokemon2, false)
|
||||
@sprites["rsprite2"].setOffset(PictureOrigin::Bottom)
|
||||
@sprites["rsprite2"].x = Graphics.width/2
|
||||
@sprites["rsprite2"].x = Graphics.width / 2
|
||||
@sprites["rsprite2"].y = 264
|
||||
@sprites["rsprite2"].z = 10
|
||||
@pokemon2.species_data.apply_metrics_to_sprite(@sprites["rsprite2"], 1)
|
||||
@@ -58,100 +58,100 @@ class PokemonTrade_Scene
|
||||
end
|
||||
|
||||
def pbScene1
|
||||
spriteBall = IconSprite.new(0,0,@viewport)
|
||||
spriteBall = IconSprite.new(0, 0, @viewport)
|
||||
pictureBall = PictureEx.new(0)
|
||||
picturePoke = PictureEx.new(0)
|
||||
ballimage = sprintf("Graphics/Battle animations/ball_%s", @pokemon.poke_ball)
|
||||
ballopenimage = sprintf("Graphics/Battle animations/ball_%s_open", @pokemon.poke_ball)
|
||||
# Starting position of ball
|
||||
pictureBall.setXY(0,Graphics.width/2,48)
|
||||
pictureBall.setName(0,ballimage)
|
||||
pictureBall.setSrcSize(0,32,64)
|
||||
pictureBall.setOrigin(0,PictureOrigin::Center)
|
||||
pictureBall.setVisible(0,true)
|
||||
pictureBall.setXY(0, Graphics.width / 2, 48)
|
||||
pictureBall.setName(0, ballimage)
|
||||
pictureBall.setSrcSize(0, 32, 64)
|
||||
pictureBall.setOrigin(0, PictureOrigin::Center)
|
||||
pictureBall.setVisible(0, true)
|
||||
# Starting position of sprite
|
||||
picturePoke.setXY(0,@sprites["rsprite1"].x,@sprites["rsprite1"].y)
|
||||
picturePoke.setOrigin(0,PictureOrigin::Bottom)
|
||||
picturePoke.setVisible(0,true)
|
||||
picturePoke.setXY(0, @sprites["rsprite1"].x, @sprites["rsprite1"].y)
|
||||
picturePoke.setOrigin(0, PictureOrigin::Bottom)
|
||||
picturePoke.setVisible(0, true)
|
||||
# Change Pokémon color
|
||||
picturePoke.moveColor(2,5,Color.new(31*8,22*8,30*8,255))
|
||||
picturePoke.moveColor(2, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 255))
|
||||
# Recall
|
||||
delay = picturePoke.totalDuration
|
||||
picturePoke.setSE(delay,"Battle recall")
|
||||
pictureBall.setName(delay,ballopenimage)
|
||||
pictureBall.setSrcSize(delay,32,64)
|
||||
picturePoke.setSE(delay, "Battle recall")
|
||||
pictureBall.setName(delay, ballopenimage)
|
||||
pictureBall.setSrcSize(delay, 32, 64)
|
||||
# Move sprite to ball
|
||||
picturePoke.moveZoom(delay,8,0)
|
||||
picturePoke.moveXY(delay,8,Graphics.width/2,48)
|
||||
picturePoke.setSE(delay+5,"Battle jump to ball")
|
||||
picturePoke.setVisible(delay+8,false)
|
||||
delay = picturePoke.totalDuration+1
|
||||
pictureBall.setName(delay,ballimage)
|
||||
pictureBall.setSrcSize(delay,32,64)
|
||||
picturePoke.moveZoom(delay, 8, 0)
|
||||
picturePoke.moveXY(delay, 8, Graphics.width / 2, 48)
|
||||
picturePoke.setSE(delay + 5, "Battle jump to ball")
|
||||
picturePoke.setVisible(delay + 8, false)
|
||||
delay = picturePoke.totalDuration + 1
|
||||
pictureBall.setName(delay, ballimage)
|
||||
pictureBall.setSrcSize(delay, 32, 64)
|
||||
# Make Poké Ball go off the top of the screen
|
||||
delay = picturePoke.totalDuration+10
|
||||
pictureBall.moveXY(delay,6,Graphics.width/2,-32)
|
||||
delay = picturePoke.totalDuration + 10
|
||||
pictureBall.moveXY(delay, 6, Graphics.width / 2, -32)
|
||||
# Play animation
|
||||
pbRunPictures(
|
||||
[picturePoke,pictureBall],
|
||||
[@sprites["rsprite1"],spriteBall]
|
||||
[picturePoke, pictureBall],
|
||||
[@sprites["rsprite1"], spriteBall]
|
||||
)
|
||||
spriteBall.dispose
|
||||
end
|
||||
|
||||
def pbScene2
|
||||
spriteBall = IconSprite.new(0,0,@viewport)
|
||||
spriteBall = IconSprite.new(0, 0, @viewport)
|
||||
pictureBall = PictureEx.new(0)
|
||||
picturePoke = PictureEx.new(0)
|
||||
ballimage = sprintf("Graphics/Battle animations/ball_%s", @pokemon2.poke_ball)
|
||||
ballopenimage = sprintf("Graphics/Battle animations/ball_%s_open", @pokemon2.poke_ball)
|
||||
# Starting position of ball
|
||||
pictureBall.setXY(0,Graphics.width/2,-32)
|
||||
pictureBall.setName(0,ballimage)
|
||||
pictureBall.setSrcSize(0,32,64)
|
||||
pictureBall.setOrigin(0,PictureOrigin::Center)
|
||||
pictureBall.setVisible(0,true)
|
||||
pictureBall.setXY(0, Graphics.width / 2, -32)
|
||||
pictureBall.setName(0, ballimage)
|
||||
pictureBall.setSrcSize(0, 32, 64)
|
||||
pictureBall.setOrigin(0, PictureOrigin::Center)
|
||||
pictureBall.setVisible(0, true)
|
||||
# Starting position of sprite
|
||||
picturePoke.setOrigin(0,PictureOrigin::Bottom)
|
||||
picturePoke.setZoom(0,0)
|
||||
picturePoke.setColor(0,Color.new(31*8,22*8,30*8,255))
|
||||
picturePoke.setVisible(0,false)
|
||||
picturePoke.setOrigin(0, PictureOrigin::Bottom)
|
||||
picturePoke.setZoom(0, 0)
|
||||
picturePoke.setColor(0, Color.new(31 * 8, 22 * 8, 30 * 8, 255))
|
||||
picturePoke.setVisible(0, false)
|
||||
# Dropping ball
|
||||
y = Graphics.height-96-16-16 # end point of Poké Ball
|
||||
delay = picturePoke.totalDuration+2
|
||||
y = Graphics.height - 96 - 16 - 16 # end point of Poké Ball
|
||||
delay = picturePoke.totalDuration + 2
|
||||
for i in 0...4
|
||||
t = [4,4,3,2][i] # Time taken to rise or fall for each bounce
|
||||
d = [1,2,4,8][i] # Fraction of the starting height each bounce rises to
|
||||
delay -= t if i==0
|
||||
if i>0
|
||||
pictureBall.setZoomXY(delay,100+5*(5-i),100-5*(5-i)) # Squish
|
||||
pictureBall.moveZoom(delay,2,100) # Unsquish
|
||||
pictureBall.moveXY(delay,t,Graphics.width/2,y-100/d)
|
||||
t = [4, 4, 3, 2][i] # Time taken to rise or fall for each bounce
|
||||
d = [1, 2, 4, 8][i] # Fraction of the starting height each bounce rises to
|
||||
delay -= t if i == 0
|
||||
if i > 0
|
||||
pictureBall.setZoomXY(delay, 100 + 5 * (5 - i), 100 - 5 * (5 - i)) # Squish
|
||||
pictureBall.moveZoom(delay, 2, 100) # Unsquish
|
||||
pictureBall.moveXY(delay, t, Graphics.width / 2, y - 100 / d)
|
||||
end
|
||||
pictureBall.moveXY(delay+t,t,Graphics.width/2,y)
|
||||
pictureBall.setSE(delay+2*t,"Battle ball drop")
|
||||
pictureBall.moveXY(delay + t, t, Graphics.width / 2, y)
|
||||
pictureBall.setSE(delay + 2 * t, "Battle ball drop")
|
||||
delay = pictureBall.totalDuration
|
||||
end
|
||||
picturePoke.setXY(delay,Graphics.width/2,y)
|
||||
picturePoke.setXY(delay, Graphics.width / 2, y)
|
||||
# Open Poké Ball
|
||||
delay = pictureBall.totalDuration+15
|
||||
pictureBall.setSE(delay,"Battle recall")
|
||||
pictureBall.setName(delay,ballopenimage)
|
||||
pictureBall.setSrcSize(delay,32,64)
|
||||
pictureBall.setVisible(delay+5,false)
|
||||
delay = pictureBall.totalDuration + 15
|
||||
pictureBall.setSE(delay, "Battle recall")
|
||||
pictureBall.setName(delay, ballopenimage)
|
||||
pictureBall.setSrcSize(delay, 32, 64)
|
||||
pictureBall.setVisible(delay + 5, false)
|
||||
# Pokémon appears and enlarges
|
||||
picturePoke.setVisible(delay,true)
|
||||
picturePoke.moveZoom(delay,8,100)
|
||||
picturePoke.moveXY(delay,8,Graphics.width/2,@sprites["rsprite2"].y)
|
||||
picturePoke.setVisible(delay, true)
|
||||
picturePoke.moveZoom(delay, 8, 100)
|
||||
picturePoke.moveXY(delay, 8, Graphics.width / 2, @sprites["rsprite2"].y)
|
||||
# Return Pokémon's color to normal and play cry
|
||||
delay = picturePoke.totalDuration
|
||||
picturePoke.moveColor(delay,5,Color.new(31*8,22*8,30*8,0))
|
||||
picturePoke.moveColor(delay, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 0))
|
||||
cry = GameData::Species.cry_filename_from_pokemon(@pokemon2)
|
||||
picturePoke.setSE(delay,cry) if cry
|
||||
picturePoke.setSE(delay, cry) if cry
|
||||
# Play animation
|
||||
pbRunPictures(
|
||||
[picturePoke,pictureBall],
|
||||
[@sprites["rsprite2"],spriteBall]
|
||||
[picturePoke, pictureBall],
|
||||
[@sprites["rsprite2"], spriteBall]
|
||||
)
|
||||
spriteBall.dispose
|
||||
end
|
||||
@@ -164,7 +164,7 @@ class PokemonTrade_Scene
|
||||
newspecies = @pokemon2.check_evolution_on_trade(@pokemon)
|
||||
if newspecies
|
||||
evo = PokemonEvolutionScene.new
|
||||
evo.pbStartScreen(@pokemon2,newspecies)
|
||||
evo.pbStartScreen(@pokemon2, newspecies)
|
||||
evo.pbEvolution(false)
|
||||
evo.pbEndScreen
|
||||
end
|
||||
@@ -173,31 +173,31 @@ class PokemonTrade_Scene
|
||||
def pbTrade
|
||||
pbBGMStop
|
||||
@pokemon.play_cry
|
||||
speciesname1=GameData::Species.get(@pokemon.species).name
|
||||
speciesname2=GameData::Species.get(@pokemon2.species).name
|
||||
speciesname1 = GameData::Species.get(@pokemon.species).name
|
||||
speciesname2 = GameData::Species.get(@pokemon2.species).name
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_ISPRINTF("{1:s}\r\nID: {2:05d} OT: {3:s}\\wtnp[0]",
|
||||
@pokemon.name,@pokemon.owner.public_id,@pokemon.owner.name)) { pbUpdate }
|
||||
pbMessageWaitForInput(@sprites["msgwindow"],50,true) { pbUpdate }
|
||||
@pokemon.name, @pokemon.owner.public_id, @pokemon.owner.name)) { pbUpdate }
|
||||
pbMessageWaitForInput(@sprites["msgwindow"], 50, true) { pbUpdate }
|
||||
pbPlayDecisionSE
|
||||
pbScene1
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("For {1}'s {2},\r\n{3} sends {4}.\1",@trader1,speciesname1,@trader2,speciesname2)) { pbUpdate }
|
||||
_INTL("For {1}'s {2},\r\n{3} sends {4}.\1", @trader1, speciesname1, @trader2, speciesname2)) { pbUpdate }
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("{1} bids farewell to {2}.",@trader2,speciesname2)) { pbUpdate }
|
||||
_INTL("{1} bids farewell to {2}.", @trader2, speciesname2)) { pbUpdate }
|
||||
pbScene2
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_ISPRINTF("{1:s}\r\nID: {2:05d} OT: {3:s}\1",
|
||||
@pokemon2.name,@pokemon2.owner.public_id,@pokemon2.owner.name)) { pbUpdate }
|
||||
@pokemon2.name, @pokemon2.owner.public_id, @pokemon2.owner.name)) { pbUpdate }
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("Take good care of {1}.",speciesname2)) { pbUpdate }
|
||||
_INTL("Take good care of {1}.", speciesname2)) { pbUpdate }
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender = 0)
|
||||
def pbStartTrade(pokemonIndex, newpoke, nickname, trainerName, trainerGender = 0)
|
||||
$stats.trade_count += 1
|
||||
myPokemon = $player.party[pokemonIndex]
|
||||
yourPokemon = nil
|
||||
|
||||
@@ -39,44 +39,44 @@ class HallOfFame_Scene
|
||||
FINALFADESPEED = 16
|
||||
# Sprites opacity value when them aren't selected
|
||||
OPACITY = 64
|
||||
BASECOLOR = Color.new(248,248,248)
|
||||
SHADOWCOLOR = Color.new(0,0,0)
|
||||
BASECOLOR = Color.new(248, 248, 248)
|
||||
SHADOWCOLOR = Color.new(0, 0, 0)
|
||||
|
||||
# Placement for pokemon icons
|
||||
def pbStartScene
|
||||
@sprites={}
|
||||
@viewport=Viewport.new(0,0,Graphics.width, Graphics.height)
|
||||
@viewport.z=99999
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
# Comment the below line to doesn't use a background
|
||||
addBackgroundPlane(@sprites,"bg","hallfamebg",@viewport)
|
||||
@sprites["hallbars"]=IconSprite.new(@viewport)
|
||||
addBackgroundPlane(@sprites, "bg", "hallfamebg", @viewport)
|
||||
@sprites["hallbars"] = IconSprite.new(@viewport)
|
||||
@sprites["hallbars"].setBitmap("Graphics/Pictures/hallfamebars")
|
||||
@sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
@sprites["overlay"].z=10
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@sprites["overlay"].z = 10
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
@alreadyFadedInEnd=false
|
||||
@useMusic=false
|
||||
@battlerIndex=0
|
||||
@hallEntry=[]
|
||||
@alreadyFadedInEnd = false
|
||||
@useMusic = false
|
||||
@battlerIndex = 0
|
||||
@hallEntry = []
|
||||
@nationalDexList = [:NONE]
|
||||
GameData::Species.each_species { |s| @nationalDexList.push(s.species) }
|
||||
end
|
||||
|
||||
def pbStartSceneEntry
|
||||
pbStartScene
|
||||
@useMusic=(ENTRYMUSIC && ENTRYMUSIC!="")
|
||||
@useMusic = (ENTRYMUSIC && ENTRYMUSIC != "")
|
||||
pbBGMPlay(ENTRYMUSIC) if @useMusic
|
||||
saveHallEntry
|
||||
@xmovement=[]
|
||||
@ymovement=[]
|
||||
@xmovement = []
|
||||
@ymovement = []
|
||||
createBattlers
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbStartScenePC
|
||||
pbStartScene
|
||||
@hallIndex=$PokemonGlobal.hallOfFame.size-1
|
||||
@hallEntry=$PokemonGlobal.hallOfFame[-1]
|
||||
@hallIndex = $PokemonGlobal.hallOfFame.size - 1
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[-1]
|
||||
createBattlers(false)
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
pbUpdatePC
|
||||
@@ -90,35 +90,35 @@ class HallOfFame_Scene
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def slowFadeOut(sprites,exponent) # 2 exponent
|
||||
def slowFadeOut(sprites, exponent) # 2 exponent
|
||||
# To handle values above 8
|
||||
extraWaitExponent=exponent-9
|
||||
exponent=8 if exponent > 8
|
||||
max=2**exponent
|
||||
speed=(2**8)/max
|
||||
extraWaitExponent = exponent - 9
|
||||
exponent = 8 if exponent > 8
|
||||
max = 2**exponent
|
||||
speed = (2**8) / max
|
||||
for j in 0..max
|
||||
if extraWaitExponent>-1
|
||||
if extraWaitExponent > -1
|
||||
(2**extraWaitExponent).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
end
|
||||
pbSetSpritesToColor(sprites,Color.new(0,0,0,j*speed))
|
||||
pbSetSpritesToColor(sprites, Color.new(0, 0, 0, j * speed))
|
||||
block_given? ? yield : pbUpdateSpriteHash(sprites)
|
||||
end
|
||||
end
|
||||
|
||||
# Dispose the sprite if the sprite exists and make it null
|
||||
def restartSpritePosition(sprites,spritename)
|
||||
def restartSpritePosition(sprites, spritename)
|
||||
sprites[spritename].dispose if sprites.include?(spritename) && sprites[spritename]
|
||||
sprites[spritename]=nil
|
||||
sprites[spritename] = nil
|
||||
end
|
||||
|
||||
# Change the pokémon sprites opacity except the index one
|
||||
def setPokemonSpritesOpacity(index,opacity = 255)
|
||||
def setPokemonSpritesOpacity(index, opacity = 255)
|
||||
for n in 0...@hallEntry.size
|
||||
@sprites["pokemon#{n}"].opacity=(n==index) ? 255 : opacity if @sprites["pokemon#{n}"]
|
||||
@sprites["pokemon#{n}"].opacity = (n == index) ? 255 : opacity if @sprites["pokemon#{n}"]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -129,73 +129,73 @@ class HallOfFame_Scene
|
||||
end
|
||||
# Update the global variables
|
||||
$PokemonGlobal.hallOfFame.push(@hallEntry)
|
||||
$PokemonGlobal.hallOfFameLastNumber+=1
|
||||
$PokemonGlobal.hallOfFame.delete_at(0) if HALLLIMIT>-1 &&
|
||||
$PokemonGlobal.hallOfFame.size>HALLLIMIT
|
||||
$PokemonGlobal.hallOfFameLastNumber += 1
|
||||
$PokemonGlobal.hallOfFame.delete_at(0) if HALLLIMIT > -1 &&
|
||||
$PokemonGlobal.hallOfFame.size > HALLLIMIT
|
||||
end
|
||||
|
||||
# Return the x/y point position in screen for battler index number
|
||||
# Don't use odd numbers!
|
||||
def xpointformula(battlernumber)
|
||||
ret=0
|
||||
ret = 0
|
||||
if !SINGLEROW
|
||||
ret=32+160*xpositionformula(battlernumber)
|
||||
ret = 32 + 160 * xpositionformula(battlernumber)
|
||||
else
|
||||
ret=(60*(battlernumber/2)+48)*(xpositionformula(battlernumber)-1)
|
||||
ret+=Graphics.width/2-56
|
||||
ret = (60 * (battlernumber / 2) + 48) * (xpositionformula(battlernumber) - 1)
|
||||
ret += Graphics.width / 2 - 56
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def ypointformula(battlernumber)
|
||||
ret=0
|
||||
ret = 0
|
||||
if !SINGLEROW
|
||||
ret=32+128*ypositionformula(battlernumber)/2
|
||||
ret = 32 + 128 * ypositionformula(battlernumber) / 2
|
||||
else
|
||||
ret=96-8*(battlernumber/2)
|
||||
ret = 96 - 8 * (battlernumber / 2)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
# Returns 0, 1 or 2 as the x/y column value
|
||||
def xpositionformula(battlernumber)
|
||||
ret=0
|
||||
ret = 0
|
||||
if !SINGLEROW
|
||||
ret=(battlernumber/3%2==0) ? (19-battlernumber)%3 : (19+battlernumber)%3
|
||||
ret = (battlernumber / 3 % 2 == 0) ? (19 - battlernumber) % 3 : (19 + battlernumber) % 3
|
||||
else
|
||||
ret=battlernumber%2*2
|
||||
ret = battlernumber % 2 * 2
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def ypositionformula(battlernumber)
|
||||
ret=0
|
||||
ret = 0
|
||||
if !SINGLEROW
|
||||
ret=(battlernumber/3)%2*2
|
||||
ret = (battlernumber / 3) % 2 * 2
|
||||
else
|
||||
ret=1
|
||||
ret = 1
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def moveSprite(i)
|
||||
spritename=(i>-1) ? "pokemon#{i}" : "trainer"
|
||||
speed = (i>-1) ? ANIMATIONSPEED : 2
|
||||
spritename = (i > -1) ? "pokemon#{i}" : "trainer"
|
||||
speed = (i > -1) ? ANIMATIONSPEED : 2
|
||||
if !ANIMATION # Skips animation
|
||||
@sprites[spritename].x-=speed*@xmovement[i]
|
||||
@xmovement[i]=0
|
||||
@sprites[spritename].y-=speed*@ymovement[i]
|
||||
@ymovement[i]=0
|
||||
@sprites[spritename].x -= speed * @xmovement[i]
|
||||
@xmovement[i] = 0
|
||||
@sprites[spritename].y -= speed * @ymovement[i]
|
||||
@ymovement[i] = 0
|
||||
end
|
||||
if @xmovement[i] != 0
|
||||
direction = (@xmovement[i]>0) ? -1 : 1
|
||||
@sprites[spritename].x+=speed*direction
|
||||
@xmovement[i]+=direction
|
||||
direction = (@xmovement[i] > 0) ? -1 : 1
|
||||
@sprites[spritename].x += speed * direction
|
||||
@xmovement[i] += direction
|
||||
end
|
||||
if @ymovement[i] != 0
|
||||
direction = (@ymovement[i]>0) ? -1 : 1
|
||||
@sprites[spritename].y+=speed*direction
|
||||
@ymovement[i]+=direction
|
||||
direction = (@ymovement[i] > 0) ? -1 : 1
|
||||
@sprites[spritename].y += speed * direction
|
||||
@ymovement[i] += direction
|
||||
end
|
||||
end
|
||||
|
||||
@@ -204,67 +204,67 @@ class HallOfFame_Scene
|
||||
for i in 0...6
|
||||
# Clear all 6 pokémon sprites and dispose the ones that exists every time
|
||||
# that this method is call
|
||||
restartSpritePosition(@sprites,"pokemon#{i}")
|
||||
next if i>=@hallEntry.size
|
||||
xpoint=xpointformula(i)
|
||||
ypoint=ypointformula(i)
|
||||
pok=@hallEntry[i]
|
||||
@sprites["pokemon#{i}"]=PokemonSprite.new(@viewport)
|
||||
restartSpritePosition(@sprites, "pokemon#{i}")
|
||||
next if i >= @hallEntry.size
|
||||
xpoint = xpointformula(i)
|
||||
ypoint = ypointformula(i)
|
||||
pok = @hallEntry[i]
|
||||
@sprites["pokemon#{i}"] = PokemonSprite.new(@viewport)
|
||||
@sprites["pokemon#{i}"].setOffset(PictureOrigin::TopLeft)
|
||||
@sprites["pokemon#{i}"].setPokemonBitmap(pok)
|
||||
# This method doesn't put the exact coordinates
|
||||
@sprites["pokemon#{i}"].x = xpoint
|
||||
@sprites["pokemon#{i}"].y = ypoint
|
||||
if @sprites["pokemon#{i}"].bitmap && !@sprites["pokemon#{i}"].disposed?
|
||||
@sprites["pokemon#{i}"].x += (128-@sprites["pokemon#{i}"].bitmap.width)/2
|
||||
@sprites["pokemon#{i}"].y += (128-@sprites["pokemon#{i}"].bitmap.height)/2
|
||||
@sprites["pokemon#{i}"].x += (128 - @sprites["pokemon#{i}"].bitmap.width) / 2
|
||||
@sprites["pokemon#{i}"].y += (128 - @sprites["pokemon#{i}"].bitmap.height) / 2
|
||||
end
|
||||
@sprites["pokemon#{i}"].z=7-i if SINGLEROW
|
||||
@sprites["pokemon#{i}"].z = 7 - i if SINGLEROW
|
||||
next if !hide
|
||||
# Animation distance calculation
|
||||
horizontal=1-xpositionformula(i)
|
||||
vertical=1-ypositionformula(i)
|
||||
xdistance=(horizontal==-1) ? -@sprites["pokemon#{i}"].bitmap.width : Graphics.width
|
||||
ydistance=(vertical==-1) ? -@sprites["pokemon#{i}"].bitmap.height : Graphics.height
|
||||
xdistance=((xdistance-@sprites["pokemon#{i}"].x)/ANIMATIONSPEED).abs+1
|
||||
ydistance=((ydistance-@sprites["pokemon#{i}"].y)/ANIMATIONSPEED).abs+1
|
||||
biggerdistance=(xdistance>ydistance) ? xdistance : ydistance
|
||||
@xmovement[i]=biggerdistance
|
||||
@xmovement[i]*=-1 if horizontal==-1
|
||||
@xmovement[i]=0 if horizontal== 0
|
||||
@ymovement[i]=biggerdistance
|
||||
@ymovement[i]*=-1 if vertical==-1
|
||||
@ymovement[i]=0 if vertical== 0
|
||||
horizontal = 1 - xpositionformula(i)
|
||||
vertical = 1 - ypositionformula(i)
|
||||
xdistance = (horizontal == -1) ? -@sprites["pokemon#{i}"].bitmap.width : Graphics.width
|
||||
ydistance = (vertical == -1) ? -@sprites["pokemon#{i}"].bitmap.height : Graphics.height
|
||||
xdistance = ((xdistance - @sprites["pokemon#{i}"].x) / ANIMATIONSPEED).abs + 1
|
||||
ydistance = ((ydistance - @sprites["pokemon#{i}"].y) / ANIMATIONSPEED).abs + 1
|
||||
biggerdistance = (xdistance > ydistance) ? xdistance : ydistance
|
||||
@xmovement[i] = biggerdistance
|
||||
@xmovement[i] *= -1 if horizontal == -1
|
||||
@xmovement[i] = 0 if horizontal == 0
|
||||
@ymovement[i] = biggerdistance
|
||||
@ymovement[i] *= -1 if vertical == -1
|
||||
@ymovement[i] = 0 if vertical == 0
|
||||
# Hide the battlers
|
||||
@sprites["pokemon#{i}"].x+=@xmovement[i]*ANIMATIONSPEED
|
||||
@sprites["pokemon#{i}"].y+=@ymovement[i]*ANIMATIONSPEED
|
||||
@sprites["pokemon#{i}"].x += @xmovement[i] * ANIMATIONSPEED
|
||||
@sprites["pokemon#{i}"].y += @ymovement[i] * ANIMATIONSPEED
|
||||
end
|
||||
end
|
||||
|
||||
def createTrainerBattler
|
||||
@sprites["trainer"]=IconSprite.new(@viewport)
|
||||
@sprites["trainer"] = IconSprite.new(@viewport)
|
||||
@sprites["trainer"].setBitmap(GameData::TrainerType.front_sprite_filename($player.trainer_type))
|
||||
if !SINGLEROW
|
||||
@sprites["trainer"].x=Graphics.width-96
|
||||
@sprites["trainer"].y=160
|
||||
@sprites["trainer"].x = Graphics.width - 96
|
||||
@sprites["trainer"].y = 160
|
||||
else
|
||||
@sprites["trainer"].x=Graphics.width/2
|
||||
@sprites["trainer"].y=178
|
||||
@sprites["trainer"].x = Graphics.width / 2
|
||||
@sprites["trainer"].y = 178
|
||||
end
|
||||
@sprites["trainer"].z=9
|
||||
@sprites["trainer"].ox=@sprites["trainer"].bitmap.width/2
|
||||
@sprites["trainer"].oy=@sprites["trainer"].bitmap.height/2
|
||||
@sprites["trainer"].z = 9
|
||||
@sprites["trainer"].ox = @sprites["trainer"].bitmap.width / 2
|
||||
@sprites["trainer"].oy = @sprites["trainer"].bitmap.height / 2
|
||||
if REMOVEBARS
|
||||
@sprites["overlay"].bitmap.clear
|
||||
@sprites["hallbars"].visible=false
|
||||
@sprites["hallbars"].visible = false
|
||||
end
|
||||
@xmovement[@battlerIndex]=0
|
||||
@ymovement[@battlerIndex]=0
|
||||
@xmovement[@battlerIndex] = 0
|
||||
@ymovement[@battlerIndex] = 0
|
||||
if ANIMATION && !SINGLEROW # Trainer Animation
|
||||
startpoint=Graphics.width/2
|
||||
startpoint = Graphics.width / 2
|
||||
# 2 is the trainer speed
|
||||
@xmovement[@battlerIndex]=(startpoint-@sprites["trainer"].x)/2
|
||||
@sprites["trainer"].x=startpoint
|
||||
@xmovement[@battlerIndex] = (startpoint - @sprites["trainer"].x) / 2
|
||||
@sprites["trainer"].x = startpoint
|
||||
else
|
||||
ENTRYWAITTIME.times do
|
||||
Graphics.update
|
||||
@@ -278,58 +278,58 @@ class HallOfFame_Scene
|
||||
totalsec = Graphics.frame_count / Graphics.frame_rate
|
||||
hour = totalsec / 60 / 60
|
||||
min = totalsec / 60 % 60
|
||||
pubid=sprintf("%05d", $player.public_ID)
|
||||
lefttext= _INTL("Name<r>{1}<br>", $player.name)
|
||||
lefttext+=_INTL("IDNo.<r>{1}<br>",pubid)
|
||||
lefttext+=_ISPRINTF("Time<r>{1:02d}:{2:02d}<br>",hour,min)
|
||||
lefttext+=_INTL("Pokédex<r>{1}/{2}<br>",
|
||||
pubid = sprintf("%05d", $player.public_ID)
|
||||
lefttext = _INTL("Name<r>{1}<br>", $player.name)
|
||||
lefttext += _INTL("IDNo.<r>{1}<br>", pubid)
|
||||
lefttext += _ISPRINTF("Time<r>{1:02d}:{2:02d}<br>", hour, min)
|
||||
lefttext += _INTL("Pokédex<r>{1}/{2}<br>",
|
||||
$player.pokedex.owned_count, $player.pokedex.seen_count)
|
||||
@sprites["messagebox"]=Window_AdvancedTextPokemon.new(lefttext)
|
||||
@sprites["messagebox"].viewport=@viewport
|
||||
@sprites["messagebox"].width=192 if @sprites["messagebox"].width<192
|
||||
@sprites["msgwindow"]=pbCreateMessageWindow(@viewport)
|
||||
@sprites["messagebox"] = Window_AdvancedTextPokemon.new(lefttext)
|
||||
@sprites["messagebox"].viewport = @viewport
|
||||
@sprites["messagebox"].width = 192 if @sprites["messagebox"].width < 192
|
||||
@sprites["msgwindow"] = pbCreateMessageWindow(@viewport)
|
||||
pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("League champion!\nCongratulations!\\^"))
|
||||
end
|
||||
|
||||
def writePokemonData(pokemon,hallNumber = -1)
|
||||
overlay=@sprites["overlay"].bitmap
|
||||
def writePokemonData(pokemon, hallNumber = -1)
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
pokename=pokemon.name
|
||||
speciesname=pokemon.speciesName
|
||||
pokename = pokemon.name
|
||||
speciesname = pokemon.speciesName
|
||||
if pokemon.male?
|
||||
speciesname+="♂"
|
||||
speciesname += "♂"
|
||||
elsif pokemon.female?
|
||||
speciesname+="♀"
|
||||
speciesname += "♀"
|
||||
end
|
||||
pokename+="/"+speciesname
|
||||
pokename=_INTL("Egg")+"/"+_INTL("Egg") if pokemon.egg?
|
||||
idno=(pokemon.owner.name.empty? || pokemon.egg?) ? "?????" : sprintf("%05d",pokemon.owner.public_id)
|
||||
pokename += "/" + speciesname
|
||||
pokename = _INTL("Egg") + "/" + _INTL("Egg") if pokemon.egg?
|
||||
idno = (pokemon.owner.name.empty? || pokemon.egg?) ? "?????" : sprintf("%05d", pokemon.owner.public_id)
|
||||
dexnumber = _INTL("No. ???")
|
||||
if !pokemon.egg?
|
||||
number = @nationalDexList.index(pokemon.species) || 0
|
||||
dexnumber = _ISPRINTF("No. {1:03d}", number)
|
||||
end
|
||||
textPositions=[
|
||||
[dexnumber,32,Graphics.height-86,0,BASECOLOR,SHADOWCOLOR],
|
||||
[pokename,Graphics.width-192,Graphics.height-86,2,BASECOLOR,SHADOWCOLOR],
|
||||
[_INTL("Lv. {1}",pokemon.egg? ? "?" : pokemon.level),
|
||||
64,Graphics.height-54,0,BASECOLOR,SHADOWCOLOR],
|
||||
[_INTL("IDNo.{1}",pokemon.egg? ? "?????" : idno),
|
||||
Graphics.width-192,Graphics.height-54,2,BASECOLOR,SHADOWCOLOR]
|
||||
textPositions = [
|
||||
[dexnumber, 32, Graphics.height - 86, 0, BASECOLOR, SHADOWCOLOR],
|
||||
[pokename, Graphics.width - 192, Graphics.height - 86, 2, BASECOLOR, SHADOWCOLOR],
|
||||
[_INTL("Lv. {1}", pokemon.egg? ? "?" : pokemon.level),
|
||||
64, Graphics.height - 54, 0, BASECOLOR, SHADOWCOLOR],
|
||||
[_INTL("IDNo.{1}", pokemon.egg? ? "?????" : idno),
|
||||
Graphics.width - 192, Graphics.height - 54, 2, BASECOLOR, SHADOWCOLOR]
|
||||
]
|
||||
if (hallNumber>-1)
|
||||
textPositions.push([_INTL("Hall of Fame No."),Graphics.width/2-104,-6,0,BASECOLOR,SHADOWCOLOR])
|
||||
textPositions.push([hallNumber.to_s,Graphics.width/2+104,-6,1,BASECOLOR,SHADOWCOLOR])
|
||||
if (hallNumber > -1)
|
||||
textPositions.push([_INTL("Hall of Fame No."), Graphics.width / 2 - 104, -6, 0, BASECOLOR, SHADOWCOLOR])
|
||||
textPositions.push([hallNumber.to_s, Graphics.width / 2 + 104, -6, 1, BASECOLOR, SHADOWCOLOR])
|
||||
end
|
||||
pbDrawTextPositions(overlay,textPositions)
|
||||
pbDrawTextPositions(overlay, textPositions)
|
||||
end
|
||||
|
||||
def writeWelcome
|
||||
overlay=@sprites["overlay"].bitmap
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
pbDrawTextPositions(overlay,[[_INTL("Welcome to the Hall of Fame!"),
|
||||
Graphics.width/2,Graphics.height-80,2,BASECOLOR,SHADOWCOLOR]])
|
||||
pbDrawTextPositions(overlay, [[_INTL("Welcome to the Hall of Fame!"),
|
||||
Graphics.width / 2, Graphics.height - 80, 2, BASECOLOR, SHADOWCOLOR]])
|
||||
end
|
||||
|
||||
def pbAnimationLoop
|
||||
@@ -338,7 +338,7 @@ class HallOfFame_Scene
|
||||
Input.update
|
||||
pbUpdate
|
||||
pbUpdateAnimation
|
||||
break if @battlerIndex==@hallEntry.size+2
|
||||
break if @battlerIndex == @hallEntry.size + 2
|
||||
end
|
||||
end
|
||||
|
||||
@@ -347,19 +347,19 @@ class HallOfFame_Scene
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
continueScene=true
|
||||
continueScene = true
|
||||
break if Input.trigger?(Input::BACK) # Exits
|
||||
if Input.trigger?(Input::USE) # Moves the selection one entry backward
|
||||
@battlerIndex+=10
|
||||
continueScene=pbUpdatePC
|
||||
@battlerIndex += 10
|
||||
continueScene = pbUpdatePC
|
||||
end
|
||||
if Input.trigger?(Input::LEFT) # Moves the selection one pokémon forward
|
||||
@battlerIndex-=1
|
||||
continueScene=pbUpdatePC
|
||||
@battlerIndex -= 1
|
||||
continueScene = pbUpdatePC
|
||||
end
|
||||
if Input.trigger?(Input::RIGHT) # Moves the selection one pokémon backward
|
||||
@battlerIndex+=1
|
||||
continueScene=pbUpdatePC
|
||||
@battlerIndex += 1
|
||||
continueScene = pbUpdatePC
|
||||
end
|
||||
break if !continueScene
|
||||
end
|
||||
@@ -370,75 +370,75 @@ class HallOfFame_Scene
|
||||
end
|
||||
|
||||
def pbUpdateAnimation
|
||||
if @battlerIndex<=@hallEntry.size
|
||||
if @xmovement[@battlerIndex]!=0 || @ymovement[@battlerIndex]!=0
|
||||
spriteIndex=(@battlerIndex<@hallEntry.size) ? @battlerIndex : -1
|
||||
if @battlerIndex <= @hallEntry.size
|
||||
if @xmovement[@battlerIndex] != 0 || @ymovement[@battlerIndex] != 0
|
||||
spriteIndex = (@battlerIndex < @hallEntry.size) ? @battlerIndex : -1
|
||||
moveSprite(spriteIndex)
|
||||
else
|
||||
@battlerIndex+=1
|
||||
if @battlerIndex<=@hallEntry.size
|
||||
@battlerIndex += 1
|
||||
if @battlerIndex <= @hallEntry.size
|
||||
# If it is a pokémon, write the pokémon text, wait the
|
||||
# ENTRYWAITTIME and goes to the next battler
|
||||
@hallEntry[@battlerIndex - 1].play_cry
|
||||
writePokemonData(@hallEntry[@battlerIndex-1])
|
||||
(ENTRYWAITTIME*Graphics.frame_rate/20).times do
|
||||
writePokemonData(@hallEntry[@battlerIndex - 1])
|
||||
(ENTRYWAITTIME * Graphics.frame_rate / 20).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
if @battlerIndex<@hallEntry.size # Preparates the next battler
|
||||
setPokemonSpritesOpacity(@battlerIndex,OPACITY)
|
||||
if @battlerIndex < @hallEntry.size # Preparates the next battler
|
||||
setPokemonSpritesOpacity(@battlerIndex, OPACITY)
|
||||
@sprites["overlay"].bitmap.clear
|
||||
else # Show the welcome message and preparates the trainer
|
||||
setPokemonSpritesOpacity(-1)
|
||||
writeWelcome
|
||||
(ENTRYWAITTIME*2*Graphics.frame_rate/20).times do
|
||||
(ENTRYWAITTIME * 2 * Graphics.frame_rate / 20).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
setPokemonSpritesOpacity(-1,OPACITY) if !SINGLEROW
|
||||
setPokemonSpritesOpacity(-1, OPACITY) if !SINGLEROW
|
||||
createTrainerBattler
|
||||
end
|
||||
end
|
||||
end
|
||||
elsif @battlerIndex>@hallEntry.size
|
||||
elsif @battlerIndex > @hallEntry.size
|
||||
# Write the trainer data and fade
|
||||
writeTrainerData
|
||||
(ENTRYWAITTIME*Graphics.frame_rate/20).times do
|
||||
(ENTRYWAITTIME * Graphics.frame_rate / 20).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
fadeSpeed=((Math.log(2**12)-Math.log(FINALFADESPEED))/Math.log(2)).floor
|
||||
pbBGMFade((2**fadeSpeed).to_f/20) if @useMusic
|
||||
slowFadeOut(@sprites,fadeSpeed) { pbUpdate }
|
||||
@alreadyFadedInEnd=true
|
||||
@battlerIndex+=1
|
||||
fadeSpeed = ((Math.log(2**12) - Math.log(FINALFADESPEED)) / Math.log(2)).floor
|
||||
pbBGMFade((2**fadeSpeed).to_f / 20) if @useMusic
|
||||
slowFadeOut(@sprites, fadeSpeed) { pbUpdate }
|
||||
@alreadyFadedInEnd = true
|
||||
@battlerIndex += 1
|
||||
end
|
||||
end
|
||||
|
||||
def pbUpdatePC
|
||||
# Change the team
|
||||
if @battlerIndex>=@hallEntry.size
|
||||
@hallIndex-=1
|
||||
return false if @hallIndex==-1
|
||||
@hallEntry=$PokemonGlobal.hallOfFame[@hallIndex]
|
||||
@battlerIndex=0
|
||||
if @battlerIndex >= @hallEntry.size
|
||||
@hallIndex -= 1
|
||||
return false if @hallIndex == -1
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex]
|
||||
@battlerIndex = 0
|
||||
createBattlers(false)
|
||||
elsif @battlerIndex<0
|
||||
@hallIndex+=1
|
||||
return false if @hallIndex>=$PokemonGlobal.hallOfFame.size
|
||||
@hallEntry=$PokemonGlobal.hallOfFame[@hallIndex]
|
||||
@battlerIndex=@hallEntry.size-1
|
||||
elsif @battlerIndex < 0
|
||||
@hallIndex += 1
|
||||
return false if @hallIndex >= $PokemonGlobal.hallOfFame.size
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex]
|
||||
@battlerIndex = @hallEntry.size - 1
|
||||
createBattlers(false)
|
||||
end
|
||||
# Change the pokemon
|
||||
@hallEntry[@battlerIndex].play_cry
|
||||
setPokemonSpritesOpacity(@battlerIndex,OPACITY)
|
||||
hallNumber=$PokemonGlobal.hallOfFameLastNumber + @hallIndex -
|
||||
$PokemonGlobal.hallOfFame.size + 1
|
||||
writePokemonData(@hallEntry[@battlerIndex],hallNumber)
|
||||
setPokemonSpritesOpacity(@battlerIndex, OPACITY)
|
||||
hallNumber = $PokemonGlobal.hallOfFameLastNumber + @hallIndex -
|
||||
$PokemonGlobal.hallOfFame.size + 1
|
||||
writePokemonData(@hallEntry[@battlerIndex], hallNumber)
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -469,7 +469,7 @@ end
|
||||
#===============================================================================
|
||||
class HallOfFamePC
|
||||
def shouldShow?
|
||||
return $PokemonGlobal.hallOfFameLastNumber>0
|
||||
return $PokemonGlobal.hallOfFameLastNumber > 0
|
||||
end
|
||||
|
||||
def name
|
||||
@@ -509,13 +509,13 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
def pbHallOfFameEntry
|
||||
scene=HallOfFame_Scene.new
|
||||
screen=HallOfFameScreen.new(scene)
|
||||
scene = HallOfFame_Scene.new
|
||||
screen = HallOfFameScreen.new(scene)
|
||||
screen.pbStartScreenEntry
|
||||
end
|
||||
|
||||
def pbHallOfFamePC
|
||||
scene=HallOfFame_Scene.new
|
||||
screen=HallOfFameScreen.new(scene)
|
||||
scene = HallOfFame_Scene.new
|
||||
screen = HallOfFameScreen.new(scene)
|
||||
screen.pbStartScreenPC
|
||||
end
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu_Scene
|
||||
def pbStartScene
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["cmdwindow"] = Window_CommandPokemon.new([])
|
||||
@sprites["cmdwindow"].visible = false
|
||||
@sprites["cmdwindow"].viewport = @viewport
|
||||
@sprites["infowindow"] = Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
|
||||
@sprites["infowindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
@sprites["infowindow"].visible = false
|
||||
@sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport)
|
||||
@sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 32, 32, @viewport)
|
||||
@sprites["helpwindow"].visible = false
|
||||
@infostate = false
|
||||
@helpstate = false
|
||||
@@ -19,14 +19,14 @@ class PokemonPauseMenu_Scene
|
||||
end
|
||||
|
||||
def pbShowInfo(text)
|
||||
@sprites["infowindow"].resizeToFit(text,Graphics.height)
|
||||
@sprites["infowindow"].resizeToFit(text, Graphics.height)
|
||||
@sprites["infowindow"].text = text
|
||||
@sprites["infowindow"].visible = true
|
||||
@infostate = true
|
||||
end
|
||||
|
||||
def pbShowHelp(text)
|
||||
@sprites["helpwindow"].resizeToFit(text,Graphics.height)
|
||||
@sprites["helpwindow"].resizeToFit(text, Graphics.height)
|
||||
@sprites["helpwindow"].text = text
|
||||
@sprites["helpwindow"].visible = true
|
||||
pbBottomLeft(@sprites["helpwindow"])
|
||||
@@ -51,7 +51,7 @@ class PokemonPauseMenu_Scene
|
||||
cmdwindow.commands = commands
|
||||
cmdwindow.index = $game_temp.menu_last_choice
|
||||
cmdwindow.resizeToFit(commands)
|
||||
cmdwindow.x = Graphics.width-cmdwindow.width
|
||||
cmdwindow.x = Graphics.width - cmdwindow.width
|
||||
cmdwindow.y = 0
|
||||
cmdwindow.visible = true
|
||||
loop do
|
||||
@@ -127,7 +127,7 @@ class PokemonPauseMenu
|
||||
commands[cmdTrainer = commands.length] = $player.name
|
||||
if pbInSafari?
|
||||
if Settings::SAFARI_STEPS <= 0
|
||||
@scene.pbShowInfo(_INTL("Balls: {1}",pbSafariState.ballcount))
|
||||
@scene.pbShowInfo(_INTL("Balls: {1}", pbSafariState.ballcount))
|
||||
else
|
||||
@scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
|
||||
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
|
||||
@@ -140,7 +140,7 @@ class PokemonPauseMenu
|
||||
pbBugContestState.lastPokemon.level,
|
||||
pbBugContestState.ballcount))
|
||||
else
|
||||
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}",pbBugContestState.ballcount))
|
||||
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount))
|
||||
end
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit Contest")
|
||||
else
|
||||
@@ -151,7 +151,7 @@ class PokemonPauseMenu
|
||||
commands[cmdEndGame = commands.length] = _INTL("Quit Game")
|
||||
loop do
|
||||
command = @scene.pbShowCommands(commands)
|
||||
if cmdPokedex>=0 && command==cmdPokedex
|
||||
if cmdPokedex >= 0 && command == cmdPokedex
|
||||
pbPlayDecisionSE
|
||||
if Settings::USE_CURRENT_REGION_DEX
|
||||
pbFadeOutIn {
|
||||
@@ -178,7 +178,7 @@ class PokemonPauseMenu
|
||||
}
|
||||
end
|
||||
end
|
||||
elsif cmdPokemon>=0 && command==cmdPokemon
|
||||
elsif cmdPokemon >= 0 && command == cmdPokemon
|
||||
pbPlayDecisionSE
|
||||
hiddenmove = nil
|
||||
pbFadeOutIn {
|
||||
@@ -189,10 +189,10 @@ class PokemonPauseMenu
|
||||
}
|
||||
if hiddenmove
|
||||
$game_temp.in_menu = false
|
||||
pbUseHiddenMove(hiddenmove[0],hiddenmove[1])
|
||||
pbUseHiddenMove(hiddenmove[0], hiddenmove[1])
|
||||
return
|
||||
end
|
||||
elsif cmdBag>=0 && command==cmdBag
|
||||
elsif cmdBag >= 0 && command == cmdBag
|
||||
pbPlayDecisionSE
|
||||
item = nil
|
||||
pbFadeOutIn {
|
||||
@@ -206,7 +206,7 @@ class PokemonPauseMenu
|
||||
pbUseKeyItemInField(item)
|
||||
return
|
||||
end
|
||||
elsif cmdPokegear>=0 && command==cmdPokegear
|
||||
elsif cmdPokegear >= 0 && command == cmdPokegear
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokegear_Scene.new
|
||||
@@ -215,7 +215,7 @@ class PokemonPauseMenu
|
||||
($game_temp.fly_destination) ? @scene.pbEndScene : @scene.pbRefresh
|
||||
}
|
||||
return if pbFlyToNewLocation
|
||||
elsif cmdTownMap>=0 && command==cmdTownMap
|
||||
elsif cmdTownMap >= 0 && command == cmdTownMap
|
||||
pbFadeOutIn {
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
@@ -224,7 +224,7 @@ class PokemonPauseMenu
|
||||
($game_temp.fly_destination) ? @scene.pbEndScene : @scene.pbRefresh
|
||||
}
|
||||
return if pbFlyToNewLocation
|
||||
elsif cmdTrainer>=0 && command==cmdTrainer
|
||||
elsif cmdTrainer >= 0 && command == cmdTrainer
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonTrainerCard_Scene.new
|
||||
@@ -232,7 +232,7 @@ class PokemonPauseMenu
|
||||
screen.pbStartScreen
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif cmdQuit>=0 && command==cmdQuit
|
||||
elsif cmdQuit >= 0 && command == cmdQuit
|
||||
@scene.pbHideMenu
|
||||
if pbInSafari?
|
||||
if pbConfirmMessage(_INTL("Would you like to leave the Safari Game right now?"))
|
||||
@@ -252,7 +252,7 @@ class PokemonPauseMenu
|
||||
pbShowMenu
|
||||
end
|
||||
end
|
||||
elsif cmdSave>=0 && command==cmdSave
|
||||
elsif cmdSave >= 0 && command == cmdSave
|
||||
@scene.pbHideMenu
|
||||
scene = PokemonSave_Scene.new
|
||||
screen = PokemonSaveScreen.new(scene)
|
||||
@@ -263,7 +263,7 @@ class PokemonPauseMenu
|
||||
else
|
||||
pbShowMenu
|
||||
end
|
||||
elsif cmdOption>=0 && command==cmdOption
|
||||
elsif cmdOption >= 0 && command == cmdOption
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonOption_Scene.new
|
||||
@@ -272,13 +272,13 @@ class PokemonPauseMenu
|
||||
pbUpdateSceneMap
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif cmdDebug>=0 && command==cmdDebug
|
||||
elsif cmdDebug >= 0 && command == cmdDebug
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
pbDebugMenu
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif cmdEndGame>=0 && command==cmdEndGame
|
||||
elsif cmdEndGame >= 0 && command == cmdEndGame
|
||||
@scene.pbHideMenu
|
||||
if pbConfirmMessage(_INTL("Are you sure you want to quit the game?"))
|
||||
scene = PokemonSave_Scene.new
|
||||
|
||||
@@ -5,27 +5,27 @@
|
||||
# Settings::USE_CURRENT_REGION_DEX is false.
|
||||
#===============================================================================
|
||||
class Window_DexesList < Window_CommandPokemon
|
||||
def initialize(commands,commands2,width)
|
||||
def initialize(commands, commands2, width)
|
||||
@commands2 = commands2
|
||||
super(commands,width)
|
||||
super(commands, width)
|
||||
@selarrow = AnimatedBitmap.new("Graphics/Pictures/selarrow_white")
|
||||
self.baseColor = Color.new(248,248,248)
|
||||
self.shadowColor = Color.new(0,0,0)
|
||||
self.baseColor = Color.new(248, 248, 248)
|
||||
self.shadowColor = Color.new(0, 0, 0)
|
||||
self.windowskin = nil
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
super(index,count,rect)
|
||||
if index>=0 && index<@commands2.length
|
||||
pbDrawShadowText(self.contents,rect.x+254,rect.y,64,rect.height,
|
||||
sprintf("%d",@commands2[index][0]),self.baseColor,self.shadowColor,1)
|
||||
pbDrawShadowText(self.contents,rect.x+350,rect.y,64,rect.height,
|
||||
sprintf("%d",@commands2[index][1]),self.baseColor,self.shadowColor,1)
|
||||
allseen = (@commands2[index][0]>=@commands2[index][2])
|
||||
allown = (@commands2[index][1]>=@commands2[index][2])
|
||||
pbDrawImagePositions(self.contents,[
|
||||
["Graphics/Pictures/Pokedex/icon_menuseenown",rect.x+236,rect.y+2,(allseen) ? 24 : 0,0,24,24],
|
||||
["Graphics/Pictures/Pokedex/icon_menuseenown",rect.x+332,rect.y+2,(allown) ? 24 : 0,24,24,24]
|
||||
def drawItem(index, count, rect)
|
||||
super(index, count, rect)
|
||||
if index >= 0 && index < @commands2.length
|
||||
pbDrawShadowText(self.contents, rect.x + 254, rect.y, 64, rect.height,
|
||||
sprintf("%d", @commands2[index][0]), self.baseColor, self.shadowColor, 1)
|
||||
pbDrawShadowText(self.contents, rect.x + 350, rect.y, 64, rect.height,
|
||||
sprintf("%d", @commands2[index][1]), self.baseColor, self.shadowColor, 1)
|
||||
allseen = (@commands2[index][0] >= @commands2[index][2])
|
||||
allown = (@commands2[index][1] >= @commands2[index][2])
|
||||
pbDrawImagePositions(self.contents, [
|
||||
["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 236, rect.y + 2, (allseen) ? 24 : 0, 0, 24, 24],
|
||||
["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 332, rect.y + 2, (allown) ? 24 : 0, 24, 24, 24]
|
||||
])
|
||||
end
|
||||
end
|
||||
@@ -39,17 +39,17 @@ class PokemonPokedexMenu_Scene
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
|
||||
def pbStartScene(commands,commands2)
|
||||
def pbStartScene(commands, commands2)
|
||||
@commands = commands
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_menu"))
|
||||
@sprites["headings"]=Window_AdvancedTextPokemon.newWithSize(
|
||||
_INTL("<c3=F8F8F8,C02028>SEEN<r>OBTAINED</c3>"),286,136,208,64,@viewport)
|
||||
@sprites["headings"].windowskin = nil
|
||||
@sprites["commands"] = Window_DexesList.new(commands,commands2,Graphics.width-84)
|
||||
@sprites["headings"] = Window_AdvancedTextPokemon.newWithSize(
|
||||
_INTL("<c3=F8F8F8,C02028>SEEN<r>OBTAINED</c3>"), 286, 136, 208, 64, @viewport)
|
||||
@sprites["headings"].windowskin = nil
|
||||
@sprites["commands"] = Window_DexesList.new(commands, commands2, Graphics.width - 84)
|
||||
@sprites["commands"].x = 40
|
||||
@sprites["commands"].y = 192
|
||||
@sprites["commands"].height = 192
|
||||
@@ -68,7 +68,7 @@ class PokemonPokedexMenu_Scene
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
ret = @sprites["commands"].index
|
||||
(ret==@commands.length-1) ? pbPlayCloseMenuSE : pbPlayDecisionSE
|
||||
(ret == @commands.length - 1) ? pbPlayCloseMenuSE : pbPlayDecisionSE
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -107,10 +107,10 @@ class PokemonPokedexMenuScreen
|
||||
pbGetRegionalDexLength(dex)])
|
||||
end
|
||||
commands.push(_INTL("Exit"))
|
||||
@scene.pbStartScene(commands,commands2)
|
||||
@scene.pbStartScene(commands, commands2)
|
||||
loop do
|
||||
cmd = @scene.pbScene
|
||||
break if cmd<0 || cmd>=commands2.length # Cancel/Exit
|
||||
break if cmd < 0 || cmd >= commands2.length # Cancel/Exit
|
||||
$PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[cmd]
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokedex_Scene.new
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,8 @@
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPokedexInfo_Scene
|
||||
def pbStartScene(dexlist,index,region)
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
def pbStartScene(dexlist, index, region)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@dexlist = dexlist
|
||||
@index = index
|
||||
@@ -12,7 +12,7 @@ class PokemonPokedexInfo_Scene
|
||||
@show_battled_count = false
|
||||
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["infosprite"] = PokemonSprite.new(@viewport)
|
||||
@sprites["infosprite"].setOffset(PictureOrigin::Center)
|
||||
@sprites["infosprite"].x = 104
|
||||
@@ -22,21 +22,21 @@ class PokemonPokedexInfo_Scene
|
||||
if @region < 0 # Use player's current region
|
||||
@region = (mappos) ? mappos[0] : 0 # Region 0 default
|
||||
end
|
||||
@sprites["areamap"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["areamap"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["areamap"].setBitmap("Graphics/Pictures/#{@mapdata[@region][1]}")
|
||||
@sprites["areamap"].x += (Graphics.width-@sprites["areamap"].bitmap.width)/2
|
||||
@sprites["areamap"].y += (Graphics.height+32-@sprites["areamap"].bitmap.height)/2
|
||||
@sprites["areamap"].x += (Graphics.width - @sprites["areamap"].bitmap.width) / 2
|
||||
@sprites["areamap"].y += (Graphics.height + 32 - @sprites["areamap"].bitmap.height) / 2
|
||||
for hidden in Settings::REGION_MAP_EXTRAS
|
||||
if hidden[0]==@region && hidden[1]>0 && $game_switches[hidden[1]]
|
||||
pbDrawImagePositions(@sprites["areamap"].bitmap,[
|
||||
if hidden[0] == @region && hidden[1] > 0 && $game_switches[hidden[1]]
|
||||
pbDrawImagePositions(@sprites["areamap"].bitmap, [
|
||||
["Graphics/Pictures/#{hidden[4]}",
|
||||
hidden[2]*PokemonRegionMap_Scene::SQUARE_WIDTH,
|
||||
hidden[3]*PokemonRegionMap_Scene::SQUARE_HEIGHT]
|
||||
hidden[2] * PokemonRegionMap_Scene::SQUARE_WIDTH,
|
||||
hidden[3] * PokemonRegionMap_Scene::SQUARE_HEIGHT]
|
||||
])
|
||||
end
|
||||
end
|
||||
@sprites["areahighlight"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
@sprites["areaoverlay"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["areahighlight"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@sprites["areaoverlay"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["areaoverlay"].setBitmap("Graphics/Pictures/Pokedex/overlay_area")
|
||||
@sprites["formfront"] = PokemonSprite.new(@viewport)
|
||||
@sprites["formfront"].setOffset(PictureOrigin::Center)
|
||||
@@ -49,17 +49,17 @@ class PokemonPokedexInfo_Scene
|
||||
@sprites["formicon"].setOffset(PictureOrigin::Center)
|
||||
@sprites["formicon"].x = 82
|
||||
@sprites["formicon"].y = 328
|
||||
@sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/uparrow",8,28,40,2,@viewport)
|
||||
@sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/uparrow", 8, 28, 40, 2, @viewport)
|
||||
@sprites["uparrow"].x = 242
|
||||
@sprites["uparrow"].y = 268
|
||||
@sprites["uparrow"].play
|
||||
@sprites["uparrow"].visible = false
|
||||
@sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/downarrow",8,28,40,2,@viewport)
|
||||
@sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/downarrow", 8, 28, 40, 2, @viewport)
|
||||
@sprites["downarrow"].x = 242
|
||||
@sprites["downarrow"].y = 348
|
||||
@sprites["downarrow"].play
|
||||
@sprites["downarrow"].visible = false
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
pbUpdateDummyPokemon
|
||||
@available = pbGetAvailableForms
|
||||
@@ -68,7 +68,7 @@ class PokemonPokedexInfo_Scene
|
||||
end
|
||||
|
||||
def pbStartSceneBrief(species) # For standalone access, shows first page only
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
dexnum = 0
|
||||
dexnumshift = false
|
||||
@@ -83,25 +83,25 @@ class PokemonPokedexInfo_Scene
|
||||
else
|
||||
for i in 0...$player.pokedex.dexes_count - 1 # Regional Dexes
|
||||
next if !$player.pokedex.unlocked?(i)
|
||||
num = pbGetRegionalNumber(i,species)
|
||||
num = pbGetRegionalNumber(i, species)
|
||||
next if num <= 0
|
||||
dexnum = num
|
||||
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(i)
|
||||
break
|
||||
end
|
||||
end
|
||||
@dexlist = [[species,"",0,0,dexnum,dexnumshift]]
|
||||
@dexlist = [[species, "", 0, 0, dexnum, dexnumshift]]
|
||||
@index = 0
|
||||
@page = 1
|
||||
@brief = true
|
||||
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["infosprite"] = PokemonSprite.new(@viewport)
|
||||
@sprites["infosprite"].setOffset(PictureOrigin::Center)
|
||||
@sprites["infosprite"].x = 104
|
||||
@sprites["infosprite"].y = 136
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
pbUpdateDummyPokemon
|
||||
drawPage(@page)
|
||||
@@ -116,9 +116,9 @@ class PokemonPokedexInfo_Scene
|
||||
end
|
||||
|
||||
def pbUpdate
|
||||
if @page==2
|
||||
intensity = (Graphics.frame_count%40)*12
|
||||
intensity = 480-intensity if intensity>240
|
||||
if @page == 2
|
||||
intensity = (Graphics.frame_count % 40) * 12
|
||||
intensity = 480 - intensity if intensity > 240
|
||||
@sprites["areahighlight"].opacity = intensity
|
||||
end
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
@@ -128,17 +128,17 @@ class PokemonPokedexInfo_Scene
|
||||
@species = @dexlist[@index][0]
|
||||
@gender, @form = $player.pokedex.last_form_seen(@species)
|
||||
metrics_data = GameData::SpeciesMetrics.get_species_form(@species, @form)
|
||||
@sprites["infosprite"].setSpeciesBitmap(@species,@gender,@form)
|
||||
@sprites["infosprite"].setSpeciesBitmap(@species, @gender, @form)
|
||||
if @sprites["formfront"]
|
||||
@sprites["formfront"].setSpeciesBitmap(@species,@gender,@form)
|
||||
@sprites["formfront"].setSpeciesBitmap(@species, @gender, @form)
|
||||
end
|
||||
if @sprites["formback"]
|
||||
@sprites["formback"].setSpeciesBitmap(@species,@gender,@form,false,false,true)
|
||||
@sprites["formback"].setSpeciesBitmap(@species, @gender, @form, false, false, true)
|
||||
@sprites["formback"].y = 256
|
||||
@sprites["formback"].y += metrics_data.back_sprite[1] * 2
|
||||
end
|
||||
if @sprites["formicon"]
|
||||
@sprites["formicon"].pbSetParams(@species,@gender,@form)
|
||||
@sprites["formicon"].pbSetParams(@species, @gender, @form)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -185,13 +185,13 @@ class PokemonPokedexInfo_Scene
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
# Make certain sprites visible
|
||||
@sprites["infosprite"].visible = (@page==1)
|
||||
@sprites["areamap"].visible = (@page==2) if @sprites["areamap"]
|
||||
@sprites["areahighlight"].visible = (@page==2) if @sprites["areahighlight"]
|
||||
@sprites["areaoverlay"].visible = (@page==2) if @sprites["areaoverlay"]
|
||||
@sprites["formfront"].visible = (@page==3) if @sprites["formfront"]
|
||||
@sprites["formback"].visible = (@page==3) if @sprites["formback"]
|
||||
@sprites["formicon"].visible = (@page==3) if @sprites["formicon"]
|
||||
@sprites["infosprite"].visible = (@page == 1)
|
||||
@sprites["areamap"].visible = (@page == 2) if @sprites["areamap"]
|
||||
@sprites["areahighlight"].visible = (@page == 2) if @sprites["areahighlight"]
|
||||
@sprites["areaoverlay"].visible = (@page == 2) if @sprites["areaoverlay"]
|
||||
@sprites["formfront"].visible = (@page == 3) if @sprites["formfront"]
|
||||
@sprites["formback"].visible = (@page == 3) if @sprites["formback"]
|
||||
@sprites["formicon"].visible = (@page == 3) if @sprites["formicon"]
|
||||
# Draw page-specific information
|
||||
case page
|
||||
when 1 then drawPageInfo
|
||||
@@ -251,7 +251,7 @@ class PokemonPokedexInfo_Scene
|
||||
# Draw the footprint
|
||||
footprintfile = GameData::Species.footprint_filename(@species, @form)
|
||||
if footprintfile
|
||||
footprint = RPG::Cache.load_bitmap("",footprintfile)
|
||||
footprint = RPG::Cache.load_bitmap("", footprintfile)
|
||||
overlay.blt(226, 138, footprint, footprint.rect)
|
||||
footprint.dispose
|
||||
end
|
||||
@@ -295,13 +295,13 @@ class PokemonPokedexInfo_Scene
|
||||
def drawPageArea
|
||||
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_area"))
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(88,88,80)
|
||||
shadow = Color.new(168,184,184)
|
||||
base = Color.new(88, 88, 80)
|
||||
shadow = Color.new(168, 184, 184)
|
||||
@sprites["areahighlight"].bitmap.clear
|
||||
# Fill the array "points" with all squares of the region map in which the
|
||||
# species can be found
|
||||
points = []
|
||||
mapwidth = 1+PokemonRegionMap_Scene::RIGHT-PokemonRegionMap_Scene::LEFT
|
||||
mapwidth = 1 + PokemonRegionMap_Scene::RIGHT - PokemonRegionMap_Scene::LEFT
|
||||
GameData::Encounter.each_of_version($PokemonGlobal.encounter_version) do |enc_data|
|
||||
next if !pbFindEncounter(enc_data.types, @species)
|
||||
map_metadata = GameData::MapMetadata.try_get(enc_data.map)
|
||||
@@ -309,89 +309,89 @@ class PokemonPokedexInfo_Scene
|
||||
next if !mappos || mappos[0] != @region
|
||||
showpoint = true
|
||||
for loc in @mapdata[@region][2]
|
||||
showpoint = false if loc[0]==mappos[1] && loc[1]==mappos[2] &&
|
||||
showpoint = false if loc[0] == mappos[1] && loc[1] == mappos[2] &&
|
||||
loc[7] && !$game_switches[loc[7]]
|
||||
end
|
||||
next if !showpoint
|
||||
mapsize = map_metadata.town_map_size
|
||||
if mapsize && mapsize[0] && mapsize[0]>0
|
||||
if mapsize && mapsize[0] && mapsize[0] > 0
|
||||
sqwidth = mapsize[0]
|
||||
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
||||
sqheight = (mapsize[1].length * 1.0 / mapsize[0]).ceil
|
||||
for i in 0...sqwidth
|
||||
for j in 0...sqheight
|
||||
if mapsize[1][i+j*sqwidth,1].to_i>0
|
||||
points[mappos[1]+i+(mappos[2]+j)*mapwidth] = true
|
||||
if mapsize[1][i + j * sqwidth, 1].to_i > 0
|
||||
points[mappos[1] + i + (mappos[2] + j) * mapwidth] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
points[mappos[1]+mappos[2]*mapwidth] = true
|
||||
points[mappos[1] + mappos[2] * mapwidth] = true
|
||||
end
|
||||
end
|
||||
# Draw coloured squares on each square of the region map with a nest
|
||||
pointcolor = Color.new(0,248,248)
|
||||
pointcolorhl = Color.new(192,248,248)
|
||||
pointcolor = Color.new(0, 248, 248)
|
||||
pointcolorhl = Color.new(192, 248, 248)
|
||||
sqwidth = PokemonRegionMap_Scene::SQUARE_WIDTH
|
||||
sqheight = PokemonRegionMap_Scene::SQUARE_HEIGHT
|
||||
for j in 0...points.length
|
||||
if points[j]
|
||||
x = (j%mapwidth)*sqwidth
|
||||
x += (Graphics.width-@sprites["areamap"].bitmap.width)/2
|
||||
y = (j/mapwidth)*sqheight
|
||||
y += (Graphics.height+32-@sprites["areamap"].bitmap.height)/2
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x,y,sqwidth,sqheight,pointcolor)
|
||||
if j-mapwidth<0 || !points[j-mapwidth]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x,y-2,sqwidth,2,pointcolorhl)
|
||||
x = (j % mapwidth) * sqwidth
|
||||
x += (Graphics.width - @sprites["areamap"].bitmap.width) / 2
|
||||
y = (j / mapwidth) * sqheight
|
||||
y += (Graphics.height + 32 - @sprites["areamap"].bitmap.height) / 2
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x, y, sqwidth, sqheight, pointcolor)
|
||||
if j - mapwidth < 0 || !points[j - mapwidth]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x, y - 2, sqwidth, 2, pointcolorhl)
|
||||
end
|
||||
if j+mapwidth>=points.length || !points[j+mapwidth]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x,y+sqheight,sqwidth,2,pointcolorhl)
|
||||
if j + mapwidth >= points.length || !points[j + mapwidth]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x, y + sqheight, sqwidth, 2, pointcolorhl)
|
||||
end
|
||||
if j%mapwidth==0 || !points[j-1]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x-2,y,2,sqheight,pointcolorhl)
|
||||
if j % mapwidth == 0 || !points[j - 1]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x - 2, y, 2, sqheight, pointcolorhl)
|
||||
end
|
||||
if (j+1)%mapwidth==0 || !points[j+1]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x+sqwidth,y,2,sqheight,pointcolorhl)
|
||||
if (j + 1) % mapwidth == 0 || !points[j + 1]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x + sqwidth, y, 2, sqheight, pointcolorhl)
|
||||
end
|
||||
end
|
||||
end
|
||||
# Set the text
|
||||
textpos = []
|
||||
if points.length==0
|
||||
pbDrawImagePositions(overlay,[
|
||||
[sprintf("Graphics/Pictures/Pokedex/overlay_areanone"),108,188]
|
||||
if points.length == 0
|
||||
pbDrawImagePositions(overlay, [
|
||||
[sprintf("Graphics/Pictures/Pokedex/overlay_areanone"), 108, 188]
|
||||
])
|
||||
textpos.push([_INTL("Area unknown"),Graphics.width/2,Graphics.height/2 - 6,2,base,shadow])
|
||||
textpos.push([_INTL("Area unknown"), Graphics.width / 2, Graphics.height / 2 - 6, 2, base, shadow])
|
||||
end
|
||||
textpos.push([pbGetMessage(MessageTypes::RegionNames,@region),414,38,2,base,shadow])
|
||||
textpos.push([_INTL("{1}'s area",GameData::Species.get(@species).name),
|
||||
Graphics.width/2,346,2,base,shadow])
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
textpos.push([pbGetMessage(MessageTypes::RegionNames, @region), 414, 38, 2, base, shadow])
|
||||
textpos.push([_INTL("{1}'s area", GameData::Species.get(@species).name),
|
||||
Graphics.width / 2, 346, 2, base, shadow])
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
end
|
||||
|
||||
def drawPageForms
|
||||
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms"))
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(88,88,80)
|
||||
shadow = Color.new(168,184,184)
|
||||
base = Color.new(88, 88, 80)
|
||||
shadow = Color.new(168, 184, 184)
|
||||
# Write species and form name
|
||||
formname = ""
|
||||
for i in @available
|
||||
if i[1]==@gender && i[2]==@form
|
||||
if i[1] == @gender && i[2] == @form
|
||||
formname = i[0]
|
||||
break
|
||||
end
|
||||
end
|
||||
textpos = [
|
||||
[GameData::Species.get(@species).name,Graphics.width/2,Graphics.height-94,2,base,shadow],
|
||||
[formname,Graphics.width/2,Graphics.height-62,2,base,shadow],
|
||||
[GameData::Species.get(@species).name, Graphics.width / 2, Graphics.height - 94, 2, base, shadow],
|
||||
[formname, Graphics.width / 2, Graphics.height - 62, 2, base, shadow],
|
||||
]
|
||||
# Draw all text
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
end
|
||||
|
||||
def pbGoToPrevious
|
||||
newindex = @index
|
||||
while newindex>0
|
||||
while newindex > 0
|
||||
newindex -= 1
|
||||
if $player.seen?(@dexlist[newindex][0])
|
||||
@index = newindex
|
||||
@@ -402,7 +402,7 @@ class PokemonPokedexInfo_Scene
|
||||
|
||||
def pbGoToNext
|
||||
newindex = @index
|
||||
while newindex<@dexlist.length-1
|
||||
while newindex < @dexlist.length - 1
|
||||
newindex += 1
|
||||
if $player.seen?(@dexlist[newindex][0])
|
||||
@index = newindex
|
||||
@@ -414,19 +414,19 @@ class PokemonPokedexInfo_Scene
|
||||
def pbChooseForm
|
||||
index = 0
|
||||
for i in 0...@available.length
|
||||
if @available[i][1]==@gender && @available[i][2]==@form
|
||||
if @available[i][1] == @gender && @available[i][2] == @form
|
||||
index = i
|
||||
break
|
||||
end
|
||||
end
|
||||
oldindex = -1
|
||||
loop do
|
||||
if oldindex!=index
|
||||
if oldindex != index
|
||||
$player.pokedex.set_last_form_seen(@species, @available[index][1], @available[index][2])
|
||||
pbUpdateDummyPokemon
|
||||
drawPage(@page)
|
||||
@sprites["uparrow"].visible = (index>0)
|
||||
@sprites["downarrow"].visible = (index<@available.length-1)
|
||||
@sprites["uparrow"].visible = (index > 0)
|
||||
@sprites["downarrow"].visible = (index < @available.length - 1)
|
||||
oldindex = index
|
||||
end
|
||||
Graphics.update
|
||||
@@ -434,10 +434,10 @@ class PokemonPokedexInfo_Scene
|
||||
pbUpdate
|
||||
if Input.trigger?(Input::UP)
|
||||
pbPlayCursorSE
|
||||
index = (index+@available.length-1)%@available.length
|
||||
index = (index + @available.length - 1) % @available.length
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
pbPlayCursorSE
|
||||
index = (index+1)%@available.length
|
||||
index = (index + 1) % @available.length
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
break
|
||||
@@ -470,7 +470,7 @@ class PokemonPokedexInfo_Scene
|
||||
elsif @page == 2 # Area
|
||||
# dorefresh = true
|
||||
elsif @page == 3 # Forms
|
||||
if @available.length>1
|
||||
if @available.length > 1
|
||||
pbPlayDecisionSE
|
||||
pbChooseForm
|
||||
dorefresh = true
|
||||
@@ -479,38 +479,38 @@ class PokemonPokedexInfo_Scene
|
||||
elsif Input.trigger?(Input::UP)
|
||||
oldindex = @index
|
||||
pbGoToPrevious
|
||||
if @index!=oldindex
|
||||
if @index != oldindex
|
||||
pbUpdateDummyPokemon
|
||||
@available = pbGetAvailableForms
|
||||
pbSEStop
|
||||
(@page==1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
|
||||
(@page == 1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
|
||||
dorefresh = true
|
||||
end
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
oldindex = @index
|
||||
pbGoToNext
|
||||
if @index!=oldindex
|
||||
if @index != oldindex
|
||||
pbUpdateDummyPokemon
|
||||
@available = pbGetAvailableForms
|
||||
pbSEStop
|
||||
(@page==1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
|
||||
(@page == 1) ? Pokemon.play_cry(@species, @form) : pbPlayCursorSE
|
||||
dorefresh = true
|
||||
end
|
||||
elsif Input.trigger?(Input::LEFT)
|
||||
oldpage = @page
|
||||
@page -= 1
|
||||
@page = 1 if @page<1
|
||||
@page = 3 if @page>3
|
||||
if @page!=oldpage
|
||||
@page = 1 if @page < 1
|
||||
@page = 3 if @page > 3
|
||||
if @page != oldpage
|
||||
pbPlayCursorSE
|
||||
dorefresh = true
|
||||
end
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
oldpage = @page
|
||||
@page += 1
|
||||
@page = 1 if @page<1
|
||||
@page = 3 if @page>3
|
||||
if @page!=oldpage
|
||||
@page = 1 if @page < 1
|
||||
@page = 3 if @page > 3
|
||||
if @page != oldpage
|
||||
pbPlayCursorSE
|
||||
dorefresh = true
|
||||
end
|
||||
@@ -550,8 +550,8 @@ class PokemonPokedexInfoScreen
|
||||
@scene = scene
|
||||
end
|
||||
|
||||
def pbStartScreen(dexlist,index,region)
|
||||
@scene.pbStartScene(dexlist,index,region)
|
||||
def pbStartScreen(dexlist, index, region)
|
||||
@scene.pbStartScene(dexlist, index, region)
|
||||
ret = @scene.pbScene
|
||||
@scene.pbEndScene
|
||||
return ret # Index of last species viewed in dexlist
|
||||
@@ -565,10 +565,10 @@ class PokemonPokedexInfoScreen
|
||||
else
|
||||
region = $PokemonGlobal.pokedexDex # National Dex -1, regional Dexes 0, 1, etc.
|
||||
end
|
||||
dexnum = pbGetRegionalNumber(region,species)
|
||||
dexnum = pbGetRegionalNumber(region, species)
|
||||
dexnumshift = Settings::DEXES_WITH_OFFSETS.include?(region)
|
||||
dexlist = [[species,GameData::Species.get(species).name,0,0,dexnum,dexnumshift]]
|
||||
@scene.pbStartScene(dexlist,0,region)
|
||||
dexlist = [[species, GameData::Species.get(species).name, 0, 0, dexnum, dexnumshift]]
|
||||
@scene.pbStartScene(dexlist, 0, region)
|
||||
@scene.pbScene
|
||||
@scene.pbEndScene
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -5,13 +5,13 @@ class Window_PokemonBag < Window_DrawableCommand
|
||||
attr_reader :pocket
|
||||
attr_accessor :sorting
|
||||
|
||||
def initialize(bag,filterlist,pocket,x,y,width,height)
|
||||
def initialize(bag, filterlist, pocket, x, y, width, height)
|
||||
@bag = bag
|
||||
@filterlist = filterlist
|
||||
@pocket = pocket
|
||||
@sorting = false
|
||||
@adapter = PokemonMartAdapter.new
|
||||
super(x,y,width,height)
|
||||
super(x, y, width, height)
|
||||
@selarrow = AnimatedBitmap.new("Graphics/Pictures/Bag/cursor")
|
||||
@swaparrow = AnimatedBitmap.new("Graphics/Pictures/Bag/cursor_swap")
|
||||
self.windowskin = nil
|
||||
@@ -24,7 +24,7 @@ class Window_PokemonBag < Window_DrawableCommand
|
||||
|
||||
def pocket=(value)
|
||||
@pocket = value
|
||||
@item_max = (@filterlist) ? @filterlist[@pocket].length+1 : @bag.pockets[@pocket].length+1
|
||||
@item_max = (@filterlist) ? @filterlist[@pocket].length + 1 : @bag.pockets[@pocket].length + 1
|
||||
self.index = @bag.last_viewed_index(@pocket)
|
||||
end
|
||||
|
||||
@@ -39,77 +39,77 @@ class Window_PokemonBag < Window_DrawableCommand
|
||||
end
|
||||
|
||||
def itemCount
|
||||
return (@filterlist) ? @filterlist[@pocket].length+1 : @bag.pockets[@pocket].length+1
|
||||
return (@filterlist) ? @filterlist[@pocket].length + 1 : @bag.pockets[@pocket].length + 1
|
||||
end
|
||||
|
||||
def itemRect(item)
|
||||
if item<0 || item>=@item_max || item<self.top_item-1 ||
|
||||
item>self.top_item+self.page_item_max
|
||||
return Rect.new(0,0,0,0)
|
||||
if item < 0 || item >= @item_max || item < self.top_item - 1 ||
|
||||
item > self.top_item + self.page_item_max
|
||||
return Rect.new(0, 0, 0, 0)
|
||||
else
|
||||
cursor_width = (self.width-self.borderX-(@column_max-1)*@column_spacing) / @column_max
|
||||
cursor_width = (self.width - self.borderX - (@column_max - 1) * @column_spacing) / @column_max
|
||||
x = item % @column_max * (cursor_width + @column_spacing)
|
||||
y = item / @column_max * @row_height - @virtualOy
|
||||
return Rect.new(x, y, cursor_width, @row_height)
|
||||
end
|
||||
end
|
||||
|
||||
def drawCursor(index,rect)
|
||||
if self.index==index
|
||||
def drawCursor(index, rect)
|
||||
if self.index == index
|
||||
bmp = (@sorting) ? @swaparrow.bitmap : @selarrow.bitmap
|
||||
pbCopyBitmap(self.contents,bmp,rect.x,rect.y+2)
|
||||
pbCopyBitmap(self.contents, bmp, rect.x, rect.y + 2)
|
||||
end
|
||||
end
|
||||
|
||||
def drawItem(index,_count,rect)
|
||||
def drawItem(index, _count, rect)
|
||||
textpos = []
|
||||
rect = Rect.new(rect.x+16,rect.y+16,rect.width-16,rect.height)
|
||||
rect = Rect.new(rect.x + 16, rect.y + 16, rect.width - 16, rect.height)
|
||||
thispocket = @bag.pockets[@pocket]
|
||||
if index==self.itemCount-1
|
||||
textpos.push([_INTL("CLOSE BAG"),rect.x,rect.y-2,false,self.baseColor,self.shadowColor])
|
||||
if index == self.itemCount - 1
|
||||
textpos.push([_INTL("CLOSE BAG"), rect.x, rect.y - 2, false, self.baseColor, self.shadowColor])
|
||||
else
|
||||
item = (@filterlist) ? thispocket[@filterlist[@pocket][index]][0] : thispocket[index][0]
|
||||
baseColor = self.baseColor
|
||||
shadowColor = self.shadowColor
|
||||
if @sorting && index==self.index
|
||||
baseColor = Color.new(224,0,0)
|
||||
shadowColor = Color.new(248,144,144)
|
||||
if @sorting && index == self.index
|
||||
baseColor = Color.new(224, 0, 0)
|
||||
shadowColor = Color.new(248, 144, 144)
|
||||
end
|
||||
textpos.push(
|
||||
[@adapter.getDisplayName(item),rect.x,rect.y-2,false,baseColor,shadowColor]
|
||||
[@adapter.getDisplayName(item), rect.x, rect.y - 2, false, baseColor, shadowColor]
|
||||
)
|
||||
if GameData::Item.get(item).is_important?
|
||||
if @bag.registered?(item)
|
||||
pbDrawImagePositions(self.contents,[
|
||||
["Graphics/Pictures/Bag/icon_register",rect.x+rect.width-72,rect.y+8,0,0,-1,24]
|
||||
pbDrawImagePositions(self.contents, [
|
||||
["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24]
|
||||
])
|
||||
elsif pbCanRegisterItem?(item)
|
||||
pbDrawImagePositions(self.contents,[
|
||||
["Graphics/Pictures/Bag/icon_register",rect.x+rect.width-72,rect.y+8,0,24,-1,24]
|
||||
pbDrawImagePositions(self.contents, [
|
||||
["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24]
|
||||
])
|
||||
end
|
||||
else
|
||||
qty = (@filterlist) ? thispocket[@filterlist[@pocket][index]][1] : thispocket[index][1]
|
||||
qtytext = _ISPRINTF("x{1: 3d}",qty)
|
||||
xQty = rect.x+rect.width-self.contents.text_size(qtytext).width-16
|
||||
textpos.push([qtytext,xQty,rect.y-2,false,baseColor,shadowColor])
|
||||
qtytext = _ISPRINTF("x{1: 3d}", qty)
|
||||
xQty = rect.x + rect.width - self.contents.text_size(qtytext).width - 16
|
||||
textpos.push([qtytext, xQty, rect.y - 2, false, baseColor, shadowColor])
|
||||
end
|
||||
end
|
||||
pbDrawTextPositions(self.contents,textpos)
|
||||
pbDrawTextPositions(self.contents, textpos)
|
||||
end
|
||||
|
||||
def refresh
|
||||
@item_max = itemCount
|
||||
self.update_cursor_rect
|
||||
dwidth = self.width-self.borderX
|
||||
dheight = self.height-self.borderY
|
||||
self.contents = pbDoEnsureBitmap(self.contents,dwidth,dheight)
|
||||
dwidth = self.width - self.borderX
|
||||
dheight = self.height - self.borderY
|
||||
self.contents = pbDoEnsureBitmap(self.contents, dwidth, dheight)
|
||||
self.contents.clear
|
||||
for i in 0...@item_max
|
||||
next if i<self.top_item-1 || i>self.top_item+self.page_item_max
|
||||
drawItem(i,@item_max,itemRect(i))
|
||||
next if i < self.top_item - 1 || i > self.top_item + self.page_item_max
|
||||
drawItem(i, @item_max, itemRect(i))
|
||||
end
|
||||
drawCursor(self.index,itemRect(self.index))
|
||||
drawCursor(self.index, itemRect(self.index))
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -123,46 +123,46 @@ end
|
||||
# Bag visuals
|
||||
#===============================================================================
|
||||
class PokemonBag_Scene
|
||||
ITEMLISTBASECOLOR = Color.new(88,88,80)
|
||||
ITEMLISTSHADOWCOLOR = Color.new(168,184,184)
|
||||
ITEMTEXTBASECOLOR = Color.new(248,248,248)
|
||||
ITEMTEXTSHADOWCOLOR = Color.new(0,0,0)
|
||||
POCKETNAMEBASECOLOR = Color.new(88,88,80)
|
||||
POCKETNAMESHADOWCOLOR = Color.new(168,184,184)
|
||||
ITEMLISTBASECOLOR = Color.new(88, 88, 80)
|
||||
ITEMLISTSHADOWCOLOR = Color.new(168, 184, 184)
|
||||
ITEMTEXTBASECOLOR = Color.new(248, 248, 248)
|
||||
ITEMTEXTSHADOWCOLOR = Color.new(0, 0, 0)
|
||||
POCKETNAMEBASECOLOR = Color.new(88, 88, 80)
|
||||
POCKETNAMESHADOWCOLOR = Color.new(168, 184, 184)
|
||||
ITEMSVISIBLE = 7
|
||||
|
||||
def pbUpdate
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
|
||||
def pbStartScene(bag,choosing = false,filterproc = nil,resetpocket = true)
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
def pbStartScene(bag, choosing = false, filterproc = nil, resetpocket = true)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@bag = bag
|
||||
@choosing = choosing
|
||||
@filterproc = filterproc
|
||||
pbRefreshFilter
|
||||
lastpocket = @bag.last_viewed_pocket
|
||||
numfilledpockets = @bag.pockets.length-1
|
||||
numfilledpockets = @bag.pockets.length - 1
|
||||
if @choosing
|
||||
numfilledpockets = 0
|
||||
if @filterlist!=nil
|
||||
if @filterlist != nil
|
||||
for i in 1...@bag.pockets.length
|
||||
numfilledpockets += 1 if @filterlist[i].length>0
|
||||
numfilledpockets += 1 if @filterlist[i].length > 0
|
||||
end
|
||||
else
|
||||
for i in 1...@bag.pockets.length
|
||||
numfilledpockets += 1 if @bag.pockets[i].length>0
|
||||
numfilledpockets += 1 if @bag.pockets[i].length > 0
|
||||
end
|
||||
end
|
||||
lastpocket = (resetpocket) ? 1 : @bag.last_viewed_pocket
|
||||
if (@filterlist && @filterlist[lastpocket].length==0) ||
|
||||
(!@filterlist && @bag.pockets[lastpocket].length==0)
|
||||
if (@filterlist && @filterlist[lastpocket].length == 0) ||
|
||||
(!@filterlist && @bag.pockets[lastpocket].length == 0)
|
||||
for i in 1...@bag.pockets.length
|
||||
if @filterlist && @filterlist[i].length>0
|
||||
if @filterlist && @filterlist[i].length > 0
|
||||
lastpocket = i
|
||||
break
|
||||
elsif !@filterlist && @bag.pockets[i].length>0
|
||||
elsif !@filterlist && @bag.pockets[i].length > 0
|
||||
lastpocket = i
|
||||
break
|
||||
end
|
||||
@@ -173,30 +173,30 @@ class PokemonBag_Scene
|
||||
@sliderbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Bag/icon_slider"))
|
||||
@pocketbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Bag/icon_pocket"))
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
@sprites["bagsprite"] = IconSprite.new(30,20,@viewport)
|
||||
@sprites["pocketicon"] = BitmapSprite.new(186,32,@viewport)
|
||||
@sprites["bagsprite"] = IconSprite.new(30, 20, @viewport)
|
||||
@sprites["pocketicon"] = BitmapSprite.new(186, 32, @viewport)
|
||||
@sprites["pocketicon"].x = 0
|
||||
@sprites["pocketicon"].y = 224
|
||||
@sprites["leftarrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow",8,40,28,2,@viewport)
|
||||
@sprites["leftarrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["leftarrow"].x = -4
|
||||
@sprites["leftarrow"].y = 76
|
||||
@sprites["leftarrow"].visible = (!@choosing || numfilledpockets>1)
|
||||
@sprites["leftarrow"].visible = (!@choosing || numfilledpockets > 1)
|
||||
@sprites["leftarrow"].play
|
||||
@sprites["rightarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow",8,40,28,2,@viewport)
|
||||
@sprites["rightarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["rightarrow"].x = 150
|
||||
@sprites["rightarrow"].y = 76
|
||||
@sprites["rightarrow"].visible = (!@choosing || numfilledpockets>1)
|
||||
@sprites["rightarrow"].visible = (!@choosing || numfilledpockets > 1)
|
||||
@sprites["rightarrow"].play
|
||||
@sprites["itemlist"] = Window_PokemonBag.new(@bag,@filterlist,lastpocket,168,-8,314,40+32+ITEMSVISIBLE*32)
|
||||
@sprites["itemlist"] = Window_PokemonBag.new(@bag, @filterlist, lastpocket, 168, -8, 314, 40 + 32 + ITEMSVISIBLE * 32)
|
||||
@sprites["itemlist"].viewport = @viewport
|
||||
@sprites["itemlist"].pocket = lastpocket
|
||||
@sprites["itemlist"].index = @bag.last_viewed_index(lastpocket)
|
||||
@sprites["itemlist"].baseColor = ITEMLISTBASECOLOR
|
||||
@sprites["itemlist"].shadowColor = ITEMLISTSHADOWCOLOR
|
||||
@sprites["itemicon"] = ItemIconSprite.new(48,Graphics.height-48,nil,@viewport)
|
||||
@sprites["itemicon"] = ItemIconSprite.new(48, Graphics.height - 48, nil, @viewport)
|
||||
@sprites["itemtext"] = Window_UnformattedTextPokemon.newWithSize("",
|
||||
72, 270, Graphics.width - 72 - 24, 128, @viewport)
|
||||
@sprites["itemtext"].baseColor = ITEMTEXTBASECOLOR
|
||||
@@ -209,7 +209,7 @@ class PokemonBag_Scene
|
||||
@sprites["msgwindow"] = Window_AdvancedTextPokemon.new("")
|
||||
@sprites["msgwindow"].visible = false
|
||||
@sprites["msgwindow"].viewport = @viewport
|
||||
pbBottomLeftLines(@sprites["helpwindow"],1)
|
||||
pbBottomLeftLines(@sprites["helpwindow"], 1)
|
||||
pbDeactivateWindows(@sprites)
|
||||
pbRefresh
|
||||
pbFadeInAndShow(@sprites)
|
||||
@@ -220,7 +220,7 @@ class PokemonBag_Scene
|
||||
end
|
||||
|
||||
def pbFadeInScene
|
||||
pbFadeInAndShow(@sprites,@oldsprites)
|
||||
pbFadeInAndShow(@sprites, @oldsprites)
|
||||
@oldsprites = nil
|
||||
end
|
||||
|
||||
@@ -237,20 +237,20 @@ class PokemonBag_Scene
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbDisplay(msg,brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"],msg,brief) { pbUpdate }
|
||||
def pbDisplay(msg, brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"], msg, brief) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbConfirm(msg)
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"],msg) { pbUpdate }
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"], msg) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbChooseNumber(helptext,maximum,initnum = 1)
|
||||
return UIHelper.pbChooseNumber(@sprites["helpwindow"],helptext,maximum,initnum) { pbUpdate }
|
||||
def pbChooseNumber(helptext, maximum, initnum = 1)
|
||||
return UIHelper.pbChooseNumber(@sprites["helpwindow"], helptext, maximum, initnum) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbShowCommands(helptext,commands,index = 0)
|
||||
return UIHelper.pbShowCommands(@sprites["helpwindow"],helptext,commands,index) { pbUpdate }
|
||||
def pbShowCommands(helptext, commands, index = 0)
|
||||
return UIHelper.pbShowCommands(@sprites["helpwindow"], helptext, commands, index) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
@@ -267,14 +267,14 @@ class PokemonBag_Scene
|
||||
@sprites["pocketicon"].bitmap.clear
|
||||
if @choosing && @filterlist
|
||||
for i in 1...@bag.pockets.length
|
||||
if @filterlist[i].length==0
|
||||
@sprites["pocketicon"].bitmap.blt(6+(i-1)*22,6,
|
||||
@pocketbitmap.bitmap,Rect.new((i-1)*20,28,20,20))
|
||||
if @filterlist[i].length == 0
|
||||
@sprites["pocketicon"].bitmap.blt(6 + (i - 1) * 22, 6,
|
||||
@pocketbitmap.bitmap, Rect.new((i - 1) * 20, 28, 20, 20))
|
||||
end
|
||||
end
|
||||
end
|
||||
@sprites["pocketicon"].bitmap.blt(2+(@sprites["itemlist"].pocket-1)*22,2,
|
||||
@pocketbitmap.bitmap,Rect.new((@sprites["itemlist"].pocket-1)*28,0,28,28))
|
||||
@sprites["pocketicon"].bitmap.blt(2 + (@sprites["itemlist"].pocket - 1) * 22, 2,
|
||||
@pocketbitmap.bitmap, Rect.new((@sprites["itemlist"].pocket - 1) * 28, 0, 28, 28))
|
||||
# Refresh the item window
|
||||
@sprites["itemlist"].refresh
|
||||
# Refresh more things
|
||||
@@ -286,35 +286,35 @@ class PokemonBag_Scene
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
# Draw the pocket name
|
||||
pbDrawTextPositions(overlay,[
|
||||
pbDrawTextPositions(overlay, [
|
||||
[PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]
|
||||
])
|
||||
# Draw slider arrows
|
||||
showslider = false
|
||||
if itemlist.top_row>0
|
||||
overlay.blt(470,16,@sliderbitmap.bitmap,Rect.new(0,0,36,38))
|
||||
if itemlist.top_row > 0
|
||||
overlay.blt(470, 16, @sliderbitmap.bitmap, Rect.new(0, 0, 36, 38))
|
||||
showslider = true
|
||||
end
|
||||
if itemlist.top_item+itemlist.page_item_max<itemlist.itemCount
|
||||
overlay.blt(470,228,@sliderbitmap.bitmap,Rect.new(0,38,36,38))
|
||||
if itemlist.top_item + itemlist.page_item_max < itemlist.itemCount
|
||||
overlay.blt(470, 228, @sliderbitmap.bitmap, Rect.new(0, 38, 36, 38))
|
||||
showslider = true
|
||||
end
|
||||
# Draw slider box
|
||||
if showslider
|
||||
sliderheight = 174
|
||||
boxheight = (sliderheight*itemlist.page_row_max/itemlist.row_max).floor
|
||||
boxheight += [(sliderheight-boxheight)/2,sliderheight/6].min
|
||||
boxheight = [boxheight.floor,38].max
|
||||
boxheight = (sliderheight * itemlist.page_row_max / itemlist.row_max).floor
|
||||
boxheight += [(sliderheight - boxheight) / 2, sliderheight / 6].min
|
||||
boxheight = [boxheight.floor, 38].max
|
||||
y = 54
|
||||
y += ((sliderheight-boxheight)*itemlist.top_row/(itemlist.row_max-itemlist.page_row_max)).floor
|
||||
overlay.blt(470,y,@sliderbitmap.bitmap,Rect.new(36,0,36,4))
|
||||
y += ((sliderheight - boxheight) * itemlist.top_row / (itemlist.row_max - itemlist.page_row_max)).floor
|
||||
overlay.blt(470, y, @sliderbitmap.bitmap, Rect.new(36, 0, 36, 4))
|
||||
i = 0
|
||||
while i*16<boxheight-4-18
|
||||
height = [boxheight-4-18-i*16,16].min
|
||||
overlay.blt(470,y+4+i*16,@sliderbitmap.bitmap,Rect.new(36,4,36,height))
|
||||
while i * 16 < boxheight - 4 - 18
|
||||
height = [boxheight - 4 - 18 - i * 16, 16].min
|
||||
overlay.blt(470, y + 4 + i * 16, @sliderbitmap.bitmap, Rect.new(36, 4, 36, height))
|
||||
i += 1
|
||||
end
|
||||
overlay.blt(470,y+boxheight-18,@sliderbitmap.bitmap,Rect.new(36,20,36,18))
|
||||
overlay.blt(470, y + boxheight - 18, @sliderbitmap.bitmap, Rect.new(36, 20, 36, 18))
|
||||
end
|
||||
# Set the selected item's icon
|
||||
@sprites["itemicon"].item = itemlist.item
|
||||
@@ -326,7 +326,7 @@ class PokemonBag_Scene
|
||||
def pbRefreshFilter
|
||||
@filterlist = nil
|
||||
return if !@choosing
|
||||
return if @filterproc==nil
|
||||
return if @filterproc == nil
|
||||
@filterlist = []
|
||||
for i in 1...@bag.pockets.length
|
||||
@filterlist[i] = []
|
||||
@@ -342,22 +342,22 @@ class PokemonBag_Scene
|
||||
itemwindow = @sprites["itemlist"]
|
||||
thispocket = @bag.pockets[itemwindow.pocket]
|
||||
swapinitialpos = -1
|
||||
pbActivateWindow(@sprites,"itemlist") {
|
||||
pbActivateWindow(@sprites, "itemlist") {
|
||||
loop do
|
||||
oldindex = itemwindow.index
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if itemwindow.sorting && itemwindow.index>=thispocket.length
|
||||
itemwindow.index = (oldindex==thispocket.length-1) ? 0 : thispocket.length-1
|
||||
if itemwindow.sorting && itemwindow.index >= thispocket.length
|
||||
itemwindow.index = (oldindex == thispocket.length - 1) ? 0 : thispocket.length - 1
|
||||
end
|
||||
if itemwindow.index!=oldindex
|
||||
if itemwindow.index != oldindex
|
||||
# Move the item being switched
|
||||
if itemwindow.sorting
|
||||
thispocket.insert(itemwindow.index,thispocket.delete_at(oldindex))
|
||||
thispocket.insert(itemwindow.index, thispocket.delete_at(oldindex))
|
||||
end
|
||||
# Update selected item for current pocket
|
||||
@bag.set_last_viewed_index(itemwindow.pocket,itemwindow.index)
|
||||
@bag.set_last_viewed_index(itemwindow.pocket, itemwindow.index)
|
||||
pbRefresh
|
||||
end
|
||||
if itemwindow.sorting
|
||||
@@ -367,7 +367,7 @@ class PokemonBag_Scene
|
||||
pbPlayDecisionSE
|
||||
pbRefresh
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
thispocket.insert(swapinitialpos,thispocket.delete_at(itemwindow.index))
|
||||
thispocket.insert(swapinitialpos, thispocket.delete_at(itemwindow.index))
|
||||
itemwindow.index = swapinitialpos
|
||||
itemwindow.sorting = false
|
||||
pbPlayCancelSE
|
||||
@@ -378,15 +378,15 @@ class PokemonBag_Scene
|
||||
if Input.trigger?(Input::LEFT)
|
||||
newpocket = itemwindow.pocket
|
||||
loop do
|
||||
newpocket = (newpocket==1) ? PokemonBag.pocket_count : newpocket-1
|
||||
break if !@choosing || newpocket==itemwindow.pocket
|
||||
newpocket = (newpocket == 1) ? PokemonBag.pocket_count : newpocket - 1
|
||||
break if !@choosing || newpocket == itemwindow.pocket
|
||||
if @filterlist
|
||||
break if @filterlist[newpocket].length>0
|
||||
break if @filterlist[newpocket].length > 0
|
||||
else
|
||||
break if @bag.pockets[newpocket].length>0
|
||||
break if @bag.pockets[newpocket].length > 0
|
||||
end
|
||||
end
|
||||
if itemwindow.pocket!=newpocket
|
||||
if itemwindow.pocket != newpocket
|
||||
itemwindow.pocket = newpocket
|
||||
@bag.last_viewed_pocket = itemwindow.pocket
|
||||
thispocket = @bag.pockets[itemwindow.pocket]
|
||||
@@ -396,15 +396,15 @@ class PokemonBag_Scene
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
newpocket = itemwindow.pocket
|
||||
loop do
|
||||
newpocket = (newpocket==PokemonBag.pocket_count) ? 1 : newpocket+1
|
||||
break if !@choosing || newpocket==itemwindow.pocket
|
||||
newpocket = (newpocket == PokemonBag.pocket_count) ? 1 : newpocket + 1
|
||||
break if !@choosing || newpocket == itemwindow.pocket
|
||||
if @filterlist
|
||||
break if @filterlist[newpocket].length>0
|
||||
break if @filterlist[newpocket].length > 0
|
||||
else
|
||||
break if @bag.pockets[newpocket].length>0
|
||||
break if @bag.pockets[newpocket].length > 0
|
||||
end
|
||||
end
|
||||
if itemwindow.pocket!=newpocket
|
||||
if itemwindow.pocket != newpocket
|
||||
itemwindow.pocket = newpocket
|
||||
@bag.last_viewed_pocket = itemwindow.pocket
|
||||
thispocket = @bag.pockets[itemwindow.pocket]
|
||||
@@ -423,7 +423,7 @@ class PokemonBag_Scene
|
||||
# end
|
||||
elsif Input.trigger?(Input::ACTION) # Start switching the selected item
|
||||
if !@choosing
|
||||
if thispocket.length>1 && itemwindow.index<thispocket.length &&
|
||||
if thispocket.length > 1 && itemwindow.index < thispocket.length &&
|
||||
!Settings::BAG_POCKET_AUTO_SORT[itemwindow.pocket - 1]
|
||||
itemwindow.sorting = true
|
||||
swapinitialpos = itemwindow.index
|
||||
@@ -448,7 +448,7 @@ end
|
||||
# Bag mechanics
|
||||
#===============================================================================
|
||||
class PokemonBagScreen
|
||||
def initialize(scene,bag)
|
||||
def initialize(scene, bag)
|
||||
@bag = bag
|
||||
@scene = scene
|
||||
end
|
||||
@@ -468,8 +468,8 @@ class PokemonBagScreen
|
||||
cmdDebug = -1
|
||||
commands = []
|
||||
# Generate command list
|
||||
commands[cmdRead = commands.length] = _INTL("Read") if itm.is_mail?
|
||||
if ItemHandlers.hasOutHandler(item) || (itm.is_machine? && $player.party.length>0)
|
||||
commands[cmdRead = commands.length] = _INTL("Read") if itm.is_mail?
|
||||
if ItemHandlers.hasOutHandler(item) || (itm.is_machine? && $player.party.length > 0)
|
||||
if ItemHandlers.hasUseText(item)
|
||||
commands[cmdUse = commands.length] = ItemHandlers.getUseText(item)
|
||||
else
|
||||
@@ -487,22 +487,22 @@ class PokemonBagScreen
|
||||
commands[commands.length] = _INTL("Cancel")
|
||||
# Show commands generated above
|
||||
itemname = itm.name
|
||||
command = @scene.pbShowCommands(_INTL("{1} is selected.",itemname),commands)
|
||||
if cmdRead>=0 && command==cmdRead # Read mail
|
||||
command = @scene.pbShowCommands(_INTL("{1} is selected.", itemname), commands)
|
||||
if cmdRead >= 0 && command == cmdRead # Read mail
|
||||
pbFadeOutIn {
|
||||
pbDisplayMail(Mail.new(item, "", ""))
|
||||
}
|
||||
elsif cmdUse>=0 && command==cmdUse # Use item
|
||||
ret = pbUseItem(@bag,item,@scene)
|
||||
elsif cmdUse >= 0 && command == cmdUse # Use item
|
||||
ret = pbUseItem(@bag, item, @scene)
|
||||
# ret: 0=Item wasn't used; 1=Item used; 2=Close Bag to use in field
|
||||
break if ret==2 # End screen
|
||||
break if ret == 2 # End screen
|
||||
@scene.pbRefresh
|
||||
next
|
||||
elsif cmdGive>=0 && command==cmdGive # Give item to Pokémon
|
||||
elsif cmdGive >= 0 && command == cmdGive # Give item to Pokémon
|
||||
if $player.pokemon_count == 0
|
||||
@scene.pbDisplay(_INTL("There is no Pokémon."))
|
||||
elsif itm.is_important?
|
||||
@scene.pbDisplay(_INTL("The {1} can't be held.",itemname))
|
||||
@scene.pbDisplay(_INTL("The {1} can't be held.", itemname))
|
||||
else
|
||||
pbFadeOutIn {
|
||||
sscene = PokemonParty_Scene.new
|
||||
@@ -511,35 +511,35 @@ class PokemonBagScreen
|
||||
@scene.pbRefresh
|
||||
}
|
||||
end
|
||||
elsif cmdToss>=0 && command==cmdToss # Toss item
|
||||
elsif cmdToss >= 0 && command == cmdToss # Toss item
|
||||
qty = @bag.quantity(item)
|
||||
if qty>1
|
||||
helptext = _INTL("Toss out how many {1}?",itm.name_plural)
|
||||
qty = @scene.pbChooseNumber(helptext,qty)
|
||||
if qty > 1
|
||||
helptext = _INTL("Toss out how many {1}?", itm.name_plural)
|
||||
qty = @scene.pbChooseNumber(helptext, qty)
|
||||
end
|
||||
if qty>0
|
||||
itemname = itm.name_plural if qty>1
|
||||
if pbConfirm(_INTL("Is it OK to throw away {1} {2}?",qty,itemname))
|
||||
pbDisplay(_INTL("Threw away {1} {2}.",qty,itemname))
|
||||
if qty > 0
|
||||
itemname = itm.name_plural if qty > 1
|
||||
if pbConfirm(_INTL("Is it OK to throw away {1} {2}?", qty, itemname))
|
||||
pbDisplay(_INTL("Threw away {1} {2}.", qty, itemname))
|
||||
qty.times { @bag.remove(item) }
|
||||
@scene.pbRefresh
|
||||
end
|
||||
end
|
||||
elsif cmdRegister>=0 && command==cmdRegister # Register item
|
||||
elsif cmdRegister >= 0 && command == cmdRegister # Register item
|
||||
if @bag.registered?(item)
|
||||
@bag.unregister(item)
|
||||
else
|
||||
@bag.register(item)
|
||||
end
|
||||
@scene.pbRefresh
|
||||
elsif cmdDebug>=0 && command==cmdDebug # Debug
|
||||
elsif cmdDebug >= 0 && command == cmdDebug # Debug
|
||||
command = 0
|
||||
loop do
|
||||
command = @scene.pbShowCommands(_INTL("Do what with {1}?",itemname),[
|
||||
command = @scene.pbShowCommands(_INTL("Do what with {1}?", itemname), [
|
||||
_INTL("Change quantity"),
|
||||
_INTL("Make Mystery Gift"),
|
||||
_INTL("Cancel")
|
||||
],command)
|
||||
], command)
|
||||
case command
|
||||
### Cancel ###
|
||||
when -1, 2
|
||||
@@ -552,17 +552,17 @@ class PokemonBagScreen
|
||||
params.setRange(0, Settings::BAG_MAX_PER_SLOT)
|
||||
params.setDefaultValue(qty)
|
||||
newqty = pbMessageChooseNumber(
|
||||
_INTL("Choose new quantity of {1} (max. #{Settings::BAG_MAX_PER_SLOT}).",itemplural),params) { @scene.pbUpdate }
|
||||
if newqty>qty
|
||||
_INTL("Choose new quantity of {1} (max. #{Settings::BAG_MAX_PER_SLOT}).", itemplural), params) { @scene.pbUpdate }
|
||||
if newqty > qty
|
||||
@bag.add(item, newqty - qty)
|
||||
elsif newqty<qty
|
||||
elsif newqty < qty
|
||||
@bag.remove(item, qty - newqty)
|
||||
end
|
||||
@scene.pbRefresh
|
||||
break if newqty==0
|
||||
break if newqty == 0
|
||||
### Make Mystery Gift ###
|
||||
when 1
|
||||
pbCreateMysteryGift(1,item)
|
||||
pbCreateMysteryGift(1, item)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -583,7 +583,7 @@ class PokemonBagScreen
|
||||
def pbChooseItemScreen(proc = nil)
|
||||
oldlastpocket = @bag.last_viewed_pocket
|
||||
oldchoices = @bag.last_pocket_selections.clone
|
||||
@scene.pbStartScene(@bag,true,proc)
|
||||
@scene.pbStartScene(@bag, true, proc)
|
||||
item = @scene.pbChooseItem
|
||||
@scene.pbEndScene
|
||||
@bag.last_viewed_pocket = oldlastpocket
|
||||
@@ -603,21 +603,21 @@ class PokemonBagScreen
|
||||
break if !item
|
||||
itm = GameData::Item.get(item)
|
||||
qty = storage.quantity(item)
|
||||
if qty>1 && !itm.is_important?
|
||||
qty = @scene.pbChooseNumber(_INTL("How many do you want to withdraw?"),qty)
|
||||
if qty > 1 && !itm.is_important?
|
||||
qty = @scene.pbChooseNumber(_INTL("How many do you want to withdraw?"), qty)
|
||||
end
|
||||
next if qty<=0
|
||||
if @bag.can_add?(item,qty)
|
||||
if !storage.remove(item,qty)
|
||||
next if qty <= 0
|
||||
if @bag.can_add?(item, qty)
|
||||
if !storage.remove(item, qty)
|
||||
raise "Can't delete items from storage"
|
||||
end
|
||||
if !@bag.add(item,qty)
|
||||
if !@bag.add(item, qty)
|
||||
raise "Can't withdraw items from storage"
|
||||
end
|
||||
@scene.pbRefresh
|
||||
dispqty = (itm.is_important?) ? 1 : qty
|
||||
itemname = (dispqty>1) ? itm.name_plural : itm.name
|
||||
pbDisplay(_INTL("Withdrew {1} {2}.",dispqty,itemname))
|
||||
itemname = (dispqty > 1) ? itm.name_plural : itm.name
|
||||
pbDisplay(_INTL("Withdrew {1} {2}.", dispqty, itemname))
|
||||
else
|
||||
pbDisplay(_INTL("There's no more room in the Bag."))
|
||||
end
|
||||
@@ -637,23 +637,23 @@ class PokemonBagScreen
|
||||
break if !item
|
||||
itm = GameData::Item.get(item)
|
||||
qty = @bag.quantity(item)
|
||||
if qty>1 && !itm.is_important?
|
||||
qty = @scene.pbChooseNumber(_INTL("How many do you want to deposit?"),qty)
|
||||
if qty > 1 && !itm.is_important?
|
||||
qty = @scene.pbChooseNumber(_INTL("How many do you want to deposit?"), qty)
|
||||
end
|
||||
if qty>0
|
||||
if !storage.can_add?(item,qty)
|
||||
if qty > 0
|
||||
if !storage.can_add?(item, qty)
|
||||
pbDisplay(_INTL("There's no room to store items."))
|
||||
else
|
||||
if !@bag.remove(item,qty)
|
||||
if !@bag.remove(item, qty)
|
||||
raise "Can't delete items from Bag"
|
||||
end
|
||||
if !storage.add(item,qty)
|
||||
if !storage.add(item, qty)
|
||||
raise "Can't deposit items to storage"
|
||||
end
|
||||
@scene.pbRefresh
|
||||
dispqty = (itm.is_important?) ? 1 : qty
|
||||
itemname = (dispqty>1) ? itm.name_plural : itm.name
|
||||
pbDisplay(_INTL("Deposited {1} {2}.",dispqty,itemname))
|
||||
itemname = (dispqty > 1) ? itm.name_plural : itm.name
|
||||
pbDisplay(_INTL("Deposited {1} {2}.", dispqty, itemname))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -678,17 +678,17 @@ class PokemonBagScreen
|
||||
qty = storage.quantity(item)
|
||||
itemname = itm.name
|
||||
itemnameplural = itm.name_plural
|
||||
if qty>1
|
||||
qty=@scene.pbChooseNumber(_INTL("Toss out how many {1}?",itemnameplural),qty)
|
||||
if qty > 1
|
||||
qty = @scene.pbChooseNumber(_INTL("Toss out how many {1}?", itemnameplural), qty)
|
||||
end
|
||||
if qty>0
|
||||
itemname = itemnameplural if qty>1
|
||||
if pbConfirm(_INTL("Is it OK to throw away {1} {2}?",qty,itemname))
|
||||
if !storage.remove(item,qty)
|
||||
if qty > 0
|
||||
itemname = itemnameplural if qty > 1
|
||||
if pbConfirm(_INTL("Is it OK to throw away {1} {2}?", qty, itemname))
|
||||
if !storage.remove(item, qty)
|
||||
raise "Can't delete items from storage"
|
||||
end
|
||||
@scene.pbRefresh
|
||||
pbDisplay(_INTL("Threw away {1} {2}.",qty,itemname))
|
||||
pbDisplay(_INTL("Threw away {1} {2}.", qty, itemname))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class PokegearButton < SpriteWrapper
|
||||
attr_reader :name
|
||||
attr_reader :selected
|
||||
|
||||
def initialize(command,x,y,viewport = nil)
|
||||
def initialize(command, x, y, viewport = nil)
|
||||
super(viewport)
|
||||
@image = command[0]
|
||||
@name = command[1]
|
||||
@@ -16,7 +16,7 @@ class PokegearButton < SpriteWrapper
|
||||
else
|
||||
@button = AnimatedBitmap.new("Graphics/Pictures/Pokegear/icon_button")
|
||||
end
|
||||
@contents = BitmapWrapper.new(@button.width,@button.height)
|
||||
@contents = BitmapWrapper.new(@button.width, @button.height)
|
||||
self.bitmap = @contents
|
||||
self.x = x
|
||||
self.y = y
|
||||
@@ -33,22 +33,22 @@ class PokegearButton < SpriteWrapper
|
||||
def selected=(val)
|
||||
oldsel = @selected
|
||||
@selected = val
|
||||
refresh if oldsel!=val
|
||||
refresh if oldsel != val
|
||||
end
|
||||
|
||||
def refresh
|
||||
self.bitmap.clear
|
||||
rect = Rect.new(0,0,@button.width,@button.height/2)
|
||||
rect.y = @button.height/2 if @selected
|
||||
self.bitmap.blt(0,0,@button.bitmap,rect)
|
||||
rect = Rect.new(0, 0, @button.width, @button.height / 2)
|
||||
rect.y = @button.height / 2 if @selected
|
||||
self.bitmap.blt(0, 0, @button.bitmap, rect)
|
||||
textpos = [
|
||||
[@name,self.bitmap.width/2,4,2,Color.new(248,248,248),Color.new(40,40,40)],
|
||||
[@name, self.bitmap.width / 2, 4, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)],
|
||||
]
|
||||
pbDrawTextPositions(self.bitmap,textpos)
|
||||
pbDrawTextPositions(self.bitmap, textpos)
|
||||
imagepos = [
|
||||
[sprintf("Graphics/Pictures/Pokegear/icon_"+@image),18,10]
|
||||
[sprintf("Graphics/Pictures/Pokegear/icon_" + @image), 18, 10]
|
||||
]
|
||||
pbDrawImagePositions(self.bitmap,imagepos)
|
||||
pbDrawImagePositions(self.bitmap, imagepos)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -58,7 +58,7 @@ end
|
||||
class PokemonPokegear_Scene
|
||||
def pbUpdate
|
||||
for i in 0...@commands.length
|
||||
@sprites["button#{i}"].selected = (i==@index)
|
||||
@sprites["button#{i}"].selected = (i == @index)
|
||||
end
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
@@ -66,18 +66,18 @@ class PokemonPokegear_Scene
|
||||
def pbStartScene(commands)
|
||||
@commands = commands
|
||||
@index = 0
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
if $player.female? && pbResolveBitmap(sprintf("Graphics/Pictures/Pokegear/bg_f"))
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg_f")
|
||||
else
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/Pokegear/bg")
|
||||
end
|
||||
for i in 0...@commands.length
|
||||
y = 196 - (@commands.length*24) + (i*48)
|
||||
@sprites["button#{i}"] = PokegearButton.new(@commands[i],118,y,@viewport)
|
||||
y = 196 - (@commands.length * 24) + (i * 48)
|
||||
@sprites["button#{i}"] = PokegearButton.new(@commands[i], 118, y, @viewport)
|
||||
end
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
@@ -96,13 +96,13 @@ class PokemonPokegear_Scene
|
||||
ret = @index
|
||||
break
|
||||
elsif Input.trigger?(Input::UP)
|
||||
pbPlayCursorSE if @commands.length>1
|
||||
pbPlayCursorSE if @commands.length > 1
|
||||
@index -= 1
|
||||
@index = @commands.length-1 if @index<0
|
||||
@index = @commands.length - 1 if @index < 0
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
pbPlayCursorSE if @commands.length>1
|
||||
pbPlayCursorSE if @commands.length > 1
|
||||
@index += 1
|
||||
@index = 0 if @index>=@commands.length
|
||||
@index = 0 if @index >= @commands.length
|
||||
end
|
||||
end
|
||||
return ret
|
||||
@@ -132,17 +132,17 @@ class PokemonPokegearScreen
|
||||
cmdMap = -1
|
||||
cmdPhone = -1
|
||||
cmdJukebox = -1
|
||||
commands[cmdMap = commands.length] = ["map",_INTL("Map")]
|
||||
if $PokemonGlobal.phoneNumbers && $PokemonGlobal.phoneNumbers.length>0
|
||||
commands[cmdPhone = commands.length] = ["phone",_INTL("Phone")]
|
||||
commands[cmdMap = commands.length] = ["map", _INTL("Map")]
|
||||
if $PokemonGlobal.phoneNumbers && $PokemonGlobal.phoneNumbers.length > 0
|
||||
commands[cmdPhone = commands.length] = ["phone", _INTL("Phone")]
|
||||
end
|
||||
commands[cmdJukebox = commands.length] = ["jukebox",_INTL("Jukebox")]
|
||||
commands[cmdJukebox = commands.length] = ["jukebox", _INTL("Jukebox")]
|
||||
@scene.pbStartScene(commands)
|
||||
loop do
|
||||
cmd = @scene.pbScene
|
||||
if cmd<0
|
||||
if cmd < 0
|
||||
break
|
||||
elsif cmdMap>=0 && cmd==cmdMap
|
||||
elsif cmdMap >= 0 && cmd == cmdMap
|
||||
pbFadeOutIn {
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
@@ -153,11 +153,11 @@ class PokemonPokegearScreen
|
||||
end
|
||||
}
|
||||
break if $game_temp.fly_destination
|
||||
elsif cmdPhone>=0 && cmd==cmdPhone
|
||||
elsif cmdPhone >= 0 && cmd == cmdPhone
|
||||
pbFadeOutIn {
|
||||
PokemonPhoneScene.new.start
|
||||
}
|
||||
elsif cmdJukebox>=0 && cmd==cmdJukebox
|
||||
elsif cmdJukebox >= 0 && cmd == cmdJukebox
|
||||
pbFadeOutIn {
|
||||
scene = PokemonJukebox_Scene.new
|
||||
screen = PokemonJukeboxScreen.new(scene)
|
||||
|
||||
@@ -177,13 +177,13 @@ class PokemonRegionMap_Scene
|
||||
|
||||
# TODO: Why is this PBS file writer here?
|
||||
def pbSaveMapData
|
||||
File.open("PBS/town_map.txt","wb") { |f|
|
||||
File.open("PBS/town_map.txt", "wb") { |f|
|
||||
Compiler.add_PBS_header_to_file(f)
|
||||
for i in 0...@map_data.length
|
||||
map = @map_data[i]
|
||||
next if !map
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(sprintf("[%d]\r\n",i))
|
||||
f.write(sprintf("[%d]\r\n", i))
|
||||
f.write(sprintf("Name = %s\r\nFilename = %s\r\n",
|
||||
Compiler.csvQuote(map[0]), Compiler.csvQuote(map[1])))
|
||||
for loc in map[2]
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
# Phone screen
|
||||
#===============================================================================
|
||||
class Window_PhoneList < Window_CommandPokemon
|
||||
def drawCursor(index,rect)
|
||||
def drawCursor(index, rect)
|
||||
selarrow = AnimatedBitmap.new("Graphics/Pictures/phoneSel")
|
||||
if self.index==index
|
||||
pbCopyBitmap(self.contents,selarrow.bitmap,rect.x,rect.y)
|
||||
if self.index == index
|
||||
pbCopyBitmap(self.contents, selarrow.bitmap, rect.x, rect.y)
|
||||
end
|
||||
return Rect.new(rect.x+28,rect.y+8,rect.width-16,rect.height)
|
||||
return Rect.new(rect.x + 28, rect.y + 8, rect.width - 16, rect.height)
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
return if index>=self.top_row+self.page_item_max
|
||||
def drawItem(index, count, rect)
|
||||
return if index >= self.top_row + self.page_item_max
|
||||
super
|
||||
drawCursor(index-1,itemRect(index-1))
|
||||
drawCursor(index - 1, itemRect(index - 1))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,48 +27,48 @@ class PokemonPhoneScene
|
||||
if $PokemonGlobal.phoneNumbers
|
||||
for num in $PokemonGlobal.phoneNumbers
|
||||
if num[0] # if visible
|
||||
if num.length==8 # if trainer
|
||||
@trainers.push([num[1],num[2],num[6],(num[4]>=2)])
|
||||
if num.length == 8 # if trainer
|
||||
@trainers.push([num[1], num[2], num[6], (num[4] >= 2)])
|
||||
else # if NPC
|
||||
@trainers.push([num[1],num[2],num[3]])
|
||||
@trainers.push([num[1], num[2], num[3]])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if @trainers.length==0
|
||||
if @trainers.length == 0
|
||||
pbMessage(_INTL("There are no phone numbers stored."))
|
||||
return
|
||||
end
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites["list"] = Window_PhoneList.newEmpty(152,32,Graphics.width-142,Graphics.height-80,@viewport)
|
||||
@sprites["list"] = Window_PhoneList.newEmpty(152, 32, Graphics.width - 142, Graphics.height - 80, @viewport)
|
||||
@sprites["header"] = Window_UnformattedTextPokemon.newWithSize(_INTL("Phone"),
|
||||
2,-18,128,64,@viewport)
|
||||
@sprites["header"].baseColor = Color.new(248,248,248)
|
||||
@sprites["header"].shadowColor = Color.new(0,0,0)
|
||||
2, -18, 128, 64, @viewport)
|
||||
@sprites["header"].baseColor = Color.new(248, 248, 248)
|
||||
@sprites["header"].shadowColor = Color.new(0, 0, 0)
|
||||
mapname = (@trainers[0][2]) ? pbGetMapNameFromId(@trainers[0][2]) : ""
|
||||
@sprites["bottom"] = Window_AdvancedTextPokemon.newWithSize("",
|
||||
162,Graphics.height-64,Graphics.width-158,64,@viewport)
|
||||
@sprites["bottom"].text = "<ac>"+mapname
|
||||
@sprites["info"] = Window_AdvancedTextPokemon.newWithSize("",-8,224,180,160,@viewport)
|
||||
addBackgroundPlane(@sprites,"bg","phonebg",@viewport)
|
||||
@sprites["icon"] = IconSprite.new(70,102,@viewport)
|
||||
if @trainers[0].length==4
|
||||
162, Graphics.height - 64, Graphics.width - 158, 64, @viewport)
|
||||
@sprites["bottom"].text = "<ac>" + mapname
|
||||
@sprites["info"] = Window_AdvancedTextPokemon.newWithSize("", -8, 224, 180, 160, @viewport)
|
||||
addBackgroundPlane(@sprites, "bg", "phonebg", @viewport)
|
||||
@sprites["icon"] = IconSprite.new(70, 102, @viewport)
|
||||
if @trainers[0].length == 4
|
||||
filename = GameData::TrainerType.charset_filename(@trainers[0][0])
|
||||
else
|
||||
filename = sprintf("Graphics/Characters/phone%03d",@trainers[0][0])
|
||||
filename = sprintf("Graphics/Characters/phone%03d", @trainers[0][0])
|
||||
end
|
||||
@sprites["icon"].setBitmap(filename)
|
||||
charwidth = @sprites["icon"].bitmap.width
|
||||
charheight = @sprites["icon"].bitmap.height
|
||||
@sprites["icon"].x = 86-charwidth/8
|
||||
@sprites["icon"].y = 134-charheight/8
|
||||
@sprites["icon"].src_rect = Rect.new(0,0,charwidth/4,charheight/4)
|
||||
@sprites["icon"].x = 86 - charwidth / 8
|
||||
@sprites["icon"].y = 134 - charheight / 8
|
||||
@sprites["icon"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4)
|
||||
for trainer in @trainers
|
||||
if trainer.length==4
|
||||
if trainer.length == 4
|
||||
displayname = _INTL("{1} {2}", GameData::TrainerType.get(trainer[0]).name,
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames,trainer[1])
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames, trainer[1])
|
||||
)
|
||||
commands.push(displayname) # trainer's display name
|
||||
else
|
||||
@@ -77,11 +77,11 @@ class PokemonPhoneScene
|
||||
end
|
||||
@sprites["list"].commands = commands
|
||||
for i in 0...@sprites["list"].page_item_max
|
||||
@sprites["rematch[#{i}]"] = IconSprite.new(468,62+i*32,@viewport)
|
||||
j = i+@sprites["list"].top_item
|
||||
next if j>=commands.length
|
||||
@sprites["rematch[#{i}]"] = IconSprite.new(468, 62 + i * 32, @viewport)
|
||||
j = i + @sprites["list"].top_item
|
||||
next if j >= commands.length
|
||||
trainer = @trainers[j]
|
||||
if trainer.length==4
|
||||
if trainer.length == 4
|
||||
if trainer[3]
|
||||
@sprites["rematch[#{i}]"].setBitmap("Graphics/Pictures/phoneRematch")
|
||||
end
|
||||
@@ -89,42 +89,42 @@ class PokemonPhoneScene
|
||||
end
|
||||
rematchcount = 0
|
||||
for trainer in @trainers
|
||||
if trainer.length==4
|
||||
if trainer.length == 4
|
||||
rematchcount += 1 if trainer[3]
|
||||
end
|
||||
end
|
||||
infotext = _INTL("Registered<br>")
|
||||
infotext += _INTL(" <r>{1}<br>",@sprites["list"].commands.length)
|
||||
infotext += _INTL("Waiting for a rematch<r>{1}",rematchcount)
|
||||
infotext += _INTL(" <r>{1}<br>", @sprites["list"].commands.length)
|
||||
infotext += _INTL("Waiting for a rematch<r>{1}", rematchcount)
|
||||
@sprites["info"].text = infotext
|
||||
pbFadeInAndShow(@sprites)
|
||||
pbActivateWindow(@sprites,"list") {
|
||||
pbActivateWindow(@sprites, "list") {
|
||||
oldindex = -1
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
if @sprites["list"].index!=oldindex
|
||||
if @sprites["list"].index != oldindex
|
||||
trainer = @trainers[@sprites["list"].index]
|
||||
if trainer.length==4
|
||||
if trainer.length == 4
|
||||
filename = GameData::TrainerType.charset_filename(trainer[0])
|
||||
else
|
||||
filename = sprintf("Graphics/Characters/phone%03d",trainer[0])
|
||||
filename = sprintf("Graphics/Characters/phone%03d", trainer[0])
|
||||
end
|
||||
@sprites["icon"].setBitmap(filename)
|
||||
charwidth = @sprites["icon"].bitmap.width
|
||||
charheight = @sprites["icon"].bitmap.height
|
||||
@sprites["icon"].x = 86-charwidth/8
|
||||
@sprites["icon"].y = 134-charheight/8
|
||||
@sprites["icon"].src_rect = Rect.new(0,0,charwidth/4,charheight/4)
|
||||
@sprites["icon"].x = 86 - charwidth / 8
|
||||
@sprites["icon"].y = 134 - charheight / 8
|
||||
@sprites["icon"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4)
|
||||
mapname = (trainer[2]) ? pbGetMapNameFromId(trainer[2]) : ""
|
||||
@sprites["bottom"].text = "<ac>"+mapname
|
||||
@sprites["bottom"].text = "<ac>" + mapname
|
||||
for i in 0...@sprites["list"].page_item_max
|
||||
@sprites["rematch[#{i}]"].clearBitmaps
|
||||
j = i+@sprites["list"].top_item
|
||||
next if j>=commands.length
|
||||
j = i + @sprites["list"].top_item
|
||||
next if j >= commands.length
|
||||
trainer = @trainers[j]
|
||||
if trainer.length==4
|
||||
if trainer.length == 4
|
||||
if trainer[3]
|
||||
@sprites["rematch[#{i}]"].setBitmap("Graphics/Pictures/phoneRematch")
|
||||
end
|
||||
@@ -136,8 +136,8 @@ class PokemonPhoneScene
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
index = @sprites["list"].index
|
||||
if index>=0
|
||||
pbCallTrainer(@trainers[index][0],@trainers[index][1])
|
||||
if index >= 0
|
||||
pbCallTrainer(@trainers[index][0], @trainers[index][1])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,18 +8,18 @@ class PokemonJukebox_Scene
|
||||
|
||||
def pbStartScene(commands)
|
||||
@commands = commands
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/jukeboxbg")
|
||||
@sprites["header"] = Window_UnformattedTextPokemon.newWithSize(
|
||||
_INTL("Jukebox"),2,-18,128,64,@viewport)
|
||||
@sprites["header"].baseColor = Color.new(248,248,248)
|
||||
@sprites["header"].shadowColor = Color.new(0,0,0)
|
||||
_INTL("Jukebox"), 2, -18, 128, 64, @viewport)
|
||||
@sprites["header"].baseColor = Color.new(248, 248, 248)
|
||||
@sprites["header"].shadowColor = Color.new(0, 0, 0)
|
||||
@sprites["header"].windowskin = nil
|
||||
@sprites["commands"] = Window_CommandPokemon.newWithSize(@commands,
|
||||
94,92,324,224,@viewport)
|
||||
94, 92, 324, 224, @viewport)
|
||||
@sprites["commands"].windowskin = nil
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
@@ -40,7 +40,7 @@ class PokemonJukebox_Scene
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbSetCommands(newcommands,newindex)
|
||||
def pbSetCommands(newcommands, newindex)
|
||||
@sprites["commands"].commands = (!newcommands) ? @commands : newcommands
|
||||
@sprites["commands"].index = newindex
|
||||
end
|
||||
@@ -74,25 +74,25 @@ class PokemonJukeboxScreen
|
||||
@scene.pbStartScene(commands)
|
||||
loop do
|
||||
cmd = @scene.pbScene
|
||||
if cmd<0
|
||||
if cmd < 0
|
||||
pbPlayCloseMenuSE
|
||||
break
|
||||
elsif cmdMarch>=0 && cmd==cmdMarch
|
||||
elsif cmdMarch >= 0 && cmd == cmdMarch
|
||||
pbPlayDecisionSE
|
||||
pbBGMPlay("Radio - March", 100, 100)
|
||||
$PokemonMap.whiteFluteUsed = true if $PokemonMap
|
||||
$PokemonMap.blackFluteUsed = false if $PokemonMap
|
||||
elsif cmdLullaby>=0 && cmd==cmdLullaby
|
||||
elsif cmdLullaby >= 0 && cmd == cmdLullaby
|
||||
pbPlayDecisionSE
|
||||
pbBGMPlay("Radio - Lullaby", 100, 100)
|
||||
$PokemonMap.blackFluteUsed = true if $PokemonMap
|
||||
$PokemonMap.whiteFluteUsed = false if $PokemonMap
|
||||
elsif cmdOak>=0 && cmd==cmdOak
|
||||
elsif cmdOak >= 0 && cmd == cmdOak
|
||||
pbPlayDecisionSE
|
||||
pbBGMPlay("Radio - Oak", 100, 100)
|
||||
$PokemonMap.whiteFluteUsed = false if $PokemonMap
|
||||
$PokemonMap.blackFluteUsed = false if $PokemonMap
|
||||
elsif cmdCustom>=0 && cmd==cmdCustom
|
||||
elsif cmdCustom >= 0 && cmd == cmdCustom
|
||||
pbPlayDecisionSE
|
||||
files = [_INTL("(Default)")]
|
||||
Dir.chdir("Audio/BGM/") {
|
||||
@@ -107,13 +107,13 @@ class PokemonJukeboxScreen
|
||||
Dir.glob("*.midi") { |f| files.push(f) }
|
||||
Dir.glob("*.MIDI") { |f| files.push(f) }
|
||||
}
|
||||
@scene.pbSetCommands(files,0)
|
||||
@scene.pbSetCommands(files, 0)
|
||||
loop do
|
||||
cmd2 = @scene.pbScene
|
||||
if cmd2<0
|
||||
if cmd2 < 0
|
||||
pbPlayCancelSE
|
||||
break
|
||||
elsif cmd2==0
|
||||
elsif cmd2 == 0
|
||||
pbPlayDecisionSE
|
||||
$game_system.setDefaultBGM(nil)
|
||||
$PokemonMap.whiteFluteUsed = false if $PokemonMap
|
||||
@@ -125,7 +125,7 @@ class PokemonJukeboxScreen
|
||||
$PokemonMap.blackFluteUsed = false if $PokemonMap
|
||||
end
|
||||
end
|
||||
@scene.pbSetCommands(nil,cmdCustom)
|
||||
@scene.pbSetCommands(nil, cmdCustom)
|
||||
else # Exit
|
||||
pbPlayCloseMenuSE
|
||||
break
|
||||
|
||||
@@ -7,28 +7,28 @@ class PokemonTrainerCard_Scene
|
||||
end
|
||||
|
||||
def pbStartScene
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
background = pbResolveBitmap(sprintf("Graphics/Pictures/Trainer Card/bg_f"))
|
||||
if $player.female? && background
|
||||
addBackgroundPlane(@sprites,"bg","Trainer Card/bg_f",@viewport)
|
||||
addBackgroundPlane(@sprites, "bg", "Trainer Card/bg_f", @viewport)
|
||||
else
|
||||
addBackgroundPlane(@sprites,"bg","Trainer Card/bg",@viewport)
|
||||
addBackgroundPlane(@sprites, "bg", "Trainer Card/bg", @viewport)
|
||||
end
|
||||
cardexists = pbResolveBitmap(sprintf("Graphics/Pictures/Trainer Card/card_f"))
|
||||
@sprites["card"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["card"] = IconSprite.new(0, 0, @viewport)
|
||||
if $player.female? && cardexists
|
||||
@sprites["card"].setBitmap("Graphics/Pictures/Trainer Card/card_f")
|
||||
else
|
||||
@sprites["card"].setBitmap("Graphics/Pictures/Trainer Card/card")
|
||||
end
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
@sprites["trainer"] = IconSprite.new(336,112,@viewport)
|
||||
@sprites["trainer"] = IconSprite.new(336, 112, @viewport)
|
||||
@sprites["trainer"].setBitmap(GameData::TrainerType.player_front_sprite_filename($player.trainer_type))
|
||||
@sprites["trainer"].x -= (@sprites["trainer"].bitmap.width-128)/2
|
||||
@sprites["trainer"].y -= (@sprites["trainer"].bitmap.height-128)
|
||||
@sprites["trainer"].x -= (@sprites["trainer"].bitmap.width - 128) / 2
|
||||
@sprites["trainer"].y -= (@sprites["trainer"].bitmap.height - 128)
|
||||
@sprites["trainer"].z = 2
|
||||
pbDrawTrainerCardFront
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
@@ -37,42 +37,42 @@ class PokemonTrainerCard_Scene
|
||||
def pbDrawTrainerCardFront
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
baseColor = Color.new(72,72,72)
|
||||
shadowColor = Color.new(160,160,160)
|
||||
baseColor = Color.new(72, 72, 72)
|
||||
shadowColor = Color.new(160, 160, 160)
|
||||
totalsec = $stats.play_time.to_i
|
||||
hour = totalsec / 60 / 60
|
||||
min = totalsec / 60 % 60
|
||||
time = (hour>0) ? _INTL("{1}h {2}m",hour,min) : _INTL("{1}m",min)
|
||||
time = (hour > 0) ? _INTL("{1}h {2}m", hour, min) : _INTL("{1}m", min)
|
||||
$PokemonGlobal.startTime = pbGetTimeNow if !$PokemonGlobal.startTime
|
||||
starttime = _INTL("{1} {2}, {3}",
|
||||
pbGetAbbrevMonthName($PokemonGlobal.startTime.mon),
|
||||
$PokemonGlobal.startTime.day,
|
||||
$PokemonGlobal.startTime.year)
|
||||
textPositions = [
|
||||
[_INTL("Name"),34,58,0,baseColor,shadowColor],
|
||||
[$player.name,302,58,1,baseColor,shadowColor],
|
||||
[_INTL("ID No."),332,58,0,baseColor,shadowColor],
|
||||
[sprintf("%05d",$player.public_ID),468,58,1,baseColor,shadowColor],
|
||||
[_INTL("Money"),34,106,0,baseColor,shadowColor],
|
||||
[_INTL("${1}",$player.money.to_s_formatted),302,106,1,baseColor,shadowColor],
|
||||
[_INTL("Pokédex"),34,154,0,baseColor,shadowColor],
|
||||
[sprintf("%d/%d",$player.pokedex.owned_count,$player.pokedex.seen_count),302,154,1,baseColor,shadowColor],
|
||||
[_INTL("Time"),34,202,0,baseColor,shadowColor],
|
||||
[time,302,202,1,baseColor,shadowColor],
|
||||
[_INTL("Started"),34,250,0,baseColor,shadowColor],
|
||||
[starttime,302,250,1,baseColor,shadowColor]
|
||||
[_INTL("Name"), 34, 58, 0, baseColor, shadowColor],
|
||||
[$player.name, 302, 58, 1, baseColor, shadowColor],
|
||||
[_INTL("ID No."), 332, 58, 0, baseColor, shadowColor],
|
||||
[sprintf("%05d", $player.public_ID), 468, 58, 1, baseColor, shadowColor],
|
||||
[_INTL("Money"), 34, 106, 0, baseColor, shadowColor],
|
||||
[_INTL("${1}", $player.money.to_s_formatted), 302, 106, 1, baseColor, shadowColor],
|
||||
[_INTL("Pokédex"), 34, 154, 0, baseColor, shadowColor],
|
||||
[sprintf("%d/%d", $player.pokedex.owned_count, $player.pokedex.seen_count), 302, 154, 1, baseColor, shadowColor],
|
||||
[_INTL("Time"), 34, 202, 0, baseColor, shadowColor],
|
||||
[time, 302, 202, 1, baseColor, shadowColor],
|
||||
[_INTL("Started"), 34, 250, 0, baseColor, shadowColor],
|
||||
[starttime, 302, 250, 1, baseColor, shadowColor]
|
||||
]
|
||||
pbDrawTextPositions(overlay,textPositions)
|
||||
pbDrawTextPositions(overlay, textPositions)
|
||||
x = 72
|
||||
region = pbGetCurrentRegion(0) # Get the current region
|
||||
imagePositions = []
|
||||
for i in 0...8
|
||||
if $player.badges[i+region*8]
|
||||
imagePositions.push(["Graphics/Pictures/Trainer Card/icon_badges",x,310,i*32,region*32,32,32])
|
||||
if $player.badges[i + region * 8]
|
||||
imagePositions.push(["Graphics/Pictures/Trainer Card/icon_badges", x, 310, i * 32, region * 32, 32, 32])
|
||||
end
|
||||
x += 48
|
||||
end
|
||||
pbDrawImagePositions(overlay,imagePositions)
|
||||
pbDrawImagePositions(overlay, imagePositions)
|
||||
end
|
||||
|
||||
def pbTrainerCard
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
class PokemonLoadPanel < SpriteWrapper
|
||||
attr_reader :selected
|
||||
|
||||
TEXTCOLOR = Color.new(232,232,232)
|
||||
TEXTSHADOWCOLOR = Color.new(136,136,136)
|
||||
MALETEXTCOLOR = Color.new(56,160,248)
|
||||
MALETEXTSHADOWCOLOR = Color.new(56,104,168)
|
||||
FEMALETEXTCOLOR = Color.new(240,72,88)
|
||||
FEMALETEXTSHADOWCOLOR = Color.new(160,64,64)
|
||||
TEXTCOLOR = Color.new(232, 232, 232)
|
||||
TEXTSHADOWCOLOR = Color.new(136, 136, 136)
|
||||
MALETEXTCOLOR = Color.new(56, 160, 248)
|
||||
MALETEXTSHADOWCOLOR = Color.new(56, 104, 168)
|
||||
FEMALETEXTCOLOR = Color.new(240, 72, 88)
|
||||
FEMALETEXTSHADOWCOLOR = Color.new(160, 64, 64)
|
||||
|
||||
def initialize(index, title, isContinue, trainer, framecount, stats, mapid, viewport = nil)
|
||||
super(viewport)
|
||||
@@ -19,7 +19,7 @@ class PokemonLoadPanel < SpriteWrapper
|
||||
@trainer = trainer
|
||||
@totalsec = (stats) ? stats.play_time.to_i : ((framecount || 0) / Graphics.frame_rate)
|
||||
@mapid = mapid
|
||||
@selected = (index==0)
|
||||
@selected = (index == 0)
|
||||
@bgbitmap = AnimatedBitmap.new("Graphics/Pictures/loadPanels")
|
||||
@refreshBitmap = true
|
||||
@refreshing = false
|
||||
@@ -33,7 +33,7 @@ class PokemonLoadPanel < SpriteWrapper
|
||||
end
|
||||
|
||||
def selected=(value)
|
||||
return if @selected==value
|
||||
return if @selected == value
|
||||
@selected = value
|
||||
@refreshBitmap = true
|
||||
refresh
|
||||
@@ -49,46 +49,46 @@ class PokemonLoadPanel < SpriteWrapper
|
||||
return if disposed?
|
||||
@refreshing = true
|
||||
if !self.bitmap || self.bitmap.disposed?
|
||||
self.bitmap = BitmapWrapper.new(@bgbitmap.width,111*2)
|
||||
self.bitmap = BitmapWrapper.new(@bgbitmap.width, 111 * 2)
|
||||
pbSetSystemFont(self.bitmap)
|
||||
end
|
||||
if @refreshBitmap
|
||||
@refreshBitmap = false
|
||||
self.bitmap.clear if self.bitmap
|
||||
if @isContinue
|
||||
self.bitmap.blt(0,0,@bgbitmap.bitmap,Rect.new(0,(@selected) ? 111*2 : 0,@bgbitmap.width,111*2))
|
||||
self.bitmap.blt(0, 0, @bgbitmap.bitmap, Rect.new(0, (@selected) ? 111 * 2 : 0, @bgbitmap.width, 111 * 2))
|
||||
else
|
||||
self.bitmap.blt(0,0,@bgbitmap.bitmap,Rect.new(0,111*2*2+((@selected) ? 23*2 : 0),@bgbitmap.width,23*2))
|
||||
self.bitmap.blt(0, 0, @bgbitmap.bitmap, Rect.new(0, 111 * 2 * 2 + ((@selected) ? 23 * 2 : 0), @bgbitmap.width, 23 * 2))
|
||||
end
|
||||
textpos = []
|
||||
if @isContinue
|
||||
textpos.push([@title,16*2,2*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Badges:"),16*2,53*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.badge_count.to_s,103*2,53*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Pokédex:"),16*2,69*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.pokedex.seen_count.to_s,103*2,69*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Time:"),16*2,85*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@title, 16 * 2, 2 * 2, 0, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Badges:"), 16 * 2, 53 * 2, 0, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.badge_count.to_s, 103 * 2, 53 * 2, 1, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Pokédex:"), 16 * 2, 69 * 2, 0, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.pokedex.seen_count.to_s, 103 * 2, 69 * 2, 1, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Time:"), 16 * 2, 85 * 2, 0, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
hour = @totalsec / 60 / 60
|
||||
min = @totalsec / 60 % 60
|
||||
if hour>0
|
||||
textpos.push([_INTL("{1}h {2}m",hour,min),103*2,85*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
if hour > 0
|
||||
textpos.push([_INTL("{1}h {2}m", hour, min), 103 * 2, 85 * 2, 1, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
else
|
||||
textpos.push([_INTL("{1}m",min),103*2,85*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("{1}m", min), 103 * 2, 85 * 2, 1, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
end
|
||||
if @trainer.male?
|
||||
textpos.push([@trainer.name,56*2,29*2,0,MALETEXTCOLOR,MALETEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.name, 56 * 2, 29 * 2, 0, MALETEXTCOLOR, MALETEXTSHADOWCOLOR])
|
||||
elsif @trainer.female?
|
||||
textpos.push([@trainer.name,56*2,29*2,0,FEMALETEXTCOLOR,FEMALETEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.name, 56 * 2, 29 * 2, 0, FEMALETEXTCOLOR, FEMALETEXTSHADOWCOLOR])
|
||||
else
|
||||
textpos.push([@trainer.name,56*2,29*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.name, 56 * 2, 29 * 2, 0, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
end
|
||||
mapname = pbGetMapNameFromId(@mapid)
|
||||
mapname.gsub!(/\\PN/,@trainer.name)
|
||||
textpos.push([mapname,193*2,2*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
mapname.gsub!(/\\PN/, @trainer.name)
|
||||
textpos.push([mapname, 193 * 2, 2 * 2, 1, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
else
|
||||
textpos.push([@title,16*2,1*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@title, 16 * 2, 1 * 2, 0, TEXTCOLOR, TEXTSHADOWCOLOR])
|
||||
end
|
||||
pbDrawTextPositions(self.bitmap,textpos)
|
||||
pbDrawTextPositions(self.bitmap, textpos)
|
||||
end
|
||||
@refreshing = false
|
||||
end
|
||||
@@ -103,15 +103,15 @@ class PokemonLoad_Scene
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99998
|
||||
addBackgroundOrColoredPlane(@sprites,"background","loadbg",Color.new(248,248,248),@viewport)
|
||||
y = 16*2
|
||||
addBackgroundOrColoredPlane(@sprites, "background", "loadbg", Color.new(248, 248, 248), @viewport)
|
||||
y = 16 * 2
|
||||
for i in 0...commands.length
|
||||
@sprites["panel#{i}"] = PokemonLoadPanel.new(i, commands[i],
|
||||
(show_continue) ? (i == 0) : false, trainer, frame_count, stats, map_id, @viewport)
|
||||
@sprites["panel#{i}"].x = 24*2
|
||||
@sprites["panel#{i}"].x = 24 * 2
|
||||
@sprites["panel#{i}"].y = y
|
||||
@sprites["panel#{i}"].pbRefresh
|
||||
y += (show_continue && i==0) ? 112*2 : 24*2
|
||||
y += (show_continue && i == 0) ? 112 * 2 : 24 * 2
|
||||
end
|
||||
@sprites["cmdwindow"] = Window_CommandPokemon.new([])
|
||||
@sprites["cmdwindow"].viewport = @viewport
|
||||
@@ -124,39 +124,39 @@ class PokemonLoad_Scene
|
||||
|
||||
def pbStartDeleteScene
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99998
|
||||
addBackgroundOrColoredPlane(@sprites,"background","loadbg",Color.new(248,248,248),@viewport)
|
||||
addBackgroundOrColoredPlane(@sprites, "background", "loadbg", Color.new(248, 248, 248), @viewport)
|
||||
end
|
||||
|
||||
def pbUpdate
|
||||
oldi = @sprites["cmdwindow"].index rescue 0
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
newi = @sprites["cmdwindow"].index rescue 0
|
||||
if oldi!=newi
|
||||
if oldi != newi
|
||||
@sprites["panel#{oldi}"].selected = false
|
||||
@sprites["panel#{oldi}"].pbRefresh
|
||||
@sprites["panel#{newi}"].selected = true
|
||||
@sprites["panel#{newi}"].pbRefresh
|
||||
while @sprites["panel#{newi}"].y>Graphics.height-40*2
|
||||
while @sprites["panel#{newi}"].y > Graphics.height - 40 * 2
|
||||
for i in 0...@commands.length
|
||||
@sprites["panel#{i}"].y -= 24*2
|
||||
@sprites["panel#{i}"].y -= 24 * 2
|
||||
end
|
||||
for i in 0...6
|
||||
break if !@sprites["party#{i}"]
|
||||
@sprites["party#{i}"].y -= 24*2
|
||||
@sprites["party#{i}"].y -= 24 * 2
|
||||
end
|
||||
@sprites["player"].y -= 24*2 if @sprites["player"]
|
||||
@sprites["player"].y -= 24 * 2 if @sprites["player"]
|
||||
end
|
||||
while @sprites["panel#{newi}"].y<16*2
|
||||
while @sprites["panel#{newi}"].y < 16 * 2
|
||||
for i in 0...@commands.length
|
||||
@sprites["panel#{i}"].y += 24*2
|
||||
@sprites["panel#{i}"].y += 24 * 2
|
||||
end
|
||||
for i in 0...6
|
||||
break if !@sprites["party#{i}"]
|
||||
@sprites["party#{i}"].y += 24*2
|
||||
@sprites["party#{i}"].y += 24 * 2
|
||||
end
|
||||
@sprites["player"].y += 24*2 if @sprites["player"]
|
||||
@sprites["player"].y += 24 * 2 if @sprites["player"]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -166,18 +166,18 @@ class PokemonLoad_Scene
|
||||
meta = GameData::PlayerMetadata.get(trainer.character_ID)
|
||||
if meta
|
||||
filename = pbGetPlayerCharset(meta.walk_charset, trainer, true)
|
||||
@sprites["player"] = TrainerWalkingCharSprite.new(filename,@viewport)
|
||||
@sprites["player"] = TrainerWalkingCharSprite.new(filename, @viewport)
|
||||
charwidth = @sprites["player"].bitmap.width
|
||||
charheight = @sprites["player"].bitmap.height
|
||||
@sprites["player"].x = 56*2-charwidth/8
|
||||
@sprites["player"].y = 56*2-charheight/8
|
||||
@sprites["player"].src_rect = Rect.new(0,0,charwidth/4,charheight/4)
|
||||
@sprites["player"].x = 56 * 2 - charwidth / 8
|
||||
@sprites["player"].y = 56 * 2 - charheight / 8
|
||||
@sprites["player"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4)
|
||||
end
|
||||
for i in 0...trainer.party.length
|
||||
@sprites["party#{i}"] = PokemonIconSprite.new(trainer.party[i],@viewport)
|
||||
@sprites["party#{i}"] = PokemonIconSprite.new(trainer.party[i], @viewport)
|
||||
@sprites["party#{i}"].setOffset(PictureOrigin::Center)
|
||||
@sprites["party#{i}"].x = (167+33*(i%2))*2
|
||||
@sprites["party#{i}"].y = (56+25*(i/2))*2
|
||||
@sprites["party#{i}"].x = (167 + 33 * (i % 2)) * 2
|
||||
@sprites["party#{i}"].y = (56 + 25 * (i / 2)) * 2
|
||||
@sprites["party#{i}"].z = 99999
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,32 +25,32 @@ end
|
||||
#===============================================================================
|
||||
class PokemonSave_Scene
|
||||
def pbStartScreen
|
||||
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z=99999
|
||||
@sprites={}
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
totalsec = $stats.play_time.to_i
|
||||
hour = totalsec / 60 / 60
|
||||
min = totalsec / 60 % 60
|
||||
mapname=$game_map.name
|
||||
textColor = ["0070F8,78B8E8","E82010,F8A8B8","0070F8,78B8E8"][$player.gender]
|
||||
mapname = $game_map.name
|
||||
textColor = ["0070F8,78B8E8", "E82010,F8A8B8", "0070F8,78B8E8"][$player.gender]
|
||||
locationColor = "209808,90F090" # green
|
||||
loctext=_INTL("<ac><c3={1}>{2}</c3></ac>",locationColor,mapname)
|
||||
loctext+=_INTL("Player<r><c3={1}>{2}</c3><br>",textColor,$player.name)
|
||||
if hour>0
|
||||
loctext+=_INTL("Time<r><c3={1}>{2}h {3}m</c3><br>",textColor,hour,min)
|
||||
loctext = _INTL("<ac><c3={1}>{2}</c3></ac>", locationColor, mapname)
|
||||
loctext += _INTL("Player<r><c3={1}>{2}</c3><br>", textColor, $player.name)
|
||||
if hour > 0
|
||||
loctext += _INTL("Time<r><c3={1}>{2}h {3}m</c3><br>", textColor, hour, min)
|
||||
else
|
||||
loctext+=_INTL("Time<r><c3={1}>{2}m</c3><br>",textColor,min)
|
||||
loctext += _INTL("Time<r><c3={1}>{2}m</c3><br>", textColor, min)
|
||||
end
|
||||
loctext+=_INTL("Badges<r><c3={1}>{2}</c3><br>",textColor,$player.badge_count)
|
||||
loctext += _INTL("Badges<r><c3={1}>{2}</c3><br>", textColor, $player.badge_count)
|
||||
if $player.has_pokedex
|
||||
loctext+=_INTL("Pokédex<r><c3={1}>{2}/{3}</c3>",textColor,$player.pokedex.owned_count,$player.pokedex.seen_count)
|
||||
loctext += _INTL("Pokédex<r><c3={1}>{2}/{3}</c3>", textColor, $player.pokedex.owned_count, $player.pokedex.seen_count)
|
||||
end
|
||||
@sprites["locwindow"]=Window_AdvancedTextPokemon.new(loctext)
|
||||
@sprites["locwindow"].viewport=@viewport
|
||||
@sprites["locwindow"].x=0
|
||||
@sprites["locwindow"].y=0
|
||||
@sprites["locwindow"].width=228 if @sprites["locwindow"].width<228
|
||||
@sprites["locwindow"].visible=true
|
||||
@sprites["locwindow"] = Window_AdvancedTextPokemon.new(loctext)
|
||||
@sprites["locwindow"].viewport = @viewport
|
||||
@sprites["locwindow"].x = 0
|
||||
@sprites["locwindow"].y = 0
|
||||
@sprites["locwindow"].width = 228 if @sprites["locwindow"].width < 228
|
||||
@sprites["locwindow"].visible = true
|
||||
end
|
||||
|
||||
def pbEndScreen
|
||||
@@ -64,11 +64,11 @@ end
|
||||
#===============================================================================
|
||||
class PokemonSaveScreen
|
||||
def initialize(scene)
|
||||
@scene=scene
|
||||
@scene = scene
|
||||
end
|
||||
|
||||
def pbDisplay(text,brief = false)
|
||||
@scene.pbDisplay(text,brief)
|
||||
def pbDisplay(text, brief = false)
|
||||
@scene.pbDisplay(text, brief)
|
||||
end
|
||||
|
||||
def pbDisplayPaused(text)
|
||||
|
||||
@@ -50,7 +50,7 @@ class EnumOption
|
||||
attr_reader :values
|
||||
attr_reader :name
|
||||
|
||||
def initialize(name,options,getProc,setProc)
|
||||
def initialize(name, options, getProc, setProc)
|
||||
@name = name
|
||||
@values = options
|
||||
@getProc = getProc
|
||||
@@ -58,14 +58,14 @@ class EnumOption
|
||||
end
|
||||
|
||||
def next(current)
|
||||
index = current+1
|
||||
index = @values.length-1 if index>@values.length-1
|
||||
index = current + 1
|
||||
index = @values.length - 1 if index > @values.length - 1
|
||||
return index
|
||||
end
|
||||
|
||||
def prev(current)
|
||||
index = current-1
|
||||
index = 0 if index<0
|
||||
index = current - 1
|
||||
index = 0 if index < 0
|
||||
return index
|
||||
end
|
||||
end
|
||||
@@ -78,7 +78,7 @@ class EnumOption2
|
||||
attr_reader :values
|
||||
attr_reader :name
|
||||
|
||||
def initialize(name,options,getProc,setProc)
|
||||
def initialize(name, options, getProc, setProc)
|
||||
@name = name
|
||||
@values = options
|
||||
@getProc = getProc
|
||||
@@ -86,14 +86,14 @@ class EnumOption2
|
||||
end
|
||||
|
||||
def next(current)
|
||||
index = current+1
|
||||
index = @values.length-1 if index>@values.length-1
|
||||
index = current + 1
|
||||
index = @values.length - 1 if index > @values.length - 1
|
||||
return index
|
||||
end
|
||||
|
||||
def prev(current)
|
||||
index = current-1
|
||||
index = 0 if index<0
|
||||
index = current - 1
|
||||
index = 0 if index < 0
|
||||
return index
|
||||
end
|
||||
end
|
||||
@@ -107,7 +107,7 @@ class NumberOption
|
||||
attr_reader :optstart
|
||||
attr_reader :optend
|
||||
|
||||
def initialize(name,optstart,optend,getProc,setProc)
|
||||
def initialize(name, optstart, optend, getProc, setProc)
|
||||
@name = name
|
||||
@optstart = optstart
|
||||
@optend = optend
|
||||
@@ -116,17 +116,17 @@ class NumberOption
|
||||
end
|
||||
|
||||
def next(current)
|
||||
index = current+@optstart
|
||||
index = current + @optstart
|
||||
index += 1
|
||||
index = @optstart if index>@optend
|
||||
return index-@optstart
|
||||
index = @optstart if index > @optend
|
||||
return index - @optstart
|
||||
end
|
||||
|
||||
def prev(current)
|
||||
index = current+@optstart
|
||||
index = current + @optstart
|
||||
index -= 1
|
||||
index = @optend if index<@optstart
|
||||
return index-@optstart
|
||||
index = @optend if index < @optstart
|
||||
return index - @optstart
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,7 +139,7 @@ class SliderOption
|
||||
attr_reader :optstart
|
||||
attr_reader :optend
|
||||
|
||||
def initialize(name,optstart,optend,optinterval,getProc,setProc)
|
||||
def initialize(name, optstart, optend, optinterval, getProc, setProc)
|
||||
@name = name
|
||||
@optstart = optstart
|
||||
@optend = optend
|
||||
@@ -149,17 +149,17 @@ class SliderOption
|
||||
end
|
||||
|
||||
def next(current)
|
||||
index = current+@optstart
|
||||
index = current + @optstart
|
||||
index += @optinterval
|
||||
index = @optend if index>@optend
|
||||
return index-@optstart
|
||||
index = @optend if index > @optend
|
||||
return index - @optstart
|
||||
end
|
||||
|
||||
def prev(current)
|
||||
index = current+@optstart
|
||||
index = current + @optstart
|
||||
index -= @optinterval
|
||||
index = @optstart if index<@optstart
|
||||
return index-@optstart
|
||||
index = @optstart if index < @optstart
|
||||
return index - @optstart
|
||||
end
|
||||
end
|
||||
|
||||
@@ -169,92 +169,92 @@ end
|
||||
class Window_PokemonOption < Window_DrawableCommand
|
||||
attr_reader :mustUpdateOptions
|
||||
|
||||
def initialize(options,x,y,width,height)
|
||||
def initialize(options, x, y, width, height)
|
||||
@options = options
|
||||
@nameBaseColor = Color.new(24*8,15*8,0)
|
||||
@nameShadowColor = Color.new(31*8,22*8,10*8)
|
||||
@selBaseColor = Color.new(31*8,6*8,3*8)
|
||||
@selShadowColor = Color.new(31*8,17*8,16*8)
|
||||
@nameBaseColor = Color.new(24 * 8, 15 * 8, 0)
|
||||
@nameShadowColor = Color.new(31 * 8, 22 * 8, 10 * 8)
|
||||
@selBaseColor = Color.new(31 * 8, 6 * 8, 3 * 8)
|
||||
@selShadowColor = Color.new(31 * 8, 17 * 8, 16 * 8)
|
||||
@optvalues = []
|
||||
@mustUpdateOptions = false
|
||||
for i in 0...@options.length
|
||||
@optvalues[i] = 0
|
||||
end
|
||||
super(x,y,width,height)
|
||||
super(x, y, width, height)
|
||||
end
|
||||
|
||||
def [](i)
|
||||
return @optvalues[i]
|
||||
end
|
||||
|
||||
def []=(i,value)
|
||||
def []=(i, value)
|
||||
@optvalues[i] = value
|
||||
refresh
|
||||
end
|
||||
|
||||
def setValueNoRefresh(i,value)
|
||||
def setValueNoRefresh(i, value)
|
||||
@optvalues[i] = value
|
||||
end
|
||||
|
||||
def itemCount
|
||||
return @options.length+1
|
||||
return @options.length + 1
|
||||
end
|
||||
|
||||
def drawItem(index,_count,rect)
|
||||
rect = drawCursor(index,rect)
|
||||
optionname = (index==@options.length) ? _INTL("Cancel") : @options[index].name
|
||||
optionwidth = rect.width*9/20
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,optionwidth,rect.height,optionname,
|
||||
@nameBaseColor,@nameShadowColor)
|
||||
return if index==@options.length
|
||||
def drawItem(index, _count, rect)
|
||||
rect = drawCursor(index, rect)
|
||||
optionname = (index == @options.length) ? _INTL("Cancel") : @options[index].name
|
||||
optionwidth = rect.width * 9 / 20
|
||||
pbDrawShadowText(self.contents, rect.x, rect.y, optionwidth, rect.height, optionname,
|
||||
@nameBaseColor, @nameShadowColor)
|
||||
return if index == @options.length
|
||||
if @options[index].is_a?(EnumOption)
|
||||
if @options[index].values.length>1
|
||||
if @options[index].values.length > 1
|
||||
totalwidth = 0
|
||||
for value in @options[index].values
|
||||
totalwidth += self.contents.text_size(value).width
|
||||
end
|
||||
spacing = (optionwidth-totalwidth)/(@options[index].values.length-1)
|
||||
spacing = 0 if spacing<0
|
||||
xpos = optionwidth+rect.x
|
||||
spacing = (optionwidth - totalwidth) / (@options[index].values.length - 1)
|
||||
spacing = 0 if spacing < 0
|
||||
xpos = optionwidth + rect.x
|
||||
ivalue = 0
|
||||
for value in @options[index].values
|
||||
pbDrawShadowText(self.contents,xpos,rect.y,optionwidth,rect.height,value,
|
||||
(ivalue==self[index]) ? @selBaseColor : self.baseColor,
|
||||
(ivalue==self[index]) ? @selShadowColor : self.shadowColor
|
||||
pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value,
|
||||
(ivalue == self[index]) ? @selBaseColor : self.baseColor,
|
||||
(ivalue == self[index]) ? @selShadowColor : self.shadowColor
|
||||
)
|
||||
xpos += self.contents.text_size(value).width
|
||||
xpos += spacing
|
||||
ivalue += 1
|
||||
end
|
||||
else
|
||||
pbDrawShadowText(self.contents,rect.x+optionwidth,rect.y,optionwidth,rect.height,
|
||||
optionname,self.baseColor,self.shadowColor)
|
||||
pbDrawShadowText(self.contents, rect.x + optionwidth, rect.y, optionwidth, rect.height,
|
||||
optionname, self.baseColor, self.shadowColor)
|
||||
end
|
||||
elsif @options[index].is_a?(NumberOption)
|
||||
value = _INTL("Type {1}/{2}",@options[index].optstart+self[index],
|
||||
@options[index].optend-@options[index].optstart+1)
|
||||
xpos = optionwidth+rect.x
|
||||
pbDrawShadowText(self.contents,xpos,rect.y,optionwidth,rect.height,value,
|
||||
@selBaseColor,@selShadowColor)
|
||||
value = _INTL("Type {1}/{2}", @options[index].optstart + self[index],
|
||||
@options[index].optend - @options[index].optstart + 1)
|
||||
xpos = optionwidth + rect.x
|
||||
pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value,
|
||||
@selBaseColor, @selShadowColor)
|
||||
elsif @options[index].is_a?(SliderOption)
|
||||
value = sprintf(" %d",@options[index].optend)
|
||||
sliderlength = optionwidth-self.contents.text_size(value).width
|
||||
xpos = optionwidth+rect.x
|
||||
self.contents.fill_rect(xpos,rect.y-2+rect.height/2,
|
||||
optionwidth-self.contents.text_size(value).width,4,self.baseColor)
|
||||
value = sprintf(" %d", @options[index].optend)
|
||||
sliderlength = optionwidth - self.contents.text_size(value).width
|
||||
xpos = optionwidth + rect.x
|
||||
self.contents.fill_rect(xpos, rect.y - 2 + rect.height / 2,
|
||||
optionwidth - self.contents.text_size(value).width, 4, self.baseColor)
|
||||
self.contents.fill_rect(
|
||||
xpos+(sliderlength-8)*(@options[index].optstart+self[index])/@options[index].optend,
|
||||
rect.y-8+rect.height/2,
|
||||
8,16,@selBaseColor)
|
||||
value = sprintf("%d",@options[index].optstart+self[index])
|
||||
xpos += optionwidth-self.contents.text_size(value).width
|
||||
pbDrawShadowText(self.contents,xpos,rect.y,optionwidth,rect.height,value,
|
||||
@selBaseColor,@selShadowColor)
|
||||
xpos + (sliderlength - 8) * (@options[index].optstart + self[index]) / @options[index].optend,
|
||||
rect.y - 8 + rect.height / 2,
|
||||
8, 16, @selBaseColor)
|
||||
value = sprintf("%d", @options[index].optstart + self[index])
|
||||
xpos += optionwidth - self.contents.text_size(value).width
|
||||
pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value,
|
||||
@selBaseColor, @selShadowColor)
|
||||
else
|
||||
value = @options[index].values[self[index]]
|
||||
xpos = optionwidth+rect.x
|
||||
pbDrawShadowText(self.contents,xpos,rect.y,optionwidth,rect.height,value,
|
||||
@selBaseColor,@selShadowColor)
|
||||
xpos = optionwidth + rect.x
|
||||
pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value,
|
||||
@selBaseColor, @selShadowColor)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -262,8 +262,8 @@ class Window_PokemonOption < Window_DrawableCommand
|
||||
oldindex = self.index
|
||||
@mustUpdateOptions = false
|
||||
super
|
||||
dorefresh = (self.index!=oldindex)
|
||||
if self.active && self.index<@options.length
|
||||
dorefresh = (self.index != oldindex)
|
||||
if self.active && self.index < @options.length
|
||||
if Input.repeat?(Input::LEFT)
|
||||
self[self.index] = @options[self.index].prev(self[self.index])
|
||||
dorefresh = true
|
||||
@@ -288,24 +288,24 @@ class PokemonOption_Scene
|
||||
|
||||
def pbStartScene(inloadscreen = false)
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(
|
||||
_INTL("Options"),0,0,Graphics.width,64,@viewport)
|
||||
_INTL("Options"), 0, 0, Graphics.width, 64, @viewport)
|
||||
@sprites["textbox"] = pbCreateMessageWindow
|
||||
@sprites["textbox"].text = _INTL("Speech frame {1}.",1+$PokemonSystem.textskin)
|
||||
@sprites["textbox"].text = _INTL("Speech frame {1}.", 1 + $PokemonSystem.textskin)
|
||||
@sprites["textbox"].letterbyletter = false
|
||||
pbSetSystemFont(@sprites["textbox"].contents)
|
||||
# These are the different options in the game. To add an option, define a
|
||||
# setter and a getter for that option. To delete an option, comment it out
|
||||
# or delete it. The game's options may be placed in any order.
|
||||
@PokemonOptions = [
|
||||
SliderOption.new(_INTL("Music Volume"),0,100,5,
|
||||
SliderOption.new(_INTL("Music Volume"), 0, 100, 5,
|
||||
proc { $PokemonSystem.bgmvolume },
|
||||
proc { |value|
|
||||
if $PokemonSystem.bgmvolume!=value
|
||||
if $PokemonSystem.bgmvolume != value
|
||||
$PokemonSystem.bgmvolume = value
|
||||
if $game_system.playing_bgm!=nil && !inloadscreen
|
||||
if $game_system.playing_bgm != nil && !inloadscreen
|
||||
playingBGM = $game_system.getPlayingBGM
|
||||
$game_system.bgm_pause
|
||||
$game_system.bgm_resume(playingBGM)
|
||||
@@ -313,12 +313,12 @@ class PokemonOption_Scene
|
||||
end
|
||||
}
|
||||
),
|
||||
SliderOption.new(_INTL("SE Volume"),0,100,5,
|
||||
SliderOption.new(_INTL("SE Volume"), 0, 100, 5,
|
||||
proc { $PokemonSystem.sevolume },
|
||||
proc { |value|
|
||||
if $PokemonSystem.sevolume!=value
|
||||
if $PokemonSystem.sevolume != value
|
||||
$PokemonSystem.sevolume = value
|
||||
if $game_system.playing_bgs!=nil
|
||||
if $game_system.playing_bgs != nil
|
||||
$game_system.playing_bgs.volume = value
|
||||
playingBGS = $game_system.getPlayingBGS
|
||||
$game_system.bgs_pause
|
||||
@@ -328,44 +328,44 @@ class PokemonOption_Scene
|
||||
end
|
||||
}
|
||||
),
|
||||
EnumOption.new(_INTL("Text Speed"),[_INTL("Slow"),_INTL("Normal"),_INTL("Fast")],
|
||||
EnumOption.new(_INTL("Text Speed"), [_INTL("Slow"), _INTL("Normal"), _INTL("Fast")],
|
||||
proc { $PokemonSystem.textspeed },
|
||||
proc { |value|
|
||||
$PokemonSystem.textspeed = value
|
||||
MessageConfig.pbSetTextSpeed(MessageConfig.pbSettingToTextSpeed(value))
|
||||
}
|
||||
),
|
||||
EnumOption.new(_INTL("Battle Effects"),[_INTL("On"),_INTL("Off")],
|
||||
EnumOption.new(_INTL("Battle Effects"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $PokemonSystem.battlescene },
|
||||
proc { |value| $PokemonSystem.battlescene = value }
|
||||
),
|
||||
EnumOption.new(_INTL("Battle Style"),[_INTL("Switch"),_INTL("Set")],
|
||||
EnumOption.new(_INTL("Battle Style"), [_INTL("Switch"), _INTL("Set")],
|
||||
proc { $PokemonSystem.battlestyle },
|
||||
proc { |value| $PokemonSystem.battlestyle = value }
|
||||
),
|
||||
EnumOption.new(_INTL("Default Movement"),[_INTL("Walking"),_INTL("Running")],
|
||||
EnumOption.new(_INTL("Default Movement"), [_INTL("Walking"), _INTL("Running")],
|
||||
proc { $PokemonSystem.runstyle },
|
||||
proc { |value| $PokemonSystem.runstyle = value }
|
||||
),
|
||||
NumberOption.new(_INTL("Speech Frame"),1,Settings::SPEECH_WINDOWSKINS.length,
|
||||
NumberOption.new(_INTL("Speech Frame"), 1, Settings::SPEECH_WINDOWSKINS.length,
|
||||
proc { $PokemonSystem.textskin },
|
||||
proc { |value|
|
||||
$PokemonSystem.textskin = value
|
||||
MessageConfig.pbSetSpeechFrame("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[value])
|
||||
}
|
||||
),
|
||||
NumberOption.new(_INTL("Menu Frame"),1,Settings::MENU_WINDOWSKINS.length,
|
||||
NumberOption.new(_INTL("Menu Frame"), 1, Settings::MENU_WINDOWSKINS.length,
|
||||
proc { $PokemonSystem.frame },
|
||||
proc { |value|
|
||||
$PokemonSystem.frame = value
|
||||
MessageConfig.pbSetSystemFrame("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[value])
|
||||
}
|
||||
),
|
||||
EnumOption.new(_INTL("Text Entry"),[_INTL("Cursor"),_INTL("Keyboard")],
|
||||
EnumOption.new(_INTL("Text Entry"), [_INTL("Cursor"), _INTL("Keyboard")],
|
||||
proc { $PokemonSystem.textinput },
|
||||
proc { |value| $PokemonSystem.textinput = value }
|
||||
),
|
||||
EnumOption.new(_INTL("Screen Size"),[_INTL("S"),_INTL("M"),_INTL("L"),_INTL("XL"),_INTL("Full")],
|
||||
EnumOption.new(_INTL("Screen Size"), [_INTL("S"), _INTL("M"), _INTL("L"), _INTL("XL"), _INTL("Full")],
|
||||
proc { [$PokemonSystem.screensize, 4].min },
|
||||
proc { |value|
|
||||
if $PokemonSystem.screensize != value
|
||||
@@ -376,14 +376,14 @@ class PokemonOption_Scene
|
||||
)
|
||||
]
|
||||
@PokemonOptions = pbAddOnOptions(@PokemonOptions)
|
||||
@sprites["option"] = Window_PokemonOption.new(@PokemonOptions,0,
|
||||
@sprites["title"].height,Graphics.width,
|
||||
Graphics.height-@sprites["title"].height-@sprites["textbox"].height)
|
||||
@sprites["option"] = Window_PokemonOption.new(@PokemonOptions, 0,
|
||||
@sprites["title"].height, Graphics.width,
|
||||
Graphics.height - @sprites["title"].height - @sprites["textbox"].height)
|
||||
@sprites["option"].viewport = @viewport
|
||||
@sprites["option"].visible = true
|
||||
# Get the values of each option
|
||||
for i in 0...@PokemonOptions.length
|
||||
@sprites["option"].setValueNoRefresh(i,(@PokemonOptions[i].get || 0))
|
||||
@sprites["option"].setValueNoRefresh(i, (@PokemonOptions[i].get || 0))
|
||||
end
|
||||
@sprites["option"].refresh
|
||||
pbDeactivateWindows(@sprites)
|
||||
@@ -397,7 +397,7 @@ class PokemonOption_Scene
|
||||
def pbOptions
|
||||
oldSystemSkin = $PokemonSystem.frame # Menu
|
||||
oldTextSkin = $PokemonSystem.textskin # Speech
|
||||
pbActivateWindow(@sprites,"option") {
|
||||
pbActivateWindow(@sprites, "option") {
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -407,12 +407,12 @@ class PokemonOption_Scene
|
||||
for i in 0...@PokemonOptions.length
|
||||
@PokemonOptions[i].set(@sprites["option"][i])
|
||||
end
|
||||
if $PokemonSystem.textskin!=oldTextSkin
|
||||
if $PokemonSystem.textskin != oldTextSkin
|
||||
@sprites["textbox"].setSkin(MessageConfig.pbGetSpeechFrame())
|
||||
@sprites["textbox"].text = _INTL("Speech frame {1}.",1+$PokemonSystem.textskin)
|
||||
@sprites["textbox"].text = _INTL("Speech frame {1}.", 1 + $PokemonSystem.textskin)
|
||||
oldTextSkin = $PokemonSystem.textskin
|
||||
end
|
||||
if $PokemonSystem.frame!=oldSystemSkin
|
||||
if $PokemonSystem.frame != oldSystemSkin
|
||||
@sprites["title"].setSkin(MessageConfig.pbGetSystemFrame())
|
||||
@sprites["option"].setSkin(MessageConfig.pbGetSystemFrame())
|
||||
oldSystemSkin = $PokemonSystem.frame
|
||||
@@ -421,7 +421,7 @@ class PokemonOption_Scene
|
||||
if Input.trigger?(Input::BACK)
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
break if @sprites["option"].index==@PokemonOptions.length
|
||||
break if @sprites["option"].index == @PokemonOptions.length
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ class ReadyMenuButton < SpriteWrapper
|
||||
attr_reader :selected
|
||||
attr_reader :side
|
||||
|
||||
def initialize(index,command,selected,side,viewport = nil)
|
||||
def initialize(index, command, selected, side, viewport = nil)
|
||||
super(viewport)
|
||||
@index = index
|
||||
@command = command # Item/move ID, name, mode (T move/F item), pkmnIndex
|
||||
@@ -17,16 +17,16 @@ class ReadyMenuButton < SpriteWrapper
|
||||
else
|
||||
@button = AnimatedBitmap.new("Graphics/Pictures/Ready Menu/icon_itembutton")
|
||||
end
|
||||
@contents = BitmapWrapper.new(@button.width,@button.height/2)
|
||||
@contents = BitmapWrapper.new(@button.width, @button.height / 2)
|
||||
self.bitmap = @contents
|
||||
pbSetSystemFont(self.bitmap)
|
||||
if @command[2]
|
||||
@icon = PokemonIconSprite.new($player.party[@command[3]], viewport)
|
||||
@icon.setOffset(PictureOrigin::Center)
|
||||
else
|
||||
@icon = ItemIconSprite.new(0,0,@command[0],viewport)
|
||||
@icon = ItemIconSprite.new(0, 0, @command[0], viewport)
|
||||
end
|
||||
@icon.z = self.z+1
|
||||
@icon.z = self.z + 1
|
||||
refresh
|
||||
end
|
||||
|
||||
@@ -45,47 +45,47 @@ class ReadyMenuButton < SpriteWrapper
|
||||
def selected=(val)
|
||||
oldsel = @selected
|
||||
@selected = val
|
||||
refresh if oldsel!=val
|
||||
refresh if oldsel != val
|
||||
end
|
||||
|
||||
def side=(val)
|
||||
oldsel = @side
|
||||
@side = val
|
||||
refresh if oldsel!=val
|
||||
refresh if oldsel != val
|
||||
end
|
||||
|
||||
def refresh
|
||||
sel = (@selected==@index && (@side==0)==@command[2])
|
||||
self.y = (Graphics.height-@button.height/2)/2 - (@selected-@index)*(@button.height/2+4)
|
||||
sel = (@selected == @index && (@side == 0) == @command[2])
|
||||
self.y = (Graphics.height - @button.height / 2) / 2 - (@selected - @index) * (@button.height / 2 + 4)
|
||||
if @command[2] # Pokémon
|
||||
self.x = (sel) ? 0 : -16
|
||||
@icon.x = self.x+52
|
||||
@icon.y = self.y+32
|
||||
@icon.x = self.x + 52
|
||||
@icon.y = self.y + 32
|
||||
else # Item
|
||||
self.x = (sel) ? Graphics.width-@button.width : Graphics.width+16-@button.width
|
||||
@icon.x = self.x+32
|
||||
@icon.y = self.y+@button.height/4
|
||||
self.x = (sel) ? Graphics.width - @button.width : Graphics.width + 16 - @button.width
|
||||
@icon.x = self.x + 32
|
||||
@icon.y = self.y + @button.height / 4
|
||||
end
|
||||
self.bitmap.clear
|
||||
rect = Rect.new(0,(sel) ? @button.height/2 : 0,@button.width,@button.height/2)
|
||||
self.bitmap.blt(0,0,@button.bitmap,rect)
|
||||
rect = Rect.new(0, (sel) ? @button.height / 2 : 0, @button.width, @button.height / 2)
|
||||
self.bitmap.blt(0, 0, @button.bitmap, rect)
|
||||
textx = (@command[2]) ? 164 : (GameData::Item.get(@command[0]).is_important?) ? 146 : 124
|
||||
textpos = [
|
||||
[@command[1],textx,16,2,Color.new(248,248,248),Color.new(40,40,40),1],
|
||||
[@command[1], textx, 16, 2, Color.new(248, 248, 248), Color.new(40, 40, 40), 1],
|
||||
]
|
||||
if !@command[2]
|
||||
if !GameData::Item.get(@command[0]).is_important?
|
||||
qty = $bag.quantity(@command[0])
|
||||
if qty>99
|
||||
textpos.push([_INTL(">99"),230,16,1,
|
||||
Color.new(248,248,248),Color.new(40,40,40),1])
|
||||
if qty > 99
|
||||
textpos.push([_INTL(">99"), 230, 16, 1,
|
||||
Color.new(248, 248, 248), Color.new(40, 40, 40), 1])
|
||||
else
|
||||
textpos.push([_INTL("x{1}",qty),230,16,1,
|
||||
Color.new(248,248,248),Color.new(40,40,40),1])
|
||||
textpos.push([_INTL("x{1}", qty), 230, 16, 1,
|
||||
Color.new(248, 248, 248), Color.new(40, 40, 40), 1])
|
||||
end
|
||||
end
|
||||
end
|
||||
pbDrawTextPositions(self.bitmap,textpos)
|
||||
pbDrawTextPositions(self.bitmap, textpos)
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -111,29 +111,29 @@ class PokemonReadyMenu_Scene
|
||||
@itemcommands.push(@commands[1][i][1])
|
||||
end
|
||||
@index = $bag.ready_menu_selection
|
||||
if @index[0]>=@movecommands.length && @movecommands.length>0
|
||||
@index[0] = @movecommands.length-1
|
||||
if @index[0] >= @movecommands.length && @movecommands.length > 0
|
||||
@index[0] = @movecommands.length - 1
|
||||
end
|
||||
if @index[1]>=@itemcommands.length && @itemcommands.length>0
|
||||
@index[1] = @itemcommands.length-1
|
||||
if @index[1] >= @itemcommands.length && @itemcommands.length > 0
|
||||
@index[1] = @itemcommands.length - 1
|
||||
end
|
||||
if @index[2]==0 && @movecommands.length==0
|
||||
if @index[2] == 0 && @movecommands.length == 0
|
||||
@index[2] = 1
|
||||
elsif @index[2]==1 && @itemcommands.length==0
|
||||
elsif @index[2] == 1 && @itemcommands.length == 0
|
||||
@index[2] = 0
|
||||
end
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["cmdwindow"] = Window_CommandPokemon.new((@index[2]==0) ? @movecommands : @itemcommands)
|
||||
@sprites["cmdwindow"].height = 6*32
|
||||
@sprites["cmdwindow"] = Window_CommandPokemon.new((@index[2] == 0) ? @movecommands : @itemcommands)
|
||||
@sprites["cmdwindow"].height = 6 * 32
|
||||
@sprites["cmdwindow"].visible = false
|
||||
@sprites["cmdwindow"].viewport = @viewport
|
||||
for i in 0...@commands[0].length
|
||||
@sprites["movebutton#{i}"] = ReadyMenuButton.new(i,@commands[0][i],@index[0],@index[2],@viewport)
|
||||
@sprites["movebutton#{i}"] = ReadyMenuButton.new(i, @commands[0][i], @index[0], @index[2], @viewport)
|
||||
end
|
||||
for i in 0...@commands[1].length
|
||||
@sprites["itembutton#{i}"] = ReadyMenuButton.new(i,@commands[1][i],@index[1],@index[2],@viewport)
|
||||
@sprites["itembutton#{i}"] = ReadyMenuButton.new(i, @commands[1][i], @index[1], @index[2], @viewport)
|
||||
end
|
||||
pbSEPlay("GUI menu open")
|
||||
end
|
||||
@@ -161,15 +161,15 @@ class PokemonReadyMenu_Scene
|
||||
def pbShowCommands
|
||||
ret = -1
|
||||
cmdwindow = @sprites["cmdwindow"]
|
||||
cmdwindow.commands = (@index[2]==0) ? @movecommands : @itemcommands
|
||||
cmdwindow.commands = (@index[2] == 0) ? @movecommands : @itemcommands
|
||||
cmdwindow.index = @index[@index[2]]
|
||||
cmdwindow.visible = false
|
||||
loop do
|
||||
pbUpdate
|
||||
if Input.trigger?(Input::LEFT) && @index[2]==1 && @movecommands.length>0
|
||||
if Input.trigger?(Input::LEFT) && @index[2] == 1 && @movecommands.length > 0
|
||||
@index[2] = 0
|
||||
pbChangeSide
|
||||
elsif Input.trigger?(Input::RIGHT) && @index[2]==0 && @itemcommands.length>0
|
||||
elsif Input.trigger?(Input::RIGHT) && @index[2] == 0 && @itemcommands.length > 0
|
||||
@index[2] = 1
|
||||
pbChangeSide
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
@@ -177,7 +177,7 @@ class PokemonReadyMenu_Scene
|
||||
ret = -1
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
ret = [@index[2],cmdwindow.index]
|
||||
ret = [@index[2], cmdwindow.index]
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -196,7 +196,7 @@ class PokemonReadyMenu_Scene
|
||||
for i in 0...@commands[1].length
|
||||
@sprites["itembutton#{i}"].side = @index[2]
|
||||
end
|
||||
@sprites["cmdwindow"].commands = (@index[2]==0) ? @movecommands : @itemcommands
|
||||
@sprites["cmdwindow"].commands = (@index[2] == 0) ? @movecommands : @itemcommands
|
||||
@sprites["cmdwindow"].index = @index[@index[2]]
|
||||
end
|
||||
|
||||
@@ -205,12 +205,12 @@ class PokemonReadyMenu_Scene
|
||||
def pbUpdate
|
||||
oldindex = @index[@index[2]]
|
||||
@index[@index[2]] = @sprites["cmdwindow"].index
|
||||
if @index[@index[2]]!=oldindex
|
||||
if @index[2]==0
|
||||
if @index[@index[2]] != oldindex
|
||||
if @index[2] == 0
|
||||
for i in 0...@commands[0].length
|
||||
@sprites["movebutton#{i}"].selected = @index[@index[2]]
|
||||
end
|
||||
elsif @index[2]==1
|
||||
elsif @index[2] == 1
|
||||
for i in 0...@commands[1].length
|
||||
@sprites["itembutton#{i}"].selected = @index[@index[2]]
|
||||
end
|
||||
@@ -240,28 +240,28 @@ class PokemonReadyMenu
|
||||
@scene.pbShowMenu
|
||||
end
|
||||
|
||||
def pbStartReadyMenu(moves,items)
|
||||
commands = [[],[]] # Moves, items
|
||||
def pbStartReadyMenu(moves, items)
|
||||
commands = [[], []] # Moves, items
|
||||
for i in moves
|
||||
commands[0].push([i[0], GameData::Move.get(i[0]).name, true, i[1]])
|
||||
end
|
||||
commands[0].sort! { |a,b| a[1]<=>b[1] }
|
||||
commands[0].sort! { |a, b| a[1] <=> b[1] }
|
||||
for i in items
|
||||
commands[1].push([i, GameData::Item.get(i).name, false])
|
||||
end
|
||||
commands[1].sort! { |a,b| a[1]<=>b[1] }
|
||||
commands[1].sort! { |a, b| a[1] <=> b[1] }
|
||||
@scene.pbStartScene(commands)
|
||||
loop do
|
||||
command = @scene.pbShowCommands
|
||||
break if command==-1
|
||||
if command[0]==0 # Use a move
|
||||
break if command == -1
|
||||
if command[0] == 0 # Use a move
|
||||
move = commands[0][command[1]][0]
|
||||
user = $player.party[commands[0][command[1]][3]]
|
||||
if move == :FLY
|
||||
ret = nil
|
||||
pbFadeOutInWithUpdate(99999,@scene.sprites) {
|
||||
pbFadeOutInWithUpdate(99999, @scene.sprites) {
|
||||
pbHideMenu
|
||||
scene = PokemonRegionMap_Scene.new(-1,false)
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartFlyScreen
|
||||
pbShowMenu if !ret
|
||||
@@ -269,14 +269,14 @@ class PokemonReadyMenu
|
||||
if ret
|
||||
$game_temp.fly_destination = ret
|
||||
$game_temp.in_menu = false
|
||||
pbUseHiddenMove(user,move)
|
||||
pbUseHiddenMove(user, move)
|
||||
break
|
||||
end
|
||||
else
|
||||
pbHideMenu
|
||||
if pbConfirmUseHiddenMove(user,move)
|
||||
if pbConfirmUseHiddenMove(user, move)
|
||||
$game_temp.in_menu = false
|
||||
pbUseHiddenMove(user,move)
|
||||
pbUseHiddenMove(user, move)
|
||||
break
|
||||
else
|
||||
pbShowMenu
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,11 +11,11 @@ class Window_PokemonItemStorage < Window_DrawableCommand
|
||||
refresh
|
||||
end
|
||||
|
||||
def initialize(bag,x,y,width,height)
|
||||
def initialize(bag, x, y, width, height)
|
||||
@bag = bag
|
||||
@sortIndex = -1
|
||||
@adapter = PokemonMartAdapter.new
|
||||
super(x,y,width,height)
|
||||
super(x, y, width, height)
|
||||
self.windowskin = nil
|
||||
end
|
||||
|
||||
@@ -25,27 +25,27 @@ class Window_PokemonItemStorage < Window_DrawableCommand
|
||||
end
|
||||
|
||||
def itemCount
|
||||
return @bag.length+1
|
||||
return @bag.length + 1
|
||||
end
|
||||
|
||||
def drawItem(index,_count,rect)
|
||||
rect = drawCursor(index,rect)
|
||||
def drawItem(index, _count, rect)
|
||||
rect = drawCursor(index, rect)
|
||||
textpos = []
|
||||
if index==@bag.length
|
||||
textpos.push([_INTL("CANCEL"),rect.x,rect.y-6,false,self.baseColor,self.shadowColor])
|
||||
if index == @bag.length
|
||||
textpos.push([_INTL("CANCEL"), rect.x, rect.y - 6, false, self.baseColor, self.shadowColor])
|
||||
else
|
||||
item = @bag[index][0]
|
||||
itemname = @adapter.getDisplayName(item)
|
||||
baseColor = (index==@sortIndex) ? Color.new(248,24,24) : self.baseColor
|
||||
textpos.push([itemname,rect.x,rect.y-6,false,self.baseColor,self.shadowColor])
|
||||
baseColor = (index == @sortIndex) ? Color.new(248, 24, 24) : self.baseColor
|
||||
textpos.push([itemname, rect.x, rect.y - 6, false, self.baseColor, self.shadowColor])
|
||||
if !GameData::Item.get(item).is_important? # Not a Key item/HM/TM
|
||||
qty = _ISPRINTF("x{1: 2d}",@bag[index][1])
|
||||
qty = _ISPRINTF("x{1: 2d}", @bag[index][1])
|
||||
sizeQty = self.contents.text_size(qty).width
|
||||
xQty = rect.x+rect.width-sizeQty-2
|
||||
textpos.push([qty,xQty,rect.y-6,false,baseColor,self.shadowColor])
|
||||
xQty = rect.x + rect.width - sizeQty - 2
|
||||
textpos.push([qty, xQty, rect.y - 6, false, baseColor, self.shadowColor])
|
||||
end
|
||||
end
|
||||
pbDrawTextPositions(self.contents,textpos)
|
||||
pbDrawTextPositions(self.contents, textpos)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,12 +53,12 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class ItemStorage_Scene
|
||||
ITEMLISTBASECOLOR = Color.new(88,88,80)
|
||||
ITEMLISTSHADOWCOLOR = Color.new(168,184,184)
|
||||
ITEMTEXTBASECOLOR = Color.new(248,248,248)
|
||||
ITEMTEXTSHADOWCOLOR = Color.new(0,0,0)
|
||||
TITLEBASECOLOR = Color.new(248,248,248)
|
||||
TITLESHADOWCOLOR = Color.new(0,0,0)
|
||||
ITEMLISTBASECOLOR = Color.new(88, 88, 80)
|
||||
ITEMLISTSHADOWCOLOR = Color.new(168, 184, 184)
|
||||
ITEMTEXTBASECOLOR = Color.new(248, 248, 248)
|
||||
ITEMTEXTSHADOWCOLOR = Color.new(0, 0, 0)
|
||||
TITLEBASECOLOR = Color.new(248, 248, 248)
|
||||
TITLESHADOWCOLOR = Color.new(0, 0, 0)
|
||||
ITEMSVISIBLE = 7
|
||||
|
||||
def initialize(title)
|
||||
@@ -70,27 +70,27 @@ class ItemStorage_Scene
|
||||
end
|
||||
|
||||
def pbStartScene(bag)
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@bag = bag
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/pcItembg")
|
||||
@sprites["icon"] = ItemIconSprite.new(50,334,nil,@viewport)
|
||||
@sprites["icon"] = ItemIconSprite.new(50, 334, nil, @viewport)
|
||||
# Item list
|
||||
@sprites["itemwindow"] = Window_PokemonItemStorage.new(@bag,98,14,334,32+ITEMSVISIBLE*32)
|
||||
@sprites["itemwindow"] = Window_PokemonItemStorage.new(@bag, 98, 14, 334, 32 + ITEMSVISIBLE * 32)
|
||||
@sprites["itemwindow"].viewport = @viewport
|
||||
@sprites["itemwindow"].index = 0
|
||||
@sprites["itemwindow"].baseColor = ITEMLISTBASECOLOR
|
||||
@sprites["itemwindow"].shadowColor = ITEMLISTSHADOWCOLOR
|
||||
@sprites["itemwindow"].refresh
|
||||
# Title
|
||||
@sprites["pocketwindow"] = BitmapSprite.new(88,64,@viewport)
|
||||
@sprites["pocketwindow"] = BitmapSprite.new(88, 64, @viewport)
|
||||
@sprites["pocketwindow"].x = 14
|
||||
@sprites["pocketwindow"].y = 16
|
||||
pbSetNarrowFont(@sprites["pocketwindow"].bitmap)
|
||||
# Item description
|
||||
@sprites["itemtextwindow"] = Window_UnformattedTextPokemon.newWithSize("",84,270,Graphics.width-84,128,@viewport)
|
||||
@sprites["itemtextwindow"] = Window_UnformattedTextPokemon.newWithSize("", 84, 270, Graphics.width - 84, 128, @viewport)
|
||||
@sprites["itemtextwindow"].baseColor = ITEMTEXTBASECOLOR
|
||||
@sprites["itemtextwindow"].shadowColor = ITEMTEXTSHADOWCOLOR
|
||||
@sprites["itemtextwindow"].windowskin = nil
|
||||
@@ -101,7 +101,7 @@ class ItemStorage_Scene
|
||||
@sprites["msgwindow"] = Window_AdvancedTextPokemon.new("")
|
||||
@sprites["msgwindow"].visible = false
|
||||
@sprites["msgwindow"].viewport = @viewport
|
||||
pbBottomLeftLines(@sprites["helpwindow"],1)
|
||||
pbBottomLeftLines(@sprites["helpwindow"], 1)
|
||||
pbDeactivateWindows(@sprites)
|
||||
pbRefresh
|
||||
pbFadeInAndShow(@sprites)
|
||||
@@ -113,26 +113,26 @@ class ItemStorage_Scene
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbChooseNumber(helptext,maximum)
|
||||
return UIHelper.pbChooseNumber(@sprites["helpwindow"],helptext,maximum) { update }
|
||||
def pbChooseNumber(helptext, maximum)
|
||||
return UIHelper.pbChooseNumber(@sprites["helpwindow"], helptext, maximum) { update }
|
||||
end
|
||||
|
||||
def pbDisplay(msg,brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"],msg,brief) { update }
|
||||
def pbDisplay(msg, brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"], msg, brief) { update }
|
||||
end
|
||||
|
||||
def pbConfirm(msg)
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"],msg) { update }
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"], msg) { update }
|
||||
end
|
||||
|
||||
def pbShowCommands(helptext,commands)
|
||||
return UIHelper.pbShowCommands(@sprites["helpwindow"],helptext,commands) { update }
|
||||
def pbShowCommands(helptext, commands)
|
||||
return UIHelper.pbShowCommands(@sprites["helpwindow"], helptext, commands) { update }
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
bm = @sprites["pocketwindow"].bitmap
|
||||
# Draw title at upper left corner ("Toss Item/Withdraw Item")
|
||||
drawTextEx(bm,0,4,bm.width,2,@title,TITLEBASECOLOR,TITLESHADOWCOLOR)
|
||||
drawTextEx(bm, 0, 4, bm.width, 2, @title, TITLEBASECOLOR, TITLESHADOWCOLOR)
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
# Draw item icon
|
||||
@sprites["icon"].item = itemwindow.item
|
||||
@@ -150,17 +150,17 @@ class ItemStorage_Scene
|
||||
@sprites["helpwindow"].visible = false
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
itemwindow.refresh
|
||||
pbActivateWindow(@sprites,"itemwindow") {
|
||||
pbActivateWindow(@sprites, "itemwindow") {
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
olditem = itemwindow.item
|
||||
self.update
|
||||
pbRefresh if itemwindow.item!=olditem
|
||||
pbRefresh if itemwindow.item != olditem
|
||||
if Input.trigger?(Input::BACK)
|
||||
return nil
|
||||
elsif Input.trigger?(Input::USE)
|
||||
if itemwindow.index<@bag.length
|
||||
if itemwindow.index < @bag.length
|
||||
pbRefresh
|
||||
return @bag[itemwindow.index][0]
|
||||
else
|
||||
@@ -197,13 +197,13 @@ end
|
||||
#===============================================================================
|
||||
module UIHelper
|
||||
# Letter by letter display of the message _msg_ by the window _helpwindow_.
|
||||
def self.pbDisplay(helpwindow,msg,brief)
|
||||
def self.pbDisplay(helpwindow, msg, brief)
|
||||
cw = helpwindow
|
||||
oldvisible = cw.visible
|
||||
cw.letterbyletter = true
|
||||
cw.text = msg+"\1"
|
||||
cw.text = msg + "\1"
|
||||
cw.visible = true
|
||||
pbBottomLeftLines(cw,2)
|
||||
pbBottomLeftLines(cw, 2)
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -217,13 +217,13 @@ module UIHelper
|
||||
cw.visible = oldvisible
|
||||
end
|
||||
|
||||
def self.pbDisplayStatic(msgwindow,message)
|
||||
def self.pbDisplayStatic(msgwindow, message)
|
||||
oldvisible = msgwindow.visible
|
||||
msgwindow.visible = true
|
||||
msgwindow.letterbyletter = false
|
||||
msgwindow.width = Graphics.width
|
||||
msgwindow.resizeHeightToFit(message,Graphics.width)
|
||||
msgwindow.text = message
|
||||
msgwindow.resizeHeightToFit(message, Graphics.width)
|
||||
msgwindow.text = message
|
||||
pbBottomRight(msgwindow)
|
||||
loop do
|
||||
Graphics.update
|
||||
@@ -239,14 +239,14 @@ module UIHelper
|
||||
|
||||
# Letter by letter display of the message _msg_ by the window _helpwindow_,
|
||||
# used to ask questions. Returns true if the user chose yes, false if no.
|
||||
def self.pbConfirm(helpwindow,msg)
|
||||
def self.pbConfirm(helpwindow, msg)
|
||||
dw = helpwindow
|
||||
oldvisible = dw.visible
|
||||
dw.letterbyletter = true
|
||||
dw.text = msg
|
||||
dw.visible = true
|
||||
pbBottomLeftLines(dw,2)
|
||||
commands = [_INTL("Yes"),_INTL("No")]
|
||||
pbBottomLeftLines(dw, 2)
|
||||
commands = [_INTL("Yes"), _INTL("No")]
|
||||
cw = Window_CommandPokemon.new(commands)
|
||||
cw.index = 0
|
||||
cw.viewport = helpwindow.viewport
|
||||
@@ -265,7 +265,7 @@ module UIHelper
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
ret = (cw.index==0)
|
||||
ret = (cw.index == 0)
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -275,7 +275,7 @@ module UIHelper
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.pbChooseNumber(helpwindow,helptext,maximum,initnum = 1)
|
||||
def self.pbChooseNumber(helpwindow, helptext, maximum, initnum = 1)
|
||||
oldvisible = helpwindow.visible
|
||||
helpwindow.visible = true
|
||||
helpwindow.text = helptext
|
||||
@@ -285,10 +285,10 @@ module UIHelper
|
||||
numwindow = Window_UnformattedTextPokemon.new("x000")
|
||||
numwindow.viewport = helpwindow.viewport
|
||||
numwindow.letterbyletter = false
|
||||
numwindow.text = _ISPRINTF("x{1:03d}",curnumber)
|
||||
numwindow.resizeToFit(numwindow.text,Graphics.width)
|
||||
numwindow.text = _ISPRINTF("x{1:03d}", curnumber)
|
||||
numwindow.resizeToFit(numwindow.text, Graphics.width)
|
||||
pbBottomRight(numwindow)
|
||||
helpwindow.resizeHeightToFit(helpwindow.text,Graphics.width-numwindow.width)
|
||||
helpwindow.resizeHeightToFit(helpwindow.text, Graphics.width - numwindow.width)
|
||||
pbBottomLeft(helpwindow)
|
||||
loop do
|
||||
Graphics.update
|
||||
@@ -306,23 +306,23 @@ module UIHelper
|
||||
break
|
||||
elsif Input.repeat?(Input::UP)
|
||||
curnumber += 1
|
||||
curnumber = 1 if curnumber>maximum
|
||||
numwindow.text = _ISPRINTF("x{1:03d}",curnumber)
|
||||
curnumber = 1 if curnumber > maximum
|
||||
numwindow.text = _ISPRINTF("x{1:03d}", curnumber)
|
||||
pbPlayCursorSE
|
||||
elsif Input.repeat?(Input::DOWN)
|
||||
curnumber -= 1
|
||||
curnumber = maximum if curnumber<1
|
||||
numwindow.text = _ISPRINTF("x{1:03d}",curnumber)
|
||||
curnumber = maximum if curnumber < 1
|
||||
numwindow.text = _ISPRINTF("x{1:03d}", curnumber)
|
||||
pbPlayCursorSE
|
||||
elsif Input.repeat?(Input::LEFT)
|
||||
curnumber -= 10
|
||||
curnumber = 1 if curnumber<1
|
||||
numwindow.text = _ISPRINTF("x{1:03d}",curnumber)
|
||||
curnumber = 1 if curnumber < 1
|
||||
numwindow.text = _ISPRINTF("x{1:03d}", curnumber)
|
||||
pbPlayCursorSE
|
||||
elsif Input.repeat?(Input::RIGHT)
|
||||
curnumber += 10
|
||||
curnumber = maximum if curnumber>maximum
|
||||
numwindow.text = _ISPRINTF("x{1:03d}",curnumber)
|
||||
curnumber = maximum if curnumber > maximum
|
||||
numwindow.text = _ISPRINTF("x{1:03d}", curnumber)
|
||||
pbPlayCursorSE
|
||||
end
|
||||
end
|
||||
@@ -331,7 +331,7 @@ module UIHelper
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.pbShowCommands(helpwindow,helptext,commands,initcmd = 0)
|
||||
def self.pbShowCommands(helpwindow, helptext, commands, initcmd = 0)
|
||||
ret = -1
|
||||
oldvisible = helpwindow.visible
|
||||
helpwindow.visible = helptext ? true : false
|
||||
@@ -342,7 +342,7 @@ module UIHelper
|
||||
begin
|
||||
cmdwindow.viewport = helpwindow.viewport
|
||||
pbBottomRight(cmdwindow)
|
||||
helpwindow.resizeHeightToFit(helpwindow.text,Graphics.width-cmdwindow.width)
|
||||
helpwindow.resizeHeightToFit(helpwindow.text, Graphics.width - cmdwindow.width)
|
||||
pbBottomLeft(helpwindow)
|
||||
loop do
|
||||
Graphics.update
|
||||
|
||||
@@ -26,7 +26,7 @@ class StorageSystemPC
|
||||
|
||||
def name
|
||||
if $player.seen_storage_creator
|
||||
return _INTL("{1}'s PC",pbGetStorageCreator)
|
||||
return _INTL("{1}'s PC", pbGetStorageCreator)
|
||||
else
|
||||
return _INTL("Someone's PC")
|
||||
end
|
||||
@@ -44,27 +44,27 @@ class StorageSystemPC
|
||||
[_INTL("Organize the Pokémon in Boxes and in your party."),
|
||||
_INTL("Move Pokémon stored in Boxes to your party."),
|
||||
_INTL("Store Pokémon in your party in Boxes."),
|
||||
_INTL("Return to the previous menu.")],-1,command
|
||||
_INTL("Return to the previous menu.")], -1, command
|
||||
)
|
||||
if command>=0 && command<3
|
||||
if command==1 # Withdraw
|
||||
if command >= 0 && command < 3
|
||||
if command == 1 # Withdraw
|
||||
if $PokemonStorage.party_full?
|
||||
pbMessage(_INTL("Your party is full!"))
|
||||
next
|
||||
end
|
||||
elsif command==2 # Deposit
|
||||
count=0
|
||||
elsif command == 2 # Deposit
|
||||
count = 0
|
||||
for p in $PokemonStorage.party
|
||||
count += 1 if p && !p.egg? && p.hp>0
|
||||
count += 1 if p && !p.egg? && p.hp > 0
|
||||
end
|
||||
if count<=1
|
||||
if count <= 1
|
||||
pbMessage(_INTL("Can't deposit the last Pokémon!"))
|
||||
next
|
||||
end
|
||||
end
|
||||
pbFadeOutIn {
|
||||
scene = PokemonStorageScene.new
|
||||
screen = PokemonStorageScreen.new(scene,$PokemonStorage)
|
||||
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
|
||||
screen.pbStartScreen(command)
|
||||
}
|
||||
else
|
||||
@@ -94,11 +94,11 @@ module PokemonPCList
|
||||
end
|
||||
|
||||
def self.callCommand(cmd)
|
||||
return false if cmd<0 || cmd>=@@pclist.length
|
||||
return false if cmd < 0 || cmd >= @@pclist.length
|
||||
i = 0
|
||||
for pc in @@pclist
|
||||
next if !pc.shouldShow?
|
||||
if i==cmd
|
||||
if i == cmd
|
||||
pc.access
|
||||
return true
|
||||
end
|
||||
@@ -122,7 +122,7 @@ def pbPCItemStorage
|
||||
[_INTL("Take out items from the PC."),
|
||||
_INTL("Store items in the PC."),
|
||||
_INTL("Throw away items stored in the PC."),
|
||||
_INTL("Go back to the previous menu.")],-1,command
|
||||
_INTL("Go back to the previous menu.")], -1, command
|
||||
)
|
||||
case command
|
||||
when 0 # Withdraw Item
|
||||
@@ -164,26 +164,26 @@ def pbPCItemStorage
|
||||
end
|
||||
|
||||
def pbPCMailbox
|
||||
if !$PokemonGlobal.mailbox || $PokemonGlobal.mailbox.length==0
|
||||
if !$PokemonGlobal.mailbox || $PokemonGlobal.mailbox.length == 0
|
||||
pbMessage(_INTL("There's no Mail here."))
|
||||
else
|
||||
loop do
|
||||
command = 0
|
||||
commands=[]
|
||||
commands = []
|
||||
for mail in $PokemonGlobal.mailbox
|
||||
commands.push(mail.sender)
|
||||
end
|
||||
commands.push(_INTL("Cancel"))
|
||||
command = pbShowCommands(nil,commands,-1,command)
|
||||
if command>=0 && command<$PokemonGlobal.mailbox.length
|
||||
command = pbShowCommands(nil, commands, -1, command)
|
||||
if command >= 0 && command < $PokemonGlobal.mailbox.length
|
||||
mailIndex = command
|
||||
commandMail = pbMessage(_INTL("What do you want to do with {1}'s Mail?",
|
||||
$PokemonGlobal.mailbox[mailIndex].sender),[
|
||||
$PokemonGlobal.mailbox[mailIndex].sender), [
|
||||
_INTL("Read"),
|
||||
_INTL("Move to Bag"),
|
||||
_INTL("Give"),
|
||||
_INTL("Cancel")
|
||||
],-1)
|
||||
], -1)
|
||||
case commandMail
|
||||
when 0 # Read
|
||||
pbFadeOutIn {
|
||||
@@ -215,11 +215,11 @@ end
|
||||
def pbTrainerPCMenu
|
||||
command = 0
|
||||
loop do
|
||||
command = pbMessage(_INTL("What do you want to do?"),[
|
||||
command = pbMessage(_INTL("What do you want to do?"), [
|
||||
_INTL("Item Storage"),
|
||||
_INTL("Mailbox"),
|
||||
_INTL("Turn Off")
|
||||
],-1,nil,command)
|
||||
], -1, nil, command)
|
||||
case command
|
||||
when 0 then pbPCItemStorage
|
||||
when 1 then pbPCMailbox
|
||||
@@ -239,8 +239,8 @@ def pbPokeCenterPC
|
||||
command = 0
|
||||
loop do
|
||||
commands = PokemonPCList.getCommandList
|
||||
command = pbMessage(_INTL("Which PC should be accessed?"),commands,
|
||||
commands.length,nil,command)
|
||||
command = pbMessage(_INTL("Which PC should be accessed?"), commands,
|
||||
commands.length, nil, command)
|
||||
break if !PokemonPCList.callCommand(command)
|
||||
end
|
||||
pbSEPlay("PC close")
|
||||
|
||||
@@ -137,8 +137,8 @@ class Window_PokemonMart < Window_DrawableCommand
|
||||
@adapter = adapter
|
||||
super(x, y, width, height, viewport)
|
||||
@selarrow = AnimatedBitmap.new("Graphics/Pictures/martSel")
|
||||
@baseColor = Color.new(88,88,80)
|
||||
@shadowColor = Color.new(168,184,184)
|
||||
@baseColor = Color.new(88, 88, 80)
|
||||
@shadowColor = Color.new(168, 184, 184)
|
||||
self.windowskin = nil
|
||||
end
|
||||
|
||||
@@ -154,7 +154,7 @@ class Window_PokemonMart < Window_DrawableCommand
|
||||
textpos = []
|
||||
rect = drawCursor(index, rect)
|
||||
ypos = rect.y
|
||||
if index == count-1
|
||||
if index == count - 1
|
||||
textpos.push([_INTL("CANCEL"), rect.x, ypos - 4, false, self.baseColor, self.shadowColor])
|
||||
else
|
||||
item = @stock[index]
|
||||
@@ -407,7 +407,7 @@ class PokemonMart_Scene
|
||||
end
|
||||
end
|
||||
|
||||
def pbChooseNumber(helptext,item,maximum)
|
||||
def pbChooseNumber(helptext, item, maximum)
|
||||
curnumber = 1
|
||||
ret = 0
|
||||
helpwindow = @sprites["helpwindow"]
|
||||
@@ -521,10 +521,10 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonMartScreen
|
||||
def initialize(scene,stock)
|
||||
@scene=scene
|
||||
@stock=stock
|
||||
@adapter=PokemonMartAdapter.new
|
||||
def initialize(scene, stock)
|
||||
@scene = scene
|
||||
@stock = stock
|
||||
@adapter = PokemonMartAdapter.new
|
||||
end
|
||||
|
||||
def pbConfirm(msg)
|
||||
@@ -535,51 +535,51 @@ class PokemonMartScreen
|
||||
return @scene.pbDisplay(msg)
|
||||
end
|
||||
|
||||
def pbDisplayPaused(msg,&block)
|
||||
return @scene.pbDisplayPaused(msg,&block)
|
||||
def pbDisplayPaused(msg, &block)
|
||||
return @scene.pbDisplayPaused(msg, &block)
|
||||
end
|
||||
|
||||
def pbBuyScreen
|
||||
@scene.pbStartBuyScene(@stock,@adapter)
|
||||
item=nil
|
||||
@scene.pbStartBuyScene(@stock, @adapter)
|
||||
item = nil
|
||||
loop do
|
||||
item=@scene.pbChooseBuyItem
|
||||
item = @scene.pbChooseBuyItem
|
||||
break if !item
|
||||
quantity=0
|
||||
itemname=@adapter.getDisplayName(item)
|
||||
price=@adapter.getPrice(item)
|
||||
if @adapter.getMoney<price
|
||||
quantity = 0
|
||||
itemname = @adapter.getDisplayName(item)
|
||||
price = @adapter.getPrice(item)
|
||||
if @adapter.getMoney < price
|
||||
pbDisplayPaused(_INTL("You don't have enough money."))
|
||||
next
|
||||
end
|
||||
if GameData::Item.get(item).is_important?
|
||||
if !pbConfirm(_INTL("Certainly. You want {1}. That will be ${2}. OK?",
|
||||
itemname,price.to_s_formatted))
|
||||
itemname, price.to_s_formatted))
|
||||
next
|
||||
end
|
||||
quantity=1
|
||||
quantity = 1
|
||||
else
|
||||
maxafford = (price <= 0) ? Settings::BAG_MAX_PER_SLOT : @adapter.getMoney / price
|
||||
maxafford = Settings::BAG_MAX_PER_SLOT if maxafford > Settings::BAG_MAX_PER_SLOT
|
||||
quantity=@scene.pbChooseNumber(
|
||||
_INTL("{1}? Certainly. How many would you like?",itemname),item,maxafford)
|
||||
next if quantity==0
|
||||
price*=quantity
|
||||
quantity = @scene.pbChooseNumber(
|
||||
_INTL("{1}? Certainly. How many would you like?", itemname), item, maxafford)
|
||||
next if quantity == 0
|
||||
price *= quantity
|
||||
if !pbConfirm(_INTL("{1}, and you want {2}. That will be ${3}. OK?",
|
||||
itemname,quantity,price.to_s_formatted))
|
||||
itemname, quantity, price.to_s_formatted))
|
||||
next
|
||||
end
|
||||
end
|
||||
if @adapter.getMoney<price
|
||||
if @adapter.getMoney < price
|
||||
pbDisplayPaused(_INTL("You don't have enough money."))
|
||||
next
|
||||
end
|
||||
added=0
|
||||
added = 0
|
||||
quantity.times do
|
||||
break if !@adapter.addItem(item)
|
||||
added+=1
|
||||
added += 1
|
||||
end
|
||||
if added!=quantity
|
||||
if added != quantity
|
||||
added.times do
|
||||
if !@adapter.removeItem(item)
|
||||
raise _INTL("Failed to delete stored items")
|
||||
@@ -589,7 +589,7 @@ class PokemonMartScreen
|
||||
else
|
||||
$stats.money_spent_at_marts += price
|
||||
$stats.mart_items_bought += quantity
|
||||
@adapter.setMoney(@adapter.getMoney-price)
|
||||
@adapter.setMoney(@adapter.getMoney - price)
|
||||
@stock.delete_if { |item| GameData::Item.get(item).is_important? && $bag.has?(item) }
|
||||
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }
|
||||
if quantity >= 10 && $bag && GameData::Item.exists?(:PREMIERBALL)
|
||||
@@ -618,37 +618,37 @@ class PokemonMartScreen
|
||||
end
|
||||
|
||||
def pbSellScreen
|
||||
item=@scene.pbStartSellScene(@adapter.getInventory,@adapter)
|
||||
item = @scene.pbStartSellScene(@adapter.getInventory, @adapter)
|
||||
loop do
|
||||
item=@scene.pbChooseSellItem
|
||||
item = @scene.pbChooseSellItem
|
||||
break if !item
|
||||
itemname=@adapter.getDisplayName(item)
|
||||
itemname = @adapter.getDisplayName(item)
|
||||
if !@adapter.canSell?(item)
|
||||
pbDisplayPaused(_INTL("{1}? Oh, no. I can't buy that.",itemname))
|
||||
pbDisplayPaused(_INTL("{1}? Oh, no. I can't buy that.", itemname))
|
||||
next
|
||||
end
|
||||
price=@adapter.getPrice(item,true)
|
||||
qty=@adapter.getQuantity(item)
|
||||
next if qty==0
|
||||
price = @adapter.getPrice(item, true)
|
||||
qty = @adapter.getQuantity(item)
|
||||
next if qty == 0
|
||||
@scene.pbShowMoney
|
||||
if qty>1
|
||||
qty=@scene.pbChooseNumber(
|
||||
_INTL("{1}? How many would you like to sell?",itemname),item,qty)
|
||||
if qty > 1
|
||||
qty = @scene.pbChooseNumber(
|
||||
_INTL("{1}? How many would you like to sell?", itemname), item, qty)
|
||||
end
|
||||
if qty==0
|
||||
if qty == 0
|
||||
@scene.pbHideMoney
|
||||
next
|
||||
end
|
||||
price/=2
|
||||
price*=qty
|
||||
if pbConfirm(_INTL("I can pay ${1}. Would that be OK?",price.to_s_formatted))
|
||||
price /= 2
|
||||
price *= qty
|
||||
if pbConfirm(_INTL("I can pay ${1}. Would that be OK?", price.to_s_formatted))
|
||||
old_money = @adapter.getMoney
|
||||
@adapter.setMoney(@adapter.getMoney+price)
|
||||
@adapter.setMoney(@adapter.getMoney + price)
|
||||
$stats.money_earned_at_marts += @adapter.getMoney - old_money
|
||||
qty.times do
|
||||
@adapter.removeItem(item)
|
||||
end
|
||||
pbDisplayPaused(_INTL("Turned over the {1} and received ${2}.",itemname,price.to_s_formatted)) { pbSEPlay("Mart buy item") }
|
||||
pbDisplayPaused(_INTL("Turned over the {1} and received ${2}.", itemname, price.to_s_formatted)) { pbSEPlay("Mart buy item") }
|
||||
@scene.pbRefresh
|
||||
end
|
||||
@scene.pbHideMoney
|
||||
@@ -660,7 +660,7 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbPokemonMart(stock,speech = nil,cantsell = false)
|
||||
def pbPokemonMart(stock, speech = nil, cantsell = false)
|
||||
stock.delete_if { |item| GameData::Item.get(item).is_important? && $bag.has?(item) }
|
||||
commands = []
|
||||
cmdBuy = -1
|
||||
@@ -671,22 +671,22 @@ def pbPokemonMart(stock,speech = nil,cantsell = false)
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit")
|
||||
cmd = pbMessage(
|
||||
speech ? speech : _INTL("Welcome! How may I serve you?"),
|
||||
commands,cmdQuit+1)
|
||||
commands, cmdQuit + 1)
|
||||
loop do
|
||||
if cmdBuy>=0 && cmd==cmdBuy
|
||||
if cmdBuy >= 0 && cmd == cmdBuy
|
||||
scene = PokemonMart_Scene.new
|
||||
screen = PokemonMartScreen.new(scene,stock)
|
||||
screen = PokemonMartScreen.new(scene, stock)
|
||||
screen.pbBuyScreen
|
||||
elsif cmdSell>=0 && cmd==cmdSell
|
||||
elsif cmdSell >= 0 && cmd == cmdSell
|
||||
scene = PokemonMart_Scene.new
|
||||
screen = PokemonMartScreen.new(scene,stock)
|
||||
screen = PokemonMartScreen.new(scene, stock)
|
||||
screen.pbSellScreen
|
||||
else
|
||||
pbMessage(_INTL("Please come again!"))
|
||||
break
|
||||
end
|
||||
cmd = pbMessage(_INTL("Is there anything else I can help you with?"),
|
||||
commands,cmdQuit+1)
|
||||
commands, cmdQuit + 1)
|
||||
end
|
||||
$game_temp.clear_mart_prices
|
||||
end
|
||||
|
||||
@@ -4,45 +4,45 @@
|
||||
class MoveRelearner_Scene
|
||||
VISIBLEMOVES = 4
|
||||
|
||||
def pbDisplay(msg,brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"],msg,brief) { pbUpdate }
|
||||
def pbDisplay(msg, brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"], msg, brief) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbConfirm(msg)
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"],msg) { pbUpdate }
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"], msg) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbUpdate
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
|
||||
def pbStartScene(pokemon,moves)
|
||||
@pokemon=pokemon
|
||||
@moves=moves
|
||||
moveCommands=[]
|
||||
def pbStartScene(pokemon, moves)
|
||||
@pokemon = pokemon
|
||||
@moves = moves
|
||||
moveCommands = []
|
||||
moves.each { |m| moveCommands.push(GameData::Move.get(m).name) }
|
||||
# Create sprite hash
|
||||
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z=99999
|
||||
@sprites={}
|
||||
addBackgroundPlane(@sprites,"bg","reminderbg",@viewport)
|
||||
@sprites["pokeicon"]=PokemonIconSprite.new(@pokemon,@viewport)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
addBackgroundPlane(@sprites, "bg", "reminderbg", @viewport)
|
||||
@sprites["pokeicon"] = PokemonIconSprite.new(@pokemon, @viewport)
|
||||
@sprites["pokeicon"].setOffset(PictureOrigin::Center)
|
||||
@sprites["pokeicon"].x=320
|
||||
@sprites["pokeicon"].y=84
|
||||
@sprites["background"]=IconSprite.new(0,0,@viewport)
|
||||
@sprites["pokeicon"].x = 320
|
||||
@sprites["pokeicon"].y = 84
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/reminderSel")
|
||||
@sprites["background"].y=78
|
||||
@sprites["background"].src_rect=Rect.new(0,72,258,72)
|
||||
@sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
@sprites["background"].y = 78
|
||||
@sprites["background"].src_rect = Rect.new(0, 72, 258, 72)
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
@sprites["commands"]=Window_CommandPokemon.new(moveCommands,32)
|
||||
@sprites["commands"].height=32*(VISIBLEMOVES+1)
|
||||
@sprites["commands"].visible=false
|
||||
@sprites["msgwindow"]=Window_AdvancedTextPokemon.new("")
|
||||
@sprites["msgwindow"].visible=false
|
||||
@sprites["msgwindow"].viewport=@viewport
|
||||
@typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
|
||||
@sprites["commands"] = Window_CommandPokemon.new(moveCommands, 32)
|
||||
@sprites["commands"].height = 32 * (VISIBLEMOVES + 1)
|
||||
@sprites["commands"].visible = false
|
||||
@sprites["msgwindow"] = Window_AdvancedTextPokemon.new("")
|
||||
@sprites["msgwindow"].visible = false
|
||||
@sprites["msgwindow"].viewport = @viewport
|
||||
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
|
||||
pbDrawMoveList
|
||||
pbDeactivateWindows(@sprites)
|
||||
# Fade in all sprites
|
||||
@@ -50,7 +50,7 @@ class MoveRelearner_Scene
|
||||
end
|
||||
|
||||
def pbDrawMoveList
|
||||
overlay=@sprites["overlay"].bitmap
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
@pokemon.types.each_with_index do |type, i|
|
||||
type_number = GameData::Type.get(type).icon_position
|
||||
@@ -58,68 +58,68 @@ class MoveRelearner_Scene
|
||||
type_x = (@pokemon.types.length == 1) ? 400 : 366 + 70 * i
|
||||
overlay.blt(type_x, 70, @typebitmap.bitmap, type_rect)
|
||||
end
|
||||
textpos=[
|
||||
[_INTL("Teach which move?"),16,2,0,Color.new(88,88,80),Color.new(168,184,184)]
|
||||
textpos = [
|
||||
[_INTL("Teach which move?"), 16, 2, 0, Color.new(88, 88, 80), Color.new(168, 184, 184)]
|
||||
]
|
||||
imagepos=[]
|
||||
yPos=76
|
||||
imagepos = []
|
||||
yPos = 76
|
||||
for i in 0...VISIBLEMOVES
|
||||
moveobject=@moves[@sprites["commands"].top_item+i]
|
||||
moveobject = @moves[@sprites["commands"].top_item + i]
|
||||
if moveobject
|
||||
moveData=GameData::Move.get(moveobject)
|
||||
moveData = GameData::Move.get(moveobject)
|
||||
type_number = GameData::Type.get(moveData.display_type(@pokemon)).icon_position
|
||||
imagepos.push(["Graphics/Pictures/types", 12, yPos + 8, 0, type_number * 28, 64, 28])
|
||||
textpos.push([moveData.name,80,yPos,0,Color.new(248,248,248),Color.new(0,0,0)])
|
||||
if moveData.total_pp>0
|
||||
textpos.push([_INTL("PP"),112,yPos+32,0,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
textpos.push([_INTL("{1}/{1}",moveData.total_pp),230,yPos+32,1,
|
||||
Color.new(64,64,64),Color.new(176,176,176)])
|
||||
textpos.push([moveData.name, 80, yPos, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
|
||||
if moveData.total_pp > 0
|
||||
textpos.push([_INTL("PP"), 112, yPos + 32, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
|
||||
textpos.push([_INTL("{1}/{1}", moveData.total_pp), 230, yPos + 32, 1,
|
||||
Color.new(64, 64, 64), Color.new(176, 176, 176)])
|
||||
else
|
||||
textpos.push(["-",80,yPos,0,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
textpos.push(["--",228,yPos+32,1,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
textpos.push(["-", 80, yPos, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
|
||||
textpos.push(["--", 228, yPos + 32, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)])
|
||||
end
|
||||
end
|
||||
yPos+=64
|
||||
yPos += 64
|
||||
end
|
||||
imagepos.push(["Graphics/Pictures/reminderSel",
|
||||
0,78+(@sprites["commands"].index-@sprites["commands"].top_item)*64,
|
||||
0,0,258,72])
|
||||
selMoveData=GameData::Move.get(@moves[@sprites["commands"].index])
|
||||
0, 78 + (@sprites["commands"].index - @sprites["commands"].top_item) * 64,
|
||||
0, 0, 258, 72])
|
||||
selMoveData = GameData::Move.get(@moves[@sprites["commands"].index])
|
||||
basedamage = selMoveData.display_damage(@pokemon)
|
||||
category = selMoveData.display_category(@pokemon)
|
||||
accuracy = selMoveData.display_accuracy(@pokemon)
|
||||
textpos.push([_INTL("CATEGORY"),272,108,0,Color.new(248,248,248),Color.new(0,0,0)])
|
||||
textpos.push([_INTL("POWER"),272,140,0,Color.new(248,248,248),Color.new(0,0,0)])
|
||||
textpos.push([basedamage<=1 ? basedamage==1 ? "???" : "---" : sprintf("%d",basedamage),
|
||||
468,140,2,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
textpos.push([_INTL("ACCURACY"),272,172,0,Color.new(248,248,248),Color.new(0,0,0)])
|
||||
textpos.push([accuracy==0 ? "---" : "#{accuracy}%",
|
||||
468,172,2,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
imagepos.push(["Graphics/Pictures/category",436,116,0,category*28,64,28])
|
||||
if @sprites["commands"].index<@moves.length-1
|
||||
imagepos.push(["Graphics/Pictures/reminderButtons",48,350,0,0,76,32])
|
||||
textpos.push([_INTL("CATEGORY"), 272, 108, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
|
||||
textpos.push([_INTL("POWER"), 272, 140, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
|
||||
textpos.push([basedamage <= 1 ? basedamage == 1 ? "???" : "---" : sprintf("%d", basedamage),
|
||||
468, 140, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
|
||||
textpos.push([_INTL("ACCURACY"), 272, 172, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
|
||||
textpos.push([accuracy == 0 ? "---" : "#{accuracy}%",
|
||||
468, 172, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
imagepos.push(["Graphics/Pictures/category", 436, 116, 0, category * 28, 64, 28])
|
||||
if @sprites["commands"].index < @moves.length - 1
|
||||
imagepos.push(["Graphics/Pictures/reminderButtons", 48, 350, 0, 0, 76, 32])
|
||||
end
|
||||
if @sprites["commands"].index>0
|
||||
imagepos.push(["Graphics/Pictures/reminderButtons",134,350,76,0,76,32])
|
||||
if @sprites["commands"].index > 0
|
||||
imagepos.push(["Graphics/Pictures/reminderButtons", 134, 350, 76, 0, 76, 32])
|
||||
end
|
||||
pbDrawImagePositions(overlay,imagepos)
|
||||
drawTextEx(overlay,272,214,230,5,selMoveData.description,
|
||||
Color.new(64,64,64),Color.new(176,176,176))
|
||||
pbDrawImagePositions(overlay, imagepos)
|
||||
drawTextEx(overlay, 272, 214, 230, 5, selMoveData.description,
|
||||
Color.new(64, 64, 64), Color.new(176, 176, 176))
|
||||
end
|
||||
|
||||
# Processes the scene
|
||||
def pbChooseMove
|
||||
oldcmd=-1
|
||||
pbActivateWindow(@sprites,"commands") {
|
||||
oldcmd = -1
|
||||
pbActivateWindow(@sprites, "commands") {
|
||||
loop do
|
||||
oldcmd=@sprites["commands"].index
|
||||
oldcmd = @sprites["commands"].index
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if @sprites["commands"].index!=oldcmd
|
||||
@sprites["background"].x=0
|
||||
@sprites["background"].y=78+(@sprites["commands"].index-@sprites["commands"].top_item)*64
|
||||
if @sprites["commands"].index != oldcmd
|
||||
@sprites["background"].x = 0
|
||||
@sprites["background"].y = 78 + (@sprites["commands"].index - @sprites["commands"].top_item) * 64
|
||||
pbDrawMoveList
|
||||
end
|
||||
if Input.trigger?(Input::BACK)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,104 +14,104 @@ end
|
||||
#===============================================================================
|
||||
# type: 0=Pokémon; 1 or higher=item (is the item's quantity).
|
||||
# item: The thing being turned into a Mystery Gift (Pokémon object or item ID).
|
||||
def pbEditMysteryGift(type,item,id = 0,giftname = "")
|
||||
def pbEditMysteryGift(type, item, id = 0, giftname = "")
|
||||
begin
|
||||
if type==0 # Pokémon
|
||||
commands=[_INTL("Mystery Gift"),
|
||||
_INTL("Faraway place")]
|
||||
if type == 0 # Pokémon
|
||||
commands = [_INTL("Mystery Gift"),
|
||||
_INTL("Faraway place")]
|
||||
commands.push(item.obtain_text) if item.obtain_text && !item.obtain_text.empty?
|
||||
commands.push(_INTL("[Custom]"))
|
||||
loop do
|
||||
command=pbMessage(
|
||||
_INTL("Choose a phrase to be where the gift Pokémon was obtained from."),commands,-1)
|
||||
if command<0
|
||||
command = pbMessage(
|
||||
_INTL("Choose a phrase to be where the gift Pokémon was obtained from."), commands, -1)
|
||||
if command < 0
|
||||
return nil if pbConfirmMessage(_INTL("Stop editing this gift?"))
|
||||
elsif command<commands.length-1
|
||||
elsif command < commands.length - 1
|
||||
item.obtain_text = commands[command]
|
||||
break
|
||||
elsif command==commands.length-1
|
||||
obtainname=pbMessageFreeText(_INTL("Enter a phrase."),"",false,30)
|
||||
if obtainname!=""
|
||||
elsif command == commands.length - 1
|
||||
obtainname = pbMessageFreeText(_INTL("Enter a phrase."), "", false, 30)
|
||||
if obtainname != ""
|
||||
item.obtain_text = obtainname
|
||||
break
|
||||
end
|
||||
return nil if pbConfirmMessage(_INTL("Stop editing this gift?"))
|
||||
end
|
||||
end
|
||||
elsif type>0 # Item
|
||||
params=ChooseNumberParams.new
|
||||
params.setRange(1,99999)
|
||||
elsif type > 0 # Item
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(1, 99999)
|
||||
params.setDefaultValue(type)
|
||||
params.setCancelValue(0)
|
||||
loop do
|
||||
newtype=pbMessageChooseNumber(_INTL("Choose a quantity of {1}.",
|
||||
GameData::Item.get(item).name),params)
|
||||
if newtype==0
|
||||
newtype = pbMessageChooseNumber(_INTL("Choose a quantity of {1}.",
|
||||
GameData::Item.get(item).name), params)
|
||||
if newtype == 0
|
||||
return nil if pbConfirmMessage(_INTL("Stop editing this gift?"))
|
||||
else
|
||||
type=newtype
|
||||
type = newtype
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if id==0
|
||||
master=[]
|
||||
idlist=[]
|
||||
if id == 0
|
||||
master = []
|
||||
idlist = []
|
||||
if safeExists?("MysteryGiftMaster.txt")
|
||||
master=IO.read("MysteryGiftMaster.txt")
|
||||
master=pbMysteryGiftDecrypt(master)
|
||||
master = IO.read("MysteryGiftMaster.txt")
|
||||
master = pbMysteryGiftDecrypt(master)
|
||||
end
|
||||
for i in master
|
||||
idlist.push(i[0])
|
||||
end
|
||||
params=ChooseNumberParams.new
|
||||
params.setRange(0,99999)
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 99999)
|
||||
params.setDefaultValue(id)
|
||||
params.setCancelValue(0)
|
||||
loop do
|
||||
newid=pbMessageChooseNumber(_INTL("Choose a unique ID for this gift."),params)
|
||||
if newid==0
|
||||
newid = pbMessageChooseNumber(_INTL("Choose a unique ID for this gift."), params)
|
||||
if newid == 0
|
||||
return nil if pbConfirmMessage(_INTL("Stop editing this gift?"))
|
||||
else
|
||||
if idlist.include?(newid)
|
||||
pbMessage(_INTL("That ID is already used by a Mystery Gift."))
|
||||
else
|
||||
id=newid
|
||||
id = newid
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
loop do
|
||||
newgiftname=pbMessageFreeText(_INTL("Enter a name for the gift."),giftname,false,250)
|
||||
if newgiftname!=""
|
||||
giftname=newgiftname
|
||||
newgiftname = pbMessageFreeText(_INTL("Enter a name for the gift."), giftname, false, 250)
|
||||
if newgiftname != ""
|
||||
giftname = newgiftname
|
||||
break
|
||||
end
|
||||
return nil if pbConfirmMessage(_INTL("Stop editing this gift?"))
|
||||
end
|
||||
return [id,type,item,giftname]
|
||||
return [id, type, item, giftname]
|
||||
rescue
|
||||
pbMessage(_INTL("Couldn't edit the gift."))
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def pbCreateMysteryGift(type,item)
|
||||
gift=pbEditMysteryGift(type,item)
|
||||
def pbCreateMysteryGift(type, item)
|
||||
gift = pbEditMysteryGift(type, item)
|
||||
if !gift
|
||||
pbMessage(_INTL("Didn't create a gift."))
|
||||
else
|
||||
begin
|
||||
if safeExists?("MysteryGiftMaster.txt")
|
||||
master=IO.read("MysteryGiftMaster.txt")
|
||||
master=pbMysteryGiftDecrypt(master)
|
||||
master = IO.read("MysteryGiftMaster.txt")
|
||||
master = pbMysteryGiftDecrypt(master)
|
||||
master.push(gift)
|
||||
else
|
||||
master=[gift]
|
||||
master = [gift]
|
||||
end
|
||||
string=pbMysteryGiftEncrypt(master)
|
||||
File.open("MysteryGiftMaster.txt","wb") { |f| f.write(string) }
|
||||
string = pbMysteryGiftEncrypt(master)
|
||||
File.open("MysteryGiftMaster.txt", "wb") { |f| f.write(string) }
|
||||
pbMessage(_INTL("The gift was saved to MysteryGiftMaster.txt."))
|
||||
rescue
|
||||
pbMessage(_INTL("Couldn't save the gift to MysteryGiftMaster.txt."))
|
||||
@@ -129,85 +129,85 @@ def pbManageMysteryGifts
|
||||
return
|
||||
end
|
||||
# Load all gifts from the Master file.
|
||||
master=IO.read("MysteryGiftMaster.txt")
|
||||
master=pbMysteryGiftDecrypt(master)
|
||||
if !master || !master.is_a?(Array) || master.length==0
|
||||
master = IO.read("MysteryGiftMaster.txt")
|
||||
master = pbMysteryGiftDecrypt(master)
|
||||
if !master || !master.is_a?(Array) || master.length == 0
|
||||
pbMessage(_INTL("There are no Mystery Gifts defined."))
|
||||
return
|
||||
end
|
||||
# Download all gifts from online
|
||||
msgwindow=pbCreateMessageWindow
|
||||
pbMessageDisplay(msgwindow,_INTL("Searching for online gifts...\\wtnp[0]"))
|
||||
msgwindow = pbCreateMessageWindow
|
||||
pbMessageDisplay(msgwindow, _INTL("Searching for online gifts...\\wtnp[0]"))
|
||||
online = pbDownloadToString(MysteryGift::URL)
|
||||
pbDisposeMessageWindow(msgwindow)
|
||||
if nil_or_empty?(online)
|
||||
pbMessage(_INTL("No online Mystery Gifts found.\\wtnp[20]"))
|
||||
online=[]
|
||||
online = []
|
||||
else
|
||||
pbMessage(_INTL("Online Mystery Gifts found.\\wtnp[20]"))
|
||||
online=pbMysteryGiftDecrypt(online)
|
||||
t=[]
|
||||
online = pbMysteryGiftDecrypt(online)
|
||||
t = []
|
||||
online.each { |gift| t.push(gift[0]) }
|
||||
online=t
|
||||
online = t
|
||||
end
|
||||
# Show list of all gifts.
|
||||
command=0
|
||||
command = 0
|
||||
loop do
|
||||
commands=pbRefreshMGCommands(master,online)
|
||||
command=pbMessage(_INTL("\\ts[]Manage Mystery Gifts (X=online)."),commands,-1,nil,command)
|
||||
commands = pbRefreshMGCommands(master, online)
|
||||
command = pbMessage(_INTL("\\ts[]Manage Mystery Gifts (X=online)."), commands, -1, nil, command)
|
||||
# Gift chosen
|
||||
if command==-1 || command==commands.length-1 # Cancel
|
||||
if command == -1 || command == commands.length - 1 # Cancel
|
||||
break
|
||||
elsif command==commands.length-2 # Export selected to file
|
||||
elsif command == commands.length - 2 # Export selected to file
|
||||
begin
|
||||
newfile=[]
|
||||
newfile = []
|
||||
for gift in master
|
||||
newfile.push(gift) if online.include?(gift[0])
|
||||
end
|
||||
string=pbMysteryGiftEncrypt(newfile)
|
||||
File.open("MysteryGift.txt","wb") { |f| f.write(string) }
|
||||
string = pbMysteryGiftEncrypt(newfile)
|
||||
File.open("MysteryGift.txt", "wb") { |f| f.write(string) }
|
||||
pbMessage(_INTL("The gifts were saved to MysteryGift.txt."))
|
||||
pbMessage(_INTL("Upload MysteryGift.txt to the Internet."))
|
||||
rescue
|
||||
pbMessage(_INTL("Couldn't save the gifts to MysteryGift.txt."))
|
||||
end
|
||||
elsif command>=0 && command<commands.length-2 # A gift
|
||||
cmd=0
|
||||
elsif command >= 0 && command < commands.length - 2 # A gift
|
||||
cmd = 0
|
||||
loop do
|
||||
commands=pbRefreshMGCommands(master,online)
|
||||
gift=master[command]
|
||||
cmds=[_INTL("Toggle on/offline"),
|
||||
_INTL("Edit"),
|
||||
_INTL("Receive"),
|
||||
_INTL("Delete"),
|
||||
_INTL("Cancel")]
|
||||
cmd=pbMessage("\\ts[]"+commands[command],cmds,-1,nil,cmd)
|
||||
if cmd==-1 || cmd==cmds.length-1
|
||||
commands = pbRefreshMGCommands(master, online)
|
||||
gift = master[command]
|
||||
cmds = [_INTL("Toggle on/offline"),
|
||||
_INTL("Edit"),
|
||||
_INTL("Receive"),
|
||||
_INTL("Delete"),
|
||||
_INTL("Cancel")]
|
||||
cmd = pbMessage("\\ts[]" + commands[command], cmds, -1, nil, cmd)
|
||||
if cmd == -1 || cmd == cmds.length - 1
|
||||
break
|
||||
elsif cmd==0 # Toggle on/offline
|
||||
elsif cmd == 0 # Toggle on/offline
|
||||
if online.include?(gift[0])
|
||||
online.delete(gift[0])
|
||||
else
|
||||
online.push(gift[0])
|
||||
end
|
||||
elsif cmd==1 # Edit
|
||||
newgift=pbEditMysteryGift(gift[1],gift[2],gift[0],gift[3])
|
||||
master[command]=newgift if newgift
|
||||
elsif cmd==2 # Receive
|
||||
elsif cmd == 1 # Edit
|
||||
newgift = pbEditMysteryGift(gift[1], gift[2], gift[0], gift[3])
|
||||
master[command] = newgift if newgift
|
||||
elsif cmd == 2 # Receive
|
||||
if !$player
|
||||
pbMessage(_INTL("There is no save file loaded. Cannot receive any gifts."))
|
||||
next
|
||||
end
|
||||
replaced=false
|
||||
replaced = false
|
||||
for i in 0...$player.mystery_gifts.length
|
||||
if $player.mystery_gifts[i][0]==gift[0]
|
||||
$player.mystery_gifts[i]=gift
|
||||
replaced=true
|
||||
if $player.mystery_gifts[i][0] == gift[0]
|
||||
$player.mystery_gifts[i] = gift
|
||||
replaced = true
|
||||
end
|
||||
end
|
||||
$player.mystery_gifts.push(gift) if !replaced
|
||||
pbReceiveMysteryGift(gift[0])
|
||||
elsif cmd==3 # Delete
|
||||
elsif cmd == 3 # Delete
|
||||
master.delete_at(command) if pbConfirmMessage(_INTL("Are you sure you want to delete this gift?"))
|
||||
break
|
||||
end
|
||||
@@ -238,85 +238,85 @@ end
|
||||
#===============================================================================
|
||||
# Called from the Continue/New Game screen.
|
||||
def pbDownloadMysteryGift(trainer)
|
||||
sprites={}
|
||||
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
viewport.z=99999
|
||||
addBackgroundPlane(sprites,"background","mysteryGiftbg",viewport)
|
||||
sprites = {}
|
||||
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
viewport.z = 99999
|
||||
addBackgroundPlane(sprites, "background", "mysteryGiftbg", viewport)
|
||||
pbFadeInAndShow(sprites)
|
||||
sprites["msgwindow"]=pbCreateMessageWindow
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("Searching for a gift.\nPlease wait...\\wtnp[0]"))
|
||||
sprites["msgwindow"] = pbCreateMessageWindow
|
||||
pbMessageDisplay(sprites["msgwindow"], _INTL("Searching for a gift.\nPlease wait...\\wtnp[0]"))
|
||||
string = pbDownloadToString(MysteryGift::URL)
|
||||
if nil_or_empty?(string)
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
|
||||
pbMessageDisplay(sprites["msgwindow"], _INTL("No new gifts are available."))
|
||||
else
|
||||
online=pbMysteryGiftDecrypt(string)
|
||||
pending=[]
|
||||
online = pbMysteryGiftDecrypt(string)
|
||||
pending = []
|
||||
for gift in online
|
||||
notgot=true
|
||||
notgot = true
|
||||
for j in trainer.mystery_gifts
|
||||
notgot=false if j[0]==gift[0]
|
||||
notgot = false if j[0] == gift[0]
|
||||
end
|
||||
pending.push(gift) if notgot
|
||||
end
|
||||
if pending.length==0
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
|
||||
if pending.length == 0
|
||||
pbMessageDisplay(sprites["msgwindow"], _INTL("No new gifts are available."))
|
||||
else
|
||||
loop do
|
||||
commands=[]
|
||||
commands = []
|
||||
for gift in pending
|
||||
commands.push(gift[3])
|
||||
end
|
||||
commands.push(_INTL("Cancel"))
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("Choose the gift you want to receive.\\wtnp[0]"))
|
||||
command=pbShowCommands(sprites["msgwindow"],commands,-1)
|
||||
if command==-1 || command==commands.length-1
|
||||
pbMessageDisplay(sprites["msgwindow"], _INTL("Choose the gift you want to receive.\\wtnp[0]"))
|
||||
command = pbShowCommands(sprites["msgwindow"], commands, -1)
|
||||
if command == -1 || command == commands.length - 1
|
||||
break
|
||||
else
|
||||
gift=pending[command]
|
||||
sprites["msgwindow"].visible=false
|
||||
if gift[1]==0
|
||||
sprite=PokemonSprite.new(viewport)
|
||||
gift = pending[command]
|
||||
sprites["msgwindow"].visible = false
|
||||
if gift[1] == 0
|
||||
sprite = PokemonSprite.new(viewport)
|
||||
sprite.setOffset(PictureOrigin::Center)
|
||||
sprite.setPokemonBitmap(gift[2])
|
||||
sprite.x=Graphics.width/2
|
||||
sprite.y=-sprite.bitmap.height/2
|
||||
sprite.x = Graphics.width / 2
|
||||
sprite.y = -sprite.bitmap.height / 2
|
||||
else
|
||||
sprite=ItemIconSprite.new(0,0,gift[2],viewport)
|
||||
sprite.x=Graphics.width/2
|
||||
sprite.y=-sprite.height/2
|
||||
sprite = ItemIconSprite.new(0, 0, gift[2], viewport)
|
||||
sprite.x = Graphics.width / 2
|
||||
sprite.y = -sprite.height / 2
|
||||
end
|
||||
distanceDiff = 8*20/Graphics.frame_rate
|
||||
distanceDiff = 8 * 20 / Graphics.frame_rate
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
sprite.update
|
||||
sprite.y+=distanceDiff
|
||||
break if sprite.y>=Graphics.height/2
|
||||
sprite.y += distanceDiff
|
||||
break if sprite.y >= Graphics.height / 2
|
||||
end
|
||||
pbMEPlay("Battle capture success")
|
||||
(Graphics.frame_rate*3).times do
|
||||
(Graphics.frame_rate * 3).times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
sprite.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
sprites["msgwindow"].visible=true
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("The gift has been received!")) { sprite.update }
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("Please pick up your gift from the deliveryman in any Poké Mart.")) { sprite.update }
|
||||
sprites["msgwindow"].visible = true
|
||||
pbMessageDisplay(sprites["msgwindow"], _INTL("The gift has been received!")) { sprite.update }
|
||||
pbMessageDisplay(sprites["msgwindow"], _INTL("Please pick up your gift from the deliveryman in any Poké Mart.")) { sprite.update }
|
||||
trainer.mystery_gifts.push(gift)
|
||||
pending.delete_at(command)
|
||||
opacityDiff = 16*20/Graphics.frame_rate
|
||||
opacityDiff = 16 * 20 / Graphics.frame_rate
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
sprite.update
|
||||
sprite.opacity-=opacityDiff
|
||||
break if sprite.opacity<=0
|
||||
sprite.opacity -= opacityDiff
|
||||
break if sprite.opacity <= 0
|
||||
end
|
||||
sprite.dispose
|
||||
end
|
||||
if pending.length==0
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
|
||||
if pending.length == 0
|
||||
pbMessageDisplay(sprites["msgwindow"], _INTL("No new gifts are available."))
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -332,7 +332,7 @@ end
|
||||
# Converts an array of gifts into a string and back.
|
||||
#===============================================================================
|
||||
def pbMysteryGiftEncrypt(gift)
|
||||
ret=[Zlib::Deflate.deflate(Marshal.dump(gift))].pack("m")
|
||||
ret = [Zlib::Deflate.deflate(Marshal.dump(gift))].pack("m")
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -356,63 +356,63 @@ end
|
||||
#===============================================================================
|
||||
def pbNextMysteryGiftID
|
||||
for i in $player.mystery_gifts
|
||||
return i[0] if i.length>1
|
||||
return i[0] if i.length > 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def pbReceiveMysteryGift(id)
|
||||
index=-1
|
||||
index = -1
|
||||
for i in 0...$player.mystery_gifts.length
|
||||
if $player.mystery_gifts[i][0]==id && $player.mystery_gifts[i].length>1
|
||||
index=i
|
||||
if $player.mystery_gifts[i][0] == id && $player.mystery_gifts[i].length > 1
|
||||
index = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if index==-1
|
||||
pbMessage(_INTL("Couldn't find an unclaimed Mystery Gift with ID {1}.",id))
|
||||
if index == -1
|
||||
pbMessage(_INTL("Couldn't find an unclaimed Mystery Gift with ID {1}.", id))
|
||||
return false
|
||||
end
|
||||
gift=$player.mystery_gifts[index]
|
||||
if gift[1]==0 # Pokémon
|
||||
gift = $player.mystery_gifts[index]
|
||||
if gift[1] == 0 # Pokémon
|
||||
gift[2].personalID = rand(2**16) | rand(2**16) << 16
|
||||
gift[2].calc_stats
|
||||
time=pbGetTimeNow
|
||||
gift[2].timeReceived=time.getgm.to_i
|
||||
time = pbGetTimeNow
|
||||
gift[2].timeReceived = time.getgm.to_i
|
||||
gift[2].obtain_method = 4 # Fateful encounter
|
||||
gift[2].record_first_moves
|
||||
if $game_map
|
||||
gift[2].obtain_map=$game_map.map_id
|
||||
gift[2].obtain_level=gift[2].level
|
||||
gift[2].obtain_map = $game_map.map_id
|
||||
gift[2].obtain_level = gift[2].level
|
||||
else
|
||||
gift[2].obtain_map=0
|
||||
gift[2].obtain_level=gift[2].level
|
||||
gift[2].obtain_map = 0
|
||||
gift[2].obtain_level = gift[2].level
|
||||
end
|
||||
if pbAddPokemonSilent(gift[2])
|
||||
pbMessage(_INTL("\\me[Pkmn get]{1} received {2}!",$player.name,gift[2].name))
|
||||
$player.mystery_gifts[index]=[id]
|
||||
pbMessage(_INTL("\\me[Pkmn get]{1} received {2}!", $player.name, gift[2].name))
|
||||
$player.mystery_gifts[index] = [id]
|
||||
return true
|
||||
end
|
||||
elsif gift[1]>0 # Item
|
||||
item=gift[2]
|
||||
qty=gift[1]
|
||||
if $bag.can_add?(item,qty)
|
||||
$bag.add(item,qty)
|
||||
elsif gift[1] > 0 # Item
|
||||
item = gift[2]
|
||||
qty = gift[1]
|
||||
if $bag.can_add?(item, qty)
|
||||
$bag.add(item, qty)
|
||||
itm = GameData::Item.get(item)
|
||||
itemname=(qty>1) ? itm.name_plural : itm.name
|
||||
itemname = (qty > 1) ? itm.name_plural : itm.name
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("\\me[Item get]You obtained some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
pbMessage(_INTL("\\me[Item get]You obtained some \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
|
||||
elsif itm.is_machine? # TM or HM
|
||||
pbMessage(_INTL("\\me[Item get]You obtained \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,
|
||||
pbMessage(_INTL("\\me[Item get]You obtained \\c[1]{1} {2}\\c[0]!\\wtnp[30]", itemname,
|
||||
GameData::Move.get(itm.move).name))
|
||||
elsif qty>1
|
||||
pbMessage(_INTL("\\me[Item get]You obtained {1} \\c[1]{2}\\c[0]!\\wtnp[30]",qty,itemname))
|
||||
elsif qty > 1
|
||||
pbMessage(_INTL("\\me[Item get]You obtained {1} \\c[1]{2}\\c[0]!\\wtnp[30]", qty, itemname))
|
||||
elsif itemname.starts_with_vowel?
|
||||
pbMessage(_INTL("\\me[Item get]You obtained an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
pbMessage(_INTL("\\me[Item get]You obtained an \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
|
||||
else
|
||||
pbMessage(_INTL("\\me[Item get]You obtained a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
pbMessage(_INTL("\\me[Item get]You obtained a \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
|
||||
end
|
||||
$player.mystery_gifts[index]=[id]
|
||||
$player.mystery_gifts[index] = [id]
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,33 +2,33 @@
|
||||
#
|
||||
#===============================================================================
|
||||
class Window_CharacterEntry < Window_DrawableCommand
|
||||
XSIZE=13
|
||||
YSIZE=4
|
||||
XSIZE = 13
|
||||
YSIZE = 4
|
||||
|
||||
def initialize(charset,viewport = nil)
|
||||
@viewport=viewport
|
||||
@charset=charset
|
||||
@othercharset=""
|
||||
super(0,96,480,192)
|
||||
colors=getDefaultTextColors(self.windowskin)
|
||||
self.baseColor=colors[0]
|
||||
self.shadowColor=colors[1]
|
||||
self.columns=XSIZE
|
||||
def initialize(charset, viewport = nil)
|
||||
@viewport = viewport
|
||||
@charset = charset
|
||||
@othercharset = ""
|
||||
super(0, 96, 480, 192)
|
||||
colors = getDefaultTextColors(self.windowskin)
|
||||
self.baseColor = colors[0]
|
||||
self.shadowColor = colors[1]
|
||||
self.columns = XSIZE
|
||||
refresh
|
||||
end
|
||||
|
||||
def setOtherCharset(value)
|
||||
@othercharset=value.clone
|
||||
@othercharset = value.clone
|
||||
refresh
|
||||
end
|
||||
|
||||
def setCharset(value)
|
||||
@charset=value.clone
|
||||
@charset = value.clone
|
||||
refresh
|
||||
end
|
||||
|
||||
def character
|
||||
if self.index<0 || self.index>=@charset.length
|
||||
if self.index < 0 || self.index >= @charset.length
|
||||
return ""
|
||||
else
|
||||
return @charset[self.index]
|
||||
@@ -36,30 +36,30 @@ class Window_CharacterEntry < Window_DrawableCommand
|
||||
end
|
||||
|
||||
def command
|
||||
return -1 if self.index==@charset.length
|
||||
return -2 if self.index==@charset.length+1
|
||||
return -3 if self.index==@charset.length+2
|
||||
return -1 if self.index == @charset.length
|
||||
return -2 if self.index == @charset.length + 1
|
||||
return -3 if self.index == @charset.length + 2
|
||||
return self.index
|
||||
end
|
||||
|
||||
def itemCount
|
||||
return @charset.length+3
|
||||
return @charset.length + 3
|
||||
end
|
||||
|
||||
def drawItem(index,_count,rect)
|
||||
rect=drawCursor(index,rect)
|
||||
if index==@charset.length # -1
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,"[ ]",
|
||||
self.baseColor,self.shadowColor)
|
||||
elsif index==@charset.length+1 # -2
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,@othercharset,
|
||||
self.baseColor,self.shadowColor)
|
||||
elsif index==@charset.length+2 # -3
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,_INTL("OK"),
|
||||
self.baseColor,self.shadowColor)
|
||||
def drawItem(index, _count, rect)
|
||||
rect = drawCursor(index, rect)
|
||||
if index == @charset.length # -1
|
||||
pbDrawShadowText(self.contents, rect.x, rect.y, rect.width, rect.height, "[ ]",
|
||||
self.baseColor, self.shadowColor)
|
||||
elsif index == @charset.length + 1 # -2
|
||||
pbDrawShadowText(self.contents, rect.x, rect.y, rect.width, rect.height, @othercharset,
|
||||
self.baseColor, self.shadowColor)
|
||||
elsif index == @charset.length + 2 # -3
|
||||
pbDrawShadowText(self.contents, rect.x, rect.y, rect.width, rect.height, _INTL("OK"),
|
||||
self.baseColor, self.shadowColor)
|
||||
else
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,@charset[index],
|
||||
self.baseColor,self.shadowColor)
|
||||
pbDrawShadowText(self.contents, rect.x, rect.y, rect.width, rect.height, @charset[index],
|
||||
self.baseColor, self.shadowColor)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -70,124 +70,124 @@ end
|
||||
# Text entry screen - free typing.
|
||||
#===============================================================================
|
||||
class PokemonEntryScene
|
||||
@@Characters=[
|
||||
[("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").scan(/./),"[*]"],
|
||||
[("0123456789 !@\#$%^&*() ~`-_+={}[] :;'\"<>,.?/ ").scan(/./),"[A]"],
|
||||
@@Characters = [
|
||||
[("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").scan(/./), "[*]"],
|
||||
[("0123456789 !@\#$%^&*() ~`-_+={}[] :;'\"<>,.?/ ").scan(/./), "[A]"],
|
||||
]
|
||||
USEKEYBOARD=true
|
||||
USEKEYBOARD = true
|
||||
|
||||
def pbStartScene(helptext,minlength,maxlength,initialText,subject = 0,pokemon = nil)
|
||||
@sprites={}
|
||||
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z=99999
|
||||
def pbStartScene(helptext, minlength, maxlength, initialText, subject = 0, pokemon = nil)
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
if USEKEYBOARD
|
||||
@sprites["entry"]=Window_TextEntry_Keyboard.new(initialText,
|
||||
0,0,400-112,96,helptext,true)
|
||||
@sprites["entry"] = Window_TextEntry_Keyboard.new(initialText,
|
||||
0, 0, 400 - 112, 96, helptext, true)
|
||||
Input.text_input = true
|
||||
else
|
||||
@sprites["entry"]=Window_TextEntry.new(initialText,0,0,400,96,helptext,true)
|
||||
@sprites["entry"] = Window_TextEntry.new(initialText, 0, 0, 400, 96, helptext, true)
|
||||
end
|
||||
@sprites["entry"].x=(Graphics.width/2)-(@sprites["entry"].width/2)+32
|
||||
@sprites["entry"].viewport=@viewport
|
||||
@sprites["entry"].visible=true
|
||||
@minlength=minlength
|
||||
@maxlength=maxlength
|
||||
@symtype=0
|
||||
@sprites["entry"].maxlength=maxlength
|
||||
@sprites["entry"].x = (Graphics.width / 2) - (@sprites["entry"].width / 2) + 32
|
||||
@sprites["entry"].viewport = @viewport
|
||||
@sprites["entry"].visible = true
|
||||
@minlength = minlength
|
||||
@maxlength = maxlength
|
||||
@symtype = 0
|
||||
@sprites["entry"].maxlength = maxlength
|
||||
if !USEKEYBOARD
|
||||
@sprites["entry2"]=Window_CharacterEntry.new(@@Characters[@symtype][0])
|
||||
@sprites["entry2"] = Window_CharacterEntry.new(@@Characters[@symtype][0])
|
||||
@sprites["entry2"].setOtherCharset(@@Characters[@symtype][1])
|
||||
@sprites["entry2"].viewport=@viewport
|
||||
@sprites["entry2"].visible=true
|
||||
@sprites["entry2"].x=(Graphics.width/2)-(@sprites["entry2"].width/2)
|
||||
@sprites["entry2"].viewport = @viewport
|
||||
@sprites["entry2"].visible = true
|
||||
@sprites["entry2"].x = (Graphics.width / 2) - (@sprites["entry2"].width / 2)
|
||||
end
|
||||
if minlength==0
|
||||
@sprites["helpwindow"]=Window_UnformattedTextPokemon.newWithSize(
|
||||
if minlength == 0
|
||||
@sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize(
|
||||
_INTL("Enter text using the keyboard. Press\nEnter to confirm, or Esc to cancel."),
|
||||
32,Graphics.height-96,Graphics.width-64,96,@viewport
|
||||
32, Graphics.height - 96, Graphics.width - 64, 96, @viewport
|
||||
)
|
||||
else
|
||||
@sprites["helpwindow"]=Window_UnformattedTextPokemon.newWithSize(
|
||||
@sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize(
|
||||
_INTL("Enter text using the keyboard.\nPress Enter to confirm."),
|
||||
32,Graphics.height-96,Graphics.width-64,96,@viewport
|
||||
32, Graphics.height - 96, Graphics.width - 64, 96, @viewport
|
||||
)
|
||||
end
|
||||
@sprites["helpwindow"].letterbyletter=false
|
||||
@sprites["helpwindow"].viewport=@viewport
|
||||
@sprites["helpwindow"].visible=USEKEYBOARD
|
||||
@sprites["helpwindow"].baseColor=Color.new(16,24,32)
|
||||
@sprites["helpwindow"].shadowColor=Color.new(168,184,184)
|
||||
addBackgroundPlane(@sprites,"background","Naming/bg_2",@viewport)
|
||||
@sprites["helpwindow"].letterbyletter = false
|
||||
@sprites["helpwindow"].viewport = @viewport
|
||||
@sprites["helpwindow"].visible = USEKEYBOARD
|
||||
@sprites["helpwindow"].baseColor = Color.new(16, 24, 32)
|
||||
@sprites["helpwindow"].shadowColor = Color.new(168, 184, 184)
|
||||
addBackgroundPlane(@sprites, "background", "Naming/bg_2", @viewport)
|
||||
case subject
|
||||
when 1 # Player
|
||||
meta = GameData::PlayerMetadata.get($player.character_ID)
|
||||
if meta
|
||||
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
|
||||
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
|
||||
@sprites["shadow"].x=33*2
|
||||
@sprites["shadow"].y=32*2
|
||||
@sprites["shadow"].x = 33 * 2
|
||||
@sprites["shadow"].y = 32 * 2
|
||||
filename = pbGetPlayerCharset(meta.walk_charset, nil, true)
|
||||
@sprites["subject"]=TrainerWalkingCharSprite.new(filename,@viewport)
|
||||
charwidth=@sprites["subject"].bitmap.width
|
||||
charheight=@sprites["subject"].bitmap.height
|
||||
@sprites["subject"].x = 44*2 - charwidth/8
|
||||
@sprites["subject"].y = 38*2 - charheight/4
|
||||
@sprites["subject"] = TrainerWalkingCharSprite.new(filename, @viewport)
|
||||
charwidth = @sprites["subject"].bitmap.width
|
||||
charheight = @sprites["subject"].bitmap.height
|
||||
@sprites["subject"].x = 44 * 2 - charwidth / 8
|
||||
@sprites["subject"].y = 38 * 2 - charheight / 4
|
||||
end
|
||||
when 2 # Pokémon
|
||||
if pokemon
|
||||
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
|
||||
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
|
||||
@sprites["shadow"].x=33*2
|
||||
@sprites["shadow"].y=32*2
|
||||
@sprites["subject"]=PokemonIconSprite.new(pokemon,@viewport)
|
||||
@sprites["shadow"].x = 33 * 2
|
||||
@sprites["shadow"].y = 32 * 2
|
||||
@sprites["subject"] = PokemonIconSprite.new(pokemon, @viewport)
|
||||
@sprites["subject"].setOffset(PictureOrigin::Center)
|
||||
@sprites["subject"].x=88
|
||||
@sprites["subject"].y=54
|
||||
@sprites["gender"]=BitmapSprite.new(32,32,@viewport)
|
||||
@sprites["gender"].x=430
|
||||
@sprites["gender"].y=54
|
||||
@sprites["subject"].x = 88
|
||||
@sprites["subject"].y = 54
|
||||
@sprites["gender"] = BitmapSprite.new(32, 32, @viewport)
|
||||
@sprites["gender"].x = 430
|
||||
@sprites["gender"].y = 54
|
||||
@sprites["gender"].bitmap.clear
|
||||
pbSetSystemFont(@sprites["gender"].bitmap)
|
||||
textpos=[]
|
||||
textpos = []
|
||||
if pokemon.male?
|
||||
textpos.push([_INTL("♂"),0,-6,false,Color.new(0,128,248),Color.new(168,184,184)])
|
||||
textpos.push([_INTL("♂"), 0, -6, false, Color.new(0, 128, 248), Color.new(168, 184, 184)])
|
||||
elsif pokemon.female?
|
||||
textpos.push([_INTL("♀"),0,-6,false,Color.new(248,24,24),Color.new(168,184,184)])
|
||||
textpos.push([_INTL("♀"), 0, -6, false, Color.new(248, 24, 24), Color.new(168, 184, 184)])
|
||||
end
|
||||
pbDrawTextPositions(@sprites["gender"].bitmap,textpos)
|
||||
pbDrawTextPositions(@sprites["gender"].bitmap, textpos)
|
||||
end
|
||||
when 3 # NPC
|
||||
@sprites["shadow"]=IconSprite.new(0,0,@viewport)
|
||||
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
|
||||
@sprites["shadow"].x=33*2
|
||||
@sprites["shadow"].y=32*2
|
||||
@sprites["subject"]=TrainerWalkingCharSprite.new(pokemon.to_s,@viewport)
|
||||
charwidth=@sprites["subject"].bitmap.width
|
||||
charheight=@sprites["subject"].bitmap.height
|
||||
@sprites["subject"].x = 44*2 - charwidth/8
|
||||
@sprites["subject"].y = 38*2 - charheight/4
|
||||
@sprites["shadow"].x = 33 * 2
|
||||
@sprites["shadow"].y = 32 * 2
|
||||
@sprites["subject"] = TrainerWalkingCharSprite.new(pokemon.to_s, @viewport)
|
||||
charwidth = @sprites["subject"].bitmap.width
|
||||
charheight = @sprites["subject"].bitmap.height
|
||||
@sprites["subject"].x = 44 * 2 - charwidth / 8
|
||||
@sprites["subject"].y = 38 * 2 - charheight / 4
|
||||
when 4 # Storage box
|
||||
@sprites["subject"]=TrainerWalkingCharSprite.new(nil,@viewport)
|
||||
@sprites["subject"].altcharset="Graphics/Pictures/Naming/icon_storage"
|
||||
@sprites["subject"].animspeed=4
|
||||
charwidth=@sprites["subject"].bitmap.width
|
||||
charheight=@sprites["subject"].bitmap.height
|
||||
@sprites["subject"].x = 44*2 - charwidth/8
|
||||
@sprites["subject"].y = 26*2 - charheight/2
|
||||
@sprites["subject"] = TrainerWalkingCharSprite.new(nil, @viewport)
|
||||
@sprites["subject"].altcharset = "Graphics/Pictures/Naming/icon_storage"
|
||||
@sprites["subject"].animspeed = 4
|
||||
charwidth = @sprites["subject"].bitmap.width
|
||||
charheight = @sprites["subject"].bitmap.height
|
||||
@sprites["subject"].x = 44 * 2 - charwidth / 8
|
||||
@sprites["subject"].y = 26 * 2 - charheight / 2
|
||||
end
|
||||
pbFadeInAndShow(@sprites)
|
||||
end
|
||||
|
||||
def pbEntry1
|
||||
ret=""
|
||||
ret = ""
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
if Input.triggerex?(:ESCAPE) && @minlength==0
|
||||
ret=""
|
||||
if Input.triggerex?(:ESCAPE) && @minlength == 0
|
||||
ret = ""
|
||||
break
|
||||
elsif Input.triggerex?(:RETURN) && @sprites["entry"].text.length>=@minlength
|
||||
ret=@sprites["entry"].text
|
||||
elsif Input.triggerex?(:RETURN) && @sprites["entry"].text.length >= @minlength
|
||||
ret = @sprites["entry"].text
|
||||
break
|
||||
end
|
||||
@sprites["helpwindow"].update
|
||||
@@ -199,7 +199,7 @@ class PokemonEntryScene
|
||||
end
|
||||
|
||||
def pbEntry2
|
||||
ret=""
|
||||
ret = ""
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -208,25 +208,25 @@ class PokemonEntryScene
|
||||
@sprites["entry2"].update
|
||||
@sprites["subject"].update if @sprites["subject"]
|
||||
if Input.trigger?(Input::USE)
|
||||
index=@sprites["entry2"].command
|
||||
if index==-3 # Confirm text
|
||||
ret=@sprites["entry"].text
|
||||
if ret.length<@minlength || ret.length>@maxlength
|
||||
index = @sprites["entry2"].command
|
||||
if index == -3 # Confirm text
|
||||
ret = @sprites["entry"].text
|
||||
if ret.length < @minlength || ret.length > @maxlength
|
||||
pbPlayBuzzerSE()
|
||||
else
|
||||
pbPlayDecisionSE()
|
||||
break
|
||||
end
|
||||
elsif index==-1 # Insert a space
|
||||
elsif index == -1 # Insert a space
|
||||
if @sprites["entry"].insert(" ")
|
||||
pbPlayDecisionSE()
|
||||
else
|
||||
pbPlayBuzzerSE()
|
||||
end
|
||||
elsif index==-2 # Change character set
|
||||
elsif index == -2 # Change character set
|
||||
pbPlayDecisionSE()
|
||||
@symtype+=1
|
||||
@symtype=0 if @symtype>=@@Characters.length
|
||||
@symtype += 1
|
||||
@symtype = 0 if @symtype >= @@Characters.length
|
||||
@sprites["entry2"].setCharset(@@Characters[@symtype][0])
|
||||
@sprites["entry2"].setOtherCharset(@@Characters[@symtype][1])
|
||||
else # Insert given character
|
||||
@@ -373,7 +373,7 @@ class PokemonEntryScene2
|
||||
|
||||
|
||||
|
||||
def pbStartScene(helptext,minlength,maxlength,initialText,subject = 0,pokemon = nil)
|
||||
def pbStartScene(helptext, minlength, maxlength, initialText, subject = 0, pokemon = nil)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@helptext = helptext
|
||||
@@ -476,7 +476,7 @@ class PokemonEntryScene2
|
||||
@sprites["bottomtab"].x = 22
|
||||
@sprites["bottomtab"].y = 162
|
||||
@sprites["bottomtab"].bitmap = @bitmaps[@@Characters.length]
|
||||
@sprites["toptab"]=SpriteWrapper.new(@viewport) # Next tab
|
||||
@sprites["toptab"] = SpriteWrapper.new(@viewport) # Next tab
|
||||
@sprites["toptab"].x = 22 - 504
|
||||
@sprites["toptab"].y = 162
|
||||
@sprites["toptab"].bitmap = @bitmaps[@@Characters.length + 1]
|
||||
@@ -753,12 +753,12 @@ end
|
||||
#===============================================================================
|
||||
class PokemonEntry
|
||||
def initialize(scene)
|
||||
@scene=scene
|
||||
@scene = scene
|
||||
end
|
||||
|
||||
def pbStartScreen(helptext,minlength,maxlength,initialText,mode = -1,pokemon = nil)
|
||||
@scene.pbStartScene(helptext,minlength,maxlength,initialText,mode,pokemon)
|
||||
ret=@scene.pbEntry
|
||||
def pbStartScreen(helptext, minlength, maxlength, initialText, mode = -1, pokemon = nil)
|
||||
@scene.pbStartScene(helptext, minlength, maxlength, initialText, mode, pokemon)
|
||||
ret = @scene.pbEntry
|
||||
@scene.pbEndScene
|
||||
return ret
|
||||
end
|
||||
@@ -769,36 +769,36 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbEnterText(helptext,minlength,maxlength,initialText = "",mode = 0,pokemon = nil,nofadeout = false)
|
||||
ret=""
|
||||
if ($PokemonSystem.textinput==1 rescue false) # Keyboard
|
||||
pbFadeOutIn(99999,nofadeout) {
|
||||
sscene=PokemonEntryScene.new
|
||||
sscreen=PokemonEntry.new(sscene)
|
||||
ret=sscreen.pbStartScreen(helptext,minlength,maxlength,initialText,mode,pokemon)
|
||||
def pbEnterText(helptext, minlength, maxlength, initialText = "", mode = 0, pokemon = nil, nofadeout = false)
|
||||
ret = ""
|
||||
if ($PokemonSystem.textinput == 1 rescue false) # Keyboard
|
||||
pbFadeOutIn(99999, nofadeout) {
|
||||
sscene = PokemonEntryScene.new
|
||||
sscreen = PokemonEntry.new(sscene)
|
||||
ret = sscreen.pbStartScreen(helptext, minlength, maxlength, initialText, mode, pokemon)
|
||||
}
|
||||
else # Cursor
|
||||
pbFadeOutIn(99999,nofadeout) {
|
||||
sscene=PokemonEntryScene2.new
|
||||
sscreen=PokemonEntry.new(sscene)
|
||||
ret=sscreen.pbStartScreen(helptext,minlength,maxlength,initialText,mode,pokemon)
|
||||
pbFadeOutIn(99999, nofadeout) {
|
||||
sscene = PokemonEntryScene2.new
|
||||
sscreen = PokemonEntry.new(sscene)
|
||||
ret = sscreen.pbStartScreen(helptext, minlength, maxlength, initialText, mode, pokemon)
|
||||
}
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbEnterPlayerName(helptext,minlength,maxlength,initialText = "",nofadeout = false)
|
||||
return pbEnterText(helptext,minlength,maxlength,initialText,1,nil,nofadeout)
|
||||
def pbEnterPlayerName(helptext, minlength, maxlength, initialText = "", nofadeout = false)
|
||||
return pbEnterText(helptext, minlength, maxlength, initialText, 1, nil, nofadeout)
|
||||
end
|
||||
|
||||
def pbEnterPokemonName(helptext,minlength,maxlength,initialText = "",pokemon = nil,nofadeout = false)
|
||||
return pbEnterText(helptext,minlength,maxlength,initialText,2,pokemon,nofadeout)
|
||||
def pbEnterPokemonName(helptext, minlength, maxlength, initialText = "", pokemon = nil, nofadeout = false)
|
||||
return pbEnterText(helptext, minlength, maxlength, initialText, 2, pokemon, nofadeout)
|
||||
end
|
||||
|
||||
def pbEnterNPCName(helptext,minlength,maxlength,initialText = "",id = 0,nofadeout = false)
|
||||
return pbEnterText(helptext,minlength,maxlength,initialText,3,id,nofadeout)
|
||||
def pbEnterNPCName(helptext, minlength, maxlength, initialText = "", id = 0, nofadeout = false)
|
||||
return pbEnterText(helptext, minlength, maxlength, initialText, 3, id, nofadeout)
|
||||
end
|
||||
|
||||
def pbEnterBoxName(helptext,minlength,maxlength,initialText = "",nofadeout = false)
|
||||
return pbEnterText(helptext,minlength,maxlength,initialText,4,nil,nofadeout)
|
||||
def pbEnterBoxName(helptext, minlength, maxlength, initialText = "", nofadeout = false)
|
||||
return pbEnterText(helptext, minlength, maxlength, initialText, 4, nil, nofadeout)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user