Project1

标题: 『FSL』简易商店拓展描绘 [打印本页]

作者: wangswz    时间: 2010-8-27 02:54
标题: 『FSL』简易商店拓展描绘
本帖最后由 wangswz 于 2010-9-15 20:06 编辑

对角色当前装备和店选物品做详尽信息描绘

左右键切换人物
排版修改中
可以在武器 防具栏内按X键(键盘默认A)来切换进行ATK DEF SPI AGI属性的降序排列
已方物品

目标为敌方的物品

没有的属性暗色显示


支持KGC脚本装备种类拓展脚本
支持KGC脚本多人数脚本队伍人数
支持KGC数值破限脚本
支持KGC合成脚本
    结合使用不会出现默认脚本商店提示信息显示不完整现象
同修改了Scene_Shop类的脚本有冲突可能

发现BUG请短消息告知..
更新 : 2010/8/27 增加物品数值显示
增加对KGC数值破限脚本的支持
更新 : 2010/8/28
修正了item.number_limit的NoMethodError判断错误问题 (By DeathKing)
调整操作手感 L R 换成左右键 (By wangswz)
更新 : 2010/8/30
物品 武器 防具分栏显示
现在可以在武器 防具栏内按X键(键盘默认A)来切换进行ATK DEF SPI AGI属性的降序排列了(By wangswz)
更新 : 2010/9/03
兼容KGC合成脚本了
增加物品描绘信息(By wangswz)
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ 简易商店拓展描绘脚本 - FSL_SHOP ◆ VX ◆
  3. #_/
  4. #_/    ◇ 许可协议 :FSL       ◇
  5. #_/    ◇ 项目分类 : 角色辅助  ◇
  6. #_/    ◇ 项目版本 : 1.5.903   ◇
  7. #_/    ◇ 建立日期 : 2010/8/26 ◇
  8. #_/    ◇ 最后更新 : 2010/9/03 ◇
  9. #_/----------------------------------------------------------------------------
  10. #_/  作者:wangswz DeathKing
  11. #_/  引用网址: http://rpg.blue/thread-154915-1-1.html
  12. #_/============================================================================
  13. #_/ 【基本机能】方便商店购物选择
  14. #_/  放在默认脚本之后,Main脚本之前,通过事件指令【商店处理】调用。
  15. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  16. #===============================================================================
  17. #-------------------------------------------------------------------------------
  18. # ▼ 通用配置模块
  19. #-------------------------------------------------------------------------------
  20. module FSL
  21.   module SHOP
  22.     # ◆ 无法装备的提示信息
  23.     Shop_help = "-无法装备-"
  24.    
  25.     # ◆ 无法使用的提示信息
  26.     Shop_help2 = "-无法使用-"
  27.    
  28.     # ◆ 设置atk def spi agi 上升 下降 相等时 图标显示 4个一组
  29.     Shop_icon = [
  30.     120,121,122,123,
  31.     124,125,126,127,
  32.       0,  0,  0,  0
  33.     ]
  34.   end
  35. end
  36. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  37. $imported = {} if $imported == nil
  38. $fscript = {} if $fscript == nil
  39. $fscript["FSL_SHOP"] = "1.5.903"
  40. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  41. #==============================================================================
  42. # ■ Scene_Map
  43. #==============================================================================

  44. class Scene_Map < Scene_Base
  45.   #--------------------------------------------------------------------------
  46.   # ● ショップ画面への切り替え
  47.   #--------------------------------------------------------------------------
  48.   def call_shop
  49.     if $imported["ComposeItem"] == true && $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH]
  50.       # 合成画面に移行
  51.       $game_temp.next_scene = nil
  52.       $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH] = false
  53.       $scene = Scene_ComposeItem.new
  54.     else
  55.       $game_temp.next_scene = nil
  56.       $scene = Scene_Shop2.new
  57.     end
  58.   end
  59. end
  60. #==============================================================================
  61. # ■ Scene_Shop
  62. #------------------------------------------------------------------------------
  63. #  处理商店画面的类。
  64. #==============================================================================

  65. class Scene_Shop2 < Scene_Base
  66.   #--------------------------------------------------------------------------
  67.   # ● 开始处理
  68.   #--------------------------------------------------------------------------
  69.   def start
  70.     super
  71.     create_menu_background
  72.     create_command_window
  73.     create_command_window2
  74.     @help_window = Window_Help.new
  75.     @gold_window = Window_Gold.new(384, 56)
  76.     @dummy_window = Window_Base.new(0, 112, 544, 304)
  77.     @dummy_window2 = Window_Base.new(304, 112, 240, 304)
  78.     @dummy_window3 = Window_Base.new(0, 168, 304, 248)
  79.     @dummy_window2.visible = false
  80.     @dummy_window3.visible = false
  81.     @buy_window = Window_ShopBuy2.new(0, 168)
  82.     @buy_window.active = false
  83.     @buy_window.visible = false
  84.     @buy_window.help_window = @help_window
  85.     @sell_window = Window_ShopSell.new(0, 112, 544, 304)
  86.     @sell_window.active = false
  87.     @sell_window.visible = false
  88.     @sell_window.help_window = @help_window
  89.     @number_window = Window_ShopNumber.new(0, 112)
  90.     @number_window.active = false
  91.     @number_window.visible = false
  92.     @actor_index = 0
  93.     @status_window = Window_Shop_ActorStatus.new($game_party.members[@actor_index])
  94.     @status_window.visible = false
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 结束处理
  98.   #--------------------------------------------------------------------------
  99.   def terminate
  100.     super
  101.     dispose_menu_background
  102.     dispose_command_window
  103.     dispose_command_window2
  104.     @help_window.dispose
  105.     @gold_window.dispose
  106.     @dummy_window.dispose
  107.     @dummy_window2.dispose
  108.     @dummy_window3.dispose
  109.     @buy_window.dispose
  110.     @sell_window.dispose
  111.     @number_window.dispose
  112.     @status_window.dispose
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 更新画面
  116.   #--------------------------------------------------------------------------
  117.   def update
  118.     super
  119.     update_menu_background
  120.     @help_window.update
  121.     @command_window.update
  122.     @command_window2.update
  123.     @gold_window.update
  124.     @dummy_window.update
  125.     @dummy_window2.update
  126.     @dummy_window3.update
  127.     @buy_window.update
  128.     @sell_window.update
  129.     @number_window.update
  130.     @status_window.update
  131.     if @command_window.active
  132.       update_command_selection
  133.     elsif @buy_window.active
  134.       update_buy_selection1
  135.     elsif @sell_window.active
  136.       update_sell_selection
  137.     elsif @number_window.active
  138.       update_number_input
  139.     elsif @command_window2.active
  140.       update_command_selection2
  141.     end
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 生成命令窗口
  145.   #--------------------------------------------------------------------------
  146.   def create_command_window
  147.     s1 = Vocab::ShopBuy
  148.     s2 = Vocab::ShopSell
  149.     s3 = Vocab::ShopCancel
  150.     @command_window = Window_Command.new(384, [s1, s2, s3], 3)
  151.     @command_window.y = 56
  152.     if $game_temp.shop_purchase_only
  153.       @command_window.draw_item(1, false)
  154.     end
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 释放命令窗口
  158.   #--------------------------------------------------------------------------
  159.   def dispose_command_window
  160.     @command_window.dispose
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 更新命令窗口
  164.   #--------------------------------------------------------------------------
  165.   def update_command_selection
  166.     if Input.trigger?(Input::B)
  167.       Sound.play_cancel
  168.       $scene = Scene_Map.new
  169.     elsif Input.trigger?(Input::C)
  170.       case @command_window.index
  171.       when 0  # 买入
  172.         Sound.play_decision
  173.         @command_window.active = false
  174.         @dummy_window.visible = false
  175.         @dummy_window2.visible = true
  176.         @dummy_window3.visible = true
  177.         @command_window2.active = true
  178.         @command_window2.visible = true
  179.       when 1  # 卖出
  180.         if $game_temp.shop_purchase_only
  181.           Sound.play_buzzer
  182.         else
  183.           Sound.play_decision
  184.           @command_window.active = false
  185.           @dummy_window.visible = false
  186.           @sell_window.active = true
  187.           @sell_window.visible = true
  188.           @sell_window.refresh
  189.         end
  190.       when 2  # 离开
  191.         Sound.play_decision
  192.         $scene = Scene_Map.new
  193.       end
  194.     end
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 生成二级命令窗口
  198.   #--------------------------------------------------------------------------
  199.   def create_command_window2
  200.     s1 = "物品"
  201.     s2 = "武器"
  202.     s3 = "防具"
  203.     @command_window2 = Window_Command.new(304, [s1, s2, s3], 3)
  204.     @command_window2.x = 0
  205.     @command_window2.y = 112
  206.     @command_window2.active = false
  207.     @command_window2.visible = false
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 释放二级命令窗口
  211.   #--------------------------------------------------------------------------
  212.   def dispose_command_window2
  213.     @command_window2.dispose
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 更新二级命令窗口
  217.   #--------------------------------------------------------------------------
  218.   def update_command_selection2
  219.     if Input.trigger?(Input::B)
  220.       Sound.play_cancel
  221.       @command_window.active = true
  222.       @command_window2.active = false
  223.       @command_window2.visible = false
  224.       @dummy_window.visible = true
  225.       @dummy_window2.visible = false
  226.       @dummy_window3.visible = false
  227.       @buy_window.active = false
  228.       @buy_window.visible = false
  229.       @status_window.visible = false
  230.       @status_window.item = nil
  231.       @help_window.set_text("")
  232.       return
  233.     elsif Input.trigger?(Input::C)
  234.       case @command_window2.index
  235.       when 0
  236.         Sound.play_decision
  237.         @command_window2.active = false
  238.         @buy_window.index = 0
  239.         @buy_window.active = true
  240.         @buy_window.visible = true
  241.         @buy_window.type = 0
  242.         @buy_window.refresh
  243.         @status_window.visible = true
  244.       when 1
  245.         Sound.play_decision
  246.         @command_window2.active = false
  247.         @buy_window.index = 0
  248.         @buy_window.active = true
  249.         @buy_window.visible = true
  250.         @buy_window.type = 1
  251.         @buy_window.refresh
  252.         @status_window.visible = true
  253.       when 2
  254.         Sound.play_decision
  255.         @command_window2.active = false
  256.         @buy_window.index = 0
  257.         @buy_window.active = true
  258.         @buy_window.visible = true
  259.         @buy_window.type = 2
  260.         @buy_window.refresh
  261.         @status_window.visible = true
  262.       end
  263.     end
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● 更新买入选择
  267.   #--------------------------------------------------------------------------
  268.   def update_buy_selection1
  269.     @status_window.item = @buy_window.item
  270.     if Input.trigger?(Input::B)
  271.       Sound.play_cancel
  272.       @command_window2.active = true
  273.       @buy_window.active = false
  274.       @buy_window.visible = false
  275.       @status_window.visible = false
  276.       @status_window.item = nil
  277.       @help_window.set_text("")
  278.       return
  279.     end
  280.     if Input.trigger?(Input::C)
  281.       @item = @buy_window.item
  282.       number = $game_party.item_number(@item)
  283.       if $imported["LimitBreak"] == true
  284.         if @item == nil || @item.price > $game_party.gold ||
  285.           number == @item.number_limit
  286.           Sound.play_buzzer
  287.         else
  288.           Sound.play_decision
  289.           max = (@item.price == 0 ?
  290.           @item.number_limit : $game_party.gold / @item.price)
  291.           max = [max, @item.number_limit - number].min
  292.           @buy_window.active = false
  293.           @buy_window.visible = false
  294.           @number_window.set(@item, max, @item.price)
  295.           @number_window.active = true
  296.           @number_window.visible = true
  297.         end
  298.       else
  299.         if @item == nil or @item.price > $game_party.gold or number == 99
  300.           Sound.play_buzzer
  301.         else
  302.           Sound.play_decision
  303.           max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  304.           max = [max, 99 - number].min
  305.           @buy_window.active = false
  306.           @buy_window.visible = false
  307.           @number_window.set(@item, max, @item.price)
  308.           @number_window.active = true
  309.           @number_window.visible = true
  310.         end
  311.       end
  312.     end
  313.     if Input.trigger?(Input::RIGHT)
  314.       Sound.play_cursor
  315.       next_actor
  316.     elsif Input.trigger?(Input::LEFT)
  317.       Sound.play_cursor
  318.       prev_actor
  319.     end
  320.     if Input.trigger?(Input::X)
  321.       @buy_window.sort_item
  322.     end
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● 切换至下一角色画面
  326.   #--------------------------------------------------------------------------
  327.   def next_actor
  328.     @actor_index += 1
  329.     @actor_index %= $game_party.members.size
  330.     @status_window.actor = ($game_party.members[@actor_index])
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 切换至上一角色画面
  334.   #--------------------------------------------------------------------------
  335.   def prev_actor
  336.     @actor_index += $game_party.members.size - 1
  337.     @actor_index %= $game_party.members.size
  338.     @status_window.actor = ($game_party.members[@actor_index])
  339.   end
  340.   #--------------------------------------------------------------------------
  341.   # ● 更新卖出选择
  342.   #--------------------------------------------------------------------------
  343.   def update_sell_selection
  344.     if Input.trigger?(Input::B)
  345.       Sound.play_cancel
  346.       @command_window.active = true
  347.       @dummy_window.visible = true
  348.       @sell_window.active = false
  349.       @sell_window.visible = false
  350.       @status_window.item = nil
  351.       @help_window.set_text("")
  352.     elsif Input.trigger?(Input::C)
  353.       @item = @sell_window.item
  354.       @status_window.item = @item
  355.       if @item == nil or @item.price == 0
  356.         Sound.play_buzzer
  357.       else
  358.         Sound.play_decision
  359.         max = $game_party.item_number(@item)
  360.         @sell_window.active = false
  361.         @sell_window.visible = false
  362.         @number_window.set(@item, max, @item.price / 2)
  363.         @number_window.active = true
  364.         @number_window.visible = true
  365.         @status_window.visible = true
  366.       end
  367.     end
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ● 更新数值输入
  371.   #--------------------------------------------------------------------------
  372.   def update_number_input
  373.     if Input.trigger?(Input::B)
  374.       cancel_number_input
  375.     elsif Input.trigger?(Input::C)
  376.       decide_number_input
  377.     end
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 取消数值输入
  381.   #--------------------------------------------------------------------------
  382.   def cancel_number_input
  383.     Sound.play_cancel
  384.     @number_window.active = false
  385.     @number_window.visible = false
  386.     case @command_window.index
  387.     when 0  # 买入
  388.       @buy_window.active = true
  389.       @buy_window.visible = true
  390.     when 1  # 卖出
  391.       @sell_window.active = true
  392.       @sell_window.visible = true
  393.       @status_window.visible = false
  394.     end
  395.   end
  396.   #--------------------------------------------------------------------------
  397.   # ● 确认数值输入
  398.   #--------------------------------------------------------------------------
  399.   def decide_number_input
  400.     Sound.play_shop
  401.     @number_window.active = false
  402.     @number_window.visible = false
  403.     case @command_window.index
  404.     when 0  # 买入
  405.       $game_party.lose_gold(@number_window.number * @item.price)
  406.       $game_party.gain_item(@item, @number_window.number)
  407.       @gold_window.refresh
  408.       @buy_window.refresh
  409.       @status_window.refresh
  410.       @buy_window.active = true
  411.       @buy_window.visible = true
  412.     when 1  # 卖出
  413.       $game_party.gain_gold(@number_window.number * (@item.price / 2))
  414.       $game_party.lose_item(@item, @number_window.number)
  415.       @gold_window.refresh
  416.       @sell_window.refresh
  417.       @status_window.refresh
  418.       @sell_window.active = true
  419.       @sell_window.visible = true
  420.       @status_window.visible = false
  421.     end
  422.   end
  423. end
  424. #==============================================================================
  425. # ■ Window_Shop_ActorStatus
  426. #------------------------------------------------------------------------------
  427. #  显示角色的状态窗口。
  428. #==============================================================================

  429. class Window_Shop_ActorStatus < Window_Base
  430.   #--------------------------------------------------------------------------
  431.   # ● 初始化对像
  432.   #     actor : 角色
  433.   #--------------------------------------------------------------------------
  434.   def initialize(actor, item = nil, sort = 0)
  435.     super(304, 112, 240, 304)
  436.     @item = item
  437.     @actor = actor
  438.     @sort = sort
  439.     refresh
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● 刷新
  443.   #--------------------------------------------------------------------------
  444.   def refresh
  445.     self.contents.clear
  446.     draw_Shopface(@actor.face_name, @actor.face_index, 84, 4)
  447.     draw_actor_name(@actor, 4, 0)
  448.     draw_actor_graphic(@actor, 192, 56)
  449.    
  450.     if @item != nil
  451.       draw_actor_parameter_change(@actor, 4, 96)
  452.       number = $game_party.item_number(@item)
  453.       self.contents.font.color = system_color
  454.       self.contents.draw_text(4, WLH * 10, 200, WLH, Vocab::Possession)
  455.       self.contents.font.color = normal_color
  456.       self.contents.draw_text(4, WLH * 10, 200, WLH, number, 2)
  457.       if @item.is_a?(RPG::Item) && @item.scope > 0
  458.         draw_item_parameter_change(4, 48)
  459.       elsif @item.is_a?(RPG::Item)
  460.         self.contents.font.color = system_color
  461.         self.contents.draw_text(0, y + 24, 200, WLH, FSL::SHOP::Shop_help2, 1)
  462.       end
  463.     end
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● 绘制物品效果
  467.   #     x     : 绘制点 X 座标
  468.   #     y     : 绘制点 Y 座标
  469.   #--------------------------------------------------------------------------
  470.   def draw_item_parameter_change(x, y)
  471.     if @item.scope > 6
  472.       draw_actor_hp(@actor, x, y)
  473.       draw_actor_mp(@actor, x, y + 24)
  474.       self.contents.font.color = system_color
  475.       self.contents.draw_text(x, y + WLH * 2, 200, WLH, "hp mp 回复值/率", 2)
  476.          
  477.       self.contents.font.color = hp_gauge_color1
  478.       self.contents.draw_text(x - 10, y + WLH * 3, 104, WLH, sprintf("%d", @item.hp_recovery), 2)
  479.       self.contents.draw_text(x, y + WLH * 4, 104, WLH, sprintf("%d", @item.hp_recovery_rate)+"%", 2)
  480.       
  481.       self.contents.font.color = mp_gauge_color1
  482.       self.contents.draw_text(x - 10, y + WLH * 3, 200, WLH, sprintf("%d", @item.mp_recovery), 2)
  483.       self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%d", @item.mp_recovery_rate)+"%", 2)
  484.       
  485.       if @item.parameter_type > 0
  486.         self.contents.font.color = system_color
  487.         self.contents.draw_text(x, y + WLH * 7, 200, WLH, "增加能力")
  488.         self.contents.font.color = normal_color
  489.         case @item.parameter_type
  490.         when 1
  491.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "HP", 1)
  492.         when 2
  493.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "MP", 1)
  494.         when 3
  495.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "ATK", 1)
  496.         when 4
  497.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "DEF", 1)
  498.         when 5
  499.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "SPI", 1)
  500.         when 6
  501.           self.contents.draw_text(x, y + WLH * 7, 200, WLH, "AGI", 1)
  502.         end
  503.         self.contents.draw_text(x, y + WLH * 7, 200, WLH, sprintf("%d", @item.parameter_points), 2)
  504.       else
  505.         self.contents.font.color = text_color(7)
  506.         self.contents.draw_text(x, y + WLH * 7, 200, WLH, "增加能力")
  507.       end
  508.     else
  509.       self.contents.font.color = normal_color
  510.       draw_actor_parameter(@actor, x, y, 0)
  511.       draw_actor_parameter(@actor, x, y + 24, 2)
  512.       
  513.       self.contents.font.color = system_color
  514.       self.contents.draw_text(x, y + WLH * 2, 240, WLH, "伤害值 力量/精神影响")
  515.       
  516.       self.contents.font.color = normal_color
  517.       self.contents.draw_text(x, y + WLH * 3, 104, WLH, sprintf("%d", @item.base_damage))
  518.       
  519.       self.contents.font.color = hp_gauge_color1
  520.       self.contents.draw_text(x, y + WLH * 4, 104, WLH, sprintf("%d", @item.atk_f), 2)
  521.       
  522.       self.contents.font.color = mp_gauge_color1
  523.       self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%d", @item.spi_f), 2)
  524.     end

  525.     self.contents.font.color = system_color
  526.     if @item.plus_state_set.size == 0
  527.       self.contents.font.color = text_color(7)
  528.     end
  529.     self.contents.draw_text(x, y + WLH * 5, 200, WLH, "增益")
  530.     self.contents.font.color = system_color
  531.     if @item.minus_state_set.size == 0
  532.       self.contents.font.color = text_color(7)
  533.     end
  534.     self.contents.draw_text(x, y + WLH * 6, 200, WLH, "削减")
  535.     m = 48
  536.     for i in @item.plus_state_set
  537.       draw_icon($data_states[i].icon_index, x + m, y + WLH * 5)
  538.       break if m == 168
  539.       m += 24
  540.     end
  541.     m = 48
  542.     for i in @item.minus_state_set
  543.       draw_icon($data_states[i].icon_index, x + m, y + WLH * 6)
  544.       break if m == 168
  545.       m += 24
  546.     end
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ● 绘制角色当前装备和能力值
  550.   #     actor : 角色
  551.   #     x     : 绘制点 X 座标
  552.   #     y     : 绘制点 Y 座标
  553.   #--------------------------------------------------------------------------
  554.   def draw_actor_parameter_change(actor, x, y)
  555.     return if @item.is_a?(RPG::Item)
  556.     enabled = actor.equippable?(@item)
  557.     if @item.is_a?(RPG::Weapon)
  558.       item1 = weaker_weapon(actor)
  559.     elsif actor.two_swords_style and @item.kind == 0
  560.       item1 = nil
  561.     else
  562.       if $imported["EquipExtension"] == true
  563.         index = actor.equip_type.index(@item.kind)
  564.         item1 = (index != nil ? actor.equips[1 + index] : nil)
  565.       else
  566.         item1 = actor.equips[1 + @item.kind]
  567.       end
  568.     end
  569.    
  570.     if enabled
  571.       
  572.       atk1 = item1 == nil ? 0 : item1.atk
  573.       atk2 = @item == nil ? 0 : @item.atk
  574.       change = atk2 - atk1
  575.       shop_change(change)
  576.       if change > 0
  577.         draw_icon(FSL::SHOP::Shop_icon[0], 108, y + WLH)
  578.       elsif  change < 0
  579.         draw_icon(FSL::SHOP::Shop_icon[4], 108, y + WLH)
  580.       else
  581.         draw_icon(FSL::SHOP::Shop_icon[8], 108, y + WLH)
  582.       end
  583.       self.contents.draw_text(x, y + WLH, 200, WLH, sprintf("%d", atk2), 2)
  584.       
  585.       def1 = item1 == nil ? 0 : item1.def
  586.       def2 = @item == nil ? 0 : @item.def
  587.       change = def2 - def1
  588.       shop_change(change)
  589.       if change > 0
  590.         draw_icon(FSL::SHOP::Shop_icon[1], 108, y + WLH * 2)
  591.       elsif  change < 0
  592.         draw_icon(FSL::SHOP::Shop_icon[5], 108, y + WLH * 2)
  593.       else
  594.         draw_icon(FSL::SHOP::Shop_icon[9], 108, y + WLH)
  595.       end
  596.       self.contents.draw_text(x, y + WLH * 2, 200, WLH, sprintf("%d", def2), 2)
  597.       
  598.       spi1 = item1 == nil ? 0 : item1.spi
  599.       spi2 = @item == nil ? 0 : @item.spi
  600.       change = spi2 - spi1
  601.       shop_change(change)
  602.       if change > 0
  603.         draw_icon(FSL::SHOP::Shop_icon[2], 108, y + WLH * 3)
  604.       elsif  change < 0
  605.         draw_icon(FSL::SHOP::Shop_icon[6], 108, y + WLH * 3)
  606.       else
  607.         draw_icon(FSL::SHOP::Shop_icon[10], 108, y + WLH)
  608.       end
  609.       self.contents.draw_text(x, y + WLH * 3, 200, WLH, sprintf("%d", spi2), 2)
  610.       
  611.       agi1 = item1 == nil ? 0 : item1.agi
  612.       agi2 = @item == nil ? 0 : @item.agi
  613.       change = agi2 - agi1
  614.       shop_change(change)
  615.       if change > 0
  616.         draw_icon(FSL::SHOP::Shop_icon[3], 108, y + WLH * 4)
  617.       elsif  change < 0
  618.         draw_icon(FSL::SHOP::Shop_icon[7], 108, y + WLH * 4)
  619.       else
  620.         draw_icon(FSL::SHOP::Shop_icon[11], 108, y + WLH)
  621.       end
  622.       self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%d", agi2), 2)
  623.       
  624.       self.contents.font.color = system_color
  625.       self.contents.draw_text(4, y - 32, 204, WLH, "当前装备")
  626.       
  627.       self.contents.draw_text(x + 32, y + WLH, 200, WLH, sprintf("%d", atk1))
  628.       self.contents.draw_text(x + 32, y + WLH * 2, 200, WLH, sprintf("%d", def1))
  629.       self.contents.draw_text(x + 32, y + WLH * 3, 200, WLH, sprintf("%d", spi1))
  630.       self.contents.draw_text(x + 32, y + WLH * 4, 200, WLH, sprintf("%d", agi1))
  631.       
  632.       self.contents.draw_text(0, y + WLH, 200, WLH, "ATK")
  633.       self.contents.draw_text(0, y + WLH * 2, 200, WLH, "DEF")
  634.       self.contents.draw_text(0, y + WLH * 3, 200, WLH, "SPI")
  635.       self.contents.draw_text(0, y + WLH * 4, 200, WLH, "AGI")
  636.       
  637.       if item1 != nil
  638.         self.contents.draw_text(24, y, 208, WLH, item1.name)
  639.         draw_icon(item1.icon_index, 0, y)
  640.       else
  641.         self.contents.draw_text(24, y, 208, WLH, "无")
  642.       end
  643.     else
  644.       self.contents.font.color = normal_color
  645.       self.contents.draw_text(0, y + 24, 200, WLH, FSL::SHOP::Shop_help, 1)
  646.     end
  647.   end
  648.   #--------------------------------------------------------------------------
  649.   # ● 判断数值颜色
  650.   #     change : 数值
  651.   #--------------------------------------------------------------------------
  652.   def shop_change(change)
  653.     if change == 0
  654.       self.contents.font.color = normal_color
  655.     else
  656.       self.contents.font.color = change>0 ? power_up_color : power_down_color
  657.     end
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # ● 获取双刀派角色所装备的武器中较弱的武器
  661.   #     actor : 角色
  662.   #--------------------------------------------------------------------------
  663.   def weaker_weapon(actor)
  664.     if actor.two_swords_style
  665.       weapon1 = actor.weapons[0]
  666.       weapon2 = actor.weapons[1]
  667.       if weapon1 == nil or weapon2 == nil
  668.         return nil
  669.       elsif weapon1.atk < weapon2.atk
  670.         return weapon1
  671.       else
  672.         return weapon2
  673.       end
  674.     else
  675.       return actor.weapons[0]
  676.     end
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● 设置角色
  680.   #     actor : 角色
  681.   #--------------------------------------------------------------------------
  682.   def actor=(actor)
  683.     if @actor != actor
  684.       @actor = actor
  685.       refresh
  686.     end
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # ● 设置物品
  690.   #     item : 新物品
  691.   #--------------------------------------------------------------------------
  692.   def item=(item)
  693.     if @item != item
  694.       @item = item
  695.       refresh
  696.     end
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # ● 绘制头像部分图
  700.   #     face_name  : 头像文件名
  701.   #     face_index : 头像号码
  702.   #     x     : 描画目标 X 坐标
  703.   #     y     : 描画目标 Y 坐标
  704.   #     size       : 显示大小
  705.   #--------------------------------------------------------------------------
  706.   def draw_Shopface(face_name, face_index, x, y, size = 96)
  707.     bitmap = Cache.face(face_name)
  708.     rect = Rect.new(0, 0, 0, 0)
  709.     rect.x = face_index % 4 * 96 + (96 - size) / 2
  710.     rect.y = face_index / 4 * 96 + (96 - size) / 2 + size / 4
  711.     rect.width = size
  712.     rect.height = size / 2
  713.     self.contents.blt(x, y, bitmap, rect)
  714.     bitmap.dispose
  715.   end
  716. end
  717. #==============================================================================
  718. # ■ Window_ShopBuy2
  719. #------------------------------------------------------------------------------
  720. #  商店画面、浏览显示可以购买的商品的窗口。
  721. #==============================================================================

  722. class Window_ShopBuy2 < Window_Selectable
  723.   #--------------------------------------------------------------------------
  724.   # ● 初始化对像
  725.   #     x      : 窗口 X 座标
  726.   #     y      : 窗口 Y 座标
  727.   #--------------------------------------------------------------------------
  728.   def initialize(x, y)
  729.     super(x, y, 304, 248)
  730.     @shop_goods = $game_temp.shop_goods
  731.     @type = 0
  732.     @sort = 0
  733.     refresh
  734.     self.index = 0
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # ● 商品类型
  738.   #--------------------------------------------------------------------------
  739.   def type=(type)
  740.     if @type != type
  741.       @type = type
  742.       refresh
  743.     end
  744.   end
  745.   #--------------------------------------------------------------------------
  746.   # ● 获取商品
  747.   #--------------------------------------------------------------------------
  748.   def item
  749.     if @type == 0
  750.       return @data1[self.index]
  751.     elsif @type == 1
  752.       return @data2[self.index]
  753.     else
  754.       return @data3[self.index]
  755.     end
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # ● 刷新
  759.   #--------------------------------------------------------------------------
  760.   def refresh
  761.     @data1 = []
  762.     @data2 = []
  763.     @data3 = []
  764.     for goods_item in @shop_goods
  765.       case goods_item[0]
  766.       when 0
  767.         item = $data_items[goods_item[1]]
  768.         if item != nil
  769.           @data1.push(item)
  770.         end
  771.       when 1
  772.         item = $data_weapons[goods_item[1]]
  773.         if item != nil
  774.           @data2.push(item)
  775.         end
  776.       when 2
  777.         item = $data_armors[goods_item[1]]
  778.         if item != nil
  779.           @data3.push(item)
  780.         end
  781.       end
  782.     end
  783.     for i in [email protected]
  784.       for j in [email protected]
  785.         if @data2[i].atk < @data2[j].atk
  786.           m = @data2[i]
  787.           @data2[i] = @data2[j]
  788.           @data2[j] = m
  789.         end
  790.       end
  791.     end
  792.     for i in [email protected]
  793.       for j in [email protected]
  794.         if @data3[i].atk < @data3[j].atk
  795.           m = @data3[i]
  796.           @data3[i] = @data3[j]
  797.           @data3[j] = m
  798.         end
  799.       end
  800.     end
  801.     @sort = 1
  802.     if    @type == 0
  803.       @item_max = @data1.size
  804.     elsif @type == 1
  805.       @item_max = @data2.size
  806.     else
  807.       @item_max = @data3.size
  808.     end
  809.    
  810.     create_contents
  811.     for i in 0...@item_max
  812.       draw_item1(i)
  813.     end
  814.   end
  815.   #--------------------------------------------------------------------------
  816.   # ● 绘制商品
  817.   #     index : 商品索引
  818.   #--------------------------------------------------------------------------
  819.   def draw_item1(index)
  820.     if    @type == 0
  821.       item = @data1[index]
  822.     elsif @type == 1
  823.       item = @data2[index]
  824.     else
  825.       item = @data3[index]
  826.     end
  827.     number = $game_party.item_number(item)
  828.     if $imported["LimitBreak"] == true
  829.       enabled = (item.price <= $game_party.gold && number < item.number_limit)
  830.     else
  831.       enabled = (item.price <= $game_party.gold and number < 99)
  832.     end
  833.     rect = item_rect(index)
  834.     self.contents.clear_rect(rect)
  835.     draw_item_name(item, rect.x, rect.y, enabled)
  836.     rect.width -= 4
  837.     self.contents.draw_text(rect, item.price, 2)
  838.   end
  839.   #--------------------------------------------------------------------------
  840.   # ● 顺位排序
  841.   #--------------------------------------------------------------------------
  842.   def sort_item
  843.     case @sort
  844.     when 0
  845.       for i in [email protected]
  846.         for j in [email protected]
  847.           if @data2[i].atk < @data2[j].atk
  848.             m = @data2[i]
  849.             @data2[i] = @data2[j]
  850.             @data2[j] = m
  851.           end
  852.         end
  853.       end
  854.       for i in [email protected]
  855.         for j in [email protected]
  856.           if @data3[i].atk < @data3[j].atk
  857.             m = @data3[i]
  858.             @data3[i] = @data3[j]
  859.             @data3[j] = m
  860.           end
  861.         end
  862.       end
  863.       @sort = 1
  864.     when 1
  865.       for i in [email protected]
  866.         for j in [email protected]
  867.           if @data2[i].def < @data2[j].def
  868.             m = @data2[i]
  869.             @data2[i] = @data2[j]
  870.             @data2[j] = m
  871.           end
  872.         end
  873.       end
  874.       for i in [email protected]
  875.         for j in [email protected]
  876.           if @data3[i].def < @data3[j].def
  877.             m = @data3[i]
  878.             @data3[i] = @data3[j]
  879.             @data3[j] = m
  880.           end
  881.         end
  882.       end
  883.       @sort = 2
  884.     when 2
  885.       for i in [email protected]
  886.         for j in [email protected]
  887.           if @data2[i].spi < @data2[j].spi
  888.             m = @data2[i]
  889.             @data2[i] = @data2[j]
  890.             @data2[j] = m
  891.           end
  892.         end
  893.       end
  894.       for i in [email protected]
  895.         for j in [email protected]
  896.           if @data3[i].spi < @data3[j].spi
  897.             m = @data3[i]
  898.             @data3[i] = @data3[j]
  899.             @data3[j] = m
  900.           end
  901.         end
  902.       end
  903.       @sort = 3
  904.     when 3
  905.       for i in [email protected]
  906.         for j in [email protected]
  907.           if @data2[i].agi < @data2[j].agi
  908.             m = @data2[i]
  909.             @data2[i] = @data2[j]
  910.             @data2[j] = m
  911.           end
  912.         end
  913.       end
  914.       for i in [email protected]
  915.         for j in [email protected]
  916.           if @data3[i].agi < @data3[j].agi
  917.             m = @data3[i]
  918.             @data3[i] = @data3[j]
  919.             @data3[j] = m
  920.           end
  921.         end
  922.       end
  923.       @sort = 0
  924.     end
  925.     if    @type == 0
  926.       @item_max = @data1.size
  927.     elsif @type == 1
  928.       @item_max = @data2.size
  929.     else
  930.       @item_max = @data3.size
  931.     end
  932.    
  933.     create_contents
  934.     for i in 0...@item_max
  935.       draw_item1(i)
  936.     end
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ● 更新帮助窗口文字
  940.   #--------------------------------------------------------------------------
  941.   def update_help
  942.     @help_window.set_text(item == nil ? "" : item.description)
  943.   end
  944. end
