Changed functionality of running key, added compatibility with old Mystery Gifts

This commit is contained in:
Maruno17
2021-03-07 19:16:05 +00:00
parent 3a1b9b6dc6
commit 3ca08f27b8
15 changed files with 38 additions and 38 deletions

View File

@@ -162,7 +162,7 @@ class Bitmap
end
end
# Zlib deflation
smoldata = Zlib::Deflate.deflate(data.pack("C*")).bytes.map { |e| e.to_i }
smoldata = Zlib::Deflate.deflate(data.pack("C*")).bytes
# data chunk length
f.write_int smoldata.size
# IDAT

View File

@@ -48,7 +48,7 @@ def pbDownloadData(url, filename = nil, authorization = nil, depth = 0, &block)
return ret if !ret.is_a?(Hash)
return "" if ret[:status] != 200
return ret[:body] if !filename
File.open(filename, "wb"){|f|f.write(ret[:body])}
File.open(filename, "wb") { |f| f.write(ret[:body]) }
return ""
end
@@ -82,4 +82,4 @@ def pbPostToFile(url, postdata, file)
pbPostData(url, postdata,file)
rescue
end
end
end

View File

@@ -39,8 +39,8 @@ SaveData.register_conversion(:v19_convert_player) do
display_title 'Converting player trainer class'
to_all do |save_data|
next if save_data[:player].is_a?(PlayerTrainer)
# Conversion of the party is handled in PokeBattle_Trainer.copy
save_data[:player] = PokeBattle_Trainer.copy(save_data[:player])
# Conversion of the party is handled in PokeBattle_Trainer.convert
save_data[:player] = PokeBattle_Trainer.convert(save_data[:player])
end
end

View File

@@ -24,7 +24,7 @@ class Game_Player < Game_Character
@move_route_forcing || $game_temp.message_window_showing ||
pbMapInterpreterRunning?
terrain = pbGetTerrainTag
input = ($PokemonSystem.runstyle==1) ? $PokemonGlobal.runtoggle : Input.press?(Input::SPECIAL)
input = ($PokemonSystem.runstyle == 1) ^ Input.press?(Input::SPECIAL)
return input && $PokemonGlobal.runningShoes && !jumping? &&
!$PokemonGlobal.diving && !$PokemonGlobal.surfing &&
!$PokemonGlobal.bicycle && !PBTerrain.onlyWalk?(terrain)

View File

@@ -187,10 +187,6 @@ class Scene_Map
unless $game_player.moving?
$PokemonTemp.keyItemCalling = true
end
elsif Input.trigger?(Input::SPECIAL)
if $PokemonSystem.runstyle==1
$PokemonGlobal.runtoggle = !$PokemonGlobal.runtoggle
end
elsif Input.press?(Input::F9)
$game_temp.debug_calling = true if $DEBUG
end

View File

@@ -114,7 +114,7 @@ class BitmapWrapper < Bitmap
def dispose
return if self.disposed?
@refcount -= 1
super if @refcount == 0
super if @refcount <= 0
end
def initialize(*arg)
@@ -265,8 +265,8 @@ module BitmapCache
objKey = fromCache(key)
if !objKey
bitmap = BitmapWrapper.new(Game_Map::TILE_WIDTH, Game_Map::TILE_HEIGHT)
x = (tile_id - 384) % 8 * 32
y = (tile_id - 384) / 8 * 32
x = (tile_id - 384) % 8 * Game_Map::TILE_WIDTH
y = (tile_id - 384) / 8 * Game_Map::TILE_HEIGHT
rect = Rect.new(x, y, Game_Map::TILE_WIDTH, Game_Map::TILE_HEIGHT)
tileset = yield(filename)
bitmap.blt(0, 0, tileset, rect)

View File

@@ -296,7 +296,7 @@ class GifBitmap
end
def totalFrames
@totalframes/2 # Due to frame count being incremented by 2
@totalframes/2 # Due to frame count being incremented by 2
end
def disposed?
@@ -311,7 +311,7 @@ class GifBitmap
@gifbitmaps.length==0 ? 0 : @gifbitmaps[0].height
end
# This function must be called in order to animate the GIF image.
# This function must be called in order to animate the GIF image.
def update
return if disposed?
if @gifbitmaps.length>0

View File

@@ -592,7 +592,7 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
alignstack.push(0)
nextline=1 if x>0 && nextline==0
else
alignstack.pop;
alignstack.pop
nextline=1 if x>0 && nextline==0
end
elsif control=="ac" # Center align
@@ -600,7 +600,7 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
alignstack.push(2)
nextline=1 if x>0 && nextline==0
else
alignstack.pop;
alignstack.pop
nextline=1 if x>0 && nextline==0
end
elsif control=="icon" # Icon

View File

@@ -335,7 +335,7 @@ class LocationWindow
@window.dispose
return
end
if @frames>80
if @frames > Graphics.frame_rate * 2
@window.y -= 4
@window.dispose if @window.y+@window.height<0
else

View File

@@ -10,7 +10,6 @@ class PokemonGlobalMetadata
attr_accessor :sliding
attr_accessor :fishing
attr_accessor :runningShoes
attr_accessor :runtoggle
# Player data
attr_accessor :startTime
attr_accessor :stepcount
@@ -71,7 +70,6 @@ class PokemonGlobalMetadata
@sliding = false
@fishing = false
@runningShoes = false
@runtoggle = false
# Player data
@startTime = Time.now
@stepcount = 0

View File

@@ -44,7 +44,7 @@ class PokeBattle_Trainer
attr_reader :pokedex, :pokegear
attr_reader :mysterygiftaccess, :mysterygift
def self.copy(trainer)
def self.convert(trainer)
validate trainer => self
ret = PlayerTrainer.new(trainer.name, trainer.trainertype)
ret.id = trainer.id

View File

@@ -349,14 +349,9 @@ class PokemonOption_Scene
proc { $PokemonSystem.battlestyle },
proc { |value| $PokemonSystem.battlestyle = value }
),
EnumOption.new(_INTL("Running Key"),[_INTL("Hold"),_INTL("Toggle")],
EnumOption.new(_INTL("Default Movement"),[_INTL("Walking"),_INTL("Running")],
proc { $PokemonSystem.runstyle },
proc { |value|
if $PokemonSystem.runstyle!=value
$PokemonSystem.runstyle = value
$PokemonGlobal.runtoggle = false if $PokemonGlobal
end
}
proc { |value| $PokemonSystem.runstyle = value }
),
NumberOption.new(_INTL("Speech Frame"),1,Settings::SPEECH_WINDOWSKINS.length,
proc { $PokemonSystem.textskin },

View File

@@ -7,8 +7,7 @@
# NOTE: Essentials cannot handle https addresses. You must use a http address.
#===============================================================================
module MysteryGift
URL = "http://images1.wikia.nocookie.net/pokemonessentials/images/e/e7/MysteryGift.txt"
# URL = "http://pastebin.com/raw/w6BqqUsm"
URL = "https://pastebin.com/raw/w6BqqUsm"
end
#===============================================================================
@@ -57,7 +56,8 @@ def pbEditMysteryGift(type,item,id=0,giftname="")
end
end
if id==0
master=[]; idlist=[]
master=[]
idlist=[]
if safeExists?("MysteryGiftMaster.txt")
master=IO.read("MysteryGiftMaster.txt")
master=pbMysteryGiftDecrypt(master)
@@ -146,7 +146,7 @@ def pbManageMysteryGifts
pbMessage(_INTL("Online Mystery Gifts found.\\wtnp[20]"))
online=pbMysteryGiftDecrypt(online)
t=[]
for gift in online; t.push(gift[0]); end
online.each { |gift| t.push(gift[0]) }
online=t
end
# Show list of all gifts.
@@ -155,9 +155,9 @@ def pbManageMysteryGifts
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
if command==-1 || command==commands.length-1 # Cancel
break
elsif command==commands.length-2
elsif command==commands.length-2 # Export selected to file
begin
newfile=[]
for gift in master
@@ -170,7 +170,7 @@ def pbManageMysteryGifts
rescue
pbMessage(_INTL("Couldn't save the gifts to MysteryGift.txt."))
end
elsif command>=0 && command<commands.length-2
elsif command>=0 && command<commands.length-2 # A gift
cmd=0
loop do
commands=pbRefreshMGCommands(master,online)
@@ -336,7 +336,16 @@ end
def pbMysteryGiftDecrypt(gift)
return [] if gift==""
ret=Marshal.restore(Zlib::Inflate.inflate(gift.unpack("m")[0]))
ret = Marshal.restore(Zlib::Inflate.inflate(gift.unpack("m")[0]))
if ret
ret.each do |gift|
if gift[1] == 0 # Pokémon
gift[2] = PokeBattle_Pokemon.convert(gift[2])
else # Item
gift[2] = GameData::Item.get(gift[2]).id
end
end
end
return ret
end

View File

@@ -10,8 +10,10 @@ def pbScreenCapture
t = pbGetTimeNow
filestart = t.strftime("[%Y-%m-%d] %H_%M_%S")
filestart = sprintf("%s.%03d", filestart, (t.to_f - t.to_i) * 1000) # milliseconds
capturefile = RTP.getSaveFileName(sprintf("%s.png", filestart))
Graphics.snap_to_bitmap.save_to_png(capturefile)
# capturefile = RTP.getSaveFileName(sprintf("%s.png", filestart))
# Graphics.snap_to_bitmap.save_to_png(capturefile)
capturefile = RTP.getSaveFileName(sprintf("%s.bmp", filestart))
Graphics.screenshot(capturefile)
pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full")
end