Guest User

cms

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