设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 516|回复: 1

[已经解决] add_command的条件为真时,能点进去但选项是灰色

[复制链接]

Lv5.捕梦者

梦石
0
星屑
24242
在线时间
5033 小时
注册时间
2016-3-8
帖子
1618
发表于 2020-8-12 05:51:57 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 alexncf125 于 2024-1-25 01:48 编辑
  1.   def make_command_list
  2.     p $game_party.usable?(@item)
  3.     add_command(UseVocab, :use, $game_party.usable?(@item))
  4.     p discardable?(@item)
  5.     add_command(DiscardVocab, :discard, discardable?(@item))
  6.     add_command(CancelVocab, :cancel)
  7.   end
复制代码

未命名.png
选项能点进去,但为什么是灰色的???

RUBY 代码复制
  1. # =============================================================================
  2. # TheoAllen - Limited Inventory
  3. # Version : 1.4c
  4. # Contact : Discord @ Theo#3034
  5. # (English Documentation)
  6. # =============================================================================
  7. ($imported ||= {})[:Theo_LimInventory] = true
  8. # =============================================================================
  9. # Change logs:
  10. # -----------------------------------------------------------------------------
  11. # 2017.03.08 - Fixed minor issue on updating help window
  12. # 2017.03.05 - Help window updated when item removed by discarding
  13. # 2015.02.02 - Added slowdown penalty when the inventory is full
  14. #            - Added disable dash when the inventory is full
  15. #            - Added force gain item to supports those newly added features
  16. # 2014.09.22 - Bugfix. Negative number appear when use item and inventory
  17. #              reached its limit.
  18. #            - Compatibility patch with YEA Menu Cursor
  19. #            - Compatibility patch with MOG Menu Cursor as well
  20. # 2014.02.25 - Add limited inventory eval formula to provide flexibility
  21. #            - Change notetag constant to provide flexibility
  22. # 2014.02.16 - Base Inventory slot of an actor can be changed using script call
  23. # 2014.02.11 - Bugfix. Unequip item causes lose the item if inventory is full
  24. # 2013.10.07 - Bugfix. Item doesn't removed when discarded
  25. #            - Bugfix. Inventory amount not refreshed when item is discarded
  26. # 2013.10.04 - Compatibility fix with chest system
  27. # 2013.08.30 - Now unable to discard key item
  28. # 2013.08.22 - Bugfix. Item size notetag isn't working
  29. # 2013.08.19 - Bugfix when gained item
  30. #            - Bugfix when disable display item size in shop menu
  31. # 2013.08.18 - Finished script
  32. # =============================================================================
  33. =begin
  34.   ---------------------------------------------------------------------------
  35.   Introduction :
  36.   This script allow you to limit your inventory by overall possesed items
  37.   instead of individual items
  38.  
  39.   ---------------------------------------------------------------------------
  40.   How to Use :
  41.   Put this script below material but above main
  42.   If you're using YEA - Shop Option, put it below that script
  43.   Edit configurations and the notetags as described below
  44.  
  45.   ---------------------------------------------------------------------------
  46.   Notetags :
  47.   write down these notetags to the notebox in your database
  48.  
  49.   <inv size: n>
  50.   Use this notetag where the n is a numeric value which is determine the size
  51.   of item. Use 0 for unlimited item. Only works for item and equipment such as
  52.   weapon or armor.
  53.  
  54.   <inv plus: n>
  55.   Use this notetag to determine the additional avalaible free inventory slot.
  56.   This notetag avalaible for Actor, Class, Equip, and States. If it's for
  57.   actor, avalaible inventory slot will increase when a new actor entered party.
  58.   If it's for equip, the avalaible slot will be increase if the certain equip
  59.   is equipped. And so do states.
  60.  
  61.   This value can be changed by script call during the game. Just check the
  62.   script call instruction.
  63.  
  64.   <inv minus: n>
  65.   Inverse of <inv plus>. It will decrease the avalaible inventory slot. Pretty
  66.   clear I think.
  67.  
  68.   <inv formula>
  69.   script
  70.   </inv formula>
  71.   This notetag is used to determine inventory limit based on your own formula
  72.   For example, inventory limit for an actor is based on its agility or even
  73.   its level. It can be used inside actor or class notebox.
  74.  
  75.   Inventory formula is automatically accumulated with base inventory. I mean,
  76.   if you're going to add <inv plus: 100> and your formula. Then, the result is
  77.   ==> 100 + your formula
  78.  
  79.   Example :
  80.   <inv formula>
  81.   level * 100
  82.   </inv formula>
  83.   By using this formula it means that each actor has leveled up, its base
  84.   inventory will be increase by 100. If you're using multiple lines, it will be
  85.   considered as a one line. You can also using these parameters to determine
  86.   your own formula.
  87.  
  88.   - mhp
  89.   - mmp
  90.   - atk
  91.   - def
  92.   - mat
  93.   - mdf
  94.   - agi
  95.   - luk
  96.   - $game_variables[id]
  97.  
  98.   Note :
  99.   - A false formula may produce an error. So, make sure you write the correct
  100.     formula. Alternatively, you can ask ppl out there to help you out.
  101.   - For scripter, the formula eval is evaled inside Game_Actor
  102.   ---------------------------------------------------------------------------
  103.   Script call :
  104.   If you want to force gain an item even the inventory is full, you can do it
  105.   by script call. Just write this following line
  106.  
  107.   force_gain_item($data_items[id],amount)
  108.   id is an item id in your database
  109.  
  110.   To change base inventory for an actor, use these script call
  111.   $game_actors[id].base_inv = value     << Set
  112.   $game_actors[id].base_inv += value    << Add
  113.   $game_actors[id].base_inv -= value    << Substract
  114.  
  115.   If you set dynamic slot as false, you can change inventory limit by using
  116.   this script call.
  117.   $game_party.base_inv = value
  118.  
  119.   ---------------------------------------------------------------------------
  120.   Terms of use :
  121.   Credit me, TheoAllen. You are free to edit this script by your own. As long
  122.   as you don't claim it yours. For commercial purpose, don't forget to give me
  123.   a free copy of the game.
  124. =end
  125. # =============================================================================
  126. # Configurations :
  127. # =============================================================================
  128. module Theo
  129.   module LimInv
  130.  
  131.   # --------------------------------------------------------------------------
  132.   # General Settings (just put true / false)
  133.   # --------------------------------------------------------------------------
  134.  
  135.     DynamicSlot       = true
  136.   # Total avalaible inventory slot depends on actor, states, total party
  137.   # members, etc ...
  138.  
  139.     Display_ItemSize  = true
  140.   # Diplay item size in item menu
  141.  
  142.     Include_Equip     = false
  143.   # Total used inventory slot will also include actor equipment.
  144.  
  145.     DrawTotal_Size    = true
  146.   # If true, item size window will show total weight of specified item. For
  147.   # example, you have 10 potions. And each potion has 3 size/weight. The window
  148.   # will show 30 instead of 3
  149.  
  150.     ForceGain         = true
  151.   # Keep force to gain item when the item is full. Please set some penalties
  152.   # when the inventory is full below to serve the purpose of this script
  153.   # This overwrite the method gain item from default script. There is a chance
  154.   # of incompatibility between different script which also use the same method
  155.  
  156.     Full_DisableDash  = true
  157.   # Disable dash when the inventory is full. Should be used when ForceGain
  158.   # is set to true. If use together with YEA System Option, please put this
  159.   # script below the YEA system option, unless you get rid completely the
  160.   # autodash config in Yanfly's script
  161.  
  162.     Full_SlowDown     = true
  163.   # Slowdown the player movement by 1 when the inventory is full Should be
  164.   # used when ForceGain is set to true
  165.  
  166.   # --------------------------------------------------------------------------
  167.   # Numeric Settings
  168.   # --------------------------------------------------------------------------
  169.  
  170.     Default_FreeSlot  = 20
  171.   # Default values which is provided each actor. Of course, you may change
  172.   # it by notetag. If DynamicSlot is set to false, it will be used as the total
  173.   # avalaible slot
  174.  
  175.     NearMaxed_Percent = 25
  176.   # Remain avalaible slot percentage to determine if the inventory is almost
  177.   # maxed out or not.
  178.  
  179.     NearMaxed_Color   = 21
  180.   # If inventory is almost maxed out, the inventory window will be drawn in
  181.   # different color. The color code is same as \C[n] in message
  182.  
  183.     UseCommand_Size   = 200   
  184.   # The width of use item command window
  185.  
  186.   # --------------------------------------------------------------------------
  187.   # Vocab Settings (Self-explanatory I think)
  188.   # --------------------------------------------------------------------------
  189.  
  190.     InvSlotVocab    = "Inventory: "   # Inventory Vocab
  191.     InvSizeVocab    = "Item Size: "   # Item size / weight
  192.     SlotVocabShort  = "Inv:"          # Abbreviation for Inventory
  193.     UseVocab        = "Use item"      # Use item
  194.     DiscardVocab    = "Discard item"  # Discard Item
  195.     CancelVocab     = "Cancel"        # Cancel
  196.  
  197.   end
  198. end
  199. # ============================================================================
  200. # Do not touch anything pass this line.
  201. # ============================================================================
  202. =begin
  203.   -----------------------------------------------------------------------------
  204.   Compatibility info :
  205.   -----------------------------------------------------------------------------
  206.   This script overwrite these methods :
  207.   Game_Actor  >> trade_item_with_party
  208.   Game_Party  >> max_item_number
  209.   Game_Party  >> item_max?
  210.   Game_Party  >> lose_item
  211.  
  212.   -----------------------------------------------------------------------------
  213.   This script aliased these methods :
  214.   DataManager >> load_database
  215.   Game_Actor  >> setup
  216.   Game_Party  >> initialize
  217.   Scene_Menu  >> start
  218.   Scene_Item  >> start
  219.   Scene_Item  >> use_item
  220.   Scene_Shop  >> on_buy_ok
  221.   Scene_Shop  >> on_sell_ok
  222. =end
  223. # =============================================================================
  224. # Altered built in modules and classes
  225. # =============================================================================
  226. # =============================================================================
  227. # ▼ DataManager
  228. # =============================================================================
  229. class << DataManager
  230.  
  231.   alias theo_limited_item_load_db load_database
  232.   def load_database
  233.     theo_limited_item_load_db
  234.     load_limited_slot
  235.   end
  236.  
  237.   def load_limited_slot
  238.     database = $data_actors + $data_classes + $data_weapons + $data_armors +
  239.       $data_states + $data_items
  240.     database.compact.each do |db|
  241.       db.load_limited_inv
  242.     end
  243.   end
  244. end
  245. # =============================================================================
  246. # ▼ RPG::BaseItem
  247. # =============================================================================
  248. class RPG::BaseItem
  249.   attr_accessor :inv_size # Item inventory size
  250.   attr_accessor :inv_mod  # Inventory slot modifier
  251.   attr_accessor :inv_eval # Inventory eval modifier
  252.  
  253.   InvSizeREGX     = /<inv[\s_]+size\s*:\s*(\d+)>/i
  254.   InvPlusREGX     = /<inv[\s_]+plus\s*:\s*(\d+)>/i
  255.   InvMinusREGX    = /<inv[\s_]+minus\s*:\s*(\d+)/i
  256.   InvFormSTART    = /<inv[\s_]+formula>/i
  257.   InvFormEND      = /<\/inv[\s_]+formula>/i
  258.  
  259.   def load_limited_inv
  260.     load_eval = false
  261.     @inv_size = 1
  262.     @inv_eval = '0'
  263.     @inv_mod = self.is_a?(RPG::Actor) ? Theo::LimInv::Default_FreeSlot : 0
  264.     self.note.split(/[\r\n]+/).each do |line|
  265.       case line
  266.       when InvSizeREGX
  267.         @inv_size = $1.to_i
  268.       when InvPlusREGX
  269.         @inv_mod = $1.to_i
  270.       when InvMinusREGX
  271.         @inv_mod = -$1.to_i
  272.       when InvFormSTART
  273.         load_eval = true
  274.         @inv_eval = ''
  275.       when InvFormEND
  276.         load_eval = false
  277.       else
  278.         @inv_eval += line if load_eval
  279.       end
  280.     end
  281.   end
  282.  
  283. end
  284. # =============================================================================
  285. # Data structures and workflows goes here
  286. # =============================================================================
  287. # =============================================================================
  288. # ▼ Game_Actor
  289. # =============================================================================
  290. class Game_Actor < Game_Battler
  291.   attr_accessor :base_inv
  292.  
  293.   alias theo_liminv_setup setup
  294.   def setup(actor_id)
  295.     theo_liminv_setup(actor_id)
  296.     @base_inv = $data_actors[id].inv_mod
  297.   end
  298.  
  299.   def equip_size
  300.     return 0 unless Theo::LimInv::Include_Equip
  301.     equips.compact.inject(0) {|total,equip| total + equip.inv_size}
  302.   end
  303.  
  304.   def inv_max
  305.     result = base_inv
  306.     result += $data_classes[class_id].inv_mod
  307.     result += states.inject(0) {|total,db| total + db.inv_mod}
  308.     result += equips.compact.inject(0) {|total,db| total + db.inv_mod}
  309.     result += eval(actor.inv_eval)
  310.     result += eval(self.class.inv_eval)
  311.     result
  312.   end
  313.   # --------------------------------------------------------------------------
  314.   # Overwrite : Trade item with party
  315.   # --------------------------------------------------------------------------
  316.   def trade_item_with_party(new_item, old_item)
  317.     return false if new_item && !$game_party.has_item?(new_item)
  318.     $game_party.force_gain_item(old_item, 1)
  319.     $game_party.force_gain_item(new_item, -1)
  320.     return true
  321.   end
  322.  
  323. end
  324. # =============================================================================
  325. # ▼ Game_Party
  326. # =============================================================================
  327. class Game_Party < Game_Unit
  328.   attr_accessor :base_inv
  329.  
  330.   alias theo_liminv_init initialize
  331.   def initialize
  332.     @base_inv = (Theo::LimInv::DynamicSlot ? 0 : Theo::LimInv::Default_FreeSlot)
  333.     theo_liminv_init
  334.   end
  335.  
  336.   def inv_max
  337.     return @base_inv unless Theo::LimInv::DynamicSlot
  338.     return members.inject(0) {|total,member| total + member.inv_max} + @base_inv
  339.   end
  340.  
  341.   def inv_maxed?
  342.     inv_max <= total_inv_size
  343.   end
  344.  
  345.   def total_inv_size
  346.     result = all_items.inject(0) {|total,item| total +
  347.       (item_number(item) * item.inv_size)}
  348.     result += members.inject(0) {|total,member| total + member.equip_size}
  349.     result
  350.   end
  351.  
  352.   alias theo_liminv_max_item max_item_number
  353.   def max_item_number(item)
  354.     $BTEST ? theo_liminv_max_item(item) : inv_max_item(item) + item_number(item)
  355.   end
  356.  
  357.   def inv_max_item(item)
  358.     return 9999999 if item.nil? || item.inv_size == 0
  359.     free_slot / item.inv_size
  360.   end
  361.  
  362.   def free_slot
  363.     inv_max - total_inv_size
  364.   end
  365.  
  366.   alias theo_liminv_item_max? item_max?
  367.   def item_max?(item)
  368.     $BTEST ? theo_liminv_item_max?(item) : inv_maxed?
  369.   end
  370.  
  371.   def near_maxed?
  372.     free_slot.to_f / inv_max <= Theo::LimInv::NearMaxed_Percent/100.0
  373.   end
  374.  
  375.   def item_size(item)
  376.     return 0 unless item
  377.     item.inv_size * item_number(item)
  378.   end
  379.  
  380.   def force_gain_item(item, amount, include_equip = false)
  381.     container = item_container(item.class)
  382.     return unless container
  383.     last_number = item_number(item)
  384.     new_number = last_number + amount
  385.     container[item.id] = [new_number, 0].max
  386.     container.delete(item.id) if container[item.id] == 0
  387.     if include_equip && new_number < 0
  388.       discard_members_equip(item, -new_number)
  389.     end
  390.     $game_map.need_refresh = true
  391.   end
  392.  
  393.   def lose_item(item, amount, include_equip = false)
  394.     force_gain_item(item, -amount, include_equip)
  395.   end
  396.  
  397.   alias theo_liminv_gain_item gain_item
  398.   def gain_item(item, amount, include_equip = false)
  399.     if Theo::LimInv::ForceGain
  400.       force_gain_item(item, amount, include_equip)
  401.     else
  402.       theo_liminv_gain_item(item, amount, include_equip)
  403.     end
  404.   end
  405.  
  406. end
  407. # =============================================================================
  408. # ▼ Game_Player
  409. # =============================================================================
  410. class Game_Player
  411.  
  412.   alias theo_liminv_dash? dash?
  413.   def dash?
  414.     return false if Theo::LimInv::Full_DisableDash && $game_party.inv_maxed?
  415.     return theo_liminv_dash?
  416.   end
  417.  
  418.   alias theo_liminv_real_move_speed real_move_speed
  419.   def real_move_speed
  420.     theo_liminv_real_move_speed - move_penalty
  421.   end
  422.  
  423.   def move_penalty
  424.     Theo::LimInv::Full_SlowDown && $game_party.inv_maxed? ? 1 : 0
  425.   end
  426.  
  427. end
  428. # =============================================================================
  429. # ▼ Game_Interpreter
  430. # =============================================================================
  431. class Game_Interpreter
  432.   def force_gain_item(item, amount)
  433.     $game_party.force_gain_item(item, amount)
  434.   end
  435. end
  436. # =============================================================================
  437. # Window related class goes here
  438. # =============================================================================
  439. # =============================================================================
  440. # ▼ Window_Base
  441. # =============================================================================
  442. class Window_Base < Window
  443.   def draw_inv_slot(x,y,width = contents.width,align = 2)
  444.     txt = sprintf("%d/%d",$game_party.total_inv_size, $game_party.inv_max)
  445.     color = Theo::LimInv::NearMaxed_Color
  446.     if $game_party.near_maxed?
  447.       change_color(text_color(color))
  448.     else
  449.       change_color(normal_color)
  450.     end
  451.     draw_text(x,y,width,line_height,txt,align)
  452.     change_color(normal_color)
  453.   end
  454.  
  455.   def draw_inv_info(x,y,width = contents.width)
  456.     change_color(system_color)
  457.     draw_text(x,y,width,line_height,Theo::LimInv::InvSlotVocab)
  458.     change_color(normal_color)
  459.     draw_inv_slot(x,y,width)
  460.   end
  461.  
  462.   def draw_item_size(item,x,y,total = true,width = contents.width)
  463.     rect = Rect.new(x,y,width,line_height)
  464.     change_color(system_color)
  465.     draw_text(rect,Theo::LimInv::InvSizeVocab)
  466.     change_color(normal_color)
  467.     number = (Theo::LimInv::DrawTotal_Size && total) ?
  468.       $game_party.item_size(item) : item.nil? ? 0 : item.inv_size
  469.     draw_text(rect,number,2)
  470.   end
  471. end
  472. # =============================================================================
  473. # ▼ New Class : Window_MenuLimInv
  474. # =============================================================================
  475. class Window_MenuLimInv < Window_Base
  476.  
  477.   def initialize(width)
  478.     super(0,0,width,fitting_height(1))
  479.     refresh
  480.   end
  481.  
  482.   def refresh
  483.     contents.clear
  484.     change_color(system_color)
  485.     txt = Theo::LimInv::SlotVocabShort
  486.     draw_text(0,0,contents.width,line_height,txt)
  487.     draw_inv_slot(0,0)
  488.   end
  489.  
  490. end
  491. # =============================================================================
  492. # ▼ New Class : Window_ItemSize
  493. # =============================================================================
  494. class Window_ItemSize < Window_Base
  495.  
  496.   def initialize(x,y,width)
  497.     super(x,y,width,fitting_height(1))
  498.   end
  499.  
  500.   def set_item(item)
  501.     @item = item
  502.     refresh
  503.   end
  504.  
  505.   def refresh
  506.     contents.clear
  507.     draw_item_size(@item,0,0)
  508.   end
  509.  
  510. end
  511. # =============================================================================
  512. # ▼ New Class : Window_FreeSlot
  513. # =============================================================================
  514. class Window_FreeSlot < Window_Base
  515.   def initialize(x,y,width)
  516.     super(x,y,width,fitting_height(1))
  517.     refresh
  518.   end
  519.  
  520.   def refresh
  521.     contents.clear
  522.     draw_inv_info(0,0)
  523.   end
  524. end
  525. # =============================================================================
  526. # ▼ New Class : Window_ItemUseCommand
  527. # =============================================================================
  528. class Window_ItemUseCommand < Window_Command
  529.   include Theo::LimInv
  530.  
  531.   def initialize
  532.     super(0,0)
  533.     self.openness = 0
  534.   end
  535.  
  536.   def set_item(item)
  537.     @item = item
  538.     refresh
  539.   end
  540.  
  541.   def window_width
  542.     UseCommand_Size
  543.   end
  544.  
  545.   def make_command_list
  546.     add_command(UseVocab, :use, $game_party.usable?(@item))
  547.     add_command(DiscardVocab, :discard, discardable?(@item))
  548.     add_command(CancelVocab, :cancel)
  549.   end
  550.  
  551.   def to_center
  552.     self.x = Graphics.width/2 - width/2
  553.     self.y = Graphics.height/2 - height/2
  554.   end
  555.  
  556.   def discardable?(item)
  557.     return false if item.nil?
  558.     !(item.is_a?(RPG::Item) && item.itype_id == 2)
  559.   end
  560.  
  561. end
  562. # =============================================================================
  563. # ▼ New Class : Window_DiscardAmount
  564. # =============================================================================
  565. class Window_DiscardAmount < Window_Base
  566.   attr_accessor :cmn_window
  567.   attr_accessor :itemlist
  568.   attr_accessor :freeslot
  569.  
  570.   def initialize(x,y,width)
  571.     super(x,y,width,fitting_height(1))
  572.     self.openness = 0
  573.     @amount = 0
  574.   end
  575.  
  576.   def set_item(item)
  577.     @item = item
  578.     @amount = 0
  579.     refresh
  580.   end
  581.  
  582.   def refresh
  583.     contents.clear
  584.     return unless @item
  585.     draw_item_name(@item,0,0,true,contents.width)
  586.     txt = sprintf("%d/%d",@amount, $game_party.item_number(@item))
  587.     draw_text(0,0,contents.width,line_height,txt,2)
  588.   end
  589.  
  590.   def draw_item_name(item, x, y, enabled = true, width = 172)
  591.     return unless item
  592.     draw_icon(item.icon_index, x, y, enabled)
  593.     change_color(normal_color, enabled)
  594.     draw_text(x + 24, y, width, line_height, item.name + ":")
  595.   end
  596.  
  597.   def update
  598.     super
  599.     return unless open?
  600.     change_amount(1) if Input.repeat?(:RIGHT)
  601.     change_amount(-1) if Input.repeat?(:LEFT)
  602.     change_amount(10) if Input.repeat?(:UP)
  603.     change_amount(-10) if Input.repeat?(:DOWN)
  604.     lose_item if Input.trigger?(:C)
  605.     close_window if Input.trigger?(:B)
  606.   end
  607.  
  608.   def change_amount(num)
  609.     @amount = [[@amount+num,0].max,$game_party.item_number(@item)].min
  610.     Sound.play_cursor
  611.     refresh
  612.   end
  613.  
  614.   def lose_item
  615.     $game_party.lose_item(@item,@amount)
  616.     @itemlist.redraw_current_item
  617.     @freeslot.refresh
  618.     if $game_party.item_number(@item) == 0
  619.       Sound.play_ok
  620.       @itemlist.activate.refresh
  621.       @itemlist.update_help
  622.       @cmn_window.close.deactivate
  623.       close
  624.     else
  625.       close_window
  626.     end
  627.   end
  628.  
  629.   def close_window
  630.     close
  631.     @cmn_window.activate
  632.     Sound.play_ok
  633.   end
  634.  
  635. end
  636. # =============================================================================
  637. # ▼ Window_ItemList
  638. # =============================================================================
  639. class Window_ItemList < Window_Selectable
  640.   attr_reader :item_size_window
  641.  
  642.   def item_size_window=(window)
  643.     @item_size_window = window
  644.     @item_size_window.set_item(item)
  645.   end
  646.  
  647.   alias theo_liminv_update_help update_help
  648.   def update_help
  649.     theo_liminv_update_help
  650.     @item_size_window.set_item(item) if @item_size_window
  651.   end
  652.  
  653.   alias theo_liminv_height= height=
  654.   def height=(height)
  655.     self.theo_liminv_height = height
  656.     refresh
  657.   end
  658.  
  659.   def enable?(item)
  660.     return !item.nil?
  661.   end
  662.  
  663. end
  664. # =============================================================================
  665. # ▼ Window_ShopNumber
  666. # =============================================================================
  667. class Window_ShopNumber < Window_Selectable
  668.   attr_accessor :mode
  669.  
  670.   alias theo_liminv_init initialize
  671.   def initialize(x, y, height)
  672.     theo_liminv_init(x, y, height)
  673.     @mode = :buy
  674.   end
  675.  
  676.   alias theo_liminv_refresh refresh
  677.   def refresh
  678.     theo_liminv_refresh
  679.     draw_itemsize
  680.   end
  681.  
  682.   def draw_itemsize
  683.     item_size = @number * @item.inv_size
  684.     total_size = $game_party.total_inv_size +
  685.       (@mode == :buy ? item_size : -item_size)
  686.     txt = sprintf("%d/%d",total_size,$game_party.inv_max)
  687.     ypos = item_y + line_height * ($imported["YEA-ShopOptions"] ? 5 : 4)
  688.     rect = Rect.new(4,ypos,contents.width-8,line_height)
  689.     change_color(system_color)
  690.     draw_text(rect,Theo::LimInv::InvSlotVocab)
  691.     change_color(normal_color)
  692.     draw_text(rect,txt,2)
  693.   end
  694.  
  695. end
  696. # =============================================================================
  697. # ▼ Window_ShopStatus
  698. # =============================================================================
  699. class Window_ShopStatus < Window_Base
  700.  
  701.   if Theo::LimInv::Display_ItemSize
  702.   alias theo_liminv_draw_posses draw_possession
  703.   def draw_possession(x, y)
  704.     theo_liminv_draw_posses(x,y)
  705.     y += line_height
  706.     draw_item_size(@item,x,y,false, contents.width-(x*2))
  707.   end
  708.  
  709.   if $imported["YEA-ShopOptions"]
  710.   def draw_actor_equip_info(dx, dy, actor)
  711.     dy += line_height
  712.     enabled = actor.equippable?(@item)
  713.     change_color(normal_color, enabled)
  714.     draw_text(dx, dy, contents.width, line_height, actor.name)
  715.     item1 = current_equipped_item(actor, @item.etype_id)
  716.     draw_actor_param_change(dx, dy, actor, item1) if enabled
  717.   end
  718.   end # $imported["YEA-ShopOption"]
  719.   end # Display item size
  720.  
  721. end
  722. # =============================================================================
  723. # Scene classes goes here
  724. # =============================================================================
  725. # =============================================================================
  726. # ▼ Scene_Menu
  727. # =============================================================================
  728. class Scene_Menu < Scene_MenuBase
  729.  
  730.   alias theo_liminv_start start
  731.   def start
  732.     theo_liminv_start
  733.     create_liminv_window
  734.   end
  735.  
  736.   def create_liminv_window
  737.     @lim_inv = Window_MenuLimInv.new(@gold_window.width)
  738.     @lim_inv.x = @command_window.x
  739.     @lim_inv.y = @command_window.height
  740.   end
  741.  
  742. end
  743. # =============================================================================
  744. # ▼ Scene_Item
  745. # =============================================================================
  746. class Scene_Item < Scene_ItemBase
  747.  
  748.   alias theo_liminv_start start
  749.   def start
  750.     theo_liminv_start
  751.     resize_item_window
  752.     create_freeslot_window
  753.     create_itemsize_window
  754.     create_usecommand_window
  755.     create_discard_amount
  756.   end
  757.  
  758.   def resize_item_window
  759.     @item_window.height -= @item_window.line_height * 2
  760.   end
  761.  
  762.   def create_freeslot_window
  763.     wy = @item_window.y + @item_window.height
  764.     wh = Theo::LimInv::Display_ItemSize ? Graphics.width/2 : Graphics.width
  765.     @freeslot = Window_FreeSlot.new(0,wy,wh)
  766.     @freeslot.viewport = @viewport
  767.   end
  768.  
  769.   def create_itemsize_window
  770.     return unless Theo::LimInv::Display_ItemSize
  771.     wx = @freeslot.width
  772.     wy = @freeslot.y
  773.     ww = wx
  774.     @itemsize = Window_ItemSize.new(wx,wy,ww)
  775.     @itemsize.viewport = @viewport
  776.     @item_window.item_size_window = @itemsize
  777.   end
  778.  
  779.   def create_usecommand_window
  780.     @use_command = Window_ItemUseCommand.new
  781.     @use_command.to_center
  782.     @use_command.set_handler(:use, method(:use_command_ok))
  783.     @use_command.set_handler(:discard, method(:on_discard_ok))
  784.     @use_command.set_handler(:cancel, method(:on_usecmd_cancel))
  785.     @use_command.viewport = @viewport
  786.   end
  787.  
  788.   def create_discard_amount
  789.     wx = @use_command.x
  790.     wy = @use_command.y + @use_command.height
  791.     ww = @use_command.width
  792.     @discard_window = Window_DiscardAmount.new(wx,wy,ww)
  793.     @discard_window.cmn_window = @use_command
  794.     @discard_window.itemlist = @item_window
  795.     @discard_window.freeslot = @freeslot
  796.     @discard_window.viewport = @viewport
  797.   end
  798.  
  799.   alias theo_liminv_item_ok on_item_ok
  800.   def on_item_ok
  801.     @use_command.set_item(item)
  802.     @use_command.open
  803.     @use_command.activate
  804.     @use_command.select(0)
  805.   end
  806.  
  807.   alias theo_liminv_use_item use_item
  808.   def use_item
  809.     @use_command.close
  810.     theo_liminv_use_item
  811.     @freeslot.refresh
  812.   end
  813.  
  814.   def use_command_ok
  815.     theo_liminv_item_ok
  816.     @use_command.close
  817.   end
  818.  
  819.   def on_discard_ok
  820.     @discard_window.set_item(item)
  821.     @discard_window.open
  822.   end
  823.  
  824.   def on_usecmd_cancel
  825.     @item_window.activate
  826.     @use_command.close
  827.     @use_command.deactivate
  828.   end
  829.  
  830. end
  831. # =============================================================================
  832. # ▼ Scene_Shop
  833. # =============================================================================
  834. class Scene_Shop < Scene_MenuBase
  835.   alias theo_liminv_buy_ok on_buy_ok
  836.   def on_buy_ok
  837.     @number_window.mode = :buy
  838.     theo_liminv_buy_ok
  839.   end
  840.  
  841.   alias theo_liminv_sell_ok on_sell_ok
  842.   def on_sell_ok
  843.     @number_window.mode = :sell
  844.     theo_liminv_sell_ok
  845.   end
  846. end
  847.  
  848. # =============================================================================
  849. # ▼ Compatibility patch thingy
  850. # =============================================================================
  851.  
  852. if $imported["YEA-MenuCursor"]
  853. class Sprite_MenuCursor
  854.   def opacity_rate
  855.     rate = 16
  856.     return -rate if !@window.active || @window.close?
  857.     return rate
  858.   end
  859. end
  860. end
  861.  
  862. if $imported[:mog_menu_cursor]
  863. module CURSOR_MENU_SPRITE
  864.   def can_update_cursor_position?
  865.     return false if !self.active     
  866.     return false if self.index < 0
  867.     return false if !self.visible
  868.     return false if self.close?
  869.     return true
  870.   end
  871. end
  872. end

Lv5.捕梦者

梦石
0
星屑
24242
在线时间
5033 小时
注册时间
2016-3-8
帖子
1618
 楼主| 发表于 2020-8-12 07:52:23 | 显示全部楼层
已解決,是与其他脚本沖突了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-18 20:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表