Код:
#==============================================================================
# EK Items Menu v.1.00b
#------------------------------------------------------------------------------
# Created by: Equilibrium Keeper [equilibriumkeeper@inbox.com]
# Created on: 25.05.2008 22:23:14
#==============================================================================
# Description: Script changes structure of the menu of items, adding
# a filtration by four criteria:
# Usable (Menu or Battle), Battle only, Equipment and Not usable ("Other")
#------------------------------------------------------------------------------
# Requirements: Addon by Equilibrium Keeper v.1.00 or above
# Install: Make a new blank script page above main and copy this script.
#==============================================================================
module Vocab
# Items Screen
ItemsType = ["Usable", "Battle Only", "Equipment", "Other"]
end
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
# type : item type
#--------------------------------------------------------------------------
def initialize(x, y, width, height, type = -1)
super(x, y, width, height)
@type = type
@column_max = 2
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# * Whether or not to include in item list
# item : item
#--------------------------------------------------------------------------
def include?(item)
@item_id = item.id
return false if item == nil
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
case @type
when 0
return false if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
return false unless $data_items[@item_id].menu_ok?
when 1
return false if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
return false if $data_items[@item_id].menu_ok?
return false unless $data_items[@item_id].battle_ok?
when 2
return false unless item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
when 3
return false if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
return false if $data_items[@item_id].menu_ok? || $data_items[@item_id].battle_ok?
end
return true
end
end
class Scene_Item < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@command_window = Window_Command.new(544, Vocab::ItemsType, 4, 0, 32, 1)
@command_window.index = 0
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new (0, 56)
@help_window.viewport = @viewport
@item_window = Window_Item.new(0, 112, 544, 304, 0)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
@command_window.active = true
@item_window.active = false
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@viewport.dispose
@help_window.dispose
@item_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@help_window.update
@item_window.update
@target_window.update
if @command_window.active
update_command
elsif @item_window.active
update_item_selection
elsif @target_window.active
update_target_selection
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
end
if Input.trigger?(Input::C)
Sound.play_decision
@command_window.active = false
@item_window.active = true
end
case @command_window.index
when 0
@item_window.dispose
@item_window = Window_Item.new(0, 112, 544, 304, @command_window.index)
when 1
@item_window.dispose
@item_window = Window_Item.new(0, 112, 544, 304, @command_window.index)
when 2
@item_window.dispose
@item_window = Window_Item.new(0, 112, 544, 304, @command_window.index)
when 3
@item_window.dispose
@item_window = Window_Item.new(0, 112, 544, 304, @command_window.index)
end
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
Sound.play_decision
@command_window.active = false
@item_window.active = true
elsif Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
@item_window.dispose
@item_window = Window_Item.new(0, 112, 544, 304, @command_window.index)
@item_window.active = false
@item_window.help_window = @help_window
@item_window.update_help
end
end
#--------------------------------------------------------------------------
# * Show(Recreate) Target Window
# right : Right justification flag (if false, left justification)
#--------------------------------------------------------------------------
def show_target_window(right)
@item_window.active = false
@target_window.dispose
@target_window = Window_MenuStatus.new(0, 0)
width_remain = 544 - @target_window.width
@target_window.x = right ? width_remain : 0
@target_window.visible = true
@target_window.active = true
if right
@viewport.rect.set(0, 0, width_remain, 416)
@viewport.ox = 0
else
@viewport.rect.set(@target_window.width, 0, width_remain, 416)
@viewport.ox = @target_window.width
end
end
end
Социальные закладки