Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # DSI Dungeon Infomation
- # -- Last Updated: 2017.03.11
- # -- Author: dsiver144
- # -- Level: Normal
- # -- Requires: DSI-Bitmap
- # -- Commission for: MHRob
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["DSI-DungeonInfo"] = true
- #==============================================================================
- # + Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2017.02.28 - Finish first version.
- # 2017.03.11 - Add an option to hide hard mode
- #==============================================================================
- # + Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ?? Materials/?f?? but above ?? Main. Remember to save.
- # Remember to put this script below: DSI-Bitmap.
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # Script Call:
- # show_dungeon_scene(id) # Open Scene with specific dungeon ID (See below)
- #==============================================================================
- module DSIVER144
- module DUNGEON_INFO
- COMMANDS = {} # Don't remove this line!
- COMMANDS[1] = ["Enter Dungeon (Normal)", 1606] # [Name, Icon_index]
- COMMANDS[2] = ["Enter Dungeon (Hard)", 1699] # [Name, Icon_index]
- COMMANDS[3] = ["Exit", 137] # [Name, Icon_index]
- SWITCH_PAGE_TEXT = "\\i[1609]:Switch Page"
- OTHER_BUTTONS_TEXT = "\\i[1600]:Choose - \\i[1602]:Cancel"
- OTHER_BUTTONS_MARGIN = 170
- SWITCH_PAGE_SE = ["Confirm2 (Final Fantasy 7).wav", 100, 100]
- SCENE_BACKGROUND = "StarlitSky" # Located in Parallax Folder. Set to false if don't want to use it.
- TEXTS = {} # Don't remove this line!
- TEXTS[:description_header] = "\\c[5]Dungeon Description: \\c[0]"
- TEXTS[:general_info_header] = "\\c[5]General Infomation: \\c[0]"
- DUNGEONS = {} # Don't remove this line!
- #-------------------------------------------------------------------------
- # -> DUNGEONS[dungeon_id] <-
- #-------------------------------------------------------------------------
- DUNGEONS[1] = {} # Don't remove this line!
- DUNGEONS[1][:name] = ["Ice Caves", 3] # [Name , Color Code]
- DUNGEONS[1][:normal_cme] = 25 # Normal Dungeon Common Event
- # Delete below line then there is no hard mode for this dungeon!
- DUNGEONS[1][:hard_cme] = 26 # Hard Dungeon Common Event
- DUNGEONS[1][:require_item] = [15,5] # [Item_ID, Number]
- DUNGEONS[1][:picture] = "BlueSky" # Located in Parallaxes Folder (226x200). It will automatically resize to 226x200.
- DUNGEONS[1][:description] = "There are a series of Man made Ice Caves that were made long ago in the hopes of finding a path to the
- legendary Ice Palace. Though, Deep within the Ice Caves lie the ancient Ice Caverns, said to lead to the Ice Palace of the forgotten Snow Queen."
- DUNGEONS[1][:description_font] = [16,20] # [Font size, Line Height]
- DUNGEONS[1][:gerenal_info] = {} # Don't remove this line!
- DUNGEONS[1][:gerenal_info][:tools] = [13,14,15,16,17,18] # Item ID of Tools
- DUNGEONS[1][:gerenal_info][:font] = [15,18] # [Font size, Line Height]
- DUNGEONS[1][:gerenal_info][:texts] = [ # Don't remove this line!
- ["\\c[5]Expected Monster\\c[0]:", "Ice Slime, Ice Hell Flower, ect"],
- ["\\c[6]Common Element Found\\c[0]:", "Ice Mage Cards"],
- ["\\c[7]Recommended Cards\\c[0]:", "Fire Mage Cards"],
- ["\\c[21]Number of Areas\\c[0]:", "6+"],
- ["\\c[9]Available Altars\\c[0]:", "Ice"],
- ["\\c[10]Save Point\\c[0]:", "Yes"],
- ["\\c[11]Teleportation Allowed\\c[0]:", "Yes"],
- ["\\c[12]Special Monster Encounters\\c[0]:", "Yes"],
- ["\\c[13]Quest Available\\c[0]:", "Yes"],
- ] # Don't remove this line!
- DUNGEONS[2] = {} # Don't remove this line!
- DUNGEONS[2][:name] = ["Earth", 3] # [Name , Color Code]
- DUNGEONS[2][:normal_cme] = 25 # Normal Dungeon Common Event
- DUNGEONS[2][:hard_cme] = 26 # Hard Dungeon Common Event
- DUNGEONS[2][:require_item] = [15,10] # [Item_ID, Number]
- DUNGEONS[2][:picture] = "Dungeon1" # Located in Parallaxes Folder (226x200). It will automatically resize to 226x200.
- DUNGEONS[2][:description] = "Something"
- DUNGEONS[2][:description_font] = [16,20] # [Font size, Line Height]
- DUNGEONS[2][:gerenal_info] = {} # Don't remove this line!
- DUNGEONS[2][:gerenal_info][:tools] = [14,15,16,17,18,19,20] # Item ID of Tools
- DUNGEONS[2][:gerenal_info][:font] = [15,18] # [Font size, Line Height]
- DUNGEONS[2][:gerenal_info][:texts] = [ # Don't remove this line!
- ["\\c[5]Expected Monster\\c[0]:", "Ice Slime, Ice Hell Flower, ect"],
- ["\\c[6]Common Element Found\\c[0]:", "Ice Mage Cards"],
- ["\\c[7]Recommended Cards\\c[0]:", "Fire Mage Cards"],
- ["\\c[21]Number of Areas\\c[0]:", "6+"],
- ["\\c[9]Available Altars\\c[0]:", "Ice"],
- ["\\c[10]Save Point\\c[0]:", "Yes"],
- ["\\c[11]Teleportation Allowed\\c[0]:", "Yes"],
- ["\\c[12]Special Monster Encounters\\c[0]:", "Yes"],
- ["\\c[13]Quest Available\\c[0]:", "Yes"],
- ] # Don't remove this line!
- #-------------------------------------------------------------------------
- end # DUNGEON_INFO
- end # DSIVER144
- class Game_Interpreter
- #-------------------------------------------------------------------------
- # * new method: show_dungeon_scene
- #-------------------------------------------------------------------------
- def show_dungeon_scene(id)
- SceneManager.call(Scene_DungeonInfo)
- SceneManager.scene.prepare(id)
- end
- end # Game_Interpreter
- class Scene_DungeonInfo < Scene_Base
- include DSIVER144::DUNGEON_INFO
- #-------------------------------------------------------------------------
- # * new method: prepare
- #-------------------------------------------------------------------------
- def prepare(id)
- @dungeon_id = id
- end
- #-------------------------------------------------------------------------
- # * new method: start
- #-------------------------------------------------------------------------
- def start
- super
- @dungeon_id ||= 1
- create_background_image
- create_main_windows
- end
- #-------------------------------------------------------------------------
- # * new method: create_background_image
- #-------------------------------------------------------------------------
- def create_background_image
- @background_image = Sprite.new
- if SCENE_BACKGROUND != false
- begin
- @background_image.bitmap = Cache.parallax(SCENE_BACKGROUND)
- rescue
- @background_image.bitmap = SceneManager.background_bitmap
- @background_image.color.set(16, 16, 16, 128)
- end
- else
- @background_image.bitmap = SceneManager.background_bitmap
- @background_image.color.set(16, 16, 16, 128)
- end
- end
- #-------------------------------------------------------------------------
- # * new method: create_main_windows
- #-------------------------------------------------------------------------
- def create_main_windows
- @title_window = Window_Base.new(0,0,Graphics.width,48)
- @title_window.change_color(@title_window.text_color(DUNGEONS[@dungeon_id][:name][1]))
- @title_window.draw_text(0,0,@title_window.contents_width,@title_window.contents_height,DUNGEONS[@dungeon_id][:name][0],1)
- @help_window = Window_DungeonInfoHelp.new
- @command_window = Window_DungeonCommand.new(0,0,@dungeon_id)
- @command_window.y = @help_window.y - @command_window.height
- @command_window.set_handler(:normal, method(:process_normal))
- @command_window.set_handler(:hard, method(:process_hard))
- @command_window.set_handler(:cancel, method(:return_scene))
- wh = Graphics.height - @command_window.height - @title_window.height - @title_window.height
- @picture_window = Window_DungeonPicture.new(0,0,@command_window.width,wh) # 226 200
- @picture_window.y = @help_window.height
- wx = @picture_window.width
- wy = @picture_window.y
- ww = Graphics.width - @picture_window.width
- wh = @picture_window.height + @command_window.height
- @description_window = Window_DungeonDescription.new(wx,wy,ww,wh)
- @picture_window.draw_picture(@dungeon_id)
- @description_window.draw_description(@dungeon_id)
- @info_window = Window_DungeonInfo.new(wx,wy,ww,wh)
- @info_window.x = Graphics.width
- @info_window.draw_general_info(@dungeon_id)
- @page = 1
- end
- #-------------------------------------------------------------------------
- # * new method: process_normal
- #-------------------------------------------------------------------------
- def process_normal
- $game_temp.reserve_common_event(DUNGEONS[@dungeon_id][:normal_cme])
- SceneManager.goto(Scene_Map)
- end
- #-------------------------------------------------------------------------
- # * new method: process_hard
- #-------------------------------------------------------------------------
- def process_hard
- item = $data_items[DUNGEONS[@dungeon_id][:require_item][0]]
- num = DUNGEONS[@dungeon_id][:require_item][1]
- $game_party.lose_item(item, num)
- $game_temp.reserve_common_event(DUNGEONS[@dungeon_id][:hard_cme])
- SceneManager.goto(Scene_Map)
- end
- #-------------------------------------------------------------------------
- # * new method: easeInOutQuad
- #-------------------------------------------------------------------------
- def easeInOutQuad(t, b, c, d)
- t = t / (d/2.0)
- if (t < 1)
- return c/2*t*t + b
- end
- t -= 1
- return -c/2.0 * (t*(t-2) - 1) + b
- end
- #-------------------------------------------------------------------------
- # * new method: update_swith_page
- #-------------------------------------------------------------------------
- def update_swith_page
- RPG::SE.new(*SWITCH_PAGE_SE).play
- if @page == 1
- start_x = Graphics.width - @description_window.width
- des_x = Graphics.width - start_x
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- @description_window.x = easeInOutQuad(current_time, start_x, des_x, 45)
- Graphics.update
- @command_window.update
- end
- start_x = Graphics.width
- des_x = - @description_window.width
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- @info_window.x = easeInOutQuad(current_time, start_x, des_x, 45)
- Graphics.update
- @command_window.update
- end
- @page = 2
- else
- start_x = Graphics.width - @description_window.width
- des_x = Graphics.width - start_x
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- @info_window.x = easeInOutQuad(current_time, start_x, des_x, 45)
- Graphics.update
- @command_window.update
- end
- start_x = Graphics.width
- des_x = - @description_window.width
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- @description_window.x = easeInOutQuad(current_time, start_x, des_x, 45)
- Graphics.update
- @command_window.update
- end
- @page = 1
- end
- end
- #-------------------------------------------------------------------------
- # * new method: update
- #-------------------------------------------------------------------------
- def update
- super
- if Input.trigger?(:X)
- update_swith_page
- end
- end
- #-------------------------------------------------------------------------
- # * new method: terminate
- #-------------------------------------------------------------------------
- def terminate
- super
- @background_image.bitmap.dispose
- @background_image.dispose
- end
- end # Scene_DungeonInfo
- class Window_DungeonInfoHelp < Window_Base
- include DSIVER144::DUNGEON_INFO
- #-------------------------------------------------------------------------
- # * method: draw_info
- #-------------------------------------------------------------------------
- def initialize
- super(0,Graphics.height-48,Graphics.width,48)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Draw Text with Control Characters
- #--------------------------------------------------------------------------
- def draw_text_ex(x, y, text)
- text = convert_escape_characters(text)
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- #-------------------------------------------------------------------------
- # * new method: refresh
- #-------------------------------------------------------------------------
- def refresh(enable_altar=false)
- contents.clear
- change_color(normal_color,true)
- draw_text_ex(0,0,SWITCH_PAGE_TEXT)
- draw_text_ex(contents_width - OTHER_BUTTONS_MARGIN,0,OTHER_BUTTONS_TEXT)
- end
- end # Window_CursedHelp
- class Window_DungeonPicture < Window_Base
- include DSIVER144::DUNGEON_INFO
- #-------------------------------------------------------------------------
- # * new method: terminate
- #-------------------------------------------------------------------------
- def draw_picture(dungeon_id)
- contents.clear
- file_name = DUNGEONS[dungeon_id][:picture]
- pic_bitmap = Cache.parallax(file_name)
- des_rect = Rect.new(0,0,contents_width,contents_height)
- contents.stretch_blt(des_rect,pic_bitmap,pic_bitmap.rect)
- end
- end # Window_DungeonPicture
- class Window_DungeonDescription < Window_Base
- include DSIVER144::DUNGEON_INFO
- #-------------------------------------------------------------------------
- # * new method: terminate
- #-------------------------------------------------------------------------
- def draw_description(dungeon_id)
- contents.clear
- desc_text = TEXTS[:description_header]
- desc = DUNGEONS[dungeon_id][:description]
- x = 0; y = 0;
- contents.draw_text_ex(x,y,desc_text,false,17)
- y += 20
- contents.fill_rect(x,y,contents_width,1,Color.new(64,64,255))
- y += 5
- contents.turn_on_wordwraping
- contents.font.size = DUNGEONS[dungeon_id][:description_font][0]
- contents.draw_text_ex(x,y,desc,false,DUNGEONS[dungeon_id][:description_font][1])
- end
- end # Window_DungeonDescription
- class Window_DungeonInfo < Window_Base
- include DSIVER144::DUNGEON_INFO
- #-------------------------------------------------------------------------
- # * new method: terminate
- #-------------------------------------------------------------------------
- def draw_general_info(dungeon_id)
- contents.clear
- contents.turn_on_wordwraping
- desc_text = TEXTS[:general_info_header]
- general_info = DUNGEONS[dungeon_id][:gerenal_info]
- x = 0; y = 0;
- contents.draw_text_ex(x,y,desc_text,false,17)
- y += 20
- contents.fill_rect(x,y,contents_width,1,Color.new(64,64,255))
- y += 5
- if general_info[:tools]
- contents.draw_text_ex(x,y,"\\c[20]Tools for Full Exploration\\c[0]: ",false,17)
- y += 24
- start_x = 0.5*(contents_width - general_info[:tools].size * 35)
- x = start_x
- general_info[:tools].each_with_index do |id,index|
- draw_icon($data_weapons[id].icon_index, x, y)
- x += 35;
- end
- end
- y += 32
- x = 0
- contents.font.size = general_info[:font][0]
- if general_info[:texts]
- st = ""
- general_info[:texts].each do |line|
- st += line[0] + " " + line[1] + "\n"
- end
- contents.draw_text_ex(x,y,st,false,general_info[:font][1])
- end
- end
- end # Window_DungeonInfo
- class Window_DungeonCommand < Window_Command
- include DSIVER144::DUNGEON_INFO
- #--------------------------------------------------------------------------
- # * new method: initialize
- #--------------------------------------------------------------------------
- def initialize(x,y,dungeon_id)
- @dungeon_id = dungeon_id
- super(x,y)
- end
- #--------------------------------------------------------------------------
- # * new method: window_width
- #--------------------------------------------------------------------------
- def window_width
- return 250
- end
- #--------------------------------------------------------------------------
- # * new method: add_command
- #--------------------------------------------------------------------------
- def add_command(name, symbol, icon_index = nil, enabled = true, ext = nil)
- @list.push({:name=>name, :symbol=>symbol, :icon_index=>icon_index, :enabled=>enabled, :ext=>ext})
- end
- #--------------------------------------------------------------------------
- # * new method: add_command
- #--------------------------------------------------------------------------
- def command_name(index)
- @list[index][:name]
- end
- #--------------------------------------------------------------------------
- # * new method: draw_item
- #--------------------------------------------------------------------------
- def draw_item(index)
- change_color(normal_color, command_enabled?(index))
- rect = item_rect_for_text(index)
- if command_icon(index)
- draw_icon(command_icon(index),rect.x, rect.y)
- rect.x += 26
- end
- draw_text(rect, command_name(index), 0)
- end
- #--------------------------------------------------------------------------
- # * new method: command_icon
- #--------------------------------------------------------------------------
- def command_icon(index)
- @list[index][:icon_index]
- end
- #--------------------------------------------------------------------------
- # * Get Window Height
- #--------------------------------------------------------------------------
- def window_height
- fitting_height(3)
- end
- #--------------------------------------------------------------------------
- # * new method: make_command_list
- #--------------------------------------------------------------------------
- def make_command_list
- key = [:normal,:hard,:cancel]
- hide_stt = DUNGEONS[@dungeon_id].has_key?(:hard_cme)
- if DUNGEONS[@dungeon_id].has_key?(:require_item)
- item = $data_items[DUNGEONS[@dungeon_id][:require_item][0]]
- hard_stt = $game_party.item_number(item) >= DUNGEONS[@dungeon_id][:require_item][1]
- else
- hard_stt = false
- end
- COMMANDS.values.each_with_index do |command,index|
- if key[index] != :hard
- add_command(command[0],key[index],command[1])
- elsif hide_stt
- add_command(command[0],key[index],command[1],hard_stt)
- end # end if
- end # end loop
- end # end make_command_list
- end # Window_DungeonCommand
- class Bitmap
- attr_accessor :last_line_height
- #--------------------------------------------------------------------------
- # * New Line Character Processing
- #--------------------------------------------------------------------------
- def process_new_line(text, pos)
- pos[:x] = pos[:new_x]
- pos[:y] += pos[:height]
- if @last_line_height
- pos[:height] = calc_line_height(text,true,@last_line_height)
- else
- pos[:height] = calc_line_height(text)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Text with Control Characters
- #--------------------------------------------------------------------------
- def draw_text_ex(x, y, text,reset_font=true,custom_size=false)
- reset_font_settings if reset_font == true
- #self.font.size -= 3
- text = convert_escape_characters(text)
- if !custom_size
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
- else
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text, true, custom_size)}
- end
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- #--------------------------------------------------------------------------
- # * Calculate Line Height
- # restore_font_size : Return to original font size after calculating
- #--------------------------------------------------------------------------
- def calc_line_height(text, restore_font_size = true, custom_size=false)
- if custom_size
- @last_line_height = custom_size
- return custom_size
- end
- result = [line_height, self.font.size].max
- last_font_size = self.font.size
- text.slice(/^.*$/).scan(/\e[\{\}]/).each do |esc|
- make_font_bigger if esc == "\e{"
- make_font_smaller if esc == "\e}"
- result = [result, self.font.size].max
- end
- self.font.size = last_font_size if restore_font_size
- result
- end
- end
- #===============================================================================
- # * END OF FILE
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement