Advertisement
Dekita

$D13x Core 1.6

Apr 8th, 2013
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.33 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.6
  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/o4/2o13 - Added more keyboard keys,
  21. # - :S_Colon, :Equal, :Comma, :Minus, :Period, :F_Slash, :HASH,
  22. # - :L_Sqr_Brack, :B_Slash, :R_Sqr_Brack, :S_Quote,
  23. # o3/o4/2o13 - Fixed Keys.trigger? method
  24. # - Added Keys.release? method
  25. # o1/o4/2o13 - Added More Keyboard Keys,
  26. # ^- :F1, :F2, :F3, :F4, :F5, :F6, :F7, :F8, :F9, :F10, :F11, :F12
  27. # ^- :N_0, :N_1, :N_2, :N_3, :N_4, :N_5, :N_6, :N_7, :N_8, :N_9,
  28. # ^- :ADD, :MUL, :SUB, :DIV, :DECI, :TAB, :BACK, :ENTER, :CAPS,
  29. # ^- :SPACE, :ESC, :ALT
  30. # 29/o3/2o13 - Added More Keyboard Keys,(Left/Right CTRL)
  31. # 28/o3/2o13 - Improved Customisation Layout,
  32. # - Removed Some Methods,
  33. # - Improved Keyboard Code,
  34. # 27/o3/2o13 - Added Keyboard Control,
  35. # 26/o3/2o13 - Compatibility, (Status Scene)
  36. # - Update, (Icons w/Hue)
  37. # 18/03/2013 - Compatibility, (Skill Scene)
  38. # 23/o2/2o13 - Started, Finished,
  39. #
  40. #===============================================================================
  41. # ☆ Introduction
  42. #-------------------------------------------------------------------------------
  43. # This script simply holds some information and methods used by some other
  44. # scripts in the $D13x system.
  45. # Current Features:
  46. # Fonts,
  47. # Color,
  48. # Vocab,
  49. # Keyboard Control,
  50. # Icons (w/Hue)...
  51. #
  52. # Place above all other $D13x Scripts.
  53. #
  54. #===============================================================================
  55. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  56. #===============================================================================
  57. # 1. You MUST give credit to "Dekita" !!
  58. # 2. You are NOT allowed to repost this script.(or modified versions)
  59. # 3. You are NOT allowed to convert this script.
  60. # 4. You are NOT allowed to use this script for Commercial games.
  61. # 5. ENJOY!
  62. #
  63. # "FINE PRINT"
  64. # By using this script you hereby agree to the above terms and conditions,
  65. # if any violation of the above terms occurs "legal action" may be taken.
  66. # Not understanding the above terms and conditions does NOT mean that
  67. # they do not apply to you.
  68. # If you wish to discuss the terms and conditions in further detail you can
  69. # contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  70. #
  71. #===============================================================================
  72. # ☆ Instructions
  73. #-------------------------------------------------------------------------------
  74. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  75. # Place Above ALL Other $D13x Scripts.
  76. #
  77. #===============================================================================
  78. # ☆ Notetags
  79. # For use with Weapons / Armors
  80. #-------------------------------------------------------------------------------
  81. # <tcol: red, grn, blu>
  82. # use this notetag to change the color of the items text shown in some of my
  83. # scenes.
  84. #
  85. #===============================================================================
  86. # ☆ HELP
  87. #-------------------------------------------------------------------------------
  88. # Heres a list of :key_symbols ( for use in scripts that require this one )
  89. # F KEYS
  90. # :F1, :F2, :F3, :F4, :F5, :F6, :F7, :F8, :F9, :F10, :F11, :F12
  91. # NUMBER KEYS
  92. # :_1, :_2, :_3, :_4, :_5, :_6, :_7, :_8, :_9, :_0
  93. # LETTERS
  94. # :A, :B, :C, :D, :E, :F, :G, :H, :I, :J, :K, :L, :M, :N,
  95. # :O, :P, :Q, :R, :S, :T, :U, :V, :W, :X, :Y, :Z
  96. # NUM PAD
  97. # :N_0, :N_1, :N_2, :N_3, :N_4, :N_5, :N_6, :N_7, :N_8, :N_9,
  98. # :ADD, :MUL, :SUB, :DIV, :DECI
  99. # ARROWS
  100. # :LEFT, :RIGHT, :UP, :DOWN
  101. # OTHER
  102. # :SHIFT, :LSHIFT, :RSHIFT, :TAB, :PAUSE, :CTRL, :L_CTRL, :R_CTRL,
  103. # :BACK, :ENTER, :CAPS, :SPACE, :ESC, :ALT
  104. # :S_Colon, :Equal, :Comma, :Minus, :Period, :F_Slash, :HASH, :L_Sqr_Brack
  105. # :B_Slash, :R_Sqr_Brack, :S_Quote,
  106. #
  107. # To Disable A Key, Make Symbol = :NONE,
  108. #
  109. #===============================================================================
  110. # ☆ For Scripters
  111. #-------------------------------------------------------------------------------
  112. # You can use any of the keys above in your own scripts, simply change the
  113. # default Input.press? / Input.trigger? / Input.repeat? methods with the
  114. # equivalent new method :
  115. # Keys.press?(KEY)
  116. # Keys.repeat?(KEY)
  117. # Keys.trigger?(KEY)
  118. # Keys.release?(KEY)
  119. # KEY should be either the keys 'code' or you can reference the Keys module
  120. # like so...
  121. # Keys.press?( Keys::Key[:SYMBOL] )
  122. # Keys.repeat?( Keys::Key[:SYMBOL] )
  123. # Keys.trigger?( Keys::Key[:SYMBOL] )
  124. # Keys.release?( Keys::Key[:SYMBOL] )
  125. #
  126. # Keys.press?
  127. # ^- will be triggered if the key is being pressed down
  128. # Keys.repeat?
  129. # ^- will be triggered if the key is in the "on" state (caps lock ect)
  130. # Keys.trigger?
  131. # ^- will be triggered when they key is first pressed
  132. # Keys.release?(KEY)
  133. # ^- will be triggered when they key is de-pressed (let go)
  134. #
  135. #===============================================================================
  136. module Text_Color
  137. #===============================================================================
  138. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  139. # ☆ Color Settings
  140. #-----------------------------------------------------------------------------
  141. # You can use these colors in any of my scripts that offer color customisation.
  142. # simply put Text_Color::THE_COLOR_YOU_WANT as the setting.
  143. # eg.
  144. # Text_Color::Pure_White
  145. #-----------------------------------------------------------------------------
  146. # White's
  147. Pure_White = Color.new(255,255,255)
  148. White = Color.new(222,222,222)
  149. Grey = Color.new(111,111,111)
  150. Black = Color.new(0 ,0 ,0 )
  151. #-----------------------------------------------------------------------------
  152. # Yellow's
  153. Yellow = Color.new(255,255,0)
  154. Gold = Color.new(212,212,64)
  155. Orange = Color.new(255,182,0)
  156. Deep_Orange = Color.new(212,64,0)
  157. Dirt_Orange = Color.new(182,64,0)
  158. Brown = Color.new(128,32,0)
  159. #-----------------------------------------------------------------------------
  160. # Red's
  161. Red = Color.new(251,111,111)
  162. Deep_Red = Color.new(222,60,60)
  163. Pure_Red = Color.new(255,0,0)
  164. Pink = Color.new(255,0,255)
  165. Dark_Pink = Color.new(182,0,156)
  166. #-----------------------------------------------------------------------------
  167. # Blue's
  168. Sky_Blue = Color.new(0,182,255)
  169. Light_Blue = Color.new(64,128,255)
  170. Dark_Blue = Color.new(32,64,255)
  171. Purple = Color.new(182,64,255)
  172. Magenta = Color.new(156,156,255)
  173. #-----------------------------------------------------------------------------
  174. # Green's
  175. Green = Color.new(111,251,111)
  176. Candy_Green = Color.new(0,255,0)
  177. Dirty_Green = Color.new(128,182,0)
  178. Khaki_Green = Color.new(111,156,64)
  179. Turquoise = Color.new(0,255,182)
  180. #-----------------------------------------------------------------------------
  181. # Sets the default equipment text color
  182. Default_Equip_Color = White
  183.  
  184. end #===========================================================================
  185. module General
  186. #===============================================================================
  187. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  188. # ☆ General Settings
  189. #-----------------------------------------------------------------------------
  190. # these settings are usined for visual scripts of mine, such as status screen.
  191. Fonts = ["VL Gothic"]
  192. Font_Size = 18
  193. Font_Bold = false
  194. #-----------------------------------------------------------------------------
  195. # Gauges = [ Color 1 , Color 2 ]
  196. Hp_Colors = [ Text_Color::Dirt_Orange , Text_Color::Gold ]
  197. Mp_Colors = [ Text_Color::Dark_Blue , Text_Color::Sky_Blue ]
  198. Tp_Colors = [ Text_Color::Grey , Text_Color::Pure_Red ]
  199. Exp_Color = [ Text_Color::Deep_Red , Text_Color::Dark_Pink ]
  200. #-----------------------------------------------------------------------------
  201. # Show TP as a percentage ?
  202. # Only works in scripts i have written :p
  203. Show_Tp_As_Perc = false
  204.  
  205. end #===========================================================================
  206. module Vocab
  207. #===============================================================================
  208. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  209. # ☆ Vocabulary Settings
  210. #-----------------------------------------------------------------------------
  211. # This is where you would adjust the common vocab used in some of my scripts.
  212. #-----------------------------------------------------------------------------
  213. # Parameters
  214. def self.param(param_id)
  215. case param_id
  216. when 0 then "Max HP" # "Health"
  217. when 1 then "Max MP" # "Will"
  218. when 2 then "Physical Attack" # "Attack"
  219. when 3 then "Physical Resist" # "Defence"
  220. when 4 then "Magical Attack" # "Magic"
  221. when 5 then "Magical Resist" # "Aura"
  222. when 6 then "Agility" # "Speed"
  223. when 7 then "Luck" # "Luck"
  224. end
  225. end
  226. #-----------------------------------------------------------------------------
  227. # Tp vocab
  228. Tp = "Rage"
  229. #-----------------------------------------------------------------------------
  230. # X - Parameters
  231. def self.x_param(x_param_id)
  232. case x_param_id
  233. when 0 then "Accuracy"
  234. when 1 then "Evasion"
  235. when 2 then "Critical"
  236. when 3 then "Crit Eva"
  237. when 4 then "Mag Eva"
  238. when 5 then "Mag Ref"
  239. when 6 then "Counter"
  240. when 7 then "HP Regen"
  241. when 8 then "MP Regen"
  242. when 9 then "TP Regen"
  243. end
  244. end
  245. #-----------------------------------------------------------------------------
  246. # S - Parameters
  247. def self.s_param(s_param_id)
  248. case s_param_id
  249. when 0 then "Aggro"
  250. when 1 then "Guard"
  251. when 2 then "Recovery"
  252. when 3 then "Medicine"#Pharmacology
  253. when 4 then "MP Cost"
  254. when 5 then "TP Charge"
  255. when 6 then "P DMG Taken"
  256. when 7 then "M DMG Taken"
  257. when 8 then "Floor DMG"
  258. when 9 then "Exp Rate"
  259. end
  260. end
  261. #-----------------------------------------------------------------------------
  262. # Specials
  263. def self.specials(id)
  264. case id
  265. when 0 then "Auto-Fight"
  266. when 1 then "Guard"
  267. when 2 then "Substitue"
  268. when 3 then "Preserve TP"
  269. end
  270. end
  271. #-----------------------------------------------------------------------------
  272. # Collapse Type
  273. def self.collapse_type(id)
  274. case id
  275. when 0 then "Boss"
  276. when 1 then "Instant"
  277. when 2 then "No Vanish"
  278. end
  279. end
  280. #-----------------------------------------------------------------------------
  281. # Party Ability
  282. def self.party_ability(id)
  283. case id
  284. when 0 then "Encounter ½"
  285. when 1 then "Encounter NA"
  286. when 2 then "No Surprise"
  287. when 3 then "Pre-Emptive +"
  288. when 4 then "Gold Double"
  289. when 5 then "Double Drops"
  290. end
  291. end
  292. #-----------------------------------------------------------------------------
  293. # Various Statistics
  294. Attack_Speed = "Atk Speed"
  295. Attack_Times = "Atks Per Turn" # "APT"
  296. Skill_Type = "Skillset"
  297. Skill = "Skills"
  298. Equip_Type = "Equipable"
  299. Action_Times = "Action Time"
  300. Fixed = "Fixed "
  301. Sealed = "Sealed "
  302. Slot_Type = "Slot Type"
  303. Dual_Slot = "Dual Wield"
  304. One__Slot = "Single"
  305. #####################
  306. # CUSTOMISATION END #
  307. end #####################
  308. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  309. # #
  310. # http://dekitarpg.wordpress.com/ #
  311. # #
  312. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  313. # The following code is protected under the 2013 Dekita Data Protection Act. #
  314. # Ie. The “Do Not Fucking Look” Law. #
  315. # Breaking This One And Only Rule May Result In The Following Side Effects : #
  316. # Eyes Bleeding, Nightmares, Severe Head Ache's AND A Scratch On Your Knee :p #
  317. # That is all ! #
  318. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  319.  
  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,
  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 / 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