Advertisement
Dekita

$D13x Core 2.0

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