复制代码

作者: 日月星辰    时间: 2010-8-27 06:55
这个事…………………………vx???
还有……发错区了。
作者: a827594998    时间: 2010-8-27 07:05
厉害,抱走试试看
作者: cartoonist    时间: 2010-8-27 08:18
提示: 作者被禁止或删除 内容自动屏蔽
作者: lzy136188230    时间: 2010-8-27 08:23
就是几个主角就有点不方便了,要按q和w翻页!
作者: DeathKing    时间: 2010-8-27 08:48
回复 cartoonist 的帖子


    诡异,第三行是注释啊 O_O
作者: 夕阳武士    时间: 2010-8-27 10:02
老哥最近发的脚本不少嘛~我觉得数值右边的|去掉比较好,看起来很挤拉
作者: 冰舞蝶恋    时间: 2010-8-27 10:05
wangswz我上次提问你发的就是这个脚本吧~哦啦啦,个人还是觉得你之前发的那个简洁哦~
嘿嘿,大爱,顶!
作者: 冰舞蝶恋    时间: 2010-8-27 13:33
哦~
作者: 企鹅达达    时间: 2010-8-27 14:07
先谢过LZ,个人觉得要改的话主要是改右下方的框框里面的,那里的左上方放头像,右上方我觉得可以放姓名、职业、等级,下面可以放攻击等的属性变化,这一部分你这里做得有点繁琐,还不如用默认的esc菜单“装备”那里的式样。另外这里可以用左右来切换角色,同时在框框的左右两边各放两个三角形一闪一闪的光标,提示玩家可以用左右切换。
作者: 冰舞蝶恋    时间: 2010-8-27 14:33
企鹅君!?
作者: 夕阳武士    时间: 2010-8-27 16:16
嗯,改完了舒服多了!
作者: DeathKing    时间: 2010-8-28 14:34
http://tempuser.138yf.com/fsl/project/RPGVX/FSL_SHOP/1.2.0828.rar
  1. #===============================================================================
  2. # ■ 简易商店拓展描绘
  3. #    FSL_SHOP
  4. #-------------------------------------------------------------------------------
  5. #    放在默认脚本之后,Main脚本之前,通过事件指令【商店处理】调用。
  6. #
  7. #    本脚本可以方便商店购物选择。
  8. #-------------------------------------------------------------------------------
  9. #    更新作者: wangswz DeathKing
  10. #    许可协议: FSL
  11. #    项目版本: 1.2.0828
  12. #    引用网址: http://rpg.blue/thread-154915-1-1.html
  13. #-------------------------------------------------------------------------------
  14. #    - 1.2.0828 (By DeathKing)
  15. #      * 修正了@item.limt_num的NoMethodError;
  16. #
  17. #    - 1.1.0827 (By wangswz)
  18. #      * 初始版本;
  19. #
  20. #===============================================================================
  21. $imported = {} if $imported == nil
  22. $fscript = {} if $fscript == nil
  23. $fscript["FSL_SHOP"] = "1.1.0827"

  24. #-------------------------------------------------------------------------------
  25. # ▼ 通用配置模块
  26. #-------------------------------------------------------------------------------
  27. module FSL
  28.   module SHOP
  29.     # ◆ 设置atk def spi agi 上升 下降图标显示
  30.     Shop_icon = [120,121,122,123,124,125,126,127]
  31.    
  32.     # ◆ 无法装备的提示信息
  33.     Shop_help = "-无法装备-"
  34.   end
  35. end

  36. #==============================================================================
  37. # ■ Scene_Shop
  38. #------------------------------------------------------------------------------
  39. #  处理商店画面的类。
  40. #==============================================================================

  41. class Scene_Shop < Scene_Base
  42.   #--------------------------------------------------------------------------
  43.   # ● 开始处理
  44.   #--------------------------------------------------------------------------
  45.   def start
  46.     super
  47.     create_menu_background
  48.     create_command_window
  49.     @help_window = Window_Help.new
  50.     @gold_window = Window_Gold.new(384, 56)
  51.     @dummy_window = Window_Base.new(0, 112, 544, 304)
  52.     @buy_window = Window_ShopBuy.new(0, 112)
  53.     @buy_window.active = false
  54.     @buy_window.visible = false
  55.     @buy_window.help_window = @help_window
  56.     @sell_window = Window_ShopSell.new(0, 112, 544, 304)
  57.     @sell_window.active = false
  58.     @sell_window.visible = false
  59.     @sell_window.help_window = @help_window
  60.     @number_window = Window_ShopNumber.new(0, 112)
  61.     @number_window.active = false
  62.     @number_window.visible = false
  63.     @actor_index = 0
  64.     @status_window = Window_Shop_ActorStatus.new($game_party.members[@actor_index])
  65.     @status_window.visible = false
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● 结束处理
  69.   #--------------------------------------------------------------------------
  70.   def terminate
  71.     super
  72.     dispose_menu_background
  73.     dispose_command_window
  74.     @help_window.dispose
  75.     @gold_window.dispose
  76.     @dummy_window.dispose
  77.     @buy_window.dispose
  78.     @sell_window.dispose
  79.     @number_window.dispose
  80.     @status_window.dispose
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 更新画面
  84.   #--------------------------------------------------------------------------
  85.   def update
  86.     super
  87.     update_menu_background
  88.     @help_window.update
  89.     @command_window.update
  90.     @gold_window.update
  91.     @dummy_window.update
  92.     @buy_window.update
  93.     @sell_window.update
  94.     @number_window.update
  95.     @status_window.update
  96.     if @command_window.active
  97.       update_command_selection
  98.     elsif @buy_window.active
  99.       update_buy_selection
  100.     elsif @sell_window.active
  101.       update_sell_selection
  102.     elsif @number_window.active
  103.       update_number_input
  104.     end
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 生成命令窗口
  108.   #--------------------------------------------------------------------------
  109.   def create_command_window
  110.     s1 = Vocab::ShopBuy
  111.     s2 = Vocab::ShopSell
  112.     s3 = Vocab::ShopCancel
  113.     @command_window = Window_Command.new(384, [s1, s2, s3], 3)
  114.     @command_window.y = 56
  115.     if $game_temp.shop_purchase_only
  116.       @command_window.draw_item(1, false)
  117.     end
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 释放命令窗口
  121.   #--------------------------------------------------------------------------
  122.   def dispose_command_window
  123.     @command_window.dispose
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 更新命令窗口
  127.   #--------------------------------------------------------------------------
  128.   def update_command_selection
  129.     if Input.trigger?(Input::B)
  130.       Sound.play_cancel
  131.       $scene = Scene_Map.new
  132.     elsif Input.trigger?(Input::C)
  133.       case @command_window.index
  134.       when 0  # 买入
  135.         Sound.play_decision
  136.         @command_window.active = false
  137.         @dummy_window.visible = false
  138.         @buy_window.active = true
  139.         @buy_window.visible = true
  140.         @buy_window.refresh
  141.         @status_window.visible = true
  142.       when 1  # 卖出
  143.         if $game_temp.shop_purchase_only
  144.           Sound.play_buzzer
  145.         else
  146.           Sound.play_decision
  147.           @command_window.active = false
  148.           @dummy_window.visible = false
  149.           @sell_window.active = true
  150.           @sell_window.visible = true
  151.           @sell_window.refresh
  152.         end
  153.       when 2  # 离开
  154.         Sound.play_decision
  155.         $scene = Scene_Map.new
  156.       end
  157.     end
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● 更新买入选择
  161.   #--------------------------------------------------------------------------
  162.     def update_buy_selection
  163.     if $imported["LimitBreak"] == false
  164.       @status_window.item = @buy_window.item
  165.       if Input.trigger?(Input::B)
  166.         Sound.play_cancel
  167.         @command_window.active = true
  168.         @dummy_window.visible = true
  169.         @buy_window.active = false
  170.         @buy_window.visible = false
  171.         @status_window.visible = false
  172.         @status_window.item = nil
  173.         @help_window.set_text("")
  174.         return
  175.       end
  176.       if Input.trigger?(Input::C)
  177.         @item = @buy_window.item
  178.         number = $game_party.item_number(@item)
  179.         if @item == nil or @item.price > $game_party.gold or number == 99
  180.           Sound.play_buzzer
  181.         else
  182.           Sound.play_decision
  183.           max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  184.           max = [max, 99 - number].min
  185.           @buy_window.active = false
  186.           @buy_window.visible = false
  187.           @number_window.set(@item, max, @item.price)
  188.           @number_window.active = true
  189.           @number_window.visible = true
  190.         end
  191.       end
  192.       if Input.trigger?(Input::R)
  193.         Sound.play_cursor
  194.         next_actor
  195.       elsif Input.trigger?(Input::L)
  196.         Sound.play_cursor
  197.         prev_actor
  198.       end
  199.     else
  200.       @status_window.item = @buy_window.item
  201.       if Input.trigger?(Input::B)
  202.         Sound.play_cancel
  203.         @command_window.active = true
  204.         @dummy_window.visible = true
  205.         @buy_window.active = false
  206.         @buy_window.visible = false
  207.         @status_window.visible = false
  208.         @status_window.item = nil
  209.         @help_window.set_text("")
  210.         return
  211.       end
  212.       if Input.trigger?(Input::C)
  213.         @item = @buy_window.item
  214.         number = $game_party.item_number(@item)
  215.         if @item == nil || @item.price > $game_party.gold or number == 99
  216.           Sound.play_buzzer
  217.         else
  218.           Sound.play_decision
  219.           max = (@item.price == 0 ? 99 : $game_party.gold / @item.price)
  220.           max = [max, 99 - number].min
  221.           @buy_window.active = false
  222.           @buy_window.visible = false
  223.           @number_window.set(@item, max, @item.price)
  224.           @number_window.active = true
  225.           @number_window.visible = true
  226.         end
  227.       end
  228.     end
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● 切换至下一角色画面
  232.   #--------------------------------------------------------------------------
  233.   def next_actor
  234.     @actor_index += 1
  235.     @actor_index %= $game_party.members.size
  236.     @status_window.actor = ($game_party.members[@actor_index])
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 切换至上一角色画面
  240.   #--------------------------------------------------------------------------
  241.   def prev_actor
  242.     @actor_index += $game_party.members.size - 1
  243.     @actor_index %= $game_party.members.size
  244.     @status_window.actor = ($game_party.members[@actor_index])
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● 更新卖出选择
  248.   #--------------------------------------------------------------------------
  249.   def update_sell_selection
  250.     if Input.trigger?(Input::B)
  251.       Sound.play_cancel
  252.       @command_window.active = true
  253.       @dummy_window.visible = true
  254.       @sell_window.active = false
  255.       @sell_window.visible = false
  256.       @status_window.item = nil
  257.       @help_window.set_text("")
  258.     elsif Input.trigger?(Input::C)
  259.       @item = @sell_window.item
  260.       @status_window.item = @item
  261.       if @item == nil or @item.price == 0
  262.         Sound.play_buzzer
  263.       else
  264.         Sound.play_decision
  265.         max = $game_party.item_number(@item)
  266.         @sell_window.active = false
  267.         @sell_window.visible = false
  268.         @number_window.set(@item, max, @item.price / 2)
  269.         @number_window.active = true
  270.         @number_window.visible = true
  271.         @status_window.visible = true
  272.       end
  273.     end
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● 更新数值输入
  277.   #--------------------------------------------------------------------------
  278.   def update_number_input
  279.     if Input.trigger?(Input::B)
  280.       cancel_number_input
  281.     elsif Input.trigger?(Input::C)
  282.       decide_number_input
  283.     end
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● 取消数值输入
  287.   #--------------------------------------------------------------------------
  288.   def cancel_number_input
  289.     Sound.play_cancel
  290.     @number_window.active = false
  291.     @number_window.visible = false
  292.     case @command_window.index
  293.     when 0  # 买入
  294.       @buy_window.active = true
  295.       @buy_window.visible = true
  296.     when 1  # 卖出
  297.       @sell_window.active = true
  298.       @sell_window.visible = true
  299.       @status_window.visible = false
  300.     end
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ● 确认数值输入
  304.   #--------------------------------------------------------------------------
  305.   def decide_number_input
  306.     Sound.play_shop
  307.     @number_window.active = false
  308.     @number_window.visible = false
  309.     case @command_window.index
  310.     when 0  # 买入
  311.       $game_party.lose_gold(@number_window.number * @item.price)
  312.       $game_party.gain_item(@item, @number_window.number)
  313.       @gold_window.refresh
  314.       @buy_window.refresh
  315.       @status_window.refresh
  316.       @buy_window.active = true
  317.       @buy_window.visible = true
  318.     when 1  # 卖出
  319.       $game_party.gain_gold(@number_window.number * (@item.price / 2))
  320.       $game_party.lose_item(@item, @number_window.number)
  321.       @gold_window.refresh
  322.       @sell_window.refresh
  323.       @status_window.refresh
  324.       @sell_window.active = true
  325.       @sell_window.visible = true
  326.       @status_window.visible = false
  327.     end
  328.   end
  329. end
  330. #==============================================================================
  331. # ■ Window_Shop_ActorStatus
  332. #------------------------------------------------------------------------------
  333. #  显示角色的状态窗口。
  334. #==============================================================================

  335. class Window_Shop_ActorStatus < Window_Base
  336.   #--------------------------------------------------------------------------
  337.   # ● 初始化对像
  338.   #     actor : 角色
  339.   #--------------------------------------------------------------------------
  340.   def initialize(actor, item = nil)
  341.     super(304, 112, 240, 304)
  342.     @item = item
  343.     @actor = actor
  344.     refresh
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 刷新
  348.   #--------------------------------------------------------------------------
  349.   def refresh
  350.     self.contents.clear
  351.     draw_actor_face(@actor, 96, 4)
  352.     draw_actor_name(@actor, 4, 0)
  353.     draw_actor_graphic(@actor, 32, 64)
  354.     if @item != nil
  355.       draw_actor_parameter_change(@actor, 4, 96)
  356.       number = $game_party.item_number(@item)
  357.       self.contents.font.color = system_color
  358.       self.contents.draw_text(4, 240, 200, WLH, Vocab::Possession)
  359.       self.contents.font.color = normal_color
  360.       self.contents.draw_text(4, 240, 200, WLH, number, 2)
  361.       if @item.is_a?(RPG::Item) && @item.scope > 6
  362.         draw_item_parameter_change(4, 96)
  363.         draw_actor_hp(@actor, 4, 96)
  364.         draw_actor_mp(@actor, 4, 120)
  365.       end
  366.     end
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # ● 绘制物品效果
  370.   #     x     : 绘制点 X 座标
  371.   #     y     : 绘制点 Y 座标
  372.   #--------------------------------------------------------------------------
  373.   def draw_item_parameter_change(x, y)
  374.     self.contents.draw_text(x, y + WLH * 2, 200, WLH, "hp mp 回复值/率", 2)
  375.    
  376.     self.contents.font.color = hp_gauge_color1
  377.     self.contents.draw_text(x - 10, y + WLH * 3, 104, WLH, sprintf("%d", @item.hp_recovery), 2)
  378.     self.contents.draw_text(x, y + WLH * 4, 104, WLH, sprintf("%d", @item.hp_recovery_rate)+"%", 2)
  379.    
  380.     self.contents.font.color = mp_gauge_color1
  381.     self.contents.draw_text(x - 10, y + WLH * 3, 200, WLH, sprintf("%d", @item.mp_recovery), 2)
  382.     self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%d", @item.mp_recovery_rate)+"%", 2)
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● 绘制角色当前装备和能力值
  386.   #     actor : 角色
  387.   #     x     : 绘制点 X 座标
  388.   #     y     : 绘制点 Y 座标
  389.   #--------------------------------------------------------------------------
  390.   def draw_actor_parameter_change(actor, x, y)
  391.     return if @item.is_a?(RPG::Item)
  392.     enabled = actor.equippable?(@item)
  393.     if @item.is_a?(RPG::Weapon)
  394.       item1 = weaker_weapon(actor)
  395.     elsif actor.two_swords_style and @item.kind == 0
  396.       item1 = nil
  397.     else
  398.       if $imported["EquipExtension"] == true
  399.         index = actor.equip_type.index(@item.kind)
  400.         item1 = (index != nil ? actor.equips[1 + index] : nil)
  401.       else
  402.         item1 = actor.equips[1 + @item.kind]
  403.       end
  404.     end
  405.    
  406.     if enabled
  407.       atk1 = item1 == nil ? 0 : item1.atk
  408.       atk2 = @item == nil ? 0 : @item.atk
  409.       change = atk2 - atk1
  410.       shop_change(change)
  411.       if change > 0
  412.         draw_icon(FSL::SHOP::Shop_icon[0], x + 24, y)
  413.       elsif  change < 0
  414.         draw_icon(FSL::SHOP::Shop_icon[4], x + 24, y)
  415.       end
  416.       change = -change if change<=0
  417.       self.contents.draw_text(x, y + WLH * 1, 56, WLH, sprintf("%d", change), 2)
  418.       self.contents.draw_text(x, y + WLH * 5, 56, WLH, sprintf("%d", atk2), 2)
  419.       
  420.       def1 = item1 == nil ? 0 : item1.def
  421.       def2 = @item == nil ? 0 : @item.def
  422.       change = def2 - def1
  423.       shop_change(change)
  424.       if change > 0
  425.         draw_icon(FSL::SHOP::Shop_icon[1], x + 72, y)
  426.       elsif  change < 0
  427.         draw_icon(FSL::SHOP::Shop_icon[5], x + 72, y)
  428.       end
  429.       change = -change if change<=0
  430.       self.contents.draw_text(x, y + WLH * 1, 104, WLH, sprintf("%d", change), 2)
  431.       self.contents.draw_text(x, y + WLH * 5, 104, WLH, sprintf("%d", def2), 2)
  432.       
  433.       spi1 = item1 == nil ? 0 : item1.spi
  434.       spi2 = @item == nil ? 0 : @item.spi
  435.       change = spi2 - spi1
  436.       shop_change(change)
  437.       if change > 0
  438.         draw_icon(FSL::SHOP::Shop_icon[2], x + 120, y)
  439.       elsif  change < 0
  440.         draw_icon(FSL::SHOP::Shop_icon[6], x + 120, y)
  441.       end
  442.       change = -change if change<=0
  443.       self.contents.draw_text(x, y + WLH * 1, 152, WLH, sprintf("%d", change), 2)
  444.       self.contents.draw_text(x, y + WLH * 5, 152, WLH, sprintf("%d", spi2), 2)
  445.       
  446.       agi1 = item1 == nil ? 0 : item1.agi
  447.       agi2 = @item == nil ? 0 : @item.agi
  448.       change = agi2 - agi1
  449.       shop_change(change)
  450.       if change > 0
  451.         draw_icon(FSL::SHOP::Shop_icon[3], x + 168, y)
  452.       elsif  change < 0
  453.         draw_icon(FSL::SHOP::Shop_icon[7], x + 168, y)
  454.       end
  455.       change = -change if change<=0
  456.       self.contents.draw_text(x, y + WLH * 1, 200, WLH, sprintf("%d", change), 2)
  457.       self.contents.draw_text(x, y + WLH * 5, 200, WLH, sprintf("%d", agi2), 2)
  458.       
  459.       
  460.       self.contents.font.color = normal_color
  461.       self.contents.draw_text(4, y + 48, 204, WLH, "当前装备")
  462.       self.contents.draw_text(4, y + 96, 204, WLH, "当前店中")
  463.       
  464.       self.contents.draw_text(x, y + WLH * 3, 56, WLH, sprintf("%d", atk1), 2)
  465.       self.contents.draw_text(x, y + WLH * 3, 104, WLH, sprintf("%d", def1), 2)
  466.       self.contents.draw_text(x, y + WLH * 3, 152, WLH, sprintf("%d", spi1), 2)
  467.       self.contents.draw_text(x, y + WLH * 3, 200, WLH, sprintf("%d", agi1), 2)
  468.       
  469.       if item1 != nil
  470.         self.contents.draw_text(120, y + 48, 208, WLH, item1.name)
  471.         draw_icon(item1.icon_index, 96, y + 48)
  472.       else
  473.         self.contents.draw_text(96, y + 48, 208, WLH, "无")
  474.       end
  475.     else
  476.       self.contents.font.color = normal_color
  477.       self.contents.draw_text(0, y + 24, 200, WLH, FSL::SHOP::Shop_help, 1)
  478.     end
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ● 判断数值颜色
  482.   #     change : 数值
  483.   #--------------------------------------------------------------------------
  484.   def shop_change(change)
  485.     if change == 0
  486.       self.contents.font.color = normal_color
  487.     else
  488.       self.contents.font.color = change>0 ? power_up_color : power_down_color
  489.     end
  490.   end
  491.   #--------------------------------------------------------------------------
  492.   # ● 获取双刀派角色所装备的武器中较弱的武器
  493.   #     actor : 角色
  494.   #--------------------------------------------------------------------------
  495.   def weaker_weapon(actor)
  496.     if actor.two_swords_style
  497.       weapon1 = actor.weapons[0]
  498.       weapon2 = actor.weapons[1]
  499.       if weapon1 == nil or weapon2 == nil
  500.         return nil
  501.       elsif weapon1.atk < weapon2.atk
  502.         return weapon1
  503.       else
  504.         return weapon2
  505.       end
  506.     else
  507.       return actor.weapons[0]
  508.     end
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● 设置角色
  512.   #     actor : 角色
  513.   #--------------------------------------------------------------------------
  514.   def actor=(actor)
  515.     if @actor != actor
  516.       @actor = actor
  517.       refresh
  518.     end
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # ● 设置物品
  522.   #     item : 新物品
  523.   #--------------------------------------------------------------------------
  524.   def item=(item)
  525.     if @item != item
  526.       @item = item
  527.       refresh
  528.     end
  529.   end
  530. end
复制代码

作者: 企鹅达达    时间: 2010-8-28 16:36
回复 DeathKing 的帖子
这个范例……为什么我按Q和W结果只是物品菜单的翻页,而没办法切换人物呢?

   
作者: DeathKing    时间: 2010-8-28 16:41
回复 企鹅达达 的帖子


    有需求就有改动 ^_^
所以就看楼主了(现在在写一个菜单脚本的说。)
作者: wangswz    时间: 2010-8-28 21:36
本帖最后由 wangswz 于 2010-8-28 22:46 编辑

编辑掉
作者: wangswz    时间: 2010-8-28 21:46
本帖最后由 wangswz 于 2010-8-28 22:46 编辑

编辑掉
作者: qazsdwexc    时间: 2010-8-28 22:16
右边看不懂。。。
作者: DeathKing    时间: 2010-8-29 07:20
回复 wangswz 的帖子

大陆版的上线时99个,这和大陆的文化有关系吧~~~
   
作者: untrueterry    时间: 2010-8-29 10:02
提示: 作者被禁止或删除 内容自动屏蔽
作者: qq464154015    时间: 2010-8-29 12:06
不错啊、、、、
作者: 无名小兵    时间: 2010-8-29 12:20
=.=很喜欢这个。。无耻的收下了 。。
作者: wangswz    时间: 2010-8-30 20:42
更新咯
作者: untrueterry    时间: 2010-8-30 20:51
提示: 作者被禁止或删除 内容自动屏蔽
作者: 冰舞蝶恋    时间: 2010-8-30 20:51
回复 wangswz 的帖子

