#============================================================================== # ■ ショップ画面簡易改造 #------------------------------------------------------------------------------ #  ショップステータス画面をより使いやすくします # 簡易ですので細かい機能等はありません # 要望、バグなどはホームページにてご報告ください # # *月の下の宿 # URL:http://gekkasou.shiteyattari.com/ #============================================================================== #============================================================================== # ■ Vocab #============================================================================== module Vocab #命中率 Accuracy = "命中率" #回避率 Evasion = "回避率" #切り替え可能 Change_Actor = "←→キーでアクター変更" #スキル習得切り替え Change_Skill = "X:スキル切り替え" Learning = "習得スキル" end #============================================================================== # ■ An_Custom_Shop #------------------------------------------------------------------------------ #  ショップ画面改造での設定項目 #============================================================================== module An_Custom_Shop #このスイッチがオンの時にショップを起動すると購入・売却専用画面になります #ショップ画面を閉じたら自動的にオフになります Swi_BSOnly = 16 #このスイッチがオンの時、ショップ画面のコマンドに装備画面を追加する EquipPlusSwitch = 3 #武器ならば命中率、防具ならば回避率を表示 View_HE = false #選択した武具がすでに装備してるものだった場合に表示する文字 Equip = "E" #ステータス表示時の文字色(\C[n]と同じ) #変化なし Normal = 0 #上昇時 PowerUp = 24 #低下時 PowerDown = 25 #習得スキル切り替えボタン Change_Skill = Input::X #Aボタン end #競合関係回避用 $imported = {} if $imported.nil? $rsi = {} if $rsi.nil? #============================================================================== # ■ Window_ShopStatus #============================================================================== class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias an_status_initialize initialize def initialize(x, y) @an_actor = 0 @an_contents_x = 0 @an_mode = 0 @page_max = 0 an_status_initialize(x, y) end #-------------------------------------------------------------------------- # ● ウィンドウ内容の作成 #-------------------------------------------------------------------------- def create_contents super if $game_party.members.size > 0 self.contents.dispose self.contents = Bitmap.new(width - 30, height - 32) end end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear x = @an_contents_x + 4 if @item != nil number = $game_party.item_number(@item) self.contents.font.color = system_color self.contents.draw_text(x, 0, 200, WLH, Vocab::Possession) self.contents.font.color = normal_color self.contents.draw_text(x, 0, 200, WLH, number, 2) self.contents.font.color = normal_color self.contents.draw_text(x, 28, 200, WLH, actor.name, 1) if actor.equips.include?(@item) self.contents.draw_text(x, 28, 200, WLH, An_Custom_Shop::Equip) end self.cursor_rect.empty if $imported["EquipLearnSkill"] && !@item.learn_skills.empty? self.contents.draw_text(x, WLH * 9+8, 200, WLH, Vocab::Change_Skill, 1) end return if @item.is_a?(RPG::Item) self.cursor_rect.set(0,24,208,32) if size > 1 self.contents.draw_text(x, WLH * 8+8, 200, WLH, Vocab::Change_Actor, 1) end else return end if @an_mode == 0 for i in 0..($rsi["魔法防御パラメーター追加"] ? 5 : 4) an_draw_status_name(i, x, WLH * 2 + WLH * i) end draw_actor_parameter_change(actor,x+64,WLH*1+8) else return if $imported["EquipLearnSkill"] != true y = WLH * 2+8 index = 0 text = Vocab::Learning text += @an_mode.to_s text += "/" text += (@page_max - 1).to_s self.contents.draw_text(x, y, 200, WLH, text, 1) y += 24 for i in 0..1 skill = skills[(@an_mode - 1) * 2 + i] next if skill == nil draw_icon(skill.icon_index, x, y, true) self.contents.font.color = normal_color self.contents.draw_text(x + 24, y, 172, WLH, skill.name) text = "#{actor.skill_ap(skill.id)}/#{skill.need_ap.to_s}" self.contents.draw_text(x + 24, y + 24, 172, WLH, text, 2) y += 48 end end end def an_draw_status_name(index, x, y) case index when 0 text = Vocab.atk when 1 text = Vocab.def when 2 text = Vocab.spi when 3 if $rsi["魔法防御パラメーター追加"] text = Rokan::MagicGuard_Plas::MDN else text = Vocab.agi end when 4 if $rsi["魔法防御パラメーター追加"] text = Vocab.agi else if @item.is_a?(RPG::Weapon) && An_Custom_Shop::View_HE text = Vocab.Accuracy elsif @item.is_a?(RPG::Armor) && An_Custom_Shop::View_HE text = Vocab.Evasion end end when 5 if @item.is_a?(RPG::Weapon) && An_Custom_Shop::View_HE text = Vocab.Accuracy elsif @item.is_a?(RPG::Armor) && An_Custom_Shop::View_HE text = Vocab.Evasion end end self.contents.draw_text(x, y + 8, 56, WLH, text) end #-------------------------------------------------------------------------- # ● パーティのサイズ取得 #-------------------------------------------------------------------------- def size return $game_party.members.size end def actor return $game_party.members[@an_actor] end def skills return [] if $imported.nil? || $imported["EquipLearnSkill"] != true result = [] return [] unless actor.include_learnable_equipment?(@item) @item.learn_skills.each {|i| skill = $data_skills[i] next unless actor.include_equipment_skill?(skill) if KGC::EquipLearnSkill::NEED_FULL_AP next unless skill.need_ap == 0 || actor.ap_full?(skill) end result << skill } return result end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias an_shopstatus_update update def update item = @item an_shopstatus_update if item != @item @an_mode = 0 end return if @item.nil? @page_max = (skills.size + 1) / 2 + 1 last_actor = @an_actor if Input.trigger?(Input::LEFT) @an_actor = (@an_actor-1+size)%size elsif Input.trigger?(Input::RIGHT) @an_actor = (@an_actor+1)%size elsif !skills.empty? && Input.trigger?(An_Custom_Shop::Change_Skill) @an_mode = (@an_mode + 1) % @page_max Sound.play_cursor refresh return end if @an_actor != last_actor if @an_actor != 0 @an_contents_x = 1 end if @an_actor == size-1 @an_contents_x = 2 end if @an_actor == 0 @an_contents_x = 0 end self.ox = @an_contents_x @an_mode = 0 Sound.play_cursor refresh end end #-------------------------------------------------------------------------- # ● アクターの現装備と能力値変化の描画 #-------------------------------------------------------------------------- def draw_actor_parameter_change(actor, x, y) return if @item.is_a?(RPG::Item) self.contents.font.color = normal_color item = [@item.atk, @item.def, @item.spi, @item.agi] item.insert(3, @item.mdef) if $rsi["魔法防御パラメーター追加"] temp_actor = Marshal.load(Marshal.dump(actor)) enabled = actor.equippable?(@item) && !temp_actor.equips.include?(@item) self.contents.font.color.alpha = enabled ? 255 : 128 if enabled if @item.is_a?(RPG::Armor) kind = @item.kind + 1 else kind = 0 end temp_actor.change_equip(kind, @item, true) result = [] result << temp_actor.atk - actor.atk result << temp_actor.def - actor.def result << temp_actor.spi - actor.spi if $rsi["魔法防御パラメーター追加"] result << temp_actor.base_mdef - actor.base_mdef end result << temp_actor.agi - actor.agi if @item.is_a?(RPG::Weapon) result << temp_actor.hit - actor.hit else result << temp_actor.eva - actor.eva end else result = [0,0,0,0,0] if $rsi["魔法防御パラメーター追加"] ; result << 0 ; end end if @item.is_a?(RPG::Weapon) item << @item.hit else item << @item.eva end for i in 0...result.size break if i == result.size - 1 && !An_Custom_Shop::View_HE self.contents.font.color = normal_color plus = WLH * (i + 1) self.contents.draw_text(x+4, y+plus, 64, WLH, item[i], 2) self.contents.font.color = text_color(An_Custom_Shop::Normal) self.contents.font.color.alpha = enabled ? 255 : 128 change = result[i] text = sprintf("%+d", change) if change < 0 self.contents.font.color = text_color(An_Custom_Shop::PowerDown) elsif change > 0 self.contents.font.color = text_color(An_Custom_Shop::PowerUp) end self.contents.draw_text(x+72, y+plus, 64, WLH, text, 2) end self.contents.font.color = normal_color self.contents.font.color.alpha = 255 end end if !$imported.nil? && $imported["HelpExtension"] #============================================================================== # ■ Scene_Shop #============================================================================== class Scene_Shop #-------------------------------------------------------------------------- # ● ウィンドウサイズ調整 #-------------------------------------------------------------------------- alias an_shopstatus_adjust_window_size adjust_window_size def adjust_window_size an_shopstatus_adjust_window_size @status_window.create_contents end alias an_helpextention_update update def update if @buy_window.active item = @buy_window.item elsif @sell_window.active item = @sell_window.item end if !@command_window.active && Input.press?(KGC::HelpExtension::SHOP_STATUS_SCROLL_BUTTON) @buy_window.update @sell_window.update end an_helpextention_update if !item.nil? && !item.is_a?(RPG::Item) @status_window.cursor_rect.set(0,24,208,32) end end end end #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● ショップ画面への切り替え #-------------------------------------------------------------------------- alias an_sellorbuyonly_call_shop call_shop def call_shop if $game_switches[An_Custom_Shop::Swi_BSOnly] == true $game_switches[An_Custom_Shop::Swi_BSOnly] = false $game_temp.next_scene = nil $scene = Scene_An_Shop.new return elsif $game_switches[An_Custom_Shop::EquipPlusSwitch] == true $game_switches[An_Custom_Shop::EquipPlusSwitch] = false $game_temp.next_scene = nil $scene = Scene_eShop.new return end an_sellorbuyonly_call_shop end end #============================================================================== # ■ Scene_sEquip #============================================================================== class Scene_sEquip < Scene_Equip #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_eShop.new(2) end end #============================================================================== # ■ Scene_An_Shop #============================================================================== class Scene_An_Shop < Scene_Base #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background create_command_window @help_window = Window_Help.new @gold_window = Window_Gold.new(384, 56) @buy_window = Window_ShopBuy.new(0, 112) @buy_window.active = $game_temp.shop_purchase_only @buy_window.visible = $game_temp.shop_purchase_only @buy_window.help_window = @help_window @sell_window = Window_ShopSell.new(0, 112, 544, 304) @sell_window.active = !$game_temp.shop_purchase_only @sell_window.visible = !$game_temp.shop_purchase_only @sell_window.help_window = @help_window @number_window = Window_ShopNumber.new(0, 112) @number_window.active = false @number_window.visible = false @status_window = Window_ShopStatus.new(304, 112) @status_window.visible = $game_temp.shop_purchase_only if $imported != nil && $imported["HelpExtension"] adjust_window_size @sell_window.refresh @buy_window.refresh end end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @command_window.dispose @help_window.dispose @gold_window.dispose @buy_window.dispose @sell_window.dispose @number_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_menu_background @help_window.update @gold_window.update @buy_window.update @sell_window.update stnu = true if @number_window.active && @status_window.visible if stnu if Input.press?(Input::SHIFT) @status_window.update else @number_window.update end else @status_window.update if @status_window.visible @number_window.update end if @buy_window.active update_buy_selection elsif @sell_window.active update_sell_selection elsif @number_window.active update_number_input end end #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::ShopBuy s2 = Vocab::ShopSell s3 = Vocab::ShopCancel @command_window = Window_Command.new(384, [s1, s2, s3], 3) for i in 0..3 @command_window.draw_item(i, false) end if !$game_temp.shop_purchase_only @command_window.index = 1 end @command_window.update end #-------------------------------------------------------------------------- # ● 購入アイテム選択の更新 #-------------------------------------------------------------------------- def update_buy_selection @status_window.item = @buy_window.item if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) @item = @buy_window.item number = $game_party.item_number(@item) if @item == nil or @item.price > $game_party.gold or number == 99 Sound.play_buzzer else Sound.play_decision max = @item.price == 0 ? 99 : $game_party.gold / @item.price max = [max, 99 - number].min @buy_window.active = false @buy_window.visible = false @number_window.set(@item, max, @item.price) @number_window.active = true @number_window.visible = true @status_window.refresh @status_window.update end end end #-------------------------------------------------------------------------- # ● 売却アイテム選択の更新 #-------------------------------------------------------------------------- def update_sell_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) @item = @sell_window.item @status_window.item = @item if @item == nil or @item.price == 0 Sound.play_buzzer else Sound.play_decision max = $game_party.item_number(@item) @sell_window.active = false @sell_window.visible = false @number_window.set(@item, max, @item.price / 2) @number_window.active = true @number_window.visible = true @status_window.visible = true @status_window.refresh @status_window.update end end end #-------------------------------------------------------------------------- # ● 個数入力の更新 #-------------------------------------------------------------------------- def update_number_input if Input.trigger?(Input::B) cancel_number_input elsif Input.trigger?(Input::C) decide_number_input end end #-------------------------------------------------------------------------- # ● 個数入力のキャンセル #-------------------------------------------------------------------------- def cancel_number_input Sound.play_cancel if $game_temp.shop_purchase_only @buy_window.active = true @buy_window.visible = true else @sell_window.active = true @sell_window.visible = true end @number_window.active = false @number_window.visible = false @status_window.visible = false if @command_window.index == 1 end #-------------------------------------------------------------------------- # ● 個数入力の決定 #-------------------------------------------------------------------------- def decide_number_input Sound.play_shop if $game_temp.shop_purchase_only $game_party.lose_gold(@number_window.number * @item.price) $game_party.gain_item(@item, @number_window.number) @buy_window.active = true @buy_window.visible = true @buy_window.refresh else $game_party.gain_gold(@number_window.number * (@item.price / 2)) $game_party.lose_item(@item, @number_window.number) @sell_window.active = true @sell_window.visible = true @sell_window.refresh end @number_window.active = false @number_window.visible = false @gold_window.refresh @status_window.refresh @status_window.visible = false if @command_window.index == 1 end #-------------------------------------------------------------------------- # ● ウィンドウサイズ調整 #-------------------------------------------------------------------------- def adjust_window_size @help_window.row_max = KGC::HelpExtension::ROW_MAX @gold_window.y = @command_window.y = @help_window.height dy = @help_window.height + 56 @status_window.y = @buy_window.y = @sell_window.y = @number_window.y = dy @buy_window.height = @sell_window.height = @number_window.height = @status_window.height = Graphics.height - dy @number_window.create_contents @status_window.create_contents @sell_window.create_contents @buy_window.create_contents end end #============================================================================== # ■ Scene_eShop #============================================================================== class Scene_eShop < Scene_Shop #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(index = 0) @index = index end #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::ShopBuy s2 = Vocab::ShopSell s3 = Vocab::equip s4 = Vocab::ShopCancel @command_window = Window_Command.new(384, [s1, s2, s3, s4], 4) @command_window.y = KGC::HelpExtension::ROW_MAX * Window_Base::WLH + 32 if $game_temp.shop_purchase_only @command_window.draw_item(1, false) end @command_window.index = @index end #-------------------------------------------------------------------------- # ● コマンド選択の更新 #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::C) if @command_window.index == 2 Sound.play_decision $scene = Scene_sEquip.new return elsif @command_window.index == 3 Sound.play_decision $scene = Scene_Map.new return end end super end end #ver1.11