Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #--------# Fantasy CMS #--------------------------------------------
- #--------# version 2.01 #--------------------------------------------
- #--------# by Thieffer and Dante #--------------------------------------------
- #--------# 29.12.2010 #--------------------------------------------
- #--------# thieffer.zamthir.net #--------------------------------------------
- #===============================================================================
- #===============================================================================
- #--------# INFO #--------------------------------------------
- #===============================================================================
- # Wklej skrypt nad Main.
- # Do prawidłowego działania potrzebna jest czcionka używana przez skrypt (standardowo Galileo Font)
- # Podziękowania dla www.ragnarokonline.com za ikony.
- #===============================================================================
- #===============================================================================
- #--------# CHANGELOG #--------------------------------------------
- #===============================================================================
- # ** version 1.0 (09.07.2010)
- # - publikacja skryptu
- # ** version 1.1 (14.07.2010)
- # - dodana możliwość włączenia komendy 'Bestiariusz' w komendach menu,
- # - dodana możliwość zmiany grafiki windowskina CMSa w CONFIGu,
- # - naprawiony błąd z wjeżdżaniem okienek,
- # - naprawiony błąd z przezroczystością okna komend
- # ** version 2.0 (21.09.2010)
- # - wszystkie submenusy w stylu Fantasy (Scene_Item, Scene_Equip,
- # Scene_Skill, Scene_Status, Scene_Save, Scene_Load, Scene_End)
- # - usunięta możliwość włączenia komendy 'Bestiariusz' w komendach menu,
- # - naprawiony błąd z wyświetlaniem koloru tekstu HP w menu głównym,
- # - dodana możliwość ustawienia krótkich opisów bohaterów w Scene_Status
- # ** version 2.1 (29.12.2010)
- # - naprawiony bug w Scene_Equip
- #===============================================================================
- #===============================================================================
- #--------# CONFIG #--------------------------------------------
- #===============================================================================
- module Fantasy_CMS
- # Nazwa czcionki
- FONT_NAME = "Galileo Font"
- # Kolor czcionki komend i imion bohaterów
- FONT_COLOR = Color.new(230, 230, 150, 255)
- # Kolor czcionki podrzędnej
- FONT_COLOR2 = Color.new(255, 255, 255, 255)
- # Kolor czcionki niedostępnej opcji ("disabled")
- FONT_COLOR_DISABLED = Color.new(255, 255, 255, 130)
- # Kolor czcionki Positive (zielona)
- FONT_COLOR_POSITIVE = Color.new(130, 255, 0, 255)
- # Kolor czcionki Negative (czerwona)
- FONT_COLOR_NEGATIVE = Color.new(220, 0, 30, 255)
- # Rozmiar czcionki podrzędnej
- FONT_SIZE2 = 18
- # Nieprzezroczystość okienek (0-255)
- OPACITY = 200
- # Nieprzezroczystość obrazka tła (0-255)
- BACKGROUND_OPACITY = 150
- # Grafika windowskina
- WINDOWSKIN_GRAPHIC = "fantasy_windowskin"
- ACTOR_DESCRIPTION = {
- # *** OPISY BOHATERÓW ***
- # Schemat tworzenia opisów:
- # ID_Bohatera => [1 linijka opisu, 2 linijka opisu, 3 linijka opisu, 4 linijka_opisu, 5 linijka_opisu]
- # Każdy z takich elementów musi być odzielony przecinkiem.
- # W opisie bohatera możesz użyć od 1 do 5 linjek tekstu.
- # Jeśli nie stworzysz opisu bohatera, okienko z opisem (w statusie) nie zostanie wyświetlone.
- 1 => ["1 linijka opisu", "2 linijka opisu", "3 linijka opisu", "4 linijka opisu", "5 linijka opisu"],
- 2 => ["1 linijka opisu", "2 linijka opisu", "3 linijka opisu"],
- 7 => nil, # nil = brak opisu
- 8 => ["1 linijka opisu"]
- }
- #===============================================================================
- #===============================================================================
- # Fantasy_CMS::Window_Command
- #===============================================================================
- class Window_Command < Window_Selectable
- def initialize(width, commands, icons = false)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- @icons = icons
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- refresh
- self.index = 0
- self.opacity = Fantasy_CMS::OPACITY
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- c = Fantasy_CMS::FONT_COLOR
- draw_item(i, c)
- end
- end
- def draw_item(index, color)
- self.contents.font.color = color
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- x = @icons ? 24 : 0
- rect = Rect.new(4+x, 32 * index, self.contents.width - 8, 32)
- self.contents.blt(0,32* index+4, RPG::Cache.picture("Fantasy_CMS_icons/"+@commands[index]), Rect.new(0,0,24,24)) if @icons
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index], 0)
- end
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_MenuStatus
- #===============================================================================
- class Window_MenuStatus < Window_Selectable
- def initialize
- super(216, -169, 392, 166)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- refresh
- self.active = false
- self.index = -1
- self.opacity = Fantasy_CMS::OPACITY
- end
- def refresh
- self.contents.clear
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- @item_max = $game_party.actors.size
- @column_max = 4
- for i in 0...$game_party.actors.size
- x = i*90
- y = 0
- actor = $game_party.actors[i]
- draw_actor_graphic(actor, x+12+30, y+48+22)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR
- self.contents.draw_text(x, y+3, 90, 20, actor.name, 1)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(x, y+70, 90, 20, "Poziom: " + actor.level.to_s, 1)
- draw_actor_hp(actor,x,y+95)
- end
- end
- def draw_actor_hp(actor, x, y, width = 144)
- self.contents.draw_text(x, y, 90, 20, "Zdrowie:", 1)
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(x-10, y+10, 48, 32, actor.hp.to_s, 2)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(x + 48-10, y+10, 12, 32, "/", 1)
- self.contents.draw_text(x + 60-10, y+10, 48, 32, actor.maxhp.to_s)
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(@index*90, 0, 90 , 134)
- end
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_Location
- #===============================================================================
- class Window_Location < Window_Base
- def initialize
- super(216, 483, 224, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR
- self.contents.draw_text(35+4, 0, 150, 32, "Lokacja:", 0)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.draw_text(4, 32, 196, 32, $game_map.name, 0)
- self.contents.blt(0,0, RPG::Cache.picture("Fantasy_CMS_icons/lokacja"), Rect.new(0,0,24,24))
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_Gold
- #===============================================================================
- class Window_Gold < Window_Base
- def initialize
- super(643, 283, 152, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR
- self.contents.draw_text(28+4, 0, 150, 32, "Sakwa:", 0)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.draw_text(14, 32, 100, 32, $game_party.gold.to_s + " " +$data_system.words.gold, 0)
- self.contents.blt(0,4, RPG::Cache.picture("Fantasy_CMS_icons/sakwa"), Rect.new(0,0,24,24))
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_Target
- #===============================================================================
- class Window_Target < Window_Selectable
- def initialize
- super(640, 76, 292, 400)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.z += 10
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @item_max = $game_party.actors.size
- refresh
- end
- def refresh
- self.contents.clear
- for i in 0...$game_party.actors.size
- x = 4
- y = i * 92
- actor = $game_party.actors[i]
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x + 120, y)
- draw_actor_level(actor, x + 8, y + 30)
- draw_actor_state(actor, x + 8, y + 60)
- draw_actor_hp(actor, x + 122, y + 30)
- draw_actor_sp(actor, x + 122, y + 60)
- end
- end
- def update_cursor_rect
- # Cursor position -1 = all choices, -2 or lower = independent choice
- # (meaning the user's own choice)
- if @index <= -2
- self.cursor_rect.set(0, (@index + 10) * 92, self.width - 32, 92)
- elsif @index == -1
- self.cursor_rect.set(0, 0, self.width - 32, @item_max * 92 - 20)
- else
- self.cursor_rect.set(0, @index * 92, self.width - 32, 92)
- end
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_Help
- #===============================================================================
- class Window_Help < Window_Base
- def initialize
- super(0, 8, 640, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- end
- #--------------------------------------------------------------------------
- # * Set Text
- # text : text string displayed in window
- # align : alignment (0..flush left, 1..center, 2..flush right)
- #--------------------------------------------------------------------------
- def set_text(text, align = 0)
- if text != @text or align != @align
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
- @text = text
- @align = align
- @actor = nil
- end
- self.visible = true
- end
- def set_actor(actor)
- if actor != @actor
- self.contents.clear
- draw_actor_name(actor, 4, 0)
- draw_actor_state(actor, 140, 0)
- draw_actor_hp(actor, 284, 0)
- draw_actor_sp(actor, 460, 0)
- @actor = actor
- @text = nil
- self.visible = true
- end
- end
- def set_enemy(enemy)
- text = enemy.name
- state_text = make_battler_state_text(enemy, 112, false)
- if state_text != ""
- text += " " + state_text
- end
- set_text(text, 1)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_Item
- #===============================================================================
- class Window_Item < Window_Selectable
- def initialize
- super(156, 96, 324, 352)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @column_max = 1
- refresh
- self.index = 0
- end
- def item
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- unless $game_temp.in_battle
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data.push($data_weapons[i])
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- else
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- end
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == Fantasy_CMS::FONT_COLOR2 ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_Skill
- #===============================================================================
- class Window_Skill < Window_Selectable
- def initialize(actor)
- super(266, 96, 324, 352)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- @column_max = 1
- refresh
- self.index = 0
- end
- def skill
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 0...@actor.skills.size
- skill = $data_skills[@actor.skills[i]]
- if skill != nil
- @data.push(skill)
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- else
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- end
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == Fantasy_CMS::FONT_COLOR2 ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_SkillStatus
- #===============================================================================
- class Window_SkillStatus < Window_Base
- def initialize(actor)
- super(40, 150, 200, 150)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- draw_actor_name(@actor, 4, 0)
- draw_actor_state(@actor, 4, 32)
- draw_actor_hp(@actor, 4, 64)
- draw_actor_sp(@actor, 4, 96)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_EquipLeft
- #===============================================================================
- class Window_EquipLeft < Window_Base
- def initialize(actor)
- super(18, 280, 272, 192)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- draw_actor_name(@actor, 4, 0)
- draw_actor_level(@actor, 4, 32)
- draw_actor_parameter(@actor, 4, 64, 0)
- draw_actor_parameter(@actor, 4, 96, 1)
- draw_actor_parameter(@actor, 4, 128, 2)
- if @new_atk != nil
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.draw_text(160, 64, 40, 32, "->", 1)
- if @new_atk > @actor.atk
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_POSITIVE
- elsif @new_atk == @actor.atk
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- else
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_NEGATIVE
- end
- self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
- end
- if @new_pdef != nil
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.draw_text(160, 96, 40, 32, "->", 1)
- if @new_pdef > @actor.pdef
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_POSITIVE
- elsif @new_pdef == @actor.pdef
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- else
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_NEGATIVE
- end
- self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
- end
- if @new_mdef != nil
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.draw_text(160, 128, 40, 32, "->", 1)
- if @new_mdef > @actor.mdef
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_POSITIVE
- elsif @new_mdef == @actor.mdef
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- else
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_NEGATIVE
- end
- self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
- end
- end
- def set_new_parameters(new_atk, new_pdef, new_mdef)
- if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
- @new_atk = new_atk
- @new_pdef = new_pdef
- @new_mdef = new_mdef
- refresh
- end
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_EquipRight
- #===============================================================================
- class Window_EquipRight < Window_Selectable
- def initialize(actor)
- super(136, 80, 368, 192)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- refresh
- self.index = 0
- end
- def item
- return @data[self.index]
- end
- def refresh
- self.contents.clear
- @data = []
- @data.push($data_weapons[@actor.weapon_id])
- @data.push($data_armors[@actor.armor1_id])
- @data.push($data_armors[@actor.armor2_id])
- @data.push($data_armors[@actor.armor3_id])
- @data.push($data_armors[@actor.armor4_id])
- @item_max = @data.size
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
- self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
- self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
- self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
- self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
- draw_item_name(@data[0], 102, 32 * 0)
- draw_item_name(@data[1], 102, 32 * 1)
- draw_item_name(@data[2], 102, 32 * 2)
- draw_item_name(@data[3], 102, 32 * 3)
- draw_item_name(@data[4], 102, 32 * 4)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_EquipItem
- #===============================================================================
- class Window_EquipItem < Window_Selectable
- def initialize(actor, equip_type)
- super(298, 280, 324, 192)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- @equip_type = equip_type
- @column_max = 1
- refresh
- self.active = false
- self.index = -1
- end
- def item
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- if @equip_type == 0
- weapon_set = $data_classes[@actor.class_id].weapon_set
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
- @data.push($data_weapons[i])
- end
- end
- end
- if @equip_type != 0
- armor_set = $data_classes[@actor.class_id].armor_set
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0 and armor_set.include?(i)
- if $data_armors[i].kind == @equip_type-1
- @data.push($data_armors[i])
- end
- end
- end
- end
- @data.push(nil)
- @item_max = @data.size
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max-1
- draw_item(i)
- end
- end
- def draw_item(index)
- item = @data[index]
- x = 4
- y = index * 32
- case item
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_StatusInfo
- #===============================================================================
- class Window_StatusInfo < Window_Base
- def initialize(actor)
- super(8, 8, 300, 184)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- draw_actor_graphic(@actor, 40, 132)
- draw_actor_name(@actor, 4, 0)
- draw_actor_class(@actor, 4 + 4, 32)
- draw_actor_level(@actor, 96, 25)
- draw_actor_state(@actor, 96, 0)
- draw_actor_hp(@actor, 96, 100, 172)
- draw_actor_sp(@actor, 96, 125, 172)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.draw_text(96, 60, 80, 32, "Exp:")
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(96+30, 60, 142, 32, @actor.exp_s+" / "+ @actor.next_exp_s,2)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_StatusParameters
- #===============================================================================
- class Window_StatusParameters < Window_Base
- def initialize(actor)
- super(8, 196, 300, 276)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR
- self.contents.font.size = 22
- self.contents.draw_text(0, 0, 268, 32, "Parametry:", 1)
- draw_actor_parameter(@actor, 40, 40, 0)
- draw_actor_parameter(@actor, 40, 60, 1)
- draw_actor_parameter(@actor, 40, 80, 2)
- draw_actor_parameter(@actor, 40, 120, 3)
- draw_actor_parameter(@actor, 40, 140, 4)
- draw_actor_parameter(@actor, 40, 160, 5)
- draw_actor_parameter(@actor, 40, 182, 6)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_StatusEquip
- #===============================================================================
- class Window_StatusEquip < Window_Base
- def initialize(actor)
- super(316, 196, 316, 276)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR
- self.contents.font.size = 22
- self.contents.draw_text(0, 0, 268, 32, "Wyposażenie:", 1)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.draw_text(8, 40, 96, 32, $data_system.words.weapon)
- self.contents.draw_text(8, 80, 96, 32, $data_system.words.armor1)
- self.contents.draw_text(8, 120, 96, 32, $data_system.words.armor2)
- self.contents.draw_text(8, 160, 96, 32, $data_system.words.armor3)
- self.contents.draw_text(8, 200, 96, 32, $data_system.words.armor4)
- draw_item_name($data_weapons[@actor.weapon_id], 100, 40)
- draw_item_name($data_armors[@actor.armor1_id], 100, 80)
- draw_item_name($data_armors[@actor.armor2_id], 100, 120)
- draw_item_name($data_armors[@actor.armor3_id], 100, 160)
- draw_item_name($data_armors[@actor.armor4_id], 100, 200)
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_StatusDescription
- #===============================================================================
- class Window_StatusDescription < Window_Base
- def initialize(actor)
- super(316, 8, 316, 184)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @actor = actor
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR
- self.contents.font.size = 22
- self.contents.draw_text(0, 0, 268, 25, "Opis:", 1)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- lines = Fantasy_CMS::ACTOR_DESCRIPTION[@actor.actor_id]
- for i in 0..lines.size-1
- self.contents.draw_text(0, 25+25*i, 268, 25, lines[i])
- end
- end
- end
- #===============================================================================
- # Fantasy_CMS::Window_SaveFile
- #===============================================================================
- class Window_SaveFile < Window_Base
- attr_reader :filename # file name
- attr_reader :selected # selected
- def initialize(file_index, filename)
- super(0, 64 + file_index % 4 * 104, 640, 104)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
- self.opacity = Fantasy_CMS::OPACITY
- @file_index = file_index
- @filename = "Save#{@file_index + 1}.rxdata"
- @time_stamp = Time.at(0)
- @file_exist = FileTest.exist?(@filename)
- if @file_exist
- file = File.open(@filename, "r")
- @time_stamp = file.mtime
- @characters = Marshal.load(file)
- @frame_count = Marshal.load(file)
- @game_system = Marshal.load(file)
- @game_switches = Marshal.load(file)
- @game_variables = Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- end
- refresh
- @selected = false
- end
- def refresh
- self.contents.clear
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- name = "Slot #{@file_index + 1}"
- self.contents.draw_text(4, 0, 600, 32, name)
- @name_width = contents.text_size(name).width
- if @file_exist
- for i in 0...@characters.size
- bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
- cw = bitmap.rect.width / 4
- ch = bitmap.rect.height / 4
- src_rect = Rect.new(0, 0, cw, ch)
- x = 300 - @characters.size * 32 + i * 64 - cw / 2
- self.contents.blt(x, 68 - ch, bitmap, src_rect)
- end
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(4, 8, 600, 32, time_string, 2)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
- self.contents.draw_text(4, 40, 600, 32, time_string, 2)
- end
- end
- def selected=(selected)
- @selected = selected
- update_cursor_rect
- end
- def update_cursor_rect
- if @selected
- self.cursor_rect.set(0, 0, @name_width + 8, 32)
- else
- self.cursor_rect.empty
- end
- end
- end
- end
- #===============================================================================
- # END OF FANTASY_CMS MODULE
- #===============================================================================
- #===============================================================================
- # Game_Map
- #===============================================================================
- class Game_Map
- def name
- $map_infos[@map_id]
- end
- end
- #===============================================================================
- # Scene_Title
- #===============================================================================
- class Scene_Title
- $map_infos = load_data("Data/MapInfos.rxdata")
- for key in $map_infos.keys
- $map_infos[key] = $map_infos[key].name
- end
- end
- #===============================================================================
- # Game_Actor
- #===============================================================================
- class Game_Actor
- attr_reader :actor_id
- end
- #===============================================================================
- # Window_Base
- #===============================================================================
- class Window_Base < Window
- def draw_actor_name(actor, x, y)
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR
- self.contents.font.size = 22
- self.contents.draw_text(x, y, 120, 30, actor.name)
- end
- def draw_actor_class(actor, x, y)
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.draw_text(x, y, 236, 30, actor.class_name)
- end
- def draw_actor_level(actor, x, y)
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.draw_text(x, y, 40, 30, "Poziom:")
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(x + 45, y, 24, 30, actor.level.to_s, 2)
- end
- def draw_actor_state(actor, x, y, width = 120)
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- text = make_battler_state_text(actor, width, true)
- self.contents.font.color = actor.hp == 0 ? knockout_color : Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(x, y, width, 32, text)
- end
- def draw_actor_hp(actor, x, y, width = 144)
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
- if width - 32 >= 108
- hp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- hp_x = x + width - 48
- flag = false
- end
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
- if flag
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
- end
- end
- def draw_actor_sp(actor, x, y, width = 144)
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
- if width - 32 >= 108
- sp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- sp_x = x + width - 48
- flag = false
- end
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
- if flag
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
- end
- end
- def draw_item_name(item, x, y)
- if item == nil
- return
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- self.contents.draw_text(x + 28, y, 212, 32, item.name)
- end
- def draw_actor_parameter(actor, x, y, type)
- self.contents.font.name = Fantasy_CMS::FONT_NAME
- self.contents.font.size = Fantasy_CMS::FONT_SIZE2
- case type
- when 0
- parameter_name = $data_system.words.atk
- parameter_value = actor.atk
- when 1
- parameter_name = $data_system.words.pdef
- parameter_value = actor.pdef
- when 2
- parameter_name = $data_system.words.mdef
- parameter_value = actor.mdef
- when 3
- parameter_name = $data_system.words.str
- parameter_value = actor.str
- when 4
- parameter_name = $data_system.words.dex
- parameter_value = actor.dex
- when 5
- parameter_name = $data_system.words.agi
- parameter_value = actor.agi
- when 6
- parameter_name = $data_system.words.int
- parameter_value = actor.int
- end
- self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
- self.contents.draw_text(x, y, 120, 32, parameter_name)
- self.contents.font.color = Fantasy_CMS::FONT_COLOR2
- self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
- end
- end
- #===============================================================================
- # Scene_Menu
- #===============================================================================
- class Scene_Menu
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
- def main
- @appearing = true
- @disappearing = false
- # Wczytanie tła mapy
- @spriteset = Spriteset_Map.new
- # Wczytanie obrazku tła CMS
- @tlo = Sprite.new
- @tlo.bitmap = RPG::Cache.picture("fantasy_background")
- @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
- s1 = "Przedmioty"
- s2 = "Umiejętności"
- s3 = "Ekwipunek"
- s4 = "Status"
- s5 = "Rozdaj punkty"
- s6 = "Dziennik"
- s7 = "Bestiariusz"
- s8 = "Zapisz"
- s9 = "Wczytaj"
- s10 = "Wyjście"
- commands = [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10]
- @cmd_window = Fantasy_CMS::Window_Command.new(170, commands, true)
- @cmd_window.opacity = Fantasy_CMS::OPACITY
- @cmd_window.x = -176
- @cmd_window.y = 60
- @cmd_window.index = @menu_index
- @status_window = Fantasy_CMS::Window_MenuStatus.new
- @location_window = Fantasy_CMS::Window_Location.new
- @gold_window = Fantasy_CMS::Window_Gold.new
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @spriteset.dispose
- @cmd_window.dispose
- @status_window.dispose
- @location_window.dispose
- @gold_window.dispose
- @tlo.dispose
- end
- # Wpływanie okienek na ekran
- def appear
- @cmd_window.x += 8 if @cmd_window.x < 32
- @status_window.y += 10 if @status_window.y < 101
- @location_window.y -= 8 if @location_window.y > 283
- @gold_window.x -= 8 if @gold_window.x > 456
- if @location_window.y == 283 and @status_window.y == 101
- @appearing = false
- end
- end
- # Wypływanie okienek z ekranu
- def disappear
- @cmd_window.x -= 8 if @cmd_window.x > -176
- @status_window.y -= 10 if @status_window.y > -169
- @location_window.y += 8 if @location_window.y < 483
- @gold_window.x += 8 if @gold_window.x < 643
- if @location_window.y == 483 and @status_window.y == -169
- $scene = Scene_Map.new
- end
- end
- def update
- if @appearing
- appear
- end
- if @disappearing
- disappear
- end
- @spriteset.update
- @cmd_window.update
- @status_window.update
- if @cmd_window.active and not @appearing
- update_command
- return
- end
- if @status_window.active
- update_status
- return
- end
- end
- def update_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @disappearing = true
- return
- end
- if Input.trigger?(Input::C)
- if $game_party.actors.size == 0 and @cmd_window.index < 4
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- case @cmd_window.index
- when 0
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Item.new
- when 1
- $game_system.se_play($data_system.decision_se)
- @cmd_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 2
- $game_system.se_play($data_system.decision_se)
- @cmd_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 3
- $game_system.se_play($data_system.decision_se)
- @cmd_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 4
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Points.new
- when 5
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Quests.new
- when 6
- $scene = Scene_MonsterBook.new
- when 7
- if $game_system.save_disabled
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Save.new
- when 8
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Load.new(1)
- when 9
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_End.new
- end
- return
- end
- end
- def update_status
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @cmd_window.active = true
- @status_window.active = false
- @status_window.index = -1
- return
- end
- if Input.trigger?(Input::C)
- case @cmd_window.index
- when 1
- if $game_party.actors[@status_window.index].restriction >= 2
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Skill.new(@status_window.index)
- when 2
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Equip.new(@status_window.index)
- when 3
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Status.new(@status_window.index)
- end
- return
- end
- end
- end
- #===============================================================================
- # Scene_Item
- #===============================================================================
- class Scene_Item
- def main
- @appearing = false
- @disappearing = false
- # Wczytanie tła mapy
- @spriteset = Spriteset_Map.new
- # Wczytanie obrazku tła CMS
- @tlo = Sprite.new
- @tlo.bitmap = RPG::Cache.picture("fantasy_background")
- @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
- @help_window = Fantasy_CMS::Window_Help.new
- @item_window = Fantasy_CMS::Window_Item.new
- @item_window.help_window = @help_window
- @target_window = Fantasy_CMS::Window_Target.new
- @target_window.active = false
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @item_window.dispose
- @target_window.dispose
- @spriteset.dispose
- @tlo.dispose
- end
- def appear
- @item_window.x -= 10 if @item_window.x > 6
- @target_window.x -= 20 if @target_window.x > 340
- if @item_window.x == 6 and @target_window.x == 340
- @appearing = false
- end
- end
- def disappear
- @item_window.x += 10 if @item_window.x < 156
- @target_window.x += 20 if @target_window.x < 640
- if @item_window.x == 156 and @target_window.x == 640
- @disappearing = false
- end
- end
- def update
- appear if @appearing
- disappear if @disappearing
- @help_window.update
- @item_window.update
- @target_window.update
- @spriteset.update
- if @item_window.active and not @disappearing
- update_item
- return
- end
- if @target_window.active and not @appearing
- update_target
- return
- end
- end
- def update_item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(0)
- return
- end
- if Input.trigger?(Input::C)
- @item = @item_window.item
- unless @item.is_a?(RPG::Item)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- unless $game_party.item_can_use?(@item.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- if @item.scope >= 3
- @item_window.active = false
- @target_window.active = true
- @appearing = true
- if @item.scope == 4 || @item.scope == 6
- @target_window.index = -1
- else
- @target_window.index = 0
- end
- else
- if @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $game_system.se_play(@item.menu_se)
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- @item_window.draw_item(@item_window.index)
- end
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- def update_target
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- unless $game_party.item_can_use?(@item.id)
- @item_window.refresh
- end
- @disappearing = true
- @item_window.active = true
- @target_window.active = false
- return
- end
- if Input.trigger?(Input::C)
- if $game_party.item_number(@item.id) == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if @target_window.index == -1
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- if @target_window.index >= 0
- target = $game_party.actors[@target_window.index]
- used = target.item_effect(@item)
- end
- if used
- $game_system.se_play(@item.menu_se)
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- @item_window.draw_item(@item_window.index)
- end
- @target_window.refresh
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- return
- end
- if @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $scene = Scene_Map.new
- return
- end
- end
- unless used
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- #===============================================================================
- # Scene_Skill
- #===============================================================================
- class Scene_Skill
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- end
- def main
- @appearing = false
- @disappearing = false
- # Wczytanie tła mapy
- @spriteset = Spriteset_Map.new
- # Wczytanie obrazku tła CMS
- @tlo = Sprite.new
- @tlo.bitmap = RPG::Cache.picture("fantasy_background")
- @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
- @actor = $game_party.actors[@actor_index]
- @help_window = Fantasy_CMS::Window_Help.new
- @status_window = Fantasy_CMS::Window_SkillStatus.new(@actor)
- @skill_window = Fantasy_CMS::Window_Skill.new(@actor)
- @skill_window.help_window = @help_window
- @target_window = Fantasy_CMS::Window_Target.new
- @target_window.active = false
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @status_window.dispose
- @skill_window.dispose
- @target_window.dispose
- @spriteset.dispose
- @tlo.dispose
- end
- def appear
- @status_window.x -= 20 if @status_window.x > -240
- @skill_window.x -= 20 if @skill_window.x > 6
- @target_window.x -= 20 if @target_window.x > 340
- if @status_window.x == -240 and @skill_window.x == 6 and @target_window.x == 340
- @appearing = false
- end
- end
- def disappear
- @status_window.x += 20 if @status_window.x < 40
- @skill_window.x += 20 if @skill_window.x < 266
- @target_window.x += 20 if @target_window.x < 640
- if @status_window.x == 40 and @skill_window.x == 266 and @target_window.x == 640
- @disappearing = false
- end
- end
- def update
- appear if @appearing
- disappear if @disappearing
- @spriteset.update
- @help_window.update
- @status_window.update
- @skill_window.update
- @target_window.update
- if @skill_window.active and not @disappearing
- update_skill
- return
- end
- if @target_window.active and not @appearing
- update_target
- return
- end
- end
- def update_skill
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(1)
- return
- end
- if Input.trigger?(Input::C)
- @skill = @skill_window.skill
- if @skill == nil or not @actor.skill_can_use?(@skill.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- if @skill.scope >= 3
- @skill_window.active = false
- @target_window.active = true
- @appearing = true
- if @skill.scope == 4 || @skill.scope == 6
- @target_window.index = -1
- elsif @skill.scope == 7
- @target_window.index = @actor_index - 10
- else
- @target_window.index = 0
- end
- else
- if @skill.common_event_id > 0
- $game_temp.common_event_id = @skill.common_event_id
- $game_system.se_play(@skill.menu_se)
- @actor.sp -= @skill.sp_cost
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- if Input.trigger?(Input::R)
- $game_system.se_play($data_system.cursor_se)
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- if Input.trigger?(Input::L)
- $game_system.se_play($data_system.cursor_se)
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- end
- def update_target
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @skill_window.active = true
- @target_window.active = false
- @disappearing = true
- return
- end
- if Input.trigger?(Input::C)
- unless @actor.skill_can_use?(@skill.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if @target_window.index == -1
- used = false
- for i in $game_party.actors
- used |= i.skill_effect(@actor, @skill)
- end
- end
- if @target_window.index <= -2
- target = $game_party.actors[@target_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- if @target_window.index >= 0
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- if used
- $game_system.se_play(@skill.menu_se)
- @actor.sp -= @skill.sp_cost
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- return
- end
- if @skill.common_event_id > 0
- $game_temp.common_event_id = @skill.common_event_id
- $scene = Scene_Map.new
- return
- end
- end
- unless used
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- #===============================================================================
- # Scene_Equip
- #===============================================================================
- class Scene_Equip
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- @equip_index = equip_index
- end
- def main
- # Wczytanie tła mapy
- @spriteset = Spriteset_Map.new
- # Wczytanie obrazku tła CMS
- @tlo = Sprite.new
- @tlo.bitmap = RPG::Cache.picture("fantasy_background")
- @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
- @actor = $game_party.actors[@actor_index]
- @help_window = Fantasy_CMS::Window_Help.new
- @left_window = Fantasy_CMS::Window_EquipLeft.new(@actor)
- @right_window = Fantasy_CMS::Window_EquipRight.new(@actor)
- @item_window1 = Fantasy_CMS::Window_EquipItem.new(@actor, 0)
- @item_window2 = Fantasy_CMS::Window_EquipItem.new(@actor, 1)
- @item_window3 = Fantasy_CMS::Window_EquipItem.new(@actor, 2)
- @item_window4 = Fantasy_CMS::Window_EquipItem.new(@actor, 3)
- @item_window5 = Fantasy_CMS::Window_EquipItem.new(@actor, 4)
- @right_window.help_window = @help_window
- @item_window1.help_window = @help_window
- @item_window2.help_window = @help_window
- @item_window3.help_window = @help_window
- @item_window4.help_window = @help_window
- @item_window5.help_window = @help_window
- @right_window.index = @equip_index
- refresh
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @left_window.dispose
- @right_window.dispose
- @item_window1.dispose
- @item_window2.dispose
- @item_window3.dispose
- @item_window4.dispose
- @item_window5.dispose
- @spriteset.dispose
- @tlo.dispose
- end
- def refresh
- @item_window1.visible = (@right_window.index == 0)
- @item_window2.visible = (@right_window.index == 1)
- @item_window3.visible = (@right_window.index == 2)
- @item_window4.visible = (@right_window.index == 3)
- @item_window5.visible = (@right_window.index == 4)
- item1 = @right_window.item
- case @right_window.index
- when 0
- @item_window = @item_window1
- when 1
- @item_window = @item_window2
- when 2
- @item_window = @item_window3
- when 3
- @item_window = @item_window4
- when 4
- @item_window = @item_window5
- end
- if @right_window.active
- @left_window.set_new_parameters(nil, nil, nil)
- end
- if @item_window.active
- item2 = @item_window.item
- last_hp = @actor.hp
- last_sp = @actor.sp
- @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
- new_atk = @actor.atk
- new_pdef = @actor.pdef
- new_mdef = @actor.mdef
- @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
- @actor.hp = last_hp
- @actor.sp = last_sp
- @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
- end
- end
- def update
- @left_window.update
- @right_window.update
- @item_window.update
- @spriteset.update
- refresh
- if @right_window.active
- update_right
- return
- end
- if @item_window.active
- update_item
- return
- end
- end
- def update_right
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(2)
- return
- end
- if Input.trigger?(Input::C)
- if @actor.equip_fix?(@right_window.index)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @right_window.active = false
- @item_window.active = true
- @item_window.index = 0
- return
- end
- if Input.trigger?(Input::R)
- $game_system.se_play($data_system.cursor_se)
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Equip.new(@actor_index, @right_window.index)
- return
- end
- if Input.trigger?(Input::L)
- $game_system.se_play($data_system.cursor_se)
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Equip.new(@actor_index, @right_window.index)
- return
- end
- end
- def update_item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @right_window.active = true
- @item_window.active = false
- @item_window.index = -1
- return
- end
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.equip_se)
- item = @item_window.item
- @actor.equip(@right_window.index, item == nil ? 0 : item.id)
- @right_window.active = true
- @item_window.active = false
- @item_window.index = -1
- @right_window.refresh
- @item_window.refresh
- return
- end
- end
- end
- #===============================================================================
- # Scene_Status
- #===============================================================================
- class Scene_Status
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- end
- def main
- # Wczytanie tła mapy
- @spriteset = Spriteset_Map.new
- # Wczytanie obrazku tła CMS
- @tlo = Sprite.new
- @tlo.bitmap = RPG::Cache.picture("fantasy_background")
- @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
- @actor = $game_party.actors[@actor_index]
- @info_window = Fantasy_CMS::Window_StatusInfo.new(@actor)
- @equip_window = Fantasy_CMS::Window_StatusEquip.new(@actor)
- @parameters_window = Fantasy_CMS::Window_StatusParameters.new(@actor)
- if Fantasy_CMS::ACTOR_DESCRIPTION[@actor.actor_id] != nil
- @description_window = Fantasy_CMS::Window_StatusDescription.new(@actor)
- else
- @info_window.x = 170
- end
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @info_window.dispose
- @equip_window.dispose
- @parameters_window.dispose
- @spriteset.dispose
- @tlo.dispose
- @description_window.dispose unless @description_window == nil
- end
- def update
- @spriteset.update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(3)
- return
- end
- if Input.trigger?(Input::R)
- $game_system.se_play($data_system.cursor_se)
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Status.new(@actor_index)
- return
- end
- if Input.trigger?(Input::L)
- $game_system.se_play($data_system.cursor_se)
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Status.new(@actor_index)
- return
- end
- end
- end
- #===============================================================================
- # Scene_File
- #===============================================================================
- class Scene_File
- def initialize(help_text)
- @help_text = help_text
- end
- def main
- # Wczytanie obrazku tła CMS
- @tlo = Sprite.new
- @tlo.bitmap = RPG::Cache.picture("fantasy_background")
- @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
- @help_window = Fantasy_CMS::Window_Help.new
- @help_window.y = 0
- @help_window.set_text(@help_text)
- @savefile_windows = []
- for i in 0..3
- @savefile_windows.push(Fantasy_CMS::Window_SaveFile.new(i, make_filename(i)))
- end
- @file_index = $game_temp.last_file_index
- @savefile_windows[@file_index].selected = true
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @tlo.dispose
- for i in @savefile_windows
- i.dispose
- end
- end
- def update
- @help_window.update
- for i in @savefile_windows
- i.update
- end
- if Input.trigger?(Input::C)
- on_decision(make_filename(@file_index))
- $game_temp.last_file_index = @file_index
- return
- end
- if Input.trigger?(Input::B)
- on_cancel
- return
- end
- if Input.repeat?(Input::DOWN)
- if Input.trigger?(Input::DOWN) or @file_index < 3
- $game_system.se_play($data_system.cursor_se)
- @savefile_windows[@file_index].selected = false
- @file_index = (@file_index + 1) % 4
- @savefile_windows[@file_index].selected = true
- return
- end
- end
- if Input.repeat?(Input::UP)
- if Input.trigger?(Input::UP) or @file_index > 0
- $game_system.se_play($data_system.cursor_se)
- @savefile_windows[@file_index].selected = false
- @file_index = (@file_index + 3) % 4
- @savefile_windows[@file_index].selected = true
- return
- end
- end
- end
- def make_filename(file_index)
- return "Save#{file_index + 1}.rxdata"
- end
- end
- #===============================================================================
- # Scene_Save
- #===============================================================================
- class Scene_Save < Scene_File
- def initialize
- super("Na którym slocie chcesz zapisać grę?")
- end
- def on_decision(filename)
- $game_system.se_play($data_system.save_se)
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- $scene = Scene_Menu.new(4)
- end
- def on_cancel
- $game_system.se_play($data_system.cancel_se)
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- $scene = Scene_Menu.new(4)
- end
- def write_save_data(file)
- characters = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- $game_system.save_count += 1
- $game_system.magic_number = $data_system.magic_number
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- end
- end
- #===============================================================================
- # Scene_Load
- #===============================================================================
- class Scene_Load < Scene_File
- def initialize(esc_option = 0)
- @esc_option = esc_option # 0 - to title, 1 - to menu
- $game_temp = Game_Temp.new
- $game_temp.last_file_index = 0
- latest_time = Time.at(0)
- for i in 0..3
- filename = make_filename(i)
- if FileTest.exist?(filename)
- file = File.open(filename, "r")
- if file.mtime > latest_time
- latest_time = file.mtime
- $game_temp.last_file_index = i
- end
- file.close
- end
- end
- super("Który slot chciałbyś wczytać?")
- end
- def on_decision(filename)
- unless FileTest.exist?(filename)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.load_se)
- file = File.open(filename, "rb")
- read_save_data(file)
- file.close
- $game_system.bgm_play($game_system.playing_bgm)
- $game_system.bgs_play($game_system.playing_bgs)
- $game_map.update
- $scene = Scene_Map.new
- end
- def on_cancel
- $game_system.se_play($data_system.cancel_se)
- $scene = @esc_option == 0 ? Scene_Title.new : Scene_Menu.new(5)
- end
- def read_save_data(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_screen = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- if $game_system.magic_number != $data_system.magic_number
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- $game_party.refresh
- end
- end
- #===============================================================================
- # Scene_End
- #===============================================================================
- class Scene_End
- def main
- # Wczytanie tła mapy
- @spriteset = Spriteset_Map.new
- # Wczytanie obrazku tła CMS
- @tlo = Sprite.new
- @tlo.bitmap = RPG::Cache.picture("fantasy_background")
- @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
- s1 = "Menu Główne"
- s2 = "Wyjście"
- s3 = "Anuluj"
- @command_window = Fantasy_CMS::Window_Command.new(192, [s1, s2, s3])
- @command_window.x = 320 - @command_window.width / 2
- @command_window.y = 240 - @command_window.height / 2
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @command_window.dispose
- @spriteset.dispose
- @tlo.dispose
- if $scene.is_a?(Scene_Title)
- Graphics.transition
- Graphics.freeze
- end
- end
- def update
- @spriteset.update
- @command_window.update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(6)
- return
- end
- if Input.trigger?(Input::C)
- case @command_window.index
- when 0 # to title
- command_to_title
- when 1 # shutdown
- command_shutdown
- when 2 # quit
- command_cancel
- end
- return
- end
- end
- def command_to_title
- $game_system.se_play($data_system.decision_se)
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- $scene = Scene_Title.new
- end
- def command_shutdown
- $game_system.se_play($data_system.decision_se)
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- $scene = nil
- end
- def command_cancel
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Menu.new(6)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment