#============================================================================== # ■ VXAce-RGSS3-4-lst クエストシステム【クエストリスト】 by Claimh #------------------------------------------------------------------------------ # 進行中・クリア済み・失敗したクエストの一覧を表示します。 #============================================================================== class Scene_QuestList < Scene_MenuBase #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_type_window create_list_window @info = Window_QuestInfo.new @list.help_window = @info @type.help_window = @list @rank = Window_QuestRank.new if Quest::SHOW_RANK if Quest::QUEST_LIST.size <= 1 @type.visible = false @list.activate else @type.activate end end #-------------------------------------------------------------------------- # ● タイプウィンドウ生成 #-------------------------------------------------------------------------- def create_type_window @type = Window_QuestType.new @type.set_handler(:ok, method(:type_ok)) @type.set_handler(:cancel, method(:return_scene)) end #-------------------------------------------------------------------------- # ● リストウィンドウ生成 #-------------------------------------------------------------------------- def create_list_window @list = Window_QuestList.new(Quest::QUEST_LIST[@type.index]) @list.set_handler(:cancel, method(:list_cancel)) end #---------------------------------------------------------------------------- # ● 種別選択 #---------------------------------------------------------------------------- def type_ok @list.activate end #---------------------------------------------------------------------------- # ● 種別選択 #---------------------------------------------------------------------------- def list_cancel @type.activate return_scene if Quest::QUEST_LIST.size <= 1 end end class Window_QuestType < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @commands = Quest.questlist_name super(0, 0, Graphics.width, fitting_height(1)) refresh self.index = 0 end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max @commands.size end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max @commands.size end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) draw_text(item_rect_for_text(index), @commands[index], 1) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.data_refresh(Quest::QUEST_LIST[@index]) @help_window.update_help end end class Window_QuestList < Window_Selectable M_PLAY=0;M_CLR=1;M_FAIL=2;M_REPORT=3;M_SHOP=4;M_NIL=5 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(type, shop_id=0) one_line = fitting_height(1) size = SceneManager.scene_is?(Scene_Guild) ? Quest::GUILD_LIST.size : Quest::QUEST_LIST.size y = (size > 1) ? one_line : 0 h = Graphics.height - one_line l = SceneManager.scene_is?(Scene_Guild) ? 2 : 1 h -= fitting_height(l) if Quest::SHOW_RANK h += one_line if y == 0 @commands = [] super(0, y, 180, h) $game_system.quest.reset(true) ## IDリストの更新しておく @shop_id = shop_id return if type < 0 data_refresh(type) end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max @commands.size end #-------------------------------------------------------------------------- # ● カーソルを右に移動 #-------------------------------------------------------------------------- def cursor_right(wrap = false) return unless @help_window.enable_right? Sound.play_cursor @help_window.page_right end #-------------------------------------------------------------------------- # ● カーソルを左に移動 #-------------------------------------------------------------------------- def cursor_left(wrap = false) return unless @help_window.enable_left? Sound.play_cursor @help_window.page_left end #-------------------------------------------------------------------------- # ● カーソルを 1 ページ後ろに移動 #-------------------------------------------------------------------------- def cursor_pagedown return unless @help_window.enable_down? Sound.play_cursor @help_window.page_down end #-------------------------------------------------------------------------- # ● カーソルを 1 ページ前に移動 #-------------------------------------------------------------------------- def cursor_pageup return unless @help_window.enable_up? Sound.play_cursor @help_window.page_up end #-------------------------------------------------------------------------- # ● 決定ボタンが押されたときの処理 #-------------------------------------------------------------------------- def process_ok super call_handler(:cation) unless current_item_enabled? end #-------------------------------------------------------------------------- # ● 有効Index? #-------------------------------------------------------------------------- def index_active?(i) return false if @commands[i].nil? case @type when M_REPORT; return @commands[i].quest_clear? when M_SHOP; return @commands[i].can_start? end return true end #-------------------------------------------------------------------------- # ● 選択項目の有効状態を取得 #-------------------------------------------------------------------------- def current_item_enabled? return false if @type == M_SHOP and $game_system.quest.over_playing? return index_active?(@index) end #-------------------------------------------------------------------------- # ● アイテム情報 #-------------------------------------------------------------------------- def current_item return @commands[@index] end #-------------------------------------------------------------------------- # ● 無効になっている理由 #-------------------------------------------------------------------------- def cause return "" if @commands[@index].nil? case @type when M_REPORT; return @commands[@index].clear_cause when M_SHOP; return @commands[@index].start_cause end return "" ## 使い方わるい end #-------------------------------------------------------------------------- # ● データリフレッシュ #-------------------------------------------------------------------------- def data_refresh(type, force=false, i=0) return if @type == type and !force @type = type @commands = [] $game_system.quest.ids.each do |id| data = $game_system.quest[id] next unless data.visible case @type when M_PLAY; @commands.push(data) if data.playing when M_CLR; @commands.push(data) if data.clear_finish when M_FAIL; @commands.push(data) if data.fail_finish when M_REPORT;@commands.push(data) if data.guild_report when M_SHOP; @commands.push(data) if data.guild_enable(@shop_id) when M_NIL; break end end cond = (@type == M_PLAY or @type == M_REPORT) @help_window.reset(cond) unless @help_window.nil? # index位置の保持 i = item_max - 1 if (item_max-1) < i i = 0 if i < 0 create_contents self.index = i refresh if self.top_row < 0 self.top_row = 0 self.oy = 0 update_cursor end end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) change_color(normal_color, index_active?(index)) draw_text(item_rect_for_text(index), Quest.conv_text(@commands[index].name)) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.refresh(@commands[@index]) end #-------------------------------------------------------------------------- # ● クエスト開始 #-------------------------------------------------------------------------- def quest_start return if @commands[@index].nil? @commands[@index].quest_start data_refresh(@type, true, @index) end #-------------------------------------------------------------------------- # ● クエストクリア #-------------------------------------------------------------------------- def quest_clear?(i) return false if @commands[i].nil? return true if @commands[i].report? and @commands[i].clear return @commands[i].quest_clear? end def quest_clear return if @commands[@index].nil? @commands[@index].quest_clear #data_refresh(@type, true) end #-------------------------------------------------------------------------- # ● クエスト失敗 #-------------------------------------------------------------------------- def quest_fail?(i) return false if @commands[i].nil? return true if @commands[i].report? and @commands[i].fail return false end def quest_fail return if @commands[@index].nil? @commands[@index].quest_fail #data_refresh(@type, true) end end class Window_QuestInfo < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize size = SceneManager.scene_is?(Scene_Guild) ? Quest::GUILD_LIST.size : Quest::QUEST_LIST.size y = (size > 1) ? fitting_height(1) : 0 super(180, y, Graphics.width-180, Graphics.height-y) reset refresh(nil) end #-------------------------------------------------------------------------- # ● データ破棄 #-------------------------------------------------------------------------- def reset(view=true) @data = nil @page = 0 @left = 0 @view_cond = view create_bitmap(@data) end #-------------------------------------------------------------------------- # ● ビットマップ生成 #-------------------------------------------------------------------------- def create_bitmap(data) w = contents_width h = contents_height if data != @data @left = 0 @page = 0 self.oy = 0 self.ox = 0 end if !data.nil? and (data.view_res or (data.view_cond and @view_cond) ) w = width else @left = 0 # 左ページのみ self.ox = 0 end if !data.nil? and @left == 0 # 上下ページは左ページのみ # 上下ページ数が変わる h = height if data.page_num > 1 else @page = 0 self.oy = 0 end self.contents = Bitmap.new(w, h) end #-------------------------------------------------------------------------- # ● 左右ページ切り替え有効? #-------------------------------------------------------------------------- def enable_right? return false if @data.nil? return (left_max != (@left+1)) end def enable_left? return @left != 0 end #-------------------------------------------------------------------------- # ● 左右ページ切り替え #-------------------------------------------------------------------------- def page_left self.left = (@left - 1 + left_max) % left_max end def page_right self.left = (@left + 1) % left_max end def left=(i) @left = i case i when 0; self.ox = 0 when 1; self.ox = left_max == 3 ? 16 : 32 when 2; self.ox = 32 end refresh(@data, true) end #-------------------------------------------------------------------------- # ● 左右ページ最大数 #-------------------------------------------------------------------------- def left_max return 1 if @data.nil? or (!@data.view_res and (!@data.view_cond and !@view_cond)) return 3 if @data.view_res and (@data.view_cond and @view_cond) return 2 if @data.view_res or (@data.view_cond and @view_cond) return 1 end #-------------------------------------------------------------------------- # ● 上下ページ切り替え有効? #-------------------------------------------------------------------------- def enable_up? return (!@data.nil? and @left == 0 and @page != 0 and @data.page_num > 0) end def enable_down? return (!@data.nil? and @left == 0 and @page < (@data.page_num-1)) end #-------------------------------------------------------------------------- # ● 上下ページ切り替え #-------------------------------------------------------------------------- def page_up self.page = @page - 1 end def page_down self.page = @page + 1 end def page=(pp) @page = pp case pp when 0; self.oy = 0 when (@data.page_num - 1); self.oy = 32 else; self.oy = 16 end refresh(@data, true) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh(data=nil, force=false) return if data == @data and !force create_bitmap(data) @data = data return if data.nil? change_color(normal_color) draw_text(self.ox, self.oy, 240, line_height, Quest.conv_text(@data.name)) if Quest::SHOW_RANK and !@data.rank.quest.nil? change_color(system_color) xx = Graphics.width - 124 draw_text(self.ox+xx, self.oy, 100, line_height, "Rank") change_color(Quest::RANK_CLR[@data.rank.quest]) draw_text(self.ox+xx+60, self.oy, 80, line_height, Quest::RANK[@data.rank.quest]) change_color(normal_color) end case @left when 0; refresh_text when 1 if left_max == 2 @data.view_res ? refresh_result : refresh_cond else ## left_max == 3 refresh_result end when 2; refresh_cond end end #-------------------------------------------------------------------------- # ● リフレッシュ(クエスト内容) #-------------------------------------------------------------------------- def refresh_text y = line_height if @data.client != "" change_color(system_color) draw_text(self.ox+20, self.oy+y, 120, line_height, "依頼主") change_color(normal_color) draw_text(self.ox+120, self.oy+y, 240, line_height, Quest.conv_text(@data.client)) y = line_height * 2 end # ギルドイベントだけここに表示 premium = @data.premium if premium > 0 and @data.enable and @data.view_res change_color(system_color) draw_text(self.ox+20, y, 120, line_height, "報酬金額") draw_currency_value(premium, $data_system.currency_unit, self.ox+100, y, 120) y += line_height end commission = @data.commission if commission > 0 and @data.enable #and @data.view_res change_color(system_color) draw_text(self.ox+20, y, 120, line_height, "手数料") draw_currency_value(commission, $data_system.currency_unit, self.ox+100, y, 120) y += line_height end self.contents.fill_rect(0, self.oy+y+4, self.contents.width, 2, Color.new(255, 255, 255, 128)) y += 10 change_color(normal_color) Quest.draw_quest_text(self.contents, self.ox+4, self.oy+y, Graphics.width-224, line_height, @data.page_text(@page)) if @data.page_num > 1 txt = "( " + (@page+1).to_s + " / " + @data.page_num.to_s + " )" draw_text(self.ox+180, self.oy+364-self.y, 160, line_height, txt, 2) end end #-------------------------------------------------------------------------- # ● リフレッシュ(報酬) #-------------------------------------------------------------------------- def refresh_result y = line_height premium = @data.premium if premium > 0 change_color(system_color) draw_text(self.ox+20, y, 120, line_height, "報酬金額") draw_currency_value(premium, $data_system.currency_unit, self.ox+100, y, 120) y += line_height end commission = @data.commission if commission > 0 change_color(system_color) draw_text(self.ox+20, y, 120, line_height, "手数料") draw_currency_value(commission, $data_system.currency_unit, self.ox+100, y, 120) y += line_height end penalty = @data.penalty if penalty > 0 change_color(system_color) draw_text(self.ox+20, y, 120, line_height, "違約金") draw_currency_value(penalty, $data_system.currency_unit, self.ox+100, y, 120) y += line_height end res_y = y y += line_height for result in @data.result next if result.penalty or !result.view case result.type when Quest::ITEM, Quest::WEAPON, Quest::ARMOR draw_item_name(result.obj, self.ox+30, y) if result.num > 1 x = 30 + 32 + self.contents.text_size(result.obj.name).width + 30 draw_text(self.ox+x, y, 40, line_height, "×") draw_text(self.ox+x+10, y, 40, line_height, result.num.to_s, 2) end when Quest::SKILL text = "\\s[#{result.id}]習得" draw_text(self.ox+30, y, 400, line_height, Quest.conv_text(text)) when Quest::CLASS text = "\\j[#{result.id}]にクラスチェンジ" draw_text(self.ox+30, y, 400, line_height, Quest.conv_text(text)) when Quest::LEVEL text = "#{result.num}レベルアップ" draw_text(self.ox+30, y, 400, line_height, Quest.conv_text(text)) when Quest::ACTOR text = "#{result.obj.name}加入" draw_text(self.ox+30, y, 400, line_height, Quest.conv_text(text)) else; next # 上記以外は表示なし end y += line_height end if (res_y + line_height) < y change_color(system_color) draw_text(self.ox+20, res_y, 120, line_height, "報酬") change_color(normal_color) end end #-------------------------------------------------------------------------- # ● リフレッシュ(進捗状態) #-------------------------------------------------------------------------- def refresh_cond change_color(system_color) draw_text(self.ox+20, line_height, 120, line_height, "進捗状況") change_color(normal_color) y = line_height * 2 for i in 0...@data.condition.size case @data.condition[i].type when Quest::ITEM, Quest::WEAPON, Quest::ARMOR draw_item_name(@data.condition[i].obj, self.ox+30, y) draw_condition_num(i, y) when Quest::MONEY txt = "#{@data.condition[i].obj_name}(" + @data.condition[i].num.to_s draw_text(self.ox+30, y, 240, line_height, txt) x = 30 + self.contents.text_size(txt).width + 4 change_color(system_color) draw_text(self.ox+x, y, 80, line_height, $data_system.currency_unit) change_color(normal_color) x += self.contents.text_size($data_system.currency_unit).width + 4 draw_text(self.ox+x, y, 40, line_height, ")") draw_condition(i, y) when Quest::SW, Quest::EV, Quest::QUEST_T, Quest::QUEST_F, Quest::CLASS, Quest::SCRIPT draw_text(self.ox+30, y, 240, line_height, @data.condition[i].obj_name) draw_condition(i, y) when Quest::VAL draw_text(self.ox+30, y, 240, line_height, @data.condition[i].obj_name) draw_condition_num(i, y) when Quest::LEVEL draw_text(self.ox+30, y, 240, line_height, @data.condition[i].obj_name) #x = 30 + self.contents.text_size(@data.condition[i].obj.name).width + 4 #draw_actor_level(@data.condition[i].obj, self.ox+x, y) draw_condition_num(i, y) when Quest::ENEMY draw_text(self.ox+30, y, 240, line_height, @data.condition[i].obj_name) draw_condition_num(i, y) when Quest::ACTOR draw_actor_name(@data.condition[i].obj, self.ox+30, y) draw_condition(i, y) when Quest::SKILL draw_item_name(@data.condition[i].obj, self.ox+30, y) draw_condition(i, y) else; next # 上記以外は記載しない end # y += line_height end end #-------------------------------------------------------------------------- # ● 進捗状態の表示 #-------------------------------------------------------------------------- def draw_condition_num(i, y) if @data.condition[i].condition_clear?(@data.report) draw_condition_clear(y) else change_color(normal_color) txt = @data.condition[i].obj_num.to_s + " / " + @data.condition[i].num.to_s draw_text(self.ox+240, y, 100, line_height, txt) end end def draw_condition(i, y) if @data.condition[i].condition_clear?(@data.report) draw_condition_clear(y) end end def draw_condition_clear(y) self.contents.font.color = crisis_color draw_text(self.ox+240, y, 80, line_height, "OK") change_color(normal_color) end end class Window_QuestRank < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(gold=false) h = gold ? (Quest::SHOW_RANK ? fitting_height(2) : fitting_height(1)) : fitting_height(1) y = Graphics.height - h super(0, y, 180, h) @gold = gold refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear y = 0 if Quest::SHOW_RANK change_color(system_color) draw_text(4, 0, 120, line_height, "Quest Rank") change_color(Quest::RANK_CLR[$game_party.quest_rank]) draw_text(128, 0, 80, line_height, Quest::RANK[$game_party.quest_rank]) y += line_height end if @gold draw_currency_value($game_party.gold, $data_system.currency_unit, 4, y, contents.width - 8) end end end class Window_QuestResult < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize w = Graphics.width - 220 super(110, 200, w, fitting_height(2)) self.z = 500 hide end #-------------------------------------------------------------------------- # ● 結果表示 #-------------------------------------------------------------------------- def refresh(data) return if data.nil? show activate self.pause = true item_num = 0 premium = data.premium penalty = data.penalty diff_rank = ($game_party.quest_rank != $game_temp.questresult_old_rank) rank_h = ((Quest::SHOW_RANK and diff_rank) ? line_height : 0) # 解析 if data.clear for result in data.result next if result.penalty or !result.view case result.type when Quest::ITEM, Quest::WEAPON, Quest::ARMOR, Quest::SKILL, Quest::QUEST_T, Quest::QUEST_F, Quest::CLASS, Quest::LEVEL item_num += 1 end end prem_h = (premium > 0 ? line_height : 0) item_h = item_num > 0 ? fitting_height(item_num) : 0 self.height = line_height + 32 + rank_h + prem_h + item_h self.y = 180 - (item_h / 2) txt = "CLEAR!" else penl_h = (penalty > 0 ? line_height : 0) self.y = 180 self.height = fitting_height(1) + rank_h + penl_h txt = "FAIL!" end # Bitmap再生成 create_contents # クエスト名と結果 change_color(normal_color) draw_text(0, 0, 240, line_height, Quest.conv_text(data.name)) change_color(data.clear ? crisis_color : knockout_color) draw_text(220, 0, 240, line_height, txt) y = line_height # ランク変動 if Quest::SHOW_RANK and diff_rank change_color(system_color) draw_text(20, y, 100, line_height, "Rank") change_color(Quest::RANK_CLR[$game_temp.questresult_old_rank]) rank_txt = Quest::RANK[$game_temp.questresult_old_rank] draw_text(80, y, 80, line_height, rank_txt) x = self.contents.text_size(rank_txt).width + 4 change_color(normal_color) draw_text(80+x, y, 80, line_height, "→") x += self.contents.text_size("→").width + 4 change_color(Quest::RANK_CLR[$game_party.quest_rank]) draw_text(80+x+4, y, 80, line_height, Quest::RANK[$game_party.quest_rank]) y += line_height end if data.clear # 報酬金 if premium > 0 change_color(system_color) draw_text(20, y, 120, line_height, "報酬金額") xx = 120 + self.contents.text_size(premium.to_s).width + 4 draw_text(xx, y, 120, line_height, $data_system.currency_unit) change_color(normal_color) draw_text(120, y, 120, line_height, premium.to_s) y += line_height end # 報酬 if item_num > 0 change_color(system_color) draw_text(20, y, 120, line_height, "報酬") change_color(normal_color) y += line_height for result in data.result next unless result.view next if result.penalty case result.type when Quest::ITEM, Quest::WEAPON, Quest::ARMOR draw_item_name(result.obj, 30, y) if result.num > 1 x = 30 + 32 + self.contents.text_size(result.obj.name).width + 30 draw_text(x, y, 40, line_height, "×") draw_text(x+10, y, 40, line_height, result.num.to_s, 2) end when Quest::SKILL text = "\\s[#{result.id}]習得" draw_text(30, y, 330, line_height, Quest.conv_text(text)) when Quest::QUEST_T text = "『\\q[#{result.id}]』追加" draw_text(30, y, 330, line_height, Quest.conv_text(text)) when Quest::QUEST_F text = "『\\q[#{result.id}]』終了" draw_text(30, y, 330, line_height, Quest.conv_text(text)) when Quest::QUEST_S text = "『\\q[#{result.id}]』開始" draw_text(30, y, 330, line_height, Quest.conv_text(text)) when Quest::CLASS text = "\\j[#{result.id}]にクラスチェンジ" draw_text(30, y, 330, line_height, Quest.conv_text(text)) when Quest::LEVEL text = "#{result.num}レベルアップ" draw_text(30, y, 400, line_height, Quest.conv_text(text)) when Quest::ACTOR text = "#{result.obj.name}加入" draw_text(self.ox+30, y, 400, line_height, Quest.conv_text(text)) else; next end y += line_height end end else if penalty > 0 change_color(system_color) draw_text(20, y, 120, line_height, "違約金") xx = 120 + self.contents.text_size(penalty.to_s).width + 4 draw_text(xx, y, 120, line_height, $data_system.currency_unit) change_color(normal_color) draw_text(120, y, 120, line_height, penalty.to_s) end end end end