Код:
=begin
###############################################################################
# #
# Аддон к Extended Settings #
# #
###############################################################################
Автор: Денис Кузнецов (http://vk.com/id8137201)
=end
$Extended_Settings_Command_List.push({ :command_name => "Параметры игры", :command_symbol => :den_kyz_game_test_command_symbol,
:method => :den_kyz_game_test_settings_method, :enabled => true, :author => "Денис Кузнецов", :version => "1.2", :date => "02.02.15",
:description => "Игровые настройки для VX ACE\nВы можете настроить следующие\nпараметры:\nДеньги, Жизни, Уровень, Магия,\nТелепорт, Статы, Вещи, Оружие,\nБроня, Навыки, Классы, Партия" })
module Game_Test_Settings_Module
ANIMATION_SPEED = 10 # Скорость анимации (больше 0)
USE_REGULAR_ITEM_FILTR = true # Использовать фильтр для вещей
# Например, если вы составляете базу данных с использованием заглавий
# Например: 001:---Зелья--- 002: Зелье жизни 003: Зелье маны и т.д.
# Ниже не трогать :)
COMMAND_LIST = [ "Деньги",
"Жизни",
"Уровень",
"Магия",
"Телепорт",
"Статы",
"Вещи",
"Оружие",
"Броня",
"Навыки",
"Классы",
"Партия" ]
end # module Game_Test_Module
class Extended_Settings_Scene < Scene_Base
def den_kyz_game_test_settings_method
SceneManager.call(Game_Test_Settings_Scene)
end
end # class Extended_Settings_Scene < Scene_Base
class Game_Test_Settings_Scene < Scene_Base
include Game_Test_Settings_Module
def start
super
@animation = false
@animation_type = 0
@window_activate = 0
create_command_window
create_info_window
create_control_window
end
def create_command_window
@create_command_window = Game_Test_Settings_Command_Window.new(0, 0)
COMMAND_LIST.each do |index|
@create_command_window.set_handler(index.to_sym, method(:press_ok_command_window))
end
end
def create_info_window
@create_info_window = Game_Test_Settings_Info_Window.new(Graphics.width / 3, 0, Graphics.width * 2 / 3, Graphics.height)
end
def create_control_window
@create_control_window = Game_Test_Settings_Control_Window.new(Graphics.width / 3, 0)
@create_control_window.opacity = 0
@create_control_window.contents_opacity = 0
@create_control_window.deactivate
@create_control_window.set_handler(:increase, method(:next_layer))
@create_control_window.set_handler(:decrease, method(:next_layer))
@create_control_window.set_handler(:setup, method(:next_layer))
@create_control_window.set_handler(:all, method(:next_layer))
$game_party.members.each do |index|
@create_control_window.set_handler(index.name.to_sym, method(:next_layer))
end
$data_mapinfos.each do |index|
@create_control_window.set_handler(index[1].name.to_sym, method(:next_layer))
end
$data_system.terms.params.each do |index|
@create_control_window.set_handler(index.to_sym, method(:next_layer))
end
$data_items.each do |index|
next if next_add_command?(index)
@create_control_window.set_handler(index.name.to_sym, method(:next_layer)) if index.name != ""
end
$data_weapons.each do |index|
next if next_add_command?(index)
@create_control_window.set_handler(index.name.to_sym, method(:next_layer)) if index.name != ""
end
$data_armors.each do |index|
next if next_add_command?(index)
@create_control_window.set_handler(index.name.to_sym, method(:next_layer)) if index.name != ""
end
@create_control_window.set_handler(:money, method(:change_money))
@create_control_window.set_handler(:hp, method(:change_hp))
@create_control_window.set_handler(:lvl, method(:change_lvl))
@create_control_window.set_handler(:mp, method(:change_mp))
@create_control_window.set_handler(:teleport, method(:teleport))
@create_control_window.set_handler(:stats, method(:change_stats))
@create_control_window.set_handler(:items, method(:change_items_weapons_armors))
@create_control_window.set_handler(:weapons, method(:change_items_weapons_armors))
@create_control_window.set_handler(:armors, method(:change_items_weapons_armors))
$data_skills.each do |index|
next if next_add_command?(index)
@create_control_window.set_handler(index.name.to_sym, method(:change_skills)) if index.name != ""
end
$data_classes.each do |index|
next if next_add_command?(index)
@create_control_window.set_handler(index.name.to_sym, method(:change_class)) if index.name != ""
end
$data_actors.each do |index|
next if next_add_command?(index)
@create_control_window.set_handler((index.name + "change_party").to_sym, method(:change_party)) if index.name != ""
end
end
def next_add_command?(index)
return true if index == nil
return true if index.name == ""
return true if index.name =~ /(?:[\Q \- !@#\$%^&*)_= \[ \] (}{ \/ \\ .|?+>< \E]+)(?:[\wа-яА-Я]*)(?:[\Q \- !@#\$%^&*)_= \[ \] (}{ \/ \\ .|?+<> \E]+)/ && USE_REGULAR_ITEM_FILTR
return false
end
def next_layer # следующий уровень 2 окна
reactivate_control_window(@create_control_window.layer + 1)
end
def change_money # Увеличиваем/уменьшаем деньги
case @create_control_window.cursor_layer_0
when 0
$game_party.gain_gold(@create_control_window.money)
when 1
$game_party.lose_gold(@create_control_window.money)
when 2
$game_party.lose_gold($game_party.gold)
$game_party.gain_gold(@create_control_window.money)
end
post_complete_process
end
def change_hp
case @create_control_window.cursor_layer_0
when 0 # увеличить
if @create_control_window.cursor_layer_1 == 0 # если для всей партии
$game_party.members.each do |index|
index.change_hp(@create_control_window.hp, false)
end
else
$game_party.members[@create_control_window.cursor_layer_1 - 1].change_hp(@create_control_window.hp, false)
end
when 1 # уменьшить
if @create_control_window.cursor_layer_1 == 0 # если для всей партии
$game_party.members.each do |index|
index.change_hp(-@create_control_window.hp, false)
end
else
$game_party.members[@create_control_window.cursor_layer_1 - 1].change_hp(-@create_control_window.hp, false)
end
when 2 # установить
if @create_control_window.cursor_layer_1 == 0 # если для всей партии
$game_party.members.each do |index|
index.change_hp(-$game_party.members[@create_control_window.cursor_layer_1 - 1].hp, false)
index.change_hp(@create_control_window.hp, false)
end
else
$game_party.members[@create_control_window.cursor_layer_1 - 1].change_hp(-$game_party.members[@create_control_window.cursor_layer_1 - 1].hp, false)
$game_party.members[@create_control_window.cursor_layer_1 - 1].change_hp(@create_control_window.hp, false)
end
end
post_complete_process
end
def change_lvl
case @create_control_window.cursor_layer_0
when 0 # увеличить
if @create_control_window.cursor_layer_1 == 0 # если для всей партии
$game_party.members.each do |index|
for i in 0..@create_control_window.lvl - 1
index.level_up
end
end
else # для кого-то из партии
for i in 0..@create_control_window.lvl - 1
$game_party.members[@create_control_window.cursor_layer_1 - 1].level_up
end
end
when 1 # уменьшить
if @create_control_window.cursor_layer_1 == 0 # если для всей партии
$game_party.members.each do |index|
for i in 0..@create_control_window.lvl - 1
index.level_down
end
end
else # для кого-то из партии
for i in 0..@create_control_window.lvl - 1
$game_party.members[@create_control_window.cursor_layer_1 - 1].level_down
end
end
when 2 # установить
if @create_control_window.cursor_layer_1 == 0 # для всей партии
$game_party.members.each do |index|
for i in 0..@create_control_window.lvl - 1
index.change_level(@create_control_window.lvl, false)
end
end
else # для кого-то из партии
$game_party.members[@create_control_window.cursor_layer_1 - 1].change_level(@create_control_window.lvl, false)
end
end
post_complete_process
end
def change_mp
case @create_control_window.cursor_layer_0
when 0 # увеличить
if @create_control_window.cursor_layer_1 == 0 # если для всей партии
$game_party.members.each do |index|
index.mp += @create_control_window.mp
end
else
$game_party.members[@create_control_window.cursor_layer_1 - 1].mp += @create_control_window.mp
end
when 1 # уменьшить
if @create_control_window.cursor_layer_1 == 0 # если для всей партии
$game_party.members.each do |index|
index.mp -= @create_control_window.mp
end
else
$game_party.members[@create_control_window.cursor_layer_1 - 1].mp -= @create_control_window.mp
end
when 2 # установить
if @create_control_window.cursor_layer_1 == 0 # если для всей партии
$game_party.members.each do |index|
index.mp = @create_control_window.mp
end
else
$game_party.members[@create_control_window.cursor_layer_1 - 1].mp = @create_control_window.mp
end
end
post_complete_process
end
def teleport
i = 0
$data_mapinfos.map.each do |index|
if i == @create_control_window.cursor_layer_0
$game_map.setup(index[0])
$game_player.moveto(@create_control_window.teleport_x, @create_control_window.teleport_y)
$game_player.refresh
end
i += 1
end
post_complete_process
end
def change_stats
case @create_control_window.cursor_layer_0
when 0 # увеличить
if @create_control_window.cursor_layer_1 == 0 # если всей партии
if @create_control_window.cursor_layer_2 == 0 # если все статы
i = 0
$data_system.terms.params.each do |index|
$game_party.members.each do |actor|
actor.add_param(i, @create_control_window.stats)
end
i += 1
end
else # если один стат всей партии
$game_party.members.each do |actor|
actor.add_param(@create_control_window.cursor_layer_2 - 1, @create_control_window.stats)
end
end
else # если один стат одному
$game_party.members[@create_control_window.cursor_layer_1 - 1].add_param(@create_control_window.cursor_layer_2 - 1, @create_control_window.stats)
end
when 1
if @create_control_window.cursor_layer_1 == 0 # если всей партии
if @create_control_window.cursor_layer_2 == 0 # если все статы
i = 0
$data_system.terms.params.each do |index|
$game_party.members.each do |actor|
actor.add_param(i, -@create_control_window.stats)
end
i += 1
end
else # если один стат всей партии
$game_party.members.each do |actor|
actor.add_param(@create_control_window.cursor_layer_2 - 1, -@create_control_window.stats)
end
end
else # если один стат одному
$game_party.members[@create_control_window.cursor_layer_1 - 1].add_param(@create_control_window.cursor_layer_2 - 1, -@create_control_window.stats)
end
when 2
if @create_control_window.cursor_layer_1 == 0 # если всей партии
if @create_control_window.cursor_layer_2 == 0 # если все статы
i = 0
$data_system.terms.params.each do |index|
$game_party.members.each do |actor|
actor.add_param(i, -actor.param(i))
actor.add_param(i, @create_control_window.stats)
actor.hp += @create_control_window.stats if i == 1
actor.mp += @create_control_window.stats if i == 2
end
i += 1
end
else # если один стат всей партии
$game_party.members.each do |actor|
actor.add_param(@create_control_window.cursor_layer_2 - 1, -actor.param(@create_control_window.cursor_layer_2 - 1))
actor.add_param(@create_control_window.cursor_layer_2 - 1, @create_control_window.stats)
actor.hp += @create_control_window.stats if @create_control_window.cursor_layer_2 == 1
actor.mp += @create_control_window.stats if @create_control_window.cursor_layer_2 == 2
end
end
else # если один стат одному
#выбрал нужного персонажа, добавляю ему выбранный параметр, отнимая, что уже есть
$game_party.members[@create_control_window.cursor_layer_1 - 1].add_param(@create_control_window.cursor_layer_2 - 1, -$game_party.members[@create_control_window.cursor_layer_1 - 1].param(@create_control_window.cursor_layer_2 - 1))
#выбрал персонажа, добавляю ему выбранный параметр
$game_party.members[@create_control_window.cursor_layer_1 - 1].add_param(@create_control_window.cursor_layer_2 - 1, @create_control_window.stats)
#восстанавливаем hp и mp
$game_party.members[@create_control_window.cursor_layer_1 - 1].hp += @create_control_window.stats if @create_control_window.cursor_layer_2 == 1
$game_party.members[@create_control_window.cursor_layer_1 - 1].hp += @create_control_window.stats if @create_control_window.cursor_layer_2 == 2
end
end
post_complete_process
end
def change_items_weapons_armors
case @create_command_window.current_index
when 6
array = $data_items
num = @create_control_window.items
when 7
array = $data_weapons
num = @create_control_window.weapons
when 8
array = $data_armors
num = @create_control_window.armors
end
array_index = @create_control_window.visible_items
layer_cursor = @create_control_window.cursor_layer_1
znak = 1 # прибавить вещь
znak *= -1 if @create_control_window.cursor_layer_0 == 1 # отнять вещь
$game_party.gain_item(array[array_index[layer_cursor]], num * znak)
post_complete_process
end
def change_skills
visible_items = @create_control_window.visible_items
cursor = @create_control_window.cursor_layer_2
if @create_control_window.cursor_layer_1 == 0
$game_party.members.each do |index|
if @create_control_window.cursor_layer_0 == 0
index.learn_skill(visible_items[cursor])
else
index.forget_skill(visible_items[cursor])
end
end
else
actor = $game_party.members[@create_control_window.cursor_layer_1 - 1]
if @create_control_window.cursor_layer_0 == 0
actor.learn_skill(visible_items[cursor])
else
actor.forget_skill(visible_items[cursor])
end
end
post_complete_process
end
def change_class
visible_items = @create_control_window.visible_items
cursor = @create_control_window.cursor_layer_2
if @create_control_window.cursor_layer_0 == 0
$game_party.members.each do |actor|
level = actor.level - 1 if @create_control_window.cursor_layer_1 # -1 потому что ниже times начинает с 0
actor.change_class(visible_items[cursor])
level.times do actor.level_up end if @create_control_window.cursor_layer_1 == 0
end
else
actor = $game_party.members[@create_control_window.cursor_layer_0 - 1]
level = actor.level - 1 if @create_control_window.cursor_layer_1 # -1 потому что ниже times начинает с 0
actor.change_class(visible_items[cursor])
level.times do actor.level_up end if @create_control_window.cursor_layer_1 == 0
end
post_complete_process
end
def change_party
visible_items = @create_control_window.visible_items
cursor = @create_control_window.cursor_layer_1
if @create_control_window.cursor_layer_0 == 0
$game_party.add_actor(visible_items[cursor])
else
$game_party.remove_actor(visible_items[cursor])
end
post_complete_process
end
def post_complete_process # после добавления чего-либо вернуть 1 окно
@window_activate = 0
@animation = true
activate_window
update
end
def reactivate_control_window(layer) # Переактивируем окно и устанавливаем уровень
@create_control_window.layer = layer
@create_control_window.refresh
@create_control_window.select(0)
@create_control_window.activate
end
def press_ok_command_window
@animation = true
@animation_type = rand(4)
pre_animation_setting
@window_activate = 1
update_window_cursors
reactivate_control_window(0)
activate_window
update
end
def pre_animation_setting
@create_info_window.x = Graphics.width / 3
@create_info_window.y = 0
@create_control_window.opacity = 0
@create_control_window.contents_opacity = 0
@create_control_window.x = Graphics.width / 3
@create_control_window.y = 0
@create_control_window.x = Graphics.width if @animation_type == 2
end
def activate_window
case @window_activate
when 0
@create_command_window.activate
@create_control_window.deactivate
when 1
@create_command_window.deactivate
@create_control_window.activate
end
end
def update
update_window_cursors
super
if !@animation && Input.trigger?(:B) # обработка нажатия кнопки Esc
case @window_activate
when 0
Sound.play_cancel
return_scene
when 1
if @create_control_window.layer == 0
Sound.play_cancel
@window_activate = 0
activate_window
@animation = true
else
Sound.play_cancel
reactivate_control_window(@create_control_window.layer - 1)
end
end
end
animation_type if @animation
end
def update_window_cursors
if @window_activate == 0
@create_info_window.command = @create_command_window.current_index
else
@create_control_window.command = @create_command_window.current_index
end
end
def animation_type
case @animation_type
when 0 # первая анимация
case @window_activate # вернуть первое окно
when 0
@create_info_window.x -= ANIMATION_SPEED
@create_info_window.opacity += ANIMATION_SPEED
@create_info_window.contents_opacity += ANIMATION_SPEED
@create_control_window.opacity -= ANIMATION_SPEED
@create_control_window.contents_opacity -= ANIMATION_SPEED
if @create_control_window.opacity == 0
@animation = false
end
when 1 # показать второе окно
@create_info_window.x += ANIMATION_SPEED
@create_info_window.opacity -= ANIMATION_SPEED
@create_info_window.contents_opacity -= ANIMATION_SPEED
@create_control_window.opacity += ANIMATION_SPEED
@create_control_window.contents_opacity += ANIMATION_SPEED
if @create_control_window.opacity == 255
@animation = false
end
end
when 1
case @window_activate
when 0
@create_info_window.y -= ANIMATION_SPEED
@create_info_window.opacity += ANIMATION_SPEED
@create_info_window.contents_opacity += ANIMATION_SPEED
@create_control_window.opacity -= ANIMATION_SPEED
@create_control_window.contents_opacity -= ANIMATION_SPEED
if @create_control_window.opacity == 0
@animation = false
end
when 1
@create_info_window.y += ANIMATION_SPEED
@create_info_window.opacity -= ANIMATION_SPEED
@create_info_window.contents_opacity -= ANIMATION_SPEED
@create_control_window.opacity += ANIMATION_SPEED
@create_control_window.contents_opacity += ANIMATION_SPEED
if @create_control_window.opacity == 255
@animation = false
end
end
when 2 # вторая анимация
case @window_activate
when 0
@create_info_window.x += ANIMATION_SPEED
@create_info_window.opacity += ANIMATION_SPEED
@create_info_window.contents_opacity += ANIMATION_SPEED
@create_control_window.x += ANIMATION_SPEED
@create_control_window.opacity -= ANIMATION_SPEED
@create_control_window.contents_opacity -= ANIMATION_SPEED
if @create_info_window.x >= Graphics.width / 3
@create_info_window.x = Graphics.width / 3
@animation = false
end
when 1
@create_info_window.x -= ANIMATION_SPEED
@create_info_window.opacity -= ANIMATION_SPEED
@create_info_window.contents_opacity -= ANIMATION_SPEED
@create_control_window.x -= ANIMATION_SPEED
@create_control_window.opacity += ANIMATION_SPEED
@create_control_window.contents_opacity += ANIMATION_SPEED
if @create_control_window.x <= Graphics.width / 3
@create_control_window.x = Graphics.width / 3
@animation = false
end
end
when 3 # третья анимация
case @window_activate # вернуть первое окно
when 0
@create_info_window.opacity += ANIMATION_SPEED / 2
@create_info_window.contents_opacity += ANIMATION_SPEED / 2
@create_control_window.opacity -= ANIMATION_SPEED / 2
@create_control_window.contents_opacity -= ANIMATION_SPEED / 2
if @create_control_window.opacity == 0
@animation = false
end
when 1 # установить второе окно
@create_info_window.opacity -= ANIMATION_SPEED / 2
@create_info_window.contents_opacity -= ANIMATION_SPEED / 2
@create_control_window.opacity += ANIMATION_SPEED / 2
@create_control_window.contents_opacity += ANIMATION_SPEED / 2
if @create_control_window.opacity == 255
@animation = false
end
end
end
end
end # class Game_Test_Settings_Scene < Scene_Base
class Game_Test_Settings_Command_Window < Window_Command
include Game_Test_Settings_Module
def initialize(x, y)
super(x, y)
end
def window_width
Graphics.width / 3
end
def window_height
Graphics.height
end
def make_command_list
COMMAND_LIST.each do |index|
add_command(index, index.to_sym)
end
end
def current_index
for i in 0..@list.size-1
return i if @list[i][:symbol] == current_symbol
end
end
end # class Game_Test_Settings_Command_Window < Window_Command
class Game_Test_Settings_Info_Window < Window_Base
attr_accessor :command
def initialize(x, y, w, h)
@command = 0 # какая команда выбрана на окне команд
super(x, y, w, h)
end
def update
super
contents.clear
draw_text(0, 30, 450, 32, "Возможности:")
case @command
when 0
draw_text(0, 0, 450, 32, "Управление деньгами")
draw_text(0, 60, 450, 32, "1) Увеличить деньги")
draw_text(0, 90, 450, 32, "2) Уменьшить деньги")
draw_text(0, 120, 450, 32, "3) Установить определенный уровень")
when 1
draw_text(0, 0, 450, 32, "Управление здоровьем")
draw_text(0, 60, 450, 32, "1) Восстановить жизни")
draw_text(0, 90, 450, 32, "2) Отнять жизни")
draw_text(0, 120, 450, 32, "3) Установить определенный уровень")
when 2
draw_text(0, 0, 450, 32, "Управление уровнями")
draw_text(0, 60, 450, 32, "1) Прибавить уровень")
draw_text(0, 90, 450, 32, "2) Отнять уровень")
draw_text(0, 120, 450, 32, "3) Установить определенный уровень")
when 3
draw_text(0, 0, 450, 32, "Управление магией")
draw_text(0, 60, 450, 32, "1) Восстановить магию")
draw_text(0, 90, 450, 32, "2) Отнять магию")
draw_text(0, 120, 450, 32, "3) Установить определенный уровень")
when 4
draw_text(0, 0, 450, 32, "Управление телепортом")
draw_text(0, 60, 450, 32, "Телепортироваться на любую карту")
when 5
draw_text(0, 0, 450, 32, "Управление статами")
draw_text(0, 60, 450, 32, "1) Увеличить стат")
draw_text(0, 90, 450, 32, "2) Уменьшить стат")
draw_text(0, 120, 450, 32, "3) Установить определенный уровень")
when 6
draw_text(0, 0, 450, 32, "Управление вещами")
draw_text(0, 60, 450, 32, "1) Добавить вещь")
draw_text(0, 90, 450, 32, "2) Отнять вещь")
when 7
draw_text(0, 0, 450, 32, "Управление оружием")
draw_text(0, 60, 450, 32, "1) Добавить оружие")
draw_text(0, 90, 450, 32, "2) Отнять оружие")
when 8
draw_text(0, 0, 450, 32, "Управление броней")
draw_text(0, 60, 450, 32, "1) Добавить броню")
draw_text(0, 90, 450, 32, "2) Отнять броню")
when 9
draw_text(0, 0, 450, 32, "Управление навыками")
draw_text(0, 60, 450, 32, "1) Добавить навык")
draw_text(0, 90, 450, 32, "2) Отнять навык")
when 10
draw_text(0, 0, 450, 32, "Управление классами")
draw_text(0, 60, 450, 32, "Изменить класс персонажа")
when 11
draw_text(0, 0, 450, 32, "Управление партией")
draw_text(0, 60, 450, 32, "1) Добавить персонажа")
draw_text(0, 90, 450, 32, "2) Удалить персонажа")
end
end
end # class Game_Test_Settings_Info_Window < Window_Base
class Game_Test_Settings_Control_Window < Window_Command
include Game_Test_Settings_Module
attr_accessor :layer
attr_accessor :money
attr_accessor :hp
attr_accessor :lvl
attr_accessor :mp
attr_accessor :teleport_x
attr_accessor :teleport_y
attr_accessor :stats
attr_accessor :items
attr_accessor :weapons
attr_accessor :armors
attr_accessor :visible_items
attr_accessor :cursor_layer_0
attr_accessor :cursor_layer_1
attr_accessor :cursor_layer_2
attr_accessor :command
def initialize(x, y)
@layer = 0 # уровень отображения кнопок
@money = 1 # деньги
@hp = 1 # жизни
@lvl = 1 # уровень
@mp = 1 # магия
@teleport_x = 0 # x для телепорта
@teleport_y = 0 # y для телепорта
@stats = 1 # статы
@items = 1 # вещи
@weapons = 1 # оружие
@armors = 1 # броня
@visible_items = [] # реальные индексы вещей в базе данных
@actor_data = [] # индексы, что есть у определенного персонажа (навыки)
@cursor_layer_0 = 0 # какая кнопка была нажата на layer == 0
@cursor_layer_1 = 0 # какая кнопка была нажата на layer == 1
@cursor_layer_2 = 0 # какая кнопка была нажата на layer == 2
@command = 0 # какая команда была выбрана из COMMAND_LIST
super(x, y)
end
def current_index
for i in 0..@list.size-1
return i if @list[i][:symbol] == current_symbol
end
end
def window_width
Graphics.width * 2 /3
end
def window_height
Graphics.height
end
def make_command_list
if @layer == 0 && @command != 4 && @command != 10
add_command("Увеличить", :increase)
add_command("Уменьшить", :decrease)
add_command("Установить", :setup) if @command < 6
end
if @layer == 1 && (@command != 0 && @command != 4 && @command < 6 || @command == 9) || (@layer == 0 && @command == 10) # 4 - телепорт, 5 - статы
add_command("Всей партии", :all)
$game_party.members.each do |index|
add_command(index.name, index.name.to_sym)
end
end
case @command
when 0
add_command(@money.to_s, :money) if @layer == 1
when 1
add_command(@hp.to_s, :hp) if @layer == 2
when 2
add_command(@lvl.to_s, :lvl) if @layer == 2
when 3
add_command(@mp.to_s, :mp) if @layer == 2
when 4
if @layer == 0
$data_mapinfos.each do |index|
add_command(index[1].name, index[1].name.to_sym)
end
end
if @layer == 1
add_command("x = " + @teleport_x.to_s, :teleport_x)
add_command("y = " + @teleport_y.to_s, :teleport_y)
add_command("Телепортироваться", :teleport)
end
when 5
if @layer == 2
add_command("Все статы", :all) # all ?
$data_system.terms.params.each do |index|
add_command(index.to_s, index.to_sym)
end
end
add_command(@stats.to_s, :stats) if @layer == 3
when 6..8
case @command
when 6
array = $data_items if @cursor_layer_0 == 0
array = $game_party.items if @cursor_layer_0 == 1
add_command(@items.to_s, :items) if @layer == 2
when 7
array = $data_weapons if @cursor_layer_0 == 0
array = $game_party.weapons if @cursor_layer_0 == 1
add_command(@weapons.to_s, :weapons) if @layer == 2
when 8
array = $data_armors if @cursor_layer_0 == 0
array = $game_party.armors if @cursor_layer_0 == 1
add_command(@armors.to_s, :armors) if @layer == 2
end
if @layer == 1
array.each do |index|
next if next_add_command?(index)
@visible_items.push(index.id)
add_command(index.name, index.name.to_sym)
end
add_command("Ничего нет", :nothing) if array.size == 0
end
when 9 # навыки
if @layer == 2
if @cursor_layer_0 == 0 # выбрали увеличить
if @cursor_layer_1 == 0 # выбрали для всех
$data_skills.each do |index|
next if next_add_command?(index)
next if index.id < 3 # не включать навыки атаки и защиты
name = $data_system.skill_types[index.stype_id]
@visible_items.push(index.id)
add_command(index.name + " (" + name + ")" , index.name.to_sym)
end
else # увеличить для кого-то одного
actor = $game_party.members[@cursor_layer_1 - 1]
$data_skills.each do |index|
next if next_add_command?(index)
next if index.id < 3 # не включать навыки атаки и защиты
find_actor_data(actor.skills) # находим индексы всех навыков персонажа
next if @actor_data.include?(index.id) # зачем добавлять, если у персонажа уже есть
name = $data_system.skill_types[index.stype_id]
@visible_items.push(index.id)
add_command(index.name + " (" + name + ")" , index.name.to_sym)
end
end
else # если уменьшить
if @cursor_layer_1 == 0 #уменьшить у всех
$game_party.members.each do |actor|
actor.skills.each do |index|
next if next_add_command?(index)
next if @visible_items.include?(index.id)
name = $data_system.skill_types[index.stype_id]
@visible_items.push(index.id)
add_command(index.name + " (" + name + ")" , index.name.to_sym)
end
end
else # уменьшить у одного
actor = $game_party.members[@cursor_layer_1 - 1]
actor.skills.each do |index|
next if next_add_command?(index)
name = $data_system.skill_types[index.stype_id]
@visible_items.push(index.id)
add_command(index.name + " (" + name + ")" , index.name.to_sym)
end
end
end
end
when 10 # классы
if @layer == 1
# increase и decrease потому что они тоже отвечают за переход на следующий layer
# так зачем использовать лишние символы
add_command("Да", :increase)
add_command("Нет", :decrease)
end
if @layer == 2
$data_classes.each do |index|
next if next_add_command?(index)
if @cursor_layer_0 != 0
next if $game_party.members[@cursor_layer_0 - 1].class_id == index.id
end
@visible_items.push(index.id)
add_command(index.name, index.name.to_sym)
end
end
when 11 # партия
if @layer == 1
if @cursor_layer_0 == 0 # увеличить партию
$data_actors.each do |index|
next if next_add_command?(index)
find_actor_data($game_party.members) # находим индексы персонажей в партии
next if @actor_data.include? (index.id) # зачем добавлять, если они уже в партии
#~ next if index.name =~ /(?:[\Q \- !@#\$%^&*)_= \[ \] (}{ \/ \\ .|?+>< \E]+)(?:[\wа-яА-Я]*)(?:[\Q \- !@#\$%^&*)_= \[ \] (}{ \/ \\ .|?+<> \E]+)/ && USE_REGULAR_ITEM_FILTR
@visible_items.push(index.id)
add_command(index.name, (index.name + "change_party").to_sym)
end
else # уменьшить партию
if $game_party.members.size == 1
add_command("Нельзя удалить последнего персонажа", :nothing)
else
$game_party.members.each do |index|
next if next_add_command?(index)
@visible_items.push(index.id)
add_command(index.name, (index.name + "change_party").to_sym)
end
end
end
end
end
end
def find_actor_data(actor) # находим индексы чего-либо (actor)
@actor_data = []
actor.each do |index|
next if next_add_command?(index)
@actor_data.push(index.id)
end
end
def next_add_command?(index)
return true if index == nil
return true if index.name == ""
return true if index.name =~ /(?:[\Q \- !@#\$%^&*)_= \[ \] (}{ \/ \\ .|?+>< \E]+)(?:[\wа-яА-Я]*)(?:[\Q \- !@#\$%^&*)_= \[ \] (}{ \/ \\ .|?+<> \E]+)/ && USE_REGULAR_ITEM_FILTR
return false
end
def refresh
@visible_items = [] if @layer < 2
super
draw_text(0, 0, 350, 32, "Выберите из списка", 1) if @layer == 0
case @command
when 0 # если выбраны деньги
draw_text(0, 0, 350, 32, "Введите сумму", 1) if @layer == 1
draw_text(0, 30, 350, 32, "У партии: " + $game_party.gold.to_s + " " + Vocab::currency_unit, 1)
when 1 # жизни
draw_text(0, 0, 350, 32, "Кому изменить жизни ?", 1) if @layer == 1
draw_text(0, 0, 350, 32, "Введите жизни", 1) if @layer == 2
draw_text(0, 30, 350, 32, "У " + $game_party.members[@cursor_layer_1 - 1].name + " " + $game_party.members[@cursor_layer_1 - 1].hp.to_s + " жизней", 1) if @layer == 2 && @cursor_layer_1 > 0
when 2 # уровни
draw_text(0, 0, 350, 32, "Кому изменить уровень ?", 1) if @layer == 1
draw_text(0, 0, 350, 32, "Введите уровень", 1) if @layer == 2
draw_text(0, 30, 350, 32, "У " + $game_party.members[@cursor_layer_1 - 1].name + " " + $game_party.members[@cursor_layer_1 - 1].level.to_s + " уровень", 1) if @layer == 2 && @cursor_layer_1 > 0
when 3 # магия
draw_text(0, 0, 350, 32, "Кому изменить магию ?", 1) if @layer == 1
draw_text(0, 0, 350, 32, "Введите магию", 1) if @layer == 2
draw_text(0, 30, 350, 32, "У " + $game_party.members[@cursor_layer_1 - 1].name + " " + $game_party.members[@cursor_layer_1 - 1].mp.to_s + " магии", 1) if @layer == 2 && @cursor_layer_1 > 0
when 4
draw_text(0, 0, 350, 32, "Введите координаты", 1) if @layer == 1
when 5
draw_text(0, 0, 350, 32, "Кому изменить стат ?", 1) if @layer == 1
draw_text(0, 0, 350, 32, "Выберите из списка", 1) if @layer == 2
draw_text(0, 0, 350, 32, "Введите стат", 1) if @layer == 3
# у этого такой стат на столько
if @layer == 3 && @cursor_layer_1 > 0 && @cursor_layer_2 > 0
actor = $game_party.members[@cursor_layer_1 - 1]
draw_text(0, 30, 350, 32, "У " + actor.name + " " + actor.param(@cursor_layer_2 - 1).to_s + " " + $data_system.terms.params[@cursor_layer_2 - 1], 1)
end
when 6..8
draw_text(0, 0, 350, 32, "Выберите из списка", 1) if @layer == 1
draw_text(0, 0, 350, 32, "Введите количество", 1) if @layer == 2
if @layer == 2 && @cursor_layer_0 == 1
case @command
when 6
array = $data_items
when 7
array = $data_weapons
when 8
array = $data_armors
end
item = array[@visible_items[@cursor_layer_1]]
text = $game_party.item_number(item)
draw_text(0, 30, 350, 32, "У партии " + text.to_s + " " + item.name, 1) if @layer == 2 && @cursor_layer_0 == 1
end
when 9..11
draw_text(0, 0, 350, 32, "Выберите из списка", 1) if @layer < 3 && !(@layer == 1 && @command == 10)
draw_text(0, 0, 350, 32, "Сохранить текущий уровень ?", 1) if @layer == 1 && @command == 10
end
end
def item_rect(index) # 72 + (добавил)
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * (item_width + spacing)
rect.y = 72 + index / col_max * item_height
rect
end
def page_row_max # - 72 (добавил)
(height - padding - padding_bottom - 72) / item_height
end
def row_max # + 72 / item_height (добавил)
[(item_max + col_max - 1 + 72 / item_height) / col_max, 1].max
end
def current_index # не правильно работает, если одинаковые символы
for i in 0..@list.size-1
return i if @list[i][:symbol] == current_symbol
end
end
def call_ok_handler
@cursor_layer_0 = current_index if @layer == 0
@cursor_layer_1 = current_index if @layer == 1
@cursor_layer_2 = current_index if @layer == 2
super
end
def cursor_pagedown
return super if @layer == 0
case @command
when 0
@money += 10000
@money = $game_party.gold if @money > $game_party.gold && @cursor == 1
when 1
return super if @layer < 2
@hp += 1000
when 2
return super if @layer < 2
@lvl += 50
when 3
return super if @layer < 2
@mp += 1000
when 4
if current_index == 0
@teleport_x += 5
else
@teleport_y += 5
end
when 5
@stats += 50
when 6
@items += 50
when 7
@weapons += 50
when 8
@armors += 50
end
refresh
end
def cursor_pageup
return super if @layer == 0
case @command
when 0
@money -= 10000
@money = 0 if @money < 0
when 1
return super if @layer < 2
@hp -= 1000
@hp = 0 if @hp < 0
when 2
return super if @layer < 2
@lvl -= 50
@lvl = 0 if @lvl < 0
@lvl = 1 if @lvl < 1 && @cursor_layer_0 == 2
when 3
return super if @layer < 2
@mp -= 1000
@mp = 0 if @mp < 0
when 4
if current_index == 0
@teleport_x -= 5
@teleport_x = 0 if @teleport_x < 0
else
@teleport_y -= 5
@teleport_y = 0 if @teleport_y < 0
end
when 5
@stats -= 50
@stats = 1 if @stats < 1
when 6
@items -= 50
@items = 0 if @items < 0
when 7
@weapons -= 50
@weapons = 0 if @weapons < 0
when 8
@armors -= 50
@armors = 0 if @armors < 0
end
refresh
end
def cursor_up(wrap = false)
return super if @layer < 2 # == 0
case @command
when 0
@money += 100
@money = $game_party.gold if @money > $game_party.gold && @cursor == 1
when 1
#~ return super if @layer < 2
@hp += 20
when 2
#~ return super if @layer < 2
@lvl += 10
when 3
#~ return super if @layer < 2
@mp += 20
when 5
return super if @layer < 3
@stats += 10
when 6
#~ return super if @layer < 2
@items += 10
when 7
#~ return super if @layer < 2
@weapons += 10
when 8
#~ return super if @layer < 2
@armors += 10
else
return super
end
refresh
end
def cursor_down(wrap = false)
return super if @layer < 2 # == 0
case @command
when 0
@money -= 100
@money = 0 if @money < 0
when 1
#~ return super if @layer < 2
@hp -= 20
@hp = 0 if @hp < 0
when 2
#~ return super if @layer < 2
@lvl -= 10
@lvl = 0 if @lvl < 0
@lvl = 1 if @lvl < 1 && @cursor_layer_0 == 2
when 3
#~ return super if @layer < 2
@mp -= 20
@mp = 0 if @mp < 0
when 4
return super
when 5
return super if @layer < 3
@stats -= 10
@stats = 1 if @stats < 1
when 6
#~ return super if @layer < 2
@items -= 10
@items = 0 if @items < 0
when 7
#~ return super if @layer < 2
@weapons -= 10
@weapons = 0 if @weapons < 0
when 8
#~ return super if @layer < 2
@armors -= 10
@armors = 0 if @armors < 0
else
return super
end
refresh
end
def cursor_right(wrap = false)
return super if @layer < 2 # == 0
case @command
when 0
@money += 1
@money = $game_party.gold if @money > $game_party.gold && @cursor == 1
when 1
#~ return super if @layer < 2
@hp += 1
when 2
#~ return super if @layer < 2
@lvl += 1
when 3
#~ return super if @layer < 2
@mp += 1
when 4
if current_index == 0
@teleport_x += 1
else
@teleport_y += 1
end
when 5
#~ return super if @layer < 2
@stats += 1
when 6
#~ return super if @layer < 2
@items += 1
when 7
#~ return super if @layer < 2
@weapons += 1
when 8
#~ return super if @layer < 2
@armors += 1
end
refresh
end
def cursor_left(wrap = false)
return super if @layer < 2 # == 0
case @command
when 0
@money -= 1
@money = 0 if @money < 0
when 1
#~ return super if @layer < 2
@hp -= 1
@hp = 0 if @hp < 0
when 2
#~ return super if @layer < 2
@lvl -= 1
@lvl = 0 if @lvl < 0
@lvl = 1 if @lvl < 1 && @cursor_layer_0 == 2
when 3
#~ return super if @layer < 2
@mp -= 1
@mp = 0 if @mp < 0
when 4
if current_index == 0
@teleport_x -= 1
@teleport_x = 0 if @teleport_x < 0
else
@teleport_y -= 1
@teleport_y = 0 if @teleport_y < 0
end
when 5
#~ return super if @layer < 2
@stats -= 1
@stats = 1 if @stats < 1
when 6
#~ return super if @layer < 2
@items -= 1
@items = 0 if @items < 0
when 7
#~ return super if @layer < 2
@weapons -= 1
@weapons = 0 if @weapons < 0
when 8
#~ return super if @layer < 2
@armors -= 1
@armors = 0 if @armors < 0
end
refresh
end
end # class Game_Test_Settings_Control_Window < Window_Command
Социальные закладки