Advertisement
Dekita

$D13x - Core v2.3

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