很棒的东西,话说我这个脚本盲还有个过分要求。。。。
就是装备能力上升的时候不只是字变绿,还会在前面加上“+”,下降时前面加上“-”
主要是因为有时候我自己都红绿不分,误把红色字认作能力上升……= =
希望更新一下。。。
过分要求的话可以无视我。。。。。谢谢了。   
作者: 企鹅达达    时间: 2010-8-30 23:15
本帖最后由 企鹅达达 于 2010-8-30 23:21 编辑

……嘿嘿,不好意思,其实看LZ这么辛苦还真的不太好意思挑毛病
首先,刚刚进入时的界面是全屏的,然后点了购买就突然缩小了,这样看着有点不舒服,而且购买界面修改了,但是卖东西的界面却没有改……
然后,通常我们设置商店时会自动分开道具店、武器店、防具店,所以购买界面的分类显得没有多大的必要,而排序这个功能,个人觉得可要可不要,其实我们在制作事件的时候就可以把商品按照自己的心意调整,毕竟武器和防具的价值不只是体现在三个属性的增加上的,尤其是那些添加了武器装备扩展脚本的游戏……
然后是属性点的增加,本来我是觉得显示角色本身的属性点变化会比较好的,不过再想想好像又差不多。
最后是物品那一栏,道具除了回复道具,还有攻击道具、成长道具、特殊道具,攻击道具和成长道具都是可以添加上去的。然后,MP和HP两个词能不能放在对应数字的上方?顺带也把恢复值和回复率给对应了吧……
以上仅代表个人观点,多有得罪,见谅见谅,阿弥陀佛

