Project1
标题:
求VX的人物仓库脚本
[打印本页]
作者:
1224198918
时间:
2011-3-20 11:49
标题:
求VX的人物仓库脚本
本帖最后由 铃仙·优昙华院·因幡 于 2011-5-11 20:15 编辑
如题 要与人物跟随脚本兼容
#==============================================================================
# ■ Train_Actor::Config
#------------------------------------------------------------------------------
# マップ上でアクターを隊列移動させる
#==============================================================================
module Train_Actor
# ●透明状態用スイッチ設定
# true だとスイッチ制御を行う
#TRANSPARENT_SWITCH = true
TRANSPARENT_SWITCH = false
# ●透明状態用スイッチ番号
# TRANSPARENT_SWITCH が true で、この番号のスイッチがONだと透明になる
TRANSPARENT_SWITCHES_INDEX = 20
# 死亡時のキャラクターグラフィック名
#DEAD_CHARACTER_NAME = "Coffin"
#DEAD_CHARACTER_INDEX = 0
DEAD_CHARACTER_NAME = ""
DEAD_CHARACTER_INDEX = 0
# 定数
DOWN_LEFT = 1
DOWN_RIGHT = 3
UP_LEFT = 7
UP_RIGHT = 9
JUMP = 5
STOP = 0
end
# Train_Actor::Game_Event_Module
# マップ上でアクターを隊列移動させる
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Game_Event_Module
# 通行可能判定
# x:: X 座標
# y:: Y 座標
# return:: 通行不可 false 可能 true
def passable?(x, y)
result = super(x, y)
return result if @through
if result
# 新しい座標を求める
new_x = x
new_y = y
# トレインアクターのループ
for actor in $game_party.characters
# 表示されている場合
if (not actor.character_name.empty?) and (not actor.transparent)
# アクターの座標が移動先と一致した場合
if actor.x == new_x and actor.y == new_y
# 自分がイベントの場合
if self != $game_player
# 通行不可
return false
end
end
end
end
end
return result
end
end
end
class Game_Event
include Train_Actor::Game_Event_Module
end
# Train_Actor::Game_Party_Module
# Game_Party用隊列歩行モジュール
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Game_Party_Module
attr_reader :characters
def initialize
super
if @characters.nil?
@characters = []
for i in 1 ... Game_Party::MAX_MEMBERS
@characters.push(Game_Party_Actor.new(i - 1))
end
end
end
def empty?
return @actors.empty?
end
def dead_actor_include?
for actor in members
if actor.dead?
return true
end
end
return false
end
def get_active_party_order
if not dead_actor_include?
return members
end
alive_actors = []
dead_actors = []
for actor in members
if actor.dead?
dead_actors.push actor
else
alive_actors.push actor
end
end
return alive_actors + dead_actors
end
def setup_actor_character_sprites
setup_actors = get_active_party_order
for i in 1 ... Game_Party::MAX_MEMBERS
@characters[i - 1].setup(setup_actors[i])
end
end
def transparent_switch
if TRANSPARENT_SWITCH
unless $game_player.transparent
return $game_switches[TRANSPARENT_SWITCHES_INDEX]
end
end
return $game_player.transparent
end
def update_party_actors
setup_actor_character_sprites
transparent = transparent_switch
for character in @characters
character.transparent = transparent
character.update
if $game_player.vehicle_type >= 0 # 乗り物に乗ってる時は同期
character.sync_with_player
end
end
end
def moveto_party_actors( x, y )
setup_actor_character_sprites
for character in @characters
character.moveto( x, y )
end
@move_list = []
move_list_setup
end
def move_party_actors
if @move_list == nil
@move_list = []
move_list_setup
end
@move_list.each_index do |i|
if not @characters[i].nil?
@characters[i].add_move_list_element(@move_list[i])
end
end
end
class Move_List_Element
def initialize(type,args)
@type = type
@args = args
end
def type() return @type end
def args() return @args end
end
def move_list_setup
for i in 0 .. Game_Party::MAX_MEMBERS
@move_list[i] = nil
end
end
def add_move_list(type,*args)
if $game_player.vehicle_type >= 0 # 乗り物に乗ってる時は同期
move_list_setup
return
end
@move_list.unshift(Move_List_Element.new(type,args)).pop
end
def move_down_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::DOWN,turn_enabled)
end
def move_left_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::LEFT,turn_enabled)
end
def move_right_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::RIGHT,turn_enabled)
end
def move_up_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::UP,turn_enabled)
end
def move_lower_left_party_actors
move_party_actors
add_move_list(DOWN_LEFT)
end
def move_lower_right_party_actors
move_party_actors
add_move_list(DOWN_RIGHT)
end
def move_upper_left_party_actors
move_party_actors
add_move_list(UP_LEFT)
end
def move_upper_right_party_actors
move_party_actors
add_move_list(UP_RIGHT)
end
def jump_party_actors(x_plus, y_plus)
move_party_actors
add_move_list(JUMP,x_plus, y_plus)
move_stop_party_actors
end
def move_stop_party_actors
self.members.each do |a|
move_party_actors
add_move_list(STOP)
end
end
end
end
class Game_Party
include Train_Actor::Game_Party_Module
end
# Train_Actor::Game_Player_Module
# Game_Player用隊列歩行モジュール
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Game_Player_Module
attr_reader :move_speed
attr_reader :step_anime
attr_reader :direction_fix
def update_party_actors
if $game_party.empty?
return
end
$game_party.update_party_actors
actors = $game_party.members
actor = actors[0]
if not actor.dead?
if not @prev_dead.nil?
@character_name = actor.character_name
@character_index = actor.character_index
@prev_dead = nil
end
return
end
@prev_dead = true
actors.each do |actor|
if not actor.dead?
@character_name = actor.character_name
@character_index = actor.character_index
break
end
end
end
def update
update_party_actors
super
end
def moveto( x, y )
$game_party.moveto_party_actors( x, y )
super( x, y )
end
def move_down(turn_enabled = true)
if passable?(@x, @y + 1)
$game_party.move_down_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_left(turn_enabled = true)
if passable?(@x - 1, @y)
$game_party.move_left_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_right(turn_enabled = true)
if passable?(@x + 1, @y)
$game_party.move_right_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_up(turn_enabled = true)
if passable?(@x, @y - 1)
$game_party.move_up_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_lower_left
# 下→左、左→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y+1) and passable?(@x-1, @y+1)) or
(passable?(@x-1, @y) and passable?(@x-1, @y+1))
$game_party.move_lower_left_party_actors
end
super
end
def move_lower_right
# 下→右、右→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y+1) and passable?(@x+1, @y+1)) or
(passable?(@x+1, @y) and passable?(@x+1, @y+1))
$game_party.move_lower_right_party_actors
end
super
end
def move_upper_left
# 上→左、左→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y-1) and passable?(@x-1, @y-1)) or
(passable?(@x-1, @y) and passable?(@x-1, @y-1))
$game_party.move_upper_left_party_actors
end
super
end
def move_upper_right
# 上→右、右→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y-1) and passable?(@x+1, @y-1)) or
(passable?(@x+1, @y) and passable?(@x+1, @y-1))
$game_party.move_upper_right_party_actors
end
super
end
def jump(x_plus, y_plus)
# 新しい座標を計算
new_x = @x + x_plus
new_y = @y + y_plus
# 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y)
$game_party.jump_party_actors(x_plus, y_plus)
end
super(x_plus, y_plus)
end
end
end
class Game_Player
include Train_Actor::Game_Player_Module
end
# Train_Actor::Spriteset_Map_Module
# Spriteset_Map用隊列歩行モジュール
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Spriteset_Map_Module
def setup_actor_character_sprites
for character in $game_party.characters.reverse
@character_sprites.unshift(Sprite_Character.new(@viewport1, character))
end
end
end
end
class Spriteset_Map
include Train_Actor::Spriteset_Map_Module
alias train_actor_create_characters create_characters
def create_characters
train_actor_create_characters
setup_actor_character_sprites
end
end
# Train_Actor::Game_Party_Actor
# マップ上のパーティ用キャラクター
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
class Game_Party_Actor < Game_Character
def initialize(train_index)
super()
@train_index = train_index
@character_wait = 0
@through = true
# 不透明度と合成方法を初期化
@opacity = 255
@blend_type = 0
@move_list = []
end
def setup(actor)
# キャラクターのファイル名と色相を設定
if actor.nil?
@character_name = ""
elsif not actor.dead? # 死んでる場合とりあえず、消しとこ…
@character_name = actor.character_name
@character_index = actor.character_index
else
@character_name = DEAD_CHARACTER_NAME
@character_index = DEAD_CHARACTER_INDEX
end
end
def dash?
return false if $game_map.disable_dash?
# return false if $game_player.move_route_forcing
return Input.press?(Input::A)
end
def update
@move_speed = $game_player.move_speed
@step_anime = $game_player.step_anime
@opacity = $game_player.opacity
@blend_type = $game_player.blend_type
@direction_fix = $game_player.direction_fix
if @direction_fix
@direction = $game_player.direction
end
update_move_list()
super
end
def screen_z(height = 0)
if $game_player.x == @x and $game_player.y == @y
super() - 1
else
super()
end
end
def add_move_list_element(element)
@move_list.push(element)
if @move_list.size == 1
update_move_list()
end
end
def move_list_size
return @move_list.size
end
def update_move_list()
return if moving?
return if @move_list.empty?
if @move_list[0].type == STOP
if @train_index != 0
character = $game_party.characters[@train_index - 1]
if character.x == @x and character.y == @y and character.direction == @direction
distance = (2 ** @move_speed)
distance *= 2 if dash?
@character_wait = 256 / distance + 1
while character.move_list_size < @move_list.size and @move_list[0].type == STOP
@move_list.shift
end
end
end
else
@character_wait = 0
end
if @character_wait > 0
if dash?
@character_wait -= 2
else
@character_wait -= 1
end
return
end
element = @move_list.shift
case element.type
when Input::DOWN
move_down(element.args[0])
when Input::LEFT
move_left(element.args[0])
when Input::RIGHT
move_right(element.args[0])
when Input::UP
move_up(element.args[0])
when DOWN_LEFT
move_lower_left
when DOWN_RIGHT
move_lower_right
when UP_LEFT
move_upper_left
when UP_RIGHT
move_upper_right
when JUMP
jump(element.args[0],element.args[1])
when STOP
update_move_list()
end
end
def moveto( x, y )
@move_list.clear
super(x, y)
end
#--------------------------------------------------------------------------
# ● 下に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# 下を向く
if turn_enabled
turn_down
end
# 通行可能な場合
if passable?(@x, @y + 1)
# 下を向く
turn_down
# 座標を更新
@y += 1
end
end
#--------------------------------------------------------------------------
# ● 左に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# 左を向く
if turn_enabled
turn_left
end
# 通行可能な場合
if passable?(@x - 1, @y)
# 左を向く
turn_left
# 座標を更新
@x -= 1
end
end
#--------------------------------------------------------------------------
# ● 右に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# 右を向く
if turn_enabled
turn_right
end
# 通行可能な場合
if passable?(@x + 1, @y)
# 右を向く
turn_right
# 座標を更新
@x += 1
end
end
#--------------------------------------------------------------------------
# ● 上に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# 上を向く
if turn_enabled
turn_up
end
# 通行可能な場合
if passable?(@x, @y - 1)
# 上を向く
turn_up
# 座標を更新
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● 左下に移動
#--------------------------------------------------------------------------
def move_lower_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、上向きだった場合は下を向く
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
end
# 下→左、左→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y+1) and passable?(@x-1, @y+1)) or
(passable?(@x-1, @y) and passable?(@x-1, @y+1))
# 座標を更新
@x -= 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● 右下に移動
#--------------------------------------------------------------------------
def move_lower_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、上向きだった場合は下を向く
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
end
# 下→右、右→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y+1) and passable?(@x+1, @y+1)) or
(passable?(@x+1, @y) and passable?(@x+1, @y+1))
# 座標を更新
@x += 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● 左上に移動
#--------------------------------------------------------------------------
def move_upper_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、下向きだった場合は上を向く
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
end
# 上→左、左→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y-1) and passable?(@x-1, @y-1)) or
(passable?(@x-1, @y) and passable?(@x-1, @y-1))
# 座標を更新
@x -= 1
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● 右上に移動
#--------------------------------------------------------------------------
def move_upper_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、下向きだった場合は上を向く
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
end
# 上→右、右→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y-1) and passable?(@x+1, @y-1)) or
(passable?(@x+1, @y) and passable?(@x+1, @y-1))
# 座標を更新
@x += 1
@y -= 1
end
end
def sync_with_player
@x = $game_player.x
@y = $game_player.y
@real_x = $game_player.real_x
@real_y = $game_player.real_y
@direction = $game_player.direction
update_bush_depth
end
end
end
复制代码
作者:
强弩之末
时间:
2011-3-23 18:19
本帖最后由 铃仙·优昙华院·因幡 于 2011-5-11 20:14 编辑
仓库脚本很多的啦,但是不知道是不是兼容的……
#==============================================================================
#
# 仓库ver1.1
#
# 汉化 by 约束
#
# RPG中存放多余物品的仓库。
# 本脚本与黑狮子的脚本相似
# 参考于MQ0_PartyReserve所做。
#
# 使用方法
# 事件中的「脚本」里填入reserve_system即可启动此脚本。
#
# 不可存放物品
# ・不想可以存放事件/剧情所需物品时
# 在物品的备注栏中填入 非存放 即可
# 如此即可使物品不可存入仓库。
#
# 另外、为能使用TYPE74RX-T様的「限定特定物平的所持数上限」脚本
# 而写了专门应对的方法
# 如果有用到以上所述脚本、请使RX_T_ITEM为true状态
#
#==============================================================================
module BBL_RESERVE_SYSTEM
#==============================================================================
# 设定项目开始
#==============================================================================
# 如果不希望保管物品根据以下范畴区分的情况时 请填入false
ITEM_DISCRETION = true
# ITEM_DISCRETION在true的状态时 请在以下填入范畴名
# 从左开始依次为物品、武器、防具、金钱(顺序不可改变)
# ※如果不希望有金钱保管功能时 将金钱从范畴内消去
# 例) ["物品", "武器", "防具"]
DISCRETION_NAME = ["物品", "武器", "防具", "金钱"]
# 操作说明文
# 如果不需要时、消除""内文字即可
COMMAND_EXPLANATION = "空格键:将物品分别存入 D键:将物品全部存入"
# 使用仓库时的按键
RESERVE_KEY = Input::C # 分别存入
RESERVE_ALL_KEY = Input::Z # 全部存入
# 金钱选项窗口的用语
# 从左开始依次为保存和提取
GOLD_COMMAND_NAME = ["存入", "提取"]
# 所持金钱的用语
GOLD_NAME = "拥有金币"
# 保存金钱的用语
RESERVE_GOLD_NAME = "储存金额"
# 使用了TYPE74RX-T様的「限定特定物平的所持数上限」脚本
# 请在以下改为true即可
RX_T_ITEM = false
#==============================================================================
# 设定项目完毕
#==============================================================================
end
$imported = {} if $imported == nil
class Game_Party
alias bbl_initialize initialize
#--------------------------------------------------------------------------
# ○ 定义实例变量 (追加定义)
#--------------------------------------------------------------------------
attr_reader :keep_gold # 保存金钱
#--------------------------------------------------------------------------
# ● 初期化对象
#--------------------------------------------------------------------------
def initialize
bbl_initialize
@keep_items = {} # 保管品 hash (物品 ID)
@keep_weapons = {} # 保管品 hash (武器 ID)
@keep_armors = {} # 保管品 hash (防具 ID)
@keep_gold = 0 # 保管金钱
end
#--------------------------------------------------------------------------
# ○ 获取保存物品的排序
#--------------------------------------------------------------------------
def keeping_items
result = []
for i in @keep_items.keys.sort
result.push($data_items[i]) if @keep_items[i] > 0
end
for i in @keep_weapons.keys.sort
result.push($data_weapons[i]) if @keep_weapons[i] > 0
end
for i in @keep_armors.keys.sort
result.push($data_armors[i]) if @keep_armors[i] > 0
end
return result
end
#--------------------------------------------------------------------------
# ○ 获取保存物品的所持数量
#--------------------------------------------------------------------------
def keeping_item_number(item)
case item
when RPG::Item
number = @keep_items[item.id]
when RPG::Weapon
number = @keep_weapons[item.id]
when RPG::Armor
number = @keep_armors[item.id]
end
return number == nil ? 0 : number
end
#--------------------------------------------------------------------------
# ○ 保存物品的增加 (减少)
# item : 物品
# n : 个数
#--------------------------------------------------------------------------
def gain_keeping_item(item, n)
number = keeping_item_number(item)
case item
when RPG::Item
@keep_items[item.id] = [[number + n, 0].max, 99].min
when RPG::Weapon
@keep_weapons[item.id] = [[number + n, 0].max, 99].min
when RPG::Armor
@keep_armors[item.id] = [[number + n, 0].max, 99].min
end
end
#--------------------------------------------------------------------------
# ○ 保存物品的减少
# item : 物品
# n : 个数
#--------------------------------------------------------------------------
def lose_keeping_item(item, n)
gain_keeping_item(item, -n)
end
#--------------------------------------------------------------------------
# ● 保管金额的增加 (减少)
# n : 金额
#--------------------------------------------------------------------------
def gain_keeping_gold(n)
@keep_gold = [[@keep_gold + n, 0].max, 9999999].min
end
#--------------------------------------------------------------------------
# ● 保管金额的减少
# n : 金额
#--------------------------------------------------------------------------
def lose_keeping_gold(n)
gain_keeping_gold(-n)
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 呼出仓库
#--------------------------------------------------------------------------
def reserve_system
$scene = Scene_Reserve.new
return true
end
end
class Scene_Reserve < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
@not_gold = true if BBL_RESERVE_SYSTEM::DISCRETION_NAME.size < 4
if BBL_RESERVE_SYSTEM::ITEM_DISCRETION
@item_window = Window_Reserve_main.new(0, 112, 272, 248)
@reserve_window = Window_Reserve.new(272, 112, 272, 248)
else
@item_window = Window_Reserve_main.new(0, 56, 272, 304)
@reserve_window = Window_Reserve.new(272, 56, 272, 304)
end
@help_window = Window_Help.new
@item_window.help_window = @help_window
@reserve_window.help_window = @help_window
@command_window = Window_ReserveCommand.new(544, BBL_RESERVE_SYSTEM::DISCRETION_NAME,
BBL_RESERVE_SYSTEM::DISCRETION_NAME.size, 1, 4)
@command_window.y = 56
@command_window.active = true
@gold_command_window = Window_ReserveCommand.new(192, BBL_RESERVE_SYSTEM::GOLD_COMMAND_NAME, 1, 0)
@gold_command_window.opacity = 0
@gold_command_window.x = 32
@gold_command_window.y = @item_window.y + 64
@gold_command_window.visible = false
@item_window.active = false
@reserve_window.active = false
@item_window.index = -1
@reserve_window.index = -1
@item_cursor = 0
@reserve_cursor = 0
@item_window.mode = 1
@reserve_window.mode = 1
@number_window = Window_GoldInput.new
@number_window.visible = false
@number_window.y = @gold_command_window.y + @gold_command_window.height
@gold_window = Window_HandGold.new(0, 416 - 56)
@gold_reserve_window = Window_ReserveGold.new(272, 416 - 56)
unless BBL_RESERVE_SYSTEM::ITEM_DISCRETION
@command_window.active = false
@command_window.visible = false
@item_window.index = 0
@item_window.active
end
if $imported["HelpExtension"]
adjust_window_size
else
adjust_gold_window_size
end
end
#--------------------------------------------------------------------------
# ● 完毕处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@item_window.dispose
@reserve_window.dispose
@command_window.dispose
@help_window.dispose
@gold_command_window.dispose
@gold_window.dispose
@gold_reserve_window.dispose
@number_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update if BBL_RESERVE_SYSTEM::ITEM_DISCRETION
if @item_window.index >= 0
@item_window.active = true
@reserve_window.active = false
elsif @reserve_window.index >= 0
@item_window.active = false
@reserve_window.active = true
end
if @command_window.active == true
command_selection
elsif @item_window.active == true
select_item
elsif @reserve_window.active == true
select_keeping_item
elsif @gold_command_window.active == true
select_gold_command
elsif @number_window.active == true
select_number
end
item_mode = @command_window.index + 1
if item_mode != @item_window.mode
@item_window.mode = item_mode
end
if item_mode != @reserve_window.mode
@reserve_window.mode = item_mode
end
end
#--------------------------------------------------------------------------
# ● 指令窗口选项的刷新
#--------------------------------------------------------------------------
def command_selection
@help_window.set_text(BBL_RESERVE_SYSTEM::COMMAND_EXPLANATION)
if Input.trigger?(Input::C)
if @command_window.index == 3
Sound.play_decision
@command_window.active = false
@gold_command_window.visible = true
@gold_command_window.active = true
@gold_command_window.index = 0
else
Sound.play_decision
@command_window.active = false
@item_window.active = true
@item_window.index = 0
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
end
end
#--------------------------------------------------------------------------
# ● 所持物品选项的刷新
#--------------------------------------------------------------------------
def select_item
@item_window.update
@reserve_window.update
if Input.repeat?(BBL_RESERVE_SYSTEM::RESERVE_KEY)
@item_window.gain_item
@item_window.refresh
@reserve_window.refresh
if @item_window.item == nil
@item_window.index -= 1 if @item_window.index > 0
end
elsif Input.repeat?(BBL_RESERVE_SYSTEM::RESERVE_ALL_KEY)
@item_window.gain_item_all
@item_window.refresh
@reserve_window.refresh
if @item_window.item == nil
@item_window.index -= 1 if @item_window.index > 0
end
elsif Input.trigger?(Input::B)
if BBL_RESERVE_SYSTEM::ITEM_DISCRETION
Sound.play_cancel
@item_window.active = false
@item_window.index = -1
@command_window.active = true
else
Sound.play_cancel
$scene = Scene_Map.new
end
elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::LEFT)
Sound.play_cursor
@item_cursor = @item_window.index
@item_window.active = false
@reserve_window.active
@item_window.index = -1
@reserve_window.index = @reserve_cursor
end
end
#--------------------------------------------------------------------------
# ● 保管物品选项的刷新
#--------------------------------------------------------------------------
def select_keeping_item
@item_window.update
@reserve_window.update
if Input.repeat?(BBL_RESERVE_SYSTEM::RESERVE_KEY)
@reserve_window.reserve_item
@item_window.refresh
@reserve_window.refresh
if @reserve_window.item == nil
@reserve_window.index -= 1 if @reserve_window.index > 0
end
elsif Input.repeat?(BBL_RESERVE_SYSTEM::RESERVE_ALL_KEY)
@reserve_window.reserve_item_all
@item_window.refresh
@reserve_window.refresh
if @reserve_window.item == nil
@reserve_window.index -= 1 if @reserve_window.index > 0
end
elsif Input.trigger?(Input::B)
if BBL_RESERVE_SYSTEM::ITEM_DISCRETION
Sound.play_cancel
@reserve_window.active = false
@reserve_window.index = -1
@command_window.active = true
else
Sound.play_cancel
$scene = Scene_Map.new
end
elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::LEFT)
Sound.play_cursor
@reserve_cursor = @reserve_window.index
@reserve_window.active = false
@item_window.active
@reserve_window.index = -1
@item_window.index = @item_cursor
end
end
#--------------------------------------------------------------------------
# ● 金钱指令窗口选项的刷新
#--------------------------------------------------------------------------
def select_gold_command
@gold_command_window.update
if Input.trigger?(Input::C)
Sound.play_decision
@gold_command_window.active = false
@gold_command_window.visible = false
@number_window.visible = true
@number_window.active = true
if @gold_command_window.index == 0
@number_window.mode = 0 # 存入
@number_window.x = 32
else
@number_window.mode = 1 # 提取
@number_window.x = 304
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
@gold_command_window.active = false
@gold_command_window.visible = false
@command_window.active = true
end
end
#--------------------------------------------------------------------------
# ● 填写金额的刷新
#--------------------------------------------------------------------------
def select_number
@number_window.update
if Input.trigger?(Input::C)
if @number_window.mode == 0
if @number_window.number > $game_party.gold
Sound.play_buzzer
@number_window.number = $game_party.gold
else
Sound.play_decision
gold = @number_window.number
$game_party.lose_gold(gold)
$game_party.gain_keeping_gold(gold)
@number_window.number = 0
@gold_window.refresh
@gold_reserve_window.refresh
end
elsif @number_window.mode == 1
if @number_window.number > $game_party.keep_gold
Sound.play_buzzer
@number_window.number = $game_party.keep_gold
else
Sound.play_decision
gold = @number_window.number
$game_party.gain_gold(gold)
$game_party.lose_keeping_gold(gold)
@number_window.number = 0
@gold_window.refresh
@gold_reserve_window.refresh
end
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
@number_window.visible = false
@number_window.active = false
@number_window.number = 0
@number_window.index = 6
@gold_command_window.visible = true
@gold_command_window.active = true
end
end
if $imported["HelpExtension"]
#--------------------------------------------------------------------------
# ● 调整窗口大小 用于KGC的扩张帮助窗口
#--------------------------------------------------------------------------
def adjust_window_size
@help_window.row_max = KGC::HelpExtension::ROW_MAX
@command_window.y = @help_window.height
@item_window.y = @command_window.height + @help_window.height
@reserve_window.y = @command_window.height + @help_window.height
sy = @help_window.height + @command_window.height + @gold_window.height
sy = @help_window.height + @command_window.height if @not_gold
@item_window.height = 416 - sy
@reserve_window.height = 416 - sy
@gold_command_window.y = @item_window.y
if @not_gold
@gold_window.visible = false
@gold_reserve_window.visible = false
end
end
end
#--------------------------------------------------------------------------
# ● 调整窗口大小
#--------------------------------------------------------------------------
def adjust_gold_window_size
sy = @help_window.height + @command_window.height + @gold_window.height
sy = @help_window.height + @command_window.height if @not_gold
@item_window.height = 416 - sy
@reserve_window.height = 416 - sy
if @not_gold
@gold_window.visible = false
@gold_reserve_window.visible = false
end
end
end
#==============================================================================
# ■ Window_Reserve
#------------------------------------------------------------------------------
# 显示仓库中物品一览
#==============================================================================
class Window_Reserve < Window_Selectable
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :mode # 模式
#--------------------------------------------------------------------------
# ● 初期化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
# width : 窗口的宽度
# height : 窗口的高度
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 1
self.index = -1
@mode = 0
@total = 0
@value = 0
refresh
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.keeping_items
next unless include?(item)
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 项目的描画
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.keeping_item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
self.contents.draw_text(rect, sprintf("%2d", number), 2)
self.contents.font.size = 14
rect.width -= 20
self.contents.draw_text(rect, "×", 2)
self.contents.font.size = 20
end
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
#--------------------------------------------------------------------------
# ● 模式的设定
# mode : 新模式
#--------------------------------------------------------------------------
def mode=(mode)
if @mode != mode
@mode = mode
refresh
end
end
#--------------------------------------------------------------------------
# ● 物品在许可状态时是否显示
#--------------------------------------------------------------------------
def enable?(item)
if BBL_RESERVE_SYSTEM::RX_T_ITEM
rx_limit = RX_T.get_numeric_of_system_word_in_sys_str(item, "所持可能数")
if rx_limit > 0
if $game_party.item_number(item) == rx_limit
return false
end
end
end
if $game_party.item_number(item) == 99
return false
else
return true
end
end
#--------------------------------------------------------------------------
# ● 物品是否存在于名单
# item : 物品
#--------------------------------------------------------------------------
def include?(item)
if BBL_RESERVE_SYSTEM::ITEM_DISCRETION
case @mode
when 1 # 物品
return false unless item.is_a?(RPG::Item)
when 2 # 武器
return false unless item.is_a?(RPG::Weapon)
when 3 # 防具
return false unless item.is_a?(RPG::Armor)
when 4 # 金钱
return false
end
return true
else
return false if item == nil
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
return true
end
end
#--------------------------------------------------------------------------
# ● 取出保管中物品
#--------------------------------------------------------------------------
def reserve_item
return if item == nil
if BBL_RESERVE_SYSTEM::RX_T_ITEM
rx_limit = RX_T.get_numeric_of_system_word_in_sys_str(item, "所持可能数")
end
return Sound.play_buzzer if $game_party.item_number(item) == 99
if rx_limit == 0
rx_limit = nil
end
if $game_party.item_number(item) == rx_limit
Sound.play_buzzer
else
Sound.play_use_item
$game_party.lose_keeping_item(item, 1)
$game_party.gain_item(item, 1)
end
end
#--------------------------------------------------------------------------
# ● 将保管中物品全部取出
#--------------------------------------------------------------------------
def reserve_item_all
return if item == nil
if BBL_RESERVE_SYSTEM::RX_T_ITEM
rx_limit = RX_T.get_numeric_of_system_word_in_sys_str(item, "所持可能数")
end
return Sound.play_buzzer if $game_party.item_number(item) == 99
if rx_limit == 0
rx_limit = nil
end
if $game_party.item_number(item) == rx_limit
Sound.play_buzzer
else
Sound.play_use_item
@total = $game_party.keeping_item_number(item) + $game_party.item_number(item)
if rx_limit != nil
if rx_limit > 0
if @total > rx_limit
@value = @total - rx_limit
end
end
else
if @total > 99
@value = @total - 99
end
end
$game_party.gain_item(item, $game_party.keeping_item_number(item))
$game_party.lose_keeping_item(item, $game_party.keeping_item_number(item))
$game_party.gain_keeping_item(item, @value)
@total = 0
@value = 0
end
end
end
#==============================================================================
# ■ Window_Reserve
#------------------------------------------------------------------------------
# 显示仓库中所持物品一览
#==============================================================================
class Window_Reserve_main < Window_Selectable
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :mode # 模式
#--------------------------------------------------------------------------
# ● 初期化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
# width : 窗口的宽度
# height : 窗口的高度
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 1
self.index = -1
@mode = 0
@total = 0
@value = 0
refresh
end
#--------------------------------------------------------------------------
# ● 物品的获取
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 项目的描画
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
self.contents.draw_text(rect, sprintf("%2d", number), 2)
self.contents.font.size = 14
rect.width -= 20
self.contents.draw_text(rect, "×", 2)
self.contents.font.size = 20
end
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
#--------------------------------------------------------------------------
# ● 模式的设定
# mode : 新模式
#--------------------------------------------------------------------------
def mode=(mode)
if @mode != mode
@mode = mode
refresh
end
end
#--------------------------------------------------------------------------
# ● 物品在许可状态时是否显示
#--------------------------------------------------------------------------
def enable?(item)
if $game_party.keeping_item_number(item) == 99
return false
else
return true
end
end
#--------------------------------------------------------------------------
# ○ 物品是否存在于名单
# item : 物品
#--------------------------------------------------------------------------
def include?(item)
if BBL_RESERVE_SYSTEM::ITEM_DISCRETION
case @mode
when 1 # 物品
return false unless item.is_a?(RPG::Item)
return false if item.note.include?("非存放")
when 2 # 武器
return false unless item.is_a?(RPG::Weapon)
return false if item.note.include?("非存放")
when 3 # 防具
return false unless item.is_a?(RPG::Armor)
return false if item.note.include?("非存放")
when 4 # 金钱
return false
end
return true
else
return false if item == nil
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
return false if item.note.include?("非存放")
return true
end
end
#--------------------------------------------------------------------------
# ● 所持有物品的保存
#--------------------------------------------------------------------------
def gain_item
return if item == nil
if $game_party.keeping_item_number(item) == 99
Sound.play_buzzer
else
Sound.play_use_item
$game_party.gain_keeping_item(item, 1)
$game_party.lose_item(item, 1)
end
end
#--------------------------------------------------------------------------
# ● 所持有物品全部保存
#--------------------------------------------------------------------------
def gain_item_all
return if item == nil
if $game_party.keeping_item_number(item) == 99
Sound.play_buzzer
else
Sound.play_use_item
@total = $game_party.keeping_item_number(item) + $game_party.item_number(item)
if @total > 99
@value = @total - 99
end
$game_party.gain_keeping_item(item, $game_party.item_number(item))
$game_party.lose_item(item, $game_party.item_number(item))
$game_party.gain_item(item, @value)
@total = 0
@value = 0
end
end
end
#==============================================================================
# ■ Window_GoldInput
#------------------------------------------------------------------------------
# 用于填写所持金钱的窗口。
#==============================================================================
class Window_GoldInput < Window_Base
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :mode # 模式
attr_accessor :index # 索引
#--------------------------------------------------------------------------
# ● 初期化对象
# digits_max : 行数
#--------------------------------------------------------------------------
def initialize
super(32, 208, 544, 64)
@number = 0
@digits_max = 7
@index = @digits_max - 1
@mode = 0
self.opacity = 0
self.active = false
self.z += 9999
refresh
update_cursor
end
#--------------------------------------------------------------------------
# ● 数值的获取
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ● 模式的获取
# 0:保存 1:提取
#--------------------------------------------------------------------------
def mode=(mode)
@mode = mode
return @mode
end
#--------------------------------------------------------------------------
# ● 数值的设定
# number : 新数值
#--------------------------------------------------------------------------
def number=(number)
@number = [[number, 0].max, 10 ** @digits_max - 1].min
refresh
end
#--------------------------------------------------------------------------
# ● 行数的获取
#--------------------------------------------------------------------------
def digits_max
return @digits_max
end
#--------------------------------------------------------------------------
# ● 行数的设定
# digits_max : 新行数
#--------------------------------------------------------------------------
def digits_max=(digits_max)
@digits_max = digits_max
refresh
end
#--------------------------------------------------------------------------
# ● 光标向右移动
# wrap : 可以往复循环移动
#--------------------------------------------------------------------------
def cursor_right(wrap)
if @index < @digits_max - 1 or wrap
@index = (@index + 1) % @digits_max
end
end
#--------------------------------------------------------------------------
# ● 光标向左移动
# wrap : 可以往复循环移动
#--------------------------------------------------------------------------
def cursor_left(wrap)
if @index > 0 or wrap
@index = (@index + @digits_max - 1) % @digits_max
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
if self.active
if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
Sound.play_cursor
place = 10 ** (@digits_max - 1 - @index)
n = @number / place % 10
@number -= n * place
n = (n + 1) % 10 if Input.repeat?(Input::UP)
n = (n + 9) % 10 if Input.repeat?(Input::DOWN)
@number += n * place
refresh
end
last_index = @index
if Input.repeat?(Input::RIGHT)
if @index == @digits_max - 1
Sound.play_cursor
if @mode == 0
if @number == $game_party.gold
@number = 0
else
@number = $game_party.gold
end
elsif @mode == 1
if @number == $game_party.keep_gold
@number = 0
else
@number = $game_party.keep_gold
end
end
refresh
else
cursor_right(Input.trigger?(Input::RIGHT))
end
end
if Input.repeat?(Input::LEFT)
if @index == 0
Sound.play_cursor
if @mode == 0
if @number == $game_party.gold
@number = 0
else
@number = $game_party.gold
end
elsif @mode == 1
if @number == $game_party.keep_gold
@number = 0
else
@number = $game_party.keep_gold
end
end
refresh
else
cursor_left(Input.trigger?(Input::LEFT))
end
end
if @index != last_index
Sound.play_cursor
end
update_cursor
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
s = sprintf("%0*d", @digits_max, @number)
for i in 0...@digits_max
self.contents.draw_text(24 + i * 16, 0, 16, WLH, s[i,1], 1)
end
self.contents.font.color = system_color
self.contents.draw_text(24 + (i + 1) * 16, 0, 16, WLH, Vocab::gold)
end
#--------------------------------------------------------------------------
# ● 光标的刷新
#--------------------------------------------------------------------------
def update_cursor
self.cursor_rect.set(24 + @index * 16, 0, 16, WLH)
end
end
#==============================================================================
# ■ Window_ReserveGold
#------------------------------------------------------------------------------
# 显示保存金额的窗口。
#==============================================================================
class Window_ReserveGold < Window_Base
#--------------------------------------------------------------------------
# ● 初期化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 272, WLH + 32)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_currency_value($game_party.keep_gold, 104, 0, 120)
self.contents.font.color = system_color
self.contents.draw_text(16, 0, 120, WLH, BBL_RESERVE_SYSTEM::RESERVE_GOLD_NAME)
end
end
#==============================================================================
# ■ Window_HandGold
#------------------------------------------------------------------------------
# 显示所持金额的窗口。
#==============================================================================
class Window_HandGold < Window_Base
#--------------------------------------------------------------------------
# ● 初期化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 272, WLH + 32)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_currency_value($game_party.gold, 104, 0, 120)
self.contents.font.color = system_color
self.contents.draw_text(16, 0, 120, WLH, BBL_RESERVE_SYSTEM::GOLD_NAME)
end
end
#==============================================================================
# ■ Window_ReserveCommand
#------------------------------------------------------------------------------
# 进行仓库指令选择的窗口。
#==============================================================================
class Window_ReserveCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :commands # 指令
#--------------------------------------------------------------------------
# ● 初期化对象
# width : 窗口的宽度
# commands : 指令字符串的排序
# column_max : 行数 (在2 以上时,横向选项)
# row_max : 列数 (0:切合指令个数)
# spacing : 项目横向排列时 空白的部分
#--------------------------------------------------------------------------
def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
if row_max == 0
row_max = (commands.size + column_max - 1) / column_max
end
super(0, 0, width, row_max * WLH + 32, spacing)
@commands = commands
@item_max = commands.size
@column_max = column_max
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 项目的描画
# index : 项目编号
# enabled : 有效标志。false 时会描绘为半透明状
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], 1)
end
end
复制代码
作者:
一箭烂YiJL
时间:
2011-3-23 19:47
这一个可以兼容跟随的:
http://f44.aaa.livedoor.jp/~ytom ... mp;tech=large_party
作者:
强弩之末
时间:
2011-3-25 18:00
回复
强弩之末
的帖子
大汗……- -
作者:
1224198918
时间:
2011-3-27 10:30
回复
一箭烂YiJL
的帖子
能不能把变成中文操作啊
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1