Guest User

fantasycms

a guest
Nov 2nd, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 67.84 KB | None | 0 0
  1. #===============================================================================
  2. #--------#      Fantasy CMS        #--------------------------------------------
  3. #--------#      version 2.01       #--------------------------------------------
  4. #--------#  by Thieffer and Dante  #--------------------------------------------
  5. #--------#       29.12.2010        #--------------------------------------------
  6. #--------#   thieffer.zamthir.net  #--------------------------------------------
  7. #===============================================================================
  8.  
  9. #===============================================================================
  10. #--------#          INFO           #--------------------------------------------
  11. #===============================================================================
  12. # Wklej skrypt nad Main.
  13. # Do prawidłowego działania potrzebna jest czcionka używana przez skrypt (standardowo Galileo Font)
  14. # Podziękowania dla www.ragnarokonline.com za ikony.
  15. #===============================================================================
  16.  
  17. #===============================================================================
  18. #--------#        CHANGELOG        #--------------------------------------------
  19. #===============================================================================
  20. #  ** version 1.0 (09.07.2010)
  21. #     - publikacja skryptu
  22. #  ** version 1.1 (14.07.2010)
  23. #     - dodana możliwość włączenia komendy 'Bestiariusz' w komendach menu,
  24. #     - dodana możliwość zmiany grafiki windowskina CMSa w CONFIGu,
  25. #     - naprawiony błąd z wjeżdżaniem okienek,
  26. #     - naprawiony błąd z przezroczystością okna komend
  27. #  ** version 2.0 (21.09.2010)
  28. #     - wszystkie submenusy w stylu Fantasy (Scene_Item, Scene_Equip,  
  29. #       Scene_Skill, Scene_Status, Scene_Save, Scene_Load, Scene_End)
  30. #     - usunięta możliwość włączenia komendy 'Bestiariusz' w komendach menu,
  31. #     - naprawiony błąd z wyświetlaniem koloru tekstu HP w menu głównym,
  32. #     - dodana możliwość ustawienia krótkich opisów bohaterów w Scene_Status
  33. #  ** version 2.1 (29.12.2010)
  34. #     - naprawiony bug w Scene_Equip
  35. #===============================================================================
  36.  
  37. #===============================================================================
  38. #--------#         CONFIG          #--------------------------------------------
  39. #===============================================================================
  40. module Fantasy_CMS
  41.   # Nazwa czcionki
  42.   FONT_NAME = "Galileo Font"
  43.   # Kolor czcionki komend i imion bohaterów
  44.   FONT_COLOR = Color.new(230, 230, 150, 255)
  45.   # Kolor czcionki podrzędnej
  46.   FONT_COLOR2 = Color.new(255, 255, 255, 255)
  47.   # Kolor czcionki niedostępnej opcji ("disabled")
  48.   FONT_COLOR_DISABLED = Color.new(255, 255, 255, 130)
  49.   # Kolor czcionki Positive (zielona)
  50.   FONT_COLOR_POSITIVE = Color.new(130, 255, 0, 255)
  51.   # Kolor czcionki Negative (czerwona)
  52.   FONT_COLOR_NEGATIVE = Color.new(220, 0, 30, 255)
  53.   # Rozmiar czcionki podrzędnej
  54.   FONT_SIZE2 = 18
  55.   # Nieprzezroczystość okienek (0-255)
  56.   OPACITY = 200
  57.   # Nieprzezroczystość obrazka tła (0-255)
  58.   BACKGROUND_OPACITY = 150
  59.   # Grafika windowskina
  60.   WINDOWSKIN_GRAPHIC = "fantasy_windowskin"
  61.  
  62.   ACTOR_DESCRIPTION = {
  63.   # *** OPISY BOHATERÓW ***
  64.   # Schemat tworzenia opisów:
  65.   # ID_Bohatera => [1 linijka opisu, 2 linijka opisu, 3 linijka opisu, 4 linijka_opisu, 5 linijka_opisu]
  66.   # Każdy z takich elementów musi być odzielony przecinkiem.
  67.   # W opisie bohatera możesz użyć od 1 do 5 linjek tekstu.
  68.   # Jeśli nie stworzysz opisu bohatera, okienko z opisem (w statusie) nie zostanie wyświetlone.
  69.   1 => ["1 linijka opisu", "2 linijka opisu", "3 linijka opisu", "4 linijka opisu", "5 linijka opisu"],
  70.   2 => ["1 linijka opisu", "2 linijka opisu", "3 linijka opisu"],
  71.   7 => nil, # nil = brak opisu
  72.   8 => ["1 linijka opisu"]
  73.  
  74.   }
  75. #===============================================================================
  76.  
  77. #===============================================================================
  78. # Fantasy_CMS::Window_Command
  79. #===============================================================================
  80.   class Window_Command < Window_Selectable
  81.     def initialize(width, commands, icons = false)
  82.       super(0, 0, width, commands.size * 32 + 32)
  83.       @item_max = commands.size
  84.       @commands = commands
  85.       @icons = icons
  86.       self.contents = Bitmap.new(width - 32, @item_max * 32)
  87.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  88.       refresh
  89.       self.index = 0
  90.       self.opacity = Fantasy_CMS::OPACITY
  91.     end
  92.    
  93.     def refresh
  94.       self.contents.clear
  95.       for i in 0...@item_max
  96.         c = Fantasy_CMS::FONT_COLOR
  97.         draw_item(i, c)
  98.       end
  99.     end
  100.    
  101.     def draw_item(index, color)
  102.       self.contents.font.color = color
  103.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  104.       x = @icons ? 24 : 0
  105.       rect = Rect.new(4+x, 32 * index, self.contents.width - 8, 32)
  106.       self.contents.blt(0,32* index+4, RPG::Cache.picture("Fantasy_CMS_icons/"+@commands[index]), Rect.new(0,0,24,24)) if @icons
  107.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  108.       self.contents.draw_text(rect, @commands[index], 0)
  109.     end
  110.    
  111.     def disable_item(index)
  112.       draw_item(index, disabled_color)
  113.     end
  114.   end
  115.  
  116. #===============================================================================
  117. # Fantasy_CMS::Window_MenuStatus
  118. #===============================================================================  
  119.   class Window_MenuStatus < Window_Selectable
  120.     def initialize
  121.       super(216, -169, 392, 166)
  122.       self.contents = Bitmap.new(width - 32, height - 32)
  123.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  124.       refresh
  125.       self.active = false
  126.       self.index = -1
  127.       self.opacity = Fantasy_CMS::OPACITY
  128.     end
  129.    
  130.     def refresh
  131.       self.contents.clear
  132.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  133.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  134.       @item_max = $game_party.actors.size
  135.       @column_max = 4
  136.       for i in 0...$game_party.actors.size
  137.         x = i*90
  138.         y = 0
  139.         actor = $game_party.actors[i]
  140.         draw_actor_graphic(actor, x+12+30, y+48+22)
  141.         self.contents.font.color = Fantasy_CMS::FONT_COLOR
  142.         self.contents.draw_text(x, y+3, 90, 20, actor.name, 1)
  143.         self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  144.         self.contents.draw_text(x, y+70, 90, 20, "Poziom: " + actor.level.to_s, 1)
  145.         draw_actor_hp(actor,x,y+95)
  146.       end
  147.     end
  148.    
  149.     def draw_actor_hp(actor, x, y, width = 144)
  150.       self.contents.draw_text(x, y, 90, 20, "Zdrowie:", 1)
  151.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  152.         actor.hp <= actor.maxhp / 4 ? crisis_color : Fantasy_CMS::FONT_COLOR2
  153.       self.contents.draw_text(x-10, y+10, 48, 32, actor.hp.to_s, 2)
  154.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  155.       self.contents.draw_text(x + 48-10, y+10, 12, 32, "/", 1)
  156.       self.contents.draw_text(x + 60-10, y+10, 48, 32, actor.maxhp.to_s)
  157.     end
  158.    
  159.     def update_cursor_rect
  160.       if @index < 0
  161.         self.cursor_rect.empty
  162.       else
  163.         self.cursor_rect.set(@index*90, 0, 90 , 134)
  164.       end
  165.     end
  166.   end
  167.  
  168. #===============================================================================
  169. # Fantasy_CMS::Window_Location
  170. #===============================================================================  
  171.   class Window_Location < Window_Base
  172.     def initialize
  173.       super(216, 483, 224, 96)
  174.       self.contents = Bitmap.new(width - 32, height - 32)
  175.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  176.       self.opacity = Fantasy_CMS::OPACITY
  177.       refresh
  178.     end
  179.     def refresh
  180.       self.contents.clear
  181.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  182.       self.contents.font.color = Fantasy_CMS::FONT_COLOR
  183.       self.contents.draw_text(35+4, 0, 150, 32, "Lokacja:", 0)
  184.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  185.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  186.       self.contents.draw_text(4, 32, 196, 32, $game_map.name, 0)
  187.       self.contents.blt(0,0, RPG::Cache.picture("Fantasy_CMS_icons/lokacja"), Rect.new(0,0,24,24))
  188.     end
  189.   end
  190.  
  191. #===============================================================================
  192. # Fantasy_CMS::Window_Gold
  193. #===============================================================================
  194.   class Window_Gold < Window_Base
  195.     def initialize
  196.       super(643, 283, 152, 96)
  197.       self.contents = Bitmap.new(width - 32, height - 32)
  198.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  199.       self.opacity = Fantasy_CMS::OPACITY
  200.       refresh
  201.     end
  202.     def refresh
  203.       self.contents.clear
  204.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  205.       self.contents.font.color = Fantasy_CMS::FONT_COLOR
  206.       self.contents.draw_text(28+4, 0, 150, 32, "Sakwa:", 0)
  207.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  208.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  209.       self.contents.draw_text(14, 32, 100, 32, $game_party.gold.to_s + " " +$data_system.words.gold, 0)
  210.       self.contents.blt(0,4, RPG::Cache.picture("Fantasy_CMS_icons/sakwa"), Rect.new(0,0,24,24))
  211.     end
  212.   end
  213.  
  214. #===============================================================================
  215. # Fantasy_CMS::Window_Target
  216. #===============================================================================
  217.   class Window_Target < Window_Selectable
  218.     def initialize
  219.       super(640, 76, 292, 400)
  220.       self.contents = Bitmap.new(width - 32, height - 32)
  221.       self.z += 10
  222.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  223.       self.opacity = Fantasy_CMS::OPACITY
  224.       @item_max = $game_party.actors.size
  225.       refresh
  226.     end
  227.  
  228.     def refresh
  229.       self.contents.clear
  230.       for i in 0...$game_party.actors.size
  231.         x = 4
  232.         y = i * 92
  233.         actor = $game_party.actors[i]
  234.         draw_actor_name(actor, x, y)
  235.         draw_actor_class(actor, x + 120, y)
  236.         draw_actor_level(actor, x + 8, y + 30)
  237.         draw_actor_state(actor, x + 8, y + 60)
  238.         draw_actor_hp(actor, x + 122, y + 30)
  239.         draw_actor_sp(actor, x + 122, y + 60)
  240.       end
  241.     end
  242.  
  243.     def update_cursor_rect
  244.       # Cursor position -1 = all choices, -2 or lower = independent choice
  245.       # (meaning the user's own choice)
  246.       if @index <= -2
  247.         self.cursor_rect.set(0, (@index + 10) * 92, self.width - 32, 92)
  248.       elsif @index == -1
  249.         self.cursor_rect.set(0, 0, self.width - 32, @item_max * 92 - 20)
  250.       else
  251.         self.cursor_rect.set(0, @index * 92, self.width - 32, 92)
  252.       end
  253.     end
  254.   end
  255.  
  256. #===============================================================================
  257. # Fantasy_CMS::Window_Help
  258. #===============================================================================
  259.   class Window_Help < Window_Base
  260.     def initialize
  261.       super(0, 8, 640, 64)
  262.       self.contents = Bitmap.new(width - 32, height - 32)
  263.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  264.       self.opacity = Fantasy_CMS::OPACITY
  265.     end
  266.     #--------------------------------------------------------------------------
  267.     # * Set Text
  268.     #  text  : text string displayed in window
  269.     #  align : alignment (0..flush left, 1..center, 2..flush right)
  270.     #--------------------------------------------------------------------------
  271.     def set_text(text, align = 0)
  272.       if text != @text or align != @align
  273.         self.contents.clear
  274.         self.contents.font.name = Fantasy_CMS::FONT_NAME
  275.         self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  276.         self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  277.         @text = text
  278.         @align = align
  279.         @actor = nil
  280.       end
  281.       self.visible = true
  282.     end
  283.    
  284.     def set_actor(actor)
  285.       if actor != @actor
  286.         self.contents.clear
  287.         draw_actor_name(actor, 4, 0)
  288.         draw_actor_state(actor, 140, 0)
  289.         draw_actor_hp(actor, 284, 0)
  290.         draw_actor_sp(actor, 460, 0)
  291.         @actor = actor
  292.         @text = nil
  293.         self.visible = true
  294.       end
  295.     end
  296.  
  297.     def set_enemy(enemy)
  298.       text = enemy.name
  299.       state_text = make_battler_state_text(enemy, 112, false)
  300.       if state_text != ""
  301.         text += "  " + state_text
  302.       end
  303.       set_text(text, 1)
  304.     end
  305.   end
  306.  
  307. #===============================================================================
  308. # Fantasy_CMS::Window_Item
  309. #===============================================================================
  310.   class Window_Item < Window_Selectable
  311.     def initialize
  312.       super(156, 96, 324, 352)
  313.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  314.       self.opacity = Fantasy_CMS::OPACITY
  315.       @column_max = 1
  316.       refresh
  317.       self.index = 0
  318.     end
  319.    
  320.     def item
  321.       return @data[self.index]
  322.     end
  323.  
  324.     def refresh
  325.       if self.contents != nil
  326.         self.contents.dispose
  327.         self.contents = nil
  328.       end
  329.       @data = []
  330.       for i in 1...$data_items.size
  331.         if $game_party.item_number(i) > 0
  332.           @data.push($data_items[i])
  333.         end
  334.       end
  335.       unless $game_temp.in_battle
  336.         for i in 1...$data_weapons.size
  337.           if $game_party.weapon_number(i) > 0
  338.             @data.push($data_weapons[i])
  339.           end
  340.         end
  341.         for i in 1...$data_armors.size
  342.           if $game_party.armor_number(i) > 0
  343.             @data.push($data_armors[i])
  344.           end
  345.         end
  346.       end
  347.       @item_max = @data.size
  348.       if @item_max > 0
  349.         self.contents = Bitmap.new(width - 32, row_max * 32)
  350.         for i in 0...@item_max
  351.           draw_item(i)
  352.         end
  353.       end
  354.     end
  355.  
  356.     def draw_item(index)
  357.       item = @data[index]
  358.       case item
  359.       when RPG::Item
  360.         number = $game_party.item_number(item.id)
  361.       when RPG::Weapon
  362.         number = $game_party.weapon_number(item.id)
  363.       when RPG::Armor
  364.         number = $game_party.armor_number(item.id)
  365.       end
  366.       if item.is_a?(RPG::Item) and
  367.          $game_party.item_can_use?(item.id)
  368.         self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  369.       else
  370.         self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  371.       end
  372.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  373.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  374.       x = 4
  375.       y = index * 32
  376.       rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  377.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  378.       bitmap = RPG::Cache.icon(item.icon_name)
  379.       opacity = self.contents.font.color == Fantasy_CMS::FONT_COLOR2 ? 255 : 128
  380.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  381.       self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  382.       self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  383.       self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  384.     end
  385.  
  386.     def update_help
  387.       @help_window.set_text(self.item == nil ? "" : self.item.description)
  388.     end
  389.   end
  390.  
  391. #===============================================================================
  392. # Fantasy_CMS::Window_Skill
  393. #===============================================================================
  394.   class Window_Skill < Window_Selectable
  395.     def initialize(actor)
  396.       super(266, 96, 324, 352)
  397.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  398.       self.opacity = Fantasy_CMS::OPACITY
  399.       @actor = actor
  400.       @column_max = 1
  401.       refresh
  402.       self.index = 0
  403.     end
  404.    
  405.     def skill
  406.       return @data[self.index]
  407.     end
  408.  
  409.     def refresh
  410.       if self.contents != nil
  411.         self.contents.dispose
  412.         self.contents = nil
  413.       end
  414.       @data = []
  415.       for i in 0...@actor.skills.size
  416.         skill = $data_skills[@actor.skills[i]]
  417.         if skill != nil
  418.           @data.push(skill)
  419.         end
  420.       end
  421.       @item_max = @data.size
  422.       if @item_max > 0
  423.         self.contents = Bitmap.new(width - 32, row_max * 32)
  424.         for i in 0...@item_max
  425.           draw_item(i)
  426.         end
  427.       end
  428.     end
  429.  
  430.     def draw_item(index)
  431.       skill = @data[index]
  432.       if @actor.skill_can_use?(skill.id)
  433.         self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  434.       else
  435.         self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  436.       end
  437.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  438.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  439.       x = 4
  440.       y = index * 32
  441.       rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  442.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  443.       bitmap = RPG::Cache.icon(skill.icon_name)
  444.       opacity = self.contents.font.color == Fantasy_CMS::FONT_COLOR2 ? 255 : 128
  445.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  446.       self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  447.       self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  448.     end
  449.  
  450.     def update_help
  451.       @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  452.     end
  453.   end
  454.  
  455. #===============================================================================
  456. # Fantasy_CMS::Window_SkillStatus
  457. #===============================================================================  
  458.   class Window_SkillStatus < Window_Base
  459.     def initialize(actor)
  460.       super(40, 150, 200, 150)
  461.       self.contents = Bitmap.new(width - 32, height - 32)
  462.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  463.       self.opacity = Fantasy_CMS::OPACITY
  464.       @actor = actor
  465.       refresh
  466.     end
  467.     def refresh
  468.       self.contents.clear
  469.       draw_actor_name(@actor, 4, 0)
  470.       draw_actor_state(@actor, 4, 32)
  471.       draw_actor_hp(@actor, 4, 64)
  472.       draw_actor_sp(@actor, 4, 96)
  473.     end
  474.   end
  475.  
  476. #===============================================================================
  477. # Fantasy_CMS::Window_EquipLeft
  478. #===============================================================================
  479.   class Window_EquipLeft < Window_Base
  480.     def initialize(actor)
  481.       super(18, 280, 272, 192)
  482.       self.contents = Bitmap.new(width - 32, height - 32)
  483.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  484.       self.opacity = Fantasy_CMS::OPACITY
  485.       @actor = actor
  486.       refresh
  487.     end
  488.  
  489.     def refresh
  490.       self.contents.clear
  491.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  492.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  493.       draw_actor_name(@actor, 4, 0)
  494.       draw_actor_level(@actor, 4, 32)
  495.       draw_actor_parameter(@actor, 4, 64, 0)
  496.       draw_actor_parameter(@actor, 4, 96, 1)
  497.       draw_actor_parameter(@actor, 4, 128, 2)
  498.       if @new_atk != nil
  499.         self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  500.         self.contents.draw_text(160, 64, 40, 32, "->", 1)
  501.         if @new_atk > @actor.atk
  502.           self.contents.font.color = Fantasy_CMS::FONT_COLOR_POSITIVE
  503.         elsif @new_atk == @actor.atk
  504.           self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  505.         else
  506.           self.contents.font.color = Fantasy_CMS::FONT_COLOR_NEGATIVE
  507.         end
  508.         self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  509.       end
  510.       if @new_pdef != nil
  511.         self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  512.         self.contents.draw_text(160, 96, 40, 32, "->", 1)
  513.         if @new_pdef > @actor.pdef
  514.           self.contents.font.color = Fantasy_CMS::FONT_COLOR_POSITIVE
  515.         elsif @new_pdef == @actor.pdef
  516.           self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  517.         else
  518.           self.contents.font.color = Fantasy_CMS::FONT_COLOR_NEGATIVE
  519.         end
  520.         self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  521.       end
  522.       if @new_mdef != nil
  523.         self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  524.         self.contents.draw_text(160, 128, 40, 32, "->", 1)
  525.         if @new_mdef > @actor.mdef
  526.           self.contents.font.color = Fantasy_CMS::FONT_COLOR_POSITIVE
  527.         elsif @new_mdef == @actor.mdef
  528.           self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  529.         else
  530.           self.contents.font.color = Fantasy_CMS::FONT_COLOR_NEGATIVE
  531.         end
  532.         self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  533.       end
  534.     end
  535.  
  536.     def set_new_parameters(new_atk, new_pdef, new_mdef)
  537.       if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
  538.         @new_atk = new_atk
  539.         @new_pdef = new_pdef
  540.         @new_mdef = new_mdef
  541.         refresh
  542.       end
  543.     end
  544.   end
  545.  
  546. #===============================================================================
  547. # Fantasy_CMS::Window_EquipRight
  548. #===============================================================================
  549.   class Window_EquipRight < Window_Selectable
  550.     def initialize(actor)
  551.       super(136, 80, 368, 192)
  552.       self.contents = Bitmap.new(width - 32, height - 32)
  553.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  554.       self.opacity = Fantasy_CMS::OPACITY
  555.       @actor = actor
  556.       refresh
  557.       self.index = 0
  558.     end
  559.  
  560.     def item
  561.       return @data[self.index]
  562.     end
  563.  
  564.     def refresh
  565.       self.contents.clear
  566.       @data = []
  567.       @data.push($data_weapons[@actor.weapon_id])
  568.       @data.push($data_armors[@actor.armor1_id])
  569.       @data.push($data_armors[@actor.armor2_id])
  570.       @data.push($data_armors[@actor.armor3_id])
  571.       @data.push($data_armors[@actor.armor4_id])
  572.       @item_max = @data.size
  573.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  574.       self.contents.font.color = Fantasy_CMS::FONT_COLOR
  575.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  576.       self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  577.       self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  578.       self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  579.       self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  580.       self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  581.       draw_item_name(@data[0], 102, 32 * 0)
  582.       draw_item_name(@data[1], 102, 32 * 1)
  583.       draw_item_name(@data[2], 102, 32 * 2)
  584.       draw_item_name(@data[3], 102, 32 * 3)
  585.       draw_item_name(@data[4], 102, 32 * 4)
  586.     end
  587.  
  588.     def update_help
  589.       @help_window.set_text(self.item == nil ? "" : self.item.description)
  590.     end
  591.   end
  592.  
  593. #===============================================================================
  594. # Fantasy_CMS::Window_EquipItem
  595. #===============================================================================
  596.   class Window_EquipItem < Window_Selectable
  597.     def initialize(actor, equip_type)
  598.       super(298, 280, 324, 192)
  599.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  600.       self.opacity = Fantasy_CMS::OPACITY
  601.       @actor = actor
  602.       @equip_type = equip_type
  603.       @column_max = 1
  604.       refresh
  605.       self.active = false
  606.       self.index = -1
  607.     end
  608.  
  609.     def item
  610.       return @data[self.index]
  611.     end
  612.  
  613.     def refresh
  614.       if self.contents != nil
  615.         self.contents.dispose
  616.         self.contents = nil
  617.       end
  618.       @data = []
  619.       if @equip_type == 0
  620.         weapon_set = $data_classes[@actor.class_id].weapon_set
  621.         for i in 1...$data_weapons.size
  622.           if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  623.             @data.push($data_weapons[i])
  624.           end
  625.         end
  626.       end
  627.       if @equip_type != 0
  628.         armor_set = $data_classes[@actor.class_id].armor_set
  629.         for i in 1...$data_armors.size
  630.           if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  631.             if $data_armors[i].kind == @equip_type-1
  632.               @data.push($data_armors[i])
  633.             end
  634.           end
  635.         end
  636.       end
  637.       @data.push(nil)
  638.       @item_max = @data.size
  639.       self.contents = Bitmap.new(width - 32, row_max * 32)
  640.       for i in 0...@item_max-1
  641.         draw_item(i)
  642.       end
  643.     end
  644.    
  645.     def draw_item(index)
  646.       item = @data[index]
  647.       x = 4
  648.       y = index * 32
  649.       case item
  650.       when RPG::Weapon
  651.         number = $game_party.weapon_number(item.id)
  652.       when RPG::Armor
  653.         number = $game_party.armor_number(item.id)
  654.       end
  655.       bitmap = RPG::Cache.icon(item.icon_name)
  656.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  657.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  658.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  659.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  660.       self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  661.       self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  662.       self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  663.     end
  664.  
  665.     def update_help
  666.       @help_window.set_text(self.item == nil ? "" : self.item.description)
  667.     end
  668.   end
  669.  
  670. #===============================================================================
  671. # Fantasy_CMS::Window_StatusInfo
  672. #===============================================================================
  673.   class Window_StatusInfo < Window_Base
  674.     def initialize(actor)
  675.       super(8, 8, 300, 184)
  676.       self.contents = Bitmap.new(width - 32, height - 32)
  677.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  678.       self.opacity = Fantasy_CMS::OPACITY
  679.       @actor = actor
  680.       refresh
  681.     end
  682.  
  683.     def refresh
  684.       self.contents.clear
  685.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  686.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  687.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  688.       draw_actor_graphic(@actor, 40, 132)
  689.       draw_actor_name(@actor, 4, 0)
  690.       draw_actor_class(@actor, 4 + 4, 32)
  691.       draw_actor_level(@actor, 96, 25)
  692.       draw_actor_state(@actor, 96, 0)
  693.       draw_actor_hp(@actor, 96, 100, 172)
  694.       draw_actor_sp(@actor, 96, 125, 172)
  695.       self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  696.       self.contents.draw_text(96, 60, 80, 32, "Exp:")
  697.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  698.       self.contents.draw_text(96+30, 60, 142, 32, @actor.exp_s+" / "+ @actor.next_exp_s,2)
  699.     end
  700.   end
  701.  
  702. #===============================================================================
  703. # Fantasy_CMS::Window_StatusParameters
  704. #===============================================================================
  705.   class Window_StatusParameters < Window_Base
  706.     def initialize(actor)
  707.       super(8, 196, 300, 276)
  708.       self.contents = Bitmap.new(width - 32, height - 32)
  709.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  710.       self.opacity = Fantasy_CMS::OPACITY
  711.       @actor = actor
  712.       refresh
  713.     end
  714.  
  715.     def refresh
  716.       self.contents.clear
  717.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  718.       self.contents.font.color = Fantasy_CMS::FONT_COLOR
  719.       self.contents.font.size = 22
  720.       self.contents.draw_text(0, 0, 268, 32, "Parametry:", 1)
  721.       draw_actor_parameter(@actor, 40, 40, 0)
  722.       draw_actor_parameter(@actor, 40, 60, 1)
  723.       draw_actor_parameter(@actor, 40, 80, 2)
  724.       draw_actor_parameter(@actor, 40, 120, 3)
  725.       draw_actor_parameter(@actor, 40, 140, 4)
  726.       draw_actor_parameter(@actor, 40, 160, 5)
  727.       draw_actor_parameter(@actor, 40, 182, 6)
  728.     end
  729.   end
  730.  
  731. #===============================================================================
  732. # Fantasy_CMS::Window_StatusEquip
  733. #===============================================================================
  734.   class Window_StatusEquip < Window_Base
  735.     def initialize(actor)
  736.       super(316, 196, 316, 276)
  737.       self.contents = Bitmap.new(width - 32, height - 32)
  738.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  739.       self.opacity = Fantasy_CMS::OPACITY
  740.       @actor = actor
  741.       refresh
  742.     end
  743.  
  744.     def refresh
  745.       self.contents.clear
  746.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  747.       self.contents.font.color = Fantasy_CMS::FONT_COLOR
  748.       self.contents.font.size = 22
  749.       self.contents.draw_text(0, 0, 268, 32, "Wyposażenie:", 1)
  750.       self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  751.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  752.       self.contents.draw_text(8, 40, 96, 32, $data_system.words.weapon)
  753.       self.contents.draw_text(8, 80, 96, 32, $data_system.words.armor1)
  754.       self.contents.draw_text(8, 120, 96, 32, $data_system.words.armor2)
  755.       self.contents.draw_text(8, 160, 96, 32, $data_system.words.armor3)
  756.       self.contents.draw_text(8, 200, 96, 32, $data_system.words.armor4)
  757.       draw_item_name($data_weapons[@actor.weapon_id], 100, 40)
  758.       draw_item_name($data_armors[@actor.armor1_id], 100, 80)
  759.       draw_item_name($data_armors[@actor.armor2_id], 100, 120)
  760.       draw_item_name($data_armors[@actor.armor3_id], 100, 160)
  761.       draw_item_name($data_armors[@actor.armor4_id], 100, 200)
  762.     end
  763.   end
  764.  
  765. #===============================================================================
  766. # Fantasy_CMS::Window_StatusDescription
  767. #===============================================================================
  768.   class Window_StatusDescription < Window_Base
  769.     def initialize(actor)
  770.       super(316, 8, 316, 184)
  771.       self.contents = Bitmap.new(width - 32, height - 32)
  772.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  773.       self.opacity = Fantasy_CMS::OPACITY
  774.       @actor = actor
  775.       refresh
  776.     end
  777.  
  778.     def refresh
  779.       self.contents.clear
  780.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  781.       self.contents.font.color = Fantasy_CMS::FONT_COLOR
  782.       self.contents.font.size = 22
  783.       self.contents.draw_text(0, 0, 268, 25, "Opis:", 1)
  784.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  785.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  786.       lines = Fantasy_CMS::ACTOR_DESCRIPTION[@actor.actor_id]
  787.       for i in 0..lines.size-1
  788.         self.contents.draw_text(0, 25+25*i, 268, 25, lines[i])
  789.       end
  790.     end
  791.   end
  792.  
  793. #===============================================================================
  794. # Fantasy_CMS::Window_SaveFile
  795. #===============================================================================
  796.   class Window_SaveFile < Window_Base
  797.    
  798.     attr_reader   :filename                 # file name
  799.     attr_reader   :selected                 # selected
  800.  
  801.     def initialize(file_index, filename)
  802.       super(0, 64 + file_index % 4 * 104, 640, 104)
  803.       self.contents = Bitmap.new(width - 32, height - 32)
  804.       self.windowskin = RPG::Cache.windowskin(Fantasy_CMS::WINDOWSKIN_GRAPHIC)
  805.       self.opacity = Fantasy_CMS::OPACITY
  806.       @file_index = file_index
  807.       @filename = "Save#{@file_index + 1}.rxdata"
  808.       @time_stamp = Time.at(0)
  809.       @file_exist = FileTest.exist?(@filename)
  810.       if @file_exist
  811.         file = File.open(@filename, "r")
  812.         @time_stamp = file.mtime
  813.         @characters = Marshal.load(file)
  814.         @frame_count = Marshal.load(file)
  815.         @game_system = Marshal.load(file)
  816.         @game_switches = Marshal.load(file)
  817.         @game_variables = Marshal.load(file)
  818.         @total_sec = @frame_count / Graphics.frame_rate
  819.         file.close
  820.       end
  821.       refresh
  822.       @selected = false
  823.     end
  824.  
  825.     def refresh
  826.       self.contents.clear
  827.       self.contents.font.name = Fantasy_CMS::FONT_NAME
  828.       self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  829.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  830.       name = "Slot #{@file_index + 1}"
  831.       self.contents.draw_text(4, 0, 600, 32, name)
  832.       @name_width = contents.text_size(name).width
  833.       if @file_exist
  834.         for i in 0...@characters.size
  835.           bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  836.           cw = bitmap.rect.width / 4
  837.           ch = bitmap.rect.height / 4
  838.           src_rect = Rect.new(0, 0, cw, ch)
  839.           x = 300 - @characters.size * 32 + i * 64 - cw / 2
  840.           self.contents.blt(x, 68 - ch, bitmap, src_rect)
  841.         end
  842.         hour = @total_sec / 60 / 60
  843.         min = @total_sec / 60 % 60
  844.         sec = @total_sec % 60
  845.         time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  846.         self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  847.         self.contents.draw_text(4, 8, 600, 32, time_string, 2)
  848.         self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  849.         time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  850.         self.contents.draw_text(4, 40, 600, 32, time_string, 2)
  851.       end
  852.     end
  853.    
  854.     def selected=(selected)
  855.       @selected = selected
  856.       update_cursor_rect
  857.     end
  858.  
  859.     def update_cursor_rect
  860.       if @selected
  861.         self.cursor_rect.set(0, 0, @name_width + 8, 32)
  862.       else
  863.         self.cursor_rect.empty
  864.       end
  865.     end
  866.   end
  867. end
  868. #===============================================================================
  869. #           END OF FANTASY_CMS MODULE
  870. #===============================================================================
  871.  
  872.  
  873. #===============================================================================
  874. # Game_Map
  875. #===============================================================================
  876. class Game_Map
  877.   def name
  878.     $map_infos[@map_id]
  879.   end
  880. end
  881.  
  882. #===============================================================================
  883. # Scene_Title
  884. #===============================================================================
  885. class Scene_Title
  886.   $map_infos = load_data("Data/MapInfos.rxdata")
  887.   for key in $map_infos.keys
  888.     $map_infos[key] = $map_infos[key].name
  889.   end
  890. end
  891.  
  892. #===============================================================================
  893. # Game_Actor
  894. #===============================================================================
  895. class Game_Actor
  896.   attr_reader :actor_id
  897. end
  898.  
  899. #===============================================================================
  900. # Window_Base
  901. #===============================================================================
  902. class Window_Base < Window
  903.   def draw_actor_name(actor, x, y)
  904.     self.contents.font.name = Fantasy_CMS::FONT_NAME
  905.     self.contents.font.color = Fantasy_CMS::FONT_COLOR
  906.     self.contents.font.size = 22
  907.     self.contents.draw_text(x, y, 120, 30, actor.name)
  908.   end
  909.  
  910.   def draw_actor_class(actor, x, y)
  911.     self.contents.font.name = Fantasy_CMS::FONT_NAME
  912.     self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  913.     self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  914.     self.contents.draw_text(x, y, 236, 30, actor.class_name)
  915.   end
  916.  
  917.   def draw_actor_level(actor, x, y)
  918.     self.contents.font.name = Fantasy_CMS::FONT_NAME
  919.     self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  920.     self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  921.     self.contents.draw_text(x, y, 40, 30, "Poziom:")
  922.     self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  923.     self.contents.draw_text(x + 45, y, 24, 30, actor.level.to_s, 2)
  924.   end
  925.  
  926.   def draw_actor_state(actor, x, y, width = 120)
  927.     self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  928.     self.contents.font.name = Fantasy_CMS::FONT_NAME
  929.     text = make_battler_state_text(actor, width, true)
  930.     self.contents.font.color = actor.hp == 0 ? knockout_color : Fantasy_CMS::FONT_COLOR2
  931.     self.contents.draw_text(x, y, width, 32, text)
  932.   end
  933.  
  934.   def draw_actor_hp(actor, x, y, width = 144)
  935.     self.contents.font.name = Fantasy_CMS::FONT_NAME
  936.     self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  937.     self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  938.     self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  939.     if width - 32 >= 108
  940.       hp_x = x + width - 108
  941.       flag = true
  942.     elsif width - 32 >= 48
  943.       hp_x = x + width - 48
  944.       flag = false
  945.     end
  946.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  947.       actor.hp <= actor.maxhp / 4 ? crisis_color : Fantasy_CMS::FONT_COLOR2
  948.     self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  949.     if flag
  950.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  951.       self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  952.       self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  953.     end
  954.   end
  955.  
  956.   def draw_actor_sp(actor, x, y, width = 144)
  957.     self.contents.font.name = Fantasy_CMS::FONT_NAME
  958.     self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  959.     self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  960.     self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  961.     if width - 32 >= 108
  962.       sp_x = x + width - 108
  963.       flag = true
  964.     elsif width - 32 >= 48
  965.       sp_x = x + width - 48
  966.       flag = false
  967.     end
  968.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  969.       actor.sp <= actor.maxsp / 4 ? crisis_color : Fantasy_CMS::FONT_COLOR2
  970.     self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  971.     if flag
  972.       self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  973.       self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  974.       self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  975.     end
  976.   end
  977.   def draw_item_name(item, x, y)
  978.     if item == nil
  979.       return
  980.     end
  981.     bitmap = RPG::Cache.icon(item.icon_name)
  982.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  983.     self.contents.font.name = Fantasy_CMS::FONT_NAME
  984.     self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  985.     self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  986.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  987.   end
  988.   def draw_actor_parameter(actor, x, y, type)
  989.     self.contents.font.name = Fantasy_CMS::FONT_NAME
  990.     self.contents.font.size = Fantasy_CMS::FONT_SIZE2
  991.     case type
  992.     when 0
  993.       parameter_name = $data_system.words.atk
  994.       parameter_value = actor.atk
  995.     when 1
  996.       parameter_name = $data_system.words.pdef
  997.       parameter_value = actor.pdef
  998.     when 2
  999.       parameter_name = $data_system.words.mdef
  1000.       parameter_value = actor.mdef
  1001.     when 3
  1002.       parameter_name = $data_system.words.str
  1003.       parameter_value = actor.str
  1004.     when 4
  1005.       parameter_name = $data_system.words.dex
  1006.       parameter_value = actor.dex
  1007.     when 5
  1008.       parameter_name = $data_system.words.agi
  1009.       parameter_value = actor.agi
  1010.     when 6
  1011.       parameter_name = $data_system.words.int
  1012.       parameter_value = actor.int
  1013.     end
  1014.     self.contents.font.color = Fantasy_CMS::FONT_COLOR_DISABLED
  1015.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  1016.     self.contents.font.color = Fantasy_CMS::FONT_COLOR2
  1017.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  1018.   end
  1019. end
  1020.  
  1021.  
  1022. #===============================================================================
  1023. # Scene_Menu
  1024. #===============================================================================
  1025. class Scene_Menu
  1026.   def initialize(menu_index = 0)
  1027.     @menu_index = menu_index
  1028.   end
  1029.  
  1030.   def main
  1031.     @appearing = true  
  1032.     @disappearing = false  
  1033.     # Wczytanie tła mapy
  1034.     @spriteset = Spriteset_Map.new
  1035.     # Wczytanie obrazku tła CMS
  1036.     @tlo = Sprite.new
  1037.     @tlo.bitmap = RPG::Cache.picture("fantasy_background")
  1038.     @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
  1039.     s1 = "Przedmioty"
  1040.     s2 = "Umiejętności"
  1041.     s3 = "Ekwipunek"
  1042.     s4 = "Status"
  1043.     s5 = "Rozdaj punkty"
  1044.     s6 = "Dziennik"
  1045.     s7 = "Bestiariusz"
  1046.     s8 = "Zapisz"
  1047.     s9 = "Wczytaj"
  1048.     s10 = "Wyjście"
  1049.     commands = [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10]
  1050.     @cmd_window = Fantasy_CMS::Window_Command.new(170, commands, true)
  1051.     @cmd_window.opacity = Fantasy_CMS::OPACITY  
  1052.     @cmd_window.x = -176
  1053.     @cmd_window.y = 60
  1054.     @cmd_window.index = @menu_index
  1055.     @status_window = Fantasy_CMS::Window_MenuStatus.new
  1056.     @location_window = Fantasy_CMS::Window_Location.new
  1057.     @gold_window = Fantasy_CMS::Window_Gold.new
  1058.     Graphics.transition
  1059.     loop do
  1060.       Graphics.update
  1061.       Input.update
  1062.       update
  1063.       if $scene != self
  1064.         break
  1065.       end
  1066.     end
  1067.     Graphics.freeze
  1068.     @spriteset.dispose
  1069.     @cmd_window.dispose
  1070.     @status_window.dispose
  1071.     @location_window.dispose
  1072.     @gold_window.dispose
  1073.     @tlo.dispose
  1074.   end
  1075.  
  1076.   # Wpływanie okienek na ekran
  1077.   def appear  
  1078.     @cmd_window.x += 8 if @cmd_window.x < 32
  1079.     @status_window.y += 10 if @status_window.y < 101
  1080.     @location_window.y -= 8 if @location_window.y > 283
  1081.     @gold_window.x -= 8 if @gold_window.x > 456
  1082.     if @location_window.y == 283 and @status_window.y == 101
  1083.       @appearing = false  
  1084.     end  
  1085.   end  
  1086.      
  1087.   # Wypływanie okienek z ekranu
  1088.   def disappear  
  1089.     @cmd_window.x -= 8 if @cmd_window.x > -176
  1090.     @status_window.y -= 10 if @status_window.y > -169
  1091.     @location_window.y += 8 if @location_window.y < 483
  1092.     @gold_window.x += 8 if @gold_window.x < 643
  1093.     if @location_window.y == 483 and @status_window.y == -169
  1094.       $scene = Scene_Map.new  
  1095.     end  
  1096.   end
  1097.  
  1098.   def update
  1099.     if @appearing    
  1100.       appear  
  1101.     end  
  1102.     if @disappearing  
  1103.       disappear  
  1104.     end
  1105.     @spriteset.update
  1106.     @cmd_window.update
  1107.     @status_window.update
  1108.     if @cmd_window.active and not @appearing
  1109.       update_command
  1110.       return
  1111.     end
  1112.     if @status_window.active
  1113.       update_status
  1114.       return
  1115.     end
  1116.   end
  1117.   def update_command
  1118.     if Input.trigger?(Input::B)
  1119.       $game_system.se_play($data_system.cancel_se)
  1120.       @disappearing = true  
  1121.       return
  1122.     end
  1123.     if Input.trigger?(Input::C)
  1124.       if $game_party.actors.size == 0 and @cmd_window.index < 4
  1125.         $game_system.se_play($data_system.buzzer_se)
  1126.         return
  1127.       end
  1128.       case @cmd_window.index
  1129.       when 0
  1130.         $game_system.se_play($data_system.decision_se)
  1131.         $scene = Scene_Item.new
  1132.       when 1
  1133.         $game_system.se_play($data_system.decision_se)
  1134.         @cmd_window.active = false
  1135.         @status_window.active = true
  1136.         @status_window.index = 0
  1137.       when 2  
  1138.         $game_system.se_play($data_system.decision_se)
  1139.         @cmd_window.active = false
  1140.         @status_window.active = true
  1141.         @status_window.index = 0
  1142.       when 3
  1143.         $game_system.se_play($data_system.decision_se)
  1144.         @cmd_window.active = false
  1145.         @status_window.active = true
  1146.         @status_window.index = 0
  1147.       when 4
  1148.         $game_system.se_play($data_system.decision_se)
  1149.         $scene = Scene_Points.new
  1150.       when 5
  1151.         $game_system.se_play($data_system.decision_se)
  1152.         $scene = Scene_Quests.new
  1153.       when 6
  1154.         $scene = Scene_MonsterBook.new
  1155.       when 7
  1156.         if $game_system.save_disabled
  1157.           $game_system.se_play($data_system.buzzer_se)
  1158.           return
  1159.         end
  1160.         $game_system.se_play($data_system.decision_se)
  1161.         $scene = Scene_Save.new
  1162.       when 8
  1163.         $game_system.se_play($data_system.decision_se)
  1164.         $scene = Scene_Load.new(1)
  1165.       when 9
  1166.         $game_system.se_play($data_system.decision_se)
  1167.         $scene = Scene_End.new
  1168.       end
  1169.       return
  1170.     end
  1171.   end
  1172.   def update_status
  1173.     if Input.trigger?(Input::B)
  1174.       $game_system.se_play($data_system.cancel_se)
  1175.       @cmd_window.active = true
  1176.       @status_window.active = false
  1177.       @status_window.index = -1
  1178.       return
  1179.     end
  1180.     if Input.trigger?(Input::C)
  1181.       case @cmd_window.index
  1182.       when 1  
  1183.         if $game_party.actors[@status_window.index].restriction >= 2
  1184.           $game_system.se_play($data_system.buzzer_se)
  1185.           return
  1186.         end
  1187.         $game_system.se_play($data_system.decision_se)
  1188.         $scene = Scene_Skill.new(@status_window.index)
  1189.       when 2  
  1190.         $game_system.se_play($data_system.decision_se)
  1191.         $scene = Scene_Equip.new(@status_window.index)
  1192.       when 3  
  1193.         $game_system.se_play($data_system.decision_se)
  1194.         $scene = Scene_Status.new(@status_window.index)
  1195.       end
  1196.       return
  1197.     end
  1198.   end
  1199. end
  1200.  
  1201. #===============================================================================
  1202. # Scene_Item
  1203. #===============================================================================
  1204. class Scene_Item
  1205.   def main
  1206.     @appearing = false  
  1207.     @disappearing = false
  1208.     # Wczytanie tła mapy
  1209.     @spriteset = Spriteset_Map.new
  1210.     # Wczytanie obrazku tła CMS
  1211.     @tlo = Sprite.new
  1212.     @tlo.bitmap = RPG::Cache.picture("fantasy_background")
  1213.     @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
  1214.     @help_window = Fantasy_CMS::Window_Help.new
  1215.     @item_window = Fantasy_CMS::Window_Item.new
  1216.     @item_window.help_window = @help_window
  1217.     @target_window = Fantasy_CMS::Window_Target.new
  1218.     @target_window.active = false
  1219.     Graphics.transition
  1220.     loop do
  1221.       Graphics.update
  1222.       Input.update
  1223.       update
  1224.       if $scene != self
  1225.         break
  1226.       end
  1227.     end
  1228.     Graphics.freeze
  1229.     @help_window.dispose
  1230.     @item_window.dispose
  1231.     @target_window.dispose
  1232.     @spriteset.dispose
  1233.     @tlo.dispose
  1234.   end
  1235.  
  1236.   def appear
  1237.     @item_window.x -= 10 if @item_window.x > 6
  1238.     @target_window.x -= 20 if @target_window.x > 340
  1239.     if @item_window.x == 6 and @target_window.x == 340
  1240.       @appearing = false
  1241.     end
  1242.   end
  1243.  
  1244.   def disappear
  1245.     @item_window.x += 10 if @item_window.x < 156
  1246.     @target_window.x += 20 if @target_window.x < 640
  1247.     if @item_window.x == 156 and @target_window.x == 640
  1248.       @disappearing = false
  1249.     end
  1250.   end
  1251.  
  1252.   def update
  1253.     appear if @appearing
  1254.     disappear if @disappearing
  1255.     @help_window.update
  1256.     @item_window.update
  1257.     @target_window.update
  1258.     @spriteset.update
  1259.     if @item_window.active and not @disappearing
  1260.       update_item
  1261.       return
  1262.     end
  1263.     if @target_window.active and not @appearing
  1264.       update_target
  1265.       return
  1266.     end
  1267.   end
  1268.  
  1269.   def update_item
  1270.     if Input.trigger?(Input::B)
  1271.       $game_system.se_play($data_system.cancel_se)
  1272.       $scene = Scene_Menu.new(0)
  1273.       return
  1274.     end
  1275.     if Input.trigger?(Input::C)
  1276.       @item = @item_window.item
  1277.       unless @item.is_a?(RPG::Item)
  1278.         $game_system.se_play($data_system.buzzer_se)
  1279.         return
  1280.       end
  1281.       unless $game_party.item_can_use?(@item.id)
  1282.         $game_system.se_play($data_system.buzzer_se)
  1283.         return
  1284.       end
  1285.       $game_system.se_play($data_system.decision_se)
  1286.       if @item.scope >= 3
  1287.         @item_window.active = false
  1288.         @target_window.active = true
  1289.         @appearing = true
  1290.         if @item.scope == 4 || @item.scope == 6
  1291.           @target_window.index = -1
  1292.         else
  1293.           @target_window.index = 0
  1294.         end
  1295.       else
  1296.         if @item.common_event_id > 0
  1297.           $game_temp.common_event_id = @item.common_event_id
  1298.           $game_system.se_play(@item.menu_se)
  1299.           if @item.consumable
  1300.             $game_party.lose_item(@item.id, 1)
  1301.             @item_window.draw_item(@item_window.index)
  1302.           end
  1303.           $scene = Scene_Map.new
  1304.           return
  1305.         end
  1306.       end
  1307.       return
  1308.     end
  1309.   end
  1310.  
  1311.   def update_target
  1312.     if Input.trigger?(Input::B)
  1313.       $game_system.se_play($data_system.cancel_se)
  1314.       unless $game_party.item_can_use?(@item.id)
  1315.         @item_window.refresh
  1316.       end
  1317.       @disappearing = true
  1318.       @item_window.active = true
  1319.       @target_window.active = false
  1320.       return
  1321.     end
  1322.     if Input.trigger?(Input::C)
  1323.       if $game_party.item_number(@item.id) == 0
  1324.         $game_system.se_play($data_system.buzzer_se)
  1325.         return
  1326.       end
  1327.       if @target_window.index == -1
  1328.         used = false
  1329.         for i in $game_party.actors
  1330.           used |= i.item_effect(@item)
  1331.         end
  1332.       end
  1333.       if @target_window.index >= 0
  1334.         target = $game_party.actors[@target_window.index]
  1335.         used = target.item_effect(@item)
  1336.       end
  1337.       if used
  1338.         $game_system.se_play(@item.menu_se)
  1339.         if @item.consumable
  1340.           $game_party.lose_item(@item.id, 1)
  1341.           @item_window.draw_item(@item_window.index)
  1342.         end
  1343.         @target_window.refresh
  1344.         if $game_party.all_dead?
  1345.           $scene = Scene_Gameover.new
  1346.           return
  1347.         end
  1348.         if @item.common_event_id > 0
  1349.           $game_temp.common_event_id = @item.common_event_id
  1350.           $scene = Scene_Map.new
  1351.           return
  1352.         end
  1353.       end
  1354.       unless used
  1355.         $game_system.se_play($data_system.buzzer_se)
  1356.       end
  1357.       return
  1358.     end
  1359.   end
  1360. end
  1361.  
  1362. #===============================================================================
  1363. # Scene_Skill
  1364. #===============================================================================
  1365. class Scene_Skill
  1366.   def initialize(actor_index = 0, equip_index = 0)
  1367.     @actor_index = actor_index
  1368.   end
  1369.  
  1370.   def main
  1371.     @appearing = false
  1372.     @disappearing = false
  1373.     # Wczytanie tła mapy
  1374.     @spriteset = Spriteset_Map.new
  1375.     # Wczytanie obrazku tła CMS
  1376.     @tlo = Sprite.new
  1377.     @tlo.bitmap = RPG::Cache.picture("fantasy_background")
  1378.     @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
  1379.     @actor = $game_party.actors[@actor_index]
  1380.     @help_window = Fantasy_CMS::Window_Help.new
  1381.     @status_window = Fantasy_CMS::Window_SkillStatus.new(@actor)
  1382.     @skill_window = Fantasy_CMS::Window_Skill.new(@actor)
  1383.     @skill_window.help_window = @help_window
  1384.     @target_window = Fantasy_CMS::Window_Target.new
  1385.     @target_window.active = false
  1386.     Graphics.transition
  1387.     loop do
  1388.       Graphics.update
  1389.       Input.update
  1390.       update
  1391.       if $scene != self
  1392.         break
  1393.       end
  1394.     end
  1395.     Graphics.freeze
  1396.     @help_window.dispose
  1397.     @status_window.dispose
  1398.     @skill_window.dispose
  1399.     @target_window.dispose
  1400.     @spriteset.dispose
  1401.     @tlo.dispose
  1402.   end
  1403.  
  1404.   def appear
  1405.     @status_window.x -= 20 if @status_window.x > -240
  1406.     @skill_window.x -= 20 if @skill_window.x > 6
  1407.     @target_window.x -= 20 if @target_window.x > 340
  1408.     if @status_window.x == -240 and @skill_window.x == 6 and @target_window.x == 340
  1409.       @appearing = false
  1410.     end
  1411.   end
  1412.  
  1413.   def disappear
  1414.     @status_window.x += 20 if @status_window.x < 40
  1415.     @skill_window.x += 20 if @skill_window.x < 266
  1416.     @target_window.x += 20 if @target_window.x < 640
  1417.     if @status_window.x == 40 and @skill_window.x == 266 and @target_window.x == 640
  1418.       @disappearing = false
  1419.     end
  1420.   end
  1421.  
  1422.   def update
  1423.     appear if @appearing
  1424.     disappear if @disappearing
  1425.     @spriteset.update
  1426.     @help_window.update
  1427.     @status_window.update
  1428.     @skill_window.update
  1429.     @target_window.update
  1430.     if @skill_window.active and not @disappearing
  1431.       update_skill
  1432.       return
  1433.     end
  1434.     if @target_window.active and not @appearing
  1435.       update_target
  1436.       return
  1437.     end
  1438.   end
  1439.  
  1440.   def update_skill
  1441.     if Input.trigger?(Input::B)
  1442.       $game_system.se_play($data_system.cancel_se)
  1443.       $scene = Scene_Menu.new(1)
  1444.       return
  1445.     end
  1446.     if Input.trigger?(Input::C)
  1447.       @skill = @skill_window.skill
  1448.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  1449.         $game_system.se_play($data_system.buzzer_se)
  1450.         return
  1451.       end
  1452.       $game_system.se_play($data_system.decision_se)
  1453.       if @skill.scope >= 3
  1454.         @skill_window.active = false
  1455.         @target_window.active = true
  1456.         @appearing = true
  1457.         if @skill.scope == 4 || @skill.scope == 6
  1458.           @target_window.index = -1
  1459.         elsif @skill.scope == 7
  1460.           @target_window.index = @actor_index - 10
  1461.         else
  1462.           @target_window.index = 0
  1463.         end
  1464.       else
  1465.         if @skill.common_event_id > 0
  1466.           $game_temp.common_event_id = @skill.common_event_id
  1467.           $game_system.se_play(@skill.menu_se)
  1468.           @actor.sp -= @skill.sp_cost
  1469.           @status_window.refresh
  1470.           @skill_window.refresh
  1471.           @target_window.refresh
  1472.           $scene = Scene_Map.new
  1473.           return
  1474.         end
  1475.       end
  1476.       return
  1477.     end
  1478.     if Input.trigger?(Input::R)
  1479.       $game_system.se_play($data_system.cursor_se)
  1480.       @actor_index += 1
  1481.       @actor_index %= $game_party.actors.size
  1482.       $scene = Scene_Skill.new(@actor_index)
  1483.       return
  1484.     end
  1485.     if Input.trigger?(Input::L)
  1486.       $game_system.se_play($data_system.cursor_se)
  1487.       @actor_index += $game_party.actors.size - 1
  1488.       @actor_index %= $game_party.actors.size
  1489.       $scene = Scene_Skill.new(@actor_index)
  1490.       return
  1491.     end
  1492.   end
  1493.  
  1494.   def update_target
  1495.     if Input.trigger?(Input::B)
  1496.       $game_system.se_play($data_system.cancel_se)
  1497.       @skill_window.active = true
  1498.       @target_window.active = false
  1499.       @disappearing = true
  1500.       return
  1501.     end
  1502.     if Input.trigger?(Input::C)
  1503.       unless @actor.skill_can_use?(@skill.id)
  1504.         $game_system.se_play($data_system.buzzer_se)
  1505.         return
  1506.       end
  1507.       if @target_window.index == -1
  1508.         used = false
  1509.         for i in $game_party.actors
  1510.           used |= i.skill_effect(@actor, @skill)
  1511.         end
  1512.       end
  1513.       if @target_window.index <= -2
  1514.         target = $game_party.actors[@target_window.index + 10]
  1515.         used = target.skill_effect(@actor, @skill)
  1516.       end
  1517.       if @target_window.index >= 0
  1518.         target = $game_party.actors[@target_window.index]
  1519.         used = target.skill_effect(@actor, @skill)
  1520.       end
  1521.       if used
  1522.         $game_system.se_play(@skill.menu_se)
  1523.         @actor.sp -= @skill.sp_cost
  1524.         @status_window.refresh
  1525.         @skill_window.refresh
  1526.         @target_window.refresh
  1527.         if $game_party.all_dead?
  1528.           $scene = Scene_Gameover.new
  1529.           return
  1530.         end
  1531.         if @skill.common_event_id > 0
  1532.           $game_temp.common_event_id = @skill.common_event_id
  1533.           $scene = Scene_Map.new
  1534.           return
  1535.         end
  1536.       end
  1537.       unless used
  1538.         $game_system.se_play($data_system.buzzer_se)
  1539.       end
  1540.       return
  1541.     end
  1542.   end
  1543. end
  1544.  
  1545. #===============================================================================
  1546. # Scene_Equip
  1547. #===============================================================================
  1548. class Scene_Equip
  1549.   def initialize(actor_index = 0, equip_index = 0)
  1550.     @actor_index = actor_index
  1551.     @equip_index = equip_index
  1552.   end
  1553.  
  1554.   def main
  1555.     # Wczytanie tła mapy
  1556.     @spriteset = Spriteset_Map.new
  1557.     # Wczytanie obrazku tła CMS
  1558.     @tlo = Sprite.new
  1559.     @tlo.bitmap = RPG::Cache.picture("fantasy_background")
  1560.     @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
  1561.     @actor = $game_party.actors[@actor_index]
  1562.     @help_window = Fantasy_CMS::Window_Help.new
  1563.     @left_window = Fantasy_CMS::Window_EquipLeft.new(@actor)
  1564.     @right_window = Fantasy_CMS::Window_EquipRight.new(@actor)
  1565.     @item_window1 = Fantasy_CMS::Window_EquipItem.new(@actor, 0)
  1566.     @item_window2 = Fantasy_CMS::Window_EquipItem.new(@actor, 1)
  1567.     @item_window3 = Fantasy_CMS::Window_EquipItem.new(@actor, 2)
  1568.     @item_window4 = Fantasy_CMS::Window_EquipItem.new(@actor, 3)
  1569.     @item_window5 = Fantasy_CMS::Window_EquipItem.new(@actor, 4)
  1570.     @right_window.help_window = @help_window
  1571.     @item_window1.help_window = @help_window
  1572.     @item_window2.help_window = @help_window
  1573.     @item_window3.help_window = @help_window
  1574.     @item_window4.help_window = @help_window
  1575.     @item_window5.help_window = @help_window
  1576.     @right_window.index = @equip_index
  1577.     refresh
  1578.     Graphics.transition
  1579.     loop do
  1580.       Graphics.update
  1581.       Input.update
  1582.       update
  1583.       if $scene != self
  1584.         break
  1585.       end
  1586.     end
  1587.     Graphics.freeze
  1588.     @help_window.dispose
  1589.     @left_window.dispose
  1590.     @right_window.dispose
  1591.     @item_window1.dispose
  1592.     @item_window2.dispose
  1593.     @item_window3.dispose
  1594.     @item_window4.dispose
  1595.     @item_window5.dispose
  1596.     @spriteset.dispose
  1597.     @tlo.dispose
  1598.   end
  1599.  
  1600.   def refresh
  1601.     @item_window1.visible = (@right_window.index == 0)
  1602.     @item_window2.visible = (@right_window.index == 1)
  1603.     @item_window3.visible = (@right_window.index == 2)
  1604.     @item_window4.visible = (@right_window.index == 3)
  1605.     @item_window5.visible = (@right_window.index == 4)
  1606.     item1 = @right_window.item
  1607.     case @right_window.index
  1608.     when 0
  1609.       @item_window = @item_window1
  1610.     when 1
  1611.       @item_window = @item_window2
  1612.     when 2
  1613.       @item_window = @item_window3
  1614.     when 3
  1615.       @item_window = @item_window4
  1616.     when 4
  1617.       @item_window = @item_window5
  1618.     end
  1619.     if @right_window.active
  1620.       @left_window.set_new_parameters(nil, nil, nil)
  1621.     end
  1622.     if @item_window.active
  1623.       item2 = @item_window.item
  1624.       last_hp = @actor.hp
  1625.       last_sp = @actor.sp
  1626.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  1627.       new_atk = @actor.atk
  1628.       new_pdef = @actor.pdef
  1629.       new_mdef = @actor.mdef
  1630.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  1631.       @actor.hp = last_hp
  1632.       @actor.sp = last_sp
  1633.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  1634.     end
  1635.   end
  1636.  
  1637.   def update
  1638.     @left_window.update
  1639.     @right_window.update
  1640.     @item_window.update
  1641.     @spriteset.update
  1642.     refresh
  1643.     if @right_window.active
  1644.       update_right
  1645.       return
  1646.     end
  1647.     if @item_window.active
  1648.       update_item
  1649.       return
  1650.     end
  1651.   end
  1652.  
  1653.   def update_right
  1654.     if Input.trigger?(Input::B)
  1655.       $game_system.se_play($data_system.cancel_se)
  1656.       $scene = Scene_Menu.new(2)
  1657.       return
  1658.     end
  1659.     if Input.trigger?(Input::C)
  1660.       if @actor.equip_fix?(@right_window.index)
  1661.         $game_system.se_play($data_system.buzzer_se)
  1662.         return
  1663.       end
  1664.       $game_system.se_play($data_system.decision_se)
  1665.       @right_window.active = false
  1666.       @item_window.active = true
  1667.       @item_window.index = 0
  1668.       return
  1669.     end
  1670.     if Input.trigger?(Input::R)
  1671.       $game_system.se_play($data_system.cursor_se)
  1672.       @actor_index += 1
  1673.       @actor_index %= $game_party.actors.size
  1674.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1675.       return
  1676.     end
  1677.     if Input.trigger?(Input::L)
  1678.       $game_system.se_play($data_system.cursor_se)
  1679.       @actor_index += $game_party.actors.size - 1
  1680.       @actor_index %= $game_party.actors.size
  1681.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1682.       return
  1683.     end
  1684.   end
  1685.  
  1686.   def update_item
  1687.     if Input.trigger?(Input::B)
  1688.       $game_system.se_play($data_system.cancel_se)
  1689.       @right_window.active = true
  1690.       @item_window.active = false
  1691.       @item_window.index = -1
  1692.       return
  1693.     end
  1694.     if Input.trigger?(Input::C)
  1695.       $game_system.se_play($data_system.equip_se)
  1696.       item = @item_window.item
  1697.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  1698.       @right_window.active = true
  1699.       @item_window.active = false
  1700.       @item_window.index = -1
  1701.       @right_window.refresh
  1702.       @item_window.refresh
  1703.       return
  1704.     end
  1705.   end
  1706. end
  1707.  
  1708. #===============================================================================
  1709. # Scene_Status
  1710. #===============================================================================
  1711. class Scene_Status
  1712.   def initialize(actor_index = 0, equip_index = 0)
  1713.     @actor_index = actor_index
  1714.   end
  1715.  
  1716.   def main
  1717.     # Wczytanie tła mapy
  1718.     @spriteset = Spriteset_Map.new
  1719.     # Wczytanie obrazku tła CMS
  1720.     @tlo = Sprite.new
  1721.     @tlo.bitmap = RPG::Cache.picture("fantasy_background")
  1722.     @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
  1723.     @actor = $game_party.actors[@actor_index]
  1724.     @info_window = Fantasy_CMS::Window_StatusInfo.new(@actor)
  1725.     @equip_window = Fantasy_CMS::Window_StatusEquip.new(@actor)
  1726.     @parameters_window = Fantasy_CMS::Window_StatusParameters.new(@actor)
  1727.     if Fantasy_CMS::ACTOR_DESCRIPTION[@actor.actor_id] != nil
  1728.       @description_window = Fantasy_CMS::Window_StatusDescription.new(@actor)
  1729.     else
  1730.       @info_window.x = 170
  1731.     end
  1732.     Graphics.transition
  1733.     loop do
  1734.       Graphics.update
  1735.       Input.update
  1736.       update
  1737.       if $scene != self
  1738.         break
  1739.       end
  1740.     end
  1741.     Graphics.freeze
  1742.     @info_window.dispose
  1743.     @equip_window.dispose
  1744.     @parameters_window.dispose
  1745.     @spriteset.dispose
  1746.     @tlo.dispose
  1747.     @description_window.dispose unless @description_window == nil
  1748.   end
  1749.  
  1750.   def update
  1751.     @spriteset.update
  1752.     if Input.trigger?(Input::B)
  1753.       $game_system.se_play($data_system.cancel_se)
  1754.       $scene = Scene_Menu.new(3)
  1755.       return
  1756.     end
  1757.     if Input.trigger?(Input::R)
  1758.       $game_system.se_play($data_system.cursor_se)
  1759.       @actor_index += 1
  1760.       @actor_index %= $game_party.actors.size
  1761.       $scene = Scene_Status.new(@actor_index)
  1762.       return
  1763.     end
  1764.     if Input.trigger?(Input::L)
  1765.       $game_system.se_play($data_system.cursor_se)
  1766.       @actor_index += $game_party.actors.size - 1
  1767.       @actor_index %= $game_party.actors.size
  1768.       $scene = Scene_Status.new(@actor_index)
  1769.       return
  1770.     end
  1771.   end
  1772. end
  1773.  
  1774. #===============================================================================
  1775. # Scene_File
  1776. #===============================================================================
  1777. class Scene_File
  1778.   def initialize(help_text)
  1779.     @help_text = help_text
  1780.   end
  1781.  
  1782.   def main
  1783.     # Wczytanie obrazku tła CMS
  1784.     @tlo = Sprite.new
  1785.     @tlo.bitmap = RPG::Cache.picture("fantasy_background")
  1786.     @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
  1787.     @help_window = Fantasy_CMS::Window_Help.new
  1788.     @help_window.y = 0
  1789.     @help_window.set_text(@help_text)
  1790.     @savefile_windows = []
  1791.     for i in 0..3
  1792.       @savefile_windows.push(Fantasy_CMS::Window_SaveFile.new(i, make_filename(i)))
  1793.     end
  1794.     @file_index = $game_temp.last_file_index
  1795.     @savefile_windows[@file_index].selected = true
  1796.     Graphics.transition
  1797.     loop do
  1798.       Graphics.update
  1799.       Input.update
  1800.       update
  1801.       if $scene != self
  1802.         break
  1803.       end
  1804.     end
  1805.     Graphics.freeze
  1806.     @help_window.dispose
  1807.     @tlo.dispose
  1808.     for i in @savefile_windows
  1809.       i.dispose
  1810.     end
  1811.   end
  1812.  
  1813.   def update
  1814.     @help_window.update
  1815.     for i in @savefile_windows
  1816.       i.update
  1817.     end
  1818.     if Input.trigger?(Input::C)
  1819.       on_decision(make_filename(@file_index))
  1820.       $game_temp.last_file_index = @file_index
  1821.       return
  1822.     end
  1823.     if Input.trigger?(Input::B)
  1824.       on_cancel
  1825.       return
  1826.     end
  1827.     if Input.repeat?(Input::DOWN)
  1828.       if Input.trigger?(Input::DOWN) or @file_index < 3
  1829.         $game_system.se_play($data_system.cursor_se)
  1830.         @savefile_windows[@file_index].selected = false
  1831.         @file_index = (@file_index + 1) % 4
  1832.         @savefile_windows[@file_index].selected = true
  1833.         return
  1834.       end
  1835.     end
  1836.     if Input.repeat?(Input::UP)
  1837.       if Input.trigger?(Input::UP) or @file_index > 0
  1838.         $game_system.se_play($data_system.cursor_se)
  1839.         @savefile_windows[@file_index].selected = false
  1840.         @file_index = (@file_index + 3) % 4
  1841.         @savefile_windows[@file_index].selected = true
  1842.         return
  1843.       end
  1844.     end
  1845.   end
  1846.  
  1847.   def make_filename(file_index)
  1848.     return "Save#{file_index + 1}.rxdata"
  1849.   end
  1850. end
  1851.  
  1852. #===============================================================================
  1853. # Scene_Save
  1854. #===============================================================================
  1855. class Scene_Save < Scene_File
  1856.   def initialize
  1857.     super("Na którym slocie chcesz zapisać grę?")
  1858.   end
  1859.  
  1860.   def on_decision(filename)
  1861.     $game_system.se_play($data_system.save_se)
  1862.     file = File.open(filename, "wb")
  1863.     write_save_data(file)
  1864.     file.close
  1865.     if $game_temp.save_calling
  1866.       $game_temp.save_calling = false
  1867.       $scene = Scene_Map.new
  1868.       return
  1869.     end
  1870.     $scene = Scene_Menu.new(4)
  1871.   end
  1872.  
  1873.   def on_cancel
  1874.     $game_system.se_play($data_system.cancel_se)
  1875.     if $game_temp.save_calling
  1876.       $game_temp.save_calling = false
  1877.       $scene = Scene_Map.new
  1878.       return
  1879.     end
  1880.     $scene = Scene_Menu.new(4)
  1881.   end
  1882.  
  1883.   def write_save_data(file)
  1884.     characters = []
  1885.     for i in 0...$game_party.actors.size
  1886.       actor = $game_party.actors[i]
  1887.       characters.push([actor.character_name, actor.character_hue])
  1888.     end
  1889.     Marshal.dump(characters, file)
  1890.     Marshal.dump(Graphics.frame_count, file)
  1891.     $game_system.save_count += 1
  1892.     $game_system.magic_number = $data_system.magic_number
  1893.     Marshal.dump($game_system, file)
  1894.     Marshal.dump($game_switches, file)
  1895.     Marshal.dump($game_variables, file)
  1896.     Marshal.dump($game_self_switches, file)
  1897.     Marshal.dump($game_screen, file)
  1898.     Marshal.dump($game_actors, file)
  1899.     Marshal.dump($game_party, file)
  1900.     Marshal.dump($game_troop, file)
  1901.     Marshal.dump($game_map, file)
  1902.     Marshal.dump($game_player, file)
  1903.   end
  1904. end
  1905.  
  1906. #===============================================================================
  1907. # Scene_Load
  1908. #===============================================================================
  1909. class Scene_Load < Scene_File
  1910.   def initialize(esc_option = 0)
  1911.     @esc_option = esc_option # 0 - to title, 1 - to menu
  1912.     $game_temp = Game_Temp.new
  1913.     $game_temp.last_file_index = 0
  1914.     latest_time = Time.at(0)
  1915.     for i in 0..3
  1916.       filename = make_filename(i)
  1917.       if FileTest.exist?(filename)
  1918.         file = File.open(filename, "r")
  1919.         if file.mtime > latest_time
  1920.           latest_time = file.mtime
  1921.           $game_temp.last_file_index = i
  1922.         end
  1923.         file.close
  1924.       end
  1925.     end
  1926.     super("Który slot chciałbyś wczytać?")
  1927.   end
  1928.  
  1929.   def on_decision(filename)
  1930.     unless FileTest.exist?(filename)
  1931.       $game_system.se_play($data_system.buzzer_se)
  1932.       return
  1933.     end
  1934.     $game_system.se_play($data_system.load_se)
  1935.     file = File.open(filename, "rb")
  1936.     read_save_data(file)
  1937.     file.close
  1938.     $game_system.bgm_play($game_system.playing_bgm)
  1939.     $game_system.bgs_play($game_system.playing_bgs)
  1940.     $game_map.update
  1941.     $scene = Scene_Map.new
  1942.   end
  1943.  
  1944.   def on_cancel
  1945.     $game_system.se_play($data_system.cancel_se)
  1946.     $scene = @esc_option == 0 ? Scene_Title.new : Scene_Menu.new(5)
  1947.   end
  1948.  
  1949.   def read_save_data(file)
  1950.     characters = Marshal.load(file)
  1951.     Graphics.frame_count = Marshal.load(file)
  1952.     $game_system        = Marshal.load(file)
  1953.     $game_switches      = Marshal.load(file)
  1954.     $game_variables     = Marshal.load(file)
  1955.     $game_self_switches = Marshal.load(file)
  1956.     $game_screen        = Marshal.load(file)
  1957.     $game_actors        = Marshal.load(file)
  1958.     $game_party         = Marshal.load(file)
  1959.     $game_troop         = Marshal.load(file)
  1960.     $game_map           = Marshal.load(file)
  1961.     $game_player        = Marshal.load(file)
  1962.     if $game_system.magic_number != $data_system.magic_number
  1963.       $game_map.setup($game_map.map_id)
  1964.       $game_player.center($game_player.x, $game_player.y)
  1965.     end
  1966.     $game_party.refresh
  1967.   end
  1968. end
  1969.  
  1970. #===============================================================================
  1971. # Scene_End
  1972. #===============================================================================
  1973. class Scene_End
  1974.   def main
  1975.     # Wczytanie tła mapy
  1976.     @spriteset = Spriteset_Map.new
  1977.     # Wczytanie obrazku tła CMS
  1978.     @tlo = Sprite.new
  1979.     @tlo.bitmap = RPG::Cache.picture("fantasy_background")
  1980.     @tlo.opacity = Fantasy_CMS::BACKGROUND_OPACITY
  1981.     s1 = "Menu Główne"
  1982.     s2 = "Wyjście"
  1983.     s3 = "Anuluj"
  1984.     @command_window = Fantasy_CMS::Window_Command.new(192, [s1, s2, s3])
  1985.     @command_window.x = 320 - @command_window.width / 2
  1986.     @command_window.y = 240 - @command_window.height / 2
  1987.     Graphics.transition
  1988.     loop do
  1989.       Graphics.update
  1990.       Input.update
  1991.       update
  1992.       if $scene != self
  1993.         break
  1994.       end
  1995.     end
  1996.     Graphics.freeze
  1997.     @command_window.dispose
  1998.     @spriteset.dispose
  1999.     @tlo.dispose
  2000.     if $scene.is_a?(Scene_Title)
  2001.       Graphics.transition
  2002.       Graphics.freeze
  2003.     end
  2004.   end
  2005.  
  2006.   def update
  2007.     @spriteset.update
  2008.     @command_window.update
  2009.     if Input.trigger?(Input::B)
  2010.       $game_system.se_play($data_system.cancel_se)
  2011.       $scene = Scene_Menu.new(6)
  2012.       return
  2013.     end
  2014.     if Input.trigger?(Input::C)
  2015.       case @command_window.index
  2016.       when 0  # to title
  2017.         command_to_title
  2018.       when 1  # shutdown
  2019.         command_shutdown
  2020.       when 2  # quit
  2021.         command_cancel
  2022.       end
  2023.       return
  2024.     end
  2025.   end
  2026.  
  2027.   def command_to_title
  2028.     $game_system.se_play($data_system.decision_se)
  2029.     Audio.bgm_fade(800)
  2030.     Audio.bgs_fade(800)
  2031.     Audio.me_fade(800)
  2032.     $scene = Scene_Title.new
  2033.   end
  2034.  
  2035.   def command_shutdown
  2036.     $game_system.se_play($data_system.decision_se)
  2037.     Audio.bgm_fade(800)
  2038.     Audio.bgs_fade(800)
  2039.     Audio.me_fade(800)
  2040.     $scene = nil
  2041.   end
  2042.  
  2043.   def command_cancel
  2044.     $game_system.se_play($data_system.decision_se)
  2045.     $scene = Scene_Menu.new(6)
  2046.   end
  2047. end
Advertisement
Add Comment
Please, Sign In to add comment