Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** Window_ChangeClass
- #------------------------------------------------------------------------------
- # Change dem classes!
- #==============================================================================
- class Window_ChangeClass < Window_Command
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :lightupnum
- #--------------------------------------------------------------------------
- # * Initialize Command Selection Position (Class Method)
- #--------------------------------------------------------------------------
- def self.init_command_position
- @@last_command_symbol = nil
- end
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, actor)
- @list = []
- @actor=actor
- @targclass = 0
- super(x, y)
- #initialise_specialBG
- printf "actor is %s\n",actor.name
- #create_sprites
- activate
- select_current
- refresh
- end
- #--------------------------------------------------------------------------
- # * create class list
- #--------------------------------------------------------------------------
- # I know! It's a monster!
- # generates three arrays that record the command data (@list)
- # image names I'll need for later (currently unused) and @occupied classes
- # as far as I can tell all this is now completely WAI
- def make_command_list
- @list = []
- @classimages = []
- @occupied = []
- @actor.classes.each do |entry|
- if $game_variables[entry+20] > 0
- n=0
- pushit = -1
- while n<$game_party.members.size
- order = [0,1,2] if n==0
- order = [-1,0,1] if n==1
- order = [-2,-1,0] if n==2
- order.each do |i|
- if entry == ($game_party.members[n].class_id+i) and $game_party.members[n].class_id > 1 and $game_party.members[n].class_id < 29
- pushit = n
- #printf "IDs match: entry = %d, class_id = %d, n = %d, i = %d\n",entry,$game_party.members[n].class_id,n,i
- elsif pushit == -1
- #printf "no match: entry = %d, class_id = %d, n = %d, i = %d\n",entry,$game_party.members[n].class_id,n,i
- end
- end
- n += 1
- end
- @occupied.push(pushit)
- printf "pushing %d for %d\n",@occupied.last,entry
- #printf "%d found\n",entry
- add_command($data_classes[entry].name, :on_ok, @occupied.last, entry)
- $data_classes[entry].note.split( /\n */ ).each do |line|
- #printf "Class Notes: %s\n",line
- bits=line.split( /= */ )
- case
- when bits[0]=="face"
- @classimages.push(bits[1].chomp)
- when bits[0]=="facenum"
- bobs=bits[1].split(",")
- if @actor.index == (bobs[0].to_i - 1)
- @classimages.push(bobs[1].chomp)
- end
- end
- end
- end
- end
- end
- def am_i_class?(index)
- true
- end
- #--------------------------------------------------------------------------
- # * create sprites
- #--------------------------------------------------------------------------
- def create_sprites
- @images = []
- n=0
- while n<@classes.length
- @images[n] = Sprite_MenuBack.new(n*10,n*10,@classimages[n],255,"Front")
- n += 1
- end
- end
- def am_i_char?(index)
- false
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # * Get Window Height
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- @list.length
- end
- #--------------------------------------------------------------------------
- # * Get Item Height
- #--------------------------------------------------------------------------
- def item_height
- line_height
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- #def draw_item(index)
- #just using the default window_command one for now
- #end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- @targclass = current_data[:ext]
- super
- make_command_list
- refresh
- end
- #--------------------------------------------------------------------------
- # * Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_current
- select(0)
- end
- def draw_sprites
- n=0
- @images[@lightupnum].update
- @images[@lightupnum].blt_to_target(@backgroundimg)
- while n<@images.size do
- if n != @lightupnum
- @images[n].update
- @images[n].blt_to_target(@backgroundimg)
- end
- n +=1
- end
- end
- def targclass?
- @targclass
- end
- def occupied?
- @occupied[index]
- end
- end
RAW Paste Data