Advertisement
roninator2

Yami Order Battlers - Class Icons

Dec 11th, 2024
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.06 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ YSA Battle Add-On: Order Battlers - Class Icons
  4. # -- Last Updated: 2012.02.20
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9. # ▼ Instructions
  10. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  11. # Place below Order Battlers
  12. #
  13. # -----------------------------------------------------------------------------
  14. # Class Notetags - These notetags go in the class notebox in the database.
  15. # -----------------------------------------------------------------------------
  16. # <battler class icon: x>
  17. # Change actor's icon into x for class
  18. #
  19. # <class icon hue: x>
  20. # Change icon hue.
  21. #
  22. #==============================================================================
  23. module YSA
  24.   module REGEXP
  25.     module ACTOR
  26.       BATTLER_CLASS_ICON = /<(?:BATTLER_CLASS_ICON|battler class icon):[ ](\d+)?>/i
  27.       CLASS_ICON_HUE = /<(?:CLASS_ICON_HUE|class icon hue):[ ](\d+)?>/i
  28.     end # ACTOR
  29.   end
  30. end
  31. class RPG::Class < RPG::BaseItem
  32.   attr_accessor :battler_class_icon
  33.   attr_accessor :class_icon_hue
  34.     def load_notetags_orbt
  35.     @battler_class_icon = YSA::ORDER_GAUGE::DEFAULT_ACTOR_ICON
  36.     #---
  37.     self.note.split(/[\r\n]+/).each { |line|
  38.       case line
  39.       #---
  40.       when YSA::REGEXP::ACTOR::BATTLER_CLASS_ICON
  41.         @battler_class_icon = $1.to_i
  42.       when YSA::REGEXP::ACTOR::CLASS_ICON_HUE
  43.         @class_icon_hue = $1.to_i
  44.       end
  45.     }
  46.   end
  47. end
  48. class Game_Battler < Game_BattlerBase
  49.   def battler_class_icon
  50.     aci = $data_classes[actor.class_id]
  51.     aci.battler_class_icon
  52.   end
  53.   def battler_class_icon_hue
  54.     aci = $data_classes[actor.class_id]
  55.     aci.class_icon_hue
  56.   end
  57. end
  58. module DataManager
  59.   def self.load_notetags_orbt
  60.     groups = [$data_enemies + $data_actors + $data_classes]
  61.     for group in groups
  62.       for obj in group
  63.         next if obj.nil?
  64.         obj.load_notetags_orbt
  65.       end
  66.     end
  67.   end
  68. end # DataManager
  69. class Sprite_OrderBattler < Sprite_Base
  70.   def create_dtb_style
  71.     bitmap = Bitmap.new(24, 24)
  72.     if $imported["YEA-BattleEngine"]
  73.       icon_bitmap = $game_temp.iconset
  74.     else
  75.       icon_bitmap = Cache.system("IconSet")
  76.     end
  77.     #--- Create Battler Background ---
  78.     icon_index = @battler.actor? ? YSA::ORDER_GAUGE::BATTLER_ICON_BORDERS[:actor][0] : YSA::ORDER_GAUGE::BATTLER_ICON_BORDERS[:enemy][0]
  79.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  80.     bitmap.blt(0, 0, icon_bitmap, rect)
  81.     #--- Create Battler Icon ---
  82.     ######## edited for class icons
  83.     if @battler.actor?
  84.       if @battler.battler_class_icon == YSA::ORDER_GAUGE::DEFAULT_ACTOR_ICON
  85.         icon_index = @battler.battler_icon
  86.       else
  87.         icon_index = @battler.battler_class_icon
  88.       end
  89.     else
  90.       icon_index = @battler.battler_icon
  91.     end
  92.     ########
  93.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  94.     temp_bitmap = Bitmap.new(24, 24)
  95.     temp_bitmap.blt(0, 0, icon_bitmap, rect)
  96.     ######## edited for class hue
  97.     if @battler.actor?
  98.       temp_bitmap.hue_change(@battler.battler_icon_hue) if @battler.battler_icon_hue
  99.       temp_bitmap.hue_change(@battler.battler_class_icon_hue) if @battler.battler_class_icon_hue
  100.     else
  101.       temp_bitmap.hue_change(@battler.battler_icon_hue) if @battler.battler_icon_hue
  102.     end
  103.     ########
  104.     bitmap.blt(0, 0, temp_bitmap, Rect.new(0, 0, 24, 24))
  105.     temp_bitmap.dispose
  106.     #--- Create Battler Border ---
  107.     icon_index = @battler.actor? ? YSA::ORDER_GAUGE::BATTLER_ICON_BORDERS[:actor][1] : YSA::ORDER_GAUGE::BATTLER_ICON_BORDERS[:enemy][1]
  108.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  109.     bitmap.blt(0, 0, icon_bitmap, rect)
  110.     #---
  111.     self.bitmap.dispose if self.bitmap != nil
  112.     self.bitmap = bitmap
  113.     return if @created_icon
  114.     @created_icon = true
  115.     self.ox = 12; self.oy = 12
  116.     self.x = 24 if @battle != :pctb2 && @battle != :pctb3
  117.     self.y = 24
  118.     self.z = 8000
  119.   end
  120. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement