赞 0
VIP 0
好人卡 0
积分 1
经验 14813
最后登录 2016-11-13
在线时间 135 小时
Lv1.梦旅人
梦石 0
星屑 52
在线时间 135 小时
注册时间 2011-11-5
帖子 83
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 ji3rul4coco 于 2013-8-22 19:28 编辑
問題如下:
Q1(紅框):想把其中強化的功能去除,退出可去可不去(請問日文"退出"在哪改)?
Q2(藍框):因為我有用第二貨幣腳本,所以想改窗口高度,請問在哪修改?
Q3(綠框):因為顯示屬性對比時會遮住人物,所以想改窗口寬度,請問在哪修改?
Q4(綠框):想把成人物行走圖改成頭像(或者在腳本裡設定,從picture讀取圖片)?
Q5:希望看得懂得大大幫忙翻譯一下,我用的是google翻譯,不過看不懂翻譯結果=3=......
when M_S_C; text = "#{item.name}を生成しました"
when M_S_S; text = "#{item.name}に強化しました"
when M_N_P; text = "所持金錢不足"
when M_N_I; text = "所持素材不足"
when M_N_N; text = "これ以上、持てません"
when M_E_N; text = "裝備できません"
when M_E_D; text = "#{item.name}の裝備を外しました"
when M_E_C; text = "#{item.name}の裝備を■更しました"
when M_O_I; text = "所持品に入れました"
其他Q:請各位大大幫忙將運行腳本時會顯示日文的部分改成中文(測試時不曉得有沒有遺漏,要改的應該都在Q5了)
以下為腳本(按順序排列)
鍛造屋
#==============================================================================
# ■ VXAce-RGSS3-16 鍛冶屋 [Ver.1.0.0] by Claimh
#------------------------------------------------------------------------------
# ・武器/防具の鍛造・強化を行う鍛冶屋
# ・必要條件を滿たせば、必ず成功する
# ・使用可能な條件
# - お金
# - アイテムの有無
# ・鍛冶成功時にはお金とアイテム(消耗品のみ)が減算される
#------------------------------------------------------------------------------
#【畫面操作】
# Rボタン : パーティーメンバー表示(右)切り替え
# Lボタン : ステータス表示(下)切り替え
# Aボタン : アイテム詳細表示(ENABLE_INFO=trueの場合のみ)
# ← → ボタン : カテゴリ切り替え(カテゴリが複數ある場合のみ)
#------------------------------------------------------------------------------
# ★鍛冶屋の呼び出し方
# SceneManager.call(Scene_Blacksmith)
#------------------------------------------------------------------------------
# ★武器の鍛造 表示切り替え
# $game_system.bs.c_w[武器ID].visible = flag
# flag : 表示狀態(true=表示 false=非表示)
#------------------------------------------------------------------------------
# ★防具の鍛造 表示切り替え
# $game_system.bs.c_a[防具ID].visible = flag
# flag : 表示狀態(true=表示 false=非表示)
#------------------------------------------------------------------------------
# ★武器の強化 表示切り替え
# $game_system.bs.s_w[武器ID][強化後の武器ID].visible = flag
# flag : 表示狀態(true=表示 false=非表示)
#------------------------------------------------------------------------------
# ★防具の強化 表示切り替え
# $game_system.bs.s_a[防具ID][強化後の防具ID].visible = flag
# flag : 表示狀態(true=表示 false=非表示)
#==============================================================================
module Blacksmith
CT_ALL = 0
### システム設定 ###############################################################
# システムコマンド(1個以上選■)
# 0 : 鍛造
# 1 : 強化
# 2 : やめる
SYS_CMD = [ 0 , 1 , 2 ]
# モードコマンド(1個以上選■)
# 0 : 武器
# 1 : 防具
# 2 : やめる
MOD_CMD = [ 0 , 1 ]
# ステータスの表示パターン(1個以上選■、先頭は0:素材アイテム情報固定)
# 0 : 素材アイテム情報
# 1 : ■成アイテム情報
# 2 : パーティーステータス
# 3 : アクターステータス
ST_PTN = [ 0 , 1 , 2 , 3 ]
# ■張アイテム情報を表示する
# (注) trueにする場合は
# Window_BsItemInfo#draw_options
# に表示する內容を追加してください。
ENABLE_INFO = false
# 攻■力、防禦力で整列させる
SORT = true
# 成功時のSE
SUCCESS_SE = RPG::SE .new ( "Sword2" , 100 , 100 )
# Indexを記憶する
S_INDEX = false
### カテゴリ設定 ###############################################################
# 全カテゴリ表示を追加する
ADD_ALL = true
# 防具カテゴリの分け方
# true : 防具タイプごとに分ける
# false : 防具種別ごとに分ける
A_TYPE = false
# 武器カテゴリ表示用のアイコンindex
# [ALL用, 武器タイプ:1, 武器タイプ:2, …]
WT_ICON = [ 16 , 144 , 145 , 146 , 147 , 148 , 149 , 150 , 151 , 152 , 153 ,1738 ]
# 防具カテゴリ表示用のアイコンindex
# [ALL用, 防具タイプ:1, 防具タイプ:2, …]
AT_ICON = [ 16 , 168 , 171 , 169 , 170 , 160 , 161 ]
# AT_ICON = [16, 160, 164, 168, 176] # for 防具種類
# カテゴリに含めない武器タイプ
WT_NOT_USE = [ 12 ]
# カテゴリに含めない防具タイプ
AT_NOT_USE = [ ]
### 共通書式 ###################################################################
=begin
# 條件(6個まで表示)
[[アイテムID, 個數], …]
=end
### 武器鍛造 ###################################################################
=begin
C_WEAPON = {
武器ID => [所需之$$, [[鍛造需物品ID, 物品個數]], 初期表示(省略時はfalse)]
}
=end
C_WEAPON = {
1 => [ 100 , [ [ 1 , 1 ] ] , true ] ,
12 => [ 200 , [ [ 2 , 2 ] , [ 3 , 1 ] ] , true ] ,
23 => [ 300 , [ [ 1 , 1 ] , [ 2 , 1 ] , [ 3 , 1 ] , [ 4 , 1 ] , [ 5 , 1 ] , [ 6 , 1 ] ] , true ] ,
35 => [ 100 , [ [ 1 , 1 ] ] , true ] ,
46 => [ 500 , [ [ 2 , 2 ] , [ 5 , 2 ] ] , true ] ,
58 => [ 1000 , [ [ 2 , 2 ] , [ 4 , 1 ] ] , true ] ,
60 => [ 3000 , [ [ 3 , 2 ] , [ 4 , 1 ] ] , true ]
}
### 防具鍛造 ###################################################################
=begin
C_ARMOR[防具カテゴリIndex] = {
防具ID => [所需之$$, [[鍛造需物品ID, 物品個數]], 初期表示(省略時はfalse)]
}
=end
C_ARMOR = {
1 => [ 100 , [ [ 1 , 1 ] ] , true ] ,
2 => [ 500 , [ [ 2 , 2 ] ] , true ] ,
7 => [ 100 , [ [ 1 , 1 ] ] , true ] ,
8 => [ 500 , [ [ 2 , 2 ] ] , true ] ,
9 => [ 100 , [ [ 2 , 1 ] ] , true ] ,
13 => [ 500 , [ [ 2 , 2 ] ] , true ] ,
14 => [ 500 , [ [ 2 , 2 ] ] ] ,
16 => [ 500 , [ [ 2 , 2 ] ] ] ,
23 => [ 1000 , [ [ 10 , 2 ] ] ] ,
24 => [ 1000 , [ [ 12 , 2 ] ] ] ,
25 => [ 2000 , [ [ 15 , 1 ] ] ] ,
26 => [ 2000 , [ [ 20 , 1 ] ] ] ,
27 => [ 3000 , [ [ 22 , 2 ] ] ] ,
28 => [ 5000 , [ [ 24 , 2 ] ] ] ,
29 => [ 10000 , [ [ 1 , 40 ] ,[ 2 , 4 ] ] ] ,
30 => [ 50000 , [ [ 2 , 50 ] ,[ 5 , 4 ] ] ]
}
### 武器強化 ###################################################################
=begin
S_WEAPON = {
武器ID => {
強化後の武器ID => [■段, 條件(複數指定可), 初期表示(省略時はfalse)]
}
}
=end
S_WEAPON = {
1 => {
2 => [ 100 , [ [ 2 , 1 ] ] , true ]
} ,
2 => {
3 => [ 500 , [ [ 2 , 2 ] ] ] ,
4 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
3 => {
4 => [ 500 , [ [ 3 , 1 ] ] , true ] ,
5 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
5 => {
6 => [ 100 , [ [ 1 , 1 ] ] , true ]
} ,
6 => {
7 => [ 500 , [ [ 2 , 2 ] ] ]
} ,
8 => {
9 => [ 1500 , [ [ 3 , 1 ] ] , true ]
}
}
### 防具強化 ###################################################################
=begin
S_ARMOR = {
防具ID => {
強化後の防具ID => [■段, 條件(複數指定可), 初期表示(省略時はfalse)]
}
}
=end
S_ARMOR = {
1 => {
2 => [ 100 , [ [ 1 , 1 ] ] , true ]
} ,
2 => {
3 => [ 500 , [ [ 2 , 2 ] ] ] ,
4 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
3 => {
4 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
4 => {
5 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
5 => {
6 => [ 1000 , [ [ 1 , 10 ] ] , true ]
} ,
7 => {
8 => [ 500 , [ [ 2 , 2 ] ] ] ,
10 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
9 => {
11 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
11 => {
12 => [ 100 , [ [ 1 , 1 ] ] , true ]
} ,
10 => {
11 => [ 500 , [ [ 2 , 2 ] ] ] ,
12 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
11 => {
12 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
13 => {
16 => [ 100 , [ [ 1 , 1 ] ] , true ]
} ,
14 => {
15 => [ 500 , [ [ 2 , 2 ] ] ] ,
21 => [ 5000 , [ [ 3 , 1 ] ] ]
} ,
13 => {
16 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
15 => {
17 => [ 1000 , [ [ 3 , 2 ] ] ] ,
19 => [ 2000 , [ [ 3 , 2 ] ] ]
} ,
16 => {
20 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
17 => {
22 => [ 10000 , [ [ 1 , 1 ] ] , true ]
}
}
################################################################################
end
#==============================================================================
# ■ VXAce-RGSS3-16 鍛冶屋 [Ver.1.0.0] by Claimh
#------------------------------------------------------------------------------
# ・武器/防具の鍛造・強化を行う鍛冶屋
# ・必要條件を滿たせば、必ず成功する
# ・使用可能な條件
# - お金
# - アイテムの有無
# ・鍛冶成功時にはお金とアイテム(消耗品のみ)が減算される
#------------------------------------------------------------------------------
#【畫面操作】
# Rボタン : パーティーメンバー表示(右)切り替え
# Lボタン : ステータス表示(下)切り替え
# Aボタン : アイテム詳細表示(ENABLE_INFO=trueの場合のみ)
# ← → ボタン : カテゴリ切り替え(カテゴリが複數ある場合のみ)
#------------------------------------------------------------------------------
# ★鍛冶屋の呼び出し方
# SceneManager.call(Scene_Blacksmith)
#------------------------------------------------------------------------------
# ★武器の鍛造 表示切り替え
# $game_system.bs.c_w[武器ID].visible = flag
# flag : 表示狀態(true=表示 false=非表示)
#------------------------------------------------------------------------------
# ★防具の鍛造 表示切り替え
# $game_system.bs.c_a[防具ID].visible = flag
# flag : 表示狀態(true=表示 false=非表示)
#------------------------------------------------------------------------------
# ★武器の強化 表示切り替え
# $game_system.bs.s_w[武器ID][強化後の武器ID].visible = flag
# flag : 表示狀態(true=表示 false=非表示)
#------------------------------------------------------------------------------
# ★防具の強化 表示切り替え
# $game_system.bs.s_a[防具ID][強化後の防具ID].visible = flag
# flag : 表示狀態(true=表示 false=非表示)
#==============================================================================
module Blacksmith
CT_ALL = 0
### システム設定 ###############################################################
# システムコマンド(1個以上選■)
# 0 : 鍛造
# 1 : 強化
# 2 : やめる
SYS_CMD = [ 0 , 1 , 2 ]
# モードコマンド(1個以上選■)
# 0 : 武器
# 1 : 防具
# 2 : やめる
MOD_CMD = [ 0 , 1 ]
# ステータスの表示パターン(1個以上選■、先頭は0:素材アイテム情報固定)
# 0 : 素材アイテム情報
# 1 : ■成アイテム情報
# 2 : パーティーステータス
# 3 : アクターステータス
ST_PTN = [ 0 , 1 , 2 , 3 ]
# ■張アイテム情報を表示する
# (注) trueにする場合は
# Window_BsItemInfo#draw_options
# に表示する內容を追加してください。
ENABLE_INFO = false
# 攻■力、防禦力で整列させる
SORT = true
# 成功時のSE
SUCCESS_SE = RPG::SE .new ( "Sword2" , 100 , 100 )
# Indexを記憶する
S_INDEX = false
### カテゴリ設定 ###############################################################
# 全カテゴリ表示を追加する
ADD_ALL = true
# 防具カテゴリの分け方
# true : 防具タイプごとに分ける
# false : 防具種別ごとに分ける
A_TYPE = false
# 武器カテゴリ表示用のアイコンindex
# [ALL用, 武器タイプ:1, 武器タイプ:2, …]
WT_ICON = [ 16 , 144 , 145 , 146 , 147 , 148 , 149 , 150 , 151 , 152 , 153 ,1738 ]
# 防具カテゴリ表示用のアイコンindex
# [ALL用, 防具タイプ:1, 防具タイプ:2, …]
AT_ICON = [ 16 , 168 , 171 , 169 , 170 , 160 , 161 ]
# AT_ICON = [16, 160, 164, 168, 176] # for 防具種類
# カテゴリに含めない武器タイプ
WT_NOT_USE = [ 12 ]
# カテゴリに含めない防具タイプ
AT_NOT_USE = [ ]
### 共通書式 ###################################################################
=begin
# 條件(6個まで表示)
[[アイテムID, 個數], …]
=end
### 武器鍛造 ###################################################################
=begin
C_WEAPON = {
武器ID => [所需之$$, [[鍛造需物品ID, 物品個數]], 初期表示(省略時はfalse)]
}
=end
C_WEAPON = {
1 => [ 100 , [ [ 1 , 1 ] ] , true ] ,
12 => [ 200 , [ [ 2 , 2 ] , [ 3 , 1 ] ] , true ] ,
23 => [ 300 , [ [ 1 , 1 ] , [ 2 , 1 ] , [ 3 , 1 ] , [ 4 , 1 ] , [ 5 , 1 ] , [ 6 , 1 ] ] , true ] ,
35 => [ 100 , [ [ 1 , 1 ] ] , true ] ,
46 => [ 500 , [ [ 2 , 2 ] , [ 5 , 2 ] ] , true ] ,
58 => [ 1000 , [ [ 2 , 2 ] , [ 4 , 1 ] ] , true ] ,
60 => [ 3000 , [ [ 3 , 2 ] , [ 4 , 1 ] ] , true ]
}
### 防具鍛造 ###################################################################
=begin
C_ARMOR[防具カテゴリIndex] = {
防具ID => [所需之$$, [[鍛造需物品ID, 物品個數]], 初期表示(省略時はfalse)]
}
=end
C_ARMOR = {
1 => [ 100 , [ [ 1 , 1 ] ] , true ] ,
2 => [ 500 , [ [ 2 , 2 ] ] , true ] ,
7 => [ 100 , [ [ 1 , 1 ] ] , true ] ,
8 => [ 500 , [ [ 2 , 2 ] ] , true ] ,
9 => [ 100 , [ [ 2 , 1 ] ] , true ] ,
13 => [ 500 , [ [ 2 , 2 ] ] , true ] ,
14 => [ 500 , [ [ 2 , 2 ] ] ] ,
16 => [ 500 , [ [ 2 , 2 ] ] ] ,
23 => [ 1000 , [ [ 10 , 2 ] ] ] ,
24 => [ 1000 , [ [ 12 , 2 ] ] ] ,
25 => [ 2000 , [ [ 15 , 1 ] ] ] ,
26 => [ 2000 , [ [ 20 , 1 ] ] ] ,
27 => [ 3000 , [ [ 22 , 2 ] ] ] ,
28 => [ 5000 , [ [ 24 , 2 ] ] ] ,
29 => [ 10000 , [ [ 1 , 40 ] ,[ 2 , 4 ] ] ] ,
30 => [ 50000 , [ [ 2 , 50 ] ,[ 5 , 4 ] ] ]
}
### 武器強化 ###################################################################
=begin
S_WEAPON = {
武器ID => {
強化後の武器ID => [■段, 條件(複數指定可), 初期表示(省略時はfalse)]
}
}
=end
S_WEAPON = {
1 => {
2 => [ 100 , [ [ 2 , 1 ] ] , true ]
} ,
2 => {
3 => [ 500 , [ [ 2 , 2 ] ] ] ,
4 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
3 => {
4 => [ 500 , [ [ 3 , 1 ] ] , true ] ,
5 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
5 => {
6 => [ 100 , [ [ 1 , 1 ] ] , true ]
} ,
6 => {
7 => [ 500 , [ [ 2 , 2 ] ] ]
} ,
8 => {
9 => [ 1500 , [ [ 3 , 1 ] ] , true ]
}
}
### 防具強化 ###################################################################
=begin
S_ARMOR = {
防具ID => {
強化後の防具ID => [■段, 條件(複數指定可), 初期表示(省略時はfalse)]
}
}
=end
S_ARMOR = {
1 => {
2 => [ 100 , [ [ 1 , 1 ] ] , true ]
} ,
2 => {
3 => [ 500 , [ [ 2 , 2 ] ] ] ,
4 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
3 => {
4 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
4 => {
5 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
5 => {
6 => [ 1000 , [ [ 1 , 10 ] ] , true ]
} ,
7 => {
8 => [ 500 , [ [ 2 , 2 ] ] ] ,
10 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
9 => {
11 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
11 => {
12 => [ 100 , [ [ 1 , 1 ] ] , true ]
} ,
10 => {
11 => [ 500 , [ [ 2 , 2 ] ] ] ,
12 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
11 => {
12 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
13 => {
16 => [ 100 , [ [ 1 , 1 ] ] , true ]
} ,
14 => {
15 => [ 500 , [ [ 2 , 2 ] ] ] ,
21 => [ 5000 , [ [ 3 , 1 ] ] ]
} ,
13 => {
16 => [ 500 , [ [ 3 , 1 ] ] , true ]
} ,
15 => {
17 => [ 1000 , [ [ 3 , 2 ] ] ] ,
19 => [ 2000 , [ [ 3 , 2 ] ] ]
} ,
16 => {
20 => [ 1000 , [ [ 3 , 2 ] ] ]
} ,
17 => {
22 => [ 10000 , [ [ 1 , 1 ] ] , true ]
}
}
################################################################################
end
基礎
#==============================================================================
# ■ VXAce-RGSS3-16 鍛冶屋 [基本クラス] by Claimh
#==============================================================================
#==============================================================================
# ■ 基本クラス
#==============================================================================
module Blacksmith
DBG = true # 全て表示
C_W=0 ;C_A=1 ;S_W=2 ;S_A=3
T = [ "鍛造" , "強化" , "やめる" ]
# メッセージタイプ
module MesCmd
M_S_C = 0 # 鍛造成功
M_S_S = 1 # 強化成功
M_N_P = 10 # お金足りない
M_N_I = 11 # アイテム足りない
M_N_N = 12 # アイテムいっぱい
M_E_N = 20 # 裝備できない
M_E_D = 21 # 裝備外した
M_E_C = 22 # 裝備■更した
M_O_I = 30 # 所持品に入れた
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def self .conv_text ( type, item=nil )
case type
when M_S_C; text = "#{item.name}を鍛造しました"
when M_S_S; text = "#{item.name}に強化しました"
when M_N_P; text = "所持金錢不足"
when M_N_I; text = "所持素材不足"
when M_N_N; text = "これ以上、持てません"
when M_E_N; text = "裝備できません"
when M_E_D; text = "#{item.name}の裝備を外しました"
when M_E_C; text = "#{item.name}の裝備を■更しました"
when M_O_I; text = "所持品に入れました"
else ; p "bad arg" , type; return ""
end
return text
end
end
#--------------------------------------------------------------------------
# ● コマンド
#--------------------------------------------------------------------------
def self .sys_cmd
SYS_CMD.collect { |d| T[ d] }
end
def self .mod_cmd ( s)
text = [ "武器#{T[s]}" , "防具#{T[s]}" , "退出" ]
MOD_CMD.collect { |d| text[ d] }
end
#--------------------------------------------------------------------------
# ● シンボル
#--------------------------------------------------------------------------
def self .sys_symbol ( i)
[ :create , :pwup , :exit ] [ i]
end
def self .mod_symbol ( i)
[ :weapon , :armor , :exit ] [ i]
end
#--------------------------------------------------------------------------
# ● 設定情報參照
#--------------------------------------------------------------------------
def self .data ( t)
[ C_WEAPON, C_ARMOR, S_WEAPON, S_ARMOR] [ t]
end
#--------------------------------------------------------------------------
# ● カテゴリ設定情報參照
#--------------------------------------------------------------------------
def self .ctg ( t)
ids = [ ]
ids.push ( CT_ALL) if ADD_ALL
if t % 2 == 0 # weapon
$data_system .weapon_types .each_index do |i|
ids.push ( i) if i > 0 and !WT_NOT_USE.include ?( i)
end
else # armor
if A_TYPE
$data_system .armor_types .each_index do |i|
ids.push ( i) if i > 0 and !AT_NOT_USE.include ?( i)
end
else
ids += [ 1 , 2 , 3 , 4 ]
end
end
ids
end
#--------------------------------------------------------------------------
# ● データソート
#--------------------------------------------------------------------------
def self .sort ( list, t)
return [ ] if list.nil ?
return list unless SORT
case t # 攻■力・防禦力でソートする
when C_W, S_W; list.sort ! { |a,b| b.obj .params [ 2 ] - a.obj .params [ 2 ] }
when C_A, S_A; list.sort ! { |a,b| b.obj .params [ 3 ] - a.obj .params [ 3 ] }
end
return list
end
#--------------------------------------------------------------------------
# ● データPush
#--------------------------------------------------------------------------
def self .push ( list, d, t, c)
return list.push ( d) if c == CT_ALL
if t % 2 == 0 # weapon
list.push ( d) if d.obj .wtype_id == c
else # armor
if A_TYPE
list.push ( d) if d.obj .atype_id == c
else
list.push ( d) if d.obj .etype_id == c
end
end
return list
end
# 條件クラス
class Condition
attr_reader :id # 條件ID
attr_reader :num # 條件■
attr_reader :enable
def initialize( prm)
if prm.empty ?
@id = 0
@num = 0
@enable = true
else
@id = prm[ 0 ]
@num = prm[ 1 ]
end
end
def update_status
return enable?
end
def enable?
return ( @enable = true ) if @id == 0 or @num == 0
return ( @enable = ( pt_num >= @num ) )
end
def lose
return if @id == 0 or @num == 0
$game_party .lose_item ( obj, @num ) if obj.consumable # 消耗
end
def obj
return $data_items [ @id]
end
def pt_num
return $game_party .item_number ( obj)
end
end
# 個別データクラス
class CommonData
attr_writer :visible
attr_reader :price
attr_reader :cond
attr_reader :status
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( b_id, a_id, data)
@b_id = b_id
@a_id = a_id
@price = data[ 0 ]
@cond = data[ 1 ] .collect { |d| Condition.new ( d) }
@visible = data[ 2 ] .nil ? ? false : data[ 2 ]
@status = 0xFF
end
def id
@a_id
end
def size
@cond .size
end
def num
$game_party .item_number ( obj)
end
def gain
$game_party .gain_item ( obj, 1 )
end
def lose
$game_party .lose_item ( b_obj, 1 )
end
def equip( actor)
actor.change_equip ( actor.empty_slot ( obj.etype_id ) , obj)
end
#--------------------------------------------------------------------------
# ● 表示狀態
#--------------------------------------------------------------------------
def visible
@visible or DBG
end
#--------------------------------------------------------------------------
# ● ステータス更新
#--------------------------------------------------------------------------
ST_P = 0b001
ST_C = 0b010
ST_N = 0b100
def update_status
@status = 0
@status |= ST_P unless price?
@status |= ST_C unless cond_enable?
@status |= ST_N unless num?
return visible # @statusではなくvisibleを返す
end
def enable?
return ( @status == 0 )
end
def message
return MesCmd::M_N_P if ( @status & ST_P) == ST_P
return MesCmd::M_N_I if ( @status & ST_C) == ST_C
return MesCmd::M_N_N
end
#--------------------------------------------------------------------------
# ● 鍛冶可否判定
#--------------------------------------------------------------------------
def cond_enable?
return true if @cond .empty ?
@cond .all ? { |c| c.update_status }
end
def price?
@price <= $game_party .gold
end
def num?( n=1 )
( self .num + n) <= $game_party .max_item_number ( obj)
end
#--------------------------------------------------------------------------
# ● 鍛冶■行
#--------------------------------------------------------------------------
def execute( change=false , actor=nil )
$game_party .lose_gold ( @price)
@cond .each { |c| c.lose }
gain
equip( actor) if change
lose if @b_id != 0
end
#--------------------------------------------------------------------------
# ● 裝備可能メンバー
#--------------------------------------------------------------------------
def equippable_members
actors = $game_party .members .select { |a| a.equippable ?( obj) }
actors.collect { |a| a.index }
end
end
# 武器・防具クラス
class CommonWeapon < CommonData
def obj
$data_weapons [ @a_id]
end
def b_obj
$data_weapons [ @b_id]
end
end
class CommonArmor < CommonData
def obj
$data_armors [ @a_id]
end
def b_obj
$data_armors [ @b_id]
end
end
# リストクラス
class CreateList
attr_reader :equip_actors
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( type, b_id=0 )
@type = type
@b_id = b_id
reset_all
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def reset_all
@list = { }
@equip_actors = [ ]
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def reset( id)
case @type
when C_W; @list [ id] = CommonWeapon.new ( 0 , id, C_WEAPON[ id] )
when C_A; @list [ id] = CommonArmor.new ( 0 , id, C_ARMOR[ id] )
when S_W; @list [ id] = CommonWeapon.new ( @b_id, id, S_WEAPON[ @b_id] [ id] )
when S_A; @list [ id] = CommonArmor.new ( @b_id, id, S_ARMOR[ @b_id] [ id] )
end
return @list [ id]
end
#--------------------------------------------------------------------------
# ● オブジェクト參照
#--------------------------------------------------------------------------
def [ ] ( id)
return ( @list[ id] .nil ? ? reset( id) : @list [ id] )
end
#--------------------------------------------------------------------------
# ● カテゴリ別リスト鍛造(鍛造用)
#--------------------------------------------------------------------------
def make_list
mlist = [ ]
ids = ::Blacksmith.data ( @type) .keys .sort
ct = ::Blacksmith.ctg ( @type)
ids.each do |id|
d = self .[ ] ( id)
next unless d.update_status # リスト作るときにステータス更新
ct.each_index do |i|
mlist[ i] = [ ] if mlist[ i] .nil ?
mlist[ i] = ::Blacksmith.push ( mlist[ i] , d, @type , ct[ i] )
end
end
ct.each_index do |i|
mlist[ i] = ::Blacksmith.sort ( mlist[ i] , @type )
end
return mlist
end
#--------------------------------------------------------------------------
# ● 強化用メソッド
#--------------------------------------------------------------------------
def obj
case @type
when S_W; return $data_weapons [ @b_id]
when S_A; return $data_armors [ @b_id]
end
end
def enable?
return true
end
def num
return $game_party .item_number ( obj)
end
#--------------------------------------------------------------------------
# ● アイテム所持判定(裝備品含む)
#--------------------------------------------------------------------------
def has_item?
flag = ( self .num > 0 )
@equip_actors = [ ]
$game_party .members .each do |actor|
@equip_actors .push ( actor.index ) if equip_item?( actor)
end
return ( flag or ( @equip_actors.size > 0 ) )
end
#--------------------------------------------------------------------------
# ● アイテム裝備判定
#--------------------------------------------------------------------------
def equip_item?( actor)
actor.equips .include ?( obj)
end
#--------------------------------------------------------------------------
# ● リスト鍛造(強化用) ※カテゴリ不要
#--------------------------------------------------------------------------
def make_slist
slist = [ ]
ids = ::Blacksmith.data ( @type) [ @b_id] .keys .sort
ids.each do |id|
d = self .[ ] ( id)
slist.push ( d) if d.update_status # リスト作るときにステータス更新
end
return ::Blacksmith.sort ( slist, @type )
end
end
# リストクラス
class StrengthenList
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( type)
@type = type
reset_all
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def reset_all
@list = { }
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def reset( b_id)
@list [ b_id] = CreateList.new ( @type, b_id)
end
#--------------------------------------------------------------------------
# ● オブジェクト參照
#--------------------------------------------------------------------------
def [ ] ( b_id)
reset( b_id) if @list [ b_id] .nil ?
return @list [ b_id]
end
#--------------------------------------------------------------------------
# ● カテゴリ別リスト鍛造
#--------------------------------------------------------------------------
def make_list
mlist = [ ]
ids = ::Blacksmith.data ( @type) .keys .sort
ct = ::Blacksmith.ctg ( @type)
ids.each do |id|
d = self .[ ] ( id)
next unless d.has_item ? # 所持アイテムのみ有■
ct.each_index do |i|
mlist[ i] = [ ] if mlist[ i] .nil ?
num = 0
a_ids = ::Blacksmith.data ( @type) [ id] .keys
a_ids.each do |a_id|
if d[ a_id] .update_status # リスト作るときにステータス更新
num = 1 ; break
end
end
next if num == 0 # 全て非表示なら除外
mlist[ i] = ::Blacksmith.push ( mlist[ i] , d, @type , ct[ i] )
end
end
ct.each_index do |i|
mlist[ i] = ::Blacksmith.sort ( mlist[ i] , @type )
end
return mlist
end
end
# Blacksmithクラス
class Blacksmith
attr_reader :c_w
attr_reader :c_a
attr_reader :s_w
attr_reader :s_a
def initialize
reset_all
end
def reset_all
@c_w = CreateList.new ( C_W)
@c_a = CreateList.new ( C_A)
@s_w = StrengthenList.new ( S_W)
@s_a = StrengthenList.new ( S_A)
end
end
end ## module Blacksmith
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_reader :bs
alias initialize_blacksmith initialize
def initialize
initialize_blacksmith
@bs = Blacksmith::Blacksmith .new
end
end
#==============================================================================
# ■ VXAce-RGSS3-16 鍛冶屋 [基本クラス] by Claimh
#==============================================================================
#==============================================================================
# ■ 基本クラス
#==============================================================================
module Blacksmith
DBG = true # 全て表示
C_W=0 ;C_A=1 ;S_W=2 ;S_A=3
T = [ "鍛造" , "強化" , "やめる" ]
# メッセージタイプ
module MesCmd
M_S_C = 0 # 鍛造成功
M_S_S = 1 # 強化成功
M_N_P = 10 # お金足りない
M_N_I = 11 # アイテム足りない
M_N_N = 12 # アイテムいっぱい
M_E_N = 20 # 裝備できない
M_E_D = 21 # 裝備外した
M_E_C = 22 # 裝備■更した
M_O_I = 30 # 所持品に入れた
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def self .conv_text ( type, item=nil )
case type
when M_S_C; text = "#{item.name}を鍛造しました"
when M_S_S; text = "#{item.name}に強化しました"
when M_N_P; text = "所持金錢不足"
when M_N_I; text = "所持素材不足"
when M_N_N; text = "これ以上、持てません"
when M_E_N; text = "裝備できません"
when M_E_D; text = "#{item.name}の裝備を外しました"
when M_E_C; text = "#{item.name}の裝備を■更しました"
when M_O_I; text = "所持品に入れました"
else ; p "bad arg" , type; return ""
end
return text
end
end
#--------------------------------------------------------------------------
# ● コマンド
#--------------------------------------------------------------------------
def self .sys_cmd
SYS_CMD.collect { |d| T[ d] }
end
def self .mod_cmd ( s)
text = [ "武器#{T[s]}" , "防具#{T[s]}" , "退出" ]
MOD_CMD.collect { |d| text[ d] }
end
#--------------------------------------------------------------------------
# ● シンボル
#--------------------------------------------------------------------------
def self .sys_symbol ( i)
[ :create , :pwup , :exit ] [ i]
end
def self .mod_symbol ( i)
[ :weapon , :armor , :exit ] [ i]
end
#--------------------------------------------------------------------------
# ● 設定情報參照
#--------------------------------------------------------------------------
def self .data ( t)
[ C_WEAPON, C_ARMOR, S_WEAPON, S_ARMOR] [ t]
end
#--------------------------------------------------------------------------
# ● カテゴリ設定情報參照
#--------------------------------------------------------------------------
def self .ctg ( t)
ids = [ ]
ids.push ( CT_ALL) if ADD_ALL
if t % 2 == 0 # weapon
$data_system .weapon_types .each_index do |i|
ids.push ( i) if i > 0 and !WT_NOT_USE.include ?( i)
end
else # armor
if A_TYPE
$data_system .armor_types .each_index do |i|
ids.push ( i) if i > 0 and !AT_NOT_USE.include ?( i)
end
else
ids += [ 1 , 2 , 3 , 4 ]
end
end
ids
end
#--------------------------------------------------------------------------
# ● データソート
#--------------------------------------------------------------------------
def self .sort ( list, t)
return [ ] if list.nil ?
return list unless SORT
case t # 攻■力・防禦力でソートする
when C_W, S_W; list.sort ! { |a,b| b.obj .params [ 2 ] - a.obj .params [ 2 ] }
when C_A, S_A; list.sort ! { |a,b| b.obj .params [ 3 ] - a.obj .params [ 3 ] }
end
return list
end
#--------------------------------------------------------------------------
# ● データPush
#--------------------------------------------------------------------------
def self .push ( list, d, t, c)
return list.push ( d) if c == CT_ALL
if t % 2 == 0 # weapon
list.push ( d) if d.obj .wtype_id == c
else # armor
if A_TYPE
list.push ( d) if d.obj .atype_id == c
else
list.push ( d) if d.obj .etype_id == c
end
end
return list
end
# 條件クラス
class Condition
attr_reader :id # 條件ID
attr_reader :num # 條件■
attr_reader :enable
def initialize( prm)
if prm.empty ?
@id = 0
@num = 0
@enable = true
else
@id = prm[ 0 ]
@num = prm[ 1 ]
end
end
def update_status
return enable?
end
def enable?
return ( @enable = true ) if @id == 0 or @num == 0
return ( @enable = ( pt_num >= @num ) )
end
def lose
return if @id == 0 or @num == 0
$game_party .lose_item ( obj, @num ) if obj.consumable # 消耗
end
def obj
return $data_items [ @id]
end
def pt_num
return $game_party .item_number ( obj)
end
end
# 個別データクラス
class CommonData
attr_writer :visible
attr_reader :price
attr_reader :cond
attr_reader :status
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( b_id, a_id, data)
@b_id = b_id
@a_id = a_id
@price = data[ 0 ]
@cond = data[ 1 ] .collect { |d| Condition.new ( d) }
@visible = data[ 2 ] .nil ? ? false : data[ 2 ]
@status = 0xFF
end
def id
@a_id
end
def size
@cond .size
end
def num
$game_party .item_number ( obj)
end
def gain
$game_party .gain_item ( obj, 1 )
end
def lose
$game_party .lose_item ( b_obj, 1 )
end
def equip( actor)
actor.change_equip ( actor.empty_slot ( obj.etype_id ) , obj)
end
#--------------------------------------------------------------------------
# ● 表示狀態
#--------------------------------------------------------------------------
def visible
@visible or DBG
end
#--------------------------------------------------------------------------
# ● ステータス更新
#--------------------------------------------------------------------------
ST_P = 0b001
ST_C = 0b010
ST_N = 0b100
def update_status
@status = 0
@status |= ST_P unless price?
@status |= ST_C unless cond_enable?
@status |= ST_N unless num?
return visible # @statusではなくvisibleを返す
end
def enable?
return ( @status == 0 )
end
def message
return MesCmd::M_N_P if ( @status & ST_P) == ST_P
return MesCmd::M_N_I if ( @status & ST_C) == ST_C
return MesCmd::M_N_N
end
#--------------------------------------------------------------------------
# ● 鍛冶可否判定
#--------------------------------------------------------------------------
def cond_enable?
return true if @cond .empty ?
@cond .all ? { |c| c.update_status }
end
def price?
@price <= $game_party .gold
end
def num?( n=1 )
( self .num + n) <= $game_party .max_item_number ( obj)
end
#--------------------------------------------------------------------------
# ● 鍛冶■行
#--------------------------------------------------------------------------
def execute( change=false , actor=nil )
$game_party .lose_gold ( @price)
@cond .each { |c| c.lose }
gain
equip( actor) if change
lose if @b_id != 0
end
#--------------------------------------------------------------------------
# ● 裝備可能メンバー
#--------------------------------------------------------------------------
def equippable_members
actors = $game_party .members .select { |a| a.equippable ?( obj) }
actors.collect { |a| a.index }
end
end
# 武器・防具クラス
class CommonWeapon < CommonData
def obj
$data_weapons [ @a_id]
end
def b_obj
$data_weapons [ @b_id]
end
end
class CommonArmor < CommonData
def obj
$data_armors [ @a_id]
end
def b_obj
$data_armors [ @b_id]
end
end
# リストクラス
class CreateList
attr_reader :equip_actors
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( type, b_id=0 )
@type = type
@b_id = b_id
reset_all
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def reset_all
@list = { }
@equip_actors = [ ]
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def reset( id)
case @type
when C_W; @list [ id] = CommonWeapon.new ( 0 , id, C_WEAPON[ id] )
when C_A; @list [ id] = CommonArmor.new ( 0 , id, C_ARMOR[ id] )
when S_W; @list [ id] = CommonWeapon.new ( @b_id, id, S_WEAPON[ @b_id] [ id] )
when S_A; @list [ id] = CommonArmor.new ( @b_id, id, S_ARMOR[ @b_id] [ id] )
end
return @list [ id]
end
#--------------------------------------------------------------------------
# ● オブジェクト參照
#--------------------------------------------------------------------------
def [ ] ( id)
return ( @list[ id] .nil ? ? reset( id) : @list [ id] )
end
#--------------------------------------------------------------------------
# ● カテゴリ別リスト鍛造(鍛造用)
#--------------------------------------------------------------------------
def make_list
mlist = [ ]
ids = ::Blacksmith.data ( @type) .keys .sort
ct = ::Blacksmith.ctg ( @type)
ids.each do |id|
d = self .[ ] ( id)
next unless d.update_status # リスト作るときにステータス更新
ct.each_index do |i|
mlist[ i] = [ ] if mlist[ i] .nil ?
mlist[ i] = ::Blacksmith.push ( mlist[ i] , d, @type , ct[ i] )
end
end
ct.each_index do |i|
mlist[ i] = ::Blacksmith.sort ( mlist[ i] , @type )
end
return mlist
end
#--------------------------------------------------------------------------
# ● 強化用メソッド
#--------------------------------------------------------------------------
def obj
case @type
when S_W; return $data_weapons [ @b_id]
when S_A; return $data_armors [ @b_id]
end
end
def enable?
return true
end
def num
return $game_party .item_number ( obj)
end
#--------------------------------------------------------------------------
# ● アイテム所持判定(裝備品含む)
#--------------------------------------------------------------------------
def has_item?
flag = ( self .num > 0 )
@equip_actors = [ ]
$game_party .members .each do |actor|
@equip_actors .push ( actor.index ) if equip_item?( actor)
end
return ( flag or ( @equip_actors.size > 0 ) )
end
#--------------------------------------------------------------------------
# ● アイテム裝備判定
#--------------------------------------------------------------------------
def equip_item?( actor)
actor.equips .include ?( obj)
end
#--------------------------------------------------------------------------
# ● リスト鍛造(強化用) ※カテゴリ不要
#--------------------------------------------------------------------------
def make_slist
slist = [ ]
ids = ::Blacksmith.data ( @type) [ @b_id] .keys .sort
ids.each do |id|
d = self .[ ] ( id)
slist.push ( d) if d.update_status # リスト作るときにステータス更新
end
return ::Blacksmith.sort ( slist, @type )
end
end
# リストクラス
class StrengthenList
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( type)
@type = type
reset_all
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def reset_all
@list = { }
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def reset( b_id)
@list [ b_id] = CreateList.new ( @type, b_id)
end
#--------------------------------------------------------------------------
# ● オブジェクト參照
#--------------------------------------------------------------------------
def [ ] ( b_id)
reset( b_id) if @list [ b_id] .nil ?
return @list [ b_id]
end
#--------------------------------------------------------------------------
# ● カテゴリ別リスト鍛造
#--------------------------------------------------------------------------
def make_list
mlist = [ ]
ids = ::Blacksmith.data ( @type) .keys .sort
ct = ::Blacksmith.ctg ( @type)
ids.each do |id|
d = self .[ ] ( id)
next unless d.has_item ? # 所持アイテムのみ有■
ct.each_index do |i|
mlist[ i] = [ ] if mlist[ i] .nil ?
num = 0
a_ids = ::Blacksmith.data ( @type) [ id] .keys
a_ids.each do |a_id|
if d[ a_id] .update_status # リスト作るときにステータス更新
num = 1 ; break
end
end
next if num == 0 # 全て非表示なら除外
mlist[ i] = ::Blacksmith.push ( mlist[ i] , d, @type , ct[ i] )
end
end
ct.each_index do |i|
mlist[ i] = ::Blacksmith.sort ( mlist[ i] , @type )
end
return mlist
end
end
# Blacksmithクラス
class Blacksmith
attr_reader :c_w
attr_reader :c_a
attr_reader :s_w
attr_reader :s_a
def initialize
reset_all
end
def reset_all
@c_w = CreateList.new ( C_W)
@c_a = CreateList.new ( C_A)
@s_w = StrengthenList.new ( S_W)
@s_a = StrengthenList.new ( S_A)
end
end
end ## module Blacksmith
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_reader :bs
alias initialize_blacksmith initialize
def initialize
initialize_blacksmith
@bs = Blacksmith::Blacksmith .new
end
end
窗口
#==============================================================================
# ■ VXAce-RGSS3-16 鍛冶屋 [ウィンドウクラス] by Claimh
#==============================================================================
#==============================================================================
# ■ Window_BsSysCmd
#==============================================================================
class Window_BsSysCmd < Window_HorzCommand
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super ( 0 , fitting_height( 2 ) )
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
item_max
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
Blacksmith::SYS_CMD .each_index do |i|
add_command( Blacksmith.sys_cmd [ i] , Blacksmith.sys_symbol ( i) )
end
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
Graphics.width - 160
end
#--------------------------------------------------------------------------
# ● 固定?
#--------------------------------------------------------------------------
def fix?
item_max == 1
end
#--------------------------------------------------------------------------
# ● 終了コマンド?
#--------------------------------------------------------------------------
def exit ?
data == 2
end
#--------------------------------------------------------------------------
# ● indexデータ
#--------------------------------------------------------------------------
def data
Blacksmith::SYS_CMD [ @index]
end
end
#==============================================================================
# ■ Window_BsModCmd
#==============================================================================
class Window_BsModCmd < Window_BsSysCmd
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
[ url=home.php ?mod=space&uid=34008 ] @sys[ /url] = Blacksmith::SYS_CMD [ 0 ]
super
end
#--------------------------------------------------------------------------
# ● システム設定
#--------------------------------------------------------------------------
def data=( d)
[ url=home.php ?mod=space&uid=34008 ] @sys[ /url] = d
clear_command_list
make_command_list
refresh
self .index = 0
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
Blacksmith::MOD_CMD .each_index do |i|
add_command( Blacksmith.mod_cmd ( @sys) [ i] , Blacksmith.mod_symbol ( i) )
end
end
#--------------------------------------------------------------------------
# ● indexデータ
#--------------------------------------------------------------------------
def data
Blacksmith::MOD_CMD [ @index]
end
end
#==============================================================================
# ■ Window_BsCtg
#==============================================================================
class Window_BsCtg < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@type = 0
super ( 0 , fitting_height( 2 ) , Graphics.width - 160 , fitting_height( 1 ) )
hide.z = 200
@index_s = [ 0 , 0 ]
end
#--------------------------------------------------------------------------
# ● 固定?
#--------------------------------------------------------------------------
def fix?
Blacksmith.ctg ( @type) .size == 1
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
item_max
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
Blacksmith.ctg ( @type) .size
end
#--------------------------------------------------------------------------
# ● 橫に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 8
end
#--------------------------------------------------------------------------
# ● 項目を描畫する矩形の取得
#--------------------------------------------------------------------------
def item_rect( index)
rect = Rect.new
rect.width = 24
rect.height = item_height
rect.x = index % col_max * ( item_width + spacing)
rect.y = index / col_max * item_height
rect
end
#--------------------------------------------------------------------------
# ● ■更
#--------------------------------------------------------------------------
def change( t)
@index_s [ @type] = Blacksmith::S_INDEX ? [ url=home.php ?mod=space&uid=370741 ] @Index[ /url] : 0
@type = t
@list = t == 0 ? Blacksmith::WT_ICON : Blacksmith::AT_ICON
create_contents
refresh
self .index = @index_s [ @type]
self .index = 0 if @index < 0
end
#--------------------------------------------------------------------------
# ● 左シフト
#--------------------------------------------------------------------------
def shift_l
Sound.play_cursor
old_index = @index
cursor_left( true )
redraw_item( old_index)
redraw_item( @index)
end
#--------------------------------------------------------------------------
# ● 右シフト
#--------------------------------------------------------------------------
def shift_r
Sound.play_cursor
old_index = @index
cursor_right( true )
redraw_item( old_index)
redraw_item( @index)
end
#--------------------------------------------------------------------------
# ● 項目の描畫
#--------------------------------------------------------------------------
def draw_item( index)
draw_icon( @list[ index] , item_rect( index) .x , 0 , index == @index )
end
end
#==============================================================================
# ■ Sprite_BsTAG
#==============================================================================
class Sprite_BsTAG < Sprite
W = 100
H = 14
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( x, y, z, tag)
@viewport = Viewport.new ( x, y, W, H)
super ( @viewport)
self .viewport .z = z
self .bitmap = Bitmap.new ( W, H)
self .bitmap .font .size = 12
self .bitmap .font .color = Color.new ( 192 , 224 , 255 , 255 )
refresh( tag)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def dispose
super
@viewport .dispose
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh( tag)
self .bitmap .clear
self .bitmap .draw_text ( 0 , 0 , W, H, tag)
end
#--------------------------------------------------------------------------
# ● ウィンドウの表示
#--------------------------------------------------------------------------
def show
self .visible = true
self
end
#--------------------------------------------------------------------------
# ● ウィンドウの非表示
#--------------------------------------------------------------------------
def hide
self .visible = false
self
end
end
#==============================================================================
# ■ Window_BsListDummy
#==============================================================================
class Window_BsListDummy < Window_Base
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh( data=nil )
contents.clear
return if data.nil ?
draw_item( data)
end
#--------------------------------------------------------------------------
# ● 項目描畫
#--------------------------------------------------------------------------
def draw_item( data)
change_color( normal_color, data.enable ?)
x = 4
y = 0
draw_item_name( data.obj , x, y, data.enable ?, 220 )
if data.equip_actors .size > 0
draw_text( tag_p_x-60 , y, 80 , line_height, "[E]" , 2 )
end
draw_text( tag_n_x-50 , y, 80 , line_height, data.num .to_s , 2 )
end
#--------------------------------------------------------------------------
# ● タグ位置(價格)
#--------------------------------------------------------------------------
def tag_p_x
self .x + self .width - 160
end
#--------------------------------------------------------------------------
# ● タグ位置(所持數)
#--------------------------------------------------------------------------
def tag_n_x
self .x + self .width - 60
end
end
#==============================================================================
# ■ Window_BsListCmn
#==============================================================================
class Window_BsListCmn < Window_Selectable
attr_accessor :pt_window
attr_accessor :sts_window
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( x, y, w, h)
super ( x, y, w, h)
create_tag
@pt_window = @sts_window = nil
end
#--------------------------------------------------------------------------
# ● タグスプライト鍛造
#--------------------------------------------------------------------------
def create_tag
@sprite_p = Sprite_BsTAG.new ( tag_p_x, self .y +2 , win_z+10 , "價格" )
@sprite_n = Sprite_BsTAG.new ( tag_n_x, self .y +2 , win_z+10 , "所持數" )
end
#--------------------------------------------------------------------------
# ● タグ位置(價格)
#--------------------------------------------------------------------------
def tag_p_x
self .x + self .width - 160
end
#--------------------------------------------------------------------------
# ● タグ位置(所持數)
#--------------------------------------------------------------------------
def tag_n_x
self .x + self .width - 60
end
#--------------------------------------------------------------------------
# ● offset位置(sublist用)
#--------------------------------------------------------------------------
def offset
return 0
end
#--------------------------------------------------------------------------
# ● オブジェクト開放
#--------------------------------------------------------------------------
def dispose
super
@sprite_p .dispose
@sprite_n .dispose
end
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング■理
#--------------------------------------------------------------------------
def process_handling
return unless open ? && active
return process_ok if ok_enabled? && Input.trigger ?( :C )
return process_cancel if cancel_enabled? && Input.trigger ?( :B )
return process_pagedown if handle?( :pagedown ) && Input.trigger ?( :R )
return process_pageup if handle?( :pageup ) && Input.trigger ?( :L )
return process_info if handle?( :info ) && Input.trigger ?( :A )
return call_handler( :right ) if Input.repeat ?( :RIGHT )
return call_handler( :left ) if Input.repeat ?( :LEFT )
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの■理
#--------------------------------------------------------------------------
def process_ok
super
call_handler( :alert ) unless current_item_enabled?
end
#--------------------------------------------------------------------------
# ● L ボタン(PageUp)が押されたときの■理
#--------------------------------------------------------------------------
def process_pageup
Sound.play_cursor
Input.update
call_handler( :pageup )
end
#--------------------------------------------------------------------------
# ● R ボタン(PageDown)が押されたときの■理
#--------------------------------------------------------------------------
def process_pagedown
Sound.play_cursor
Input.update
call_handler( :pagedown )
end
#--------------------------------------------------------------------------
# ● 情報表示■理
#--------------------------------------------------------------------------
def process_info
if !data.nil ?
Sound.play_ok
Input.update
deactivate
call_handler( :info )
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● 選■項目の有■狀態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
enable?
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window .set_text ( item == nil ? "" : item.description )
@pt_window .item = @sts_window .item = self .data
end
end
#==============================================================================
# ■ Window_BsList
#==============================================================================
class Window_BsList < Window_BsListCmn
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( sys=0 , mod=0 , ctg=0 )
r = Rect.new
r.y = fitting_height( 2 ) + fitting_height( 1 )
r.width = Graphics.width -120
r.height = Graphics.height - r.y - fitting_height( 3 )
@data = [ nil , nil , nil , nil ]
@tmp_bit = Bitmap.new ( 1 , 1 )
@bitmap = [ [ ] ,[ ] ,[ ] ,[ ] ]
@index_s = [ [ ] ,[ ] ,[ ] ,[ ] ]
@sys = [ url=home.php ?mod=space&uid=277847 ] @MOD[ /url] = @ctg = -1
super ( r.x , r.y , r.width , r.height )
@dmy_win = Window_BsListDummy.new ( r.x , r.y , r.width , r.height )
self .z = win_z
change_t( sys*2 +mod, ctg)
hide.dummy_show
end
#--------------------------------------------------------------------------
# ● ウィンドウのZ軸
#--------------------------------------------------------------------------
def win_z
return 200
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウの表示
#--------------------------------------------------------------------------
def dummy_show
@dmy_win .show
self
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウの非表示
#--------------------------------------------------------------------------
def dummy_hide
@dmy_win .hide
self
end
#--------------------------------------------------------------------------
# ● オブジェクト開放
#--------------------------------------------------------------------------
def dispose
super
@tmp_bit .dispose
@bitmap .each_index { |i| dispose_bitmap( i) }
@dmy_win .dispose
end
#--------------------------------------------------------------------------
# ● Bitmap開放
#--------------------------------------------------------------------------
def dispose_bitmap( t)
return if @bitmap [ t] .nil ? or @bitmap [ t] .empty ?
@bitmap [ t] .each do |b|
unless b.nil ?
b.dispose
b = nil
end
end
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
return 0 if @data [ type] .nil ?
@data [ type] [ @ctg] .size
end
#--------------------------------------------------------------------------
# ● 動作タイプ
#--------------------------------------------------------------------------
C_W=0 ;C_A=1 ;S_W=2 ;S_A=3
def type
return ( @sys*2 + @mod )
end
#--------------------------------------------------------------------------
# ● 動作タイプ
#--------------------------------------------------------------------------
def type=( t)
@sys = t / 2
[ url=home.php ?mod=space&uid=277847 ] @MOD[ /url] = t % 2
@sprite_p .refresh ( @sys==0 ? "價格" : "裝備" )
end
#--------------------------------------------------------------------------
# ● カテゴリ
#--------------------------------------------------------------------------
def category( t)
Blacksmith.ctg ( t) .size
end
#--------------------------------------------------------------------------
# ● 鍛造/強化
#--------------------------------------------------------------------------
def sys_create?
return ( @sys == 0 )
end
#--------------------------------------------------------------------------
# ● システムモード切り替え
#--------------------------------------------------------------------------
def change_t( t, c=0 )
if self .type != t
push_index( self .type , @ctg )
self .type = t
@ctg = c
refresh_data( t) if @data [ t] .nil ?
self .contents = @bitmap [ t] [ c]
pop_index( t, c)
else
change_c( c)
end
end
#--------------------------------------------------------------------------
# ● カテゴリ切り替え
#--------------------------------------------------------------------------
def change_c( c)
if @ctg != c
push_index( self .type , @ctg )
@ctg = c
self .contents = @bitmap [ self .type ] [ c]
pop_index( self .type , c)
else
pop_index( self .type , c)
end
end
#--------------------------------------------------------------------------
# ● Index復元
#--------------------------------------------------------------------------
def pop_index( t, c)
self .index = ( @index_s[ t] [ c] < 0 ? 0 : @index_s [ t] [ c] )
end
#--------------------------------------------------------------------------
# ● Index記憶
#--------------------------------------------------------------------------
def push_index( t, c)
return if t < 0 or c < 0
@index_s [ t] [ c] = Blacksmith::S_INDEX ? @index : 0
end
#--------------------------------------------------------------------------
# ● データ初期化
#--------------------------------------------------------------------------
def refresh_data( t)
case t
when C_W; @data [ t] = $game_system .bs .c_w .make_list
when C_A; @data [ t] = $game_system .bs .c_a .make_list
when S_W; @data [ t] = $game_system .bs .s_w .make_list
when S_A; @data [ t] = $game_system .bs .s_a .make_list
end
refresh_t_bitmap( t)
end
#--------------------------------------------------------------------------
# ● ビットマップ初期化
#--------------------------------------------------------------------------
def refresh_t_bitmap( t)
dispose_bitmap( t)
@bitmap [ t] = [ ]
@index_s [ t] = [ ]
category( t) .times { |c| refresh_bitmap( t, c) }
end
#--------------------------------------------------------------------------
# ● カテゴリビットマップ初期化
#--------------------------------------------------------------------------
def refresh_bitmap( t, c)
num = @data [ t] [ c] .size
num = num == 0 ? 1 : num
@bitmap [ t] [ c] .dispose unless @bitmap [ t] [ c] .nil ?
@bitmap [ t] [ c] = Bitmap.new ( contents_width, num * line_height)
@bitmap [ t] [ c] .font .color = normal_color
@index_s [ t] [ c] = -1
i_refresh( t, c)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def i_refresh( t, c)
self .contents = @bitmap [ t] [ c]
contents.clear
@data [ t] [ c] .size .times { |i| draw_item( t, c, i) }
end
#--------------------------------------------------------------------------
# ● 全項目の描畫
#--------------------------------------------------------------------------
def draw_all_items
item_max.times { |i| draw_item( self .type , @ctg , i) }
end
#--------------------------------------------------------------------------
# ● 差分リフレッシュ
#--------------------------------------------------------------------------
def diff_refresh
@bitmap .each_index do |t|
refresh_data( t) unless @data [ t] .nil ?
end
t = self .type
c = @ctg
self .contents = @bitmap [ t] [ c]
@item_max = @data [ t] [ c] .size
self .index = @index >= @data [ t] [ c] .size ? ( @data[ t] [ c] .size -1 ) : @index
self .index = 0 if @index < 0
end
#--------------------------------------------------------------------------
# ● 項目描畫
#--------------------------------------------------------------------------
def draw_item( t, c, i)
itm = data_i( t, c, i)
change_color( normal_color, itm.enable ?)
x = 4
y = i * line_height
draw_item_name( itm.obj , x, y, itm.enable ?, 220 )
if t / 2 == 0 # create
draw_text( tag_p_x-60 , y, 80 , line_height, itm.price .to_s , 2 )
elsif itm.equip_actors .size > 0
draw_text( tag_p_x-60 , y, 80 , line_height, "[E]" , 2 )
end
draw_text( tag_n_x-50 , y, 80 , line_height, itm.num .to_s , 2 )
end
#--------------------------------------------------------------------------
# ● アイテム取得
#--------------------------------------------------------------------------
def item_list
return @data [ self .type ] [ @ctg]
end
def data_i( t, c, i)
return nil if i < 0 or i >= @data [ t] [ c] .size
return @data [ t] [ c] [ i]
end
def data
return data_i( self .type , @ctg , @index )
end
def item_i( t, c, i)
return nil if i < 0 or i >= @data [ t] [ c] .size
return @data [ t] [ c] [ i] .obj
end
def item
return item_i( self .type , @ctg , @index )
end
#--------------------------------------------------------------------------
# ● 有■Index?
#--------------------------------------------------------------------------
def enable_i?( t, c, i)
d = data_i( t, c, i)
return ( d.nil ? ? false : d.enable ?)
end
def enable?
return enable_i?( self .type , @ctg , @index )
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウのリフレッシュ
#--------------------------------------------------------------------------
def dummy_refresh
@dmy_win .refresh ( data)
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウのクリア
#--------------------------------------------------------------------------
def dummy_clear
@dmy_win .refresh ( nil )
end
end
#==============================================================================
# ■ Window_BsSList
#==============================================================================
class Window_BsSList < Window_BsListCmn
attr_accessor :pt_window
attr_accessor :sts_window
OFFSET = 16
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( win)
@data = nil
@slist = [ ]
l = line_height + standard_padding
super ( win.x +offset, win.y +l, win.width -offset, win.height -l)
hide
end
def win_z
return 210
end
def offset
return 16
end
#--------------------------------------------------------------------------
# ● ウィンドウの表示
#--------------------------------------------------------------------------
def show
@sprite_p .show
@sprite_n .show
super
end
#--------------------------F------------------------------------------------
# ● ウィンドウの非表示
#--------------------------------------------------------------------------
def hide
@sprite_p .hide
@sprite_n .hide
super
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
@slist .size
end
#--------------------------------------------------------------------------
# ● 起動
#--------------------------------------------------------------------------
def startup( data)
show.activate
if @data != data
@data = data
@slist = @data .make_slist
create_contents
change_color( normal_color)
refresh
end
self .index = 0
end
#--------------------------------------------------------------------------
# ● 項目描畫
#--------------------------------------------------------------------------
def draw_item( index)
itm = data_i( index)
change_color( normal_color, enable_i?( index) )
r = item_rect_for_text( index)
draw_item_name( itm.obj , r.x , r.y , enable_i?( index) , 220 )
draw_text( tag_p_x-60 -offset, r.y , 80 , line_height, itm.price .to_s , 2 )
draw_text( tag_n_x-50 -offset, r.y , 80 , line_height, itm.num .to_s , 2 )
end
#--------------------------------------------------------------------------
# ● アイテム取得
#--------------------------------------------------------------------------
def data_i( i)
return nil if i < 0
return @slist [ i]
end
def data
return data_i( @index)
end
def item_i( i)
return nil if i < 0
return @slist [ i] .obj
end
def item
return item_i( @index)
end
#--------------------------------------------------------------------------
# ● 有■Index?
#--------------------------------------------------------------------------
def enable_i?( i)
return data_i( i) .enable ?
end
def enable?
return enable_i?( @index)
end
end
#==============================================================================
# ■ Window_BsActors
#==============================================================================
class Window_BsActors < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@hh = @page = 0
@item = nil
clear_exchange
y = fitting_height( 2 ) + fitting_height( 1 )
h = Graphics.height - y - fitting_height( 3 )
super ( Graphics.width -120 , y, 120 , h)
unselect
refresh
end
#--------------------------------------------------------------------------
# ● 固定パターン?
#--------------------------------------------------------------------------
def fix?
item_max < page_size
end
#--------------------------------------------------------------------------
# ● 裝備交換可能か?
#--------------------------------------------------------------------------
def equip_exchange_ok?( actor, item)
return true unless @exchange
return false unless actor.equips .include ?( item)
equip_change_ok?( actor, item)
end
#--------------------------------------------------------------------------
# ● 裝備可能か?
#--------------------------------------------------------------------------
def equip_ok?( actor, item)
return false unless actor.equippable ?( item)
actor.slot_list ( item.etype_id ) .any ? { |s| actor.equip_change_ok ?( s) }
end
#--------------------------------------------------------------------------
# ● 裝備交換可能slotか?
#--------------------------------------------------------------------------
def equip_change_ok?( actor, item)
actor.slot_list ( item.etype_id ) .any ? { |s| actor.equip_change_ok ?( s) }
end
#--------------------------------------------------------------------------
# ● 可否判定
#--------------------------------------------------------------------------
def enable_i?( index)
return false if @item .nil ? or index < 0
a = data_i( index)
return false if !equip_exchange_ok?( a, @equip_item )
equip_ok?( a, @item .obj )
end
def enable?
return enable_i?( @index)
end
#--------------------------------------------------------------------------
# ● アクター情報
#--------------------------------------------------------------------------
def data_i( index)
return nil if index < 0
$game_party .members [ index]
end
def actor
data_i( @index)
end
#--------------------------------------------------------------------------
# ● 裝備交換モード
#--------------------------------------------------------------------------
def set_exchange( equip_item)
@exchange = true
@equip_item = equip_item
refresh
end
def clear_exchange( re=false )
@exchange = false
@equip_item = nil
refresh if re
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
$game_party .members .size
end
#--------------------------------------------------------------------------
# ● 項目の高さを取得
#--------------------------------------------------------------------------
def item_height
h = height - standard_padding * 2
h / page_size
end
#--------------------------------------------------------------------------
# ● 選■項目の有■狀態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
enable?
end
#--------------------------------------------------------------------------
# ● 一度に表示できるアクターの人數
#--------------------------------------------------------------------------
def page_size
return 4
end
#--------------------------------------------------------------------------
# ● 最大ページ數の取得
#--------------------------------------------------------------------------
def page_max
( item_max + page_size - 1 ) / page_size
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def next_page
@page = ( @page + 1 ) % page_max
self .top_row = @page * page_size
end
#--------------------------------------------------------------------------
# ● アイテムの設定
# item : 新しいアイテム
#--------------------------------------------------------------------------
def item=( item)
return if @item == item
@item = item
refresh
end
#--------------------------------------------------------------------------
# ● 項目の描畫
#--------------------------------------------------------------------------
def draw_item( index)
actor = data_i( index)
r = item_rect( index)
e = enable_i?( index)
hh = ( r.height +32 ) /2
draw_actor_graphic( actor, 20 , r.y + hh, e)
return if @item .nil ? or !@item.obj .is_a ?( RPG::EquipItem )
return unless equip_ok?( actor, @item .obj )
prms = @item .obj .is_a ?( RPG::Weapon ) ? [ 2 ,4 ] : [ 3 ,5 ]
equips = actor.equips .select { |a| a != nil }
equips = equips.select { |a| a.etype_id == @item .obj .etype_id }
r.y += r.height / 2 - line_height
prms.each_index do |i|
diff = diff_item_param( equips, prms[ i] )
draw_item_diff( 28 , r.y +i*( line_height) ,diff, e, prms[ i] )
end
end
#--------------------------------------------------------------------------
# ● グラフィックの描畫
#--------------------------------------------------------------------------
def draw_actor_graphic( actor, x, y, enble)
return if actor == nil
bitmap = Cache.character ( actor.character_name )
sign = actor.character_name [ /^[ \!\$] ./]
if sign != nil and sign.include ?( '$' )
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = actor.character_index
src_rect = Rect.new ( ( n%4 *3 +1 ) *cw, ( n/4 *4 ) *ch, cw, ch)
self .contents .blt ( x - cw / 2 , y - ch, bitmap, src_rect, enble ? 255 : translucent_alpha)
end
#--------------------------------------------------------------------------
# ● アイテムパラメータ差分取得
#--------------------------------------------------------------------------
def diff_item_param( equips, prm)
e_items = equips.sort { |a, b| b.params [ prm] - a.params [ prm] }
new_prm = e_items.empty ? ? 0 : e_items[ 0 ] .params [ prm]
return @item .obj .params [ prm] - new_prm
end
#--------------------------------------------------------------------------
# ● 裝備差分■の描畫
#--------------------------------------------------------------------------
def draw_item_diff( x, y, change, able, prm)
change_color( param_change_color( change) , able)
draw_text( x, y, contents_width-x-4 , line_height, Vocab::param( prm) +sprintf ( "%+d" ,change) , 2 )
end
end
#==============================================================================
# ■ Window_BsYesNo
#==============================================================================
class Window_BsYesNo < Window_Selectable
CMD = [ "はい" , "いいえ" ]
#--------------------------------------------------------------------------
# ● X座標
#--------------------------------------------------------------------------
def xx( w)
( Graphics.width -w) / 2
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
h = fitting_height( 3 )
y = ( Graphics.height - h) / 2
super ( xx( 200 ) , y, 200 , h)
hide.z = 500
@text = ""
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
item_max
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
CMD.size
end
#--------------------------------------------------------------------------
# ● テキスト表示
#--------------------------------------------------------------------------
def set_text( type, item=nil )
@text = Blacksmith::MesCmd .conv_text ( type, item)
w = contents.text_size ( @text) .width
self .width = w + standard_padding * 2
self .x = xx( self .width )
create_contents
refresh
show.activate .index = 1
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text( 4 , line_height*0 , contents_width, line_height, @text )
draw_text( 4 , line_height*1 , contents_width, line_height, "裝備しますか?" )
item_max.times { |i| draw_item( i) }
end
#--------------------------------------------------------------------------
# ● 項目の描畫
# index : 項目番號
#--------------------------------------------------------------------------
def draw_item( index)
draw_text( item_rect_for_text( index) , CMD[ index] , 1 )
end
#--------------------------------------------------------------------------
# ● 項目を描畫する矩形の取得
#--------------------------------------------------------------------------
def item_rect( index)
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * ( item_width + spacing)
rect.y = index / col_max * item_height + item_height*2
rect
end
end
#==============================================================================
# ■ Window_BsCaution
#==============================================================================
class Window_BsCaution < Window_Selectable
#--------------------------------------------------------------------------
# ● X座標
#--------------------------------------------------------------------------
def xx( w)
( Graphics.width -w) / 2
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
h = fitting_height( 1 )
y = ( Graphics.height - h) / 2
super ( xx( 240 ) , y, 240 , h)
@callback = nil
hide.z = 600
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def set_text( type, item=nil )
text = Blacksmith::MesCmd .conv_text ( type, item)
w = contents.text_size ( text) .width
self .width = w + standard_padding * 2
self .x = xx( self .width )
create_contents
draw_text( 0 , 0 , w, line_height, text, 1 )
show.activate .pause = true
set_callback( nil )
end
#--------------------------------------------------------------------------
# ● Callback登錄
#--------------------------------------------------------------------------
def set_callback( callback=nil )
@callback = callback
end
def get_callback
@callback
end
end
#==============================================================================
# ■ Window_BsStatus
#==============================================================================
class Window_BsStatus < Window_Selectable
M_MTRL = 0 # 素材アイテムステータス
M_ITEM = 1 # ■成アイテムステータス
M_PARTY = 2 # パーティーステータス
M_ACTOR = 3 # アクターステータス
PATTERN = Blacksmith::ST_PTN # 切り替えの並び順
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( type=0 )
@mode = M_MTRL
@type = type
@item = nil
super ( 0 , Graphics.height -fitting_height( 3 ) , Graphics.width , fitting_height( 3 ) )
mode_reset( type)
refresh
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
case @mode
when M_MTRL; return 6
when M_ITEM; return 8
when M_PARTY; return ( $game_party.members .size + page_size - 1 ) / page_size
when M_ACTOR; return $game_party .members .size
end
return 0
end
#--------------------------------------------------------------------------
# ● 橫に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 16
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
case @mode
when M_MTRL; return 2
when M_ITEM; return 4
when M_PARTY; return page_size
when M_ACTOR; return 1
end
return 0
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def page_size
case @mode
when M_MTRL; return 1
when M_ITEM; return 1
when M_PARTY; return 4
when M_ACTOR; return 1
end
return 0
end
#--------------------------------------------------------------------------
# ● 固定パターン?
#--------------------------------------------------------------------------
def fix?
return ( PATTERN.size <= 1 )
end
#--------------------------------------------------------------------------
# ● アイテムの設定
# item : 新しいアイテム
#--------------------------------------------------------------------------
def item=( item)
return if @item == item
@item = item
refresh
end
#--------------------------------------------------------------------------
# ● モードチェンジ[local]
#--------------------------------------------------------------------------
def change_local_mode
@local_idx += 1
if @local_idx >= item_max
@local_idx = 0
next_mode_t
end
refresh
end
#--------------------------------------------------------------------------
# ● モードチェンジ
#--------------------------------------------------------------------------
def change_mode
case @mode
when M_MTRL,M_ITEM; next_mode_t; refresh
when M_PARTY,M_ACTOR; change_local_mode
end
end
#--------------------------------------------------------------------------
# ● モードリセット
#--------------------------------------------------------------------------
def mode_reset( type)
@mode = M_MTRL
@type = type
next_mode if @type == 1 and !fix?
@local_idx = 0
end
#--------------------------------------------------------------------------
# ● 次のモードへ遷移
#--------------------------------------------------------------------------
def next_mode_t
next_mode
next_mode if @type == 1 and @mode == M_ITEM and !fix?
end
def next_mode
@mode = PATTERN[ ( ( PATTERN.index ( @mode) + 1 ) % PATTERN.size ) ]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
return if @item == nil
case @mode
when M_MTRL; refresh_material
when M_ITEM; refresh_item
when M_PARTY; refresh_party
when M_ACTOR; refresh_actor
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ : M_MTRL
#--------------------------------------------------------------------------
def refresh_material
return if @type == 1
change_color( normal_color)
@item .cond .size .times { |i| draw_material_i( i) }
end
#--------------------------------------------------------------------------
# ● 項目描畫 : M_MTRL
#--------------------------------------------------------------------------
def draw_material_i( index)
c = @item .cond [ index]
r = item_rect( index)
change_color( normal_color, c.enable )
draw_item_name( c.obj , r.x , r.y , c.enable )
draw_text( r.x +190 , r.y , 30 , line_height, c.pt_num , 2 )
draw_text( r.x +220 , r.y , 16 , line_height, "/" )
draw_text( r.x +224 , r.y , 30 , line_height, c.num , 2 )
end
#--------------------------------------------------------------------------
# ● リフレッシュ : M_ITEM
#--------------------------------------------------------------------------
def refresh_item
draw_item_name( @item.obj , 4 , 0 , true , 220 )
text = @item .obj .is_a ?( RPG::Weapon ) ?
$data_system .weapon_types [ @item.obj .wtype_id ] :
$data_system .armor_types [ @item.obj .atype_id ]
draw_text( 240 , 0 , 120 , line_height, "[#{text}]" )
# draw_text(240. 0, 120, line_height, $data_system.terms.etype[@item.obj.etype_id])
draw_item_prms
end
#--------------------------------------------------------------------------
# ● アイテムの上昇パラメータ描畫 : M_ITEM
#--------------------------------------------------------------------------
def draw_item_prms
8 .times do |i|
r = item_prm_rect( i)
r.width -= 10
change_color( system_color)
draw_text( r, $data_system .terms .params [ i] )
change_color( param_change_color( @item.obj .params [ i] ) )
draw_text( r, sprintf ( "%+d" , @item .obj .params [ i] ) , 2 )
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ : M_PARTY
#--------------------------------------------------------------------------
def refresh_party
start_index = @local_idx * page_size
size = [ page_size, $game_party .members .size - start_index] .min
size.times { |i| draw_item_party( i) }
end
#--------------------------------------------------------------------------
# ● 項目描畫 : M_PARTY
#--------------------------------------------------------------------------
def draw_item_party( index)
actor = $game_party .members [ index + @local_idx * page_size]
case @item .obj
when RPG::Item ; draw_item_party_i( actor, item_rect( index) .x )
when RPG::Weapon ; draw_item_party_e( actor, item_rect( index) .x , [ 2 , 4 ] )
when RPG::Armor ; draw_item_party_e( actor, item_rect( index) .x , [ 3 , 5 ] )
end
end
#--------------------------------------------------------------------------
# ● 項目描畫 : M_PARTY : RPG::Item
#--------------------------------------------------------------------------
def draw_item_party_i( actor, x)
draw_actor_name( actor, x, 0 )
draw_actor_hp( actor, x, line_height+4 )
draw_actor_mp( actor, x, line_height*2 +4 )
end
#--------------------------------------------------------------------------
# ● 項目描畫 : M_PARTY : RPG::Weapon/Armor
#--------------------------------------------------------------------------
def draw_item_party_e( actor, x, prms)
able = actor.equippable ?( @item.obj )
change_color( normal_color, able)
draw_text( x, 0 , 112 , line_height, actor.name )
prms.each_index do |i|
change_color( system_color, able)
draw_text( x, ( i+1 ) *line_height, 82 , line_height, $data_system .terms .params [ prms[ i] ] )
end
draw_diff_prms( actor, prms, x+10 , line_height) if able
end
#--------------------------------------------------------------------------
# ● パラメータ差分描畫
#--------------------------------------------------------------------------
def draw_diff_prms( actor, prms, x, y)
equips = actor.equips .select { |a| a != nil }
equips = equips.select { |a| a.etype_id == @item .obj .etype_id }
prms.each_index do |i|
diff = diff_item_param( equips, prms[ i] , prms[ 0 ] )
draw_item_diff( x, y+i*line_height, diff)
end
end
#--------------------------------------------------------------------------
# ● アイテムパラメータ差分取得
#--------------------------------------------------------------------------
def diff_item_param( equips, prm, dprm)
e_items = equips.sort { |a, b| b.params [ dprm] - a.params [ dprm] }
e_prm = e_items.empty ? ? 0 : e_items[ 0 ] .params [ prm]
return @item .obj .params [ prm] - e_prm
end
#--------------------------------------------------------------------------
# ● 裝備差分■の描畫
#--------------------------------------------------------------------------
def draw_item_diff( x, y, change)
change_color( param_change_color( change) )
draw_text( x, y, 110 , line_height, sprintf ( "%+d" , change) , 2 )
end
#--------------------------------------------------------------------------
# ● リフレッシュ : M_ACTOR
#--------------------------------------------------------------------------
def refresh_actor
actor = $game_party .members [ @local_idx]
able = @item .obj .is_a ?( RPG::Item ) ? true : actor.equippable ?( @item.obj )
type = @item .obj .is_a ?( RPG::Item ) ? -1 : @item .obj .etype_id
change_color( normal_color, able)
draw_text( 0 , 0 , 120 , line_height, actor.name )
case @item .obj
when RPG::Item ; draw_item_actor_i( actor)
when RPG::Weapon ; draw_item_actor_w( actor, able)
when RPG::Armor ; draw_item_actor_a( actor, able)
end
end
#--------------------------------------------------------------------------
# ● 項目の描畫 : M_ACTOR : RPG::Item
#--------------------------------------------------------------------------
def draw_item_actor_i( actor)
draw_actor_level( actor, 128 , 0 )
end
#--------------------------------------------------------------------------
# ● 裝備中アイテム描畫
#--------------------------------------------------------------------------
def draw_equip_items( items, able)
x = 128
text = " / "
items.size .times do |i|
if i > 0
draw_text( x, 0 , 32 , line_height, text)
x += contents.text_size ( text) .width
end
draw_item_name( items[ i] , x, 0 , able)
x += 24 + contents.text_size ( items[ i] .name ) .width
end
end
#--------------------------------------------------------------------------
# ● 項目の描畫 : M_ACTOR : RPG::Weapon
#--------------------------------------------------------------------------
def draw_item_actor_w( actor, able)
weapons = actor.weapons
draw_equip_items( weapons, able)
draw_diff_equip_params( actor, weapons, 2 , able)
end
#--------------------------------------------------------------------------
# ● 項目の描畫 : M_ACTOR : RPG::Armor
#--------------------------------------------------------------------------
def draw_item_actor_a( actor, able)
armors = actor.armors .select { |a| a.etype_id == @item .obj .etype_id }
draw_equip_items( armors, able)
draw_diff_equip_params( actor, armors, 3 , able)
end
#--------------------------------------------------------------------------
# ● 全パラメータの■動■描畫 : M_ACTOR
#--------------------------------------------------------------------------
def draw_diff_equip_params( actor, equips, dprm, able)
8 .times do |i|
r = item_prm_rect( i)
change_color( system_color, able)
draw_text( r.x , r.y , 82 , line_height, $data_system .terms .params [ i] )
draw_item_diff( r.x +r.width -120 , r.y , diff_item_param( equips, i, dprm) ) if able
end
end
#--------------------------------------------------------------------------
# ● 項目を描畫する矩形の取得
#--------------------------------------------------------------------------
def item_prm_rect( index)
rect = Rect.new
rect.width = contents_width / 4
rect.height = line_height
rect.x = index / 2 * rect.width
rect.y = index % 2 * line_height + line_height
rect
end
end
#==============================================================================
# ■ Window_BsItemInfo
#==============================================================================
class Window_BsItemInfo < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
r = Rect.new
r.y = fitting_height( 2 ) + fitting_height( 1 )
r.width = Graphics.width -120
r.height = Graphics.height - r.y - fitting_height( 3 )
@data = nil
super ( r.x , r.y , r.width , r.height )
hide
self .z = 700
end
#--------------------------------------------------------------------------
# ● 表示可否
#--------------------------------------------------------------------------
def enable?
Blacksmith::ENABLE_INFO
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング■理
#--------------------------------------------------------------------------
def process_handling
return unless open ? && active
return process_ok if ok_enabled? && Input.trigger ?( :C )
return process_cancel if cancel_enabled? && Input.trigger ?( :B )
return process_pagedown if handle?( :pagedown ) && Input.trigger ?( :R )
return process_pageup if handle?( :pageup ) && Input.trigger ?( :L )
return process_info if handle?( :info ) && Input.trigger ?( :A )
end
#--------------------------------------------------------------------------
# ● L ボタン(PageUp)が押されたときの■理
#--------------------------------------------------------------------------
def process_pageup
Sound.play_cursor
Input.update
call_handler( :pageup )
end
#--------------------------------------------------------------------------
# ● R ボタン(PageDown)が押されたときの■理
#--------------------------------------------------------------------------
def process_pagedown
Sound.play_cursor
Input.update
call_handler( :pagedown )
end
#--------------------------------------------------------------------------
# ● 情報表示■理
#--------------------------------------------------------------------------
def process_info
Sound.play_ok
Input.update
hide.deactivate
call_handler( :info )
end
#--------------------------------------------------------------------------
# ● 表示ON
#--------------------------------------------------------------------------
def item=( data)
show.activate
self .pause = true
return if @data == data
@data = data
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
return if @data .nil ?
draw_item_name( @data, 4 , 0 , true , 220 )
text = @data .is_a ?( RPG::Weapon ) ?
$data_system .weapon_types [ @data.wtype_id ] :
$data_system .armor_types [ @data.atype_id ]
draw_text( 240 , 0 , 120 , line_height, "[#{text}]" )
# draw_text(220. 0, 120, line_height, $data_system.terms.etype[@data.etype_id])
draw_options
end
#--------------------------------------------------------------------------
# ● オプション表示
#--------------------------------------------------------------------------
def draw_options
# 特になし…。
end
end
#==============================================================================
# ■ VXAce-RGSS3-16 鍛冶屋 [ウィンドウクラス] by Claimh
#==============================================================================
#==============================================================================
# ■ Window_BsSysCmd
#==============================================================================
class Window_BsSysCmd < Window_HorzCommand
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super ( 0 , fitting_height( 2 ) )
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
item_max
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
Blacksmith::SYS_CMD .each_index do |i|
add_command( Blacksmith.sys_cmd [ i] , Blacksmith.sys_symbol ( i) )
end
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
Graphics.width - 160
end
#--------------------------------------------------------------------------
# ● 固定?
#--------------------------------------------------------------------------
def fix?
item_max == 1
end
#--------------------------------------------------------------------------
# ● 終了コマンド?
#--------------------------------------------------------------------------
def exit ?
data == 2
end
#--------------------------------------------------------------------------
# ● indexデータ
#--------------------------------------------------------------------------
def data
Blacksmith::SYS_CMD [ @index]
end
end
#==============================================================================
# ■ Window_BsModCmd
#==============================================================================
class Window_BsModCmd < Window_BsSysCmd
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
[ url=home.php ?mod=space&uid=34008 ] @sys[ /url] = Blacksmith::SYS_CMD [ 0 ]
super
end
#--------------------------------------------------------------------------
# ● システム設定
#--------------------------------------------------------------------------
def data=( d)
[ url=home.php ?mod=space&uid=34008 ] @sys[ /url] = d
clear_command_list
make_command_list
refresh
self .index = 0
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
Blacksmith::MOD_CMD .each_index do |i|
add_command( Blacksmith.mod_cmd ( @sys) [ i] , Blacksmith.mod_symbol ( i) )
end
end
#--------------------------------------------------------------------------
# ● indexデータ
#--------------------------------------------------------------------------
def data
Blacksmith::MOD_CMD [ @index]
end
end
#==============================================================================
# ■ Window_BsCtg
#==============================================================================
class Window_BsCtg < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@type = 0
super ( 0 , fitting_height( 2 ) , Graphics.width - 160 , fitting_height( 1 ) )
hide.z = 200
@index_s = [ 0 , 0 ]
end
#--------------------------------------------------------------------------
# ● 固定?
#--------------------------------------------------------------------------
def fix?
Blacksmith.ctg ( @type) .size == 1
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
item_max
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
Blacksmith.ctg ( @type) .size
end
#--------------------------------------------------------------------------
# ● 橫に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 8
end
#--------------------------------------------------------------------------
# ● 項目を描畫する矩形の取得
#--------------------------------------------------------------------------
def item_rect( index)
rect = Rect.new
rect.width = 24
rect.height = item_height
rect.x = index % col_max * ( item_width + spacing)
rect.y = index / col_max * item_height
rect
end
#--------------------------------------------------------------------------
# ● ■更
#--------------------------------------------------------------------------
def change( t)
@index_s [ @type] = Blacksmith::S_INDEX ? [ url=home.php ?mod=space&uid=370741 ] @Index[ /url] : 0
@type = t
@list = t == 0 ? Blacksmith::WT_ICON : Blacksmith::AT_ICON
create_contents
refresh
self .index = @index_s [ @type]
self .index = 0 if @index < 0
end
#--------------------------------------------------------------------------
# ● 左シフト
#--------------------------------------------------------------------------
def shift_l
Sound.play_cursor
old_index = @index
cursor_left( true )
redraw_item( old_index)
redraw_item( @index)
end
#--------------------------------------------------------------------------
# ● 右シフト
#--------------------------------------------------------------------------
def shift_r
Sound.play_cursor
old_index = @index
cursor_right( true )
redraw_item( old_index)
redraw_item( @index)
end
#--------------------------------------------------------------------------
# ● 項目の描畫
#--------------------------------------------------------------------------
def draw_item( index)
draw_icon( @list[ index] , item_rect( index) .x , 0 , index == @index )
end
end
#==============================================================================
# ■ Sprite_BsTAG
#==============================================================================
class Sprite_BsTAG < Sprite
W = 100
H = 14
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( x, y, z, tag)
@viewport = Viewport.new ( x, y, W, H)
super ( @viewport)
self .viewport .z = z
self .bitmap = Bitmap.new ( W, H)
self .bitmap .font .size = 12
self .bitmap .font .color = Color.new ( 192 , 224 , 255 , 255 )
refresh( tag)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def dispose
super
@viewport .dispose
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh( tag)
self .bitmap .clear
self .bitmap .draw_text ( 0 , 0 , W, H, tag)
end
#--------------------------------------------------------------------------
# ● ウィンドウの表示
#--------------------------------------------------------------------------
def show
self .visible = true
self
end
#--------------------------------------------------------------------------
# ● ウィンドウの非表示
#--------------------------------------------------------------------------
def hide
self .visible = false
self
end
end
#==============================================================================
# ■ Window_BsListDummy
#==============================================================================
class Window_BsListDummy < Window_Base
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh( data=nil )
contents.clear
return if data.nil ?
draw_item( data)
end
#--------------------------------------------------------------------------
# ● 項目描畫
#--------------------------------------------------------------------------
def draw_item( data)
change_color( normal_color, data.enable ?)
x = 4
y = 0
draw_item_name( data.obj , x, y, data.enable ?, 220 )
if data.equip_actors .size > 0
draw_text( tag_p_x-60 , y, 80 , line_height, "[E]" , 2 )
end
draw_text( tag_n_x-50 , y, 80 , line_height, data.num .to_s , 2 )
end
#--------------------------------------------------------------------------
# ● タグ位置(價格)
#--------------------------------------------------------------------------
def tag_p_x
self .x + self .width - 160
end
#--------------------------------------------------------------------------
# ● タグ位置(所持數)
#--------------------------------------------------------------------------
def tag_n_x
self .x + self .width - 60
end
end
#==============================================================================
# ■ Window_BsListCmn
#==============================================================================
class Window_BsListCmn < Window_Selectable
attr_accessor :pt_window
attr_accessor :sts_window
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( x, y, w, h)
super ( x, y, w, h)
create_tag
@pt_window = @sts_window = nil
end
#--------------------------------------------------------------------------
# ● タグスプライト鍛造
#--------------------------------------------------------------------------
def create_tag
@sprite_p = Sprite_BsTAG.new ( tag_p_x, self .y +2 , win_z+10 , "價格" )
@sprite_n = Sprite_BsTAG.new ( tag_n_x, self .y +2 , win_z+10 , "所持數" )
end
#--------------------------------------------------------------------------
# ● タグ位置(價格)
#--------------------------------------------------------------------------
def tag_p_x
self .x + self .width - 160
end
#--------------------------------------------------------------------------
# ● タグ位置(所持數)
#--------------------------------------------------------------------------
def tag_n_x
self .x + self .width - 60
end
#--------------------------------------------------------------------------
# ● offset位置(sublist用)
#--------------------------------------------------------------------------
def offset
return 0
end
#--------------------------------------------------------------------------
# ● オブジェクト開放
#--------------------------------------------------------------------------
def dispose
super
@sprite_p .dispose
@sprite_n .dispose
end
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング■理
#--------------------------------------------------------------------------
def process_handling
return unless open ? && active
return process_ok if ok_enabled? && Input.trigger ?( :C )
return process_cancel if cancel_enabled? && Input.trigger ?( :B )
return process_pagedown if handle?( :pagedown ) && Input.trigger ?( :R )
return process_pageup if handle?( :pageup ) && Input.trigger ?( :L )
return process_info if handle?( :info ) && Input.trigger ?( :A )
return call_handler( :right ) if Input.repeat ?( :RIGHT )
return call_handler( :left ) if Input.repeat ?( :LEFT )
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの■理
#--------------------------------------------------------------------------
def process_ok
super
call_handler( :alert ) unless current_item_enabled?
end
#--------------------------------------------------------------------------
# ● L ボタン(PageUp)が押されたときの■理
#--------------------------------------------------------------------------
def process_pageup
Sound.play_cursor
Input.update
call_handler( :pageup )
end
#--------------------------------------------------------------------------
# ● R ボタン(PageDown)が押されたときの■理
#--------------------------------------------------------------------------
def process_pagedown
Sound.play_cursor
Input.update
call_handler( :pagedown )
end
#--------------------------------------------------------------------------
# ● 情報表示■理
#--------------------------------------------------------------------------
def process_info
if !data.nil ?
Sound.play_ok
Input.update
deactivate
call_handler( :info )
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● 選■項目の有■狀態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
enable?
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window .set_text ( item == nil ? "" : item.description )
@pt_window .item = @sts_window .item = self .data
end
end
#==============================================================================
# ■ Window_BsList
#==============================================================================
class Window_BsList < Window_BsListCmn
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( sys=0 , mod=0 , ctg=0 )
r = Rect.new
r.y = fitting_height( 2 ) + fitting_height( 1 )
r.width = Graphics.width -120
r.height = Graphics.height - r.y - fitting_height( 3 )
@data = [ nil , nil , nil , nil ]
@tmp_bit = Bitmap.new ( 1 , 1 )
@bitmap = [ [ ] ,[ ] ,[ ] ,[ ] ]
@index_s = [ [ ] ,[ ] ,[ ] ,[ ] ]
@sys = [ url=home.php ?mod=space&uid=277847 ] @MOD[ /url] = @ctg = -1
super ( r.x , r.y , r.width , r.height )
@dmy_win = Window_BsListDummy.new ( r.x , r.y , r.width , r.height )
self .z = win_z
change_t( sys*2 +mod, ctg)
hide.dummy_show
end
#--------------------------------------------------------------------------
# ● ウィンドウのZ軸
#--------------------------------------------------------------------------
def win_z
return 200
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウの表示
#--------------------------------------------------------------------------
def dummy_show
@dmy_win .show
self
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウの非表示
#--------------------------------------------------------------------------
def dummy_hide
@dmy_win .hide
self
end
#--------------------------------------------------------------------------
# ● オブジェクト開放
#--------------------------------------------------------------------------
def dispose
super
@tmp_bit .dispose
@bitmap .each_index { |i| dispose_bitmap( i) }
@dmy_win .dispose
end
#--------------------------------------------------------------------------
# ● Bitmap開放
#--------------------------------------------------------------------------
def dispose_bitmap( t)
return if @bitmap [ t] .nil ? or @bitmap [ t] .empty ?
@bitmap [ t] .each do |b|
unless b.nil ?
b.dispose
b = nil
end
end
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
return 0 if @data [ type] .nil ?
@data [ type] [ @ctg] .size
end
#--------------------------------------------------------------------------
# ● 動作タイプ
#--------------------------------------------------------------------------
C_W=0 ;C_A=1 ;S_W=2 ;S_A=3
def type
return ( @sys*2 + @mod )
end
#--------------------------------------------------------------------------
# ● 動作タイプ
#--------------------------------------------------------------------------
def type=( t)
@sys = t / 2
[ url=home.php ?mod=space&uid=277847 ] @MOD[ /url] = t % 2
@sprite_p .refresh ( @sys==0 ? "價格" : "裝備" )
end
#--------------------------------------------------------------------------
# ● カテゴリ
#--------------------------------------------------------------------------
def category( t)
Blacksmith.ctg ( t) .size
end
#--------------------------------------------------------------------------
# ● 鍛造/強化
#--------------------------------------------------------------------------
def sys_create?
return ( @sys == 0 )
end
#--------------------------------------------------------------------------
# ● システムモード切り替え
#--------------------------------------------------------------------------
def change_t( t, c=0 )
if self .type != t
push_index( self .type , @ctg )
self .type = t
@ctg = c
refresh_data( t) if @data [ t] .nil ?
self .contents = @bitmap [ t] [ c]
pop_index( t, c)
else
change_c( c)
end
end
#--------------------------------------------------------------------------
# ● カテゴリ切り替え
#--------------------------------------------------------------------------
def change_c( c)
if @ctg != c
push_index( self .type , @ctg )
@ctg = c
self .contents = @bitmap [ self .type ] [ c]
pop_index( self .type , c)
else
pop_index( self .type , c)
end
end
#--------------------------------------------------------------------------
# ● Index復元
#--------------------------------------------------------------------------
def pop_index( t, c)
self .index = ( @index_s[ t] [ c] < 0 ? 0 : @index_s [ t] [ c] )
end
#--------------------------------------------------------------------------
# ● Index記憶
#--------------------------------------------------------------------------
def push_index( t, c)
return if t < 0 or c < 0
@index_s [ t] [ c] = Blacksmith::S_INDEX ? @index : 0
end
#--------------------------------------------------------------------------
# ● データ初期化
#--------------------------------------------------------------------------
def refresh_data( t)
case t
when C_W; @data [ t] = $game_system .bs .c_w .make_list
when C_A; @data [ t] = $game_system .bs .c_a .make_list
when S_W; @data [ t] = $game_system .bs .s_w .make_list
when S_A; @data [ t] = $game_system .bs .s_a .make_list
end
refresh_t_bitmap( t)
end
#--------------------------------------------------------------------------
# ● ビットマップ初期化
#--------------------------------------------------------------------------
def refresh_t_bitmap( t)
dispose_bitmap( t)
@bitmap [ t] = [ ]
@index_s [ t] = [ ]
category( t) .times { |c| refresh_bitmap( t, c) }
end
#--------------------------------------------------------------------------
# ● カテゴリビットマップ初期化
#--------------------------------------------------------------------------
def refresh_bitmap( t, c)
num = @data [ t] [ c] .size
num = num == 0 ? 1 : num
@bitmap [ t] [ c] .dispose unless @bitmap [ t] [ c] .nil ?
@bitmap [ t] [ c] = Bitmap.new ( contents_width, num * line_height)
@bitmap [ t] [ c] .font .color = normal_color
@index_s [ t] [ c] = -1
i_refresh( t, c)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def i_refresh( t, c)
self .contents = @bitmap [ t] [ c]
contents.clear
@data [ t] [ c] .size .times { |i| draw_item( t, c, i) }
end
#--------------------------------------------------------------------------
# ● 全項目の描畫
#--------------------------------------------------------------------------
def draw_all_items
item_max.times { |i| draw_item( self .type , @ctg , i) }
end
#--------------------------------------------------------------------------
# ● 差分リフレッシュ
#--------------------------------------------------------------------------
def diff_refresh
@bitmap .each_index do |t|
refresh_data( t) unless @data [ t] .nil ?
end
t = self .type
c = @ctg
self .contents = @bitmap [ t] [ c]
@item_max = @data [ t] [ c] .size
self .index = @index >= @data [ t] [ c] .size ? ( @data[ t] [ c] .size -1 ) : @index
self .index = 0 if @index < 0
end
#--------------------------------------------------------------------------
# ● 項目描畫
#--------------------------------------------------------------------------
def draw_item( t, c, i)
itm = data_i( t, c, i)
change_color( normal_color, itm.enable ?)
x = 4
y = i * line_height
draw_item_name( itm.obj , x, y, itm.enable ?, 220 )
if t / 2 == 0 # create
draw_text( tag_p_x-60 , y, 80 , line_height, itm.price .to_s , 2 )
elsif itm.equip_actors .size > 0
draw_text( tag_p_x-60 , y, 80 , line_height, "[E]" , 2 )
end
draw_text( tag_n_x-50 , y, 80 , line_height, itm.num .to_s , 2 )
end
#--------------------------------------------------------------------------
# ● アイテム取得
#--------------------------------------------------------------------------
def item_list
return @data [ self .type ] [ @ctg]
end
def data_i( t, c, i)
return nil if i < 0 or i >= @data [ t] [ c] .size
return @data [ t] [ c] [ i]
end
def data
return data_i( self .type , @ctg , @index )
end
def item_i( t, c, i)
return nil if i < 0 or i >= @data [ t] [ c] .size
return @data [ t] [ c] [ i] .obj
end
def item
return item_i( self .type , @ctg , @index )
end
#--------------------------------------------------------------------------
# ● 有■Index?
#--------------------------------------------------------------------------
def enable_i?( t, c, i)
d = data_i( t, c, i)
return ( d.nil ? ? false : d.enable ?)
end
def enable?
return enable_i?( self .type , @ctg , @index )
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウのリフレッシュ
#--------------------------------------------------------------------------
def dummy_refresh
@dmy_win .refresh ( data)
end
#--------------------------------------------------------------------------
# ● ダミーウィンドウのクリア
#--------------------------------------------------------------------------
def dummy_clear
@dmy_win .refresh ( nil )
end
end
#==============================================================================
# ■ Window_BsSList
#==============================================================================
class Window_BsSList < Window_BsListCmn
attr_accessor :pt_window
attr_accessor :sts_window
OFFSET = 16
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( win)
@data = nil
@slist = [ ]
l = line_height + standard_padding
super ( win.x +offset, win.y +l, win.width -offset, win.height -l)
hide
end
def win_z
return 210
end
def offset
return 16
end
#--------------------------------------------------------------------------
# ● ウィンドウの表示
#--------------------------------------------------------------------------
def show
@sprite_p .show
@sprite_n .show
super
end
#--------------------------F------------------------------------------------
# ● ウィンドウの非表示
#--------------------------------------------------------------------------
def hide
@sprite_p .hide
@sprite_n .hide
super
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
@slist .size
end
#--------------------------------------------------------------------------
# ● 起動
#--------------------------------------------------------------------------
def startup( data)
show.activate
if @data != data
@data = data
@slist = @data .make_slist
create_contents
change_color( normal_color)
refresh
end
self .index = 0
end
#--------------------------------------------------------------------------
# ● 項目描畫
#--------------------------------------------------------------------------
def draw_item( index)
itm = data_i( index)
change_color( normal_color, enable_i?( index) )
r = item_rect_for_text( index)
draw_item_name( itm.obj , r.x , r.y , enable_i?( index) , 220 )
draw_text( tag_p_x-60 -offset, r.y , 80 , line_height, itm.price .to_s , 2 )
draw_text( tag_n_x-50 -offset, r.y , 80 , line_height, itm.num .to_s , 2 )
end
#--------------------------------------------------------------------------
# ● アイテム取得
#--------------------------------------------------------------------------
def data_i( i)
return nil if i < 0
return @slist [ i]
end
def data
return data_i( @index)
end
def item_i( i)
return nil if i < 0
return @slist [ i] .obj
end
def item
return item_i( @index)
end
#--------------------------------------------------------------------------
# ● 有■Index?
#--------------------------------------------------------------------------
def enable_i?( i)
return data_i( i) .enable ?
end
def enable?
return enable_i?( @index)
end
end
#==============================================================================
# ■ Window_BsActors
#==============================================================================
class Window_BsActors < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@hh = @page = 0
@item = nil
clear_exchange
y = fitting_height( 2 ) + fitting_height( 1 )
h = Graphics.height - y - fitting_height( 3 )
super ( Graphics.width -120 , y, 120 , h)
unselect
refresh
end
#--------------------------------------------------------------------------
# ● 固定パターン?
#--------------------------------------------------------------------------
def fix?
item_max < page_size
end
#--------------------------------------------------------------------------
# ● 裝備交換可能か?
#--------------------------------------------------------------------------
def equip_exchange_ok?( actor, item)
return true unless @exchange
return false unless actor.equips .include ?( item)
equip_change_ok?( actor, item)
end
#--------------------------------------------------------------------------
# ● 裝備可能か?
#--------------------------------------------------------------------------
def equip_ok?( actor, item)
return false unless actor.equippable ?( item)
actor.slot_list ( item.etype_id ) .any ? { |s| actor.equip_change_ok ?( s) }
end
#--------------------------------------------------------------------------
# ● 裝備交換可能slotか?
#--------------------------------------------------------------------------
def equip_change_ok?( actor, item)
actor.slot_list ( item.etype_id ) .any ? { |s| actor.equip_change_ok ?( s) }
end
#--------------------------------------------------------------------------
# ● 可否判定
#--------------------------------------------------------------------------
def enable_i?( index)
return false if @item .nil ? or index < 0
a = data_i( index)
return false if !equip_exchange_ok?( a, @equip_item )
equip_ok?( a, @item .obj )
end
def enable?
return enable_i?( @index)
end
#--------------------------------------------------------------------------
# ● アクター情報
#--------------------------------------------------------------------------
def data_i( index)
return nil if index < 0
$game_party .members [ index]
end
def actor
data_i( @index)
end
#--------------------------------------------------------------------------
# ● 裝備交換モード
#--------------------------------------------------------------------------
def set_exchange( equip_item)
@exchange = true
@equip_item = equip_item
refresh
end
def clear_exchange( re=false )
@exchange = false
@equip_item = nil
refresh if re
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
$game_party .members .size
end
#--------------------------------------------------------------------------
# ● 項目の高さを取得
#--------------------------------------------------------------------------
def item_height
h = height - standard_padding * 2
h / page_size
end
#--------------------------------------------------------------------------
# ● 選■項目の有■狀態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
enable?
end
#--------------------------------------------------------------------------
# ● 一度に表示できるアクターの人數
#--------------------------------------------------------------------------
def page_size
return 4
end
#--------------------------------------------------------------------------
# ● 最大ページ數の取得
#--------------------------------------------------------------------------
def page_max
( item_max + page_size - 1 ) / page_size
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def next_page
@page = ( @page + 1 ) % page_max
self .top_row = @page * page_size
end
#--------------------------------------------------------------------------
# ● アイテムの設定
# item : 新しいアイテム
#--------------------------------------------------------------------------
def item=( item)
return if @item == item
@item = item
refresh
end
#--------------------------------------------------------------------------
# ● 項目の描畫
#--------------------------------------------------------------------------
def draw_item( index)
actor = data_i( index)
r = item_rect( index)
e = enable_i?( index)
hh = ( r.height +32 ) /2
draw_actor_graphic( actor, 20 , r.y + hh, e)
return if @item .nil ? or !@item.obj .is_a ?( RPG::EquipItem )
return unless equip_ok?( actor, @item .obj )
prms = @item .obj .is_a ?( RPG::Weapon ) ? [ 2 ,4 ] : [ 3 ,5 ]
equips = actor.equips .select { |a| a != nil }
equips = equips.select { |a| a.etype_id == @item .obj .etype_id }
r.y += r.height / 2 - line_height
prms.each_index do |i|
diff = diff_item_param( equips, prms[ i] )
draw_item_diff( 28 , r.y +i*( line_height) ,diff, e, prms[ i] )
end
end
#--------------------------------------------------------------------------
# ● グラフィックの描畫
#--------------------------------------------------------------------------
def draw_actor_graphic( actor, x, y, enble)
return if actor == nil
bitmap = Cache.character ( actor.character_name )
sign = actor.character_name [ /^[ \!\$] ./]
if sign != nil and sign.include ?( '$' )
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = actor.character_index
src_rect = Rect.new ( ( n%4 *3 +1 ) *cw, ( n/4 *4 ) *ch, cw, ch)
self .contents .blt ( x - cw / 2 , y - ch, bitmap, src_rect, enble ? 255 : translucent_alpha)
end
#--------------------------------------------------------------------------
# ● アイテムパラメータ差分取得
#--------------------------------------------------------------------------
def diff_item_param( equips, prm)
e_items = equips.sort { |a, b| b.params [ prm] - a.params [ prm] }
new_prm = e_items.empty ? ? 0 : e_items[ 0 ] .params [ prm]
return @item .obj .params [ prm] - new_prm
end
#--------------------------------------------------------------------------
# ● 裝備差分■の描畫
#--------------------------------------------------------------------------
def draw_item_diff( x, y, change, able, prm)
change_color( param_change_color( change) , able)
draw_text( x, y, contents_width-x-4 , line_height, Vocab::param( prm) +sprintf ( "%+d" ,change) , 2 )
end
end
#==============================================================================
# ■ Window_BsYesNo
#==============================================================================
class Window_BsYesNo < Window_Selectable
CMD = [ "はい" , "いいえ" ]
#--------------------------------------------------------------------------
# ● X座標
#--------------------------------------------------------------------------
def xx( w)
( Graphics.width -w) / 2
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
h = fitting_height( 3 )
y = ( Graphics.height - h) / 2
super ( xx( 200 ) , y, 200 , h)
hide.z = 500
@text = ""
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
item_max
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
CMD.size
end
#--------------------------------------------------------------------------
# ● テキスト表示
#--------------------------------------------------------------------------
def set_text( type, item=nil )
@text = Blacksmith::MesCmd .conv_text ( type, item)
w = contents.text_size ( @text) .width
self .width = w + standard_padding * 2
self .x = xx( self .width )
create_contents
refresh
show.activate .index = 1
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text( 4 , line_height*0 , contents_width, line_height, @text )
draw_text( 4 , line_height*1 , contents_width, line_height, "裝備しますか?" )
item_max.times { |i| draw_item( i) }
end
#--------------------------------------------------------------------------
# ● 項目の描畫
# index : 項目番號
#--------------------------------------------------------------------------
def draw_item( index)
draw_text( item_rect_for_text( index) , CMD[ index] , 1 )
end
#--------------------------------------------------------------------------
# ● 項目を描畫する矩形の取得
#--------------------------------------------------------------------------
def item_rect( index)
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * ( item_width + spacing)
rect.y = index / col_max * item_height + item_height*2
rect
end
end
#==============================================================================
# ■ Window_BsCaution
#==============================================================================
class Window_BsCaution < Window_Selectable
#--------------------------------------------------------------------------
# ● X座標
#--------------------------------------------------------------------------
def xx( w)
( Graphics.width -w) / 2
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
h = fitting_height( 1 )
y = ( Graphics.height - h) / 2
super ( xx( 240 ) , y, 240 , h)
@callback = nil
hide.z = 600
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def set_text( type, item=nil )
text = Blacksmith::MesCmd .conv_text ( type, item)
w = contents.text_size ( text) .width
self .width = w + standard_padding * 2
self .x = xx( self .width )
create_contents
draw_text( 0 , 0 , w, line_height, text, 1 )
show.activate .pause = true
set_callback( nil )
end
#--------------------------------------------------------------------------
# ● Callback登錄
#--------------------------------------------------------------------------
def set_callback( callback=nil )
@callback = callback
end
def get_callback
@callback
end
end
#==============================================================================
# ■ Window_BsStatus
#==============================================================================
class Window_BsStatus < Window_Selectable
M_MTRL = 0 # 素材アイテムステータス
M_ITEM = 1 # ■成アイテムステータス
M_PARTY = 2 # パーティーステータス
M_ACTOR = 3 # アクターステータス
PATTERN = Blacksmith::ST_PTN # 切り替えの並び順
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize( type=0 )
@mode = M_MTRL
@type = type
@item = nil
super ( 0 , Graphics.height -fitting_height( 3 ) , Graphics.width , fitting_height( 3 ) )
mode_reset( type)
refresh
end
#--------------------------------------------------------------------------
# ● 項目數の取得
#--------------------------------------------------------------------------
def item_max
case @mode
when M_MTRL; return 6
when M_ITEM; return 8
when M_PARTY; return ( $game_party.members .size + page_size - 1 ) / page_size
when M_ACTOR; return $game_party .members .size
end
return 0
end
#--------------------------------------------------------------------------
# ● 橫に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 16
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
case @mode
when M_MTRL; return 2
when M_ITEM; return 4
when M_PARTY; return page_size
when M_ACTOR; return 1
end
return 0
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def page_size
case @mode
when M_MTRL; return 1
when M_ITEM; return 1
when M_PARTY; return 4
when M_ACTOR; return 1
end
return 0
end
#--------------------------------------------------------------------------
# ● 固定パターン?
#--------------------------------------------------------------------------
def fix?
return ( PATTERN.size <= 1 )
end
#--------------------------------------------------------------------------
# ● アイテムの設定
# item : 新しいアイテム
#--------------------------------------------------------------------------
def item=( item)
return if @item == item
@item = item
refresh
end
#--------------------------------------------------------------------------
# ● モードチェンジ[local]
#--------------------------------------------------------------------------
def change_local_mode
@local_idx += 1
if @local_idx >= item_max
@local_idx = 0
next_mode_t
end
refresh
end
#--------------------------------------------------------------------------
# ● モードチェンジ
#--------------------------------------------------------------------------
def change_mode
case @mode
when M_MTRL,M_ITEM; next_mode_t; refresh
when M_PARTY,M_ACTOR; change_local_mode
end
end
#--------------------------------------------------------------------------
# ● モードリセット
#--------------------------------------------------------------------------
def mode_reset( type)
@mode = M_MTRL
@type = type
next_mode if @type == 1 and !fix?
@local_idx = 0
end
#--------------------------------------------------------------------------
# ● 次のモードへ遷移
#--------------------------------------------------------------------------
def next_mode_t
next_mode
next_mode if @type == 1 and @mode == M_ITEM and !fix?
end
def next_mode
@mode = PATTERN[ ( ( PATTERN.index ( @mode) + 1 ) % PATTERN.size ) ]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
return if @item == nil
case @mode
when M_MTRL; refresh_material
when M_ITEM; refresh_item
when M_PARTY; refresh_party
when M_ACTOR; refresh_actor
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ : M_MTRL
#--------------------------------------------------------------------------
def refresh_material
return if @type == 1
change_color( normal_color)
@item .cond .size .times { |i| draw_material_i( i) }
end
#--------------------------------------------------------------------------
# ● 項目描畫 : M_MTRL
#--------------------------------------------------------------------------
def draw_material_i( index)
c = @item .cond [ index]
r = item_rect( index)
change_color( normal_color, c.enable )
draw_item_name( c.obj , r.x , r.y , c.enable )
draw_text( r.x +190 , r.y , 30 , line_height, c.pt_num , 2 )
draw_text( r.x +220 , r.y , 16 , line_height, "/" )
draw_text( r.x +224 , r.y , 30 , line_height, c.num , 2 )
end
#--------------------------------------------------------------------------
# ● リフレッシュ : M_ITEM
#--------------------------------------------------------------------------
def refresh_item
draw_item_name( @item.obj , 4 , 0 , true , 220 )
text = @item .obj .is_a ?( RPG::Weapon ) ?
$data_system .weapon_types [ @item.obj .wtype_id ] :
$data_system .armor_types [ @item.obj .atype_id ]
draw_text( 240 , 0 , 120 , line_height, "[#{text}]" )
# draw_text(240. 0, 120, line_height, $data_system.terms.etype[@item.obj.etype_id])
draw_item_prms
end
#--------------------------------------------------------------------------
# ● アイテムの上昇パラメータ描畫 : M_ITEM
#--------------------------------------------------------------------------
def draw_item_prms
8 .times do |i|
r = item_prm_rect( i)
r.width -= 10
change_color( system_color)
draw_text( r, $data_system .terms .params [ i] )
change_color( param_change_color( @item.obj .params [ i] ) )
draw_text( r, sprintf ( "%+d" , @item .obj .params [ i] ) , 2 )
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ : M_PARTY
#--------------------------------------------------------------------------
def refresh_party
start_index = @local_idx * page_size
size = [ page_size, $game_party .members .size - start_index] .min
size.times { |i| draw_item_party( i) }
end
#--------------------------------------------------------------------------
# ● 項目描畫 : M_PARTY
#--------------------------------------------------------------------------
def draw_item_party( index)
actor = $game_party .members [ index + @local_idx * page_size]
case @item .obj
when RPG::Item ; draw_item_party_i( actor, item_rect( index) .x )
when RPG::Weapon ; draw_item_party_e( actor, item_rect( index) .x , [ 2 , 4 ] )
when RPG::Armor ; draw_item_party_e( actor, item_rect( index) .x , [ 3 , 5 ] )
end
end
#--------------------------------------------------------------------------
# ● 項目描畫 : M_PARTY : RPG::Item
#--------------------------------------------------------------------------
def draw_item_party_i( actor, x)
draw_actor_name( actor, x, 0 )
draw_actor_hp( actor, x, line_height+4 )
draw_actor_mp( actor, x, line_height*2 +4 )
end
#--------------------------------------------------------------------------
# ● 項目描畫 : M_PARTY : RPG::Weapon/Armor
#--------------------------------------------------------------------------
def draw_item_party_e( actor, x, prms)
able = actor.equippable ?( @item.obj )
change_color( normal_color, able)
draw_text( x, 0 , 112 , line_height, actor.name )
prms.each_index do |i|
change_color( system_color, able)
draw_text( x, ( i+1 ) *line_height, 82 , line_height, $data_system .terms .params [ prms[ i] ] )
end
draw_diff_prms( actor, prms, x+10 , line_height) if able
end
#--------------------------------------------------------------------------
# ● パラメータ差分描畫
#--------------------------------------------------------------------------
def draw_diff_prms( actor, prms, x, y)
equips = actor.equips .select { |a| a != nil }
equips = equips.select { |a| a.etype_id == @item .obj .etype_id }
prms.each_index do |i|
diff = diff_item_param( equips, prms[ i] , prms[ 0 ] )
draw_item_diff( x, y+i*line_height, diff)
end
end
#--------------------------------------------------------------------------
# ● アイテムパラメータ差分取得
#--------------------------------------------------------------------------
def diff_item_param( equips, prm, dprm)
e_items = equips.sort { |a, b| b.params [ dprm] - a.params [ dprm] }
e_prm = e_items.empty ? ? 0 : e_items[ 0 ] .params [ prm]
return @item .obj .params [ prm] - e_prm
end
#--------------------------------------------------------------------------
# ● 裝備差分■の描畫
#--------------------------------------------------------------------------
def draw_item_diff( x, y, change)
change_color( param_change_color( change) )
draw_text( x, y, 110 , line_height, sprintf ( "%+d" , change) , 2 )
end
#--------------------------------------------------------------------------
# ● リフレッシュ : M_ACTOR
#--------------------------------------------------------------------------
def refresh_actor
actor = $game_party .members [ @local_idx]
able = @item .obj .is_a ?( RPG::Item ) ? true : actor.equippable ?( @item.obj )
type = @item .obj .is_a ?( RPG::Item ) ? -1 : @item .obj .etype_id
change_color( normal_color, able)
draw_text( 0 , 0 , 120 , line_height, actor.name )
case @item .obj
when RPG::Item ; draw_item_actor_i( actor)
when RPG::Weapon ; draw_item_actor_w( actor, able)
when RPG::Armor ; draw_item_actor_a( actor, able)
end
end
#--------------------------------------------------------------------------
# ● 項目の描畫 : M_ACTOR : RPG::Item
#--------------------------------------------------------------------------
def draw_item_actor_i( actor)
draw_actor_level( actor, 128 , 0 )
end
#--------------------------------------------------------------------------
# ● 裝備中アイテム描畫
#--------------------------------------------------------------------------
def draw_equip_items( items, able)
x = 128
text = " / "
items.size .times do |i|
if i > 0
draw_text( x, 0 , 32 , line_height, text)
x += contents.text_size ( text) .width
end
draw_item_name( items[ i] , x, 0 , able)
x += 24 + contents.text_size ( items[ i] .name ) .width
end
end
#--------------------------------------------------------------------------
# ● 項目の描畫 : M_ACTOR : RPG::Weapon
#--------------------------------------------------------------------------
def draw_item_actor_w( actor, able)
weapons = actor.weapons
draw_equip_items( weapons, able)
draw_diff_equip_params( actor, weapons, 2 , able)
end
#--------------------------------------------------------------------------
# ● 項目の描畫 : M_ACTOR : RPG::Armor
#--------------------------------------------------------------------------
def draw_item_actor_a( actor, able)
armors = actor.armors .select { |a| a.etype_id == @item .obj .etype_id }
draw_equip_items( armors, able)
draw_diff_equip_params( actor, armors, 3 , able)
end
#--------------------------------------------------------------------------
# ● 全パラメータの■動■描畫 : M_ACTOR
#--------------------------------------------------------------------------
def draw_diff_equip_params( actor, equips, dprm, able)
8 .times do |i|
r = item_prm_rect( i)
change_color( system_color, able)
draw_text( r.x , r.y , 82 , line_height, $data_system .terms .params [ i] )
draw_item_diff( r.x +r.width -120 , r.y , diff_item_param( equips, i, dprm) ) if able
end
end
#--------------------------------------------------------------------------
# ● 項目を描畫する矩形の取得
#--------------------------------------------------------------------------
def item_prm_rect( index)
rect = Rect.new
rect.width = contents_width / 4
rect.height = line_height
rect.x = index / 2 * rect.width
rect.y = index % 2 * line_height + line_height
rect
end
end
#==============================================================================
# ■ Window_BsItemInfo
#==============================================================================
class Window_BsItemInfo < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
r = Rect.new
r.y = fitting_height( 2 ) + fitting_height( 1 )
r.width = Graphics.width -120
r.height = Graphics.height - r.y - fitting_height( 3 )
@data = nil
super ( r.x , r.y , r.width , r.height )
hide
self .z = 700
end
#--------------------------------------------------------------------------
# ● 表示可否
#--------------------------------------------------------------------------
def enable?
Blacksmith::ENABLE_INFO
end
#--------------------------------------------------------------------------
# ● 桁數の取得
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング■理
#--------------------------------------------------------------------------
def process_handling
return unless open ? && active
return process_ok if ok_enabled? && Input.trigger ?( :C )
return process_cancel if cancel_enabled? && Input.trigger ?( :B )
return process_pagedown if handle?( :pagedown ) && Input.trigger ?( :R )
return process_pageup if handle?( :pageup ) && Input.trigger ?( :L )
return process_info if handle?( :info ) && Input.trigger ?( :A )
end
#--------------------------------------------------------------------------
# ● L ボタン(PageUp)が押されたときの■理
#--------------------------------------------------------------------------
def process_pageup
Sound.play_cursor
Input.update
call_handler( :pageup )
end
#--------------------------------------------------------------------------
# ● R ボタン(PageDown)が押されたときの■理
#--------------------------------------------------------------------------
def process_pagedown
Sound.play_cursor
Input.update
call_handler( :pagedown )
end
#--------------------------------------------------------------------------
# ● 情報表示■理
#--------------------------------------------------------------------------
def process_info
Sound.play_ok
Input.update
hide.deactivate
call_handler( :info )
end
#--------------------------------------------------------------------------
# ● 表示ON
#--------------------------------------------------------------------------
def item=( data)
show.activate
self .pause = true
return if @data == data
@data = data
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
return if @data .nil ?
draw_item_name( @data, 4 , 0 , true , 220 )
text = @data .is_a ?( RPG::Weapon ) ?
$data_system .weapon_types [ @data.wtype_id ] :
$data_system .armor_types [ @data.atype_id ]
draw_text( 240 , 0 , 120 , line_height, "[#{text}]" )
# draw_text(220. 0, 120, line_height, $data_system.terms.etype[@data.etype_id])
draw_options
end
#--------------------------------------------------------------------------
# ● オプション表示
#--------------------------------------------------------------------------
def draw_options
# 特になし…。
end
end
場景
#==============================================================================
# ■ VXAce-RGSS3-16 鍛冶屋 [シーンクラス] by Claimh
#==============================================================================
#==============================================================================
# ■ Scene_Blacksmith
#==============================================================================
class Scene_Blacksmith < Scene_MenuBase
include Blacksmith::MesCmd
#--------------------------------------------------------------------------
# ● 開始■理
#--------------------------------------------------------------------------
def start
super
create_sys_window
create_mod_window
create_ctg_window
@help_window = Window_Help.new
@gold_window = Window_Gold.new
@gold_window .x = @sys_window .width
@gold_window .y = @sys_window .y
@sts_window = Window_BsStatus.new ( @sys_window.data )
create_yn_window
create_mes_window
create_pt_window
create_info_window
create_list_window
create_sublist_window
#
if @sys_window .fix ?
@sys_window .hide
if @mod_window .fix ?
@mod_window .hide
@list_window .activate
@ctg_window .change ( @mod_window.data )
if @ctg_window .fix ? # sys/mod/ctg全て固定の場合はmodを表示
@mod_window .show
end
else
@mod_window .data = @sys_window .data
@mod_window .show .activate
end
else
@mod_window .hide
end
#
delete_help
#
@equip = false
@actor = nil
end
#--------------------------------------------------------------------------
# ● sys/mod/ctgが全て固定
#--------------------------------------------------------------------------
def all_fix?
if @sys_window .fix ? and @mod_window .fix ? and @ctg_window .fix ?
@sys_window .hide
@mod_window .show
@ctg_window .hide
end
end
#--------------------------------------------------------------------------
# ● ヘルプ消去
#--------------------------------------------------------------------------
def delete_help
@help_window .set_text ( "" )
@pt_window .item = @sts_window .item = nil
@sts_window .mode_reset ( @sys_window.data )
@list_window .dummy_clear
end
#--------------------------------------------------------------------------
# ● リストウィンドウ/サブリストウィンドウ
#--------------------------------------------------------------------------
def active_list_window
@sl_window .visible ? @sl_window : @list_window
end
#--------------------------------------------------------------------------
# ● システム選■ウィンドウ鍛造
#--------------------------------------------------------------------------
def create_sys_window
@sys_window = Window_BsSysCmd.new
@sys_window .set_handler ( :ok , method( :on_sys_ok ) )
@sys_window .set_handler ( :cancel , method( :return_scene ) )
end
#----------------------------------------------------------------------------
# ● システム選■ OK
#----------------------------------------------------------------------------
def on_sys_ok
return return_scene if @sys_window .exit ?
@sys_window .hide
unless @mod_window .fix ?
@mod_window .data = @sys_window .data
@mod_window .show .activate
@list_window .change_t ( @sys_window.data * 2 + @mod_window .data )
else
on_mod_ok
end
end
#--------------------------------------------------------------------------
# ● モード選■ウィンドウ鍛造
#--------------------------------------------------------------------------
def create_mod_window
@mod_window = Window_BsModCmd.new
@mod_window .set_handler ( :ok , method( :on_mod_ok ) )
@mod_window .set_handler ( :cancel , method( :on_mod_cancel ) )
@mod_window .hide
end
#----------------------------------------------------------------------------
# ● モード選■ OK
#----------------------------------------------------------------------------
def on_mod_ok
return return_scene if @mod_window .exit ?
@mod_window .hide
@sts_window .mode_reset ( @sys_window.data )
@list_window .show .dummy_hide .activate .change_t ( @sys_window.data * 2 + @mod_window .data )
@ctg_window .show .change ( @mod_window.data )
all_fix?
end
#----------------------------------------------------------------------------
# ● モード選■ Cancel
#----------------------------------------------------------------------------
def on_mod_cancel
return return_scene if @sys_window .fix ?
@mod_window .hide
@sys_window .show .activate
end
#--------------------------------------------------------------------------
# ● カテゴリウィンドウ鍛造
#--------------------------------------------------------------------------
def create_ctg_window
@ctg_window = Window_BsCtg.new
end
#--------------------------------------------------------------------------
# ● メッセージウィンドウ鍛造
#--------------------------------------------------------------------------
def create_mes_window
@mes_window = Window_BsCaution.new
@mes_window .set_handler ( :ok , method( :on_mes_ok ) )
@mes_window .set_handler ( :cancel , method( :on_mes_ok ) )
end
#--------------------------------------------------------------------------
# ● メッセージ OK
#--------------------------------------------------------------------------
def on_mes_ok
@mes_window .hide
do_callback
end
#----------------------------------------------------------------------------
# ● 予約■理■行
#----------------------------------------------------------------------------
CB_YN = 0
CB_S_PT = 1
CB_D_PT = 2
def do_callback
case @mes_window .get_callback
when CB_YN
@yn_window .show .activate
when CB_S_PT
@pt_window .activate .refresh
@pt_window .index = @elist [ 0 ]
when CB_D_PT
@pt_window .deactivate .unselect
when M_E_D, M_E_C
Sound.play_equip
@mes_window .set_text ( @mes_window.get_callback , @actor )
@actor = nil
else
active_list_window.activate
end
end
#--------------------------------------------------------------------------
# ● Infoウィンドウ鍛造
#--------------------------------------------------------------------------
def create_info_window
@info_window = Window_BsItemInfo.new
@info_window .set_handler ( :info , method( :on_info_ok ) )
@info_window .set_handler ( :cancel , method( :on_info_ok ) )
@info_window .set_handler ( :pagedown , method( :on_list_actors ) ) unless @pt_window .fix ?
@info_window .set_handler ( :pageup , method( :on_list_sts ) ) unless @sts_window .fix ?
end
#--------------------------------------------------------------------------
# ● Infoウィンドウ消去
#--------------------------------------------------------------------------
def on_info_ok
active_list_window.activate
end
#--------------------------------------------------------------------------
# ● Yes/No選■ウィンドウ鍛造
#--------------------------------------------------------------------------
def create_yn_window
@yn_window = Window_BsYesNo.new
@yn_window .set_handler ( :ok , method( :on_yn_ok ) )
@yn_window .set_handler ( :cancel , method( :on_yn_cancel ) )
end
#--------------------------------------------------------------------------
# ● Yes/No選■ OK
#--------------------------------------------------------------------------
def on_yn_ok
@yn_window .hide
if @yn_window .index == 0
@equip = true
@pt_window .index = 0
@pt_window .activate
else
on_yn_cancel
end
end
#--------------------------------------------------------------------------
# ● Yes/No選■ Cancel
#--------------------------------------------------------------------------
def on_yn_cancel
execute
@yn_window .hide
@sl_window .hide
@list_window .activate
end
#--------------------------------------------------------------------------
# ● パーティーウィンドウ鍛造
#--------------------------------------------------------------------------
def create_pt_window
@pt_window = Window_BsActors.new
@pt_window .set_handler ( :ok , method( :on_pt_ok ) )
end
#--------------------------------------------------------------------------
# ● パーティー選■ OK
#--------------------------------------------------------------------------
def on_pt_ok
execute( @pt_window.actor )
@mes_window .set_text ( M_E_C, @pt_window .actor )
@mes_window .set_callback ( CB_D_PT)
end
#--------------------------------------------------------------------------
# ● リストウィンドウ鍛造
#--------------------------------------------------------------------------
def create_list_window
@list_window = Window_BsList.new ( @sys_window.data , @mod_window .data )
@list_window .pt_window = @pt_window
@list_window .sts_window = @sts_window
@list_window .help_window = @help_window
@list_window .set_handler ( :ok , method( :on_list_ok ) )
@list_window .set_handler ( :cancel , method( :on_list_cancel ) )
@list_window .set_handler ( :right , method( :on_list_right ) )
@list_window .set_handler ( :left , method( :on_list_left ) )
@list_window .set_handler ( :pagedown , method( :on_list_actors ) ) unless @pt_window .fix ?
@list_window .set_handler ( :pageup , method( :on_list_sts ) ) unless @sts_window .fix ?
@list_window .set_handler ( :info , method( :on_list_info ) ) if @info_window .enable ?
@list_window .set_handler ( :alert , method( :on_list_alert ) )
end
#----------------------------------------------------------------------------
# ● リスト選■ OK
#----------------------------------------------------------------------------
def on_list_ok
@info_window .hide
if @list_window .sys_create ?
Blacksmith::SUCCESS_SE .play unless Blacksmith::SUCCESS_SE .nil ?
if @list_window .data .equippable_members .size == 0
@equip = false
execute
@mes_window .set_text ( M_S_C, @list_window .data .obj )
else
@yn_window .set_text ( M_S_C, @list_window .data .obj )
end
else
@sts_window .mode_reset ( 0 )
@sl_window .startup ( @list_window.data )
@list_window .hide .dummy_show .dummy_refresh
end
end
#----------------------------------------------------------------------------
# ● リスト選■ Cancel
#----------------------------------------------------------------------------
def on_list_cancel
@list_window .hide .dummy_show
@ctg_window .hide
@info_window .hide
delete_help
return @mod_window .show .activate unless @mod_window .fix ?
return @sys_window .show .activate unless @sys_window .fix ?
return_scene
end
#----------------------------------------------------------------------------
# ● リスト選■ Right
#----------------------------------------------------------------------------
def on_list_right
return if @ctg_window .fix ?
@ctg_window .shift_r
@list_window .change_c ( @ctg_window.index )
end
#----------------------------------------------------------------------------
# ● リスト選■ Left
#----------------------------------------------------------------------------
def on_list_left
return if @ctg_window .fix ?
@ctg_window .shift_l
@list_window .change_c ( @ctg_window.index )
end
#----------------------------------------------------------------------------
# ● リスト選■ アクター情報
#----------------------------------------------------------------------------
def on_list_actors
@pt_window .next_page
end
#----------------------------------------------------------------------------
# ● リスト選■ ステータス情報
#----------------------------------------------------------------------------
def on_list_sts
@sts_window .change_mode
end
#----------------------------------------------------------------------------
# ● リスト選■ アイテム情報
#----------------------------------------------------------------------------
def on_list_info
active_list_window.deactivate
@info_window .item = active_list_window.item
end
#----------------------------------------------------------------------------
# ● 警告メッセージ
#----------------------------------------------------------------------------
def on_list_alert
if @sl_window .visible
unless @sl_window .data .nil ?
@sl_window .deactivate
@mes_window .set_text ( @sl_window.data .message )
end
else
unless @list_window .data .nil ?
@list_window .deactivate
@mes_window .set_text ( @list_window.data .message )
end
end
end
#--------------------------------------------------------------------------
# ● サブリストウィンドウ鍛造
#--------------------------------------------------------------------------
def create_sublist_window
@sl_window = Window_BsSList.new ( @list_window)
@sl_window .pt_window = @pt_window
@sl_window .sts_window = @sts_window
@sl_window .help_window = @help_window
@sl_window .set_handler ( :ok , method( :on_slist_ok ) )
@sl_window .set_handler ( :cancel , method( :on_slist_cancel ) )
@sl_window .set_handler ( :pagedown , method( :on_list_actors ) ) unless @pt_window .fix ?
@sl_window .set_handler ( :pageup , method( :on_list_sts ) ) unless @sts_window .fix ?
@sl_window .set_handler ( :info , method( :on_list_info ) ) if @info_window .enable ?
@sl_window .set_handler ( :alert , method( :on_list_alert ) )
end
#--------------------------------------------------------------------------
# ● サブリスト選■ Ok
#--------------------------------------------------------------------------
def on_slist_ok
Blacksmith::SUCCESS_SE .play unless Blacksmith::SUCCESS_SE .nil ?
d = @list_window .data
if d.num == 0 # 所持品ない == 裝備品Only
# 強化したアイテムが裝備できるメンバーを抽出
@elist = d.equip_actors .select { |i| $game_party .members [ i] .equippable ?( @sl_window.data .obj ) }
if @elist .size > 1 # 複數人が裝備可能 → 選■
@equip = true
@pt_window .set_exchange ( d.obj )
@mes_window .set_text ( M_S_S, @sl_window .data .obj )
@mes_window .set_callback ( CB_S_PT)
elsif @elist .size == 1 # 一人しか裝備できない → 裝備交換
@actor = $game_party .members [ @elist[ 0 ] ]
@equip = true
@mes_window .set_text ( M_S_S, @sl_window .data .obj )
@mes_window .set_callback ( M_E_C)
execute( @actor)
else # 誰も裝備できない → 裝備を外す
@actor = $game_party .members [ d.equip_actors [ 0 ] ]
@equip = false
itm = @sl_window .data .obj
@actor .change_equip ( itm.is_a ?( RPG::Weapon ) ? 0 : ( itm.kind +1 ) , 0 )
@mes_window .set_text ( M_S_S, itm)
@mes_window .set_callback ( M_E_D)
execute( @actor)
end
else # 所持品がある場合、裝備中かどうかは無視
if @sl_window .data .equippable_members .size == 0
@equip = false
@mes_window .set_text ( M_S_S, @sl_window .data .obj )
execute
else
@yn_window .set_text ( M_S_S, @sl_window .data .obj )
end
end
end
#--------------------------------------------------------------------------
# ● サブリスト選■ Cancel
#--------------------------------------------------------------------------
def on_slist_cancel
@sl_window .hide
@sts_window .mode_reset ( @sys_window.data )
@list_window .show .dummy_hide .activate
@info_window .hide
end
#----------------------------------------------------------------------------
# ● 鍛治■行
#----------------------------------------------------------------------------
def execute( actor=nil )
if @list_window .sys_create ?
@list_window .data .execute ( @equip, actor)
else
@sl_window .data .execute ( @equip, actor)
@sts_window .mode_reset ( @sys_window.data )
end
@equip = false
@sl_window .hide .deactivate
@list_window .show .dummy_hide .activate .diff_refresh
@gold_window .refresh
@pt_window .clear_exchange ( true )
@sts_window .refresh
end
end
#==============================================================================
# ■ VXAce-RGSS3-16 鍛冶屋 [シーンクラス] by Claimh
#==============================================================================
#==============================================================================
# ■ Scene_Blacksmith
#==============================================================================
class Scene_Blacksmith < Scene_MenuBase
include Blacksmith::MesCmd
#--------------------------------------------------------------------------
# ● 開始■理
#--------------------------------------------------------------------------
def start
super
create_sys_window
create_mod_window
create_ctg_window
@help_window = Window_Help.new
@gold_window = Window_Gold.new
@gold_window .x = @sys_window .width
@gold_window .y = @sys_window .y
@sts_window = Window_BsStatus.new ( @sys_window.data )
create_yn_window
create_mes_window
create_pt_window
create_info_window
create_list_window
create_sublist_window
#
if @sys_window .fix ?
@sys_window .hide
if @mod_window .fix ?
@mod_window .hide
@list_window .activate
@ctg_window .change ( @mod_window.data )
if @ctg_window .fix ? # sys/mod/ctg全て固定の場合はmodを表示
@mod_window .show
end
else
@mod_window .data = @sys_window .data
@mod_window .show .activate
end
else
@mod_window .hide
end
#
delete_help
#
@equip = false
@actor = nil
end
#--------------------------------------------------------------------------
# ● sys/mod/ctgが全て固定
#--------------------------------------------------------------------------
def all_fix?
if @sys_window .fix ? and @mod_window .fix ? and @ctg_window .fix ?
@sys_window .hide
@mod_window .show
@ctg_window .hide
end
end
#--------------------------------------------------------------------------
# ● ヘルプ消去
#--------------------------------------------------------------------------
def delete_help
@help_window .set_text ( "" )
@pt_window .item = @sts_window .item = nil
@sts_window .mode_reset ( @sys_window.data )
@list_window .dummy_clear
end
#--------------------------------------------------------------------------
# ● リストウィンドウ/サブリストウィンドウ
#--------------------------------------------------------------------------
def active_list_window
@sl_window .visible ? @sl_window : @list_window
end
#--------------------------------------------------------------------------
# ● システム選■ウィンドウ鍛造
#--------------------------------------------------------------------------
def create_sys_window
@sys_window = Window_BsSysCmd.new
@sys_window .set_handler ( :ok , method( :on_sys_ok ) )
@sys_window .set_handler ( :cancel , method( :return_scene ) )
end
#----------------------------------------------------------------------------
# ● システム選■ OK
#----------------------------------------------------------------------------
def on_sys_ok
return return_scene if @sys_window .exit ?
@sys_window .hide
unless @mod_window .fix ?
@mod_window .data = @sys_window .data
@mod_window .show .activate
@list_window .change_t ( @sys_window.data * 2 + @mod_window .data )
else
on_mod_ok
end
end
#--------------------------------------------------------------------------
# ● モード選■ウィンドウ鍛造
#--------------------------------------------------------------------------
def create_mod_window
@mod_window = Window_BsModCmd.new
@mod_window .set_handler ( :ok , method( :on_mod_ok ) )
@mod_window .set_handler ( :cancel , method( :on_mod_cancel ) )
@mod_window .hide
end
#----------------------------------------------------------------------------
# ● モード選■ OK
#----------------------------------------------------------------------------
def on_mod_ok
return return_scene if @mod_window .exit ?
@mod_window .hide
@sts_window .mode_reset ( @sys_window.data )
@list_window .show .dummy_hide .activate .change_t ( @sys_window.data * 2 + @mod_window .data )
@ctg_window .show .change ( @mod_window.data )
all_fix?
end
#----------------------------------------------------------------------------
# ● モード選■ Cancel
#----------------------------------------------------------------------------
def on_mod_cancel
return return_scene if @sys_window .fix ?
@mod_window .hide
@sys_window .show .activate
end
#--------------------------------------------------------------------------
# ● カテゴリウィンドウ鍛造
#--------------------------------------------------------------------------
def create_ctg_window
@ctg_window = Window_BsCtg.new
end
#--------------------------------------------------------------------------
# ● メッセージウィンドウ鍛造
#--------------------------------------------------------------------------
def create_mes_window
@mes_window = Window_BsCaution.new
@mes_window .set_handler ( :ok , method( :on_mes_ok ) )
@mes_window .set_handler ( :cancel , method( :on_mes_ok ) )
end
#--------------------------------------------------------------------------
# ● メッセージ OK
#--------------------------------------------------------------------------
def on_mes_ok
@mes_window .hide
do_callback
end
#----------------------------------------------------------------------------
# ● 予約■理■行
#----------------------------------------------------------------------------
CB_YN = 0
CB_S_PT = 1
CB_D_PT = 2
def do_callback
case @mes_window .get_callback
when CB_YN
@yn_window .show .activate
when CB_S_PT
@pt_window .activate .refresh
@pt_window .index = @elist [ 0 ]
when CB_D_PT
@pt_window .deactivate .unselect
when M_E_D, M_E_C
Sound.play_equip
@mes_window .set_text ( @mes_window.get_callback , @actor )
@actor = nil
else
active_list_window.activate
end
end
#--------------------------------------------------------------------------
# ● Infoウィンドウ鍛造
#--------------------------------------------------------------------------
def create_info_window
@info_window = Window_BsItemInfo.new
@info_window .set_handler ( :info , method( :on_info_ok ) )
@info_window .set_handler ( :cancel , method( :on_info_ok ) )
@info_window .set_handler ( :pagedown , method( :on_list_actors ) ) unless @pt_window .fix ?
@info_window .set_handler ( :pageup , method( :on_list_sts ) ) unless @sts_window .fix ?
end
#--------------------------------------------------------------------------
# ● Infoウィンドウ消去
#--------------------------------------------------------------------------
def on_info_ok
active_list_window.activate
end
#--------------------------------------------------------------------------
# ● Yes/No選■ウィンドウ鍛造
#--------------------------------------------------------------------------
def create_yn_window
@yn_window = Window_BsYesNo.new
@yn_window .set_handler ( :ok , method( :on_yn_ok ) )
@yn_window .set_handler ( :cancel , method( :on_yn_cancel ) )
end
#--------------------------------------------------------------------------
# ● Yes/No選■ OK
#--------------------------------------------------------------------------
def on_yn_ok
@yn_window .hide
if @yn_window .index == 0
@equip = true
@pt_window .index = 0
@pt_window .activate
else
on_yn_cancel
end
end
#--------------------------------------------------------------------------
# ● Yes/No選■ Cancel
#--------------------------------------------------------------------------
def on_yn_cancel
execute
@yn_window .hide
@sl_window .hide
@list_window .activate
end
#--------------------------------------------------------------------------
# ● パーティーウィンドウ鍛造
#--------------------------------------------------------------------------
def create_pt_window
@pt_window = Window_BsActors.new
@pt_window .set_handler ( :ok , method( :on_pt_ok ) )
end
#--------------------------------------------------------------------------
# ● パーティー選■ OK
#--------------------------------------------------------------------------
def on_pt_ok
execute( @pt_window.actor )
@mes_window .set_text ( M_E_C, @pt_window .actor )
@mes_window .set_callback ( CB_D_PT)
end
#--------------------------------------------------------------------------
# ● リストウィンドウ鍛造
#--------------------------------------------------------------------------
def create_list_window
@list_window = Window_BsList.new ( @sys_window.data , @mod_window .data )
@list_window .pt_window = @pt_window
@list_window .sts_window = @sts_window
@list_window .help_window = @help_window
@list_window .set_handler ( :ok , method( :on_list_ok ) )
@list_window .set_handler ( :cancel , method( :on_list_cancel ) )
@list_window .set_handler ( :right , method( :on_list_right ) )
@list_window .set_handler ( :left , method( :on_list_left ) )
@list_window .set_handler ( :pagedown , method( :on_list_actors ) ) unless @pt_window .fix ?
@list_window .set_handler ( :pageup , method( :on_list_sts ) ) unless @sts_window .fix ?
@list_window .set_handler ( :info , method( :on_list_info ) ) if @info_window .enable ?
@list_window .set_handler ( :alert , method( :on_list_alert ) )
end
#----------------------------------------------------------------------------
# ● リスト選■ OK
#----------------------------------------------------------------------------
def on_list_ok
@info_window .hide
if @list_window .sys_create ?
Blacksmith::SUCCESS_SE .play unless Blacksmith::SUCCESS_SE .nil ?
if @list_window .data .equippable_members .size == 0
@equip = false
execute
@mes_window .set_text ( M_S_C, @list_window .data .obj )
else
@yn_window .set_text ( M_S_C, @list_window .data .obj )
end
else
@sts_window .mode_reset ( 0 )
@sl_window .startup ( @list_window.data )
@list_window .hide .dummy_show .dummy_refresh
end
end
#----------------------------------------------------------------------------
# ● リスト選■ Cancel
#----------------------------------------------------------------------------
def on_list_cancel
@list_window .hide .dummy_show
@ctg_window .hide
@info_window .hide
delete_help
return @mod_window .show .activate unless @mod_window .fix ?
return @sys_window .show .activate unless @sys_window .fix ?
return_scene
end
#----------------------------------------------------------------------------
# ● リスト選■ Right
#----------------------------------------------------------------------------
def on_list_right
return if @ctg_window .fix ?
@ctg_window .shift_r
@list_window .change_c ( @ctg_window.index )
end
#----------------------------------------------------------------------------
# ● リスト選■ Left
#----------------------------------------------------------------------------
def on_list_left
return if @ctg_window .fix ?
@ctg_window .shift_l
@list_window .change_c ( @ctg_window.index )
end
#----------------------------------------------------------------------------
# ● リスト選■ アクター情報
#----------------------------------------------------------------------------
def on_list_actors
@pt_window .next_page
end
#----------------------------------------------------------------------------
# ● リスト選■ ステータス情報
#----------------------------------------------------------------------------
def on_list_sts
@sts_window .change_mode
end
#----------------------------------------------------------------------------
# ● リスト選■ アイテム情報
#----------------------------------------------------------------------------
def on_list_info
active_list_window.deactivate
@info_window .item = active_list_window.item
end
#----------------------------------------------------------------------------
# ● 警告メッセージ
#----------------------------------------------------------------------------
def on_list_alert
if @sl_window .visible
unless @sl_window .data .nil ?
@sl_window .deactivate
@mes_window .set_text ( @sl_window.data .message )
end
else
unless @list_window .data .nil ?
@list_window .deactivate
@mes_window .set_text ( @list_window.data .message )
end
end
end
#--------------------------------------------------------------------------
# ● サブリストウィンドウ鍛造
#--------------------------------------------------------------------------
def create_sublist_window
@sl_window = Window_BsSList.new ( @list_window)
@sl_window .pt_window = @pt_window
@sl_window .sts_window = @sts_window
@sl_window .help_window = @help_window
@sl_window .set_handler ( :ok , method( :on_slist_ok ) )
@sl_window .set_handler ( :cancel , method( :on_slist_cancel ) )
@sl_window .set_handler ( :pagedown , method( :on_list_actors ) ) unless @pt_window .fix ?
@sl_window .set_handler ( :pageup , method( :on_list_sts ) ) unless @sts_window .fix ?
@sl_window .set_handler ( :info , method( :on_list_info ) ) if @info_window .enable ?
@sl_window .set_handler ( :alert , method( :on_list_alert ) )
end
#--------------------------------------------------------------------------
# ● サブリスト選■ Ok
#--------------------------------------------------------------------------
def on_slist_ok
Blacksmith::SUCCESS_SE .play unless Blacksmith::SUCCESS_SE .nil ?
d = @list_window .data
if d.num == 0 # 所持品ない == 裝備品Only
# 強化したアイテムが裝備できるメンバーを抽出
@elist = d.equip_actors .select { |i| $game_party .members [ i] .equippable ?( @sl_window.data .obj ) }
if @elist .size > 1 # 複數人が裝備可能 → 選■
@equip = true
@pt_window .set_exchange ( d.obj )
@mes_window .set_text ( M_S_S, @sl_window .data .obj )
@mes_window .set_callback ( CB_S_PT)
elsif @elist .size == 1 # 一人しか裝備できない → 裝備交換
@actor = $game_party .members [ @elist[ 0 ] ]
@equip = true
@mes_window .set_text ( M_S_S, @sl_window .data .obj )
@mes_window .set_callback ( M_E_C)
execute( @actor)
else # 誰も裝備できない → 裝備を外す
@actor = $game_party .members [ d.equip_actors [ 0 ] ]
@equip = false
itm = @sl_window .data .obj
@actor .change_equip ( itm.is_a ?( RPG::Weapon ) ? 0 : ( itm.kind +1 ) , 0 )
@mes_window .set_text ( M_S_S, itm)
@mes_window .set_callback ( M_E_D)
execute( @actor)
end
else # 所持品がある場合、裝備中かどうかは無視
if @sl_window .data .equippable_members .size == 0
@equip = false
@mes_window .set_text ( M_S_S, @sl_window .data .obj )
execute
else
@yn_window .set_text ( M_S_S, @sl_window .data .obj )
end
end
end
#--------------------------------------------------------------------------
# ● サブリスト選■ Cancel
#--------------------------------------------------------------------------
def on_slist_cancel
@sl_window .hide
@sts_window .mode_reset ( @sys_window.data )
@list_window .show .dummy_hide .activate
@info_window .hide
end
#----------------------------------------------------------------------------
# ● 鍛治■行
#----------------------------------------------------------------------------
def execute( actor=nil )
if @list_window .sys_create ?
@list_window .data .execute ( @equip, actor)
else
@sl_window .data .execute ( @equip, actor)
@sts_window .mode_reset ( @sys_window.data )
end
@equip = false
@sl_window .hide .deactivate
@list_window .show .dummy_hide .activate .diff_refresh
@gold_window .refresh
@pt_window .clear_exchange ( true )
@sts_window .refresh
end
end