Class: Window_ShopStatus
- Inherits:
-
Window_Base
- Object
- Window
- Window_Base
- Window_ShopStatus
- Defined in:
- lib/rgss3_default_scripts/Window_ShopStatus.rb
Overview
** Window_ShopStatus
This window displays number of items in possession and the actor's
equipment on the shop screen.
Instance Method Summary collapse
-
#current_equipped_item(actor, etype_id) ⇒ Object
————————————————————————– * Get Current Equipment Returns the weaker equipment if there is more than one of the same type, such as with dual wield.
-
#draw_actor_equip_info(x, y, actor) ⇒ Object
————————————————————————– * Draw Actor Equipment Information ————————————————————————–.
-
#draw_actor_param_change(x, y, actor, item1) ⇒ Object
————————————————————————– * Draw Actor Parameter Change ————————————————————————–.
-
#draw_equip_info(x, y) ⇒ Object
————————————————————————– * Draw Equipment Information ————————————————————————–.
-
#draw_possession(x, y) ⇒ Object
————————————————————————– * Draw Quantity Possessed ————————————————————————–.
-
#initialize(x, y, width, height) ⇒ Window_ShopStatus
constructor
————————————————————————– * Object Initialization ————————————————————————–.
-
#item=(item) ⇒ Object
————————————————————————– * Set Item ————————————————————————–.
-
#page_max ⇒ Object
————————————————————————– * Get Maximum Number of Pages ————————————————————————–.
-
#page_size ⇒ Object
————————————————————————– * Number of Actors Displayable at Once ————————————————————————–.
-
#param_id ⇒ Object
————————————————————————– * Get Parameter ID Corresponding to Selected Item By default, ATK if weapon and DEF if armor.
-
#refresh ⇒ Object
————————————————————————– * Refresh ————————————————————————–.
-
#status_members ⇒ Object
————————————————————————– * Array of Actors for Which to Draw Equipment Information ————————————————————————–.
-
#update ⇒ Object
————————————————————————– * Frame Update ————————————————————————–.
-
#update_page ⇒ Object
————————————————————————– * Update Page ————————————————————————–.
Methods inherited from Window_Base
#activate, #actor_name, #calc_line_height, #change_color, #close, #contents_height, #contents_width, #convert_escape_characters, #create_contents, #crisis_color, #deactivate, #dispose, #draw_actor_class, #draw_actor_face, #draw_actor_graphic, #draw_actor_hp, #draw_actor_icons, #draw_actor_level, #draw_actor_mp, #draw_actor_name, #draw_actor_nickname, #draw_actor_param, #draw_actor_simple_status, #draw_actor_tp, #draw_character, #draw_currency_value, #draw_current_and_max_values, #draw_face, #draw_gauge, #draw_icon, #draw_item_name, #draw_text, #draw_text_ex, #fitting_height, #gauge_back_color, #hide, #hp_color, #hp_gauge_color1, #hp_gauge_color2, #knockout_color, #line_height, #make_font_bigger, #make_font_smaller, #mp_color, #mp_cost_color, #mp_gauge_color1, #mp_gauge_color2, #normal_color, #obtain_escape_code, #obtain_escape_param, #open, #param_change_color, #party_member_name, #pending_color, #power_down_color, #power_up_color, #process_character, #process_draw_icon, #process_escape_character, #process_new_line, #process_new_page, #process_normal_character, #reset_font_settings, #show, #standard_padding, #system_color, #text_color, #text_size, #tp_color, #tp_cost_color, #tp_gauge_color1, #tp_gauge_color2, #translucent_alpha, #update_close, #update_open, #update_padding, #update_tone
Constructor Details
#initialize(x, y, width, height) ⇒ Window_ShopStatus
-
Object Initialization
12 13 14 15 16 17 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 12 def initialize(x, y, width, height) super(x, y, width, height) @item = nil @page_index = 0 refresh end |
Instance Method Details
#current_equipped_item(actor, etype_id) ⇒ Object
-
Get Current Equipment
Returns the weaker equipment if there is more than one of the same type, such as with dual wield.
101 102 103 104 105 106 107 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 101 def current_equipped_item(actor, etype_id) list = [] actor.equip_slots.each_with_index do |slot_etype_id, i| list.push(actor.equips[i]) if slot_etype_id == etype_id end list.min_by {|item| item ? item.params[param_id] : 0 } end |
#draw_actor_equip_info(x, y, actor) ⇒ Object
-
Draw Actor Equipment Information
72 73 74 75 76 77 78 79 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 72 def draw_actor_equip_info(x, y, actor) enabled = actor.equippable?(@item) change_color(normal_color, enabled) draw_text(x, y, 112, line_height, actor.name) item1 = current_equipped_item(actor, @item.etype_id) draw_actor_param_change(x, y, actor, item1) if enabled draw_item_name(item1, x, y + line_height, enabled) end |
#draw_actor_param_change(x, y, actor, item1) ⇒ Object
-
Draw Actor Parameter Change
83 84 85 86 87 88 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 83 def draw_actor_param_change(x, y, actor, item1) rect = Rect.new(x, y, contents.width - 4 - x, line_height) change = @item.params[param_id] - (item1 ? item1.params[param_id] : 0) change_color(param_change_color(change)) draw_text(rect, sprintf("%+d", change), 2) end |
#draw_equip_info(x, y) ⇒ Object
-
Draw Equipment Information
46 47 48 49 50 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 46 def draw_equip_info(x, y) status_members.each_with_index do |actor, i| draw_actor_equip_info(x, y + line_height * (i * 2.4), actor) end end |
#draw_possession(x, y) ⇒ Object
-
Draw Quantity Possessed
36 37 38 39 40 41 42 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 36 def draw_possession(x, y) rect = Rect.new(x, y, contents.width - 4 - x, line_height) change_color(system_color) draw_text(rect, Vocab::Possession) change_color(normal_color) draw_text(rect, $game_party.item_number(@item), 2) end |
#item=(item) ⇒ Object
-
Set Item
29 30 31 32 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 29 def item=(item) @item = item refresh end |
#page_max ⇒ Object
-
Get Maximum Number of Pages
66 67 68 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 66 def page_max ($game_party.members.size + page_size - 1) / page_size end |
#page_size ⇒ Object
-
Number of Actors Displayable at Once
60 61 62 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 60 def page_size return 4 end |
#param_id ⇒ Object
-
Get Parameter ID Corresponding to Selected Item
By default, ATK if weapon and DEF if armor.
93 94 95 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 93 def param_id @item.is_a?(RPG::Weapon) ? 2 : 3 end |
#refresh ⇒ Object
-
Refresh
21 22 23 24 25 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 21 def refresh contents.clear draw_possession(4, 0) draw_equip_info(4, line_height * 2) if @item.is_a?(RPG::EquipItem) end |
#status_members ⇒ Object
-
Array of Actors for Which to Draw Equipment Information
54 55 56 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 54 def status_members $game_party.members[@page_index * page_size, page_size] end |
#update ⇒ Object
-
Frame Update
111 112 113 114 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 111 def update super update_page end |
#update_page ⇒ Object
-
Update Page
118 119 120 121 122 123 |
# File 'lib/rgss3_default_scripts/Window_ShopStatus.rb', line 118 def update_page if visible && Input.trigger?(:A) && page_max > 1 @page_index = (@page_index + 1) % page_max refresh end end |