赞 | 0 |
VIP | 0 |
好人卡 | 2 |
积分 | 1 |
经验 | 20060 |
最后登录 | 2020-11-9 |
在线时间 | 345 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 70
- 在线时间
- 345 小时
- 注册时间
- 2011-10-13
- 帖子
- 414
|
{:2_276:}{:2_276:}求在VIPArcher的装备说明脚本上增加能够在白魔的装备合成脚本的界面上正确呼出说明窗口的功能,应该算是个小手术- #encoding:utf-8
- #==============================================================================
- # ■ 技能物品说明增强 蓝本:wyongcan
- # 修改 :VIPArcher
- #
- # 改动说明:
- # 改用新的帮助窗口和新定义draw_text_vip方法来增强兼容性
- # 更改初始化数据时机以支持跳过标题
- # 追加对普通物品和技能的说明内容
- # 修改了对帮助窗口行数的计算以支持控制符
- # 加上了各种颜色的设置,具体更高级的玩法自己领悟吧
- # 改成光标不动一段时间后才会出现帮助窗口
- #
- # -- 本脚本来自 [url]https://rpg.blue[/url] 使用或转载请保留以上信息。
- #==============================================================================
- $VIPArcherScript ||= {};$VIPArcherScript[:help_ex] = 20141007
- $VIPArcherScript[:equip_limit] = false #是否使用了后知后觉的装备能力限制
- class << DataManager
- alias_method :vip_load_database, :load_database
- #--------------------------------------------------------------------------
- # ● 读取数据库
- #--------------------------------------------------------------------------
- def load_database
- vip_load_database
- VIPArcher::Equipplus.equiphelpready
- end
- end
- module VIPArcher;end
- module VIPArcher::Equipplus
- TIME = 15 #帮助窗口自动出现的时间(单位帧
- Font_Name = "微软雅黑" # 推荐"微软雅黑"
- Font_Size = 20 # "微软雅黑"的话就20号字体
- UP = 24 #能力值提升颜色编号
- DOWN = 25 #能力值下降颜色编号
- VIP = 14 #特殊能力颜色编号
- MP = 23
- TP = 29
- CODE ={
- 11 => "属性抗性",
- 12 => "弱化抗性",
- 13 => "状态抗性",
- 14 => "状态免疫",
- 21 => "普通能力",
- 22 => "添加能力",
- 23 => "特殊能力",
- 31 => "附带属性",
- 32 => "附带状态",
- 33 => "攻击速度",
- 34 => "添加攻击次数",
- 41 => "添加技能类型",
- 42 => "禁用技能类型",
- 43 => "添加技能",
- 44 => "禁用技能",
- 51 => "可装备武器类型",
- 52 => "可装备护甲类型",
- 53 => "固定装备",
- 54 => "禁用装备",
- 55 => "装备风格",
- 61 => "添加行动次数",
- 62 => "特殊标志",
- 63 => "消失效果",
- 64 => "队伍能力"}
- #特殊标志
- FLAG ={
- 0 => "自动战斗",
- 1 => "擅长防御",
- 2 => "保护弱者",
- 3 => "特技专注"}
- #技能效果范围
- SCOPE ={
- 0 => "无",
- 1 => "单个敌人",
- 2 => "全体敌人",
- 3 => "一个随机敌人",
- 4 => "两个随机敌人",
- 5 => "三个随机敌人",
- 6 => "四个随机敌人",
- 7 => "单个队友",
- 8 => "全体队友",
- 9 => "单个队友(战斗不能)",
- 10 => "全体队友(战斗不能)",
- 11 => "使用者" }
- #技能命中类型
- HIT ={
- 0 => "必定命中",
- 1 => "物理攻击",
- 2 => "魔法攻击"}
- #使用限制
- OCCASION ={
- 0 => "随时可用",
- 1 => "仅战斗中",
- 2 => "仅菜单中",
- 3 => "不能使用"}
- #添加能力
- XPARAM ={
- 0 => "物理命中几率:",
- 1 => "物理闪避几率:",
- 2 => "必杀几率:",
- 3 => "必杀闪避几率:",
- 4 => "魔法闪避几率:",
- 5 => "魔法反射几率:",
- 6 => "物理反击几率:",
- 7 => "体力值再生速度:",
- 8 => "魔力值再生速度:",
- 9 => "特技值再生速度:"}
- #特殊能力
- SPARAM ={
- 0 => "受到攻击的几率",
- 1 => "防御效果比率",
- 2 => "恢复效果比率",
- 3 => "药理知识",
- 4 => "MP消费率",
- 5 => "TP消耗率",
- 6 => "物理伤害加成",
- 7 => "魔法伤害加成",
- 8 => "地形伤害加成",
- 9 => "经验获得加成"}
- #装备风格 require 装备风格扩展脚本
- SLOT_TYPE ={
- 0 => "普通",
- 1 => "双持武器",
- 2 => "索爷三刀流",
- 3 => "NPC",
- 4 => "233",
- 5 => "论坛@的BUG好烦啊"}
- #队伍能力
- PARTY_ABILITY ={
- 0 => "遇敌几率减半",
- 1 => "随机遇敌无效",
- 2 => "敌人偷袭无效",
- 3 => "先制攻击几率上升",
- 4 => "获得金钱数量双倍",
- 5 => "物品掉落几率双倍"}
- #伤害类型
- DAMAGE_TYPE = {
- 0 => "无",
- 1 => "体力值伤害",
- 2 => "魔力值伤害",
- 3 => "体力值恢复",
- 4 => "魔力值恢复",
- 5 => "体力值吸收",
- 6 => "魔力值吸收"}
- #普通能力
- #这只是个示范,你也可以依照个人喜好对这些用语添加颜色控制符
- @params ={
- 0 => "\\c[17]最大HP",
- 1 => "\\c[16]最大MP",
- 2 => "\\c[20]力量",
- 3 => "\\c[21]智力",
- 4 => "\\c[30]敏捷",
- 5 => "\\c[31]防御",
- 6 => "\\c[14]速度",
- 7 => "\\c[17]幸运"}
- #我举例技能类型的原因就是因为它 短
- @skill_types = { # 这个和下面equiphelpready里注释掉的做的是一样的事
- # 只是下面是读取数据库添加用语,这里是手动枚举
- 1 => "\\c[1]特技",
- 2 => "\\c[2]魔法",
- 3 => "\\c[3]必杀",
- 4 => "\\c[5]卖萌"}
- #初始化数据,当然如果你要用上面那样的控制符改变颜色的话
- #欢迎枚举格式就是上面这样用Hash,用ID做键把用语对应起来
- def self.equiphelpready
- params = $data_system.terms.params
- elements = $data_system.elements
- weapon_types = $data_system.weapon_types
- armor_types = $data_system.armor_types
- etypes = $data_system.terms.etypes
- skill_types = $data_system.skill_types
- @states ||= {}
- @params ||= {}
- @weapon_types ||= {}
- @armor_types ||= {}
- @etypes ||= {}
- @skill_types ||= {}
- @elements ||= {}
- skill_types.each_with_index{|x,y| @skill_types[y] = x if !x.nil?} if @skill_types == {}
- $data_states.each{|x| @states[x.id] = x.name if !x.nil?} if @states == {}
- elements.each_with_index{|x,y| @elements[y] = x if !x.nil?} if @elements == {}
- weapon_types.each_with_index{|x,y| @weapon_types[y] = x if !x.nil?} if @weapon_types == {}
- armor_types.each_with_index{|x,y| @armor_types[y] = x if !x.nil?} if @armor_types == {}
- etypes.each_with_index{|x,y| @etypes[y] = x} if @etypes == {}
- params.each_with_index{|x,y| @params[y] = x} if @params == {}
- end
- #获取装备帮助内容
- def self.getequiphelp(equip)
- help = ""
- param = []
- help += "\\c[16]装备位置:#{Vocab::etype(equip.etype_id)}\\c[0]\n"
- if $VIPArcherScript[:equip_limit] #装备能力限制
- help += "\\c[16]等级需求:#{equip.level_limit}\n" if equip.level_limit > 0
- param_limit = []
- for i in 0..7
- if equip.params_limit(i) != 0
- help += "\\c[16]#{@params[i]}需求:#{equip.params_limit(i)}\\c[0]\n"
- end
- end
- end
- equip.params.each_with_index{|x,y| param.push([@params[y],x])}
- param = param.select{|x| x[1] != 0}
- param.each{|x| help += "\\c[#{x[1]>0? UP : DOWN}]#{x[0]}:\\c[#{x[1]>0? UP : DOWN}]#{"﹢"if x[1]>0}#{x[1].to_int.to_s}\\c[0]\n"}
- features = equip.features
- featuresparam = []
- featuresparam.push features.select{|x| x.code == 21}
- featuresparam.push features.select{|x| x.code == 22}
- featuresparam.push features.select{|x| x.code == 23}
- featuresparam[0].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{@params[x.data_id]}#{x.value<0?"﹣":"﹢"}#{(x.value.abs*100).to_i}%\n"}
- featuresparam[1].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{XPARAM[x.data_id]}#{x.value<0?"﹣":"﹢"}#{(x.value.abs*100).to_i}%\n"}
- featuresparam[2].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{SPARAM[x.data_id]}#{x.value<0?"﹣":"﹢"}#{(x.value.abs*100).to_i}%\n"}
- if $VIPArcherScript[:slot_type]
- help += "\\c[#{VIP}]#{CODE[55]}:#{SLOT_TYPE[$1.to_i]}\\c[0]\n" if equip.note =~ /<slot_type\s*[:](.*)>/i
- else
- features.select{|x| x.code == 55}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:双持武器\\c[0]\n"}
- end
- features.select{|x| x.code == 11}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}×#{(x.value*100).to_i}%\\c[0]\n"}
- features.select{|x| x.code == 12}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@params[x.data_id]}×#{(x.value*100).to_i}%\\c[0]\n"}
- features.select{|x| x.code == 13}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@states[x.data_id]}×#{(x.value*100).to_i}%\\c[0]\n"}
- features.select{|x| x.code == 14}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{@states[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@states[x.data_id]}#{(x.value*100).to_i}%\\c[0]\n"}
- features.select{|x| x.code == 33}.each{|x| help += "\\c[#{x.value>0? UP : DOWN}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
- features.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
- features.select{|x| x.code == 41}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 42}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 43}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
- features.select{|x| x.code == 44}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
- features.select{|x| x.code == 51}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@weapon_types[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 52}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@armor_types[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 53}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 54}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 61}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
- features.select{|x| x.code == 62}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{FLAG[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 64}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{PARTY_ABILITY[x.data_id]}\\c[0]\n"}
- help
- end
- #获取技能帮助内容
- def self.getskillhelp(skill)
- help = ""
- effects = skill.effects
- damage = skill.damage
- r = [skill.required_wtype_id1,skill.required_wtype_id2]
- help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s} \\c[#{TP}]TP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost > 0
- help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost <= 0
- help += "\\c[16]消耗:\\c[#{TP}]TP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.tp_cost > 0 && skill.mp_cost <= 0
- help += "\\c[#{skill.speed<0?DOWN: UP}]速度修正:#{skill.speed}\\c[0]\n" if skill.speed != 0
- help += "\\c[#{DOWN}]成功率:#{skill.success_rate}%\\c[0]\n" if skill.success_rate != 100
- help += "\\c[16]类型:#{HIT[skill.hit_type]}\\c[0]\n"
- help += "\\c[16]范围:#{SCOPE[skill.scope]}\\c[0]\n" if skill.scope != 0
- help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
- effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
- effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
- effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\n"}
- effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\n"}
- effects.select{|x| x.code == 21}.each{|x| help += "\\c[#{UP}]附加:#{x.data_id == 0 ? "普通攻击" : @states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
- effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
- effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
- effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{UP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
- effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
- help += "\\c[16]场合:#{OCCASION[skill.occasion]}\n"
- help += "\\c[#{DOWN}]限制:#{$data_system.weapon_types[r[0]] if r[0] != 0} #{$data_system.weapon_types[r[1]] if r[1] != 0}\\c[0]\n" if r != [0,0]
- help
- end
- #获取道具帮助内容
- def self.getitemhelp(item)
- help = ""
- effects = item.effects
- damage = item.damage
- help += "\\c[16]类型:\\c[#{VIP}]#{"贵重物品 "if item.itype_id != 1}\\c[#{DOWN}]#{item.consumable ? "消耗品":"非消耗品"}\\c[0]\n"
- help += "\\c[16]范围:#{SCOPE[item.scope]}\\c[0]\n" if item.scope != 0
- help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
- effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
- effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
- effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\\c[0]\n"}
- effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\\c[0]\n"}
- effects.select{|x| x.code == 21}.each{|x| help += "\\c[#{UP}]附加:#{x.data_id == 0 ? "普通攻击" : @states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
- effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
- effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
- effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{VIP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
- effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
- help += "\\c[16]场合:#{OCCASION[item.occasion]}\\c[0]\n"
- help
- end
- #计算行数(有些字体的汉字和[字母,数字,符号]的宽度不同,
- #有可能会照成行数计算不对,尽量用宽度相同的字体吧)
- def self.getline(text,maxtext)
- text_new = ""
- xtext = []
- line = 0
- text.each_line{|x| text_new += x.gsub(/\\\S\[\d+\]/i){}} #去掉控制符
- text_new.each_line{|x| xtext.push x.gsub(/\n/){}} #去掉换行符
- xtext.each{|x| line += (x.size / (maxtext.to_f + 1).to_i) + 1}
- line
- end
- end
- #==============================================================================
- # ■ Window_Help_Ex
- #------------------------------------------------------------------------------
- # 加强显示特技和物品等的说明
- #==============================================================================
-
- class Window_Help_Ex < Window_Base
- include VIPArcher::Equipplus
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(line_number = 0)
- super(0, 0, 210, 0)
- self.z = 150
- contents.font.size = Font_Size
- @time = 0
- end
- #--------------------------------------------------------------------------
- # ● 设置内容
- #--------------------------------------------------------------------------
- def set_text(text)
- @text = text
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 清除
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助位置
- #--------------------------------------------------------------------------
- def uppos(index,rect,window)
- self.height = fitting_height_vip(VIPArcher::Equipplus.getline(@xtext,13))
- create_contents
- contents.font.name = Font_Name
- contents.font.size = Font_Size
- rect.x -= window.ox
- rect.y -= window.oy
- ax = rect.x + rect.width + 10
- ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
- ax += window.x
- ax = 0 if ax < 0
- ay = rect.y + rect.height
- ay = rect.y - self.height if ay + self.height > window.height
- ay += window.y
- ay = 0 if ay < 0
- self.x = ax
- self.y = ay
- set_text(@xtext)
- @time = TIME
- self.show
- self.openness = 0
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 技能、物品等
- #--------------------------------------------------------------------------
- def set_item(item)
- if item == nil
- set_text("")
- return
- end
- @xtext = ""
- if $VIPArcherScript[:itemcolor] # require 物品描绘颜色脚本
- @xtext = "\\c[16]名称:\\c[#{VIPArcher::ItemColor::Color_Lv[item.color]}]" +
- "#{item.name} #{item.color if item.color != 0}#{"★" if item.color != 0}\\c[0]\n"
- else
- @xtext = "\\c[16]名称:\\c[0]#{item.name}\n"
- end
- @xtext += "\\c[16]介绍:\\c[0]#{item.description}\n"
- if $VIPArcherScript[:load] # require 队伍负重脚本
- @xtext += "\\c[16]售价:#{item.price} 重量:#{item.load}\\c[0]\n"
- else
- @xtext += item.price == 0 ? "\\c[16]售价:\\c[14]无法出售\\c[0]\n":"\\c[16]售价:#{item.price}\\c[0]\n"
- end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
- @xtext += VIPArcher::Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
- @xtext += VIPArcher::Equipplus.getskillhelp(item) if item.is_a?(RPG::Skill)
- @xtext += VIPArcher::Equipplus.getitemhelp(item) if item.is_a?(RPG::Item)
- if $VIPArcherScript[:exdrop_rate] # require 队伍掉率扩展
- @xtext += "\\c[#{$2.to_i > 0 ? UP : DOWN}]#{$1}掉率: #{$2}%\\c[0]\n" if
- item.note =~ /<(\W+)掉率:\s*([0-9+.-]+)%>/i
- end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Skill)
- @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- self.hide if @text == ""
- draw_text_vip(4, 0, @text,width,40,false)
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- @time -= 1 if @time > 0
- self.open if @time == 0
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 计算窗口显示指定行数时的应用高度2*************************
- #--------------------------------------------------------------------------
- def fitting_height_vip(line_number)
- line_number * contents.font.size + standard_padding * 2
- end
- # draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
- #--------------------------------------------------------------------------
- # ● 绘制带有控制符的文本内容
- # 如果传递了width参数的话,会自动换行
- #--------------------------------------------------------------------------
- def draw_text_vip(x, y, text, width = nil,textwidth = nil,normalfont = true)
- reset_font_settings if normalfont == true
- text = convert_escape_characters(text)
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
- if width != nil
- pos[:height] = contents.font.size
- pos[:width] = width
- pos[:textwidth] = textwidth
- end
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- #--------------------------------------------------------------------------
- # ● 文字的处理
- # c : 文字
- # text : 绘制处理中的字符串缓存(字符串可能会被修改)
- # pos : 绘制位置 {:x, :y, :new_x, :height}
- #--------------------------------------------------------------------------
- def process_character(c, text, pos)
- case c
- when "\r" # 回车
- return
- when "\n" # 换行
- process_new_line(text, pos)
- when "\f" # 翻页
- process_new_page(text, pos)
- when "\e" # 控制符
- process_escape_character(obtain_escape_code(text), text, pos)
- else # 普通文字
- pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
- if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
- process_new_line(text, pos)
- end
- process_normal_character(c, pos)
- end
- end
- #--------------------------------------------------------------------------
- # ● 处理换行文字
- #--------------------------------------------------------------------------
- alias vip_20141007_process_new_line process_new_line
- def process_new_line(text, pos)
- vip_20141007_process_new_line(text, pos)
- pos[:height] = contents.font.size if pos[:width] != nil
- end
- end
-
- #==============================================================================
- # ■ 设置帮助增强窗口
- #==============================================================================
- class Window_Selectable < Window_Base
- attr_reader :help_ex_window
- #--------------------------------------------------------------------------
- # ● 调用帮助窗口的更新方法
- #--------------------------------------------------------------------------
- alias help_ex_call_update_help call_update_help
- def call_update_help
- help_ex_call_update_help
- update_ex_help if active && @help_ex_window
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_ex_help
- @help_ex_window.set_item(item) if @help_ex_window
- if index != -1 && item != nil
- @help_ex_window.uppos(index,item_rect(index),self)
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置帮助增强窗口
- #--------------------------------------------------------------------------
- def help_ex_window=(help_ex_window)
- @help_ex_window = help_ex_window
- end
- end
- #==============================================================================
- # ■ 在各场景处理帮助窗口
- #==============================================================================
- class Scene_Base
- #--------------------------------------------------------------------------
- # ● 生成帮助增强窗口
- #--------------------------------------------------------------------------
- def create_help_ex
- @help_ex_window = Window_Help_Ex.new
- @help_ex_window .viewport = @viewport
- @item_window.help_ex_window = @help_ex_window if @item_window
- @slot_window.help_ex_window = @help_ex_window if @slot_window
- @skill_window.help_ex_window = @help_ex_window if @skill_window
- @buy_window.help_ex_window = @help_ex_window if @buy_window
- @sell_window.help_ex_window = @help_ex_window if @sell_window
- end
- end
- #道具栏
- class Scene_Item < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 物品“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_cancel on_item_cancel
- def on_item_cancel
- help_ex_on_item_cancel
- @help_ex_window.hide
- end
- end
- #装备栏
- class Scene_Equip < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 装备栏“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_slot_cancel on_slot_cancel
- def on_slot_cancel
- help_ex_on_slot_cancel
- @help_ex_window.hide
- end
- end
- #技能栏
- class Scene_Skill < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 物品“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_ok on_item_ok
- def on_item_ok
- help_ex_on_item_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 物品“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_cancel on_item_cancel
- def on_item_cancel
- help_ex_on_item_cancel
- @help_ex_window.hide
- end
- end
- #战斗界面
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 技能“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_skill_ok on_skill_ok
- def on_skill_ok
- help_ex_on_skill_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 技能“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_skill_cancel on_skill_cancel
- def on_skill_cancel
- help_ex_on_skill_cancel
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 物品“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_ok on_item_ok
- def on_item_ok
- help_ex_on_item_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 物品“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_cancel on_item_cancel
- def on_item_cancel
- help_ex_on_item_cancel
- @help_ex_window.hide
- end
- end
- #商店界面
- class Scene_Shop < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 买入“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_buy_ok on_buy_ok
- def on_buy_ok
- help_ex_on_buy_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 买入“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_buy_cancel on_buy_cancel
- def on_buy_cancel
- help_ex_on_buy_cancel
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 卖出“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_sell_ok on_sell_ok
- def on_sell_ok
- help_ex_on_sell_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 卖出“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_sell_cancel on_sell_cancel
- def on_sell_cancel
- help_ex_on_sell_cancel
- @help_ex_window.hide
- end
- end
复制代码- #==============================================================================
- # ■ RGSS3 アイテム合成 ver 1.04
- #------------------------------------------------------------------------------
- # 配布元:
- # 白の魔 http://izumiwhite.web.fc2.com/
- #
- # 利用規約:
- # RPGツクールVX Aceの正規の登録者のみご利用になれます。
- # 利用報告・著作権表示とかは必要ありません。
- # 改造もご自由にどうぞ。
- # 何か問題が発生しても責任は持ちません。
- #==============================================================================
- #--------------------------------------------------------------------------
- # ★ 初期設定。
- # 合成レシピ等の設定
- #--------------------------------------------------------------------------
- module WD_itemsynthesis_ini
-
- Cost_view = true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
-
- Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
- Category_w = true #カテゴリウィンドウに「武器」の項目を表示
- Category_a = true #カテゴリウィンドウに「防具」の項目を表示
- Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示
-
- I_recipe = [] #この行は削除しないこと
- W_recipe = [] #この行は削除しないこと
- A_recipe = [] #この行は削除しないこと
-
- #以下、合成レシピ。
- #例: I_recipe[3] = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
- #と記載した場合、ID3のアイテムの合成必要は、100G。
- #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
- #となる。
-
- #アイテムの合成レシピ
- I_recipe[2] = [10, ["I",1,2]]
- I_recipe[3] = [100, ["I",1,1], ["I",2,1]]
- I_recipe[17] = [500, ["I",1,10]]
- #武器の合成レシピ
- W_recipe[11] = [50, ["W",1,1], ["W",2,1]]
- W_recipe[12] = [600, ["W",3,1], ["I",17,0]]
-
- #防具の合成レシピ
- A_recipe[2] = [40, ["A",1,2]]
- A_recipe[5] = [400, ["A",2,1], ["W",2,2], ["I",17,0]]
-
- end
- #==============================================================================
- # ■ WD_itemsynthesis
- #------------------------------------------------------------------------------
- # アイテム合成用の共通メソッドです。
- #==============================================================================
- module WD_itemsynthesis
- def i_recipe_switch_on(id)
- $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
- $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
- $game_system.i_rcp_sw[id] = true
- end
- def i_recipe_switch_off(id)
- $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
- $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
- $game_system.i_rcp_sw[id] = false
- end
- def i_recipe_switch_on?(id)
- $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
- $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
- return $game_system.i_rcp_sw[id]
- end
- def i_recipe_all_switch_on
- for i in 1..$data_items.size
- i_recipe_switch_on(i)
- end
- end
- def i_recipe_all_switch_off
- for i in 1..$data_items.size
- i_recipe_switch_off(i)
- end
- end
- def w_recipe_switch_on(id)
- $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
- $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
- $game_system.w_rcp_sw[id] = true
- end
- def w_recipe_switch_off(id)
- $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
- $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
- $game_system.w_rcp_sw[id] = false
- end
- def w_recipe_switch_on?(id)
- $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
- $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
- return $game_system.w_rcp_sw[id]
- end
- def w_recipe_all_switch_on
- for i in 1..$data_weapons.size
- w_recipe_switch_on(i)
- end
- end
- def w_recipe_all_switch_off
- for i in 1..$data_weapons.size
- w_recipe_switch_off(i)
- end
- end
- def a_recipe_switch_on(id)
- $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
- $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
- $game_system.a_rcp_sw[id] = true
- end
- def a_recipe_switch_off(id)
- $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
- $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
- $game_system.a_rcp_sw[id] = false
- end
- def a_recipe_switch_on?(id)
- $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
- $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
- return $game_system.a_rcp_sw[id]
- end
- def a_recipe_all_switch_on
- for i in 1..$data_armors.size
- a_recipe_switch_on(i)
- end
- end
- def a_recipe_all_switch_off
- for i in 1..$data_armors.size
- a_recipe_switch_off(i)
- end
- end
- def recipe_all_switch_on
- i_recipe_all_switch_on
- w_recipe_all_switch_on
- a_recipe_all_switch_on
- end
- def recipe_all_switch_off
- i_recipe_all_switch_off
- w_recipe_all_switch_off
- a_recipe_all_switch_off
- end
- end
- class Game_Interpreter
- include WD_itemsynthesis
- end
- class Game_System
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :i_rcp_sw
- attr_accessor :w_rcp_sw
- attr_accessor :a_rcp_sw
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias wd_orig_initialize004 initialize
- def initialize
- wd_orig_initialize004
- @i_rcp_sw = []
- @w_rcp_sw = []
- @a_rcp_sw = []
- end
- end
- #==============================================================================
- # ■ Scene_ItemSynthesis
- #------------------------------------------------------------------------------
- # 合成画面の処理を行うクラスです。
- #==============================================================================
- class Scene_ItemSynthesis < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 開始処理
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_dummy_window
- create_number_window
- create_status_window
- create_material_window
- create_list_window
- create_category_window
- create_gold_window
- create_change_window
- end
- #--------------------------------------------------------------------------
- # ● ゴールドウィンドウの作成
- #--------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.viewport = @viewport
- @gold_window.x = Graphics.width - @gold_window.width
- @gold_window.y = @help_window.height
- @gold_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 切り替え表示ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_change_window
- wx = 0
- wy = @gold_window.y
- ww = Graphics.width - @gold_window.width
- wh = @gold_window.height
- @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
- @change_window.viewport = @viewport
- @change_window.hide
- end
- #--------------------------------------------------------------------------
- # ● ダミーウィンドウの作成
- #--------------------------------------------------------------------------
- def create_dummy_window
- wy = @help_window.y + @help_window.height + 48
- wh = Graphics.height - wy
- @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
- @dummy_window.viewport = @viewport
- end
- #--------------------------------------------------------------------------
- # ● 個数入力ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_number_window
- wy = @dummy_window.y
- wh = @dummy_window.height
- @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
- @number_window.viewport = @viewport
- @number_window.hide
- @number_window.set_handler(:ok, method(:on_number_ok))
- @number_window.set_handler(:cancel, method(:on_number_cancel))
- @number_window.set_handler(:change_window, method(:on_change_window))
- end
- #--------------------------------------------------------------------------
- # ● ステータスウィンドウの作成
- #--------------------------------------------------------------------------
- def create_status_window
- wx = @number_window.width
- wy = @dummy_window.y
- ww = Graphics.width - wx
- wh = @dummy_window.height
- @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
- @status_window.viewport = @viewport
- @status_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 素材ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_material_window
- wx = @number_window.width
- wy = @dummy_window.y
- ww = Graphics.width - wx
- wh = @dummy_window.height
- @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
- @material_window.viewport = @viewport
- @material_window.hide
- @number_window.material_window = @material_window
- end
- #--------------------------------------------------------------------------
- # ● 合成アイテムリストウィンドウの作成
- #--------------------------------------------------------------------------
- def create_list_window
- wy = @dummy_window.y
- wh = @dummy_window.height
- @list_window = Window_ItemSynthesisList.new(0, wy, wh)
- @list_window.viewport = @viewport
- @list_window.help_window = @help_window
- @list_window.status_window = @status_window
- @list_window.material_window = @material_window
- @list_window.hide
- @list_window.set_handler(:ok, method(:on_list_ok))
- @list_window.set_handler(:cancel, method(:on_list_cancel))
- @list_window.set_handler(:change_window, method(:on_change_window))
- end
- #--------------------------------------------------------------------------
- # ● カテゴリウィンドウの作成
- #--------------------------------------------------------------------------
- def create_category_window
- @category_window = Window_ItemSynthesisCategory.new
- @category_window.viewport = @viewport
- @category_window.help_window = @help_window
- @category_window.y = @help_window.height
- @category_window.activate
- @category_window.item_window = @list_window
- @category_window.set_handler(:ok, method(:on_category_ok))
- @category_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # ● 合成アイテムリストウィンドウのアクティブ化
- #--------------------------------------------------------------------------
- def activate_list_window
- @list_window.money = money
- @list_window.show.activate
- end
- #--------------------------------------------------------------------------
- # ● 合成[決定]
- #--------------------------------------------------------------------------
- def on_list_ok
- @item = @list_window.item
- @list_window.hide
- @number_window.set(@item, max_buy, buying_price, currency_unit)
- @number_window.show.activate
- end
- #--------------------------------------------------------------------------
- # ● 合成[キャンセル]
- #--------------------------------------------------------------------------
- def on_list_cancel
- @category_window.activate
- @category_window.show
- @dummy_window.show
- @list_window.hide
- @status_window.hide
- @status_window.item = nil
- @material_window.hide
- @material_window.set(nil, nil)
- @gold_window.hide
- @change_window.hide
- @help_window.clear
- end
- #--------------------------------------------------------------------------
- # ● 表示切替
- #--------------------------------------------------------------------------
- def on_change_window
- if @status_window.visible
- @status_window.hide
- @material_window.show
- else
- @status_window.show
- @material_window.hide
- end
- end
- #--------------------------------------------------------------------------
- # ● カテゴリ[決定]
- #--------------------------------------------------------------------------
- def on_category_ok
- activate_list_window
- @gold_window.show
- @change_window.show
- @material_window.show
- @category_window.hide
- @list_window.select(0)
- end
- #--------------------------------------------------------------------------
- # ● 個数入力[決定]
- #--------------------------------------------------------------------------
- def on_number_ok
- Sound.play_shop
- do_syntetic(@number_window.number)
- end_number_input
- @gold_window.refresh
- end
- #--------------------------------------------------------------------------
- # ● 個数入力[キャンセル]
- #--------------------------------------------------------------------------
- def on_number_cancel
- Sound.play_cancel
- end_number_input
- end
- #--------------------------------------------------------------------------
- # ● 合成の実行
- #--------------------------------------------------------------------------
- def do_syntetic(number)
- $game_party.lose_gold(number * buying_price)
- $game_party.gain_item(@item, number)
-
- @recipe = @list_window.recipe(@item)
- for i in [email protected]
- kind = @recipe[i][0]
- id = @recipe[i][1]
- num = @recipe[i][2]
- if kind == "I"
- item = $data_items[id]
- elsif kind == "W"
- item = $data_weapons[id]
- elsif kind == "A"
- item = $data_armors[id]
- end
- $game_party.lose_item(item, num*number)
- end
- end
- #--------------------------------------------------------------------------
- # ● 個数入力の終了
- #--------------------------------------------------------------------------
- def end_number_input
- @number_window.hide
- activate_list_window
- end
- #--------------------------------------------------------------------------
- # ● 最大購入可能個数の取得
- #--------------------------------------------------------------------------
- def max_buy
- max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
-
- @recipe = @list_window.recipe(@item)
- for i in [email protected]
- kind = @recipe[i][0]
- id = @recipe[i][1]
- num = @recipe[i][2]
- if kind == "I"
- item = $data_items[id]
- elsif kind == "W"
- item = $data_weapons[id]
- elsif kind == "A"
- item = $data_armors[id]
- end
- if num > 0
- max_buf = $game_party.item_number(item)/num
- else
- max_buf = 999
- end
- max = [max, max_buf].min
- end
-
- buying_price == 0 ? max : [max, money / buying_price].min
- end
- #--------------------------------------------------------------------------
- # ● 所持金の取得
- #--------------------------------------------------------------------------
- def money
- @gold_window.value
- end
- #--------------------------------------------------------------------------
- # ● 通貨単位の取得
- #--------------------------------------------------------------------------
- def currency_unit
- @gold_window.currency_unit
- end
- #--------------------------------------------------------------------------
- # ● 合成費用の取得
- #--------------------------------------------------------------------------
- def buying_price
- @list_window.price(@item)
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisList
- #------------------------------------------------------------------------------
- # 合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisList < Window_Selectable
- include WD_itemsynthesis
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :status_window # ステータスウィンドウ
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, height)
- super(x, y, window_width, height)
-
- @shop_goods = []
- @shop_recipes = []
-
- for i in 1..WD_itemsynthesis_ini::I_recipe.size
- recipe = WD_itemsynthesis_ini::I_recipe[i]
- if recipe
- good = [0, i, recipe[0]]
- if i_recipe_switch_on?(i)
- @shop_goods.push(good)
- @shop_recipes.push(recipe)
- end
- end
- end
- for i in 1..WD_itemsynthesis_ini::W_recipe.size
- recipe = WD_itemsynthesis_ini::W_recipe[i]
- if recipe
- good = [1, i, recipe[0]]
- if w_recipe_switch_on?(i)
- @shop_goods.push(good)
- @shop_recipes.push(recipe)
- end
- end
- end
- for i in 1..WD_itemsynthesis_ini::A_recipe.size
- recipe = WD_itemsynthesis_ini::A_recipe[i]
- if recipe
- good = [2, i, recipe[0]]
- if a_recipe_switch_on?(i)
- @shop_goods.push(good)
- @shop_recipes.push(recipe)
- end
- end
- end
-
- @money = 0
- refresh
- select(0)
- end
- #--------------------------------------------------------------------------
- # ● ウィンドウ幅の取得
- #--------------------------------------------------------------------------
- def window_width
- return 304
- end
- #--------------------------------------------------------------------------
- # ● 項目数の取得
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def item
- @data[index]
- end
- #--------------------------------------------------------------------------
- # ● 所持金の設定
- #--------------------------------------------------------------------------
- def money=(money)
- @money = money
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 選択項目の有効状態を取得
- #--------------------------------------------------------------------------
- def current_item_enabled?
- enable?(@data[index])
- end
- #--------------------------------------------------------------------------
- # ● 合成費用を取得
- #--------------------------------------------------------------------------
- def price(item)
- @price[item]
- end
- #--------------------------------------------------------------------------
- # ● 合成可否を取得
- #--------------------------------------------------------------------------
- def enable?(item)
- @makable[item]
- end
- #--------------------------------------------------------------------------
- # ● レシピを取得
- #--------------------------------------------------------------------------
- def recipe(item)
- @recipe[item]
- end
- #--------------------------------------------------------------------------
- # ● アイテムを許可状態で表示するかどうか
- #--------------------------------------------------------------------------
- def have_mat?(recipe)
- flag = true
- if @money >= recipe[0]
- for i in 1...recipe.size
- kind = recipe[i][0]
- id = recipe[i][1]
- num = recipe[i][2]
- if kind == "I"
- item = $data_items[id]
- elsif kind == "W"
- item = $data_weapons[id]
- elsif kind == "A"
- item = $data_armors[id]
- end
- if $game_party.item_number(item) < [num, 1].max
- flag = false
- end
- end
- else
- flag = false
- end
- return flag
- end
- #--------------------------------------------------------------------------
- # ● カテゴリの設定
- #--------------------------------------------------------------------------
- def category=(category)
- return if @category == category
- @category = category
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- #--------------------------------------------------------------------------
- # ● アイテムをリストに含めるかどうか
- #--------------------------------------------------------------------------
- def include?(item)
- case @category
- when :item
- item.is_a?(RPG::Item) && !item.key_item?
- when :weapon
- item.is_a?(RPG::Weapon)
- when :armor
- item.is_a?(RPG::Armor)
- when :key_item
- item.is_a?(RPG::Item) && item.key_item?
- else
- false
- end
- end
- #--------------------------------------------------------------------------
- # ● アイテムリストの作成
- #--------------------------------------------------------------------------
- def make_item_list
- @data = []
- @price = {}
- @makable = {}
- @recipe = {}
- for i in 0...@shop_goods.size
- goods = @shop_goods[i]
- recipe = @shop_recipes[i]
- case goods[0]
- when 0; item = $data_items[goods[1]]
- when 1; item = $data_weapons[goods[1]]
- when 2; item = $data_armors[goods[1]]
- end
- if item
- if include?(item)
- @data.push(item)
- @price[item] = goods[2]
- @makable[item] = have_mat?(recipe) && $game_party.item_number(item) < $game_party.max_item_number(item)
- @recipe[item] = recipe
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- rect = item_rect(index)
- draw_item_name(item, rect.x, rect.y, enable?(item))
- rect.width -= 4
- draw_text(rect, price(item), 2) if WD_itemsynthesis_ini::Cost_view
- end
- #--------------------------------------------------------------------------
- # ● ステータスウィンドウの設定
- #--------------------------------------------------------------------------
- def status_window=(status_window)
- @status_window = status_window
- call_update_help
- end
- #--------------------------------------------------------------------------
- # ● 素材ウィンドウの設定
- #--------------------------------------------------------------------------
- def material_window=(material_window)
- @material_window = material_window
- call_update_help
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item) if @help_window
- @status_window.item = item if @status_window
- @material_window.set(item, recipe(item)) if @material_window
- end
- #--------------------------------------------------------------------------
- # ● Z ボタン(表示切替)が押されたときの処理
- #--------------------------------------------------------------------------
- def process_change_window
- Sound.play_cursor
- Input.update
- call_handler(:change_window)
- end
- #--------------------------------------------------------------------------
- # ● 決定やキャンセルなどのハンドリング処理
- #--------------------------------------------------------------------------
- def process_handling
- super
- if active
- return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
- # return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
- end
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisMaterial
- #------------------------------------------------------------------------------
- # 合成画面で、合成に必要な素材を表示するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisMaterial < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @item = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_possession(4, 0)
- draw_material_info(0, line_height * 2)
- end
- #--------------------------------------------------------------------------
- # ● アイテムの設定
- #--------------------------------------------------------------------------
- def set(item, recipe)
- @item = item
- @recipe = recipe
- @make_number = 1
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 作成個数の設定
- #--------------------------------------------------------------------------
- def set_num(make_number)
- @make_number = make_number
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 所持数の描画
- #--------------------------------------------------------------------------
- def draw_possession(x, y)
- rect = Rect.new(x, y, contents.width - 4 - x, line_height)
- change_color(system_color)
- draw_text(rect, Vocab::Possession)
- change_color(normal_color)
- draw_text(rect, $game_party.item_number(@item), 2)
- end
- #--------------------------------------------------------------------------
- # ● 素材情報の描画
- #--------------------------------------------------------------------------
- def draw_material_info(x, y)
- rect = Rect.new(x, y, contents.width, line_height)
- change_color(system_color)
- contents.font.size = 18
- draw_text(rect, "必要素材", 0)
- if @recipe
- for i in [email protected]
- kind = @recipe[i][0]
- id = @recipe[i][1]
- num = @recipe[i][2]
- if kind == "I"
- item = $data_items[id]
- elsif kind == "W"
- item = $data_weapons[id]
- elsif kind == "A"
- item = $data_armors[id]
- end
- rect = Rect.new(x, y + line_height*i, contents.width, line_height)
- enabled = true
- enabled = false if [num*@make_number, 1].max > $game_party.item_number(item)
- draw_item_name(item, rect.x, rect.y, enabled)
- change_color(normal_color, enabled)
- if num > 0
- draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
- end
- end
- end
- change_color(normal_color)
- contents.font.size = 24
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisNumber
- #------------------------------------------------------------------------------
- # 合成画面で、合成するアイテムの個数を入力するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisNumber < Window_ShopNumber
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_item_name(@item, 0, item_y)
- draw_number
- draw_total_price if WD_itemsynthesis_ini::Cost_view
- end
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def material_window=(material_window)
- @material_window = material_window
- call_update_help
- end
- #--------------------------------------------------------------------------
- # ● 作成個数の変更
- #--------------------------------------------------------------------------
- def change_number(amount)
- @number = [[@number + amount, @max].min, 1].max
- call_update_help #追加
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def call_update_help
- @material_window.set_num(@number) if @material_window
- end
- #--------------------------------------------------------------------------
- # ● Z ボタン(表示切替)が押されたときの処理
- #--------------------------------------------------------------------------
- def process_change_window
- Sound.play_cursor
- Input.update
- call_handler(:change_window)
- end
- #--------------------------------------------------------------------------
- # ● 決定やキャンセルなどのハンドリング処理
- #--------------------------------------------------------------------------
- def process_handling
- super
- if active
- return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
- # return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
- end
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisCategory
- #------------------------------------------------------------------------------
- # 合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisCategory < Window_ItemCategory
- #--------------------------------------------------------------------------
- # ● 桁数の取得
- #--------------------------------------------------------------------------
- def col_max
- i = 0
- i += 1 if WD_itemsynthesis_ini::Category_i
- i += 1 if WD_itemsynthesis_ini::Category_w
- i += 1 if WD_itemsynthesis_ini::Category_a
- i += 1 if WD_itemsynthesis_ini::Category_k
- return i
- end
- #--------------------------------------------------------------------------
- # ● コマンドリストの作成
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::item, :item) if WD_itemsynthesis_ini::Category_i
- add_command(Vocab::weapon, :weapon) if WD_itemsynthesis_ini::Category_w
- add_command(Vocab::armor, :armor) if WD_itemsynthesis_ini::Category_a
- add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisNumber
- #------------------------------------------------------------------------------
- # 合成画面で、切替を表示するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisChange < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- text = "D: 制作素材 / 装备对比 界面切换"
- draw_text(0, 0, contents_width, line_height, text, 1)
- end
- end
复制代码 |
|