#============================================================================== # ■ VXAce-RGSS3-4-gld クエストシステム【ギルド】 by Claimh #------------------------------------------------------------------------------ #【イベントスクリプト操作】 #◆ギルドの呼び出し # call_guild(ギルドID) # ・普通のギルド # ギルドIDは0にするか、省略してください。 # ・特定ギルドでのみ受け付けるクエストがあるギルド # ギルドIDに適切な値を設定してください。 # 普通のギルド用のクエストに加えて、 # StGuildクラスで特定ギルドに指定されたクエストが受付られます。 #============================================================================== class Scene_Guild < Scene_MenuBase #-------------------------------------------------------------------------- # ● 準備 #-------------------------------------------------------------------------- def prepare(id=0) @id = id end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_cation_window create_cmd_window create_list_window create_info_window create_rank_window create_select_window create_result_window setup_windows end #-------------------------------------------------------------------------- # ● コマンドウィンドウ生成 #-------------------------------------------------------------------------- def create_cmd_window @cmd = Window_GuildCmd.new @cmd.set_handler(:ok, method(:cmd_ok)) @cmd.set_handler(:cancel, method(:return_scene)) end #-------------------------------------------------------------------------- # ● リストウィンドウ生成 #-------------------------------------------------------------------------- def create_list_window @list = Window_QuestList.new(-1, @id) @list.set_handler(:ok, method(:list_ok)) @list.set_handler(:cancel, method(:list_cancel)) @list.set_handler(:cation, method(:list_cation)) end #-------------------------------------------------------------------------- # ● Infoウィンドウ生成 #-------------------------------------------------------------------------- def create_info_window @info = Window_QuestInfo.new end #---------------------------------------------------------------------------- # ● ランクウィンドウ生成 #---------------------------------------------------------------------------- def create_rank_window @rank = Window_QuestRank.new(true) end #---------------------------------------------------------------------------- # ● 選択ウィンドウ生成 #---------------------------------------------------------------------------- def create_select_window @select = Window_GuildSelect.new @select.set_handler(:ok, method(:select_ok)) @select.set_handler(:cancel, method(:select_cancel)) end #---------------------------------------------------------------------------- # ● 警告ウィンドウ生成 #---------------------------------------------------------------------------- def create_cation_window @cation = Window_GuildCation.new @cation.set_handler(:ok, method(:cation_cancel)) @cation.set_handler(:cancel, method(:cation_cancel)) end #---------------------------------------------------------------------------- # ● 結果ウィンドウ生成 #---------------------------------------------------------------------------- def create_result_window @result = Window_QuestResult.new @result.set_handler(:ok, method(:result_cancel)) @result.set_handler(:cancel, method(:result_cancel)) end #---------------------------------------------------------------------------- # ● セットアップ #---------------------------------------------------------------------------- def setup_windows @list.help_window = @info @cmd.help_window = @list @cmd.activate if Quest::GUILD_LIST.size <= 1 @cmd.hide @cmd.deactivate @list.activate end end #---------------------------------------------------------------------------- # ● 種別選択 #---------------------------------------------------------------------------- def cmd_ok case Quest::GUILD_LIST[@cmd.index] when Quest::REPORT, Quest::SHOP; @list.activate when Quest::EXIT; return_scene end end #---------------------------------------------------------------------------- # ● リスト選択キャンセル #---------------------------------------------------------------------------- def list_cancel @cmd.activate return_scene if Quest::GUILD_LIST.size <= 1 end #---------------------------------------------------------------------------- # ● 選択不可警告 #---------------------------------------------------------------------------- def list_cation @list.deactivate if Quest::GUILD_LIST[@cmd.index] == Quest::SHOP and $game_system.quest.over_playing? @cation.set_text("進行中のクエスト数が\\n制限数を超過しています") else @cation.set_text(@list.cause) cation_cancel unless @cation.active end end #---------------------------------------------------------------------------- # ● リスト選択 #---------------------------------------------------------------------------- def list_ok @select.select_start(Quest::GUILD_LIST[@cmd.index]) end #---------------------------------------------------------------------------- # ● 警告キャンセル #---------------------------------------------------------------------------- def cation_cancel @cation.hide @list.activate end #---------------------------------------------------------------------------- # ● Y/N選択キャンセル #---------------------------------------------------------------------------- def select_cancel @list.activate @select.hide end #---------------------------------------------------------------------------- # ● Y/N選択 #---------------------------------------------------------------------------- def select_ok case @select.index when 0 case Quest::GUILD_LIST[@cmd.index] when Quest::REPORT; quest_report when Quest::SHOP; quest_start else; p "異常: Scene_Guild.update_select#{Quest::GUILD_LIST[@cmd.index]}" end else @list.activate end @select.hide end #---------------------------------------------------------------------------- # ● フレーム更新 #---------------------------------------------------------------------------- def result_cancel @result.hide @list.data_refresh(Quest::REPORT, true, @list.index) @list.activate end #---------------------------------------------------------------------------- # ● クエストの受付 #---------------------------------------------------------------------------- def quest_start if @list.current_item.commission > 0 # 手数料ある場合はShop-SE Sound.play_shop else Sound.play_ok end @list.quest_start @rank.refresh @list.activate end #---------------------------------------------------------------------------- # ● クエストの報告 #---------------------------------------------------------------------------- def quest_report if @list.quest_clear?(@list.index) @list.quest_clear refresh_result elsif @list.quest_fail?(@list.index) @list.quest_fail refresh_result else Sound.play_buzzer @cation.set_text(@list.cause) end end def refresh_result @result.refresh(@list.current_item) @result.show @result.activate @rank.refresh end end class Window_GuildCmd < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @commands = Quest.guild_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::GUILD_LIST[@index]) @help_window.update_help end end class Window_GuildCation < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(200, 200, Graphics.width-200-32, fitting_height(2)) self.z = 500 hide self.pause = true end #-------------------------------------------------------------------------- # ● テキスト表示 #-------------------------------------------------------------------------- def set_text(text) return if text == "" self.contents.clear Quest.draw_quest_text(self.contents, 0, 0, contents_width, line_height, text) show activate end end class Window_GuildSelect < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(200, 200, Graphics.width-200-32, fitting_height(2)) self.z = 500 hide end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 2 end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max return 2 end #-------------------------------------------------------------------------- # ● クエストを受ける #-------------------------------------------------------------------------- def select_start(type) case type when Quest::REPORT; text = "このクエストを報告しますか?" when Quest::SHOP; text = "このクエストを受けますか?" else; return end self.index = 1 self.contents.clear draw_text(0, 0, contents_width, line_height, text) draw_text(item_rect_for_text(0), "はい", 1) draw_text(item_rect_for_text(1), "いいえ", 1) activate.show end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new rect.width = item_width rect.height = item_height rect.x = index % col_max * (item_width + spacing) rect.y = index / col_max * item_height + item_height rect end end