Advertisement
Dekita

Untitled

Apr 19th, 2014
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.95 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Badges (achievements)
  5. # -- Author : Dekita
  6. # -- Version : 1.1
  7. # -- Level : Easy / Normal
  8. # -- Requires : $D13x Core v2.7+
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Badges]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 19/o4/2o14 - Bugfixx, (typo caused error with restricted skills items etc..)
  21. # 17/o4/2o14 - Finished,
  22. # 15/o4/2o14 - Started
  23. #
  24. #===============================================================================
  25. # ☆ Introduction
  26. #-------------------------------------------------------------------------------
  27. # This script was inspired by Pokemons 'Badges' system. Cause I could, I made
  28. # a script to recreate it (this script) and when I had done that, I made it a
  29. # MUCH more powerful feature...
  30. #
  31. # Obviously, the standard pokemon badge system is a widely known feature;
  32. # however, for those that do not know this system - a badge is basically an
  33. # achievement that is gained throughout the course of gameplay.
  34. #
  35. # Badges are not only for showing off, they can also be used to control various
  36. # aspects of your game... Dramatically...
  37. #
  38. # In pokemon, you would not be able to use certain HM's (items) if you did not
  39. # have [x] badge. Therefore, I have included the ability to restrict item usage
  40. # when certain badges have not yet been obtained.
  41. # You can also restrict skills being used and weapons/armor from being equipped.
  42. # This restriction is automatic and you must gain the badge before it is lifted.
  43. #
  44. # Obviously, being able to use an item/skill/weapon or armor after gaining a
  45. # badge is great, but what if you want a badge to toggle a switch, modify a
  46. # variable, give gold / items / weapons / armor or maybe even run a custom
  47. # script call... Well... It can!
  48. #
  49. # Another feature within the pokemon badge system, in earlier generations, was
  50. # that your pokemons stats would increase if you owned [x] badge.
  51. # This could be done by doing a simple script call to increase each
  52. # party members stats; maybe something along the lines of
  53. # "$game_party.members.each {|m| m.add_param(id) }"
  54. # - Alternatively, you can have stats increase and learn skills for all members.
  55. # eg. badge 1 gives 50mhp, when badge one has been earned, all party members will
  56. # always gain 50mhp. Regardless of when they joined the party.
  57. #
  58. # Use simple script calls to gain badges and unlock the rewards.
  59. # But wait, what if you dont want to use script calls to gain badges? Well...
  60. # You dont have to...
  61. # Depending on the badge's settings, you can enable it to track a certain
  62. # object (such as a variable/switch/your own code) and once the 'gain badge'
  63. # condition has been met the achievment will automatically unlock.
  64. #
  65. # Couple this with some of my other scripts - such as Actor Effect Blocks/
  66. # Gold Tracker/ Items Tracker and you can enable badges to unlock when the player
  67. # has performed certain actions throught gameplay, such as; winning fights,
  68. # fleeing battle, dying, leveling, after party has earned / spent [x] amount of
  69. # gold or even when party has used [x] amount of [x] item.
  70. #
  71. # Arent I a clever fucker ^_^
  72. #
  73. #===============================================================================
  74. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  75. #===============================================================================
  76. # 1. You MUST give credit to "Dekita" !!
  77. # 2. You are NOT allowed to repost this script.(or modified versions)
  78. # 3. You are NOT allowed to convert this script.
  79. # 4. You are NOT allowed to use this script for Commercial games.
  80. # 5. ENJOY!
  81. #
  82. # "FINE PRINT"
  83. # By using this script you hereby agree to the above terms and conditions,
  84. # if any violation of the above terms occurs "legal action" may be taken.
  85. # Not understanding the above terms and conditions does NOT mean that
  86. # they do not apply to you.
  87. # If you wish to discuss the terms and conditions in further detail you can
  88. # contact me at http://dekitarpg.wordpress.com/
  89. #
  90. #===============================================================================
  91. # ☆ Instructions
  92. #-------------------------------------------------------------------------------
  93. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  94. #
  95. #===============================================================================
  96. # ☆ Script Calls
  97. #-------------------------------------------------------------------------------
  98. # SceneManager.call(Scene_Achievement)
  99. # Use to call the scene.
  100. #
  101. #-------------------------------------------------------------------------------
  102. # $game_player.gain_achii(Badge_ID)
  103. # Unlocks Badge ID.
  104. #
  105. #-------------------------------------------------------------------------------
  106. # $game_player.achiiz.progress
  107. # Returns a value equal to the amount of badges player has unlocked.
  108. #
  109. #-------------------------------------------------------------------------------
  110. # $game_player.achiiz.completed
  111. # Returns true / false depending on whether all badges have been unlocked.
  112. #
  113. #-------------------------------------------------------------------------------
  114. # -- NOTICE --
  115. # I recommend to only use the following script calls if you REALLY know what
  116. # you are doing, otherwise you could cause errors.
  117. #
  118. #-------------------------------------------------------------------------------
  119. # $game_player.achiiz.last_gained
  120. # Returns the last gained badge object.
  121. #
  122. #-------------------------------------------------------------------------------
  123. # $game_player.achiiz.item_restrictions
  124. # Returns an array containing restricted item id's
  125. #
  126. #-------------------------------------------------------------------------------
  127. # $game_player.achiiz.skill_restrictions
  128. # Returns an array containing restricted skill id's
  129. #
  130. #-------------------------------------------------------------------------------
  131. # $game_player.achiiz.weapon_restrictions
  132. # Returns an array containing restricted weapon id's
  133. #
  134. #-------------------------------------------------------------------------------
  135. # $game_player.achiiz.armor_restrictions
  136. # Returns an array containing restricted armor id's
  137. #
  138. #-------------------------------------------------------------------------------
  139. # $game_player.achiiz.unlock(id)
  140. # $game_player.achiiz.lock(id)
  141. # unlocks/lock an achievement accordingly.
  142. # Safer to use gain_achii script calls outwith of other scripts - ie on the map.
  143. #
  144. #===============================================================================
  145. # ☆ Notetags ( default )
  146. #-------------------------------------------------------------------------------
  147. # N/A
  148. #
  149. #===============================================================================
  150. # ☆ HELP
  151. #-------------------------------------------------------------------------------
  152. # N/A
  153. #
  154. #===============================================================================
  155. module Achievement ; Badge=[] # << DO NOT DELETE !!
  156. #===============================================================================
  157. #-----------------------------------------------------------------------------
  158. # Basic Vocab
  159. #-----------------------------------------------------------------------------
  160. Vocab={
  161. :comA => 'View Badges',
  162. :comB => 'Exit Scene',
  163. :prog => 'Progress:',
  164. :last => 'Last gained:',
  165. } # << Vocab
  166. #-----------------------------------------------------------------------------
  167. # Show on menu
  168. #-----------------------------------------------------------------------------
  169. Menu_Access = true
  170. #-----------------------------------------------------------------------------
  171. # (not seen in achievement screen)
  172. # = ['Name' , icon, hue, Text Color::Color]
  173. #-----------------------------------------------------------------------------
  174. Vocanicon = ["Badges", 0, 0, Text_Color::White]
  175. #-----------------------------------------------------------------------------
  176. # Sets last gained information. See F1 -> Index -> Time for more information.
  177. #-----------------------------------------------------------------------------
  178. def self.gained_on
  179. hour = Time.now.strftime("%I")
  180. minu = Time.now.strftime("%M")
  181. ampm = Time.now.strftime("%p")
  182. date = Time.now.strftime("%d")
  183. mont = Time.now.strftime("%B")
  184. year = Time.now.strftime("%Y")
  185. return "#{hour}:#{minu}#{ampm} on #{date} #{mont} #{year}"
  186. end
  187. #-----------------------------------------------------------------------------
  188. # Badge[ id ] = { #<- Begins Badge[ id ] Hash
  189. # :name => "The name of the badge",
  190. # :icon => icon index,
  191. # :ihue => icon hue,
  192. # :text => "Text shown in help window. \n gets a new line",
  193. # :mods => [ Array of effects triggered when badge unlocks ],
  194. # # Consult My $D13x Core script for info on effect blocks.
  195. # :cond => [ Array of conditions before badge can be gained ],
  196. # :rest => [ Array of restrictions caused when badge is not owned ],
  197. # } #-< Ends Badge[ id ] Hash
  198. #-----------------------------------------------------------------------------
  199. # ★ Possible :mods ;
  200. # [:common, id],
  201. # [:switch, id, true], <| Switches are pointless to use as you can
  202. # [:switch, id, false], <| use script calls to check if a badge has
  203. # [:switch, id, :alternate], <| been earned or not. But the option is there...
  204. # [:variable, id, :set, value],
  205. # [:variable, id, :add, value],
  206. # [:variable, id, :sub, value],
  207. # [:variable, id, :div, value],
  208. # [:variable, id, :mul, value],
  209. # [:variable, id, :mod, value],
  210. # [:gold, :gain, value],
  211. # [:gold, :lose, value],
  212. # [:item, id, amount, include equip(bool)],
  213. # [:weapon, id, amount, include equip(bool)],
  214. # [:armor, id, amount, include equip(bool)],
  215. # [:script, "code to evaluate"],
  216. #-----------------------------------------------------------------------------
  217. # ★ Possible :cond ;
  218. # [:variable, id, value],
  219. # [:switch, id],
  220. # [:script, "code to evaluate"],
  221. #-----------------------------------------------------------------------------
  222. # ★ Possible :rest ;
  223. # [:skill, id],
  224. # [:items, id],
  225. # [:weap, id],
  226. # [:armr, id],
  227. #-----------------------------------------------------------------------------
  228. # ★ Possible :stat ;
  229. # [:param , id, value],
  230. # [:x_param , id, value],
  231. # [:s_param , id, value],
  232. # [:atk_ele , id, value],
  233. # [:def_ele , id, value],
  234. # [:spds_stat , id, value]
  235. # [:atk_lvl , value],
  236. # [:def_lvl , value],
  237. # [:max_tp , value],
  238. # [:skill, id],
  239. #-----------------------------------------------------------------------------
  240. Badge[0] = {
  241. :name => 'Boulder',
  242. :icon => 864,
  243. :ihue => 0,
  244. :text => "Gained from Brock of Pewter City."+
  245. "\nEffects: Stat[atk] && HM[flash].",
  246. :mods => [
  247. [:gold, :gain, 100]
  248. ],#<< :mods
  249. :cond => [],
  250. :rest => [],
  251. :stat => [
  252. [:param , 0, 10],
  253. [:param , 1, 10],
  254. [:atk_lvl , 1],
  255. ],# <- :stat
  256. } # << Badge[0]
  257. #-----------------------------------------------------------------------------
  258. Badge[1] = {
  259. :name => 'Cascade',
  260. :icon => 865,
  261. :ihue => 0,
  262. :text => "Gained from Misty of Cerulean City."+
  263. "\nEffects: Stat[N/A] && HM[cut].",
  264. :mods => [
  265. [:gold, :gain, 100]
  266. ],#<< :mods
  267. :cond => [],
  268. :rest => [],
  269. :stat => [
  270. [:param , 2, 10],
  271. [:param , 3, 10],
  272. [:def_lvl , 1],
  273. ],# <- :stat
  274. } # << Badge[1]
  275. #-----------------------------------------------------------------------------
  276. Badge[2] = {
  277. :name => 'Thunder',
  278. :icon => 866,
  279. :ihue => 0,
  280. :text => "Gained from Lt. Surge of Vermilion City."+
  281. "\nEffects: Stat[speed] && HM[fly].",
  282. :mods => [
  283. [:gold, :gain, 100]
  284. ],#<< :mods
  285. :cond => [],
  286. :rest => [],
  287. :stat => [],
  288. } # << Badge[2]
  289. #-----------------------------------------------------------------------------
  290. Badge[3] = {
  291. :name => 'Rainbow',
  292. :icon => 867,
  293. :ihue => 0,
  294. :text => "Gained from Erika of Celadon City."+
  295. "\nEffects: Stat[N/A] && HM[stength].",
  296. :mods => [
  297. [:gold, :gain, 100]
  298. ],#<< :mods
  299. :cond => [],
  300. :rest => [],
  301. :stat => [],
  302. } # << Badge[3]
  303. #-----------------------------------------------------------------------------
  304. Badge[4] = {
  305. :name => 'Soul',
  306. :icon => 868,
  307. :ihue => 0,
  308. :text => "Gained from Koga of Fuchsia City."+
  309. "\nEffects: Stat[def] && HM[surf].",
  310. :mods => [
  311. [:gold, :gain, 100]
  312. ],#<< :mods
  313. :cond => [],
  314. :rest => [],
  315. :stat => [],
  316. } # << Badge[4]
  317. #-----------------------------------------------------------------------------
  318. Badge[5] = {
  319. :name => 'Marsh',
  320. :icon => 869,
  321. :ihue => 0,
  322. :text => "Gained from Sabrina of Saffron City."+
  323. "\nEffects: Stat[N/A] && HM[rock smash].",
  324. :mods => [
  325. [:gold, :gain, 100]
  326. ],#<< :mods
  327. :cond => [],
  328. :rest => [],
  329. :stat => [],
  330. } # << Badge[5]
  331. #-----------------------------------------------------------------------------
  332. Badge[6] = {
  333. :name => 'Volcano',
  334. :icon => 870,
  335. :ihue => 0,
  336. :text => "Gained from Blane of Cinnabar Island."+
  337. "\nEffects: Stat[sp atk & sp def] && HM[waterfall].",
  338. :mods => [
  339. [:gold, :gain, 100]
  340. ],#<< :mods
  341. :cond => [],
  342. :rest => [],
  343. :stat => [],
  344. } # << Badge[6]
  345. #-----------------------------------------------------------------------------
  346. Badge[7] = {
  347. :name => 'Earth',
  348. :icon => 871,
  349. :ihue => 0,
  350. :text => "Gained from Giovanni of Viridian City."+
  351. "\nEffects: Stat[N/A] && HM[rock climb].",
  352. :mods => [
  353. [:gold, :gain, 100]
  354. ],#<< :mods
  355. :cond => [],
  356. :rest => [],
  357. :stat => [],
  358. } # << Badge[7]
  359. #-----------------------------------------------------------------------------
  360.  
  361. #-----------------------------------------------------------------------------
  362. # << Add more Badge[ id ] here. Follow the format from above.
  363. #-----------------------------------------------------------------------------
  364.  
  365. #####################
  366. # CUSTOMISATION END #
  367. end #####################
  368. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  369. # #
  370. # http://dekitarpg.wordpress.com/ #
  371. # #
  372. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  373. #===============================================================================#
  374. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  375. # YES?\.\. #
  376. # OMG, REALLY? \| #
  377. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  378. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  379. #===============================================================================#
  380. class Achii_BADGE
  381. #===============================================================================
  382. #-----------------------------------------------------------------------------
  383. #
  384. #-----------------------------------------------------------------------------
  385. include Achievement
  386. #-----------------------------------------------------------------------------
  387. #
  388. #-----------------------------------------------------------------------------
  389. attr_accessor :id
  390. attr_accessor :name
  391. attr_accessor :icon
  392. attr_accessor :ihue
  393. attr_accessor :text
  394. attr_accessor :mods
  395. attr_accessor :cond
  396. attr_accessor :rest
  397. attr_accessor :stats
  398. attr_accessor :locked
  399. attr_accessor :date_gained
  400. #-----------------------------------------------------------------------------
  401. #
  402. #-----------------------------------------------------------------------------
  403. def initialize(index)
  404. init_main index
  405. init_addi
  406. end
  407. #-----------------------------------------------------------------------------
  408. #
  409. #-----------------------------------------------------------------------------
  410. def init_main(i)
  411. @id = i
  412. @name = Badge[i][:name]
  413. @icon = Badge[i][:icon]
  414. @ihue = Badge[i][:ihue]
  415. @text = Badge[i][:text]
  416. @mods = Badge[i][:mods]
  417. @cond = Badge[i][:cond]
  418. @rest = Badge[i][:rest]
  419. @stats = Badge[i][:stat]
  420. end
  421. #-----------------------------------------------------------------------------
  422. #
  423. #-----------------------------------------------------------------------------
  424. def init_addi
  425. @locked = true
  426. @date_gained = ""
  427. end
  428. #-----------------------------------------------------------------------------
  429. #
  430. #-----------------------------------------------------------------------------
  431. def do_unlock
  432. @locked = false
  433. end
  434. #-----------------------------------------------------------------------------
  435. #
  436. #-----------------------------------------------------------------------------
  437. def do_lock
  438. @locked = true
  439. end
  440. #-----------------------------------------------------------------------------
  441. #
  442. #-----------------------------------------------------------------------------
  443. def do_unlock_mods
  444. @mods.each do |block|
  445. Effect_Blocks.trigger(block)
  446. end
  447. @date_gained = Achievement.gained_on
  448. end
  449. end
  450. #===============================================================================
  451. class Achiiz
  452. #===============================================================================
  453. #-----------------------------------------------------------------------------
  454. #
  455. #-----------------------------------------------------------------------------
  456. include Achievement
  457. #-----------------------------------------------------------------------------
  458. #
  459. #-----------------------------------------------------------------------------
  460. attr_accessor :badges
  461. attr_accessor :unlocked
  462. attr_accessor :last_gained
  463. attr_accessor :sndlast_gained
  464. attr_accessor :skill_rest
  465. attr_accessor :items_rest
  466. attr_accessor :weap_rest
  467. attr_accessor :armr_rest
  468. attr_accessor :param
  469. attr_accessor :xparam
  470. attr_accessor :sparam
  471. attr_accessor :atk_ele
  472. attr_accessor :def_ele
  473. attr_accessor :atl_dfl
  474. attr_accessor :spds_stats
  475. attr_accessor :max_tp
  476. attr_accessor :skills
  477. #-----------------------------------------------------------------------------
  478. #
  479. #-----------------------------------------------------------------------------
  480. def initialize
  481. @badges = []
  482. @unlocked = [false] * Badge.size
  483. @last_gained = nil
  484. @sndlast_gained = nil
  485. Badge.size.times { |id| @badges << Achii_BADGE.new(id) }
  486. reset_rest
  487. reset_statz
  488. end
  489. #-----------------------------------------------------------------------------
  490. #
  491. #-----------------------------------------------------------------------------
  492. def reset_rest
  493. @skill_rest = []
  494. @items_rest = []
  495. @weap_rest = []
  496. @armr_rest = []
  497. @badges.each do |b|
  498. next unless b.locked
  499. b.rest.each do |r|
  500. next unless r
  501. case r[0]
  502. when :skill then @skill_rest << r[1]
  503. when :items then @items_rest << r[1]
  504. when :weap then @weap_rest << r[1]
  505. when :armr then @armr_rest << r[1]
  506. end
  507. end
  508. end
  509. end
  510. #-----------------------------------------------------------------------------
  511. #
  512. #-----------------------------------------------------------------------------
  513. def reset_statz
  514. @param = [0] * 8
  515. @xparam = [0] * 10
  516. @sparam = [0] * 10
  517. @atk_ele = [0] * $data_system.elements.size
  518. @def_ele = [0] * $data_system.elements.size
  519. @atl_dfl = [0] * 2
  520. @spds_stats = [0] * 8
  521. @spds_stats = [0] * SPDS::Commands.size if $D13x[:ISPDS]
  522. @max_tp = 0
  523. @skills = []
  524. calc_stat_mods
  525. end
  526. #-----------------------------------------------------------------------------
  527. #
  528. #-----------------------------------------------------------------------------
  529. def calc_stat_mods
  530. @badges.each do |b|
  531. next if b.locked
  532. b.stats.each do |s|
  533. next unless s
  534. case s[0]
  535. when :param then @param [s[1]] += s[2] if $D13x[:Stats_Control]
  536. when :x_param then @xparam [s[1]] += s[2] if $D13x[:Stats_Control]
  537. when :s_param then @sparam [s[1]] += s[2] if $D13x[:Stats_Control]
  538. when :atk_ele then @atk_ele[s[1]] += s[2] if $D13x[:Elems_Control]
  539. when :def_ele then @def_ele[s[1]] += s[2] if $D13x[:Elems_Control]
  540. when :atk_lvl then @atl_dfl[0] += s[1] if $D13x[:Atk_Def_Lvs]
  541. when :def_lvl then @atl_dfl[1] += s[1] if $D13x[:Atk_Def_Lvs]
  542. when :spds_stat then @spds_stats[s[1]] += s[2] if $D13x[:ISPDS]
  543. when :max_tp then @max_tp += s[1] if $D13x[:TP_Control]
  544. when :skill then @skills << s[1]
  545. end
  546. end
  547. end
  548. end
  549. #-----------------------------------------------------------------------------
  550. #
  551. #-----------------------------------------------------------------------------
  552. def unlock(id)
  553. @badges[id].do_unlock
  554. @badges[id].do_unlock_mods unless @unlocked[id]
  555. @unlocked[id] = true
  556. @sndlast_gained = @last_gained
  557. @last_gained = @badges[id]
  558. reset_rest
  559. reset_statz
  560. end
  561. #-----------------------------------------------------------------------------
  562. #
  563. #-----------------------------------------------------------------------------
  564. def lock(id)
  565. @badges[id].do_unlock
  566. end
  567. #-----------------------------------------------------------------------------
  568. #
  569. #-----------------------------------------------------------------------------
  570. def has_badge?(id)
  571. @badges[id].locked
  572. end
  573. #-----------------------------------------------------------------------------
  574. #
  575. #-----------------------------------------------------------------------------
  576. def progress
  577. unlocked = 0
  578. @unlocked.each { |i| unlocked += 1 if i}
  579. unlocked
  580. end
  581. #-----------------------------------------------------------------------------
  582. #
  583. #-----------------------------------------------------------------------------
  584. def completed
  585. @unlocked.all?
  586. end
  587. #-----------------------------------------------------------------------------
  588. #
  589. #-----------------------------------------------------------------------------
  590. def check_auto_unlock
  591. return if completed
  592. @badges.each do |b|
  593. next unless b.locked
  594. b.cond.each do |c|
  595. next unless c
  596. case c[0]
  597. when :variable then next unless $game_variables[c[1]] >= c[2]
  598. when :switch then next unless $game_switches[c[1]]
  599. when :script then next unless (eval(c[1]) rescue caul_fail(b.id,c[1]))
  600. end
  601. unlock(b.id)
  602. end
  603. end
  604. end
  605. #-----------------------------------------------------------------------------
  606. #
  607. #-----------------------------------------------------------------------------
  608. def caul_fail(id,code)
  609. line_1 = "The achievement activation script code failed for badge[#{id}]."
  610. line_2 = "\nCode in question is;\n"
  611. msgbox(line_1+line_2+code)
  612. return false
  613. end
  614. #-----------------------------------------------------------------------------
  615. #
  616. #-----------------------------------------------------------------------------
  617. def skill_restrictions
  618. @skill_rest
  619. end
  620. #-----------------------------------------------------------------------------
  621. #
  622. #-----------------------------------------------------------------------------
  623. def item_restrictions
  624. @items_rest
  625. end
  626. #-----------------------------------------------------------------------------
  627. #
  628. #-----------------------------------------------------------------------------
  629. def weapon_restrictions
  630. @weap_rest
  631. end
  632. #-----------------------------------------------------------------------------
  633. #
  634. #-----------------------------------------------------------------------------
  635. def armor_restrictions
  636. @armr_rest
  637. end
  638. end
  639. #===============================================================================
  640. module Badge_Stat_Mods
  641. #===============================================================================
  642. #-----------------------------------------------------------------------------
  643. #
  644. #-----------------------------------------------------------------------------
  645. def parp_badge_stat(id)
  646. $game_player.achiiz.param[id]
  647. end
  648. #-----------------------------------------------------------------------------
  649. #
  650. #-----------------------------------------------------------------------------
  651. def xpar_badge_stat(id)
  652. $game_player.achiiz.xparam[id]
  653. end
  654. #-----------------------------------------------------------------------------
  655. #
  656. #-----------------------------------------------------------------------------
  657. def spar_badge_stat(id)
  658. $game_player.achiiz.sparam[id]
  659. end
  660. #-----------------------------------------------------------------------------
  661. #
  662. #-----------------------------------------------------------------------------
  663. def def_ele_badge_stat(id)
  664. $game_player.achiiz.def_ele[id]
  665. end
  666. #-----------------------------------------------------------------------------
  667. #
  668. #-----------------------------------------------------------------------------
  669. def atk_ele_badge_stat(id)
  670. $game_player.achiiz.atk_ele[id]
  671. end
  672. #-----------------------------------------------------------------------------
  673. #
  674. #-----------------------------------------------------------------------------
  675. def atl_dfl_badge_stat(id)
  676. $game_player.achiiz.atl_dfl[id]
  677. end
  678. #-----------------------------------------------------------------------------
  679. #
  680. #-----------------------------------------------------------------------------
  681. def spds_badge_stat(id)
  682. $game_player.achiiz.spds_stats[id]
  683. end
  684. #-----------------------------------------------------------------------------
  685. #
  686. #-----------------------------------------------------------------------------
  687. def max_tp_badge_stat
  688. $game_player.achiiz.max_tp
  689. end
  690. #-----------------------------------------------------------------------------
  691. #
  692. #-----------------------------------------------------------------------------
  693. def badge_skills
  694. $game_player.achiiz.skills.sort.collect{|id| $data_skills[id]}
  695. end
  696. end
  697. #===============================================================================
  698. class Game_Actor < Game_Battler
  699. #===============================================================================
  700. #-----------------------------------------------------------------------------
  701. #
  702. #-----------------------------------------------------------------------------
  703. include Badge_Stat_Mods
  704. #-----------------------------------------------------------------------------
  705. #
  706. #-----------------------------------------------------------------------------
  707. alias :parp_badge :param_plus
  708. alias :xpar_badge :xparam_plus if $D13x[:Stats_Control]
  709. alias :spar_badge :sparam_plus if $D13x[:Stats_Control]
  710. alias :atke_badge :atk_ele_plus if $D13x[:Elems_Control]
  711. alias :defe_badge :def_ele_plus if $D13x[:Elems_Control]
  712. alias :atdf_badge :atl_dfl_plus if $D13x[:Atk_Def_Lvs]
  713. alias :spds_badge :spds_plus if $D13x[:ISPDS]
  714. alias :max_tp_badge :max_tp_plus if $D13x[:TP_Control]
  715. alias :skillbadge :skills
  716. #-----------------------------------------------------------------------------
  717. # Get Added Value of Parameter
  718. #-----------------------------------------------------------------------------
  719. def param_plus(param_id)
  720. parp_badge(param_id) + parp_badge_stat(param_id)
  721. end
  722. if $D13x[:Stats_Control]
  723. #---------------------------------------------------------------------------
  724. # Get Added Value of x-Parameter
  725. #---------------------------------------------------------------------------
  726. def xparam_plus(xparam_id)
  727. xpar_badge(xparam_id) + xpar_badge_stat(xparam_id)
  728. end
  729. #---------------------------------------------------------------------------
  730. # Get Added Value of s-Parameter
  731. #---------------------------------------------------------------------------
  732. def sparam_plus(sparam_id)
  733. spar_badge(sparam_id) + spar_badge_stat(sparam_id)
  734. end
  735. end # if $D13x[:Stats_Control]
  736. if $D13x[:Elems_Control]
  737. #---------------------------------------------------------------------------
  738. # Get Added Value of def-Element
  739. #---------------------------------------------------------------------------
  740. def def_ele_plus(element_id)
  741. defe_badge(element_id) + def_ele_badge_stat(element_id)
  742. end
  743. #---------------------------------------------------------------------------
  744. # Get Added Value of atk-Element
  745. #---------------------------------------------------------------------------
  746. def atk_ele_plus(element_id)
  747. atke_badge(element_id) + atk_ele_badge_stat(element_id)
  748. end
  749. end # if $D13x[:Elems_Control]
  750. if $D13x[:Atk_Def_Lvs]
  751. #---------------------------------------------------------------------------
  752. # Atk Lv | Def Lv ++
  753. #---------------------------------------------------------------------------
  754. def atl_dfl_plus(id)
  755. atdf_badge(id) + atl_dfl_badge_stat(id)
  756. end
  757. end # if $D13x[:Atk_Def_Lvs]
  758. if $D13x[:ISPDS]
  759. #---------------------------------------------------------------------------
  760. # Get SPDS Stats Plus
  761. #---------------------------------------------------------------------------
  762. def spds_plus(id)
  763. spds_badge(id) + spds_badge_stat(id)
  764. end
  765. end # if $D13x[:ISPDS]
  766. if $D13x[:TP_Control]
  767. #---------------------------------------------------------------------------
  768. # Atk Lv | Def Lv ++
  769. #---------------------------------------------------------------------------
  770. def max_tp_plus
  771. max_tp_badge + max_tp_badge_stat
  772. end
  773. end # if $D13x[:TP_Control]
  774. #-----------------------------------------------------------------------------
  775. #
  776. #-----------------------------------------------------------------------------
  777. def skills
  778. skillbadge + badge_skills
  779. end
  780. end
  781. #===============================================================================
  782. class Game_Player < Game_Character
  783. #===============================================================================
  784. #-----------------------------------------------------------------------------
  785. #
  786. #-----------------------------------------------------------------------------
  787. alias :init_achiiz :initialize
  788. alias :refr_achiiz :refresh
  789. #-----------------------------------------------------------------------------
  790. #
  791. #-----------------------------------------------------------------------------
  792. def initialize
  793. init_achiiz
  794. reset_achiiz
  795. end
  796. #-----------------------------------------------------------------------------
  797. #
  798. #-----------------------------------------------------------------------------
  799. def refresh
  800. refr_achiiz
  801. refresh_auto_unlock_badge
  802. end
  803. #-----------------------------------------------------------------------------
  804. #
  805. #-----------------------------------------------------------------------------
  806. def achiiz
  807. @achievements ||= Achiiz.new
  808. end
  809. #-----------------------------------------------------------------------------
  810. #
  811. #-----------------------------------------------------------------------------
  812. def reset_achiiz
  813. @achievements = nil
  814. @achievements = Achiiz.new
  815. end
  816. #-----------------------------------------------------------------------------
  817. #
  818. #-----------------------------------------------------------------------------
  819. def gain_achii(id)
  820. return unless @achievements
  821. @achievements.unlock id
  822. end
  823. #-----------------------------------------------------------------------------
  824. #
  825. #-----------------------------------------------------------------------------
  826. def achii_prog
  827. return 0 unless @achievements
  828. return @achievements.progress
  829. end
  830. #-----------------------------------------------------------------------------
  831. #
  832. #-----------------------------------------------------------------------------
  833. def refresh_auto_unlock_badge
  834. return unless @achievements
  835. @achievements.check_auto_unlock
  836. end
  837. end
  838. #===============================================================================
  839. class Window_ItemList < Window_Selectable
  840. #===============================================================================
  841. #-----------------------------------------------------------------------------
  842. #
  843. #-----------------------------------------------------------------------------
  844. alias :achii_enable? :enable?
  845. #-----------------------------------------------------------------------------
  846. #
  847. #-----------------------------------------------------------------------------
  848. def enable?(item)
  849. achii_enable?(item) && achi_enabled(item)
  850. end
  851. #-----------------------------------------------------------------------------
  852. #
  853. #-----------------------------------------------------------------------------
  854. def achi_enabled(item)
  855. return false unless item
  856. !$game_player.achiiz.items_restrictions.include?(item.id)
  857. end
  858. end
  859. #===============================================================================
  860. class Window_SkillList < Window_Selectable
  861. #===============================================================================
  862. #-----------------------------------------------------------------------------
  863. #
  864. #-----------------------------------------------------------------------------
  865. alias :achii_enable? :enable?
  866. #-----------------------------------------------------------------------------
  867. #
  868. #-----------------------------------------------------------------------------
  869. def enable?(item)
  870. achii_enable?(item) && achi_enabled(item)
  871. end
  872. #-----------------------------------------------------------------------------
  873. #
  874. #-----------------------------------------------------------------------------
  875. def achi_enabled(item)
  876. return false unless item
  877. !$game_player.achiiz.skill_restrictions.include?(item.id)
  878. end
  879. end
  880. #==============================================================================
  881. class Window_EquipItem < Window_ItemList
  882. #==============================================================================
  883. #-----------------------------------------------------------------------------
  884. #
  885. #-----------------------------------------------------------------------------
  886. def enable?(item)
  887. return false unless item
  888. return achi_enabled_weap(item) if item.is_a?(RPG::Weapon)
  889. return achi_enabled_armr(item) if item.is_a?(RPG::Armor)
  890. return true
  891. end
  892. #-----------------------------------------------------------------------------
  893. #
  894. #-----------------------------------------------------------------------------
  895. def achi_enabled_weap(item)
  896. return false unless item
  897. !$game_player.achiiz.weapon_restrictions.include?(item.id)
  898. end
  899. #-----------------------------------------------------------------------------
  900. #
  901. #-----------------------------------------------------------------------------
  902. def achi_enabled_armr(item)
  903. return false unless item
  904. !$game_player.achiiz.armor_restrictions.include?(item.id)
  905. end
  906. end
  907. #===============================================================================
  908. class Window_AchiiCommand < Window_Command
  909. #===============================================================================
  910. #-----------------------------------------------------------------------------
  911. #
  912. #-----------------------------------------------------------------------------
  913. def initialize
  914. super(0,0)
  915. end
  916. #-----------------------------------------------------------------------------
  917. #
  918. #-----------------------------------------------------------------------------
  919. def window_width
  920. return Graphics.width/4
  921. end
  922. #-----------------------------------------------------------------------------
  923. #
  924. #-----------------------------------------------------------------------------
  925. def alignment
  926. return 0
  927. end
  928. #-----------------------------------------------------------------------------
  929. #
  930. #-----------------------------------------------------------------------------
  931. def make_command_list
  932. add_command(Achievement::Vocab[:comA], :badges)
  933. add_command(Achievement::Vocab[:comB], :exit)
  934. end
  935. end
  936. #===============================================================================
  937. class Window_StatusAchii < Window_Selectable
  938. #===============================================================================
  939. #-----------------------------------------------------------------------------
  940. # Initialization
  941. #-----------------------------------------------------------------------------
  942. def initialize(y)
  943. super(0, y, Graphics.width/2, 104)
  944. refresh
  945. end
  946. #-----------------------------------------------------------------------------
  947. # Line Height
  948. #-----------------------------------------------------------------------------
  949. def line_height
  950. return 22
  951. end
  952. #-----------------------------------------------------------------------------
  953. # Window Padding
  954. #-----------------------------------------------------------------------------
  955. def standard_padding
  956. return 8
  957. end
  958. #-----------------------------------------------------------------------------
  959. # Do Refresh
  960. #-----------------------------------------------------------------------------
  961. def refresh
  962. contents.clear
  963. refresh_fonts
  964. draw_badge_prog
  965.  
  966. draw_last_achii
  967. end
  968. #-----------------------------------------------------------------------------
  969. #
  970. #-----------------------------------------------------------------------------
  971. def draw_badge_prog
  972. x = 0
  973. y = 0
  974. w = self.width-24
  975. h = line_height
  976. draw_text(x,y,w,h,Achievement::Vocab[:prog])
  977. valu = "#{$game_player.achii_prog} / #{$game_player.achiiz.badges.size}"
  978. draw_text(x,y,w-4,h,valu,2)
  979. end
  980.  
  981. #-----------------------------------------------------------------------------
  982. #
  983. #-----------------------------------------------------------------------------
  984. def draw_last_achii
  985. x = 0
  986. y = line_height
  987. w = self.width-24
  988. h = line_height
  989. draw_text(x,y,w,h,Achievement::Vocab[:last])
  990. canc = $game_player.achiiz.last_gained
  991. return unless canc
  992. draw_last_badge(canc)
  993. draw_last_gain_date(canc)
  994. canc = $game_player.achiiz.sndlast_gained
  995. return unless canc
  996. draw_2last_badge(canc)
  997. draw_2last_gain_date(canc)
  998. end
  999. #-----------------------------------------------------------------------------
  1000. #
  1001. #-----------------------------------------------------------------------------
  1002. def draw_last_badge(badg)
  1003. x = 0
  1004. y = line_height*2
  1005. w = self.width-24
  1006. h = line_height
  1007. draw_de_icon(badg.icon,x,y,badg.ihue,!badg.locked)
  1008. draw_text(x+24,y,w,h,badg.name)
  1009. end
  1010. #-----------------------------------------------------------------------------
  1011. #
  1012. #-----------------------------------------------------------------------------
  1013. def draw_last_gain_date(badg)
  1014. x = 0
  1015. y = line_height*2
  1016. w = self.width-24
  1017. h = line_height
  1018. draw_text(x,y,w-4,h,badg.date_gained,2)
  1019. end
  1020. #-----------------------------------------------------------------------------
  1021. #
  1022. #-----------------------------------------------------------------------------
  1023. def draw_2last_badge(badg)
  1024. x = 0
  1025. y = line_height*3
  1026. w = self.width-24
  1027. h = line_height
  1028. draw_de_icon(badg.icon,x,y,badg.ihue,!badg.locked)
  1029. draw_text(x+24,y,w,h,badg.name)
  1030. end
  1031. #-----------------------------------------------------------------------------
  1032. #
  1033. #-----------------------------------------------------------------------------
  1034. def draw_2last_gain_date(badg)
  1035. x = 0
  1036. y = line_height*3
  1037. w = self.width-24
  1038. h = line_height
  1039. draw_text(x,y,w-4,h,badg.date_gained,2)
  1040. end
  1041. #-----------------------------------------------------------------------------
  1042. #
  1043. #-----------------------------------------------------------------------------
  1044. def module_data
  1045. Achievement::Vocanicon
  1046. end
  1047. end
  1048. #===============================================================================
  1049. class Badge_Status < Dekita_Core_Status
  1050. #===============================================================================
  1051. #-----------------------------------------------------------------------------
  1052. #
  1053. #-----------------------------------------------------------------------------
  1054. def standard_padding
  1055. return 4
  1056. end
  1057. #-----------------------------------------------------------------------------
  1058. # Refresh
  1059. #-----------------------------------------------------------------------------
  1060. def refresh
  1061. contents.clear
  1062. refresh_fonts
  1063. draw_status_inf
  1064. end
  1065. #-----------------------------------------------------------------------------
  1066. # Get Setup Info
  1067. #-----------------------------------------------------------------------------
  1068. def setup_info
  1069. return Array.new unless @actor
  1070. return @actor.stats # @actor.mods
  1071. end
  1072. #-----------------------------------------------------------------------------
  1073. # Draw Status Page Info
  1074. #-----------------------------------------------------------------------------
  1075. def draw_status_inf
  1076. x = 0 ; y = 0
  1077. data = setup_info
  1078. for i in data
  1079. case i[0]
  1080. # [:header, "TEXT", Text_Color, icon_id, icon_hue, alignment],
  1081. when :param then y = draw_parameters(x,y,i[1],i[2])
  1082. when :x_param then y = draw_xparameters(x,y,i[1],i[2])
  1083. when :s_param then y = draw_sparameters(x,y,i[1],i[2])
  1084. when :atk_ele then y = draw_atk_eles(x,y,i[1],i[2])
  1085. when :def_ele then y = draw_def_eles(x,y,i[1],i[2])
  1086. when :atk_lvl then y = draw_atk_level(x,y,i[1])
  1087. when :def_lvl then y = draw_def_level(x,y,i[1])
  1088. when :tp_info then y = draw_tp_info(x,y,i[1])
  1089. when :spds_stat then y = draw_spds_info(x,y,i[1],i[2])
  1090. end
  1091. end
  1092. end
  1093. #-----------------------------------------------------------------------------
  1094. # Draw Parameters
  1095. #-----------------------------------------------------------------------------
  1096. def draw_parameters(x,y,i,v)
  1097. data = Vocanicon.param(i)
  1098. text = data[0]
  1099. colo = data[1]
  1100. icon = data[2]
  1101. ihue = data[3]
  1102. valu = sprintf("%s",v)
  1103. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1104. return y
  1105. end
  1106. #-----------------------------------------------------------------------------
  1107. # Draw x Parameters
  1108. #-----------------------------------------------------------------------------
  1109. def draw_xparameters(x,y,i,v)
  1110. data = Vocanicon.xparam(i)
  1111. text = data[0]
  1112. colo = data[1]
  1113. icon = data[2]
  1114. ihue = data[3]
  1115. valu = sprintf("%1.2f%%",v*100)
  1116. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1117. return y
  1118. end
  1119. #-----------------------------------------------------------------------------
  1120. # Draw sParameters
  1121. #-----------------------------------------------------------------------------
  1122. def draw_sparameters(x,y,i,v)
  1123. data = Vocanicon.sparam(i)
  1124. text = data[0]
  1125. colo = data[1]
  1126. icon = data[2]
  1127. ihue = data[3]
  1128. valu = sprintf("%1.2f%%",v*100)
  1129. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1130. return y
  1131. end
  1132. #-----------------------------------------------------------------------------
  1133. # Draw Attack Elements
  1134. #-----------------------------------------------------------------------------
  1135. def draw_atk_eles(x,y,i,v)
  1136. return y unless $D13x[:Elems_Control]
  1137. data = Vocanicon.atk_element(i)
  1138. text = data[0]
  1139. colo = data[1]
  1140. icon = data[2]
  1141. ihue = data[3]
  1142. valu = sprintf("%1.2f%%",v*100)
  1143. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1144. return y
  1145. end
  1146. #-----------------------------------------------------------------------------
  1147. # Draw Defence Elements
  1148. #-----------------------------------------------------------------------------
  1149. def draw_def_eles(x,y,i,v)
  1150. return y unless $D13x[:Elems_Control]
  1151. data = Vocanicon.def_element(i)
  1152. text = data[0]
  1153. colo = data[1]
  1154. icon = data[2]
  1155. ihue = data[3]
  1156. valu = sprintf("%1.2f%%",v*100)
  1157. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1158. return y
  1159. end
  1160. #-----------------------------------------------------------------------------
  1161. # Draw Attack Level
  1162. #-----------------------------------------------------------------------------
  1163. def draw_atk_level(x,y,v)
  1164. return y unless $D13x[:Atk_Def_Lvs]
  1165. data = Vocanicon::Atk_Level
  1166. text = data[0]
  1167. colo = data[1]
  1168. icon = data[2]
  1169. ihue = data[3]
  1170. valu = sprintf("%s",v.to_i)
  1171. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1172. return y
  1173. end
  1174. #-----------------------------------------------------------------------------
  1175. # Draw Defence Level
  1176. #-----------------------------------------------------------------------------
  1177. def draw_def_level(x,y,v)
  1178. return y unless $D13x[:Atk_Def_Lvs]
  1179. data = Vocanicon::Def_Level
  1180. text = data[0]
  1181. colo = data[1]
  1182. icon = data[2]
  1183. ihue = data[3]
  1184. valu = sprintf("%s",v.to_i)
  1185. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1186. return y
  1187. end
  1188. #-----------------------------------------------------------------------------
  1189. # Draw TP Info
  1190. #-----------------------------------------------------------------------------
  1191. def draw_tp_info(x,y,v)
  1192. return y unless $D13x[:TP_Control]
  1193. data = Vocanicon::TP
  1194. text = data[0]
  1195. colo = data[1]
  1196. icon = data[2]
  1197. ihue = data[3]
  1198. valu = sprintf("%s",v.to_i)
  1199. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1200. return y
  1201. end
  1202. #-----------------------------------------------------------------------------
  1203. # Draw TP Info
  1204. #-----------------------------------------------------------------------------
  1205. def draw_spds_info(x,y,i,v)
  1206. return y unless $D13x[:ISPDS]
  1207. data = Vocanicon.spds_stat($game_party.leader,i)
  1208. text = data[0]
  1209. colo = data[1]
  1210. icon = data[2]
  1211. ihue = data[3]
  1212. valu = sprintf("%s",v.to_i)
  1213. y = draw_data(x,y,text,colo,icon,ihue,valu,2)
  1214. return y
  1215. end
  1216. end
  1217. #===============================================================================
  1218. class Window_Achievement < Window_Command
  1219. #===============================================================================
  1220. #-----------------------------------------------------------------------------
  1221. #
  1222. #-----------------------------------------------------------------------------
  1223. def initialize(y)
  1224. super(0,y)
  1225. deactivate
  1226. unselect
  1227. refresh
  1228. end
  1229. #-----------------------------------------------------------------------------
  1230. #
  1231. #-----------------------------------------------------------------------------
  1232. def window_width
  1233. return Graphics.width
  1234. end
  1235. #-----------------------------------------------------------------------------
  1236. #
  1237. #-----------------------------------------------------------------------------
  1238. def col_max
  1239. return 4
  1240. end
  1241. #-----------------------------------------------------------------------------
  1242. #
  1243. #-----------------------------------------------------------------------------
  1244. def spacing
  1245. return 0
  1246. end
  1247. #-----------------------------------------------------------------------------
  1248. #
  1249. #-----------------------------------------------------------------------------
  1250. def make_command_list
  1251. $game_player.achiiz.badges.each do |i|
  1252. add_command(i.name, :badge, !i.locked, i)
  1253. end
  1254. end
  1255. #-----------------------------------------------------------------------------
  1256. #
  1257. #-----------------------------------------------------------------------------
  1258. def visible_line_number
  1259. return 9
  1260. end
  1261. #-----------------------------------------------------------------------------
  1262. #
  1263. #-----------------------------------------------------------------------------
  1264. def draw_item(index)
  1265. change_color(normal_color, command_enabled?(index))
  1266. data = @list[index][:ext]
  1267. rect = item_rect_for_text(index)
  1268. x = rect.x-1
  1269. y = rect.y+1
  1270. w = rect.width+2
  1271. h = rect.height-2
  1272. contents.fill_rect(x,y,w,h,General::Box_Color)
  1273. draw_de_icon(data.icon,x,y,0,!data.locked)
  1274. draw_text(x+24,y,w,h,command_name(index))
  1275. end
  1276. #-----------------------------------------------------------------------------
  1277. #
  1278. #-----------------------------------------------------------------------------
  1279. def draw_badges
  1280. $game_player.achiiz.badges.each do |i|
  1281. add_command(i.name, :badge, true, i)
  1282. end
  1283. end
  1284. #-----------------------------------------------------------------------------
  1285. #
  1286. #-----------------------------------------------------------------------------
  1287. def help_info
  1288. @list[index][:ext].text
  1289. end
  1290. #-----------------------------------------------------------------------------
  1291. #
  1292. #-----------------------------------------------------------------------------
  1293. def badge
  1294. @list[@index][:ext] || nil
  1295. end
  1296. end
  1297. #===============================================================================
  1298. class Scene_Achievement < Scene_MenuBase
  1299. #===============================================================================
  1300. #-----------------------------------------------------------------------------
  1301. #
  1302. #-----------------------------------------------------------------------------
  1303. def start
  1304. super
  1305. start_shit
  1306. end
  1307. #-----------------------------------------------------------------------------
  1308. #
  1309. #-----------------------------------------------------------------------------
  1310. def start_shit
  1311. create_command_window
  1312. create_help_window
  1313. create_status_window
  1314. create_achii_window
  1315. create_badge_window
  1316. end
  1317. #-----------------------------------------------------------------------------
  1318. #
  1319. #-----------------------------------------------------------------------------
  1320. def create_command_window
  1321. @command_window = Window_AchiiCommand.new
  1322. @command_window.set_handler(:cancel, method(:return_scene))
  1323. @command_window.set_handler(:exit, method(:return_scene))
  1324. @command_window.set_handler(:badges, method(:check_badges))
  1325. @command_window.viewport = @viewport
  1326. end
  1327. #-----------------------------------------------------------------------------
  1328. # Create Halp Window
  1329. #-----------------------------------------------------------------------------
  1330. def create_help_window
  1331. @help_window = Deki_Help.new
  1332. @help_window.viewport = @viewport
  1333. @help_window.x = Graphics.width / 4
  1334. end
  1335. #-----------------------------------------------------------------------------
  1336. #
  1337. #-----------------------------------------------------------------------------
  1338. def create_status_window
  1339. @status_window = Window_StatusAchii.new(@help_window.height)
  1340. @status_window.viewport = @viewport
  1341. end
  1342. #-----------------------------------------------------------------------------
  1343. #
  1344. #-----------------------------------------------------------------------------
  1345. def create_achii_window
  1346. y = @status_window.y+@status_window.height
  1347. @achii_window = Window_Achievement.new(y)
  1348. @achii_window.set_handler(:cancel,method(:return_to_com))
  1349. @achii_window.viewport = @viewport
  1350. end
  1351. #-----------------------------------------------------------------------------
  1352. #
  1353. #-----------------------------------------------------------------------------
  1354. def create_badge_window
  1355. x = Graphics.width/2
  1356. y = @status_window.y
  1357. w = Graphics.width/2
  1358. h = @status_window.height
  1359. b = @achii_window.badge
  1360. @badge_window = Badge_Status.new(x,y,w,h,b)
  1361. @badge_window.viewport = @viewport
  1362. end
  1363. #-----------------------------------------------------------------------------
  1364. #
  1365. #-----------------------------------------------------------------------------
  1366. def on_actor_change
  1367. end
  1368. #-----------------------------------------------------------------------------
  1369. #
  1370. #-----------------------------------------------------------------------------
  1371. def update
  1372. super
  1373. update_help
  1374. end
  1375. #-----------------------------------------------------------------------------
  1376. #
  1377. #-----------------------------------------------------------------------------
  1378. def update_help
  1379. @help_window.set_text(@achii_window.help_info)
  1380. @badge_window.actor = @achii_window.badge
  1381. end
  1382. #-----------------------------------------------------------------------------
  1383. #
  1384. #-----------------------------------------------------------------------------
  1385. def check_badges
  1386. @command_window.unselect
  1387. @achii_window.activate
  1388. @achii_window.select(0)
  1389. end
  1390. #-----------------------------------------------------------------------------
  1391. #
  1392. #-----------------------------------------------------------------------------
  1393. def return_to_com
  1394. @achii_window.unselect
  1395. @command_window.activate
  1396. @command_window.select(0)
  1397. end
  1398. end
  1399. if Achievement::Menu_Access
  1400. #===============================================================================
  1401. class Window_MenuCommand < Window_Command
  1402. #===============================================================================
  1403. #-----------------------------------------------------------------------------
  1404. #
  1405. #-----------------------------------------------------------------------------
  1406. alias :aoc_scene_badge :add_original_commands
  1407. #-----------------------------------------------------------------------------
  1408. #
  1409. #-----------------------------------------------------------------------------
  1410. def add_original_commands
  1411. aoc_scene_badge
  1412. add_badge_command
  1413. end
  1414. #-----------------------------------------------------------------------------
  1415. #
  1416. #-----------------------------------------------------------------------------
  1417. def add_badge_command
  1418. add_command(Achievement::Vocanicon[0],:badges)
  1419. end
  1420. end
  1421. #===============================================================================
  1422. class Scene_Menu < Scene_MenuBase
  1423. #===============================================================================
  1424. #-----------------------------------------------------------------------------
  1425. #
  1426. #-----------------------------------------------------------------------------
  1427. alias :ccw_scene_badge :create_command_window
  1428. #-----------------------------------------------------------------------------
  1429. #
  1430. #-----------------------------------------------------------------------------
  1431. def create_command_window
  1432. ccw_scene_badge
  1433. @command_window.set_handler(:badges, method(:open_badge_scene))
  1434. end
  1435. #-----------------------------------------------------------------------------
  1436. #
  1437. #-----------------------------------------------------------------------------
  1438. def open_badge_scene
  1439. SceneManager.call(Scene_Achievement)
  1440. end
  1441. end
  1442. end# if Game_Storage::Menu_Access[0]
  1443. #==============================================================================#
  1444. # http://dekitarpg.wordpress.com/ #
  1445. #==============================================================================#
  1446. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement