Project1
标题:
【VX】【汉化+加强】DEBUG工具
[打印本页]
作者:
皮卡星
时间:
2012-6-17 02:12
标题:
【VX】【汉化+加强】DEBUG工具
大家好,我好久没发帖了呢……
最近真的没动力啊,真的没
然后为了刷下存在感,我汉化了这个脚本,
因为我不擅长做说明什么的,所以我就多说点废话
大家看作是说明就行了
首先呢,这个脚本并不是我原创的
不过有原创内容,当然,版权归OriginalWij所有
这脚本的主要功能有:
在地图上的时候可以传送到xxx地图,可以调整坐标
在地图上的时候可以随时存档
在地图上的时候可以打开DEBUG用的背包,可以自己增减道具,武器,防具,金钱,角色
在地图上的时候可以打开图标查看器,这个东西可以查看图标的ID,对脚本编写者很有用
在地图上的时候可以打开变量&开关搜索器,这个东西可以查看你的游戏里出现的开关或变量的地方(搜索范围为,脚本,公共事件和事件)
截图:
QQ截图20120616200849.png
(37.43 KB, 下载次数: 18)
下载附件
保存到相册
2012-6-17 02:10 上传
脚本:
插入到MAIN的上面即可
#==============================================================================
# Debug Tools
#
# 作者 : OriginalWij + Yanfly + 星君
#
# 版本 : 2.0
#
# 星君的话:
#
# 本脚本并不是本人原创的,本人只是给这个脚本加了功能,而且汉化了
# 不过我相信我的版本不比原版差
# 请大家多多包涵
#
# 版本:
#
# v1.0 - 原版
# - 开始公开
#
# v1.2 - 星君的版本
# - 替换ICON查看器,增加变量和开关全局查看,并保存为txt格式
#
# v2.0 - 星君的版本
# - 结束更新,最终版
#
# 调用按键 :F7
#==============================================================================
#==============================================================================
# Window_NumberInput
#==============================================================================
class Window_NumberInput < Window_Base
attr_accessor :index
def index
return @index
end
def index=(new_index)
@index = new_index
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
alias test_keys_update update unless $@
def update
test_keys_update
if Input.trigger?(Input::F7) and $TEST
Sound.play_decision
$scene = Scene_DebugSelect.new
end
end
end
#==============================================================================
# Scene_Debug
#==============================================================================
class Scene_Debug < Scene_Base
def update_left_input
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
return
elsif Input.trigger?(Input::C)
Sound.play_decision
wlh = 28
if @left_window.mode == 0
text1 = 'C » ON / OFF'
@help_window.contents.draw_text(4, 0, 336, wlh, text1)
else
text1 = 'LEFT → -1'
text2 = 'RIGHT → +1'
text3 = 'L → -10'
text4 = 'R → +10'
text5 = 'X → -100'
text6 = 'Y → +100'
text7 = 'Z → Clear\c[0]'
@help_window.contents.draw_text(4, wlh * 0, 336, wlh, text1)
@help_window.contents.draw_text(4, wlh * 1, 336, wlh, text2)
@help_window.contents.draw_text(4, wlh * 2, 336, wlh, text3)
@help_window.contents.draw_text(4, wlh * 3, 336, wlh, text4)
@help_window.contents.draw_text(172, wlh * 0, 336, wlh, text5)
@help_window.contents.draw_text(172, wlh * 1, 336, wlh, text6)
@help_window.contents.draw_text(172, wlh * 2, 336, wlh, text7)
end
@left_window.active = false
@right_window.active = true
@right_window.index = 0
end
end
alias test_keys_sd_update_right_input update_right_input unless $@
def update_right_input
test_keys_sd_update_right_input
if Input.repeat?(Input::X) and @right_window.mode == 1
Sound.play_decision
$game_variables[@right_window.top_id + @right_window.index] -= 100
@right_window.draw_item(@right_window.index)
elsif Input.repeat?(Input::Y) and @right_window.mode == 1
Sound.play_decision
$game_variables[@right_window.top_id + @right_window.index] += 100
@right_window.draw_item(@right_window.index)
elsif Input.trigger?(Input::Z) and @right_window.mode == 1
Sound.play_decision
$game_variables[@right_window.top_id + @right_window.index] = 0
@right_window.draw_item(@right_window.index)
end
end
end
#==============================================================================
# Map_Select_Window
#==============================================================================
class Map_Select_Window < Window_Base
def initialize
super(0, 56, 160, 120)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 120, WLH, '地图 ID:', 0)
self.contents.draw_text(0, 32, 120, WLH, 'X:', 0)
self.contents.draw_text(0, 64, 120, WLH, 'Y:', 0)
end
end
#==============================================================================
# Map_Keys_Window
#==============================================================================
class Map_Keys_Window < Window_Base
def initialize
super(0, 264, 160, 152)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = crisis_color
self.contents.font.size = 16
self.contents.draw_text(4, 0, 120, WLH, 'Z → 选择坐标', 0)
self.contents.draw_text(4, 32, 120, WLH, 'R → 下一个', 0)
self.contents.draw_text(4, 64, 120, WLH, 'L → 前一个', 0)
self.contents.draw_text(4, 96, 120, WLH, 'C → 传送', 0)
end
end
#==============================================================================
# Item_Keys_Window
#==============================================================================
class Item_Keys_Window < Window_Base
def initialize
super(0, 208, 160, 208)
unfresh
end
def unfresh
self.contents.clear
end
def refresh_items
self.contents.clear
self.contents.font.color = crisis_color
self.contents.font.size = 16
self.contents.draw_text(4, 2, 120, 24, 'UP → 前一个', 0)
self.contents.draw_text(4, 32, 120, 24, 'DOWN → 下一个', 0)
self.contents.draw_text(4, 62, 120, 24, 'C → +1', 0)
self.contents.draw_text(4, 92, 120, 24, 'Z → +10', 0)
self.contents.draw_text(4, 122, 120, 24, 'Y → -1', 0)
self.contents.draw_text(4, 152, 120, 24, 'X → -10', 0)
end
def refresh_gold
self.contents.clear
self.contents.font.color = crisis_color
self.contents.font.size = 16
self.contents.draw_text(4, 2, 120, 24, 'UP → +100', 0)
self.contents.draw_text(4, 32, 120, 24, 'DOWN → -100', 0)
self.contents.draw_text(4, 62, 120, 24, 'L → +1,000', 0)
self.contents.draw_text(4, 92, 120, 24, 'R → -1,000', 0)
self.contents.draw_text(4, 122, 120, 24, 'X → +10,000', 0)
self.contents.draw_text(4, 152, 120, 24, 'Y → -10,000', 0)
end
def refresh_actors
self.contents.clear
self.contents.font.color = crisis_color
self.contents.font.size = 16
self.contents.draw_text(4, 2, 120, 24, 'RIGHT → 移除队伍', 0)
self.contents.draw_text(4, 32, 120, 24, 'LEFT → 加到队伍', 0)
self.contents.draw_text(4, 62, 120, 24, 'C → 查看状态', 0)
end
def refresh_actors_stats
self.contents.clear
self.contents.font.color = crisis_color
self.contents.font.size = 16
self.contents.draw_text(4, 2, 120, 24, 'A → +1', 0)
self.contents.draw_text(4, 32, 120, 24, 'Z → -1', 0)
self.contents.draw_text(4, 62, 120, 24, 'L → +10', 0)
self.contents.draw_text(4, 92, 120, 24, 'R → -10', 0)
self.contents.draw_text(4, 122, 120, 24, 'X → +100', 0)
self.contents.draw_text(4, 152, 120, 24, 'Y → -100', 0)
end
end
#==============================================================================
# Misc_Window
#==============================================================================
class Misc_Window < Window_Base
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
def refresh
self.contents.clear
end
end
#==============================================================================
# Party_Member_Select_Window
#==============================================================================
class Party_Member_Select_Window < Window_Selectable
def initialize(x, y, width, height, stats = false)
super(x, y, width, height)
if stats
@pmsw = 36
@item_max = 9
else
@pmsw = 40
@item_max = 20
end
@column_max = 1
self.opacity = 0
self.index = 0
self.contents.clear
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = @pmsw
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * @pmsw
return rect
end
def update_cursor
if @index < 0
self.cursor_rect.empty
elsif @index < @item_max
super
elsif @index >= 100
self.cursor_rect.set(0, (@index - 100) * @pmsw,
contents.width, @pmsw)
else
self.cursor_rect.set(0, 0, contents.width, @item_max * @pmsw)
end
end
end
#==============================================================================
# Item_Display_Window
#==============================================================================
class Item_Display_Window < Window_Selectable
def initialize(data)
super(160, 52, 384, 368)
@data = data
@item_max = @data.size - 1
@column_max = 1
self.opacity = 0
self.index = 0
refresh
end
def refresh
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index + 1]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, true)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
end
#==============================================================================
# Scene_Teleport
#==============================================================================
class Scene_Teleport < Scene_Base
def initialize
@map_id = 1
@map_x = @map_y = @active_input = 0
@cursor_count = 17
@blink = false
end
def start
create_menu_background
@info_window = Window_Help.new
@map_name_window = Window_Help.new
@info_window.width = @map_name_window.x = 160
@map_name_window.width = 384
@map_name_window.height = 33
@info_window.create_contents
@map_name_window.create_contents
@map_display_window = Misc_Window.new(160, 32, 384, 384)
@map_text_window = Misc_Window.new(160, -16, 384, 432)
@map_text_window.opacity = 0
@map_text_window.z = @map_display_window.z + 1
@map_text_window.active = false
@map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
@map_select_window = Map_Select_Window.new
@map_confirm_window = Misc_Window.new(0, 176, 160, 88)
@map_keys_window = Map_Keys_Window.new
@input_window = []
for i in 0..2
@input_window[i] = Window_NumberInput.new
@input_window[i].number = 1 if i == 0
@input_window[i].index = 2
@input_window[i].update_cursor
@input_window[i].digits_max = 3
@input_window[i].x = 48
@input_window[i].y = 56 + (i * 32)
end
@map_info = load_data('Data/MapInfos.rvdata')
create_target(@map.data, 0, 0)
@input_window[0].active = true
end
def terminate
dispose_menu_background
dispose_target_map
@info_window.dispose
@map_name_window.dispose
@map_display_window.dispose
@map_text_window.dispose
@map_select_window.dispose
if @confirm_window != nil
@confirm_window.dispose
@confirm_window = nil
end
@map_confirm_window.dispose
@map_keys_window.dispose
for i in 0..2
@input_window[i].dispose
end
end
def update
update_menu_background
case @active_input
when 0
@info_window.set_text('选择地图……', 1)
when 1
@info_window.set_text('选择X值……', 1)
when 2
@info_window.set_text('选择Y值……', 1)
else
@info_window.set_text('选择X&Y值……', 1)
end
@info_window.set_text('传送?', 1) if @confirm_window != nil
@map_display_window.update
@map_text_window.update
@map_select_window.update
@map_keys_window.update
for i in 0..2
@input_window[i].update
end
if @confirm_window != nil
@confirm_window.update
end
if Input.trigger?(Input::Z)
if @confirm_window == nil and @active_input < 3
Sound.play_decision
@active_input += 10
for i in 0..2
@input_window[i].active = false
end
@map_text_window.active = true
elsif @confirm_window == nil
Sound.play_cancel
@active_input -= 10
@map_text_window.active = false
@input_window[@active_input].active = true
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
if @confirm_window != nil
@confirm_window.active = false
reset_active_input
@confirm_window.dispose
@confirm_window = nil
else
$scene = Scene_Map.new
end
elsif Input.trigger?(Input::C)
if @confirm_window != nil
if @confirm_window.index == 0
Sound.play_load
$game_player.reserve_transfer(@input_window[0].number,
@input_window[1].number, @input_window[2].number, 0)
for i in 1..20
$game_map.screen.pictures[i].erase
end
$scene = Scene_Map.new
else
Sound.play_decision
@confirm_window.active = false
reset_active_input
@confirm_window.dispose
@confirm_window = nil
end
else
Sound.play_decision
com1 = '确认'
com2 = '返回'
@confirm_window = Window_Command.new(160, [com1, com2])
@confirm_window.index = 1
@confirm_window.y = 180
@confirm_window.opacity = 0
for i in 0..2
@input_window[i].active = false
end
@map_text_window.active = false
@confirm_window.active = true
end
elsif Input.repeat?(Input::UP) and @map_text_window.active == true
if @input_window[2].number > 0
adjust_y(-1)
end
elsif Input.repeat?(Input::DOWN) and @map_text_window.active == true
if @input_window[2].number < @map.height - 1
adjust_y(1)
end
elsif Input.repeat?(Input::LEFT) and @map_text_window.active == true
if @input_window[1].number > 0
adjust_x(-1)
end
elsif Input.repeat?(Input::RIGHT) and @map_text_window.active == true
if @input_window[1].number < @map.width - 1
adjust_x(1)
end
elsif Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) and
@map_text_window.active == false
mapid = @input_window[0].number
filename = sprintf("Data/Map%03d.rvdata", mapid)
dispose_target_map
@map_display_window.refresh
@map_text_window.refresh
if FileTest.exist?(filename)
@map_id = @input_window[0].number
if @input_window[1].number > 4
@map_x = (@input_window[1].number - 5) * 256
else
@map_x = 0
end
if @input_window[2].number > 4
@map_y = (@input_window[2].number - 5) * 256
else
@map_y = 0
end
@map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
if @map_x > ((@map.width * 256) - 2816)
@map_x = ((@map.width * 256) - 2816)
end
if @map_y > ((@map.height * 256) - 2816)
@map_y = ((@map.height * 256) - 2816)
end
if @input_window[1].number > @map.width - 1
index = @input_window[1].index
@input_window[1].number = @map.width - 1
@input_window[1].index = index
@input_window[1].update_cursor
end
if @input_window[2].number > @map.height - 1
index = @input_window[2].index
@input_window[2].number = @map.height - 1
@input_window[2].index = index
@input_window[2].update_cursor
end
create_target(@map.data, @map_x, @map_y)
else
text = '地图 #' + @input_window[0].number.to_s + ' 不存在……'
@map_text_window.contents.draw_text(16, 4, 320, 24, text, 1)
end
elsif Input.trigger?(Input::L) and @map_text_window.active == false
Sound.play_cursor
@active_input -= 1
@active_input = 2 if @active_input < 0
for i in 0..2
@input_window[i].active = false
end
@input_window[@active_input].active = true
elsif Input.trigger?(Input::R) and @map_text_window.active == false
Sound.play_cursor
@active_input += 1
@active_input = 0 if @active_input > 2
for i in 0..2
@input_window[i].active = false
end
@input_window[@active_input].active = true
end
mx = calc_x
my = calc_y
if @map_text_window.active == true
if @cursor_count == 0 and @blink == true
@cursor_count = 17
@blink = false
@map_text_window.contents.fill_rect(mx, my + 48, 32, 32,
Color.new(0, 255, 0, 255 - @cursor_count * 15))
@map_text_window.contents.fill_rect(mx + 2, my + 50, 28, 28,
Color.new(0, 255, 0, (255 - (@cursor_count * 15)) / 2))
elsif @cursor_count == 0 and @blink == false
@cursor_count = 17
@blink = true
@map_text_window.contents.fill_rect(mx, my + 48, 32, 32,
Color.new(0, 255, 0, @cursor_count * 15))
@map_text_window.contents.fill_rect(mx + 2, my + 50, 28, 28,
Color.new(0, 255, 0, (@cursor_count * 15) / 2))
else
@cursor_count -= 1
if @blink == true
@map_text_window.contents.fill_rect(mx, my + 48, 32, 32,
Color.new(0, 255, 0, @cursor_count * 15))
@map_text_window.contents.fill_rect(mx + 2, my + 50, 28, 28,
Color.new(0, 255, 0, (@cursor_count * 15) / 2))
else
@map_text_window.contents.fill_rect(mx, my + 48, 32, 32,
Color.new(0, 255, 0, 255 - @cursor_count * 15))
@map_text_window.contents.fill_rect(mx + 2, my + 50, 28, 28,
Color.new(0, 255, 0, (255 - (@cursor_count * 15)) / 2))
end
end
else
mapid = @input_window[0].number
filename = sprintf("Data/Map%03d.rvdata", mapid)
if FileTest.exist?(filename)
@map_text_window.contents.fill_rect(mx, my + 48, 32, 32,
Color.new(255, 0, 0, 255))
@map_text_window.contents.fill_rect(mx + 2, my + 50, 28, 28,
Color.new(255, 0, 0, 128))
else
@map_text_window.contents.clear_rect(mx, my + 48, 32, 32)
end
end
end
def create_target(map_data, ox, oy)
@viewport = Viewport.new(@map_display_window.x + 16,
@map_display_window.y + 16, 352,352)
@viewport.z = @map_display_window.z
@target_map = Tilemap.new(@viewport)
@target_map.bitmaps[0] = Cache.system("TileA1")
@target_map.bitmaps[1] = Cache.system("TileA2")
@target_map.bitmaps[2] = Cache.system("TileA3")
@target_map.bitmaps[3] = Cache.system("TileA4")
@target_map.bitmaps[4] = Cache.system("TileA5")
@target_map.bitmaps[5] = Cache.system("TileB")
@target_map.bitmaps[6] = Cache.system("TileC")
@target_map.bitmaps[7] = Cache.system("TileD")
@target_map.bitmaps[8] = Cache.system("TileE")
@target_map.map_data = map_data
@target_map.ox = ox / 8
@target_map.oy = oy / 8
filename = sprintf("Data/Map%03d.rvdata", @map_id)
if FileTest.exist?(filename)
mx = calc_x
my = calc_y
@map_text_window.contents.fill_rect(mx, my + 48, 32, 32,
Color.new(255, 0, 0, 255))
@map_text_window.contents.fill_rect(mx + 2, my + 50, 28, 28,
Color.new(255, 0, 0, 128))
@map_text_window.contents.font.size = 16
text = @map_info[@map_id].name
@map_text_window.contents.draw_text(16, 4, 320, 24, text, 1)
end
end
def dispose_target_map
unless @target_map == nil
@target_map.dispose
@target_map = nil
end
end
def reset_active_input
case @active_input
when 0
@input_window[0].active = true
when 1
@input_window[1].active = true
when 2
@input_window[2].active = true
else
@map_text_window.active = true
end
end
def adjust_x(adj_x)
Sound.play_cursor
index = @input_window[1].index
@input_window[1].number += adj_x
@input_window[1].index = index
@input_window[1].update_cursor
if @input_window[1].number > 4
@map_x = (@input_window[1].number - 5) * 256
else
@map_x = 0
end
if @map_x > ((@map.width * 256) - 2816)
@map_x = ((@map.width * 256) - 2816)
end
dispose_target_map
@map_text_window.refresh
create_target(@map.data, @map_x, @map_y)
end
def adjust_y(adj_y)
Sound.play_cursor
index = @input_window[2].index
@input_window[2].number += adj_y
@input_window[2].index = index
@input_window[2].update_cursor
if @input_window[2].number > 4
@map_y = (@input_window[2].number - 5) * 256
else
@map_y = 0
end
if @map_y > ((@map.height * 256) - 2816)
@map_y = ((@map.height * 256) - 2816)
end
dispose_target_map
@map_text_window.refresh
create_target(@map.data, @map_x, @map_y)
end
def calc_x
x = @input_window[1].number
if x > 4 and x < (@map.width - 5)
x = 5
elsif x > 4
x -= (@map.width - 11)
end
x *= 32
return x
end
def calc_y
y = @input_window[2].number
if y > 4 and y < (@map.height - 5)
y = 5
elsif y > 4
y -= (@map.height - 11)
end
y *= 32
return y
end
end
#==============================================================================
# Scene_ItemsGoldParty
#==============================================================================
class Scene_ItemsGoldParty < Scene_Base
def initialize
@itemsgoldparty = 0
@text = []
@sub_text = []
@text[0] = '增减 道具'
@text[1] = '增减 武器'
@text[2] = '增减 防具'
@text[3] = "增减 金钱"
@text[4] = '增减 队伍角色'
@sub_text[0] = '选择道具,并增减'
@sub_text[1] = '选择武器,并增减'
@sub_text[2] = '选择防具,并增减'
@sub_text[3] = '增减金钱'
@sub_text[4] = '选择角色,并增减队伍'
@sub_text[5] = '选择角色,并增加状态'
@stat_mode = false
end
def start
create_menu_background
@help_window = Window_Help.new
@display_window = Misc_Window.new(160, 56, 384, 360)
@gold_window = Window_Gold.new(160, 56)
@gold_window.z = @display_window.z + 1
@gold_window.opacity = 0
@gold_window.visible = false
com1 = ' 道具 '
com2 = ' 武器 '
com3 = ' 装备 '
com4 = ' 金钱 '
com5 = ' 角色 '
@command_window = Window_Command.new(160, [com1, com2, com3, com4, com5])
@command_window.y = 56
@key_window = Item_Keys_Window.new
@command_window.active = true
end
def terminate
dispose_menu_background
@help_window.dispose
@gold_window.dispose
@display_window.dispose
@key_window.dispose
@command_window.dispose
if @item_window != nil
@item_window.dispose
@item_window = nil
end
end
def update
update_menu_background
@help_window.update
if @itemsgoldparty == 0
@help_window.set_text(@text[@command_window.index], 1)
else
@help_window.set_text(@sub_text[@itemsgoldparty - 1], 1) unless @stat_mode
@help_window.set_text(@sub_text[@itemsgoldparty], 1) if @stat_mode
end
@gold_window.update
@display_window.update
@key_window.update
@command_window.update
if @item_window != nil
@item_window.update
end
update_keys
case @itemsgoldparty
when 0
@display_window.active = false
@command_window.active = true
update_main
when 1, 2, 3
@command_window.active = false
@item_window.active = true
update_inventory
when 4
@command_window.active = false
@display_window.active = true
update_gold
when 5
@command_window.active = false
@display_window.active = true
update_party unless @stat_mode
update_stats if @stat_mode
end
end
def update_main
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
Sound.play_decision
case @command_window.index
when 0
@data = $data_items
@itemsgoldparty = 1
if @item_window != nil
@item_window.dispose
end
@item_window = Item_Display_Window.new(@data)
when 1
@data = $data_weapons
@itemsgoldparty = 2
if @item_window != nil
@item_window.dispose
end
@item_window = Item_Display_Window.new(@data)
when 2
@data = $data_armors
@itemsgoldparty = 3
if @item_window != nil
@item_window.dispose
end
@item_window = Item_Display_Window.new(@data)
when 3
if @item_window != nil
@item_window.dispose
@item_window = nil
end
@itemsgoldparty = 4
@gold_window.visible = true
when 4
if @item_window != nil
@item_window.dispose
@item_window = nil
end
@itemsgoldparty = 5
draw_party
@select_window = Party_Member_Select_Window.new(160, 60, 384, 360)
end
end
end
def update_inventory
if Input.trigger?(Input::B)
Sound.play_cancel
@itemsgoldparty = 0
@item_window.dispose
@item_window = nil
elsif Input.repeat?(Input::C)
Sound.play_decision
$game_party.gain_item(@data[@item_window.index + 1], 1)
@item_window.draw_item(@item_window.index)
elsif Input.repeat?(Input::Y)
Sound.play_decision
$game_party.lose_item(@data[@item_window.index + 1], 1)
@item_window.draw_item(@item_window.index)
elsif Input.repeat?(Input::Z)
Sound.play_decision
$game_party.gain_item(@data[@item_window.index + 1], 10)
@item_window.draw_item(@item_window.index)
elsif Input.repeat?(Input::X)
Sound.play_decision
$game_party.lose_item(@data[@item_window.index + 1], 10)
@item_window.draw_item(@item_window.index)
end
end
def update_gold
if Input.trigger?(Input::B)
Sound.play_cancel
@gold_window.visible = false
@itemsgoldparty = 0
elsif Input.repeat?(Input::UP)
Sound.play_cursor
$game_party.gain_gold(100)
@gold_window.refresh
elsif Input.repeat?(Input::DOWN)
Sound.play_cursor
$game_party.lose_gold(100)
@gold_window.refresh
elsif Input.repeat?(Input::L)
Sound.play_cursor
$game_party.gain_gold(1000)
@gold_window.refresh
elsif Input.repeat?(Input::R)
Sound.play_cursor
$game_party.lose_gold(1000)
@gold_window.refresh
elsif Input.repeat?(Input::X)
Sound.play_cursor
$game_party.gain_gold(10000)
@gold_window.refresh
elsif Input.repeat?(Input::Y)
Sound.play_cursor
$game_party.lose_gold(10000)
@gold_window.refresh
end
end
def update_party
@select_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
draw_party(true)
@select_window.dispose
@select_window = nil
@itemsgoldparty = 0
elsif Input.trigger?(Input::C)
Sound.play_decision
@actor = $game_actors[@select_window.index + 1]
draw_party(true)
@select_window.dispose
@select_window = Party_Member_Select_Window.new(160, 58, 384, 360, true)
draw_stats
@stat_mode = true
elsif Input.trigger?(Input::LEFT)
if !$game_party.members.include?($game_actors[@select_window.index + 1])
Sound.play_cursor
$game_party.add_actor(@select_window.index + 1)
draw_party
end
elsif Input.trigger?(Input::RIGHT)
if $game_party.members.include?($game_actors[@select_window.index + 1])
Sound.play_cursor
$game_party.remove_actor(@select_window.index + 1)
draw_party
end
end
end
def update_stats
@select_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
draw_stats(true)
@select_window.dispose
@select_window = Party_Member_Select_Window.new(160, 60, 384, 360)
@select_window.index = @actor.id - 1
@stat_mode = false
draw_party
elsif Input.repeat?(Input::C)
change_stat(1)
draw_stats
elsif Input.repeat?(Input::Z)
change_stat(-1)
draw_stats
elsif Input.repeat?(Input::L)
change_stat(10)
draw_stats
elsif Input.repeat?(Input::R)
change_stat(-10)
draw_stats
elsif Input.repeat?(Input::X)
change_stat(100)
draw_stats
elsif Input.repeat?(Input::Y)
change_stat(-100)
draw_stats
end
end
def change_stat(amount)
case @select_window.index
when 0
if @actor.level + amount >= 1 and @actor.level + amount <= 99
Sound.play_cursor
@actor.change_level(@actor.level + amount, false)
end
when 1
if @actor.maxhp + amount >= 1 and @actor.maxhp + amount <= 9999
Sound.play_cursor
@actor.maxhp += amount
end
when 2
if @actor.hp + amount >= 1 and @actor.hp + amount <= @actor.maxhp
Sound.play_cursor
@actor.hp += amount
end
when 3
if @actor.maxmp + amount >= 0 and @actor.maxmp + amount <= 9999
Sound.play_cursor
@actor.maxmp += amount
end
when 4
if @actor.mp + amount >= 0 and @actor.mp + amount <= @actor.maxmp
Sound.play_cursor
@actor.mp += amount
end
when 5
if @actor.atk + amount >= 1 and @actor.atk + amount <= 999
Sound.play_cursor
@actor.atk += amount
end
when 6
if @actor.def + amount >= 1 and @actor.def + amount <= 999
Sound.play_cursor
@actor.def += amount
end
when 7
if @actor.spi + amount >= 1 and @actor.spi + amount <= 999
Sound.play_cursor
@actor.spi += amount
end
when 8
if @actor.agi + amount >= 1 and @actor.agi + amount <= 999
Sound.play_cursor
@actor.agi += amount
end
end
end
def update_keys
@key_window.contents.clear
case @itemsgoldparty
when 1, 2, 3
@key_window.refresh_items
when 4
@key_window.refresh_gold
when 5
@key_window.refresh_actors unless @stat_mode
@key_window.refresh_actors_stats if @stat_mode
else
@key_window.unfresh
end
end
def draw_party(erase = false)
@display_window.contents.clear
unless erase
for i in 1..20
actor = $game_actors[i]
if $game_party.members.include?(actor)
@display_window.draw_actor_graphic(actor, 24, i * 40)
@display_window.draw_actor_name(actor, 60, i * 40 - 28)
else
@display_window.draw_actor_graphic(actor, 328, i * 40)
@display_window.draw_actor_name(actor, 208, i * 40 - 28)
end
end
end
end
def draw_stats(erase = false)
@display_window.contents.clear
unless erase
actr_lvl = sprintf("Level: %3d", @actor.level)
actr_mhp = sprintf("Max Hp: %5d", @actor.maxhp)
actr_chp = sprintf("Hp: %5d", @actor.hp)
actr_mmp = sprintf("Max Mp: %5d", @actor.maxmp)
actr_cmp = sprintf("Mp: %5d", @actor.mp)
actr_atk = sprintf("Off: %5d", @actor.atk)
actr_def = sprintf("Def: %5d", @actor.def)
actr_spi = sprintf("Int: %5d", @actor.spi)
actr_agi = sprintf("Agi: %5d", @actor.agi)
spc = 36
@display_window.contents.draw_text(4, spc * 0 + 8, 352, 24, actr_lvl, 0)
@display_window.contents.draw_text(4, spc * 1 + 8, 352, 24, actr_mhp, 0)
@display_window.contents.draw_text(4, spc * 2 + 8, 352, 24, actr_chp, 0)
@display_window.contents.draw_text(4, spc * 3 + 8, 352, 24, actr_mmp, 0)
@display_window.contents.draw_text(4, spc * 4 + 8, 352, 24, actr_cmp, 0)
@display_window.contents.draw_text(4, spc * 5 + 8, 352, 24, actr_atk, 0)
@display_window.contents.draw_text(4, spc * 6 + 8, 352, 24, actr_def, 0)
@display_window.contents.draw_text(4, spc * 7 + 8, 352, 24, actr_spi, 0)
@display_window.contents.draw_text(4, spc * 8 + 8, 352, 24, actr_agi, 0)
end
end
end
#==============================================================================
# Window_Search
#==============================================================================
class Window_Search < Window_Base
def initialize
super(0, 56, Graphics.width, Graphics.height - 56)
@maps = {}
map_files = Dir.glob("Data/Map*.rvdata")
map_files.pop
for map in map_files
data = load_data(map)
map.scan(/MAP(\d+)/i)
@maps[$1.to_i] = data.events
end
@common_events = load_data("Data/CommonEvents.rvdata").compact!
@scripts = {}
File.open("Data/Scripts.rvdata", "rb") { |f|
Marshal.load(f).each{ |s| @scripts[s[1]] = Zlib::Inflate.inflate(s[2]) } }
end
def find(fd, fv = false)
@fd = []
sdata = "$game_variables[" + fd.to_s + "]" if fv
sdata = "$game_switches[" + fd.to_s + "]" unless fv
found_check = @fd.size
for script in @scripts.keys
next if @scripts[script] == ""
@fd.push([-1, script, 0]) if @scripts[script].include?(sdata)
@scripts[script].scan(/\$game_switches\[(.*)\]/i) { |s|
next if $1.nil? or $1.is_a?(Integer)
begin
ev = eval($1)
@fd.push([-1, script, 0]) if ev == fd
rescue
next
ensure
next
end
}
end
@fd.push([-1, "-无-", 0]) if found_check == @fd.size
found_check = @fd.size
for ce in @common_events
data = [0, ce.name, 0]
@fd.push(data) if ce.switch_id == fd and ce.trigger > 0 and !fv
for cm in ce.list
next if cm.code == 0
if cm.code == 111 and cm.parameters[1] == fd
@fd.push(data) if cm.parameters[0] == 0 and !fv
if fv
@fd.push(data) if cm.parameters[0] == 1
@fd.push(data) if cm.parameters[2] != 0 and cm.parameters[3] == fd
end
elsif cm.code == 111 and cm.parameters[0] == 12
@fd.push(data) if cm.parameters[1].include?(sdata)
elsif cm.code == 121 and !fv
@fd.push(data) if fd.between?(cm.parameters[0], cm.parameters[1])
elsif cm.code == 122 and fv
@fd.push(data) if fd.between?(cm.parameters[0], cm.parameters[1])
@fd.push(data) if cm.parameters[3] == 1 and cm.parameters[4] == fd
elsif cm.code == 355 or cm.code == 655
@fd.push(data) if cm.parameters[0].include?(sdata)
end
end
end
@fd.push([0, "-无-", 0]) if found_check == @fd.size
found_check = @fd.size
for map in @maps.keys
for event in @maps[map].values
for page in event.pages
data = [map, event.id, event.pages.index(page) + 1]
cn = page.condition
@fd.push(data) if cn.switch1_id == fd and cn.switch1_valid and !fv
@fd.push(data) if cn.switch2_id == fd and cn.switch2_valid and !fv
@fd.push(data) if cn.variable_id == fd and cn.variable_valid and fv
for cm in page.list
next if cm.code == 0
if cm.code == 111 and cm.parameters[1] == fd
@fd.push(data) if cm.parameters[0] == 0 and !fv
@fd.push(data) if cm.parameters[0] == 1 and fv
cm2 = cm.parameters[2] != 0
@fd.push(data) if cm2 and cm.parameters[3] == fd and fv
elsif cm.code == 111 and cm.parameters[0] == 12
@fd.push(data) if cm.parameters[1].include?(sdata)
elsif cm.code == 121 and !fv
@fd.push(data) if fd.between?(cm.parameters[0], cm.parameters[1])
elsif cm.code == 122 and fv
@fd.push(data) if fd.between?(cm.parameters[0], cm.parameters[1])
@fd.push(data) if cm.parameters[3] == 1 and cm.parameters[4] == fd
elsif cm.code == 355 or cm.code == 655
@fd.push(data) if cm.parameters[0].include?(sdata)
end
end
end
end
end
@fd.push([9999, "-无-", 0]) if found_check == @fd.size
@fd.uniq!
@fd.sort!
refresh
end
def refresh
self.contents.dispose
self.contents = Bitmap.new(Graphics.width - 32, (@fd.size + 3) * 24)
self.contents.clear
self.oy = y = 0
self.contents.font.color = text_color(18)
self.contents.draw_text(0, y, self.contents.width, WLH, "脚本:")
self.contents.font.color = normal_color
for found in @fd
next unless found[0] == -1
y += WLH
self.contents.draw_text(8, y, self.contents.width, WLH, found[1])
end
y += WLH
self.contents.font.color = text_color(18)
self.contents.draw_text(0, y, self.contents.width, WLH, "公共事件:")
self.contents.font.color = normal_color
for found in @fd
next unless found[0] == 0
y += WLH
self.contents.draw_text(8, y, self.contents.width, WLH, found[1])
end
y += WLH
self.contents.font.color = text_color(18)
self.contents.draw_text(0, y, self.contents.width, WLH, "事件:")
self.contents.font.color = normal_color
for found in @fd
next unless found[0] > 0
if found[0] == 9999
text = found[1]
else
text = "地图 #" + found[0].to_s + ", 事件ID #" + found[1].to_s
text += ", 第 #" + found[2].to_s + "页里"
end
y += WLH
self.contents.draw_text(8, y, self.contents.width, WLH, text)
end
end
#--------------------------------------------------------------------------
# Text Dump
#--------------------------------------------------------------------------
def text_dump(fd, fv = false)
filename = "变量 ##{fd} 搜索结果.txt" if fv
filename = "开关 ##{fd} 搜索结果.txt" unless fv
file = File.new(filename, "w+")
text = "变量的搜索结果: ##{fd}" if fv
text = "开关的搜索结果: ##{fd}" unless fv
file.puts(text)
line = "-" * text.size
file.puts(line)
file.puts(" ")
file.puts("脚本:")
file.puts("--------")
for found in @fd
next unless found[0] == -1
file.puts(found[1])
end
file.puts(" ")
file.puts("公共事件:")
file.puts("--------------")
for found in @fd
next unless found[0] == 0
file.puts(found[1])
end
file.puts(" ")
file.puts("事件:")
file.puts("-------")
for found in @fd
next unless found[0] > 0
if found[0] == 9999
text = found[1]
else
text = "地图 #" + found[0].to_s + ", 事件ID #" + found[1].to_s
text += ", 第 #" + found[2].to_s + "页里"
end
file.puts(text)
end
file.close
end
end
#==============================================================================
# Scene_Search
#==============================================================================
class Scene_Search < Scene_Base
def start
super
create_menu_background
w = Graphics.width - 112
@inf_win = Window_Base.new(0, 0, w, 56)
@inf_win.visible = false
@inf_win.contents.font.size = 16
commands = ["搜索开关ID", "搜索变量ID"]
@com_win = Window_Command.new(w, commands, 2, 1, 1)
@dum_win = Window_Base.new(w, 0, Graphics.width - w, 56)
@num_win = Window_NumberInput.new
@num_win.digits_max = 4
@num_win.index = 3
@num_win.update_cursor
@num_win.active = false
@num_win.x = w - 16
@sch_win = Window_Search.new
@no_scroll = true
end
def terminate
super
dispose_menu_background
@inf_win.dispose
@com_win.dispose
@dum_win.dispose
@num_win.dispose
@sch_win.dispose
end
def update
super
update_menu_background
@inf_win.update
@com_win.update
@dum_win.update
@num_win.update
@sch_win.update
if Input.press?(Input::A) and !@num_win.active and !@com_win.active
update_scroll unless @no_scroll
elsif !Input.press?(Input::A) and @sch_win.cursor_rect.width > 0
@sch_win.cursor_rect.empty
elsif Input.trigger?(Input::B) and @com_win.active
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::B) and @num_win.active
Sound.play_cancel
@com_win.active = @com_win.visible = true
@num_win.active = @inf_win.visible = false
elsif Input.trigger?(Input::B) and !@num_win.active and !@com_win.active
Sound.play_cancel
@num_win.active = true
@inf_win.contents.clear
txt = @com_win.index == 0 ? "选择开关ID" : "选择变量ID"
@inf_win.contents.draw_text(0, 0, Graphics.width - 144, 24, txt, 1)
elsif Input.trigger?(Input::C) and @com_win.active
Sound.play_decision
@com_win.active = @com_win.visible = false
@inf_win.contents.clear
txt = @com_win.index == 0 ? "选择开关ID" : "选择变量ID"
@inf_win.contents.draw_text(0, 0, Graphics.width - 144, 24, txt, 1)
@num_win.active = @inf_win.visible = true
elsif Input.trigger?(Input::C) and @num_win.active
unless @num_win.number.between?(1, 5000)
Sound.play_buzzer
@sch_win.contents.clear
return
end
Sound.play_decision
@sch_win.find(@num_win.number, @com_win.index == 1)
@num_win.active = @com_win.visible = false
@inf_win.contents.clear
@no_scroll = @sch_win.height - 32 >= @sch_win.contents.height
txt = @com_win.index == 1 ? "变量" : "开关"
txt += "搜索结果输出 = Z"
txt += "/翻滚页面 = A" unless @no_scroll
@inf_win.contents.draw_text(0, 0, Graphics.width - 144, 24, txt, 1)
elsif Input.trigger?(Input::Z) and !@num_win.active and !@com_win.active
Sound.play_save
@sch_win.text_dump(@num_win.number, @com_win.index == 1)
end
end
def update_scroll
@sch_win.cursor_rect.width = @sch_win.width - 32
@sch_win.cursor_rect.height = @sch_win.height - 32
if Input.press?(Input::UP)
@sch_win.oy = [@sch_win.oy - 8, 0].max
elsif Input.press?(Input::DOWN)
y = @sch_win.contents.height - (Graphics.height - 88)
@sch_win.oy = [@sch_win.oy + 8, y].min
end
end
end
#===============================================================================
# Window_Command
#===============================================================================
class Window_Command < Window_Selectable
attr_accessor :commands
attr_accessor :item_max
end
#===============================================================================
# Window_Iconview
#===============================================================================
class Window_Iconview < Window_Selectable
attr_accessor :max_pages
attr_accessor :page
attr_accessor :image
def initialize
super(Graphics.width - 416, 0, 416, 416)
self.z += 1
@item_max = 256
@column_max = 16
@page = @index = @spacing = 0
@image = Cache.system("IconSet")
@max_pages = (@image.height / 384.0).ceil
@icon_sprite = Sprite.new
@icon_sprite.bitmap = Bitmap.new(384, 384)
@icon_sprite.x = self.x + 16
@icon_sprite.y = self.y + 16
@icon_sprite.z = self.z - 1
self.opacity = self.back_opacity = 0
refresh
end
def dispose
@icon_sprite.bitmap.dispose
@icon_sprite.dispose
super
end
def update
super
return unless @max_pages > 1
if Input.repeat?(Input::L)
Sound.play_cursor
image_page_up
elsif Input.repeat?(Input::R)
Sound.play_cursor
image_page_down
end
end
def refresh
@icon_sprite.bitmap.dispose
@icon_sprite.bitmap = Bitmap.new(384, 384)
rect = Rect.new(0, @page * 384, 384, 384)
@icon_sprite.bitmap.blt(0, 0, @image, rect)
end
def cursor_down(wrap)
if @index < 240
@index += 16
elsif wrap
@index -= 240
end
end
def cursor_up(wrap)
if @index >= 16
@index -= 16
elsif wrap
@index += 240
end
end
def cursor_right(wrap)
if @index % 16 < 15
@index += 1
elsif wrap
@index -= 15
end
end
def cursor_left(wrap)
if @index % 16 > 0
@index -= 1
elsif wrap
@index += 15
end
end
def image_page_up
@page = @page == 0 ? @max_pages - 1 : @page - 1
refresh
end
def image_page_down
@page = @page == @max_pages - 1 ? 0 : @page + 1
refresh
end
end
#===============================================================================
# Window_IconPageList
#===============================================================================
class Window_IconPageList < Window_Selectable
def initialize(icon_window)
@icon_window = icon_window
super(0, 128, Graphics.width-@icon_window.width, @icon_window.height-128)
self.active = false
self.index = 0
refresh
end
def refresh
@item_max = @icon_window.max_pages
create_contents
for i in 0...@item_max; draw_item(i); end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
text = sprintf("Page%d", index+1)
self.contents.draw_text(rect, text, 1)
end
def update
super
if self.index != @icon_window.page
self.index = @icon_window.page
end
end
end
#===============================================================================
# Window_Icondata
#===============================================================================
class Window_Icondata < Window_Base
def initialize(iconview_window)
@iconview_window = iconview_window
super(0, 0, Graphics.width - @iconview_window.width, 128)
end
def refresh
self.contents.clear
text = 256 * @iconview_window.page + @iconview_window.index
text = sprintf("ID:%d", text)
self.contents.draw_text(0, WLH*0, contents.width, WLH, text, 1)
text = @iconview_window.image.height / 24 * 16
text = sprintf("总共:%d", text)
self.contents.draw_text(0, WLH*1, contents.width, WLH, text, 1)
text = "Q=上一页"
self.contents.draw_text(0, WLH*2, contents.width, WLH, text, 1)
text = "W=下一页"
self.contents.draw_text(0, WLH*3, contents.width, WLH, text, 1)
end
def update
super
if @last_index != @iconview_window.index or
@last_page != @iconview_window.page
@last_index = @iconview_window.index
@last_page = @iconview_window.page
refresh
end
end
end
#===============================================================================
# Scene_Iconview
#===============================================================================
class Scene_Iconview < Scene_Base
def start
super
create_menu_background
@iconview_window = Window_Iconview.new
dx = @iconview_window.x
dy = @iconview_window.y
dw = @iconview_window.width
dh = @iconview_window.height
@dummy_window = Window_Base.new(dx, dy, dw, dh)
@data_window = Window_Icondata.new(@iconview_window)
@page_window = Window_IconPageList.new(@iconview_window)
end
def terminate
super
dispose_menu_background
@iconview_window.dispose
@dummy_window.dispose
@data_window.dispose
@page_window.dispose
end
def update
super
update_menu_background
@iconview_window.update
@data_window.update
@page_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
end
end
end
#===============================================================================
# Scene_DebugSelect
#===============================================================================
class Scene_DebugSelect < Scene_Base
def start
super
create_menu_background
create_command_window
end
def post_start
super
open_command_window
end
def terminate
super
dispose_command_window
dispose_menu_background
end
def update
super
update_menu_background
@command_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
case @command_window.index
when 0
Sound.play_decision
$scene = Scene_Teleport.new
when 1
Sound.play_save
for actor in $game_party.members
actor.recover_all
end
$scene = Scene_File.new(true, false, true)
when 2
Sound.play_decision
$scene = Scene_ItemsGoldParty.new
when 3
Sound.play_decision
$scene = Scene_Iconview.new
when 4
Sound.play_decision
$scene = Scene_Search.new
end
end
end
def update_menu_background
super
@menuback_sprite.tone.set(0, 0, 0, 0)
end
def create_command_window
s1 = " 传送"
s2 = " 存档"
s3 = " 背包"
s4 = " 图标"
s5 = " 查找"
@command_window = Window_Command.new(120, [s1, s2, s3, s4, s5])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = (416 - @command_window.height) / 2
end
def dispose_command_window
@command_window.dispose
end
def open_command_window
@command_window.open
begin
@command_window.update
Graphics.update
end until @command_window.openness == 255
end
def close_command_window
@command_window.close
begin
@command_window.update
Graphics.update
end until @command_window.openness == 0
end
def dispose_command_window
@command_window.dispose
end
end
复制代码
最后……
感谢大家的支持,明天我要离开几天了
嘛,我就算离开了也不会对6R有什么影响
作者:
duzhi5368
时间:
2012-6-17 02:50
很给力啊~~~{:2_270:}
作者:
荷包PIG蛋
时间:
2012-6-17 08:30
额。。。刷下存在感。。。还走几天,你的守护骑士能赶上这次短篇么?
作者:
时光机
时间:
2012-6-17 09:39
1500+行,我给跪了,这可怕的debug
作者:
赛露休斯
时间:
2013-11-17 15:41
代码好长,功能看起来并不多嘛,查看图标的ID是指道具装备那些图标?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1