#==============================================================================
# ■ RGSS3 アクター預かり所 ver 1.00 本体プログラム
#------------------------------------------------------------------------------
# 配布元:
# 白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
#
# 利用規約:
# RPGツクールVX Aceの正規の登録者のみご利用になれます。
# 利用報告・著作権表示とかは必要ありません。
# 改造もご自由にどうぞ。
# 何か問題が発生しても責任は持ちません。
#==============================================================================
#==============================================================================
# ■ WD_memberchange_commonmethod
#------------------------------------------------------------------------------
# アクター預かり所用の共通メソッドです。
#==============================================================================
module WD_memberchange_commonmethod
#--------------------------------------------------------------------------
# ● 歩行グラフィックの描画
#--------------------------------------------------------------------------
def draw_character(character_name, character_index, x, y, enabled = true)
return unless character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign && sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
if enabled
contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
else
contents.blt(x - cw / 2, y - ch, bitmap, src_rect, 128)
end
end
#--------------------------------------------------------------------------
# ● ステートおよび強化/弱体のアイコンを描画
#--------------------------------------------------------------------------
def draw_actor_icons(actor, x, y, width = 96, enabled = true)
icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y, enabled) }
end
#--------------------------------------------------------------------------
# ● 名前の描画
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y, width = 112, enabled = true)
change_color(hp_color(actor), enabled)
draw_text(x, y, width, line_height, actor.name)
end
#--------------------------------------------------------------------------
# ● 職業の描画
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y, width = 112, enabled = true)
change_color(normal_color, enabled)
draw_text(x, y, width, line_height, actor.class.name)
end
#--------------------------------------------------------------------------
# ● 二つ名の描画
#--------------------------------------------------------------------------
def draw_actor_nickname(actor, x, y, width = 180, enabled = true)
change_color(normal_color, enabled)
draw_text(x, y, width, line_height, actor.nickname)
end
#--------------------------------------------------------------------------
# ● レベルの描画
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y, width = 56, enabled = true)
change_color(system_color, enabled)
draw_text(x, y, width-24, line_height, Vocab::level_a)
change_color(normal_color, enabled)
draw_text(x + 32, y, 24, line_height, actor.level, 2)
end
#--------------------------------------------------------------------------
# ● HP の描画
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 124, enabled = true)
draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color, enabled)
draw_text(x, y, 30, line_height, Vocab::hp_a)
draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
hp_color(actor), normal_color, enabled)
end
#--------------------------------------------------------------------------
# ● MP の描画
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 124, enabled = true)
draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
change_color(system_color, enabled)
draw_text(x, y, 30, line_height, Vocab::mp_a)
draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
mp_color(actor), normal_color, enabled)
end
#--------------------------------------------------------------------------
# ● TP の描画
#--------------------------------------------------------------------------
def draw_actor_tp(actor, x, y, width = 124, enabled = true)
draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
change_color(system_color, enabled)
draw_text(x, y, 30, line_height, Vocab::tp_a)
change_color(tp_color(actor), enabled)
draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
end
#--------------------------------------------------------------------------
# ● 現在値/最大値を分数形式で描画
# current : 現在値
# max : 最大値
# color1 : 現在値の色
# color2 : 最大値の色
#--------------------------------------------------------------------------
def draw_current_and_max_values(x, y, width, current, max, color1, color2, enabled = true)
change_color(color1, enabled)
xr = x + width
if width < 96
draw_text(xr - 40, y, 42, line_height, current, 2)
else
draw_text(xr - 92, y, 42, line_height, current, 2)
change_color(color2, enabled)
draw_text(xr - 52, y, 12, line_height, "/", 2)
draw_text(xr - 42, y, 42, line_height, max, 2)
end
end
#--------------------------------------------------------------------------
# ● 能力値の描画
#--------------------------------------------------------------------------
def draw_actor_param(actor, x, y, param_id, width = 156, enabled = true)
change_color(system_color, enabled)
draw_text(x, y, width-36, line_height, Vocab::param(param_id))
change_color(normal_color, enabled)
draw_text(x + width-36, y, 36, line_height, actor.param(param_id), 2)
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_equip_item(actor, x, y, slot_index, width = 264, enabled = true)
change_color(system_color, enabled)
draw_text(x, y, 92, line_height, slot_name(actor, slot_index))
draw_item_name(actor.equips[slot_index], x + 92, y, enabled, width-92)
end
#--------------------------------------------------------------------------
# ● 装備スロットの名前を取得
#--------------------------------------------------------------------------
def slot_name(actor, slot_index)
@actor ? Vocab::etype(actor.equip_slots[slot_index]) : ""
end
#--------------------------------------------------------------------------
# ● 経験値情報の描画
#--------------------------------------------------------------------------
def draw_exp_info1(actor, x, y, width = 180, enabled = true)
s1 = actor.max_level? ? "-------" : actor.exp
change_color(system_color, enabled)
draw_text(x, y, width, line_height, Vocab::ExpTotal)
change_color(normal_color, enabled)
draw_text(x, y, width, line_height, s1, 2)
end
#--------------------------------------------------------------------------
# ● 経験値情報の描画
#--------------------------------------------------------------------------
def draw_exp_info2(actor, x, y, width = 180, enabled = true)
s2 = actor.max_level? ? "-------" : actor.next_level_exp - actor.exp
s_next = sprintf(Vocab::ExpNext, Vocab::level)
change_color(system_color, enabled)
draw_text(x, y, width, line_height, s_next)
change_color(normal_color, enabled)
draw_text(x, y, width, line_height, s2, 2)
end
end
#==============================================================================
# ■ Scene_MemberChange
#------------------------------------------------------------------------------
# アクター預かり所の処理を行うクラスです。
#==============================================================================
class Scene_MemberChange < Scene_ItemBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_status_window
create_front_window
create_back_window
create_sort_window if WD_memberchange_ini::Sort_use
create_eliminate_window if WD_memberchange_ini::Eliminate_use
create_text_window
end
#--------------------------------------------------------------------------
# ● パーティから外すアクターを選択するウィンドウの作成
#--------------------------------------------------------------------------
def create_front_window
@front_window = Window_FrontMember.new
@front_window.viewport = @viewport
@front_window.status_window = @status_window
@front_window.set_handler(:ok, method(:determine_member1))
@front_window.set_handler(:cancel, method(:return_scene))
if WD_memberchange_ini::Sort_use and WD_memberchange_ini::Sort_frontcommand
@front_window.set_handler(:sort, method(:change_sort))
end
@front_window.update_help
end
#--------------------------------------------------------------------------
# ● パーティに加えるアクターを選択するウィンドウの作成
#--------------------------------------------------------------------------
def create_back_window
@back_window = Window_BackMember.new
@back_window.viewport = @viewport
@back_window.status_window = @status_window
@back_window.set_handler(:ok, method(:determine_member2))
@back_window.set_handler(:cancel, method(:cancel_member1))
if WD_memberchange_ini::Sort_use
@back_window.set_handler(:sort, method(:change_sort))
end
if WD_memberchange_ini::Eliminate_use
@back_window.set_handler(:eliminate, method(:select_eliminate))
end
end
#--------------------------------------------------------------------------
# ● アクターのステータスウィンドウの作成
#--------------------------------------------------------------------------
def create_status_window
@front_window = Window_FrontMember.new
@status_window = Window_MemberChangeStatus.new
@status_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ● ソート表示ウィンドウの作成
#--------------------------------------------------------------------------
def create_sort_window
@sort_window = Window_MemberChangeSort.new
@sort_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ● 除籍確認ウィンドウの作成
#--------------------------------------------------------------------------
def create_eliminate_window
@eliminate_window = Window_MemberChangeEliminate.new
@eliminate_window.viewport = @viewport
@eliminate_window.set_handler(:ok, method(:ok_eliminate))
@eliminate_window.set_handler(:cancel, method(:cancel_eliminate))
@eliminate_window.visible = false
end
#--------------------------------------------------------------------------
# ● テキストウィンドウの作成
#--------------------------------------------------------------------------
def create_text_window
if WD_memberchange_ini::Txtwindow1_use
x = WD_memberchange_text1_layout::Window_x
y = WD_memberchange_text1_layout::Window_y
width = WD_memberchange_text1_layout::Window_width
height = WD_memberchange_text1_layout::Window_height
text = WD_memberchange_ini::Txtwindow1_text
align = WD_memberchange_text1_layout::Text_align
@text1_window = Window_MemberChangeText.new(x, y, width, height, text, align)
@text1_window.viewport = @viewport
end
if WD_memberchange_ini::Txtwindow2_use
x = WD_memberchange_text2_layout::Window_x
y = WD_memberchange_text2_layout::Window_y
width = WD_memberchange_text2_layout::Window_width
height = WD_memberchange_text2_layout::Window_height
text = WD_memberchange_ini::Txtwindow2_text
align = WD_memberchange_text2_layout::Text_align
@text2_window = Window_MemberChangeText.new(x, y, width, height, text, align)
@text2_window.viewport = @viewport
end
if WD_memberchange_ini::Txtwindow3_use
x = WD_memberchange_text3_layout::Window_x
y = WD_memberchange_text3_layout::Window_y
width = WD_memberchange_text3_layout::Window_width
height = WD_memberchange_text3_layout::Window_height
text = WD_memberchange_ini::Txtwindow3_text
align = WD_memberchange_text3_layout::Text_align
@text3_window = Window_MemberChangeText.new(x, y, width, height, text, align)
@text3_window.viewport = @viewport
end
textwindow_visualize(3)
end
#--------------------------------------------------------------------------
# ● パーティから外すメンバーの選択
#--------------------------------------------------------------------------
def determine_member1
@back_window.activate
textwindow_visualize(2)
end
#--------------------------------------------------------------------------
# ● パーティから外すメンバーのキャンセル
#--------------------------------------------------------------------------
def cancel_member1
@front_window.activate
textwindow_visualize(3)
end
#--------------------------------------------------------------------------
# ● パーティに加えるメンバーの選択
#--------------------------------------------------------------------------
def determine_member2
actor1 = @front_window.data[@front_window.index]
actor2 = @back_window.data[@back_window.index]
remove_equip(actor1) if WD_memberchange_ini::Remove_equip1
remove_actorid = []
membersize = $game_party.members.size
for i in @front_window.index..membersize - 1
remove_actorid.push($game_party.members[@front_window.index].id)
$game_party.remove_actor($game_party.members[@front_window.index].id)
end
if actor2
$game_party.add_actor(actor2.id)
end
for i in 1..remove_actorid.size - 1
$game_party.add_actor(remove_actorid[i])
end
@front_window.refresh
@back_window.refresh
@front_window.activate
textwindow_visualize(3)
end
#--------------------------------------------------------------------------
# ● ソート切り替え
#--------------------------------------------------------------------------
def change_sort
$game_variables[WD_memberchange_ini::Sort_variable] += 1
if $game_variables[WD_memberchange_ini::Sort_variable] >=
WD_memberchange_ini::Sort_series.size
$game_variables[WD_memberchange_ini::Sort_variable] = 0
end
@back_window.refresh
@status_window.refresh
@sort_window.refresh
@back_window.select(0) if WD_memberchange_ini::Sort_indexini
end
#--------------------------------------------------------------------------
# ● 除籍の選択
#--------------------------------------------------------------------------
def select_eliminate
@eliminate_window.visible = true
@eliminate_window.select(1)
@eliminate_window.activate
end
#--------------------------------------------------------------------------
# ● 除籍の決定
#--------------------------------------------------------------------------
def ok_eliminate
if @eliminate_window.index == 0
actor = @back_window.data[@back_window.index]
$game_switches[WD_memberchange_ini::Initial_switch + actor.id - 1] = false
remove_equip(actor) if WD_memberchange_ini::Remove_equip2
@back_window.refresh
end
@back_window.activate
@eliminate_window.visible = false
end
#--------------------------------------------------------------------------
# ● 除籍のキャンセル
#--------------------------------------------------------------------------
def cancel_eliminate
@back_window.activate
@eliminate_window.visible = false
end
#--------------------------------------------------------------------------
# ● 装備を外す
#--------------------------------------------------------------------------
def remove_equip(actor)
if actor
actor.change_equip_by_id(0, 0)
actor.change_equip_by_id(1, 0)
actor.change_equip_by_id(2, 0)
actor.change_equip_by_id(3, 0)
actor.change_equip_by_id(4, 0)
end
end
#--------------------------------------------------------------------------
# ● テキストウィンドウの表示切替
#--------------------------------------------------------------------------
def textwindow_visualize(timing)
if WD_memberchange_ini::Txtwindow1_use
if WD_memberchange_ini::Txtwindow1_timing == timing
@text1_window.visible = false
else
@text1_window.visible = true
end
end
if WD_memberchange_ini::Txtwindow2_use
if WD_memberchange_ini::Txtwindow2_timing == timing
@text2_window.visible = false
else
@text2_window.visible = true
end
end
if WD_memberchange_ini::Txtwindow3_use
if WD_memberchange_ini::Txtwindow3_timing == timing
@text3_window.visible = false
else
@text3_window.visible = true
end
end
end
end
#==============================================================================
# ■ Window_MemberChangeList
#------------------------------------------------------------------------------
# アクターを選択するための共通ウィンドウクラスです。
#==============================================================================
class Window_MemberChangeList < Window_Selectable
include WD_memberchange_commonmethod
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :data # アクターデータ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# ● ヘルプウィンドウ更新メソッドの呼び出し
#--------------------------------------------------------------------------
def call_update_help
update_help if active
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
if @status_window
@status_window.set_item(item)
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# ● ステータスウィンドウの設定
#--------------------------------------------------------------------------
def status_window=(status_window)
@status_window = status_window
end
#--------------------------------------------------------------------------
# ● 下端パディングの更新
#--------------------------------------------------------------------------
def update_padding_bottom
self.padding_bottom = padding
end
#--------------------------------------------------------------------------
# ● X ボタン(Sort)が押されたときの処理
#--------------------------------------------------------------------------
def process_sort
Sound.play_cursor
Input.update
call_handler(:sort)
end
#--------------------------------------------------------------------------
# ● Y ボタン(除籍)が押されたときの処理
#--------------------------------------------------------------------------
def process_eliminate
actor = @data[index]
if actor == nil
Sound.play_buzzer
elsif $game_party.members.include?(actor)
Sound.play_buzzer
elsif WD_memberchange_ini::Fix_switch2[actor.id] != nil and
$game_switches[WD_memberchange_ini::Fix_switch2[actor.id]] == true
Sound.play_buzzer
else
Sound.play_ok
Input.update
deactivate
call_handler(:eliminate)
end
end
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング処理
#--------------------------------------------------------------------------
def process_handling
super
if active
return process_sort if handle?(:sort) && Input.trigger?(:X)
return process_eliminate if handle?(:eliminate) && Input.trigger?(:Y)
end
end
#--------------------------------------------------------------------------
# ● 選択項目の有効状態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
if @enabled[index]
return true
else
return false
end
end
end
#==============================================================================
# ■ Window_FrontMember
#------------------------------------------------------------------------------
# パーティから外すアクターを選択するウィンドウです。
#==============================================================================
class Window_FrontMember < Window_MemberChangeList
include WD_memberchange_commonmethod
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
x = WD_memberchange_front_layout::Window_x
y = WD_memberchange_front_layout::Window_y
width = WD_memberchange_front_layout::Window_width
height = WD_memberchange_front_layout::Window_height
super(x, y, width, height)
@data = []
refresh
activate
select(0)
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return WD_memberchange_front_layout::Window_col
end
#--------------------------------------------------------------------------
# ● アクターリストの作成
#--------------------------------------------------------------------------
def make_item_list
@data = []
$game_party.members.each do |actor|
@data.push(actor)
end
@enabled = []
@data.each do |actor|
if WD_memberchange_ini::Fix_switch1[actor.id] != nil and
$game_switches[WD_memberchange_ini::Fix_switch1[actor.id]]
@enabled.push(false)
else
@enabled.push(true)
end
end
if @data.size < WD_memberchange_ini::Party_max
@data.push(nil)
@enabled.push(true)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
actor = @data[index]
if actor
rect = item_rect(index)
rect.width -= 4
x0 = rect.x
y0 = rect.y
enabled = @enabled[index]
if WD_memberchange_front_layout::Faceview
x = x0 + WD_memberchange_front_layout::Faceview_x
y = y0 + WD_memberchange_front_layout::Faceview_y
draw_actor_face(actor, x, y, enabled)
end
if WD_memberchange_front_layout::Charaview
x = x0 + WD_memberchange_front_layout::Charaview_x
y = y0 + WD_memberchange_front_layout::Charaview_y
draw_character(actor.character_name, actor.character_index, x, y, enabled)
end
if WD_memberchange_front_layout::Stateview == true
x = x0 + WD_memberchange_front_layout::Stateview_x
y = y0 + WD_memberchange_front_layout::Stateview_y
width = WD_memberchange_front_layout::Stateview_width
draw_actor_icons(actor, x, y, width, enabled)
end
if WD_memberchange_front_layout::Nameview == true
x = x0 + WD_memberchange_front_layout::Nameview_x
y = y0 + WD_memberchange_front_layout::Nameview_y
width = WD_memberchange_front_layout::Nameview_width
draw_actor_name(actor, x, y, width, enabled)
end
if WD_memberchange_front_layout::Classview == true
x = x0 + WD_memberchange_front_layout::Classview_x
y = y0 + WD_memberchange_front_layout::Classview_y
width = WD_memberchange_front_layout::Classview_width
draw_actor_class(actor, x, y, width, enabled)
end
if WD_memberchange_front_layout::Nicknameview == true
x = x0 + WD_memberchange_front_layout::Nicknameview_x
y = y0 + WD_memberchange_front_layout::Nicknameview_y
width = WD_memberchange_front_layout::Nicknameview_width
draw_actor_nickname(actor, x, y, width, enabled)
end
if WD_memberchange_front_layout::Lvview == true
x = x0 + WD_memberchange_front_layout::Lvview_x
y = y0 + WD_memberchange_front_layout::Lvview_y
width = WD_memberchange_front_layout::Lvview_width
draw_actor_level(actor, x, y, width, enabled)
end
if WD_memberchange_front_layout::Hpgaugeview == true
x = x0 + WD_memberchange_front_layout::Hpgaugeview_x
y = y0 + WD_memberchange_front_layout::Hpgaugeview_y
width = WD_memberchange_front_layout::Hpgaugeview_width
draw_actor_hp(actor, x, y, width, enabled)
end
if WD_memberchange_front_layout::Mpgaugeview == true
x = x0 + WD_memberchange_front_layout::Mpgaugeview_x
y = y0 + WD_memberchange_front_layout::Mpgaugeview_y
width = WD_memberchange_front_layout::Mpgaugeview_width
draw_actor_mp(actor, x, y, width, enabled)
end
if WD_memberchange_front_layout::Tpview == true
x = x0 + WD_memberchange_front_layout::Tpview_x
y = y0 + WD_memberchange_front_layout::Tpview_y
width = WD_memberchange_front_layout::Tpview_width
draw_actor_tp(actor, x, y, width, enabled)
end
if WD_memberchange_front_layout::Parameterview0 == true
x = x0 + WD_memberchange_front_layout::Parameterview0_x
y = y0 + WD_memberchange_front_layout::Parameterview0_y
width = WD_memberchange_front_layout::Parameterview0_width
draw_actor_param(actor, x, y, 0, width, enabled)
end
if WD_memberchange_front_layout::Parameterview1 == true
x = x0 + WD_memberchange_front_layout::Parameterview1_x
y = y0 + WD_memberchange_front_layout::Parameterview1_y
width = WD_memberchange_front_layout::Parameterview1_width
draw_actor_param(actor, x, y, 1, width, enabled)
end
if WD_memberchange_front_layout::Parameterview2 == true
x = x0 + WD_memberchange_front_layout::Parameterview2_x
y = y0 + WD_memberchange_front_layout::Parameterview2_y
width = WD_memberchange_front_layout::Parameterview2_width
draw_actor_param(actor, x, y, 2, width, enabled)
end
if WD_memberchange_front_layout::Parameterview3 == true
x = x0 + WD_memberchange_front_layout::Parameterview3_x
y = y0 + WD_memberchange_front_layout::Parameterview3_y
width = WD_memberchange_front_layout::Parameterview3_width
draw_actor_param(actor, x, y, 3, width, enabled)
end
if WD_memberchange_front_layout::Parameterview4 == true
x = x0 + WD_memberchange_front_layout::Parameterview4_x
y = y0 + WD_memberchange_front_layout::Parameterview4_y
width = WD_memberchange_front_layout::Parameterview4_width
draw_actor_param(actor, x, y, 4, width, enabled)
end
if WD_memberchange_front_layout::Parameterview5 == true
x = x0 + WD_memberchange_front_layout::Parameterview5_x
y = y0 + WD_memberchange_front_layout::Parameterview5_y
width = WD_memberchange_front_layout::Parameterview5_width
draw_actor_param(actor, x, y, 5, width, enabled)
end
if WD_memberchange_front_layout::Parameterview6 == true
x = x0 + WD_memberchange_front_layout::Parameterview6_x
y = y0 + WD_memberchange_front_layout::Parameterview6_y
width = WD_memberchange_front_layout::Parameterview6_width
draw_actor_param(actor, x, y, 6, width, enabled)
end
if WD_memberchange_front_layout::Parameterview7 == true
x = x0 + WD_memberchange_front_layout::Parameterview7_x
y = y0 + WD_memberchange_front_layout::Parameterview7_y
width = WD_memberchange_front_layout::Parameterview7_width
draw_actor_param(actor, x, y, 7, width, enabled)
end
end
end
#--------------------------------------------------------------------------
# ● ウィンドウ内容の作成
#--------------------------------------------------------------------------
def create_contents
contents.dispose
if contents_width > 0 && contents_height > 0
self.contents = Bitmap.new(contents_width,
[contents_height-999, row_max * (
WD_memberchange_front_layout::Rect_height +
WD_memberchange_front_layout::Rect_interval) -
WD_memberchange_front_layout::Rect_interval].max)
else
self.contents = Bitmap.new(1, 1)
end
end
#--------------------------------------------------------------------------
# ● 先頭の行の取得
#--------------------------------------------------------------------------
def top_row
oy / (WD_memberchange_front_layout::Rect_height +
WD_memberchange_front_layout::Rect_interval)
end
#--------------------------------------------------------------------------
# ● 先頭の行の設定
#--------------------------------------------------------------------------
def top_row=(row)
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * (WD_memberchange_front_layout::Rect_height +
WD_memberchange_front_layout::Rect_interval)
end
#--------------------------------------------------------------------------
# ● 1 ページに表示できる行数の取得
#--------------------------------------------------------------------------
def page_row_max
return (height - padding*2 + WD_memberchange_front_layout::Rect_interval) /
(WD_memberchange_front_layout::Rect_height +
WD_memberchange_front_layout::Rect_interval)
end
#--------------------------------------------------------------------------
# ● 項目を描画する矩形の取得
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = WD_memberchange_front_layout::Rect_width
rect.height = WD_memberchange_front_layout::Rect_height
rect.x = index % col_max *
(rect.width + WD_memberchange_front_layout::Rect_spacing)
rect.y = index / col_max *
(rect.height + WD_memberchange_front_layout::Rect_interval)
rect
end
#--------------------------------------------------------------------------
# ● キャンセルボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_cancel
if $game_party.members.size > 0
Sound.play_cancel
Input.update
deactivate
call_cancel_handler
else
Sound.play_buzzer
end
end
end
#==============================================================================
# ■ Window_BackMember
#------------------------------------------------------------------------------
# パーティに加えるアクターを選択するウィンドウです。
#==============================================================================
class Window_BackMember < Window_MemberChangeList
include WD_memberchange_commonmethod
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
x = WD_memberchange_back_layout::Window_x
y = WD_memberchange_back_layout::Window_y
width = WD_memberchange_back_layout::Window_width
height = WD_memberchange_back_layout::Window_height
super(x, y, width, height + 46)
@data = []
refresh
select(0)
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return WD_memberchange_back_layout::Window_col
end
#--------------------------------------------------------------------------
# ● アクターリストの作成
#--------------------------------------------------------------------------
def make_item_list
data_buf = []
$data_actors.each do |actor|
if actor
if $game_switches[WD_memberchange_ini::Initial_switch+actor.id-1]
data_buf.push($game_actors[actor.id])
end
end
end
case WD_memberchange_ini::Sort_series[
$game_variables[WD_memberchange_ini::Sort_variable]]
when 0
@data = data_buf.sort_by{
|actor| actor.id}
when 1
@data = data_buf.sort_by{
|actor| WD_memberchange_ini::Assignsort_array[actor.id-1]}
when 2
@data = data_buf.sort_by{
|actor| -actor.level*10000+actor.id}
when 3
@data = data_buf.sort_by{
|actor| -actor.mhp*10000+actor.id}
when 4
@data = data_buf.sort_by{
|actor| -actor.mmp*10000+actor.id}
when 5
@data = data_buf.sort_by{
|actor| -actor.atk*10000+actor.id}
when 6
@data = data_buf.sort_by{
|actor| -actor.def*10000+actor.id}
when 7
@data = data_buf.sort_by{
|actor| -actor.mat*10000+actor.id}
when 8
@data = data_buf.sort_by{
|actor| -actor.mdf*10000+actor.id}
when 9
@data = data_buf.sort_by{
|actor| -actor.agi*10000+actor.id}
when 10
@data = data_buf.sort_by{
|actor| -actor.luk*10000+actor.id}
when 11
@data = data_buf.sort_by{
|actor| actor.class_id*10000+actor.id}
end
@enabled = []
@data.each do |actor|
if $game_party.members.include?(actor)
@enabled.push(false)
else
@enabled.push(true)
end
end
if WD_memberchange_ini::Remove_only
@data.push(nil)
@enabled.push(true)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
actor = @data[index]
if actor
rect = item_rect(index)
rect.width -= 4
x0 = rect.x
y0 = rect.y
enabled = @enabled[index]
if WD_memberchange_back_layout::Faceview
x = x0 + WD_memberchange_back_layout::Faceview_x
y = y0 + WD_memberchange_back_layout::Faceview_y
draw_actor_face(actor, x, y, enabled)
end
if WD_memberchange_back_layout::Charaview
x = x0 + WD_memberchange_back_layout::Charaview_x
y = y0 + WD_memberchange_back_layout::Charaview_y
draw_character(actor.character_name, actor.character_index, x, y, enabled)
end
if WD_memberchange_back_layout::Stateview == true
x = x0 + WD_memberchange_back_layout::Stateview_x
y = y0 + WD_memberchange_back_layout::Stateview_y
width = WD_memberchange_back_layout::Stateview_width
draw_actor_icons(actor, x, y, width, enabled)
end
if WD_memberchange_back_layout::Nameview == true
x = x0 + WD_memberchange_back_layout::Nameview_x
y = y0 + WD_memberchange_back_layout::Nameview_y
width = WD_memberchange_back_layout::Nameview_width
draw_actor_name(actor, x, y, width, enabled)
end
if WD_memberchange_back_layout::Classview == true
x = x0 + WD_memberchange_back_layout::Classview_x
y = y0 + WD_memberchange_back_layout::Classview_y
width = WD_memberchange_back_layout::Classview_width
draw_actor_class(actor, x, y, width, enabled)
end
if WD_memberchange_back_layout::Nicknameview == true
x = x0 + WD_memberchange_back_layout::Nicknameview_x
y = y0 + WD_memberchange_back_layout::Nicknameview_y
width = WD_memberchange_back_layout::Nicknameview_width
draw_actor_nickname(actor, x, y, width, enabled)
end
if WD_memberchange_back_layout::Lvview == true
x = x0 + WD_memberchange_back_layout::Lvview_x
y = y0 + WD_memberchange_back_layout::Lvview_y
width = WD_memberchange_back_layout::Lvview_width
draw_actor_level(actor, x, y, width, enabled)
end
if WD_memberchange_back_layout::Hpgaugeview == true
x = x0 + WD_memberchange_back_layout::Hpgaugeview_x
y = y0 + WD_memberchange_back_layout::Hpgaugeview_y
width = WD_memberchange_back_layout::Hpgaugeview_width
draw_actor_hp(actor, x, y, width, enabled)
end
if WD_memberchange_back_layout::Mpgaugeview == true
x = x0 + WD_memberchange_back_layout::Mpgaugeview_x
y = y0 + WD_memberchange_back_layout::Mpgaugeview_y
width = WD_memberchange_back_layout::Mpgaugeview_width
draw_actor_mp(actor, x, y, width, enabled)
end
if WD_memberchange_back_layout::Tpview == true
x = x0 + WD_memberchange_back_layout::Tpview_x
y = y0 + WD_memberchange_back_layout::Tpview_y
width = WD_memberchange_back_layout::Tpview_width
draw_actor_tp(actor, x, y, width, enabled)
end
if WD_memberchange_back_layout::Parameterview0 == true
x = x0 + WD_memberchange_back_layout::Parameterview0_x
y = y0 + WD_memberchange_back_layout::Parameterview0_y
width = WD_memberchange_back_layout::Parameterview0_width
draw_actor_param(actor, x, y, 0, width, enabled)
end
if WD_memberchange_back_layout::Parameterview1 == true
x = x0 + WD_memberchange_back_layout::Parameterview1_x
y = y0 + WD_memberchange_back_layout::Parameterview1_y
width = WD_memberchange_back_layout::Parameterview1_width
draw_actor_param(actor, x, y, 1, width, enabled)
end
if WD_memberchange_back_layout::Parameterview2 == true
x = x0 + WD_memberchange_back_layout::Parameterview2_x
y = y0 + WD_memberchange_back_layout::Parameterview2_y
width = WD_memberchange_back_layout::Parameterview2_width
draw_actor_param(actor, x, y, 2, width, enabled)
end
if WD_memberchange_back_layout::Parameterview3 == true
x = x0 + WD_memberchange_back_layout::Parameterview3_x
y = y0 + WD_memberchange_back_layout::Parameterview3_y
width = WD_memberchange_back_layout::Parameterview3_width
draw_actor_param(actor, x, y, 3, width, enabled)
end
if WD_memberchange_back_layout::Parameterview4 == true
x = x0 + WD_memberchange_back_layout::Parameterview4_x
y = y0 + WD_memberchange_back_layout::Parameterview4_y
width = WD_memberchange_back_layout::Parameterview4_width
draw_actor_param(actor, x, y, 4, width, enabled)
end
if WD_memberchange_back_layout::Parameterview5 == true
x = x0 + WD_memberchange_back_layout::Parameterview5_x
y = y0 + WD_memberchange_back_layout::Parameterview5_y
width = WD_memberchange_back_layout::Parameterview5_width
draw_actor_param(actor, x, y, 5, width, enabled)
end
if WD_memberchange_back_layout::Parameterview6 == true
x = x0 + WD_memberchange_back_layout::Parameterview6_x
y = y0 + WD_memberchange_back_layout::Parameterview6_y
width = WD_memberchange_back_layout::Parameterview6_width
draw_actor_param(actor, x, y, 6, width, enabled)
end
if WD_memberchange_back_layout::Parameterview7 == true
x = x0 + WD_memberchange_back_layout::Parameterview7_x
y = y0 + WD_memberchange_back_layout::Parameterview7_y
width = WD_memberchange_back_layout::Parameterview7_width
draw_actor_param(actor, x, y, 7, width, enabled)
end
end
end
#--------------------------------------------------------------------------
# ● ウィンドウ内容の作成
#--------------------------------------------------------------------------
def create_contents
contents.dispose
if contents_width > 0 && contents_height > 0
self.contents = Bitmap.new(contents_width,
[contents_height-999, row_max * (
WD_memberchange_back_layout::Rect_height +
WD_memberchange_back_layout::Rect_interval) -
WD_memberchange_back_layout::Rect_interval].max)
else
self.contents = Bitmap.new(1, 1)
end
end
#--------------------------------------------------------------------------
# ● 先頭の行の取得
#--------------------------------------------------------------------------
def top_row
oy / (WD_memberchange_back_layout::Rect_height +
WD_memberchange_back_layout::Rect_interval)
end
#--------------------------------------------------------------------------
# ● 先頭の行の設定
#--------------------------------------------------------------------------
def top_row=(row)
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * (WD_memberchange_back_layout::Rect_height +
WD_memberchange_back_layout::Rect_interval)
end
#--------------------------------------------------------------------------
# ● 1 ページに表示できる行数の取得
#--------------------------------------------------------------------------
def page_row_max
return (height - padding*2 + WD_memberchange_back_layout::Rect_interval) /
(WD_memberchange_back_layout::Rect_height +
WD_memberchange_back_layout::Rect_interval)
end
#--------------------------------------------------------------------------
# ● 項目を描画する矩形の取得
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = WD_memberchange_back_layout::Rect_width
rect.height = WD_memberchange_back_layout::Rect_height
rect.x = index % col_max *
(rect.width + WD_memberchange_back_layout::Rect_spacing)
rect.y = index / col_max *
(rect.height + WD_memberchange_back_layout::Rect_interval)
rect
end
end
#==============================================================================
# ■ Window_MemberChangeStatus
#------------------------------------------------------------------------------
# アクターのステータスを表示するウィンドウです。
#==============================================================================
class Window_MemberChangeStatus < Window_Base
include WD_memberchange_commonmethod
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
x = WD_memberchange_status_layout::Window_x
y = WD_memberchange_status_layout::Window_y
width = WD_memberchange_status_layout::Window_width
height = WD_memberchange_status_layout::Window_height
super(x, y, width, height)
@actor = nil
refresh
end
#--------------------------------------------------------------------------
# ● アクターの設定
#--------------------------------------------------------------------------
def set_item(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
contents.font.size = 24
if @actor != nil
x0 = 0
y0 = 0
enabled = true
actor = @actor
if WD_memberchange_status_layout::Faceview
x = x0 + WD_memberchange_status_layout::Faceview_x
y = y0 + WD_memberchange_status_layout::Faceview_y
draw_actor_face(actor, x, y, enabled)
end
if WD_memberchange_status_layout::Charaview
x = x0 + WD_memberchange_status_layout::Charaview_x
y = y0 + WD_memberchange_status_layout::Charaview_y
draw_character(actor.character_name, actor.character_index, x, y, enabled)
end
if WD_memberchange_status_layout::Stateview == true
x = x0 + WD_memberchange_status_layout::Stateview_x
y = y0 + WD_memberchange_status_layout::Stateview_y
width = WD_memberchange_status_layout::Stateview_width
draw_actor_icons(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Nameview == true
x = x0 + WD_memberchange_status_layout::Nameview_x
y = y0 + WD_memberchange_status_layout::Nameview_y
width = WD_memberchange_status_layout::Nameview_width
draw_actor_name(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Classview == true
x = x0 + WD_memberchange_status_layout::Classview_x
y = y0 + WD_memberchange_status_layout::Classview_y
width = WD_memberchange_status_layout::Classview_width
draw_actor_class(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Nicknameview == true
x = x0 + WD_memberchange_status_layout::Nicknameview_x
y = y0 + WD_memberchange_status_layout::Nicknameview_y
width = WD_memberchange_status_layout::Nicknameview_width
draw_actor_nickname(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Lvview == true
x = x0 + WD_memberchange_status_layout::Lvview_x
y = y0 + WD_memberchange_status_layout::Lvview_y
width = WD_memberchange_status_layout::Lvview_width
draw_actor_level(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Hpgaugeview == true
x = x0 + WD_memberchange_status_layout::Hpgaugeview_x
y = y0 + WD_memberchange_status_layout::Hpgaugeview_y
width = WD_memberchange_status_layout::Hpgaugeview_width
draw_actor_hp(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Mpgaugeview == true
x = x0 + WD_memberchange_status_layout::Mpgaugeview_x
y = y0 + WD_memberchange_status_layout::Mpgaugeview_y
width = WD_memberchange_status_layout::Mpgaugeview_width
draw_actor_mp(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Tpview == true
x = x0 + WD_memberchange_status_layout::Tpview_x
y = y0 + WD_memberchange_status_layout::Tpview_y
width = WD_memberchange_status_layout::Tpview_width
draw_actor_tp(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Parameterview0 == true
x = x0 + WD_memberchange_status_layout::Parameterview0_x
y = y0 + WD_memberchange_status_layout::Parameterview0_y
width = WD_memberchange_status_layout::Parameterview0_width
draw_actor_param(actor, x, y, 0, width, enabled)
end
if WD_memberchange_status_layout::Parameterview1 == true
x = x0 + WD_memberchange_status_layout::Parameterview1_x
y = y0 + WD_memberchange_status_layout::Parameterview1_y
width = WD_memberchange_status_layout::Parameterview1_width
draw_actor_param(actor, x, y, 1, width, enabled)
end
if WD_memberchange_status_layout::Parameterview2 == true
x = x0 + WD_memberchange_status_layout::Parameterview2_x
y = y0 + WD_memberchange_status_layout::Parameterview2_y
width = WD_memberchange_status_layout::Parameterview2_width
draw_actor_param(actor, x, y, 2, width, enabled)
end
if WD_memberchange_status_layout::Parameterview3 == true
x = x0 + WD_memberchange_status_layout::Parameterview3_x
y = y0 + WD_memberchange_status_layout::Parameterview3_y
width = WD_memberchange_status_layout::Parameterview3_width
draw_actor_param(actor, x, y, 3, width, enabled)
end
if WD_memberchange_status_layout::Parameterview4 == true
x = x0 + WD_memberchange_status_layout::Parameterview4_x
y = y0 + WD_memberchange_status_layout::Parameterview4_y
width = WD_memberchange_status_layout::Parameterview4_width
draw_actor_param(actor, x, y, 4, width, enabled)
end
if WD_memberchange_status_layout::Parameterview5 == true
x = x0 + WD_memberchange_status_layout::Parameterview5_x
y = y0 + WD_memberchange_status_layout::Parameterview5_y
width = WD_memberchange_status_layout::Parameterview5_width
draw_actor_param(actor, x, y, 5, width, enabled)
end
if WD_memberchange_status_layout::Parameterview6 == true
x = x0 + WD_memberchange_status_layout::Parameterview6_x
y = y0 + WD_memberchange_status_layout::Parameterview6_y
width = WD_memberchange_status_layout::Parameterview6_width
draw_actor_param(actor, x, y, 6, width, enabled)
end
if WD_memberchange_status_layout::Parameterview7 == true
x = x0 + WD_memberchange_status_layout::Parameterview7_x
y = y0 + WD_memberchange_status_layout::Parameterview7_y
width = WD_memberchange_status_layout::Parameterview7_width
draw_actor_param(actor, x, y, 7, width, enabled)
end
if WD_memberchange_status_layout::Equipview0 == true
x = x0 + WD_memberchange_status_layout::Equipview0_x
y = y0 + WD_memberchange_status_layout::Equipview0_y
width = WD_memberchange_status_layout::Equipview0_width
draw_equip_item(actor, x, y, 0, width, enabled)
end
if WD_memberchange_status_layout::Equipview1 == true
x = x0 + WD_memberchange_status_layout::Equipview1_x
y = y0 + WD_memberchange_status_layout::Equipview1_y
width = WD_memberchange_status_layout::Equipview1_width
draw_equip_item(actor, x, y, 1, width, enabled)
end
if WD_memberchange_status_layout::Equipview2 == true
x = x0 + WD_memberchange_status_layout::Equipview2_x
y = y0 + WD_memberchange_status_layout::Equipview2_y
width = WD_memberchange_status_layout::Equipview2_width
draw_equip_item(actor, x, y, 2, width, enabled)
end
if WD_memberchange_status_layout::Equipview3 == true
x = x0 + WD_memberchange_status_layout::Equipview3_x
y = y0 + WD_memberchange_status_layout::Equipview3_y
width = WD_memberchange_status_layout::Equipview3_width
draw_equip_item(actor, x, y, 3, width, enabled)
end
if WD_memberchange_status_layout::Equipview4 == true
x = x0 + WD_memberchange_status_layout::Equipview4_x
y = y0 + WD_memberchange_status_layout::Equipview4_y
width = WD_memberchange_status_layout::Equipview4_width
draw_equip_item(actor, x, y, 4, width, enabled)
end
if WD_memberchange_status_layout::Expview1 == true
x = x0 + WD_memberchange_status_layout::Expview1_x
y = y0 + WD_memberchange_status_layout::Expview1_y
width = WD_memberchange_status_layout::Expview1_width
draw_exp_info1(actor, x, y, width, enabled)
end
if WD_memberchange_status_layout::Expview2 == true
x = x0 + WD_memberchange_status_layout::Expview2_x
y = y0 + WD_memberchange_status_layout::Expview2_y
width = WD_memberchange_status_layout::Expview2_width
draw_exp_info2(actor, x, y, width, enabled)
end
end
end
end
class Window_MemberChangeSort < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
x = WD_memberchange_sort_layout::Window_x
y = WD_memberchange_sort_layout::Window_y
width = WD_memberchange_sort_layout::Window_width
height = WD_memberchange_sort_layout::Window_height
super(x, y, width, height)
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
contents.font.size = 24
sortname = WD_memberchange_ini::Sort_names[
$game_variables[WD_memberchange_ini::Sort_variable]]
draw_text(0, 0, contents_width, line_height, sortname, 1)
end
end
#==============================================================================
# ■ Window_MemberChangeEliminate
#------------------------------------------------------------------------------
# アクター除籍の確認用ウィンドウです。
#==============================================================================
class Window_MemberChangeEliminate < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
x = WD_memberchange_eliminate_layout::Window_x
y = WD_memberchange_eliminate_layout::Window_y
width = WD_memberchange_eliminate_layout::Window_width
height = WD_memberchange_eliminate_layout::Window_height
super(x, y, width, height)
@data = [WD_memberchange_ini::Eliminate_command1,
WD_memberchange_ini::Eliminate_command2]
refresh
select(1)
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return WD_memberchange_eliminate_layout::Window_col
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
return 2
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect_for_text(index)
draw_text(rect.x, rect.y, contents_width, line_height, @data[index])
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_ok
Input.update
deactivate
if index == 0
Sound.play_ok
call_ok_handler
else
Sound.play_cancel
call_cancel_handler
end
end
end
#==============================================================================
# ■ Window_MemberChangeText
#------------------------------------------------------------------------------
# テキストを表示するウィンドウです。
#==============================================================================
class Window_MemberChangeText < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height, text, align)
@text = text
@align = align
super(x, y, width, height)
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
contents.font.size = 24
text = (@text).split(/\n/)
for i in 0...text.size
draw_text(0, line_height*i, contents_width, line_height, text[i], @align)
end
end
end