作者: 无名小兵    时间: 2010-8-31 11:49
本帖最后由 无名小兵 于 2010-8-31 12:12 编辑

:'(我错了。。。之前的版本也就是8月28日的那版本 我忘保存直接覆盖了  斑竹还有吗???这个版本跟KGC的合成脚本冲突。。。如果有的话发我短消息吧。。。谢谢。。很喜欢这个商店。。。
作者: wangswz    时间: 2010-8-31 12:26
……嘿嘿,不好意思,其实看LZ这么辛苦还真的不太好意思挑毛病
首先,刚刚进入时的界面是全屏的,然后点了 ...
企鹅达达 发表于 2010-8-30 23:15


卖东西的界面正在增加买的界面和排序功能 界面过渡太生硬也正在修改
商品默认按ID号大小排列 而且不知道有没有一次性大量买卖商店的脚本使用者 排序是为方便用户 下次更新我加个开关让用户来选择开启
属性点问题上次有人和我说直接显示2个物品属性的单独比较就好。。所以才去掉角色属性 改成这样的。。 而且实在不够显示这么多信息了。。所以估计不会改回去了
道具物品方面也正在增强功能 下次预计增加对成长道具和攻击性道具的显示支持
完美也需要一定时间。。俺还在上学。见谅
以上
希望回答的能让您满意 并提出更多宝贵的意见(来鞭笞我把 comebeby~ 啊~ kimoji~)
作者: wangswz    时间: 2010-9-3 18:18
更新咯
作者: 无名小兵    时间: 2010-9-4 00:04
找到个不知道是不是BUG的问题,角色如果双刀流钩上 然后双手装备上2把不一样的武器 然后去商店,结果右边的人物显示图只显示攻击弱的武器,=。=然后我就不知道该怎么说了。。。如果不把双刀流钩上就没事。。
作者: mingaini    时间: 2010-9-15 12:17
提示: 作者被禁止或删除 内容自动屏蔽
作者: liuyiliu11    时间: 2011-6-12 16:46
66RPG就是好啊,以后要多在这学习。
作者: luyuxiang21    时间: 2012-2-14 17:29
本帖最后由 luyuxiang21 于 2012-2-15 19:10 编辑

我把
      self.contents.draw_text(0, y + WLH, 200, WLH, "ATK")
      self.contents.draw_text(0, y + WLH * 2, 200, WLH, "DEF")
      self.contents.draw_text(0, y + WLH * 3, 200, WLH, "SPI")
      self.contents.draw_text(0, y + WLH * 4, 200, WLH, "AGI")
改成了
      self.contents.draw_text(0, y + WLH, 200, WLH, "攻")
      self.contents.draw_text(0, y + WLH * 2, 200, WLH, "防")
      self.contents.draw_text(0, y + WLH * 3, 200, WLH, "魔")
      self.contents.draw_text(0, y + WLH * 4, 200, WLH, "动")
这样更直观些

另外我的小图标对不上号,直接删除了两行,影响不大





作者: jinbide    时间: 2013-2-2 17:47
哇!脚本超赞!~~~~~~~··




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1