Advertisement
Dekita

$D13x Core 1.8

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