. Their HUD was positioned differently so I had to fiddle with the numbers again to get it back to default:
class Hotkey_Assignment < Sprite
def initialize(viewport = nil)
# call superclass
super
# create bitmap
self.bitmap = Bitmap.new(320, 32)
# set font to bold
self.bitmap.font.bold = true
# decrease font size
self.bitmap.font.size -= 8
# set font color
self.bitmap.font.color = system_color
# Item quantities (set-up properties) ====================
@item_qty_sprite = Sprite.new(viewport)
@item_qty_sprite.bitmap = Bitmap.new(320, 32)
@item_qty_sprite.x = 164
@item_qty_sprite.y = 0
@item_qty_sprite.bitmap.font.name = "Arial"
@item_qty_sprite.bitmap.font.color = Color.new(255,255,255,255)
@item_qty_sprite.bitmap.font.size = 12
@old_qty = {}
# End =====================================================
# set x and y position
self.x, self.y, self.z = 160, 0, 1100
# skill IDs on hotkeys
@skills = BlizzABS::Cache::EmptyKeys
# item IDs on hotkeys
@items = BlizzABS::Cache::EmptyKeys
# update display
update
end
alias set_qty_z z=
def z=(amt)
@item_qty_sprite.z = amt + 100
set_qty_z(amt)
end
def draw(index = nil)
# iterate through all hotkeys
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
# if hotkey is skill hotkey
if $game_player.skill_hotkeys[i%10] != 0
# temporary object
object = $data_skills[$game_player.skill_hotkeys[i%10]]
# if hotkey is item hotkey
elsif $game_player.item_hotkeys[i%10] != 0
# temporary object
object = $data_items[$game_player.item_hotkeys[i%10]]
qty = $game_party.item_number(object.id)
end
# if any change applied (10 is used for 0)
if @items[i%10] != $game_player.item_hotkeys[i%10] ||
@skills[i%10] != $game_player.skill_hotkeys[i%10]
# remove this icon
self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
# fill icon bachground
self.bitmap.fill_rect(32*(i-1)+4, 4, 24, 24, Color.new(0, 0, 0, 128))
# if object exists
if object != nil
# load bitmap
bitmap = RPG::Cache.icon(object.icon_name)
# Draw item quantity
if qty != nil
@old_qty[object.id] = -1
update_item_qty(i)
else
@item_qty_sprite.bitmap.fill_rect(32*(i-1), 10, 32, 32, Color.new(0,0,0,0))
end
# draw bitmap
self.bitmap.blt(32*(i-1)+4, 4, bitmap, Rect.new(0, 0, 24, 24))
end
# draw hotkey number
self.bitmap.draw_text_full(32*(i-1), 10, 30, 32, (i%10).to_s, 2)
end}
# set new items
@items = $game_player.item_hotkeys.clone
# set new skills
@skills = $game_player.skill_hotkeys.clone
end
def update_item_qty(index = nil)
items_done = []
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
if $game_player.item_hotkeys[i%10] != 0
object_id = $game_player.item_hotkeys[i%10]
qty = $game_party.item_number(object_id)
if items_done.include?(object_id) || qty != @old_qty[object_id]
# Set new quantity
@old_qty[object_id] = qty
# Clear old quantity number
@item_qty_sprite.bitmap.fill_rect(32*(i-1), 10, 32, 32, Color.new(0,0,0,0))
@item_qty_sprite.bitmap.draw_text_full(32*(i-1)+1, 10, 32, 32, qty.to_s)
# If this item has any duplicates in hotkeys, make changes to them too
items_done.push(object_id)
end
end
}
end
alias dispose_all_sprites dispose
def dispose
@item_qty_sprite.dispose
dispose_all_sprites
end
alias hud_update update
def update
$game_system.hotkeys = $game_system.hud
@item_qty_sprite.visible = $game_system.hud
update_item_qty if @item_qty_sprite.visible
hud_update
end
end