Advertisement
Dekita

$D13x Core 1.7

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