Advertisement
Dekita

$D13x Core v2.1

Jun 3rd, 2013
1,092
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.17 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - CORE
  5. # -- Author : Dekita
  6. # -- Version : 2.1
  7. # -- Level : Easy
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:CORE] = true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # o3/o6/2o13 - Bugfix, (Exp Showing incorrect info),
  21. # 27/o5/2o13 - Added $game_party.alive_battle_members Method
  22. # 22/o5/2o13 - Small Bugfix, (fixed max tp gauge bug)
  23. # o4/o5/2o13 - Small Update, (added @database_id)
  24. # 18/o4/2o13 - Bugfixx, (tp gauge),
  25. # - Added PrtSc Key,
  26. # o4/o4/2o13 - Added more keyboard keys,
  27. # ^- :S_Colon, :Equal, :Comma, :Minus, :Period, :F_Slash, :HASH,
  28. # ^- :L_Sqr_Brack, :B_Slash, :R_Sqr_Brack, :S_Quote,
  29. # o3/o4/2o13 - Fixed Keys.trigger? method
  30. # - Added Keys.release? method
  31. # o1/o4/2o13 - Added More Keyboard Keys,
  32. # ^- :F1, :F2, :F3, :F4, :F5, :F6, :F7, :F8, :F9, :F10, :F11, :F12
  33. # ^- :N_0, :N_1, :N_2, :N_3, :N_4, :N_5, :N_6, :N_7, :N_8, :N_9,
  34. # ^- :ADD, :MUL, :SUB, :DIV, :DECI, :TAB, :BACK, :ENTER, :CAPS,
  35. # ^- :SPACE, :ESC, :ALT
  36. # 29/o3/2o13 - Added More Keyboard Keys,(Left/Right CTRL)
  37. # 28/o3/2o13 - Improved Customisation Layout,
  38. # - Removed Some Methods,
  39. # - Improved Keyboard Code,
  40. # 27/o3/2o13 - Added Keyboard Control,
  41. # 26/o3/2o13 - Compatibility, (Status Scene)
  42. # - Update, (Icons w/Hue)
  43. # 18/03/2013 - Compatibility, (Skill Scene)
  44. # 23/o2/2o13 - Started, Finished,
  45. #
  46. #===============================================================================
  47. # ☆ Introduction
  48. #-------------------------------------------------------------------------------
  49. # This script simply holds some information and methods used by some other
  50. # scripts in the $D13x system.
  51. # Current Features:
  52. # Fonts,
  53. # Color,
  54. # Vocab,
  55. # Keyboard Control,
  56. # Icons (w/Hue)...
  57. #
  58. # Place above all other $D13x Scripts.
  59. #
  60. #===============================================================================
  61. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  62. #===============================================================================
  63. # 1. You MUST give credit to "Dekita" !!
  64. # 2. You are NOT allowed to repost this script.(or modified versions)
  65. # 3. You are NOT allowed to convert this script.
  66. # 4. You are NOT allowed to use this script for Commercial games.
  67. # 5. ENJOY!
  68. #
  69. # "FINE PRINT"
  70. # By using this script you hereby agree to the above terms and conditions,
  71. # if any violation of the above terms occurs "legal action" may be taken.
  72. # Not understanding the above terms and conditions does NOT mean that
  73. # they do not apply to you.
  74. # If you wish to discuss the terms and conditions in further detail you can
  75. # contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  76. #
  77. #===============================================================================
  78. # ☆ Instructions
  79. #-------------------------------------------------------------------------------
  80. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  81. # Place Above ALL Other $D13x Scripts.
  82. #
  83. #===============================================================================
  84. # ☆ Notetags
  85. # For use with Weapons / Armors
  86. #-------------------------------------------------------------------------------
  87. # <tcol: red, grn, blu>
  88. # use this notetag to change the color of the items text shown in some of my
  89. # scenes.
  90. #
  91. #===============================================================================
  92. # ☆ HELP
  93. #-------------------------------------------------------------------------------
  94. # Heres a list of :key_symbols ( for use in scripts that require this one )
  95. # F KEYS
  96. # :F1, :F2, :F3, :F4, :F5, :F6, :F7, :F8, :F9, :F10, :F11, :F12
  97. # NUMBER KEYS
  98. # :_1, :_2, :_3, :_4, :_5, :_6, :_7, :_8, :_9, :_0
  99. # LETTERS
  100. # :A, :B, :C, :D, :E, :F, :G, :H, :I, :J, :K, :L, :M, :N,
  101. # :O, :P, :Q, :R, :S, :T, :U, :V, :W, :X, :Y, :Z
  102. # NUM PAD
  103. # :N_0, :N_1, :N_2, :N_3, :N_4, :N_5, :N_6, :N_7, :N_8, :N_9,
  104. # :ADD, :MUL, :SUB, :DIV, :DECI
  105. # ARROWS
  106. # :LEFT, :RIGHT, :UP, :DOWN
  107. # OTHER
  108. # :SHIFT, :LSHIFT, :RSHIFT, :TAB, :PAUSE, :CTRL, :L_CTRL, :R_CTRL,
  109. # :BACK, :ENTER, :CAPS, :SPACE, :ESC, :ALT
  110. # :S_Colon, :Equal, :Comma, :Minus, :Period, :F_Slash, :HASH, :L_Sqr_Brack
  111. # :B_Slash, :R_Sqr_Brack, :S_Quote,
  112. #
  113. # To Disable A Key, Make Symbol = :NONE,
  114. #
  115. #===============================================================================
  116. # ☆ For Scripters
  117. #-------------------------------------------------------------------------------
  118. # You can use any of the keys above in your own scripts, simply change the
  119. # default Input.press? / Input.trigger? / Input.repeat? methods with the
  120. # equivalent new method :
  121. # Keys.press?(KEY)
  122. # Keys.repeat?(KEY)
  123. # Keys.trigger?(KEY)
  124. # Keys.release?(KEY)
  125. # KEY should be either the keys 'virtual key code' or you can reference
  126. # the Keys module like so...
  127. # Keys.press?( Keys::Key[:SYMBOL] )
  128. # Keys.repeat?( Keys::Key[:SYMBOL] )
  129. # Keys.trigger?( Keys::Key[:SYMBOL] )
  130. # Keys.release?( Keys::Key[:SYMBOL] )
  131. #
  132. # Keys.press?
  133. # ^- will be triggered if the key is being pressed down
  134. # Keys.repeat?
  135. # ^- will be triggered if the key is in the "on" state (caps lock ect)
  136. # Keys.trigger?
  137. # ^- will be triggered when they key is first pressed
  138. # Keys.release?(KEY)
  139. # ^- will be triggered when they key is de-pressed (let go)
  140. #
  141. #===============================================================================
  142. module Text_Color
  143. #===============================================================================
  144. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  145. # ☆ Color Settings
  146. #-----------------------------------------------------------------------------
  147. # You can use these colors in any of my scripts that offer color customisation.
  148. # simply put Text_Color::THE_COLOR_YOU_WANT as the setting.
  149. # eg.
  150. # Text_Color::Pure_White
  151. #-----------------------------------------------------------------------------
  152. # White's
  153. Pure_White = Color.new(255,255,255)
  154. White = Color.new(222,222,222)
  155. Grey = Color.new(111,111,111)
  156. Black = Color.new(0 ,0 ,0 )
  157. #-----------------------------------------------------------------------------
  158. # Yellow's
  159. Yellow = Color.new(255,255,0)
  160. Gold = Color.new(212,212,64)
  161. Orange = Color.new(255,182,0)
  162. Deep_Orange = Color.new(212,64,0)
  163. Dirt_Orange = Color.new(182,64,0)
  164. Brown = Color.new(128,32,0)
  165. #-----------------------------------------------------------------------------
  166. # Red's
  167. Red = Color.new(251,111,111)
  168. Deep_Red = Color.new(222,60,60)
  169. Pure_Red = Color.new(255,0,0)
  170. Pink = Color.new(255,0,255)
  171. Dark_Pink = Color.new(182,0,156)
  172. #-----------------------------------------------------------------------------
  173. # Blue's
  174. Sky_Blue = Color.new(0,182,255)
  175. Light_Blue = Color.new(64,128,255)
  176. Dark_Blue = Color.new(32,64,255)
  177. Purple = Color.new(182,64,255)
  178. Magenta = Color.new(156,156,255)
  179. #-----------------------------------------------------------------------------
  180. # Green's
  181. Green = Color.new(111,251,111)
  182. Candy_Green = Color.new(0,255,0)
  183. Dirty_Green = Color.new(128,182,0)
  184. Khaki_Green = Color.new(111,156,64)
  185. Turquoise = Color.new(0,255,182)
  186. #-----------------------------------------------------------------------------
  187. # Sets the default equipment text color
  188. Default_Equip_Color = White
  189.  
  190. end #===========================================================================
  191. module General
  192. #===============================================================================
  193. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  194. # ☆ General Settings
  195. #-----------------------------------------------------------------------------
  196. # these settings are usined for visual scripts of mine, such as status screen.
  197. Fonts = ["VL Gothic"]
  198. Font_Size = 18
  199. Font_Bold = false
  200. #-----------------------------------------------------------------------------
  201. # Gauges = [ Color 1 , Color 2 ]
  202. Hp_Colors = [ Text_Color::Dirt_Orange , Text_Color::Gold ]
  203. Mp_Colors = [ Text_Color::Dark_Blue , Text_Color::Sky_Blue ]
  204. Tp_Colors = [ Text_Color::Grey , Text_Color::Pure_Red ]
  205. Exp_Color = [ Text_Color::Deep_Red , Text_Color::Dark_Pink ]
  206. #-----------------------------------------------------------------------------
  207. # Show TP as a percentage ?
  208. # Only works in scripts i have written :p
  209. Show_Tp_As_Perc = false
  210.  
  211. end #===========================================================================
  212. module Vocab
  213. #===============================================================================
  214. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  215. # ☆ Vocabulary Settings
  216. #-----------------------------------------------------------------------------
  217. # This is where you would adjust the common vocab used in some of my scripts.
  218. #-----------------------------------------------------------------------------
  219. # Parameters
  220. def self.param(param_id)
  221. case param_id
  222. when 0 then "Max HP" # "Health"
  223. when 1 then "Max MP" # "Will"
  224. when 2 then "Physical Attack" # "Attack"
  225. when 3 then "Physical Resist" # "Defence"
  226. when 4 then "Magical Attack" # "Magic"
  227. when 5 then "Magical Resist" # "Aura"
  228. when 6 then "Agility" # "Speed"
  229. when 7 then "Luck" # "Luck"
  230. end
  231. end
  232. #-----------------------------------------------------------------------------
  233. # Tp vocab
  234. Tp = "Rage"
  235. #-----------------------------------------------------------------------------
  236. # X - Parameters
  237. def self.x_param(x_param_id)
  238. case x_param_id
  239. when 0 then "Accuracy"
  240. when 1 then "Evasion"
  241. when 2 then "Critical"
  242. when 3 then "Crit Eva"
  243. when 4 then "Mag Eva"
  244. when 5 then "Mag Ref"
  245. when 6 then "Counter"
  246. when 7 then "HP Regen"
  247. when 8 then "MP Regen"
  248. when 9 then "TP Regen"
  249. end
  250. end
  251. #-----------------------------------------------------------------------------
  252. # S - Parameters
  253. def self.s_param(s_param_id)
  254. case s_param_id
  255. when 0 then "Aggro"
  256. when 1 then "Guard"
  257. when 2 then "Recovery"
  258. when 3 then "Medicine"#Pharmacology
  259. when 4 then "MP Cost"
  260. when 5 then "TP Charge"
  261. when 6 then "P DMG Taken"
  262. when 7 then "M DMG Taken"
  263. when 8 then "Floor DMG"
  264. when 9 then "Exp Rate"
  265. end
  266. end
  267. #-----------------------------------------------------------------------------
  268. # Specials
  269. def self.specials(id)
  270. case id
  271. when 0 then "Auto-Fight"
  272. when 1 then "Guard"
  273. when 2 then "Substitue"
  274. when 3 then "Preserve TP"
  275. end
  276. end
  277. #-----------------------------------------------------------------------------
  278. # Collapse Type
  279. def self.collapse_type(id)
  280. case id
  281. when 0 then "Boss"
  282. when 1 then "Instant"
  283. when 2 then "No Vanish"
  284. end
  285. end
  286. #-----------------------------------------------------------------------------
  287. # Party Ability
  288. def self.party_ability(id)
  289. case id
  290. when 0 then "Encounter ½"
  291. when 1 then "Encounter NA"
  292. when 2 then "No Surprise"
  293. when 3 then "Pre-Emptive +"
  294. when 4 then "Gold Double"
  295. when 5 then "Double Drops"
  296. end
  297. end
  298. #-----------------------------------------------------------------------------
  299. # Various Statistics
  300. Attack_Speed = "Atk Speed"
  301. Attack_Times = "Atks Per Turn" # "APT"
  302. Skill_Type = "Skillset"
  303. Skill = "Skills"
  304. Equip_Type = "Equipable"
  305. Action_Times = "Action Time"
  306. Fixed = "Fixed "
  307. Sealed = "Sealed "
  308. Slot_Type = "Slot Type"
  309. Dual_Slot = "Dual Wield"
  310. One__Slot = "Single"
  311. #####################
  312. # CUSTOMISATION END #
  313. end #####################
  314. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  315. # #
  316. # http://dekitarpg.wordpress.com/ #
  317. # #
  318. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  319. # The following code is protected under the 2013 Dekita Data Protection Act. #
  320. # Ie. The “Do Not Fucking Look” Law. #
  321. # Breaking This One And Only Rule May Result In The Following Side Effects : #
  322. # Eyes Bleeding, Nightmares, Severe Head Ache's AND A Scratch On Your Knee :p #
  323. # That is all ! #
  324. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  325. class Object
  326. #===============================================================================
  327. #-------------------------------------------------------------------------
  328. # rand_between
  329. #-------------------------------------------------------------------------
  330. def rand_between(min, max)
  331. min + rand(max - min + 1)
  332. end
  333.  
  334. end
  335.  
  336. #===============================================================================
  337. class Numeric
  338. #===============================================================================
  339. #---------------------------------------------------------------------------
  340. # To Float (with limited digits after decimal point)
  341. #---------------------------------------------------------------------------
  342. def to_flim(limit = 5, saftey = "0")
  343. str = self.to_f.to_s + saftey
  344. new_str = ""
  345. limit.times do |i|
  346. break if new_str =~ /[0-9].[0-9][0-9]/
  347. break if str[i] == nil
  348. new_str += str[i]
  349. end
  350. return new_str
  351. end
  352. #---------------------------------------------------------------------------
  353. # To A Percentage Of (num)
  354. #---------------------------------------------------------------------------
  355. def perc_of(num)
  356. self.to_f / num.to_f * 100.0
  357. end
  358. #---------------------------------------------------------------------------
  359. # Even ?
  360. #---------------------------------------------------------------------------
  361. def even?
  362. e = self.to_s
  363. e[e.size] == ("0"||"2"||"4"||"6"||"8")
  364. end
  365. #---------------------------------------------------------------------------
  366. # 0dd?
  367. #---------------------------------------------------------------------------
  368. def odd?
  369. o = self.to_s
  370. o[o.size] == ("1"||"3"||"5"||"7"||"9")
  371. end
  372.  
  373. end
  374.  
  375. #===============================================================================
  376. module Keys
  377. #===============================================================================
  378. #---------------------------------------------------------------------------
  379. # Win32API Information
  380. #---------------------------------------------------------------------------
  381. def self.w ; Win32API ; end
  382. def self.u ; "user32" ; end
  383. def self.i ; "i" ; end
  384. def self.gk ; "GetKeyState" ; end
  385. def self.ga ; "GetAsyncKeyState" ; end
  386. #---------------------------------------------------------------------------
  387. # Key Settings
  388. #---------------------------------------------------------------------------
  389. Key={
  390. # Func's
  391. :F1 => 0x70,:F2 => 0x71,:F3 => 0x72,:F4 => 0x73,:F5 => 0x74,:F6 => 0x75,
  392. :F7 => 0x76,:F8 => 0x77,:F9 => 0x78,:F10 => 0x7a,:F11 => 0x7b,:F12 => 0x7c,
  393. # Numbers
  394. :_0 => 0x30,:_1 => 0x31,:_2 => 0x32,:_3 => 0x33,:_4 => 0x34,
  395. :_5 => 0x35,:_6 => 0x36,:_7 => 0x37,:_8 => 0x38,:_9 => 0x39,
  396. # Letters
  397. :A => 0x41,:B => 0x42,:C => 0x43,:D => 0x44,:E => 0x45,:F => 0x46,:G => 0x47,
  398. :H => 0x48,:I => 0x49,:J => 0x4A,:K => 0x4B,:L => 0x4C,:M => 0x4D,:N => 0x4E,
  399. :O => 0x4F,:P => 0x50,:Q => 0x51,:R => 0x52,:S => 0x53,:T => 0x54,:U => 0x55,
  400. :V => 0x56,:W => 0x57,:X => 0x58,:Y => 0x59,:Z => 0x5A,
  401. # NumPad
  402. :N_0 => 0x60, :N_1 => 0x61, :N_2 => 0x62, :N_3 => 0x63, :N_4 => 0x64,
  403. :N_5 => 0x65, :N_6 => 0x66, :N_7 => 0x67, :N_8 => 0x68, :N_9 => 0x69,
  404. :ADD => 0x6b, :MUL => 0x6a, :SUB => 0x6d, :DIV => 0x6f, :DECI => 0x6e,
  405. # Arrows
  406. :LEFT => 0x25, :RIGHT => 0x27, :UP => 0x26, :DOWN => 0x28,
  407. # Symbols
  408. :S_Colon => 0xBA, :Equal => 0xBB, :Comma => 0xBC, :Minus => 0xBD,
  409. :Period => 0xBE, :F_Slash => 0xBF, :HASH => 0xDE, :L_Sqr_Brack => 0xDB,
  410. :B_Slash => 0xDC, :R_Sqr_Brack => 0xDD, :S_Quote => 0xC0,
  411. # Other
  412. :SHIFT => 0x10, :LSHIFT => 0xa0, :RSHIFT => 0xa1, :TAB => 0x09,
  413. :PAUSE => 0x13, :L_CTRL => 0xa2, :R_CTRL => 0xa3, :CTRL => 0x11,
  414. :BACK => 0x08, :ENTER => 0x0D, :CAPS => 0x14, :SPACE => 0x20,
  415. :ESC => 0x1B, :ALT => 0x12, :PrtSc => 0x2c,
  416. } # << End Key {}
  417. #---------------------------------------------------------------------------
  418. # Constants
  419. #---------------------------------------------------------------------------
  420. KS = w.new(u,gk,[i],i)
  421. AK = w.new(u,ga,[i],i)
  422. #---------------------------------------------------------------------------
  423. # Variables
  424. #---------------------------------------------------------------------------
  425. @trigger = Array.new(256) { false }
  426. @presses = Array.new(256) { false }
  427. @release = Array.new(256) { false }
  428. @repeats = Array.new(256) { false }
  429. #---------------------------------------------------------------------------
  430. # Update All Key's State's
  431. #---------------------------------------------------------------------------
  432. def self.update
  433. @trigger = Array.new(256) { false }
  434. @release = Array.new(256) { false }
  435. Key.each do |key|
  436. akey = AK.call(key[1])
  437. ktri = KS.call(key[1])
  438. @trigger[ key[1] ] = true if ((!@presses[key[1]]) && (akey != 0))
  439. @release[ key[1] ] = true if (( @presses[key[1]]) && (akey == 0))
  440. @presses[ key[1] ] = (akey != 0) ? true : false
  441. @repeats[ key[1] ] = (ktri == 1) ? true : false
  442. end
  443. end
  444. #---------------------------------------------------------------------------
  445. # Key Got Triggered? [ inital key press ]
  446. #---------------------------------------------------------------------------
  447. def self.trigger?(key)
  448. return if key.nil?
  449. return @trigger[key]
  450. end
  451. #---------------------------------------------------------------------------
  452. # Key Got Released? [ inital key depress ]
  453. #---------------------------------------------------------------------------
  454. def self.release?(key)
  455. return if key.nil?
  456. return @release[key]
  457. end
  458. #---------------------------------------------------------------------------
  459. # Key Being Pressed Currently ?
  460. #---------------------------------------------------------------------------
  461. def self.press?(key)
  462. return if key.nil?
  463. return @presses[key]
  464. end
  465. #---------------------------------------------------------------------------
  466. # Key Turned On? [Caps Lock, Num Lock, ect..]
  467. #---------------------------------------------------------------------------
  468. def self.repeat?(key)
  469. return if key.nil?
  470. return @repeats[key]
  471. end
  472.  
  473. end
  474.  
  475. #===============================================================================
  476. module Input
  477. #===============================================================================
  478. #---------------------------------------------------------------------------
  479. # Alias List
  480. #---------------------------------------------------------------------------
  481. class << self
  482. alias :update_sD13x_Keys :update
  483. end
  484. #---------------------------------------------------------------------------
  485. # Update $D13x Keys
  486. #---------------------------------------------------------------------------
  487. def self.update(*args)
  488. update_sD13x_Keys(*args)
  489. Keys.update
  490. end
  491.  
  492. end
  493.  
  494. #===============================================================================
  495. module Cache
  496. #===============================================================================
  497. #--------------------------------------------------------------------------
  498. # * Get System Graphic
  499. #--------------------------------------------------------------------------
  500. def self.icon(filename = "IconSet", hue = 0)
  501. load_bitmap("Graphics/System/", filename, hue)
  502. end
  503.  
  504. end
  505.  
  506. #===============================================================================
  507. module DataManager
  508. #===============================================================================
  509. #---------------------------------------------------------------------------
  510. # Alias List
  511. #---------------------------------------------------------------------------
  512. class << self
  513. alias :lbd_unique_shits :load_database
  514. end
  515. #---------------------------------------------------------------------------
  516. # Load Database (alias)
  517. #---------------------------------------------------------------------------
  518. def self.load_database
  519. lbd_unique_shits
  520. loa_unique_shits
  521. end
  522. #---------------------------------------------------------------------------
  523. # Load Unique Shit
  524. #---------------------------------------------------------------------------
  525. def self.loa_unique_shits
  526. classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
  527. $data_actors , $data_classes, $data_enemies, $data_states ]
  528. for g in classes
  529. for o in g
  530. next if o == nil
  531. o.load_unique_shit
  532. end
  533. end
  534. end
  535.  
  536. end # << DataManager
  537.  
  538. #===============================================================================
  539. class RPG::BaseItem
  540. #===============================================================================
  541. #--------------------------------------------------------------------------
  542. # Pi Variables
  543. #--------------------------------------------------------------------------
  544. attr_accessor :item_disp_color
  545. attr_accessor :database_id
  546. #--------------------------------------------------------------------------
  547. # Loads Unique Shit
  548. #--------------------------------------------------------------------------
  549. def load_unique_shit
  550. @database_id = @id
  551. load_item_color
  552. # << For use in Child Classes
  553. end
  554. #---------------------------------------------------------------------------
  555. # Load Item Text Color
  556. #---------------------------------------------------------------------------
  557. def load_item_color
  558. @item_disp_color = Text_Color::Default_Equip_Color
  559. if self.note.match(/<tcol:(.*),(.*),(.*)>/i)
  560. @item_disp_color = Color.new($1.to_i,$2.to_i,$3.to_i)
  561. end
  562. end
  563. #--------------------------------------------------------------------------
  564. # Returns features for item filtered by code (credits Tsukihime)
  565. #--------------------------------------------------------------------------
  566. def feature_val(code)
  567. self.features.select {|ft| ft.code == code}
  568. end
  569. #--------------------------------------------------------------------------
  570. # Returns features for item filtered by code and data ID (credits Tsukihime)
  571. #--------------------------------------------------------------------------
  572. def feature_val_with_id(code, data_id)
  573. self.features.select {|ft| ft.code == code && ft.data_id == data_id}
  574. end
  575. #--------------------------------------------------------------------------
  576. # Returns sum of all features for item, by code and data ID (credits Tsukihime)
  577. #--------------------------------------------------------------------------
  578. def features_sum(code, data_id)
  579. feature_val_with_id(code, data_id).inject(0.0) {|r, ft| r += ft.value }
  580. end
  581. #--------------------------------------------------------------------------
  582. # Returns features pi
  583. #--------------------------------------------------------------------------
  584. def features_pi(code, data_id)
  585. feature_val_with_id(code, data_id).inject(1.0) {|r, ft| r *= ft.value }
  586. end
  587. #--------------------------------------------------------------------------
  588. # Calculate Set Sum of Features
  589. #--------------------------------------------------------------------------
  590. def features_set(code)
  591. feature_val(code).inject([]) {|r, ft| r |= [ft.data_id] }
  592. end
  593.  
  594. end
  595.  
  596. #==============================================================================
  597. class Game_Party < Game_Unit
  598. #==============================================================================
  599. #-----------------------------------------------------------------------------
  600. # Get Battle Members
  601. #-----------------------------------------------------------------------------
  602. def alive_battle_members
  603. all_members[0, max_battle_members].select {|a| a.exist? && a.hp > 0 }
  604. end
  605.  
  606. end
  607.  
  608. #==============================================================================
  609. class Window_Base < Window
  610. #==============================================================================
  611. #--------------------------------------------------------------------------
  612. # Draw Gauge (w/height)
  613. #--------------------------------------------------------------------------
  614. def draw_deki_gauge(gx, gy, gw, gh, rate, color1, color2)
  615. empty_gauge_color = Color.new(0,0,0,128)
  616. fill_w = [(gw * rate).to_i, gw].min
  617. gauge_h = gh
  618. gauge_y = gy + line_height - 2 - gauge_h
  619. contents.fill_rect(gx, gauge_y, gw, gauge_h, empty_gauge_color)
  620. contents.gradient_fill_rect(gx, gauge_y, fill_w, gauge_h, color1, color2)
  621. end
  622. #--------------------------------------------------------------------------
  623. # Draw Hp
  624. #--------------------------------------------------------------------------
  625. def draw_de_hp(x, y, wid = nil)
  626. wid = self.width/2 - (standard_padding*2) if wid == nil
  627. rate = @actor.hp_rate
  628. color1 = General::Hp_Colors[0]
  629. color2 = General::Hp_Colors[1]
  630. draw_deki_gauge(x, y, wid-x-2, 2, rate, color1, color2)
  631. draw_text(x+4, y, wid, line_height, Vocab::param(0))
  632. draw_text(x, y, wid-x-6, line_height, "#{@actor.hp}/#{@actor.mhp}",2)
  633. end
  634. #--------------------------------------------------------------------------
  635. # Draw Mp
  636. #--------------------------------------------------------------------------
  637. def draw_de_mp(x, y, wid = nil)
  638. wid = self.width/2 - (standard_padding*2) if wid == nil
  639. rate = @actor.mp_rate
  640. color1 = General::Mp_Colors[0]
  641. color2 = General::Mp_Colors[1]
  642. draw_deki_gauge(x, y, wid-x-2, 2, rate, color1, color2)
  643. draw_text(x+4, y, wid, line_height, Vocab::param(1))
  644. draw_text(x, y, wid-x-6, line_height, "#{@actor.mp}/#{@actor.mmp}",2)
  645. end
  646. #--------------------------------------------------------------------------
  647. # Draw Tp
  648. #--------------------------------------------------------------------------
  649. def draw_de_tp(x, y, wid = nil)
  650. wid = self.width/2 - (standard_padding*2) if wid == nil
  651. rate = @actor.tp.to_i.to_f / @actor.max_tp.to_i
  652. color1 = General::Tp_Colors[0]
  653. color2 = General::Tp_Colors[1]
  654. draw_deki_gauge(x, y, wid-x-2, 2, rate, color1, color2)
  655. draw_text(x+4, y, wid, line_height, Vocab::Tp)
  656. text = "#{(@actor.tp).to_i}/#{@actor.max_tp.to_i}"
  657. text = "#{(@actor.tp.perc_of(@actor.max_tp)).to_flim}%" if General::Show_Tp_As_Perc
  658. draw_text(x, y, wid-x-6, line_height, text,2)
  659. end
  660. #--------------------------------------------------------------------------
  661. # Draw Exp (w/gauge)
  662. #--------------------------------------------------------------------------
  663. def draw_de_xp(x, y, gauge = true)
  664. s1 = @actor.current_level_exp
  665. s2 = @actor.next_level_exp
  666. s1_g = @actor.exp - @actor.current_level_exp
  667. s2_g = @actor.next_level_exp - @actor.current_level_exp
  668. wid = self.width/2 - (standard_padding*2)
  669. wid_b = self.width/2 - (standard_padding)
  670. rate = (s1_g).to_f / (s2_g)
  671. color1 = General::Exp_Color[0]
  672. color2 = General::Exp_Color[1]
  673. draw_deki_gauge(wid_b, y, wid-x-2, 2, rate, color1, color2) if gauge
  674. draw_text(wid_b+4, y, wid, line_height, "Exp:")
  675. draw_text(wid_b, y, wid-x-2, line_height, "#{@actor.exp}/#{s2}",2)
  676. end
  677. #--------------------------------------------------------------------------
  678. # Draw Icon (w/Hue)
  679. #--------------------------------------------------------------------------
  680. def draw_de_icon(icon_index, x, y, hue = 0, enabled = true)
  681. bitmap = Cache.icon("IconSet",hue)
  682. rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  683. contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  684. end
  685.  
  686. end
  687.  
  688. #==============================================================================
  689. class Deki_Help < Window_Base
  690. #==============================================================================
  691. #--------------------------------------------------------------------------
  692. # Object Initialization
  693. #--------------------------------------------------------------------------
  694. def initialize(line_number = 2)
  695. super(0, 0, Graphics.width/4*3, fitting_height(line_number))
  696. @item = nil
  697. end
  698. #--------------------------------------------------------------------------
  699. # Set Text
  700. #--------------------------------------------------------------------------
  701. def set_text(text)
  702. if text != @text
  703. @text = text
  704. refresh
  705. end
  706. end
  707. #--------------------------------------------------------------------------
  708. # Clear
  709. #--------------------------------------------------------------------------
  710. def clear
  711. set_text("")
  712. end
  713. #--------------------------------------------------------------------------
  714. # Set Item , item : Skills and items etc.
  715. #--------------------------------------------------------------------------
  716. def set_item(item)
  717. return if @item == item
  718. @item = item
  719. refresh
  720. set_text(item ? item.description : "")
  721. end
  722. #--------------------------------------------------------------------------
  723. # Refresh
  724. #--------------------------------------------------------------------------
  725. def refresh
  726. contents.clear
  727. draw_text_ex(4, 0, @text)
  728. end
  729. #--------------------------------------------------------------------------
  730. # Reset Font Settings
  731. #--------------------------------------------------------------------------
  732. def reset_font_settings
  733. change_color(normal_color)
  734. self.contents.font.name = General::Fonts
  735. self.contents.font.size = General::Font_Size
  736. self.contents.font.bold = General::Font_Bold
  737. end
  738.  
  739. end
  740.  
  741. #==============================================================================#
  742. # http://dekitarpg.wordpress.com/ #
  743. #==============================================================================#
  744. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement