Advertisement
blackmorning

Blackmorning - Ace Icons

Nov 4th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 37.66 KB | None | 0 0
  1. #===============================================================================
  2. # ** Blackmorning -> Icon Module (Based on YEM - Icon Module Library)
  3. # -----------------------------------------------------------------------------
  4. #  Blackmorning
  5. #  Version 1.11
  6. #  updated 08/18/2014
  7. #==============================================================================
  8. #  - INTRODUCTION -
  9. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  10. # - adds icons automatically before specific words found in various windows
  11. #   (stats, elements, menu commands, classes, states, etc...)
  12. #===============================================================================
  13. # Instructions
  14. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15. # To install this script, open up your script editor and copy/paste this script
  16. # to an open slot below BM - Base but above ? Main. Remember to save.
  17. # -----------------------------------------------------------------------------
  18. # Class Notetags - These notetags go in the class notebox in the database.
  19. # -----------------------------------------------------------------------------
  20. # <icon: x>
  21. # Sets the icon representing the class to x.
  22. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  23. # Actor Notetags - These notetags go in the actor notebox in the database.
  24. # -----------------------------------------------------------------------------
  25. # <icon: x>
  26. # Sets the icon representing the actor to x.
  27. #===============================================================================
  28. module BM
  29.   module ICON
  30.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31.     # Icon Assignment
  32.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  33.     # Edit the hash below which contains all of the icons
  34.     HASH ={
  35.     :border    => 1073, # goes around command icons
  36.     :stat_up   => 960,  # higher stat
  37.     :stat_down => 961,  # lower stat
  38.     :exp       => 912,
  39.     :currency  => 262,
  40.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  41.     # Bubs Gender Icons
  42.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  43.     # used for Bubs Gender Functions
  44.     :gender =>{
  45.       :female     => 614,
  46.       :male       => 613,
  47.       :genderless => 612,
  48.       }, # DO NOT REMOVE
  49.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  50.     # Alignment Icons
  51.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  52.     # used for BM-Alignment
  53.     :align =>{
  54.       0 => 591, #"Demonic"
  55.       1 => 591, #"Evil"
  56.       2 => 590, #"Bad"
  57.       3 => 590, #"Neutral"
  58.       4 => 590, #"Good"
  59.       5 => 589, #"Saintly"
  60.       6 => 589, #"Divine"
  61.       }, # Do Not Remove
  62.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  63.     # State Icons
  64.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  65.     :state   => {
  66.       :auto => true,        # if false, icon is not drawn beside state name
  67.       }, # Do Not Remove
  68.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  69.     # Element Icons
  70.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  71.     :element   => {
  72.       :auto => true,        # if false, icon is not drawn beside element name
  73.       0  => 0,
  74.       1  => 0,
  75.       2  => 0,
  76.       3  => 104,  # Fire element.
  77.       4  => 105,  # Ice element.
  78.       5  => 106,  # Volt element.
  79.       6  => 107,  # Earth element.
  80.       7  => 108,  # Water element.
  81.       8  => 109,  # Air element.
  82.       9  => 110,  # Light element.
  83.       10 => 111,  # Dark element.
  84.       }, # DO NOT REMOVE
  85.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  86.     # Basic Stats Icons
  87.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  88.     :basic => {
  89.       :auto => false,        # if false, icon is not drawn beside basic stat name
  90.       :show_words => false, # if false, only icon is shown instead of stat name
  91.       0 => 0,   # Level
  92.       1 => 0,   # Level (short)
  93.       2 => 880, # HP
  94.       3 => 880, # HP (short)
  95.       4 => 881, # MP
  96.       5 => 881, # MP (short)
  97.       6 => 882, # TP
  98.       7 => 882, # TP (short)
  99.       }, # DO NOT REMOVE
  100.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  101.     # Parameters Icons
  102.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  103.     :param => {
  104.       :auto => true,       # if false, icon is not drawn beside param name
  105.       :show_words => true, # if false, only icon is shown instead of param name
  106.       0 => 880, # MaxHP, Max Hit points
  107.       1 => 881, # MaxMP, Max Magic points
  108.       2 => 884, # ATK,   ATtacK power
  109.       3 => 885, # DEF,   DEFense power
  110.       4 => 886, # MAT,   Magic ATtack power
  111.       5 => 887, # MDF,   Magic DeFense power
  112.       6 => 888, # AGI,   AGIlity
  113.       7 => 889, # LUK,   LUcK    
  114.       }, # DO NOT REMOVE
  115.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  116.     # ExParameters Icons
  117.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  118.     :xparam => {
  119.       :auto => true,      # if false, icon is not drawn beside xparam name
  120.       0 => 884, #HIT, HIT Rate
  121.       1 => 885, #EVA, EVAsion
  122.       2 => 886, #CRI, CRItical Hit
  123.       3 => 887, #CEV, Critical Evade
  124.       4 => 888, #MEV, Magic EVasion
  125.       5 => 889, #MRF, Magic ReFlect
  126.       6 => 890, #CNT, CouNTer rate
  127.       7 => 880, #HRG, Hp ReGen
  128.       8 => 881, #MRG, Mp ReGen
  129.       9 => 882, #TRG, Tp ReGen
  130.       }, # DO NOT REMOVE
  131.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  132.     # Special Parameters Icons
  133.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  134.     :sparam => {
  135.       :auto => true,      # if false, icon is not drawn beside sparam name
  136.       0 => 884, #TGR, TarGet Rate
  137.       1 => 885, #GRD, GuaRD rate
  138.       2 => 886, #REC, RECovery
  139.       3 => 260, #PHA, Pharamcology
  140.       4 => 881, #MCR, Mp Cost Rate
  141.       5 => 882, #TCR, Tp ChaRge
  142.       6 => 890, #PDR, Physical Damage Rate
  143.       7 => 891, #MDR, Magical Damage Rate
  144.       8 => 892, #FDR, Floor Damage Rate
  145.       9 => 912, #EXR, EXp Rate
  146.       }, # DO NOT REMOVE
  147.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  148.     # Custom Parameters Icons (from YEA scripts)
  149.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  150.     :cparam =>{
  151.       :auto => true,      # if false, icon is not drawn beside cparam name
  152.       :cdr     => 0,  #cooldown rate # Requires YEA - Skill Restrictions
  153.       :wur     => 0,  #warmup rate   # Requires YEA - Skill Restrictions
  154.       :hcr     => 880,  #hp cost rate   # Requires YEA - Skill Cost Manager
  155.       :tcr_y   => 882,  #tp cost rate   # Requires YEA - Skill Cost Manager
  156.       :gcr     => 262,  #gold cost rate # Requires YEA - Skill Cost Manager
  157.       :hp_physical => 880, #convert hp physical # Requires YEA - Convert Damage
  158.       :mp_physical => 881, #convert mp physical # Requires YEA - Convert Damage
  159.       :hp_magical  => 880, #convert hp magical  # Requires YEA - Convert Damage
  160.       :mp_magical  => 881, #convert mp magical  # Requires YEA - Convert Damage
  161.       :gut     => 884, #guts #Requires Galv - Guts Effect
  162.       }, # DO NOT REMOVE
  163.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  164.     # Class Icons
  165.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  166.     :class => { # can also be defined in the Database in Class Notetag
  167.       :auto => true,      # if false, icon is not drawn beside class name
  168.       1  => 576, # Knight
  169.       2  => 583, # Monk
  170.       3  => 577, # Paladin
  171.       4  => 584, # Ranger
  172.       5  => 582, # Ninja
  173.       6  => 578, # Archer
  174.       7  => 581, # Thief
  175.       8  => 579, # Cleric
  176.       9  => 585, # Druid
  177.       10 => 580, # Sorcerer
  178.       }, # DO NOT REMOVE
  179.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  180.     # Command Icons (used in menus, shops, etc)
  181.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  182.     :command => {
  183.       0  => 839,    # Battle scene - partycommand - fight.
  184.       1  => 840,    # Battle scene - partycommand - escape.
  185.       2  => 837,    # Battle scene - actorcommand - attack.
  186.       3  => 383,    # Battle scene - actorcommand - defend.
  187.       4  => 820,    # Menu scene. Item scene. Battle scene - items.  
  188.       5  => 821,    # Menu scene - skills.
  189.       6  => 822,    # Menu scene - equipment.
  190.       7  => 823,    # Menu scene - status.
  191.       8  => 824,    # Menu scene - formation.
  192.       9  => 825,    # Menu scene - save.
  193.       10 => 826,    # Menu scene - game end.
  194.       11 =>   0,    #
  195.       12 => 833,    # Item scene - weapons.
  196.       13 => 834,    # Item scene - armors.
  197.       14 => 835,    # Shop scene - key items.
  198.       15 =>   0,    # Equip scene - change.
  199.       16 =>   0,    # Equip scene - optimize.
  200.       17 =>   0,    # Equip scene - clear all.
  201.       18 => 816,    # Title scene - new game.
  202.       19 => 817,    # Title scene - continue.
  203.       20 => 818,    # Title scene. Game End scene - shutdown.
  204.       21 => 818,    # Game End scene - to title.
  205.       22 => 818,    # Game End scene - cancel.
  206.       }, # DO NOT REMOVE
  207.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  208.     # Input Icons (button commands)
  209.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  210.     # not automatic for any text yet
  211.     :input => {
  212.       :DOWN  => 0,
  213.       :UP    => 0,
  214.       :RIGHT => 0,
  215.       :LEFT  => 0,
  216.       :L     => 0, # Q
  217.       :R     => 0, # W
  218.       :A     => 0, # SHIFT
  219.       :C     => 0, # SPACE, ENTER, Z
  220.       :B     => 0, # ESC, X, 0    
  221.       }, # DO NOT REMOVE
  222.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  223.     # Item Status Icons
  224.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  225.     # These are for item descriptions (ie YEA - items or shop)
  226.     :item_status => {
  227.       :hp_recover => 880, # used for HP Recovery.
  228.       :mp_recover => 881, # used for MP Recovery.
  229.       :tp_recover => 882, # used for TP Recovery.
  230.       :tp_gain    => 882, # used for TP Gain.
  231.       }, # DO NOT REMOVE
  232.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  233.     # Skill Types Icons
  234.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  235.     :skill_types => {
  236.       1 => 128,          # Skill scene. Battle scene.
  237.       2 => 136,          # Skill scene. Battle scene.
  238.       }, # DO NOT REMOVE
  239.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  240.     # Armor Types Icons
  241.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  242.     :armor_types => {
  243.       1 => 0,
  244.       2 => 0,
  245.       }, # DO NOT REMOVE
  246.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  247.     # Weapon Types Icons
  248.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  249.     :weapon_types => {
  250.       1 => 0,
  251.       2 => 0,
  252.       }, # DO NOT REMOVE
  253.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  254.     # Custom Word Icons
  255.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  256.     # for any other text you want
  257.     :words => {
  258.       :show_words => true, # if false, only icon is shown instead of word
  259.       "Auto"  => 841,
  260.       "JP"    => 883,  
  261.       "Buy"   => 259,
  262.       "Sell"  => 261,
  263.       "Equip" => 822,
  264.       }, # DO NOT REMOVE
  265.     } # DO NOT REMOVE
  266.   end
  267. end
  268. #===============================================================================
  269. # Editting anything past this point may potentially result in causing computer
  270. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  271. # Therefore, edit at your own risk.
  272. #===============================================================================
  273. module BM
  274.   def self.required(name, req, version, type = nil)
  275.     if !$imported[:bm_base]
  276.       msg = "The script '%s' requires the script\n"
  277.       msg += "'BM - Base' v%s or higher above it to work properly\n"
  278.       msg += "Go to bmscripts.weebly.com to download this script."
  279.       msgbox(sprintf(msg, self.script_name(name), version))
  280.       exit
  281.     else
  282.       self.required_script(name, req, version, type)
  283.     end
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # * script_name
  287.   #   Get the script name base on the imported value
  288.   #--------------------------------------------------------------------------
  289.   def self.script_name(name, ext = "BM")
  290.     name = name.to_s.gsub("_", " ").upcase.split
  291.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  292.     name.join(" ")
  293.   end
  294. end
  295. $imported ||= {}
  296. $imported[:bm_icon] = 1.11
  297. BM.required(:bm_icon, :bm_base, 1.00, :above)
  298. #==============================================================================
  299. module BM
  300.   module REGEXP
  301.     ICON_INDEX = /<(?:ICON_INDEX|icon index|icon):[ ](\d+)>/i
  302.   end
  303. end
  304. #==============================================================================
  305. # ** DataManager
  306. #==============================================================================
  307. module DataManager  
  308.   #--------------------------------------------------------------------------
  309.   # alias method: load_database
  310.   #--------------------------------------------------------------------------
  311.   class <<self; alias load_database_bm_icons load_database; end
  312.   def self.load_database
  313.     load_database_bm_icons
  314.     load_notetags_bm_icons
  315.   end  
  316.   #--------------------------------------------------------------------------
  317.   # new method: load_notetags_cs
  318.   #--------------------------------------------------------------------------
  319.   def self.load_notetags_bm_icons
  320.     groups = [$data_actors, $data_classes]
  321.     for group in groups
  322.       for obj in group
  323.         next if obj.nil?
  324.         obj.load_notetags_bm_icons
  325.       end
  326.     end
  327.   end
  328.  
  329. end # DataManager
  330. #==============================================================================
  331. # ** RPG::Class
  332. #==============================================================================
  333. class RPG::Class < RPG::BaseItem  
  334.   #--------------------------------------------------------------------------
  335.   # public instance variables
  336.   #--------------------------------------------------------------------------
  337.   attr_accessor :icon_index  
  338.   #--------------------------------------------------------------------------
  339.   # common cache: load_notetags_bm_icons
  340.   #--------------------------------------------------------------------------
  341.   def load_notetags_bm_icons
  342.     @icon_index = 0
  343.     #---
  344.     self.note.split(/[\r\n]+/).each { |line|
  345.       case line
  346.       #---
  347.       when BM::REGEXP::ICON_INDEX
  348.         @icon_index = $1.to_i
  349.       #---
  350.       end
  351.     } # self.note.split
  352.   end  
  353. end # RPG::Class
  354. #==============================================================================
  355. # ** RPG::Actor
  356. #==============================================================================
  357. class RPG::Actor < RPG::BaseItem  
  358.   #--------------------------------------------------------------------------
  359.   # public instance variables
  360.   #--------------------------------------------------------------------------
  361.   attr_accessor :icon_index  
  362.   #--------------------------------------------------------------------------
  363.   # common cache: load_notetags_bm_icons
  364.   #--------------------------------------------------------------------------
  365.   def load_notetags_bm_icons
  366.     @icon_index = 0
  367.     #---
  368.     self.note.split(/[\r\n]+/).each { |line|
  369.       case line
  370.       #---
  371.       when BM::REGEXP::ICON_INDEX
  372.         @icon_index = $1.to_i
  373.       #---
  374.       end
  375.     } # self.note.split
  376.   end  
  377. end
  378. #==============================================================================
  379. # ** Icon
  380. #==============================================================================
  381. module Icon
  382.   unless $imported[:bm_ring]
  383.     def self.disable; 0; end
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   def self.basic(id)
  387.     return BM::ICON::HASH[:basic][id] if BM::ICON::HASH[:basic].include?(id)
  388.     return 0
  389.   end
  390.   #--------------------------------------------------------------------------
  391.   def self.param(param_id)
  392.     case param_id
  393.       when :maxhp,:hp then param_id = 0
  394.       when :maxmp,:mp then param_id = 1
  395.       when :atk then param_id = 2
  396.       when :def then param_id = 3
  397.       when :mat then param_id = 4
  398.       when :mdf then param_id = 5
  399.       when :agi then param_id = 6
  400.       when :luk then param_id = 7
  401.     end
  402.     return BM::ICON::HASH[:param][param_id] if BM::ICON::HASH[:param].include?(param_id)
  403.     return 0
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   def self.xparam(id)
  407.     case id
  408.       when :hit then id = 0
  409.       when :eva then id = 1
  410.       when :cri then id = 2
  411.       when :cev then id = 3
  412.       when :mev then id = 4
  413.       when :mrf then id = 5
  414.       when :cnt then id = 6
  415.       when :hrg then id = 7
  416.       when :mrg then id = 8
  417.       when :trg then id = 9
  418.     end
  419.     return BM::ICON::HASH[:xparam][id] if BM::ICON::HASH[:xparam].include?(id)
  420.     return 0
  421.   end
  422.   #--------------------------------------------------------------------------
  423.   def self.sparam(id)
  424.     case id
  425.       when :tgr then id = 0
  426.       when :grd then id = 1
  427.       when :rec then id = 2
  428.       when :pha then id = 3
  429.       when :mcr then id = 4  
  430.       when :tcr then id = 5
  431.       when :pdr then id = 6
  432.       when :mdr then id = 7
  433.       when :fdr then id = 8
  434.       when :exr then id = 9
  435.     end
  436.     return BM::ICON::HASH[:sparam][id] if BM::ICON::HASH[:sparam].include?(id)
  437.     return 0
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   def self.cparam(id)
  441.     return BM::ICON::HASH[:cparam][id] if BM::ICON::HASH[:cparam].include?(id)
  442.     return 0
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   def self.element(id);
  446.     return BM::ICON::HASH[:element][id] if BM::ICON::HASH[:element].include?(id)
  447.     return 0
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   def self.class(id)
  451.     return $data_classes[id].icon_index if $data_classes[id].icon_index != 0
  452.     return BM::ICON::HASH[:class][id] if BM::ICON::HASH[:class].include?(id)
  453.     return 0
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   def self.actor(id)
  457.     return $data_actors[id].icon_index if $data_actors[id].icon_index != 0
  458.     return 0
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   def self.items(id); $data_items[id].icon_index; end
  462.   def self.weapons(id); $data_weapons[id].icon_index; end
  463.   def self.armors(id); $data_armors[id].icon_index; end
  464.   def self.skills(id); $data_skills[id].icon_index; end
  465.   def self.state(id); $data_states[id].icon_index; end
  466.   #--------------------------------------------------------------------------
  467.   def self.param_compare(num)
  468.     return BM::ICON::HASH[:stat_up] if num > 0
  469.     return BM::ICON::HASH[:stat_down] if num < 0
  470.     else; return 0
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   def self.input(id)
  474.     return BM::ICON::HASH[:input][id] if BM::ICON::HASH[:input].include?(id)
  475.     return 0
  476.   end  
  477.   #--------------------------------------------------------------------------
  478.   def self.item_status(id)
  479.     return BM::ICON::HASH[:item_status][id] if BM::ICON::HASH[:item_status].include?(id)
  480.     return 0
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   def self.command(id)
  484.     return BM::ICON::HASH[:command][id] if BM::ICON::HASH[:command].include?(id)
  485.     return 0
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # * self.****_types
  489.   #--------------------------------------------------------------------------
  490.   def self.skill_types(id)
  491.     return BM::ICON::HASH[:skill_types][id] if BM::ICON::HASH[:skill_types].include?(id)
  492.     return 0
  493.   end
  494.   def self.weapon_types(id)
  495.     return BM::ICON::HASH[:weapon_types][id] if BM::ICON::HASH[:weapon_types].include?(id)
  496.     return 0
  497.   end
  498.   def self.armor_types(id)
  499.     return BM::ICON::HASH[:armor_types][id] if BM::ICON::HASH[:armor_types].include?(id)
  500.     return 0
  501.   end
  502.   def self.words(text); BM::ICON::HASH[:words][text]; end
  503.   #--------------------------------------------------------------------------
  504.   def self.border; BM::ICON::HASH[:border]; end
  505.   def self.exp; BM::ICON::HASH[:exp]; end
  506.   def self.currency; BM::ICON::HASH[:currency]; end
  507.   def self.steal_gold; self.currency; end
  508.   def self.gold_cost; self.currency; end
  509.   def self.hp_cost; self.basic(2); end  
  510.   def self.mp_cost; self.basic(4); end  
  511.   def self.tp_cost; self.basic(6); end  
  512. end
  513. #==============================================================================
  514. # ** Game_Actor
  515. #==============================================================================
  516. class Game_Actor < Game_Battler
  517.   #--------------------------------------------------------------------------
  518.   # * Public Instance Variables
  519.   #--------------------------------------------------------------------------
  520.   attr_accessor :icon_index
  521.   #--------------------------------------------------------------------------
  522.   # Alias: Setup
  523.   #--------------------------------------------------------------------------
  524.   alias :bm_icon_setup :setup
  525.   def setup(actor_id)
  526.     bm_icon_setup(actor_id)
  527.     @icon_index = actor.icon_index
  528.   end
  529. end
  530. #==============================================================================
  531. # ** Window_Base
  532. #==============================================================================
  533. class Window_Base < Window
  534.   #--------------------------------------------------------------------------
  535.   # * New method: get_basic_id
  536.   #--------------------------------------------------------------------------
  537.   def get_basic_id(text)
  538.     for id in 0..7
  539.       case text; when Vocab.basic(id) then return id; end      
  540.     end
  541.     return nil
  542.   end  
  543.   #--------------------------------------------------------------------------
  544.   # * New method: get_param_id
  545.   #--------------------------------------------------------------------------
  546.   def get_param_id(text)
  547.     for id in 0..7  
  548.       case text
  549.         when Vocab.param_f(id) then return id
  550.         when Vocab.param_a(id) then return id
  551.       end
  552.     end
  553.     i = 0
  554.     for id in [:hp, :mp, :atk, :def, :mat, :mdf, :agi, :luk]
  555.       case text
  556.         when Vocab.param_a(id) then return i
  557.         when Vocab.param_f(id) then return i
  558.       end
  559.       i += 1
  560.     end
  561.     return nil
  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # * New method: get_xparam_id
  565.   #--------------------------------------------------------------------------
  566.   def get_xparam_id(text)
  567.     for id in 0..9  
  568.       case text
  569.         when Vocab.xparam_f(id) then return id
  570.         when Vocab.xparam_a(id) then return id
  571.       end
  572.     end
  573.     i = 0
  574.     for id in [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg]
  575.       case text
  576.         when Vocab.xparam_a(id) then return i
  577.         when Vocab.xparam_f(id) then return i
  578.       end
  579.       i += 1
  580.     end
  581.     return nil
  582.   end
  583.   #--------------------------------------------------------------------------
  584.   # * New method: get_sparam_id
  585.   #--------------------------------------------------------------------------
  586.   def get_sparam_id(text)
  587.     for id in 0..9  
  588.       case text
  589.         when Vocab.sparam_f(id) then return id
  590.         when Vocab.sparam_a(id) then return id
  591.       end
  592.     end
  593.     i = 0
  594.     for id in [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr]
  595.       case text
  596.         when Vocab.sparam_a(id) then return i
  597.         when Vocab.sparam_f(id) then return i
  598.       end
  599.       i += 1
  600.     end
  601.     return nil
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # * New method: get_cparam_id
  605.   #--------------------------------------------------------------------------
  606.   def get_cparam_id(text)
  607.     for id in [:hcr, :tcr_y, :gcr, :cdr, :wur, :hp_physical, :mp_physical, :hp_magical, :mp_magical, :gut]
  608.       case text
  609.         when Vocab.cparam_a(id) then return id
  610.         when Vocab.cparam_f(id) then return id
  611.       end
  612.     end
  613.     return nil
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # * New method: get_ele_id
  617.   #--------------------------------------------------------------------------
  618.   def get_ele_id(text)
  619.     for id in 1..$data_system.elements.size-1
  620.       case text; when Vocab.element(id) then return id; end
  621.     end
  622.     return nil
  623.   end
  624.   #--------------------------------------------------------------------------
  625.   # * New method: get_class_id
  626.   #--------------------------------------------------------------------------
  627.   def get_class_id(text)
  628.     for id in 1..$data_classes.size-1
  629.       case text; when Vocab.classes(id) then return id; end
  630.     end
  631.     return nil
  632.   end
  633.   #--------------------------------------------------------------------------
  634.   # * New method: get_ele_id
  635.   #--------------------------------------------------------------------------
  636.   def get_state_id(text)
  637.     for id in 1..$data_states.size-1
  638.       case text; when Vocab.state(id) then return id; end
  639.     end
  640.     return nil
  641.   end
  642.   #--------------------------------------------------------------------------
  643.   # * New method: get_command_id
  644.   #--------------------------------------------------------------------------
  645.   def get_command_id(text)
  646.     for id in 0..22
  647.       case text; when Vocab.command(id) then return id; end      
  648.     end
  649.     return nil
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # * New method: get_item_status_id
  653.   #--------------------------------------------------------------------------
  654.   def get_item_status_id(text)
  655.     return nil unless $imported["YEA-ItemMenu"] || $imported["YEA-ShopOptions"]
  656.     for id in [:hp_recover, :mp_recover, :tp_recover, :tp_gain]
  657.       case text
  658.         when Vocab::item_status(id) then return id
  659.       end
  660.     end
  661.     return nil
  662.   end
  663.   #--------------------------------------------------------------------------
  664.   # * New method: get_armor_type_id
  665.   #--------------------------------------------------------------------------
  666.   def get_armor_types_id(text)
  667.     for id in 1...$data_system.armor_types.size
  668.       case text
  669.         when Vocab.armor_types(id) then return id
  670.       end
  671.     end
  672.     return nil
  673.   end
  674.   #--------------------------------------------------------------------------
  675.   # * New method: get_weapon_type_id
  676.   #--------------------------------------------------------------------------
  677.   def get_weapon_types_id(text)
  678.     for id in 1...$data_system.weapon_types.size
  679.       case text
  680.         when Vocab.weapon_types(id) then return id
  681.       end
  682.     end
  683.     return nil
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # * New method: get_skill_type_id
  687.   #--------------------------------------------------------------------------
  688.   def get_skill_types_id(text)
  689.     for id in 1...$data_system.skill_types.size
  690.       case text
  691.         when Vocab.skill_types(id) then return id
  692.       end
  693.     end
  694.     return nil
  695.   end
  696.   #--------------------------------------------------------------------------
  697.   # * Draw Icon
  698.   #     enabled : Enabled flag. When false, draw semi-transparently.
  699.   #--------------------------------------------------------------------------
  700.   def draw_icon(icon_index, x, y, enabled = true)
  701.     if icon_index == nil && $TEST
  702.       msg = "The icon number #{icon_index} does not exist or you forgot to assign it properly."
  703.       msgbox(msg)
  704.       return
  705.     end
  706.     bitmap = Cache.system("Iconset")
  707.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  708.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  709.   end
  710.   #--------------------------------------------------------------------------
  711.   # * New Method: use_vocab_icon?
  712.   #--------------------------------------------------------------------------
  713.   def use_vocab_icon?(text)
  714.     return true if vocab_icon(text) != 0 || nil
  715.     return false
  716.   end  
  717.   #--------------------------------------------------------------------------
  718.   # * New Method: vocab_icon
  719.   #--------------------------------------------------------------------------
  720.   def vocab_icon(text)
  721.     icon  = 0
  722.     return icon = Icon.words(text) if BM::ICON::HASH[:words][text] != nil
  723.     return icon = Icon.basic(get_basic_id(text)) if (get_basic_id(text) != nil && BM::ICON::HASH[:basic][:auto])
  724.     return icon = Icon.param(get_param_id(text)) if (get_param_id(text) != nil && BM::ICON::HASH[:param][:auto])
  725.     return icon = Icon.xparam(get_xparam_id(text)) if (get_xparam_id(text) != nil && BM::ICON::HASH[:xparam][:auto])
  726.     return icon = Icon.sparam(get_sparam_id(text)) if (get_sparam_id(text) != nil && BM::ICON::HASH[:sparam][:auto])
  727.     return icon = Icon.cparam(get_cparam_id(text)) if (get_cparam_id(text) != nil && BM::ICON::HASH[:cparam][:auto])
  728.     return icon = Icon.element(get_ele_id(text)) if (get_ele_id(text) != nil && BM::ICON::HASH[:element][:auto])
  729.     return icon = Icon.class(get_class_id(text)) if (get_class_id(text) != nil && BM::ICON::HASH[:class][:auto])
  730.     return icon = Icon.state(get_state_id(text)) if (get_state_id(text) != nil && BM::ICON::HASH[:state][:auto])
  731.     return icon = Icon.item_status(get_item_status_id(text)) if get_item_status_id(text) != nil
  732.     return icon = Icon.exp if text == Vocab.exp
  733.     return (icon == nil) ? 0 : icon
  734.   end
  735.   #--------------------------------------------------------------------------
  736.   # * Draw Number (Gold Etc.) with Currency Unit
  737.   #--------------------------------------------------------------------------
  738.   alias :bm_icon_dcv :draw_currency_value
  739.   def draw_currency_value(value, unit, x, y, width)
  740.     icon = Icon.currency
  741.     bm_icon_dcv(value, unit, x, y, width)
  742.     draw_icon(icon, x, y)
  743.   end
  744.   #--------------------------------------------------------------------------
  745.   # * Alias: draw_icon_text
  746.   #--------------------------------------------------------------------------
  747.   alias :bm_icon_dt :draw_text
  748.   def draw_text(*args, &block)
  749.     case args.size
  750.     when 2,3
  751.       text = args[1]
  752.       rect = args[0]
  753.       if use_vocab_icon?(text)
  754.         rect1 = Rect.new(rect.x+24,rect.y,rect.width-24,rect.height)
  755.         args[0] = rect1
  756.       end
  757.     else
  758.       text = args[4]
  759.       rect = Rect.new(args[0],args[1],args[2],args[3])
  760.       if use_vocab_icon?(text)
  761.         args[0] += 24; args[2] -=24
  762.       end
  763.     end
  764.     draw_icon(vocab_icon(text), rect.x, rect.y) if use_vocab_icon?(text)  
  765.     if use_vocab_icon?(text)
  766.       return if BM::ICON::HASH[:words][text] != nil && !BM::ICON::HASH[:words][:show_words]
  767.       return if get_basic_id(text) != nil && !BM::ICON::HASH[:basic][:show_words]
  768.       return if get_param_id(text) != nil && !BM::ICON::HASH[:param][:show_words]
  769.     end
  770.     bm_icon_dt(*args, &block)
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # * new method: draw_gender_icon
  774.   #--------------------------------------------------------------------------
  775.   def draw_gender_icon(actor, x, y)
  776.     return unless $imported["BubsGenderFunctions"]
  777.     icon = BM::ICON::HASH[:gender][:genderless]
  778.     icon = BM::ICON::HASH[:gender][:male] if actor.male?
  779.     icon = BM::ICON::HASH[:gender][:female] if actor.female?
  780.     return unless icon != 0
  781.     draw_icon(icon, x, y)
  782.   end
  783.   #--------------------------------------------------------------------------
  784.   # * new method: draw_gender_icon
  785.   #--------------------------------------------------------------------------
  786.   def draw_align_icon(actor, x, y)
  787.     return unless $imported[:bm_align]
  788.     icon = BM::ICON::HASH[:align][actor.align_id]
  789.     return unless icon != 0
  790.     draw_icon(icon, x, y)
  791.   end
  792. end
  793. #==============================================================================
  794. # ** Window_Command
  795. #==============================================================================
  796. class Window_Command < Window_Selectable
  797.   #--------------------------------------------------------------------------
  798.   # * old Method: draw_text
  799.   #--------------------------------------------------------------------------
  800.   def draw_text(*args, &block); bm_icon_dt(*args, &block); end
  801.   #--------------------------------------------------------------------------
  802.   # * New Method: use_icon?
  803.   #--------------------------------------------------------------------------
  804.   def use_icon?(text)
  805.     if command_icon(text) != 0; return true
  806.     else; return false
  807.     end
  808.   end  
  809.   #--------------------------------------------------------------------------
  810.   # * New Method: command_icon
  811.   #--------------------------------------------------------------------------
  812.   def command_icon(text)
  813.     if $imported["YEA-CommandWindowIcons"]
  814.       return icon = YEA::COMMAND_WINDOW_ICONS::ICON_HASH[text] if YEA::COMMAND_WINDOW_ICONS::ICON_HASH.include?(text)
  815.     end
  816.     return icon = vocab_icon(text) if use_vocab_icon?(text)
  817.     return icon = Icon.command(get_command_id(text)) if get_command_id(text) != nil
  818.     return icon = Icon.skill_types(get_skill_types_id(text)) if get_skill_types_id(text) != nil
  819.     return icon = Icon.armor_types(get_armor_types_id(text)) if get_armor_types_id(text) != nil
  820.     return icon = Icon.weapon_types(get_weapon_types_id(text)) if get_weapon_types_id(text) != nil            
  821.     return (icon == nil) ? 0 : icon  
  822.   end  
  823.   #--------------------------------------------------------------------------
  824.   # * Overwrite: draw_item
  825.   #--------------------------------------------------------------------------
  826.   def draw_item(index)
  827.     enabled = command_enabled?(index)
  828.     change_color(normal_color, enabled)
  829.     rect = item_rect_for_text(index)
  830.     text = command_name(index)
  831.     if use_icon?(text)
  832.       draw_icon_text(rect.clone, text, alignment, enabled)
  833.       draw_icon(Icon.disable, rect.x, rect.y, @index == index) if !enabled
  834.     else
  835.       draw_text(rect, text, alignment)
  836.     end
  837.   end  
  838.   #--------------------------------------------------------------------------
  839.   # * New Method: draw_icon_text
  840.   #--------------------------------------------------------------------------
  841.   def draw_icon_text(rect, text, alignment, enabled)
  842.     cw = text_size(text).width
  843.     icon = command_icon(text)
  844.     draw_icon(Icon.border, rect.x, rect.y, enabled)
  845.     draw_icon(icon, rect.x, rect.y, enabled)
  846.     rect.x += 24
  847.     rect.width -= 24
  848.     draw_text(rect, text, alignment)
  849.   end  
  850. end
  851. #==============================================================================
  852. # ** Window_MenuCommand
  853. #==============================================================================
  854. class Window_MenuCommand < Window_Command
  855.   #--------------------------------------------------------------------------
  856.   # * Alias: command_icon
  857.   #--------------------------------------------------------------------------
  858.   alias :bm_xs_ci :command_icon
  859.   def command_icon(text)
  860.     if $imported["XAIL-XS-MENU_DELUX"]
  861.       $game_system.get_menu.each {|key, value|
  862.       name = value[0] == "" ? key.id2name.capitalize : value[0]
  863.       icon = value[2]
  864.       return icon if name == text
  865.       }
  866.     end
  867.     bm_xs_ci(text)
  868.   end
  869. end
  870. #==============================================================================
  871. # ** Window_SkillStatus
  872. #==============================================================================
  873. class Window_SkillStatus < Window_Base
  874.   #--------------------------------------------------------------------------
  875.   # * alias: Refresh
  876.   #--------------------------------------------------------------------------
  877.   alias :bm_icons_ref :refresh
  878.   def refresh
  879.     return unless @actor
  880.     bm_icons_ref
  881.     draw_gender_icon(@actor, 108, line_height*3)
  882.     draw_align_icon(@actor, 108+24, line_height*3)
  883.   end
  884. end
  885. #==============================================================================
  886. # ** Window_EquipActor
  887. #==============================================================================
  888. class Window_EquipActor < Window_Base
  889.   #--------------------------------------------------------------------------
  890.   # * alias: Refresh
  891.   #--------------------------------------------------------------------------
  892.   if $imported["YEA-AceEquipEngine"] && !$imported[:bm_vk_equip]
  893.   alias :bm_icons_ref :refresh
  894.   def refresh
  895.     return unless @actor
  896.     bm_icons_ref
  897.     draw_gender_icon(@actor, 108, line_height*3)
  898.     draw_align_icon(@actor, 108+24, line_height*3)
  899.   end
  900.   end
  901. end
  902. #==============================================================================
  903. class Window_MateriaList < Window_Selectable
  904.   #--------------------------------------------------------------------------
  905.   # * draw_icon
  906.   #--------------------------------------------------------------------------
  907.   def draw_icon(icon_index, x, y, enabled = true, item = 0)
  908.     bitmap = Cache.system("Iconset")
  909.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  910.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  911.   end
  912. end
  913.  
  914. #===============================================================================
  915. #
  916. # END OF FILE
  917. #
  918. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement