#==============================================================================
# ■ 装备增强-铁匠铺界面 v1.0 by SailCat
#------------------------------------------------------------------------------
# 方法:本脚本插入到Main之前、并在所有依赖项之后使用
# 依赖:
# 1. 装备实体接口(1.0版以上)
# 2. 消息对话框(1.0版以上)
# 3. 上下文菜单(1.0版以上)
# 4. 详情窗口(1.0版以上)
# 5. 以下装备实体增强至少其一:
# 穿戴耐久、质量分等、附魔词缀、锻造升级、镶嵌道具、随机生成
# 版本:v1.0 (Build 180716)
# 效果:支持装备实体化的可视化功能操作
# 配置:界面的表现和用语设置
# 冲突:同类功能脚本
# 说明:
# 1. 使用$scene = Scene_Smith.new来开启铁匠界面。
#==============================================================================
#==============================================================================
# ■ SailCat's 插件公用
#==============================================================================
module SailCat
$sailcat_import ||= {}
#--------------------------------------------------------------------------
# ● 脚本配置区
#--------------------------------------------------------------------------
module Equip_Config
GOLD_WINDOW_DELAY = 60 # 金钱窗口的切换延迟
GOLD_WINDOW_FADE = 10 # 金钱窗口的淡入速度
REROLL_COST_RATIO = [0, 33, 300] # 幻化消费比例(低/中/高级)
DESTROY_GAIN_RATIO = 33 # 熔毁回收比例
VOCAB_REPAIR = "修理" # 修理 用语
VOCAB_ENCHANT = "附魔" # 附魔 用语
VOCAB_REFINE = "锤炼" # 锤炼 用语
VOCAB_FORGE = "锻造" # 锻造 用语
VOCAB_PUNCH = "打孔" # 打孔 用语
VOCAB_EMBED = "镶嵌" # 镶嵌 用语
VOCAB_REROLL = "幻化" # 幻化 用语
VOCAB_DESTROY = "熔毁" # 熔毁 用语
HELP_REPAIR = "修理损坏的装备。" # 修理 帮助文字
HELP_ENCHANT = "为装备加持魔法。" # 附魔 帮助文字
HELP_REFINE = "锤炼装备提升质量。"# 锤炼 帮助文字
HELP_FORGE = "锻造装备提高等级。"# 锻造 帮助文字
HELP_PUNCH = "在装备上开镶孔。" # 打孔 帮助文字
HELP_EMBED = "在镶孔中镶嵌道具。"# 镶嵌 帮助文字
HELP_REROLL = "将装备随机幻化。" # 幻化 帮助文字
HELP_DESTROY = "熔毁装备回收金钱。"# 熔毁 帮助文字
# 修理部分的提示用语
VOCAB_REPAIR_FAIL_1 = "装备状态良好。"
VOCAB_REPAIR_FAIL_2 = "无法修理。"
VOCAB_REPAIR_FAIL_3 = "所需零件不足。"
VOCAB_REPAIR_CONFIRM = "修理装备:%s\n需要零件:%d\\C[16]\���\n要修理吗?"
VOCAB_REPAIR_INFO = "修理完成。\n现耐久度为:%d/%d。"
# 附魔部分的提示用语
VOCAB_ENCHANT_FAIL_1 = "无法附魔这个装备。"
VOCAB_ENCHANT_FAIL_2 = "附魔词缀数已达上限。"
VOCAB_ENCHANT_FAIL_3 = "该词缀已被锁定。"
VOCAB_ENCHANT_FAIL_4 = "附魔费用不足。"
VOCAB_ENCHANT_CONFIRM = "附魔装备:%s\n附魔费用:%d\\C[16]\\$\n要附魔吗?"
VOCAB_ENCHANT_INFO = "附魔完成。\n删除词缀%d个,新增词缀%d个。"
# 锤炼部分的提示用语
VOCAB_REFINE_FAIL_1 = "装备质量已达极致。"
VOCAB_REFINE_FAIL_2 = "技术所限,无法进一步锤炼。"
VOCAB_REFINE_FAIL_3 = "锤炼材料不足。"
VOCAB_REFINE_CONFIRM = "锤炼装备:%s\n所用材料:\\D[I%d] × %d\n继续吗?"
VOCAB_REFINE_INFO = "锤炼完成。\n现质量为:%s。"
# 锻造部分的提示用语
VOCAB_FORGE_FAIL_1 = "装备等级已达上限。"
VOCAB_FORGE_FAIL_2 = "消费过低,无法锻造。"
VOCAB_FORGE_FAIL_3 = "锻造失败。\n返还了消费的一半。"
VOCAB_FORGE_FAIL_4 = "锻造失败。\n装备等级没有变化。"
VOCAB_FORGE_FAIL_5 = "锻造失败。\n装备的等级下降了。"
VOCAB_FORGE_INFO = "锻造成功。\n现等级为:%+d。"
VOCAB_FORGE_TEXT_GOLD = "消费%s"
VOCAB_FORGE_TEXT_ITEM = "消费道具"
VOCAB_FORGE_TEXT_BONUS= "额外道具"
VOCAB_FORGE_TEXT_RATE = "锻造成功率"
VOCAB_FORGE_NO_BONUS = "(不使用额外道具)"
VOCAB_FORGE_NO_RATE = "无法锻造"
# 打孔部分的提示用语
VOCAB_PUNCH_FAIL_1 = "装备无法打孔。"
VOCAB_PUNCH_FAIL_2 = "打孔材料不足。"
VOCAB_PUNCH_OPEN = "开启镶孔"
VOCAB_PUNCH_CLOSE = "封闭镶孔"
VOCAB_PUNCH_CONFIRM = "%s:%s\n所用材料:\\D[I%d] × 1\n继续吗?"
VOCAB_PUNCH_INFO = "%s成功。\n现镶孔数为:%d个。"
# 镶嵌部分的提示用语
VOCAB_EMBED_FAIL_1 = "装备没有镶孔。"
VOCAB_EMBED_FAIL_2 = "装备镶嵌已满。"
VOCAB_EMBED_FAIL_3 = "这个装备不允许拆解镶嵌物。"
VOCAB_EMBED_EMPTY = "这个镶嵌孔是空的。"
# 幻化部分的提示用语
VOCAB_REROLL_FAIL_1 = "无法幻化这个装备。"
VOCAB_REROLL_FAIL_2 = "幻化消费不足。"
VOCAB_REROLL_GRADE_1 = "基础"
VOCAB_REROLL_GRADE_2 = "普通"
VOCAB_REROLL_GRADE_3 = "专家"
VOCAB_REROLL_CONFIRM = "幻化装备:%s\n幻化费用:%d\\C[16]\\$\n" +
"\\C[18]\\*警告\\*\\C[0]:装备将丢失原先所有属性!\n继续吗?"
VOCAB_REROLL_INFO = "幻化成功。\n新装备为:%s"
# 熔毁部分的提示用语
VOCAB_DESTROY_CONFIRM = "熔毁装备:%s\n回收金钱:%d\\C[16]\\$\n继续吗?"
VOCAB_DESTROY_INFO = "熔毁完成。"
end
#--------------------------------------------------------------------------
# ● 植入与依赖检查
#--------------------------------------------------------------------------
dependency = []
unless $sailcat_import[:EquipInstantiate].to_f >= 1.0
dependency.push "[EquipInstantiate] 装备实体接口(v1.0以上版本)"
end
unless $sailcat_import[:WindowMessageBox].to_f >= 1.0
dependency.push "[WindowMessageBox] 消息对话框(v1.0以上版本)"
end
unless $sailcat_import[:WindowContextMenu].to_f >= 1.0
dependency.push "[WindowContextMenu] 上下文菜单(v1.0以上版本)"
end
unless $sailcat_import[:WindowInfo].to_f >= 1.0
dependency.push "[WindowInfo] 详情窗口(v1.0以上版本)"
end
raise "缺少依赖插件:\n" + dependency.join("\n") unless dependency.empty?
$sailcat_import[:EquipSmithery] = 1.0
end
#==============================================================================
# ■ Vocab
#------------------------------------------------------------------------------
# 所有用语的整合模块。
#==============================================================================
module Vocab
self.help_text.merge!({
:smith_repair => HELP_REPAIR,
:smith_enchant => HELP_ENCHANT,
:smith_refine => HELP_REFINE,
:smith_forge => HELP_FORGE,
:smith_punch => HELP_PUNCH,
:smith_embed => HELP_EMBED,
:smith_reroll => HELP_REROLL,
})
end
#==============================================================================
# ■ Window_SmithCommand
#------------------------------------------------------------------------------
# 铁匠铺界面,显示铁匠指令列表的窗口。
#==============================================================================
class Window_SmithCommand < Window_HorzCommand
#--------------------------------------------------------------------------
# ● 初期化
#--------------------------------------------------------------------------
def initialize
@commands = []
@commands.push(Vocab.repair) if $sailcat_import[:EquipDurability]
@commands.push(Vocab.enchant) if $sailcat_import[:EquipEnchant]
@commands.push(Vocab.refine) if $sailcat_import[:EquipQuality]
@commands.push(Vocab.forge) if $sailcat_import[:EquipLevel]
@commands.push(Vocab.embed) if $sailcat_import[:EquipSocket]
@commands.push(Vocab.reroll) if $sailcat_import[:EquipRandomize]
super(SCREEN_W, @commands)
end
#--------------------------------------------------------------------------
# ● 选中的命令文字
#--------------------------------------------------------------------------
def command_text
@commands[@index]
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
case command_text
when Vocab.repair
@help_window.set_text(Vocab.help_text[:smith_repair])
when Vocab.enchant
@help_window.set_text(Vocab.help_text[:smith_enchant])
when Vocab.refine
@help_window.set_text(Vocab.help_text[:smith_refine])
when Vocab.forge
@help_window.set_text(Vocab.help_text[:smith_forge])
when Vocab.embed
@help_window.set_text(Vocab.help_text[:smith_embed])
when Vocab.reroll
@help_window.set_text(Vocab.help_text[:smith_reroll])
end
end
end
#==============================================================================
# ■ Window_SmithItem
#------------------------------------------------------------------------------
# 铁匠铺界面,显示装备列表的窗口。
#==============================================================================
class Window_SmithItem < Window_Data
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :mode # 模式
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
@mode = 0
super(0, window_h << 1, SCREEN_W >> 1, -window_h * 3, nil, 1)
end
#--------------------------------------------------------------------------
# ● 生成数据
#--------------------------------------------------------------------------
def make_data
super
@data = $game_party.sorted_weapons + $game_party.sorted_armors
@enable_proc = Proc.new {|item|
case @mode
when 0
true
when 1
item.broken? and item.repairable?
when 2
item.prototype.available_enchants.size > 0
when 3
item.quality < item.max_quality
when 4
item.level < item.max_level
when 5
item.sockets > 0 and (item.embed_removable or item.empty_sockets > 0)
end}
end
#--------------------------------------------------------------------------
# ● 设置模式
# mode : 模式
#--------------------------------------------------------------------------
def set_mode(mode)
@mode = mode
refresh
end
end
#==============================================================================
# ■ Window_SmithGold
#------------------------------------------------------------------------------
# 铁匠铺界面,显示金钱或所需道具的窗口。
#==============================================================================
class Window_SmithGold < Window_Base
include SailCat::Equip_Config
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, SCREEN_H - window_h, SCREEN_W >> 1, window_h)
self.contents = Bitmap.new(width - 32, height - 32)
@item_ids = [-1]
@index = 0
@frame_count = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
self.contents_opacity = 255
@frame_count = 0
if @item_ids[@index] == -1
draw_currency_value(number, Vocab.gold, 4, 0, width - 40)
elsif @item_ids[@index] > 0
rect = contents.rect.inflate(-4, 0)
number_width = text_size(ITEM_MAX).width.limit(24, 66) + 16
draw_item_name($data_items[@item_ids[@index]], 4, 0, true,
rect.width - number_width)
draw_text(rect.right - number_width, 0, 16, rect.height, ":", 1)
draw_text(rect.right - number_width + 16, 0,
number_width - 16, rect.height, number, 2)
end
end
#--------------------------------------------------------------------------
# ● 设置要显示的道具ID
# item_id : 道具ID
#--------------------------------------------------------------------------
def set_item_id(item_id)
if @item_ids != item_id.to_a
@item_ids = item_id.to_a
@index = 0
refresh
end
end
#--------------------------------------------------------------------------
# ● 获取数目
#--------------------------------------------------------------------------
def number
item_id = @item_ids[@index]
item_id == -1 ? $game_party.gold : $game_party.item_number(item_id)
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
if @item_ids.size > 1
@frame_count += 1
if @frame_count >= GOLD_WINDOW_DELAY
self.contents_opacity -= (255.to_f / GOLD_WINDOW_FADE).ceil
if @frame_count == GOLD_WINDOW_DELAY + GOLD_WINDOW_FADE
@index = (@index + 1) % @item_ids.size
refresh
self.contents_opacity = 0
@frame_count = -GOLD_WINDOW_FADE
end
elsif @frame_count < 0
self.contents_opacity += (255.to_f / GOLD_WINDOW_FADE).ceil
end
end
end
end
#==============================================================================
# ■ Window_SmithEnchant
#------------------------------------------------------------------------------
# 铁匠铺界面,显示附魔词缀的选择窗口。
#==============================================================================
class Window_SmithEnchant < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, 0, 576, 416)
center.hide.deactivate.z += 3
@selected = []
@column_max = 3
end
#--------------------------------------------------------------------------
# ● 设置显示的装备
# item : 装备
#--------------------------------------------------------------------------
def show_enchant(item)
return unless item
@data = item.prototype.available_enchants
main_set = item.main_set
sub_set = item.sub_set
available_set = item.available_enchants
@selected = @data.map {|k|
if main_set.include?(k) or main_set.include?(-k)
1
elsif sub_set.include?(k) or sub_set.include?(-k)
3
elsif not available_set.include?(k)
2
else
0
end}
@item_max = @data.size
@max_sel = item.max_enchant
refresh
self.height = [contents.height + 32, 416].min
center.show.activate.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
create_contents
@item_max.times {|n| draw_state(n)}
end
#--------------------------------------------------------------------------
# ● 设置选择状态
# index : 索引
# select : 选择状态(0-3)
#--------------------------------------------------------------------------
def set_select(index, select)
@selected[index] = select
draw_state(index)
end
#--------------------------------------------------------------------------
# ● 获得词缀状态
# index : 索引
#--------------------------------------------------------------------------
def enchant_state(index = @index)
n = @selected[index]
n == 0 ? (selected_enchants.size >= @max_sel ? -1 : 0) : n
end
#--------------------------------------------------------------------------
# ● 切换所选附魔开关
#--------------------------------------------------------------------------
def toggle_enchant
return unless state = $data_states[@data[@index]]
if @selected[@index] == 0
set_select(@index, 1)
state.chain_enchant_set.each do |x|
set_select(i, 3) if i = @data.index(x) and x != @data[@index]
end
state.reject_enchant_set.each do |x|
set_select(i, 2) if i = @data.index(x) and x != @data[@index]
end
elsif @selected[@index] == 1
set_select(@index, 0)
state.chain_enchant_set.each do |x|
set_select(i, 0) if i = @data.index(x) and x != @data[@index]
end
state.reject_enchant_set.each do |x|
set_select(i, 0) if i = @data.index(x) and x != @data[@index]
end
end
end
#--------------------------------------------------------------------------
# ● 绘制词缀名
#--------------------------------------------------------------------------
def draw_state(index)
contents.clear_rect(item_rect(index))
text = $data_states[@data[index]].enchant_name
text = "[" + text + "]" if @selected[index] & 1 == 1
change_color(@selected[index] > 1 ? disabled_color : normal_color)
draw_text(item_rect(index), text, 1)
end
#--------------------------------------------------------------------------
# ● 获得选中的词缀集
#--------------------------------------------------------------------------
def selected_enchants
(0...@item_max).map {|i| @selected[i] == 1 ? @data[i] : nil}.compact
end
end
#==============================================================================
# ■ Window_SmithForge
#------------------------------------------------------------------------------
# 铁匠铺界面,显示锻造消费情况的确认窗口。
#==============================================================================
class Window_SmithForge < Window_Base
include Window_Handler
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :index # 光标位置
attr_reader :item_max # 项目数
attr_reader :gold # 变量
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, 0, SCREEN_W >> 1, 320)
@handler = {}
center.hide.deactivate.z += 3
end
#--------------------------------------------------------------------------
# ● 设置显示的装备
# item : 装备
#--------------------------------------------------------------------------
def show_forge(item)
# 设置锻造目标
@target = item
# 锻造用物品
@items = item.accept_items
@sub_items = {}
# 额外物品
@bonus_items = $game_party.sorted_items.select {|item|
item.equip_bonus_rate != 0}.map {|item| item.id}
@bonus_items.unshift(0)
@item_max = @items.size + 4
resize(SCREEN_W >> 1, window_h(@item_max + 2))
create_contents
reset_cost
refresh
center.show.activate.index = 0
end
#--------------------------------------------------------------------------
# ● 重设消费数值
#--------------------------------------------------------------------------
def reset_cost
@gold = 0
@items.each {|item_id| @sub_items[item_id] = 0}
@bonus_item_id = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 清除内容
contents.clear
# 绘制各提示语文字
change_color(system_color)
w = contents.width
h = line_height
x = @items.size
draw_text(0, 0, w, h, Vocab.forge, 1)
contents.fill_rect(0, h - 1, w, 1, system_color)
gold_text = sprintf(Vocab.forge_text_gold, Vocab.gold)
draw_text(0, line_height(1), w, h, gold_text)
draw_text(0, line_height(2), w, h, Vocab.forge_text_item)
draw_text(0, line_height(3 + x), w, h, Vocab.forge_text_bonus)
draw_text(0, line_height(4 + x), w, h, Vocab.forge_text_rate)
# 绘制物品名称
w = text_size(ITEM_MAX).width.limit(24, 66) + 32
x.times do |i|
item = $data_items[@items[i]]
draw_item_name(item, 0, line_height(3 + i), true, contents.width - w)
change_color(normal_color)
draw_text(contents.width - w - 32, line_height(3 + i), 24, h, "×", 1)
end
# 绘制各项可调数值
draw_gold
x.times {|i| draw_item_number(i)}
draw_bonus_item
update_rate
# 绘制确定和取消按钮
change_color(normal_color)
w = contents.width - CURSOR_PADDING >> 1
draw_text(0, line_height(5 + x), w, h, Vocab.ok, 1)
draw_text(w + CURSOR_PADDING, line_height(5 + x), w, h, Vocab.cancel, 1)
end
#--------------------------------------------------------------------------
# ● 绘制变量数量
#--------------------------------------------------------------------------
def draw_gold
change_color(normal_color)
w = text_size(GOLD_MAX).width.limit(48, 100) + 4
contents.redraw_text(contents.width - w, line_height(1),
w - 4, line_height, @gold, 2)
end
#--------------------------------------------------------------------------
# ● 绘制物品数量
#--------------------------------------------------------------------------
def draw_item_number(i = @index - 1)
change_color(normal_color)
w = text_size(ITEM_MAX).width.limit(24, 66) + 4
contents.redraw_text(contents.width - w, line_height(3 + i),
w - 4, line_height, @sub_items[@items[i]], 2)
end
#--------------------------------------------------------------------------
# ● 绘制额外物品
#--------------------------------------------------------------------------
def draw_bonus_item
x = text_size(Vocab.forge_text_bonus).width + 8
w = contents.width - x - 4
rect = Rect.new(x, line_height(3 + @items.size), w, line_height)
if @bonus_item_id == 0
change_color(disabled_color)
contents.redraw_text(rect, Vocab.forge_no_bonus)
else
item = $data_items[@bonus_item_id]
contents.clear_rect(rect)
draw_item_name(item, rect.x, rect.y, true, rect.width)
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
update_keypress if self.active
end
#--------------------------------------------------------------------------
# ● 设置光标的位置
# index : 新的光标位置
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● 上键处理
#--------------------------------------------------------------------------
def update_up(force)
if @index > 0 or force
$game_system.se_play($data_system.cursor_se)
self.index = @index > 0 ? [@index - 1, @item_max - 3].min : @item_max - 2
end
end
#--------------------------------------------------------------------------
# ● 下键处理
#--------------------------------------------------------------------------
def update_down(force)
if @index > @item_max - 3 or force
$game_system.se_play($data_system.cursor_se)
self.index = @index > @item_max - 3 ? 0 : @index + 1
end
end
#--------------------------------------------------------------------------
# ● 左右键、LR键处理
#--------------------------------------------------------------------------
def update_left(force); key_num(@index != @item_max - 2 || force, -1); end
def update_right(force);key_num(@index != @item_max - 1 || force, +1); end
def update_pageup; key_num(@index != @item_max - 2, -10); end
def update_pagedown; key_num(@index != @item_max - 1, +10); end
#--------------------------------------------------------------------------
# ● 按键变化数值处理
# condition : 变化条件
# delta_value : 变化量
#--------------------------------------------------------------------------
def key_num(condition, delta_value)
if condition
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
change_value(delta_value * 100 ** Input.modifier)
end
end
#--------------------------------------------------------------------------
# ● 增减数量值
# delta : 变化量
#--------------------------------------------------------------------------
def change_value(delta)
case @index
when 0
set_gold(@gold + delta)
when 1..@items.size
item_id = @items[@index - 1]
set_item(item_id, @sub_items[item_id] + delta)
when @item_max - 3
set_bonus(delta <=> 0)
else
self.index = (@item_max << 1) - @index - 3
end
end
#--------------------------------------------------------------------------
# ● 光标有效判定
#--------------------------------------------------------------------------
def cursor_respond?
true
end
#--------------------------------------------------------------------------
# ● 更新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
cw = contents.width
case @index
when 0
w = text_size(GOLD_MAX).width.limit(48, 100) + 8
x, y = cw - w, 1
when 1..@items.size
w = text_size(ITEM_MAX).width.limit(24, 66) + 8
x, y = cw - w, 2
when @item_max - 3
w = cw - text_size(Vocab.forge_text_bonus).width - 4
x, y = cw - w, 2
when @item_max - 2
w = cw - CURSOR_PADDING >> 1
x, y = 0, 3
when @item_max - 1
w = cw - CURSOR_PADDING >> 1
x, y = cw - w, 2
end
self.cursor_rect = Rect.new(x, line_height(@index + y), w, line_height)
end
#--------------------------------------------------------------------------
# ● 设置金钱数量
# gold : 金钱数量
#--------------------------------------------------------------------------
def set_gold(gold)
@gold = gold.limit(0, $game_party.gold)
draw_gold
update_rate
end
#--------------------------------------------------------------------------
# ● 设置物品数量
# id : 物品 ID
# number : 物品数量
#--------------------------------------------------------------------------
def set_item(id, number)
@sub_items[id] = number.limit(0, $game_party.item_number(id))
draw_item_number
update_rate
end
#--------------------------------------------------------------------------
# ● 设置奖励物品
# delta : 增减方向
#--------------------------------------------------------------------------
def set_bonus(delta)
bonus_index = @bonus_items.index(@bonus_item_id)
@bonus_item_id = @bonus_items[(bonus_index + delta) % @bonus_items.size]
draw_bonus_item
update_rate
end
#--------------------------------------------------------------------------
# ● 更新机率显示
#--------------------------------------------------------------------------
def update_rate
rate = @target.preview_chance(money, bonus_rate).to_i
color = [disabled_color, power_down_color, crisis_color, power_up_color,
power_up_color, normal_color][(rate / 25 + 1).limit(0, 5)]
change_color(color)
text = rate < 0 ? Vocab.forge_no_rate : rate.to_s + "%"
x = text_size(Vocab.forge_text_rate).width + 8
contents.redraw_text(x, line_height(4 + @items.size),
contents.width - x - 4, line_height, text, 2)
end
#--------------------------------------------------------------------------
# ● 更新消费显示
#--------------------------------------------------------------------------
def update_cost
rate = @target.preview_chance(money, bonus_rate).to_i
if rate < 0
new_cost = @target.preview_cost(0, bonus_rate)
elsif rate < @target.success_rate
new_cost = @target.preview_cost(@target.success_rate, bonus_rate)
else
new_cost = @target.preview_cost(100, bonus_rate)
end
if @index == 0
change_value(new_cost - money)
else
price = [$data_items[@items[@index - 1]].price, 1].max
change_value(((new_cost - money).to_f / price).ceil)
end
end
#--------------------------------------------------------------------------
# ● 获取要消费的物品
#--------------------------------------------------------------------------
def items
@bonus_item_id > 0 ? @sub_items.merge({@bonus_item_id => 1}) : @sub_items
end
#--------------------------------------------------------------------------
# ● 获取总计消费价值
#--------------------------------------------------------------------------
def money
@sub_items.inject(@gold) {|g, i| g + $data_items[i[0]].price * i[1]}
end
#--------------------------------------------------------------------------
# ● 获取奖励机率
#--------------------------------------------------------------------------
def bonus_rate
(item = $data_items[@bonus_item_id]) ? item.equip_bonus_rate : 0
end
end
#==============================================================================
# ■ Window_SmithEmbed
#------------------------------------------------------------------------------
# 铁匠铺界面,镶嵌孔的选择窗口。
#==============================================================================
class Window_SmithEmbed < Window_Data
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
@equipment = nil
super(0, window_h << 1, SCREEN_W >> 1, window_h, nil, 4)
self.z += 3
deactivate.hide.index = -1
end
#--------------------------------------------------------------------------
# ● 设置当前镶嵌装备
#--------------------------------------------------------------------------
def show_embed(equipment)
@equipment = equipment
self.height = window_h([equipment.sockets + 3 >> 2, 4].min)
refresh
show.activate.index = 0
end
#--------------------------------------------------------------------------
# ● 生成数据
#--------------------------------------------------------------------------
def make_data
super
return unless @equipment
@data.concat(@equipment.socket_items.map {|i| $data_items[i]})
@enable_proc = Proc.new {|item| item == nil or @equipment.embed_removable}
end
#--------------------------------------------------------------------------
# ● 绘制镶嵌孔
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
@drawn[index] = true
enabled = (@enable_proc == nil or @enable_proc.call(item))
rect = item_rect(index).inflate(-4, 0)
# 绘制孔外廓
text_w = text_size("[").width
change_color(enabled ? normal_color : disabled_color)
rect = item_rect(index)
contents.clear_rect(rect)
draw_text(rect.x, rect.y, text_w, line_height, "[")
draw_text(rect.right - text_w, rect.y, text_w, line_height, "]")
# 如果孔内有道具,绘制道具图标
if item
draw_icon(item.icon_name, rect.x + (rect.width - ICON_WIDTH >> 1),
rect.y, true, line_height)
end
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
if self.item == nil
@help_window.set_text(Vocab.embed_empty)
else
super
end
end
end
#==============================================================================
# ■ Window_SmithEmbedItem
#------------------------------------------------------------------------------
# 铁匠铺界面,镶嵌用道具的选择窗口。
#==============================================================================
class Window_SmithEmbedItem < Window_Data
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, window_h * 3, SCREEN_W >> 1, -window_h * 3, nil, 1)
@equipment = nil
self.z += 3
deactivate.hide.index = -1
end
#--------------------------------------------------------------------------
# ● 设置当前镶嵌装备
#--------------------------------------------------------------------------
def show_embed(equipment)
@equipment = equipment
lines_top = [@equipment.sockets + 3 >> 2, 4].min
top = window_h(lines_top) + (window_h << 1)
move(0, top, SCREEN_W >> 1, SCREEN_H - top)
self.index = -1
refresh
show
end
#--------------------------------------------------------------------------
# ● 生成数据
#--------------------------------------------------------------------------
def make_data
super
# 添加可以镶嵌的道具
@data.concat($game_party.sorted_items.select {|item| item.socketable})
# 若允许解除镶嵌则添加空白
@data.push(nil) if @equipment and @equipment.embed_removable
end
end
#==============================================================================
# ■ Scene_Smith
#------------------------------------------------------------------------------
# 处理铁匠画面的类。
#==============================================================================
class Scene_Smith
include Scene_Base
include SailCat::Window_Config
include SailCat::Equip_Config
#--------------------------------------------------------------------------
# ● 建立窗口
#--------------------------------------------------------------------------
def create_all_windows
# 建立帮助窗口
@help_window = Window_Help.new
# 建立命令窗口
@command_window = Window_SmithCommand.new
# 建立金钱窗口
@gold_window = Window_SmithGold.new
# 建立物品窗口
@item_window = Window_SmithItem.new
# 建立详情窗口
height_offset = @help_window.height + @command_window.height
@info_window = Window_Info.new(SCREEN_W >> 1, height_offset,
SCREEN_W >> 1, -height_offset)
# 建立插件独立窗口
@enchant_window = Window_SmithEnchant.new if $sailcat_import[:EquipEnchant]
@forge_window = Window_SmithForge.new if $sailcat_import[:EquipLevel]
if $sailcat_import[:EquipSocket]
@top_window = Window_SmithEmbed.new
@bottom_window = Window_SmithEmbedItem.new
end
end
#--------------------------------------------------------------------------
# ● 设置场景扩展方法处理 1000
#--------------------------------------------------------------------------
def post_create_1000
@help_window.moveto(0, @command_window.height)
@command_window.help_window = @help_window
@item_window.index = -1
@item_window.help_window = @help_window
@item_window.info_window = @info_window
@item_window.set_handler(:index_changed, method(:item_index_changed))
if $sailcat_import[:EquipSocket]
@top_window.help_window = @help_window
@bottom_window.help_window = @help_window
end
end
#--------------------------------------------------------------------------
# ● 设置场景扩展方法处理 9000
#--------------------------------------------------------------------------
def post_create_9000
# 窗口初始状态设置
@command_window.activate.index = 0
@item_window.deactivate
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
# 更新所有窗口
update_all_windows
end
#--------------------------------------------------------------------------
# ● 更改物品选择处理
#--------------------------------------------------------------------------
def item_index_changed
if @item_window.index == -1 or (item = @item_window.item) == nil
item_id = -1
else
case @item_window.mode
when 3
item_id = item.quality_item_id
when 4
item_id = [-1].concat(item.accept_items)
when 5
item_id = [item.socket_item, item.unsocket_item]
else
item_id = -1
end
end
@gold_window.set_item_id(item_id)
end
#--------------------------------------------------------------------------
# ● 命令窗口 B 键处理
#--------------------------------------------------------------------------
def command_window_b
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 返回场景
SceneManager.return
end
#--------------------------------------------------------------------------
# ● 命令窗口 C 键处理
#--------------------------------------------------------------------------
def command_window_c
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换窗口焦点
@command_window.deactivate
# 根据所选功能刷新物品窗口
case @command_window.command_text
when Vocab.repair
@item_window.set_mode(1)
when Vocab.enchant
@item_window.set_mode(2)
when Vocab.refine
@item_window.set_mode(3)
when Vocab.forge
@item_window.set_mode(4)
when Vocab.punch
@item_window.set_mode(5)
when Vocab.embed
@item_window.set_mode(6)
when Vocab.reroll
@item_window.set_mode(7)
when Vocab.destroy
@item_window.set_mode(8)
end
@item_window.activate.index = 0
end
#--------------------------------------------------------------------------
# ● 物品窗口 B 键处理
#--------------------------------------------------------------------------
def item_window_b
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换窗口焦点
@item_window.deactivate.index = -1
@command_window.activate
@item_window.set_mode(0)
end
#--------------------------------------------------------------------------
# ● 物品窗口 C 键处理
#--------------------------------------------------------------------------
def item_window_c
# 选中物品无效的情况下
unless @item_window.item
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 执行物品操作
method("process_item_#{@item_window.mode}".to_sym).call
end
#--------------------------------------------------------------------------
# ● 物品操作取消
#--------------------------------------------------------------------------
def process_item_0
item_window_b
end
#--------------------------------------------------------------------------
# ● 物品操作修理
#--------------------------------------------------------------------------
def process_item_1
# 获得当前的待操作物品
item = @item_window.item
# 修理检定未通过的情况下
if (error = item.repair_state) > 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.send("repair_fail_#{error}"), Vocab.repair)
# 修理检定通过的情况下
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 询问确认的情况下,执行修理
msg = sprintf(Vocab.repair_confirm, item.info_00, item.repair_cost)
if Window_MessageBox.new(msg, Vocab.repair, MB_YN).result == DR_YES
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 执行修理
item.repair
# 更新相关窗口
@item_window.refresh
@item_window.update_help
@item_window.update_info
@gold_window.refresh
info = sprintf(Vocab.repair_info, item.durability, item.max_durability)
Window_MessageBox.new(info, Vocab.repair)
end
end
end
#--------------------------------------------------------------------------
# ● 物品操作附魔
#--------------------------------------------------------------------------
def process_item_2
# 获得当前的待操作物品
item = @item_window.item
# 附魔检定未通过的情况下
if (error = item.enchant_state) > 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.send("enchant_fail_#{error}"), Vocab.enchant)
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到附魔词缀窗口
@item_window.deactivate
@enchant_window.show_enchant(item)
end
end
#--------------------------------------------------------------------------
# ● 附魔窗口 B 键处理
#--------------------------------------------------------------------------
def enchant_window_b
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@enchant_window.deactivate.hide
# 获得当前的待操作物品
item = @item_window.item
# 比较附魔词缀变化
old_set = item.main_set
new_set = @enchant_window.selected_enchants
delete_set = old_set - new_set
keep_set = old_set & new_set
add_set = new_set - old_set
# 词缀有变的情况下
unless delete_set.empty? and add_set.empty?
# 检查附魔消费
cost1 = keep_set.sum {|x| $data_states[x].enchant_effects[:price]}
cost1 *= keep_set.size
cost2 = new_set.sum {|x| $data_states[x].enchant_effects[:price]}
cost2 *= new_set.size
cost = [cost2 - cost1, 0].max * item.prototype.price / 100
# 消费不足的情况下
if $game_party.gold < cost
Window_MessageBox.new(Vocab.enchant_fail_4, Vocab.enchant)
else
# 询问确认的情况下,执行附魔
msg = sprintf(Vocab.enchant_confirm, item.info_00, cost)
if Window_MessageBox.new(msg, Vocab.enchant, MB_YN).result == DR_YES
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 执行附魔
$game_party.lose_gold(cost)
delete_set.each {|x| item.remove_enchant(x)}
add_set.each {|x| item.add_enchant(x)}
# 更新相关窗口
@item_window.refresh
@item_window.update_info
@gold_window.refresh
info = sprintf(Vocab.enchant_info, delete_set.size, add_set.size)
Window_MessageBox.new(info, Vocab.enchant)
end
end
end
# 切换到物品窗口
@item_window.activate
end
#--------------------------------------------------------------------------
# ● 附魔窗口 C 键处理
#--------------------------------------------------------------------------
def enchant_window_c
case @enchant_window.enchant_state
when -1
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
Window_MessageBox.new(Vocab.enchant_fail_2, Vocab.enchant)
when 0, 1
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@enchant_window.toggle_enchant
when 2, 3
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
Window_MessageBox.new(Vocab.enchant_fail_3, Vocab.enchant)
end
end
#--------------------------------------------------------------------------
# ● 物品操作锤炼
#--------------------------------------------------------------------------
def process_item_3
# 获得当前的待操作物品
item = @item_window.item
# 锤炼检定未通过的情况下
if (error = item.quality_state) > 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.send("refine_fail_#{error}"), Vocab.refine)
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 询问确认的情况下,执行锤炼
msg = sprintf(Vocab.refine_confirm, item.info_00,
item.quality_item_id, item.quality_item_count)
if Window_MessageBox.new(msg, Vocab.refine, MB_YN).result == DR_YES
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 执行锤炼
item.quality_up
# 更新相关窗口
@item_window.refresh
@item_window.update_info
@gold_window.refresh
text = Vocab.qualities[item.quality - 1] || Vocab.quality_ex
if item.quality_param_rate != 0
param = sprintf("(%+d)", item.quality_param_rate)
else
param = "(--)"
end
new_quality_text = "\\C[#{item.name_color}]#{text}\\}#{param}\\{\\C[0]"
info = sprintf(Vocab.refine_info, new_quality_text)
Window_MessageBox.new(info, Vocab.refine)
end
end
end
#--------------------------------------------------------------------------
# ● 物品操作锻造
#--------------------------------------------------------------------------
def process_item_4
# 获得当前的待操作物品
item = @item_window.item
# 锻造检定未通过的情况下
if (error = item.level_state) > 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.send("forge_fail_#{error}"), Vocab.forge)
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到锻造窗口
@item_window.deactivate
@forge_window.show_forge(item)
end
end
#--------------------------------------------------------------------------
# ● 锻造窗口 B 键处理
#--------------------------------------------------------------------------
def forge_window_b
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到物品窗口
@forge_window.deactivate.hide
@item_window.activate
end
#--------------------------------------------------------------------------
# ● 锻造窗口 C 键处理
#--------------------------------------------------------------------------
def forge_window_c
# 获得当前的待操作物品
item = @item_window.item
case @forge_window.index
when 0...@forge_window.item_max - 3
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@forge_window.update_cost
when @forge_window.item_max - 3
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@forge_window.change_value(1)
when @forge_window.item_max - 2
# 执行升级操作
result = item.level_up(@forge_window.gold, @forge_window.items,
@forge_window.bonus_rate)
# 升级成功的情况下
if result == 0
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
info = sprintf(Vocab.forge_info, item.level)
Window_MessageBox.new(info, Vocab.forge)
# 升级失败的情况下
else
# 装备等级下降的情况下
if result == 5
# 演奏受伤 SE
$game_system.se_play($data_system.actor_collapse_se)
# 无法操作的情况下
elsif result <= 2
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
end
Window_MessageBox.new(Vocab.send("forge_fail_#{result}"), Vocab.forge)
end
# 更新相关窗口
@item_window.refresh
@item_window.update_info
@gold_window.refresh
if item.level_state == 0
@forge_window.reset_cost
@forge_window.refresh
else
# 切换到物品窗口
@forge_window.deactivate.hide
@item_window.activate
end
when @forge_window.item_max - 1
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到物品窗口
@forge_window.deactivate.hide
@item_window.activate
end
end
#--------------------------------------------------------------------------
# ● 物品操作打孔
#--------------------------------------------------------------------------
def process_item_5
# 获得当前的待操作物品
item = @item_window.item
# 打孔检定未通过的情况下
if item.max_sockets == 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.punch_fail_1, Vocab.punch)
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 显示打孔菜单
commands = [Vocab.punch_open, Vocab.punch_close]
menu = Window_ContextMenu.new(commands)
start_index = 0
if item.sockets == 0
menu.disable_item(1)
end
if item.sockets == item.max_sockets
menu.disable_item(0)
start_index = 1
end
x = @item_window.cursor_rect.right + @item_window.x + 16
y = @item_window.cursor_rect.y + @item_window.y + 16
case menu.show_menu(x, y, start_index)
when 0 # 开孔
word = Vocab.punch_open
material = item.socket_item
sym = :open_socket
when 1 # 封孔
word = Vocab.punch_close
material = item.unsocket_item
sym = :close_socket
when 2
return
end
# 打孔操作
if $game_party.item_number(material) > 0
msg = sprintf(Vocab.punch_confirm, word, item.info_00, material)
if Window_MessageBox.new(msg, Vocab.punch, MB_YN).result == DR_YES
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 执行打孔
item.send(sym)
# 更新相关窗口
@item_window.refresh
@item_window.update_info
@gold_window.refresh
info = sprintf(Vocab.punch_info, word, item.sockets)
Window_MessageBox.new(info, Vocab.punch)
end
else
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.punch_fail_2, Vocab.punch)
end
end
end
#--------------------------------------------------------------------------
# ● 物品操作镶嵌
#--------------------------------------------------------------------------
def process_item_6
# 获得当前的待操作物品
item = @item_window.item
# 镶嵌检定未通过的情况下
if (error = item.embed_state) > 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.send("embed_fail_#{error}"), Vocab.embed)
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到镶嵌窗口
@item_window.deactivate
@top_window.show_embed(item)
@bottom_window.show_embed(item)
end
end
#--------------------------------------------------------------------------
# ● 镶孔窗口 B 键处理
#--------------------------------------------------------------------------
def top_window_b
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到物品窗口
@top_window.deactivate.hide
@bottom_window.hide
@item_window.activate
end
#--------------------------------------------------------------------------
# ● 镶孔窗口 C 键处理
#--------------------------------------------------------------------------
def top_window_c
# 镶嵌物不能取下的情况下
if @top_window.item and not @item_window.item.embed_removable
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
Window_MessageBox.new(Vocab.embed_fail_3, Vocab.embed)
else
# 切换到镶嵌物窗口
@top_window.deactivate
@bottom_window.activate.index = 0
end
end
#--------------------------------------------------------------------------
# ● 镶嵌物窗口 B 键处理
#--------------------------------------------------------------------------
def bottom_window_b
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到镶孔窗口
@bottom_window.deactivate.index = -1
@top_window.activate
end
#--------------------------------------------------------------------------
# ● 镶嵌物窗口 C 键处理
#--------------------------------------------------------------------------
def bottom_window_c
# 取得选中的镶嵌物
item = @bottom_window.item
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 执行镶嵌
@item_window.item.socket(@top_window.index, item ? item.id : 0)
# 刷新相关窗口
@item_window.refresh
@item_window.update_info
@top_window.refresh
@bottom_window.refresh
# 切换到镶孔窗口
@bottom_window.deactivate.index = -1
@top_window.activate
end
#--------------------------------------------------------------------------
# ● 物品操作幻化
#--------------------------------------------------------------------------
def process_item_7
# 获得当前的待操作物品
item = @item_window.item
sym = $sailcat_import[:EquipDurability] ? :sailcat_equipdu_price : :price
price = item.send(sym)
# 幻化检定未通过的情况下
if not item.random_enabled?(:ALL)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.reroll_fail_1, Vocab.reroll)
# 幻化最低消费不足的情况下
elsif $game_party.gold < price.factor(REROLL_COST_RATIO.min)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
# 显示错误信息
Window_MessageBox.new(Vocab.reroll_fail_2, Vocab.reroll)
# 幻化检定通过的情况下
else
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 显示幻化菜单
commands = [1, 2, 3].map {|n|
Vocab.send("reroll_grade_#{n}") + Vocab.nbsp + Vocab.reroll}
menu = Window_ContextMenu.new(commands)
start_index = 0
3.times do |x|
if $game_party.gold < price.factor(REROLL_COST_RATIO[x])
menu.disable_item(x)
end
end
x = @item_window.cursor_rect.right + @item_window.x + 16
y = @item_window.cursor_rect.y + @item_window.y + 16
result = menu.show_menu(x, y, start_index)
# 菜单被取消的情况下,返回
return if result == 3
cost = price.factor(REROLL_COST_RATIO[result])
ranges = []
# 低级或高级需限定幻化范围
if result != 1
if item.random_enabled?(:QUALITY)
min = result == 0 ? item.min_quality : item.quality
max = result == 0 ? item.quality : item.max_quality
ranges.push(min..max)
end
if item.random_enabled?(:ENCHANT)
min = result == 0 ? 0 : item.enchant_count
max = result == 0 ? item.enchant_count : item.max_enchant
ranges.push(min..max)
end
if item.random_enabled?(:LEVEL)
min = result == 0 ? 0 : item.level
max = result == 0 ? item.level : item.max_level
ranges.push(min..max)
end
if item.random_enabled?(:SOCKET)
min = result == 0 ? 1 : [item.sockets, 1].max
max = result == 0 ? [item.sockets, 1].max : item.max_sockets
ranges.push(min..max)
end
end
# 幻化操作
msg = sprintf(Vocab.reroll_confirm, item.info_00, cost)
if Window_MessageBox.new(msg, Vocab.reroll, MB_YN).result == DR_YES
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 执行幻化
$game_party.lose_gold(cost)
item.randomize(*ranges)
# 更新相关窗口
@item_window.refresh
@item_window.update_info
@gold_window.refresh
info = sprintf(Vocab.reroll_info, item.info_00)
Window_MessageBox.new(info, Vocab.reroll)
end
end
end
#--------------------------------------------------------------------------
# ● 物品操作熔毁
#--------------------------------------------------------------------------
def process_item_8
# 获得当前的待操作物品
item = @item_window.item
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 询问确认的情况下,执行熔毁
gain = item.price.factor(DESTROY_GAIN_RATIO)
msg = sprintf(Vocab.destroy_confirm, item.info_00, gain)
if Window_MessageBox.new(msg, Vocab.destroy, MB_YN).result == DR_YES
# 演奏销毁 SE
$game_system.se_play($data_system.enemy_collapse_se)
# 执行熔毁
item.unsocket_all if $sailcat_import[:EquipSocket]
$game_party.lose_object(item, 1)
$game_party.gain_gold(gain)
# 更新相关窗口
@item_window.refresh
@item_window.update_help
@item_window.update_info
@gold_window.refresh
Window_MessageBox.new(Vocab.destroy_info, Vocab.repair)
end
end
end