dsiver144

Dark's Weapon/Armor Encyclopedia

Jun 4th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.97 KB | None | 0 0
  1. #===============================================================================
  2. # Name: Dark's Weapon/Armor Encyclopedia
  3. # Author: Nhat Nguyen (Dark Sky)
  4. # Released on: June 5th 2016
  5. #-------------------------------------------------------------------------------
  6. # Version 1.0: Released!
  7. # Version 2.0: Add Armor Encyclopedia. (June 6th 2016)
  8. #-------------------------------------------------------------------------------
  9. # Script call:
  10. # + Open weapon scene: SceneManager.call(Scene_WeaponPedia)
  11. # + Open armor scene: SceneManager.call(Scene_ArmorPedia)
  12. #-------------------------------------------------------------------------------
  13. # Item will be added to the pedia automatically when recive a weapon or an armor.
  14. #===============================================================================
  15. module DarkCreation
  16. module WeaponEncyclopedia
  17. #------------------------------------------------------------------------
  18. # * Get Weapon Category
  19. #------------------------------------------------------------------------
  20. def self.get_weapon_category
  21. wp_categories = []
  22. $data_system.weapon_types.each do |cate|
  23. next if cate == ""
  24. wp_categories.push( cate )
  25. end
  26. return wp_categories
  27. end
  28. end #WeaponEncyclopedia End
  29. module ArmorEncyclopedia
  30. #------------------------------------------------------------------------
  31. # * Get Weapon Category
  32. #------------------------------------------------------------------------
  33. def self.get_armor_category
  34. am_categories = []
  35. $data_system.armor_types.each do |cate|
  36. next if cate == ""
  37. am_categories.push( cate )
  38. end
  39. return am_categories
  40. end
  41. end #ArmorEncyclopedia End
  42. end #DarkCreatin End
  43. class Game_System
  44. attr_accessor :wpedia_list
  45. attr_accessor :apedia_list
  46. alias_method(:dark_wp_pedia_original_initialize,:initialize)
  47. def initialize
  48. @wpedia_list = []
  49. @apedia_list = []
  50. dark_wp_pedia_original_initialize()
  51. end
  52. end
  53. class Game_Interpreter
  54. alias_method(:dark_command_127_original,:command_127)
  55. alias_method(:dark_command_128_original,:command_128)
  56. #--------------------------------------------------------------------------
  57. # * Change Weapons
  58. #--------------------------------------------------------------------------
  59. def command_127
  60. dark_command_127_original()
  61. $game_system.wpedia_list.push($data_weapons[@params[0]].id)
  62. $game_system.wpedia_list.uniq!
  63. end
  64. #--------------------------------------------------------------------------
  65. # * Change Armor
  66. #--------------------------------------------------------------------------
  67. def command_128
  68. dark_command_128_original()
  69. $game_system.apedia_list.push($data_armors[@params[0]].id)
  70. $game_system.apedia_list.uniq!
  71. end
  72. end
  73.  
  74. class Scene_WeaponPedia < Scene_Base
  75. #--------------------------------------------------------------------------
  76. # * Start Processing
  77. #--------------------------------------------------------------------------
  78. def start
  79. super
  80. create_windows
  81. end
  82. #--------------------------------------------------------------------------
  83. # * Create Windows
  84. #--------------------------------------------------------------------------
  85. def create_windows
  86. @title_window = Window_WeaponPediaTitle.new
  87. @cate_window = Window_WeaponPediaCategory.new
  88. @cate_window.y = @title_window.height
  89. @info_window = Window_WeaponPediaInfo.new
  90. @info_window.y = @title_window.height
  91. @info_window.x = @cate_window.width
  92. @item_list = Window_WeaponPediaList.new
  93. @item_list.info_window = @info_window
  94. @item_list.y = @cate_window.y + @cate_window.height
  95. end
  96. def update
  97. super
  98. if Input.trigger?(:B)
  99. terminate
  100. return_scene
  101. end
  102. end
  103. end
  104. include DarkCreation::WeaponEncyclopedia
  105. TOKEN = /w_(\d+)/i #Please don't change this!
  106. TOKENA = /a_(\d+)/i
  107. class Window_WeaponPediaTitle < Window_Base
  108. #--------------------------------------------------------------------------
  109. # * Initialize
  110. #--------------------------------------------------------------------------
  111. def initialize
  112. super(0,0,Graphics.width,54)
  113. contents.font.size = 25
  114. contents.font.name = ["04b_19"]
  115. rect = contents.rect
  116. rect.y += 3
  117. contents.draw_text(rect,"WEAPON ENCYCLOPEDIA",1)
  118. end
  119. end
  120.  
  121. class Window_WeaponPediaCategory < Window_Base
  122. #--------------------------------------------------------------------------
  123. # * Initialize
  124. #--------------------------------------------------------------------------
  125. def initialize
  126. super(0,0,195,54)
  127. contents.font.name = ["04b_19"]
  128. contents.font.size = 15
  129. rect = contents.rect
  130. rect.y += 3
  131. contents.draw_text(rect,"WEAPON CATEGORIES",1)
  132. end
  133. end
  134.  
  135. class Window_WeaponPediaInfo < Window_Base
  136. attr_accessor :display
  137. #--------------------------------------------------------------------------
  138. # * Initialize
  139. #--------------------------------------------------------------------------
  140. def initialize
  141. super(0,0,Graphics.width - 195,Graphics.height - 54)
  142. contents.font.name = ["04b_19"]
  143. contents.font.size = 15
  144. display_no
  145. end
  146. #--------------------------------------------------------------------------
  147. # * Display no
  148. #--------------------------------------------------------------------------
  149. def display_no
  150. contents.clear
  151. if @spr_help
  152. @spr_help.bitmap.dispose
  153. @spr_help.dispose
  154. end
  155. @display = false
  156. contents.draw_text(contents.rect,"Choose a weapon to display!",1)
  157. end
  158. #--------------------------------------------------------------------------
  159. # * Draw Icon
  160. # enabled : Enabled flag. When false, draw semi-transparently.
  161. #--------------------------------------------------------------------------
  162. def draw_icon2(icon_index, x, y, enabled = true)
  163. bitmap = Cache.system("Iconset")
  164. rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  165. rect2 = Rect.new(x, y, 64, 64)
  166. contents.stretch_blt(rect2, bitmap, rect,enabled ? 255 : translucent_alpha)
  167. end
  168. #--------------------------------------------------------------------------
  169. # * Display Normal
  170. #--------------------------------------------------------------------------
  171. def display_normal(wp_index)
  172. contents.clear
  173. if @spr_help
  174. @spr_help.bitmap.dispose
  175. @spr_help.dispose
  176. end
  177. @display = true
  178. wp = $data_weapons[wp_index]
  179. contents.fill_rect(0,0,65,65,Color.new(0,0,0,translucent_alpha))
  180. draw_icon2(wp.icon_index,1,1)
  181. name_rect = Rect.new(70,0,250,64)
  182. name_rect.y += 5
  183. name_rect.y -= line_height/2
  184. contents.font.size = 23
  185. contents.font.color = Color.new(255,128,0)
  186. draw_text(name_rect, wp.name,1)
  187. contents.font.size = 15
  188. name_rect.y += line_height
  189. contents.font.color = Color.new(255,255,255)
  190. draw_text(name_rect, "Price: #{wp.price}",1)
  191. contents.fill_rect(0,68,contents.width,40,Color.new(0,0,0,translucent_alpha))
  192. @viewport ||= Viewport.new(207,134,325,40)
  193. @viewport.z = 100
  194. @spr_help = Sprite.new(@viewport)
  195. @spr_help.bitmap = Bitmap.new(1280*3,40)
  196. @spr_help.bitmap.font.size = 17
  197. @spr_help.bitmap.font.bold = true
  198. @spr_help.bitmap.font.outline = false
  199. @des_text = wp.description
  200. @spr_help.bitmap.draw_text(0,5,1280*3,24,@des_text)
  201. @spr_help.oy -= 5
  202. @spr_help.ox = @scroll_pos = -30
  203. @atk_color1 = Color.new(255,140,0)
  204. @atk_color2 = Color.new(255,69,0)
  205. @def_color1 = Color.new(0,255,0)
  206. @def_color2 = Color.new(50,205,50)
  207. @mat_color1 = Color.new(75,0,130)
  208. @mat_color2 = Color.new(138,43,226)
  209. @mdf_color1 = Color.new(0,206,209)
  210. @mdf_color2 = Color.new(64,224,208)
  211. @mhp_color1 = Color.new(255,0,0)
  212. @mhp_color2 = Color.new(200,100,100)
  213. @agi_color1 = Color.new(199,21,133)
  214. @agi_color2 = Color.new(219,112,147)
  215. @luk_color1 = Color.new(255,255,0)
  216. @luk_color2 = Color.new(255,215,0)
  217. @mmp_color1 = Color.new(30,144,255)
  218. @mmp_color2 = Color.new(0,191,255)
  219. x = 10
  220. y = 170
  221. @rate = wp.params[2].to_f/500.to_f
  222. draw_cir_gauge(x,y,x+65,y+65,@atk_color1,@atk_color2,-@rate,"ATK")
  223. x += 80
  224. @rate = wp.params[3].to_f/500.to_f
  225. draw_cir_gauge(x,y,x+65,y+65,@def_color1,@def_color2,-@rate,"DEF")
  226. x += 80
  227. @rate = wp.params[4].to_f/500.to_f
  228. draw_cir_gauge(x,y,x+65,y+65,@mat_color1,@mat_color2,-@rate,"MAT")
  229. x += 80
  230. @rate = wp.params[4].to_f/500.to_f
  231. draw_cir_gauge(x,y,x+65,y+65,@mdf_color1,@mdf_color2,-@rate,"MDF")
  232. x = 10
  233. y += 80
  234. @rate = wp.params[5].to_f/500.to_f
  235. draw_cir_gauge(x,y,x+65,y+65,@agi_color1,@agi_color2,-@rate,"AGI")
  236. x += 80
  237. @rate = wp.params[6].to_f/500.to_f
  238. draw_cir_gauge(x,y,x+65,y+65,@luk_color1,@luk_color2,-@rate,"LUK")
  239. x += 80
  240. @rate = wp.params[0].to_f/5000.to_f
  241. draw_cir_gauge(x,y,x+65,y+65,@mhp_color1,@mhp_color2,-@rate,"MHP",true)
  242. x += 80
  243. @rate = wp.params[1].to_f/5000.to_f
  244. draw_cir_gauge(x,y,x+65,y+65,@mmp_color1,@mmp_color2,-@rate,"MMP",true)
  245. contents.font.size = 22
  246. contents.draw_text(-10,68+40+15,Graphics.width - 195,24,"STATS",1)
  247. end
  248. #--------------------------------------------------------------------------
  249. # * Draw Circular Gauge
  250. #--------------------------------------------------------------------------
  251. def draw_cir_gauge(x1,y1,x2,y2,color1,color2,rate,text,is_hp_mp=false)
  252. contents.line_start_cap = 2
  253. contents.line_end_cap = 2
  254. contents.simple_draw_arc( x1, y1, x2, y2, Color.new(255,255,255), 90 , 360 ,10)
  255. contents.simple_draw_arc( x1, y1, x2, y2, Color.new(0,0,0,200) , 90 , 360 ,8)
  256. contents.draw_arc( x1, y1, x2, y2, x1, y1, x2 , y2 ,color1,color2,90,rate*360,7)
  257. contents.font.color = color2
  258. draw_text(x1+18,y1+10,65,24,text)
  259. rect = Rect.new(x1,y1,65,70)
  260. rect.y += 3
  261. rect.x += 1
  262. if is_hp_mp == true
  263. draw_text(rect,"#{@rate*5000}",1)
  264. else
  265. draw_text(rect,"#{@rate*500.to_i}",1)
  266. end
  267. end
  268. #--------------------------------------------------------------------------
  269. # * Dispose
  270. #--------------------------------------------------------------------------
  271. def dispose
  272. super
  273. if @spr_help && !@spr_help.disposed?
  274. @spr_help.bitmap.dispose
  275. @spr_help.dispose
  276. end
  277. @viewport.dispose if @viewport
  278. end
  279. #--------------------------------------------------------------------------
  280. # * Cal Text Width
  281. #--------------------------------------------------------------------------
  282. def cal_text_width(text)
  283. size = 0
  284. for i in 0...text.size
  285. size += text_size(text[i]).width
  286. end
  287. return size
  288. end
  289. #--------------------------------------------------------------------------
  290. # * Update
  291. #--------------------------------------------------------------------------
  292. def update
  293. super
  294. if @spr_help && self.display
  295. @spr_help.ox = @scroll_pos
  296. @scroll_pos += 1
  297. if @scroll_pos > cal_text_width(@des_text)*0.6 + 40*2
  298. @scroll_pos = -325
  299. @spr_help.ox = @scroll_pos
  300. end
  301. end
  302. end
  303. end
  304.  
  305. class Window_WeaponPediaList < Window_Command
  306. attr_accessor :info_window
  307. #--------------------------------------------------------------------------
  308. # * Initialize
  309. #--------------------------------------------------------------------------
  310. def initialize
  311. super(0,0)
  312. set_handlers
  313. end
  314. #--------------------------------------------------------------------------
  315. # * Get Window Width
  316. #--------------------------------------------------------------------------
  317. def window_width
  318. return 195
  319. end
  320. #--------------------------------------------------------------------------
  321. # * Get Window Height
  322. #--------------------------------------------------------------------------
  323. def window_height
  324. 308
  325. end
  326. #--------------------------------------------------------------------------
  327. # * Create Command List
  328. #--------------------------------------------------------------------------
  329. def make_command_list
  330. @categories = DarkCreation::WeaponEncyclopedia.get_weapon_category
  331. @weapon_list = $game_system.wpedia_list
  332. @expand_status = {}
  333. @categories.each do |cate|
  334. add_command(cate,cate.to_sym,true)
  335. @expand_status[cate.to_sym] = false
  336. end
  337. end
  338. #--------------------------------------------------------------------------
  339. # * Create New Command List
  340. #--------------------------------------------------------------------------
  341. def make_new_command_list
  342. @child = []
  343. @categories.each do |cate|
  344. add_command(cate,cate.to_sym,true)
  345. if @expand_status[cate.to_sym]
  346. @weapon_list.each do |index|
  347. wptype = $data_weapons[index].wtype_id
  348. name = $data_weapons[index].name
  349. if $data_system.weapon_types[wptype].to_sym == cate.to_sym
  350. @child.push(["w_#{index}".to_sym,index])
  351. add_command(name,"w_#{index}".to_sym,true)
  352. end
  353. end
  354. end
  355. end
  356. end
  357. #--------------------------------------------------------------------------
  358. # * Set handler
  359. #--------------------------------------------------------------------------
  360. def set_handlers
  361. @categories.each do |cate|
  362. set_handler(cate.to_sym, method(:extract_small_commands))
  363. end
  364. end
  365. #--------------------------------------------------------------------------
  366. # * Set handler
  367. #--------------------------------------------------------------------------
  368. def set_handlers_new
  369. @categories.each do |cate|
  370. set_handler(cate.to_sym, method(:extract_small_commands))
  371. end
  372. @child.each do |sym|
  373. set_handler(sym[0], method(:on_wp_click))
  374. end
  375. end
  376. #--------------------------------------------------------------------------
  377. # * On Weapon Choose
  378. #--------------------------------------------------------------------------
  379. def on_wp_click
  380. if @list[@index][:symbol].to_s =~ TOKEN
  381. @info_window.display_normal($1.to_i)
  382. end #$data_weapons[
  383. activate
  384. end
  385. #--------------------------------------------------------------------------
  386. # * Check for current expand status
  387. #--------------------------------------------------------------------------
  388. def current_expand_status
  389. return @expand_status[@list[@index][:symbol]]
  390. end
  391. #--------------------------------------------------------------------------
  392. # * Update Cursor
  393. #--------------------------------------------------------------------------
  394. def update_cursor
  395. if @cursor_all
  396. cursor_rect.set(0, 0, contents.width, row_max * item_height)
  397. self.top_row = 0
  398. elsif @index < 0
  399. cursor_rect.empty
  400. else
  401. ensure_cursor_visible
  402. rect = item_rect(@index)
  403. if @list[@index][:symbol].to_s.include?("w_")
  404. rect.x += 10
  405. rect.width -= 10
  406. else
  407. @info_window.display_no if @info_window && @info_window.display
  408. end
  409. cursor_rect.set(rect)
  410. end
  411. end
  412. #--------------------------------------------------------------------------
  413. # * Draw Item
  414. #--------------------------------------------------------------------------
  415. def draw_item(index)
  416. if @expand_status[@list[index][:symbol]]
  417. change_color(crisis_color, command_enabled?(index))
  418. else
  419. change_color(normal_color, command_enabled?(index))
  420. end
  421. rect = item_rect_for_text(index)
  422. rect.y += 2
  423. if @list[index][:symbol].to_s.include?("w_")
  424. rect.x += 10
  425. contents.font.name = Font.default_name
  426. contents.font.size = 18
  427. else
  428. contents.font.name = ["04b_19"]
  429. contents.font.size = 15
  430. end
  431. draw_text(rect, command_name(index), alignment)
  432. end
  433. #--------------------------------------------------------------------------
  434. # * Invert expand status
  435. #--------------------------------------------------------------------------
  436. def invert_expand_status
  437. if current_expand_status
  438. @expand_status[@list[@index][:symbol]] = false
  439. else
  440. @expand_status[@list[@index][:symbol]] = true
  441. end
  442. end
  443. #--------------------------------------------------------------------------
  444. # * Extract small commands
  445. #--------------------------------------------------------------------------
  446. def extract_small_commands
  447. invert_expand_status
  448. activate
  449. clear_command_list
  450. make_new_command_list
  451. set_handlers_new
  452. contents.clear
  453. create_contents
  454. draw_all_items
  455. end
  456. end
  457.  
  458. class Scene_ArmorPedia < Scene_Base
  459. #--------------------------------------------------------------------------
  460. # * Start Processing
  461. #--------------------------------------------------------------------------
  462. def start
  463. super
  464. create_windows
  465. end
  466. #--------------------------------------------------------------------------
  467. # * Create Windows
  468. #--------------------------------------------------------------------------
  469. def create_windows
  470. @title_window = Window_ArmorPediaTitle.new
  471. @cate_window = Window_ArmorPediaCategory.new
  472. @cate_window.y = @title_window.height
  473. @info_window = Window_ArmorPediaInfo.new
  474. @info_window.y = @title_window.height
  475. @info_window.x = @cate_window.width
  476. @item_list = Window_ArmorPediaList.new
  477. @item_list.info_window = @info_window
  478. @item_list.y = @cate_window.y + @cate_window.height
  479. end
  480. def update
  481. super
  482. if Input.trigger?(:B)
  483. terminate
  484. return_scene
  485. end
  486. end
  487. end
  488. include DarkCreation::ArmorEncyclopedia
  489. #TOKEN = /a_(\d+)/i #Please don't change this!
  490. class Window_ArmorPediaTitle < Window_Base
  491. #--------------------------------------------------------------------------
  492. # * Initialize
  493. #--------------------------------------------------------------------------
  494. def initialize
  495. super(0,0,Graphics.width,54)
  496. contents.font.size = 25
  497. contents.font.name = ["04b_19"]
  498. rect = contents.rect
  499. rect.y += 3
  500. contents.draw_text(rect,"ARMOR ENCYCLOPEDIA",1)
  501. end
  502. end
  503.  
  504. class Window_ArmorPediaCategory < Window_Base
  505. #--------------------------------------------------------------------------
  506. # * Initialize
  507. #--------------------------------------------------------------------------
  508. def initialize
  509. super(0,0,195,54)
  510. contents.font.name = ["04b_19"]
  511. contents.font.size = 15
  512. rect = contents.rect
  513. rect.y += 3
  514. contents.draw_text(rect,"ARMOR CATEGORIES",1)
  515. end
  516. end
  517.  
  518. class Window_ArmorPediaInfo < Window_Base
  519. attr_accessor :display
  520. #--------------------------------------------------------------------------
  521. # * Initialize
  522. #--------------------------------------------------------------------------
  523. def initialize
  524. super(0,0,Graphics.width - 195,Graphics.height - 54)
  525. contents.font.name = ["04b_19"]
  526. contents.font.size = 15
  527. display_no
  528. end
  529. #--------------------------------------------------------------------------
  530. # * Display no
  531. #--------------------------------------------------------------------------
  532. def display_no
  533. contents.clear
  534. if @spr_help
  535. @spr_help.bitmap.dispose
  536. @spr_help.dispose
  537. end
  538. @display = false
  539. contents.draw_text(contents.rect,"Choose an armor to display!",1)
  540. end
  541. #--------------------------------------------------------------------------
  542. # * Draw Icon
  543. # enabled : Enabled flag. When false, draw semi-transparently.
  544. #--------------------------------------------------------------------------
  545. def draw_icon2(icon_index, x, y, enabled = true)
  546. bitmap = Cache.system("Iconset")
  547. rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  548. rect2 = Rect.new(x, y, 64, 64)
  549. contents.stretch_blt(rect2, bitmap, rect,enabled ? 255 : translucent_alpha)
  550. end
  551. #--------------------------------------------------------------------------
  552. # * Display Normal
  553. #--------------------------------------------------------------------------
  554. def display_normal(wp_index)
  555. contents.clear
  556. if @spr_help
  557. @spr_help.bitmap.dispose
  558. @spr_help.dispose
  559. end
  560. @display = true
  561. wp = $data_armors[wp_index]
  562. contents.fill_rect(0,0,65,65,Color.new(0,0,0,translucent_alpha))
  563. draw_icon2(wp.icon_index,1,1)
  564. name_rect = Rect.new(70,0,250,64)
  565. name_rect.y += 5
  566. name_rect.y -= line_height/2
  567. contents.font.size = 23
  568. contents.font.color = Color.new(255,128,0)
  569. draw_text(name_rect, wp.name,1)
  570. contents.font.size = 15
  571. name_rect.y += line_height
  572. contents.font.color = Color.new(255,255,255)
  573. draw_text(name_rect, "Price: #{wp.price}",1)
  574. contents.fill_rect(0,68,contents.width,40,Color.new(0,0,0,translucent_alpha))
  575. @viewport ||= Viewport.new(207,134,325,40)
  576. @viewport.z = 100
  577. @spr_help = Sprite.new(@viewport)
  578. @spr_help.bitmap = Bitmap.new(1280*3,40)
  579. @spr_help.bitmap.font.size = 17
  580. @spr_help.bitmap.font.bold = true
  581. @spr_help.bitmap.font.outline = false
  582. @des_text = wp.description
  583. @spr_help.bitmap.draw_text(0,5,1280*3,24,@des_text)
  584. @spr_help.oy -= 5
  585. @spr_help.ox = @scroll_pos = -30
  586. @atk_color1 = Color.new(255,140,0)
  587. @atk_color2 = Color.new(255,69,0)
  588. @def_color1 = Color.new(0,255,0)
  589. @def_color2 = Color.new(50,205,50)
  590. @mat_color1 = Color.new(75,0,130)
  591. @mat_color2 = Color.new(138,43,226)
  592. @mdf_color1 = Color.new(0,206,209)
  593. @mdf_color2 = Color.new(64,224,208)
  594. @mhp_color1 = Color.new(255,0,0)
  595. @mhp_color2 = Color.new(200,100,100)
  596. @agi_color1 = Color.new(199,21,133)
  597. @agi_color2 = Color.new(219,112,147)
  598. @luk_color1 = Color.new(255,255,0)
  599. @luk_color2 = Color.new(255,215,0)
  600. @mmp_color1 = Color.new(30,144,255)
  601. @mmp_color2 = Color.new(0,191,255)
  602. x = 10
  603. y = 170
  604. @rate = wp.params[2].to_f/500.to_f
  605. draw_cir_gauge(x,y,x+65,y+65,@atk_color1,@atk_color2,-@rate,"ATK")
  606. x += 80
  607. @rate = wp.params[3].to_f/500.to_f
  608. draw_cir_gauge(x,y,x+65,y+65,@def_color1,@def_color2,-@rate,"DEF")
  609. x += 80
  610. @rate = wp.params[4].to_f/500.to_f
  611. draw_cir_gauge(x,y,x+65,y+65,@mat_color1,@mat_color2,-@rate,"MAT")
  612. x += 80
  613. @rate = wp.params[4].to_f/500.to_f
  614. draw_cir_gauge(x,y,x+65,y+65,@mdf_color1,@mdf_color2,-@rate,"MDF")
  615. x = 10
  616. y += 80
  617. @rate = wp.params[5].to_f/500.to_f
  618. draw_cir_gauge(x,y,x+65,y+65,@agi_color1,@agi_color2,-@rate,"AGI")
  619. x += 80
  620. @rate = wp.params[6].to_f/500.to_f
  621. draw_cir_gauge(x,y,x+65,y+65,@luk_color1,@luk_color2,-@rate,"LUK")
  622. x += 80
  623. @rate = wp.params[0].to_f/5000.to_f
  624. draw_cir_gauge(x,y,x+65,y+65,@mhp_color1,@mhp_color2,-@rate,"MHP",true)
  625. x += 80
  626. @rate = wp.params[1].to_f/5000.to_f
  627. draw_cir_gauge(x,y,x+65,y+65,@mmp_color1,@mmp_color2,-@rate,"MMP",true)
  628. contents.font.size = 22
  629. contents.draw_text(-10,68+40+15,Graphics.width - 195,24,"STATS",1)
  630. end
  631. #--------------------------------------------------------------------------
  632. # * Draw Circular Gauge
  633. #--------------------------------------------------------------------------
  634. def draw_cir_gauge(x1,y1,x2,y2,color1,color2,rate,text,is_hp_mp=false)
  635. contents.line_start_cap = 2
  636. contents.line_end_cap = 2
  637. contents.simple_draw_arc( x1, y1, x2, y2, Color.new(255,255,255), 90 , 360 ,10)
  638. contents.simple_draw_arc( x1, y1, x2, y2, Color.new(0,0,0,200) , 90 , 360 ,8)
  639. contents.draw_arc( x1, y1, x2, y2, x1, y1, x2 , y2 ,color1,color2,90,rate*360,7)
  640. contents.font.color = color2
  641. draw_text(x1+18,y1+10,65,24,text)
  642. rect = Rect.new(x1,y1,65,70)
  643. rect.y += 3
  644. rect.x += 1
  645. if is_hp_mp == true
  646. draw_text(rect,"#{@rate*5000}",1)
  647. else
  648. draw_text(rect,"#{@rate*500.to_i}",1)
  649. end
  650. end
  651. #--------------------------------------------------------------------------
  652. # * Dispose
  653. #--------------------------------------------------------------------------
  654. def dispose
  655. super
  656. if @spr_help && !@spr_help.disposed?
  657. @spr_help.bitmap.dispose
  658. @spr_help.dispose
  659. end
  660. @viewport.dispose if @viewport
  661. end
  662. #--------------------------------------------------------------------------
  663. # * Cal Text Width
  664. #--------------------------------------------------------------------------
  665. def cal_text_width(text)
  666. size = 0
  667. for i in 0...text.size
  668. size += text_size(text[i]).width
  669. end
  670. return size
  671. end
  672. #--------------------------------------------------------------------------
  673. # * Update
  674. #--------------------------------------------------------------------------
  675. def update
  676. super
  677. if @spr_help && self.display
  678. @spr_help.ox = @scroll_pos
  679. @scroll_pos += 1
  680. if @scroll_pos > cal_text_width(@des_text)*0.6 + 40*2
  681. @scroll_pos = -325
  682. @spr_help.ox = @scroll_pos
  683. end
  684. end
  685. end
  686. end
  687.  
  688. class Window_ArmorPediaList < Window_Command
  689. attr_accessor :info_window
  690. #--------------------------------------------------------------------------
  691. # * Initialize
  692. #--------------------------------------------------------------------------
  693. def initialize
  694. super(0,0)
  695. set_handlers
  696. end
  697. #--------------------------------------------------------------------------
  698. # * Get Window Width
  699. #--------------------------------------------------------------------------
  700. def window_width
  701. return 195
  702. end
  703. #--------------------------------------------------------------------------
  704. # * Get Window Height
  705. #--------------------------------------------------------------------------
  706. def window_height
  707. 308
  708. end
  709. #--------------------------------------------------------------------------
  710. # * Create Command List
  711. #--------------------------------------------------------------------------
  712. def make_command_list
  713. @categories = DarkCreation::ArmorEncyclopedia.get_armor_category
  714. @armor_list = $game_system.apedia_list
  715. @expand_status = {}
  716. @categories.each do |cate|
  717. add_command(cate,cate.to_sym,true)
  718. @expand_status[cate.to_sym] = false
  719. end
  720. end
  721. #--------------------------------------------------------------------------
  722. # * Create New Command List
  723. #--------------------------------------------------------------------------
  724. def make_new_command_list
  725. @child = []
  726. @categories.each do |cate|
  727. add_command(cate,cate.to_sym,true)
  728. if @expand_status[cate.to_sym]
  729. @armor_list.each do |index|
  730. aptype = $data_armors[index].atype_id
  731. name = $data_armors[index].name
  732. if $data_system.armor_types[aptype].to_sym == cate.to_sym
  733. @child.push(["a_#{index}".to_sym,index])
  734. add_command(name,"a_#{index}".to_sym,true)
  735. end
  736. end
  737. end
  738. end
  739. end
  740. #--------------------------------------------------------------------------
  741. # * Set handler
  742. #--------------------------------------------------------------------------
  743. def set_handlers
  744. @categories.each do |cate|
  745. set_handler(cate.to_sym, method(:extract_small_commands))
  746. end
  747. end
  748. #--------------------------------------------------------------------------
  749. # * Set handler
  750. #--------------------------------------------------------------------------
  751. def set_handlers_new
  752. @categories.each do |cate|
  753. set_handler(cate.to_sym, method(:extract_small_commands))
  754. end
  755. @child.each do |sym|
  756. set_handler(sym[0], method(:on_ar_click))
  757. end
  758. end
  759. #--------------------------------------------------------------------------
  760. # * On Weapon Choose
  761. #--------------------------------------------------------------------------
  762. def on_ar_click
  763. if @list[@index][:symbol].to_s =~ TOKENA
  764. @info_window.display_normal($1.to_i)
  765. end
  766. activate
  767. end
  768. #--------------------------------------------------------------------------
  769. # * Check for current expand status
  770. #--------------------------------------------------------------------------
  771. def current_expand_status
  772. return @expand_status[@list[@index][:symbol]]
  773. end
  774. #--------------------------------------------------------------------------
  775. # * Update Cursor
  776. #--------------------------------------------------------------------------
  777. def update_cursor
  778. if @cursor_all
  779. cursor_rect.set(0, 0, contents.width, row_max * item_height)
  780. self.top_row = 0
  781. elsif @index < 0
  782. cursor_rect.empty
  783. else
  784. ensure_cursor_visible
  785. rect = item_rect(@index)
  786. if @list[@index][:symbol].to_s.include?("a_")
  787. rect.x += 10
  788. rect.width -= 10
  789. else
  790. @info_window.display_no if @info_window && @info_window.display
  791. end
  792. cursor_rect.set(rect)
  793. end
  794. end
  795. #--------------------------------------------------------------------------
  796. # * Draw Item
  797. #--------------------------------------------------------------------------
  798. def draw_item(index)
  799. if @expand_status[@list[index][:symbol]]
  800. change_color(crisis_color, command_enabled?(index))
  801. else
  802. change_color(normal_color, command_enabled?(index))
  803. end
  804. rect = item_rect_for_text(index)
  805. rect.y += 2
  806. if @list[index][:symbol].to_s.include?("a_")
  807. rect.x += 10
  808. contents.font.name = Font.default_name
  809. contents.font.size = 18
  810. else
  811. contents.font.name = ["04b_19"]
  812. contents.font.size = 15
  813. end
  814. draw_text(rect, command_name(index), alignment)
  815. end
  816. #--------------------------------------------------------------------------
  817. # * Invert expand status
  818. #--------------------------------------------------------------------------
  819. def invert_expand_status
  820. if current_expand_status
  821. @expand_status[@list[@index][:symbol]] = false
  822. else
  823. @expand_status[@list[@index][:symbol]] = true
  824. end
  825. end
  826. #--------------------------------------------------------------------------
  827. # * Extract small commands
  828. #--------------------------------------------------------------------------
  829. def extract_small_commands
  830. invert_expand_status
  831. activate
  832. clear_command_list
  833. make_new_command_list
  834. set_handlers_new
  835. contents.clear
  836. create_contents
  837. draw_all_items
  838. end
  839. end
Advertisement
Add Comment
Please, Sign In to add comment