赞 | 13 |
VIP | 118 |
好人卡 | 28 |
积分 | 12 |
经验 | 35779 |
最后登录 | 2017-7-6 |
在线时间 | 1564 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1195
- 在线时间
- 1564 小时
- 注册时间
- 2008-7-30
- 帖子
- 4418
|
http://tempuser.138yf.com/fsl/project/RPGVX/FSL_SHOP/1.2.0828.rar- #===============================================================================
- # ■ 简易商店拓展描绘
- # FSL_SHOP
- #-------------------------------------------------------------------------------
- # 放在默认脚本之后,Main脚本之前,通过事件指令【商店处理】调用。
- #
- # 本脚本可以方便商店购物选择。
- #-------------------------------------------------------------------------------
- # 更新作者: wangswz DeathKing
- # 许可协议: FSL
- # 项目版本: 1.2.0828
- # 引用网址: http://rpg.blue/thread-154915-1-1.html
- #-------------------------------------------------------------------------------
- # - 1.2.0828 (By DeathKing)
- # * 修正了@item.limt_num的NoMethodError;
- #
- # - 1.1.0827 (By wangswz)
- # * 初始版本;
- #
- #===============================================================================
- $imported = {} if $imported == nil
- $fscript = {} if $fscript == nil
- $fscript["FSL_SHOP"] = "1.1.0827"
- #-------------------------------------------------------------------------------
- # ▼ 通用配置模块
- #-------------------------------------------------------------------------------
- module FSL
- module SHOP
- # ◆ 设置atk def spi agi 上升 下降图标显示
- Shop_icon = [120,121,122,123,124,125,126,127]
-
- # ◆ 无法装备的提示信息
- Shop_help = "-无法装备-"
- end
- end
- #==============================================================================
- # ■ Scene_Shop
- #------------------------------------------------------------------------------
- # 处理商店画面的类。
- #==============================================================================
- class Scene_Shop < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- create_command_window
- @help_window = Window_Help.new
- @gold_window = Window_Gold.new(384, 56)
- @dummy_window = Window_Base.new(0, 112, 544, 304)
- @buy_window = Window_ShopBuy.new(0, 112)
- @buy_window.active = false
- @buy_window.visible = false
- @buy_window.help_window = @help_window
- @sell_window = Window_ShopSell.new(0, 112, 544, 304)
- @sell_window.active = false
- @sell_window.visible = false
- @sell_window.help_window = @help_window
- @number_window = Window_ShopNumber.new(0, 112)
- @number_window.active = false
- @number_window.visible = false
- @actor_index = 0
- @status_window = Window_Shop_ActorStatus.new($game_party.members[@actor_index])
- @status_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- dispose_command_window
- @help_window.dispose
- @gold_window.dispose
- @dummy_window.dispose
- @buy_window.dispose
- @sell_window.dispose
- @number_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @help_window.update
- @command_window.update
- @gold_window.update
- @dummy_window.update
- @buy_window.update
- @sell_window.update
- @number_window.update
- @status_window.update
- if @command_window.active
- update_command_selection
- elsif @buy_window.active
- update_buy_selection
- elsif @sell_window.active
- update_sell_selection
- elsif @number_window.active
- update_number_input
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成命令窗口
- #--------------------------------------------------------------------------
- def create_command_window
- s1 = Vocab::ShopBuy
- s2 = Vocab::ShopSell
- s3 = Vocab::ShopCancel
- @command_window = Window_Command.new(384, [s1, s2, s3], 3)
- @command_window.y = 56
- if $game_temp.shop_purchase_only
- @command_window.draw_item(1, false)
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放命令窗口
- #--------------------------------------------------------------------------
- def dispose_command_window
- @command_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新命令窗口
- #--------------------------------------------------------------------------
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- case @command_window.index
- when 0 # 买入
- Sound.play_decision
- @command_window.active = false
- @dummy_window.visible = false
- @buy_window.active = true
- @buy_window.visible = true
- @buy_window.refresh
- @status_window.visible = true
- when 1 # 卖出
- if $game_temp.shop_purchase_only
- Sound.play_buzzer
- else
- Sound.play_decision
- @command_window.active = false
- @dummy_window.visible = false
- @sell_window.active = true
- @sell_window.visible = true
- @sell_window.refresh
- end
- when 2 # 离开
- Sound.play_decision
- $scene = Scene_Map.new
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新买入选择
- #--------------------------------------------------------------------------
- def update_buy_selection
- if $imported["LimitBreak"] == false
- @status_window.item = @buy_window.item
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @dummy_window.visible = true
- @buy_window.active = false
- @buy_window.visible = false
- @status_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- return
- end
- if Input.trigger?(Input::C)
- @item = @buy_window.item
- number = $game_party.item_number(@item)
- if @item == nil or @item.price > $game_party.gold or number == 99
- Sound.play_buzzer
- else
- Sound.play_decision
- max = @item.price == 0 ? 99 : $game_party.gold / @item.price
- max = [max, 99 - number].min
- @buy_window.active = false
- @buy_window.visible = false
- @number_window.set(@item, max, @item.price)
- @number_window.active = true
- @number_window.visible = true
- end
- end
- if Input.trigger?(Input::R)
- Sound.play_cursor
- next_actor
- elsif Input.trigger?(Input::L)
- Sound.play_cursor
- prev_actor
- end
- else
- @status_window.item = @buy_window.item
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @dummy_window.visible = true
- @buy_window.active = false
- @buy_window.visible = false
- @status_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- return
- end
- if Input.trigger?(Input::C)
- @item = @buy_window.item
- number = $game_party.item_number(@item)
- if @item == nil || @item.price > $game_party.gold or number == 99
- Sound.play_buzzer
- else
- Sound.play_decision
- max = (@item.price == 0 ? 99 : $game_party.gold / @item.price)
- max = [max, 99 - number].min
- @buy_window.active = false
- @buy_window.visible = false
- @number_window.set(@item, max, @item.price)
- @number_window.active = true
- @number_window.visible = true
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 切换至下一角色画面
- #--------------------------------------------------------------------------
- def next_actor
- @actor_index += 1
- @actor_index %= $game_party.members.size
- @status_window.actor = ($game_party.members[@actor_index])
- end
- #--------------------------------------------------------------------------
- # ● 切换至上一角色画面
- #--------------------------------------------------------------------------
- def prev_actor
- @actor_index += $game_party.members.size - 1
- @actor_index %= $game_party.members.size
- @status_window.actor = ($game_party.members[@actor_index])
- end
- #--------------------------------------------------------------------------
- # ● 更新卖出选择
- #--------------------------------------------------------------------------
- def update_sell_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @dummy_window.visible = true
- @sell_window.active = false
- @sell_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- elsif Input.trigger?(Input::C)
- @item = @sell_window.item
- @status_window.item = @item
- if @item == nil or @item.price == 0
- Sound.play_buzzer
- else
- Sound.play_decision
- max = $game_party.item_number(@item)
- @sell_window.active = false
- @sell_window.visible = false
- @number_window.set(@item, max, @item.price / 2)
- @number_window.active = true
- @number_window.visible = true
- @status_window.visible = true
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新数值输入
- #--------------------------------------------------------------------------
- def update_number_input
- if Input.trigger?(Input::B)
- cancel_number_input
- elsif Input.trigger?(Input::C)
- decide_number_input
- end
- end
- #--------------------------------------------------------------------------
- # ● 取消数值输入
- #--------------------------------------------------------------------------
- def cancel_number_input
- Sound.play_cancel
- @number_window.active = false
- @number_window.visible = false
- case @command_window.index
- when 0 # 买入
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- end
- end
- #--------------------------------------------------------------------------
- # ● 确认数值输入
- #--------------------------------------------------------------------------
- def decide_number_input
- Sound.play_shop
- @number_window.active = false
- @number_window.visible = false
- case @command_window.index
- when 0 # 买入
- $game_party.lose_gold(@number_window.number * @item.price)
- $game_party.gain_item(@item, @number_window.number)
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- $game_party.gain_gold(@number_window.number * (@item.price / 2))
- $game_party.lose_item(@item, @number_window.number)
- @gold_window.refresh
- @sell_window.refresh
- @status_window.refresh
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- end
- end
- end
- #==============================================================================
- # ■ Window_Shop_ActorStatus
- #------------------------------------------------------------------------------
- # 显示角色的状态窗口。
- #==============================================================================
- class Window_Shop_ActorStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor, item = nil)
- super(304, 112, 240, 304)
- @item = item
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_actor_face(@actor, 96, 4)
- draw_actor_name(@actor, 4, 0)
- draw_actor_graphic(@actor, 32, 64)
- if @item != nil
- draw_actor_parameter_change(@actor, 4, 96)
- number = $game_party.item_number(@item)
- self.contents.font.color = system_color
- self.contents.draw_text(4, 240, 200, WLH, Vocab::Possession)
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 240, 200, WLH, number, 2)
- if @item.is_a?(RPG::Item) && @item.scope > 6
- draw_item_parameter_change(4, 96)
- draw_actor_hp(@actor, 4, 96)
- draw_actor_mp(@actor, 4, 120)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制物品效果
- # x : 绘制点 X 座标
- # y : 绘制点 Y 座标
- #--------------------------------------------------------------------------
- def draw_item_parameter_change(x, y)
- self.contents.draw_text(x, y + WLH * 2, 200, WLH, "hp mp 回复值/率", 2)
-
- self.contents.font.color = hp_gauge_color1
- self.contents.draw_text(x - 10, y + WLH * 3, 104, WLH, sprintf("%d", @item.hp_recovery), 2)
- self.contents.draw_text(x, y + WLH * 4, 104, WLH, sprintf("%d", @item.hp_recovery_rate)+"%", 2)
-
- self.contents.font.color = mp_gauge_color1
- self.contents.draw_text(x - 10, y + WLH * 3, 200, WLH, sprintf("%d", @item.mp_recovery), 2)
- self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%d", @item.mp_recovery_rate)+"%", 2)
- end
- #--------------------------------------------------------------------------
- # ● 绘制角色当前装备和能力值
- # actor : 角色
- # x : 绘制点 X 座标
- # y : 绘制点 Y 座标
- #--------------------------------------------------------------------------
- def draw_actor_parameter_change(actor, x, y)
- return if @item.is_a?(RPG::Item)
- enabled = actor.equippable?(@item)
- if @item.is_a?(RPG::Weapon)
- item1 = weaker_weapon(actor)
- elsif actor.two_swords_style and @item.kind == 0
- item1 = nil
- else
- if $imported["EquipExtension"] == true
- index = actor.equip_type.index(@item.kind)
- item1 = (index != nil ? actor.equips[1 + index] : nil)
- else
- item1 = actor.equips[1 + @item.kind]
- end
- end
-
- if enabled
- atk1 = item1 == nil ? 0 : item1.atk
- atk2 = @item == nil ? 0 : @item.atk
- change = atk2 - atk1
- shop_change(change)
- if change > 0
- draw_icon(FSL::SHOP::Shop_icon[0], x + 24, y)
- elsif change < 0
- draw_icon(FSL::SHOP::Shop_icon[4], x + 24, y)
- end
- change = -change if change<=0
- self.contents.draw_text(x, y + WLH * 1, 56, WLH, sprintf("%d", change), 2)
- self.contents.draw_text(x, y + WLH * 5, 56, WLH, sprintf("%d", atk2), 2)
-
- def1 = item1 == nil ? 0 : item1.def
- def2 = @item == nil ? 0 : @item.def
- change = def2 - def1
- shop_change(change)
- if change > 0
- draw_icon(FSL::SHOP::Shop_icon[1], x + 72, y)
- elsif change < 0
- draw_icon(FSL::SHOP::Shop_icon[5], x + 72, y)
- end
- change = -change if change<=0
- self.contents.draw_text(x, y + WLH * 1, 104, WLH, sprintf("%d", change), 2)
- self.contents.draw_text(x, y + WLH * 5, 104, WLH, sprintf("%d", def2), 2)
-
- spi1 = item1 == nil ? 0 : item1.spi
- spi2 = @item == nil ? 0 : @item.spi
- change = spi2 - spi1
- shop_change(change)
- if change > 0
- draw_icon(FSL::SHOP::Shop_icon[2], x + 120, y)
- elsif change < 0
- draw_icon(FSL::SHOP::Shop_icon[6], x + 120, y)
- end
- change = -change if change<=0
- self.contents.draw_text(x, y + WLH * 1, 152, WLH, sprintf("%d", change), 2)
- self.contents.draw_text(x, y + WLH * 5, 152, WLH, sprintf("%d", spi2), 2)
-
- agi1 = item1 == nil ? 0 : item1.agi
- agi2 = @item == nil ? 0 : @item.agi
- change = agi2 - agi1
- shop_change(change)
- if change > 0
- draw_icon(FSL::SHOP::Shop_icon[3], x + 168, y)
- elsif change < 0
- draw_icon(FSL::SHOP::Shop_icon[7], x + 168, y)
- end
- change = -change if change<=0
- self.contents.draw_text(x, y + WLH * 1, 200, WLH, sprintf("%d", change), 2)
- self.contents.draw_text(x, y + WLH * 5, 200, WLH, sprintf("%d", agi2), 2)
-
-
- self.contents.font.color = normal_color
- self.contents.draw_text(4, y + 48, 204, WLH, "当前装备")
- self.contents.draw_text(4, y + 96, 204, WLH, "当前店中")
-
- self.contents.draw_text(x, y + WLH * 3, 56, WLH, sprintf("%d", atk1), 2)
- self.contents.draw_text(x, y + WLH * 3, 104, WLH, sprintf("%d", def1), 2)
- self.contents.draw_text(x, y + WLH * 3, 152, WLH, sprintf("%d", spi1), 2)
- self.contents.draw_text(x, y + WLH * 3, 200, WLH, sprintf("%d", agi1), 2)
-
- if item1 != nil
- self.contents.draw_text(120, y + 48, 208, WLH, item1.name)
- draw_icon(item1.icon_index, 96, y + 48)
- else
- self.contents.draw_text(96, y + 48, 208, WLH, "无")
- end
- else
- self.contents.font.color = normal_color
- self.contents.draw_text(0, y + 24, 200, WLH, FSL::SHOP::Shop_help, 1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断数值颜色
- # change : 数值
- #--------------------------------------------------------------------------
- def shop_change(change)
- if change == 0
- self.contents.font.color = normal_color
- else
- self.contents.font.color = change>0 ? power_up_color : power_down_color
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取双刀派角色所装备的武器中较弱的武器
- # actor : 角色
- #--------------------------------------------------------------------------
- def weaker_weapon(actor)
- if actor.two_swords_style
- weapon1 = actor.weapons[0]
- weapon2 = actor.weapons[1]
- if weapon1 == nil or weapon2 == nil
- return nil
- elsif weapon1.atk < weapon2.atk
- return weapon1
- else
- return weapon2
- end
- else
- return actor.weapons[0]
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置角色
- # actor : 角色
- #--------------------------------------------------------------------------
- def actor=(actor)
- if @actor != actor
- @actor = actor
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 新物品
- #--------------------------------------------------------------------------
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- end
复制代码 |
|