Dainekoichi's Skill Core Script Add on Request - Automatic Skill Core Sorting + Remova All actor skill cores in menu

Basically need to figure out a way to store which core IDs each actor has equipped before the sort, then after the sort figure out what ID those cores are *now* and change the ID to that one.
I see. I wish I could be of more help but my coding knowledge is very limited, I've coded a few very basic scripts for my game, but that's about it. I'm so glad everyone here has been so helpful. I would have given up if it weren't for the assitance.

If you can find a way to help whenever you have time, I really appreciate it, if not I undertstand. Thank you for your effort.
Code:
# Addon by TRIHAN

module DAI
  module SKILLCORES
    SORT_TEXT = "  Sort"
    REMOVE_ALL_TEXT = "  Remove All"
  end
end

Game_Actor.class_eval do
  def remove_all_skillcores
    for i in 0...$game_party.skillcores.length
      if $game_party.skillcores[i][:actor] == @actor_id
        $game_party.skillcores[i][:actor] = 0
      end
    end
    @skillcores = []
    i = 0
    while i < DAI::SKILLCORES::EQUIP_COUNT
      @skillcores.push(-1)
      i += 1
    end # while
    return
  end
  
  def rearrange_skillcores(core_names)
    @skillcores = core_names.map {|core| core != nil ? $game_party.skillcores.map {|core| core[:name]}.index(core) : -1 }
  end
end

Window_SklCoreCommand.class_eval do
  alias_method(:tlb_draw_item, :draw_item)
  def draw_item(index)
    rect = item_rect_for_text(index)
    if @list[index][:name] == DAI::SKILLCORES::SORT_TEXT || @list[index][:name] == DAI::SKILLCORES::REMOVE_ALL_TEXT
      draw_text(rect, @list[index][:name], alignment)
      return
    end
    tlb_draw_item(index)
  end
end

Window_SklCoreItems.class_eval do
  alias_method(:tlb_make_command_list, :make_command_list)
  def make_command_list
    tlb_make_command_list
    add_command(DAI::SKILLCORES::SORT_TEXT,:sort,true,nil)
    add_command(DAI::SKILLCORES::REMOVE_ALL_TEXT,:remove_all,true,nil)
  end # def
end

Scene_SkillCore.class_eval do
  alias_method(:tlb_start, :start)
  def start
    tlb_start
    @cores_window.set_handler(:sort,    method(:sort_cores))
    @cores_window.set_handler(:remove_all,  method(:remove_all_cores))
  end

  def sort_cores
    actor_cores = {}
    for i in 1...$data_actors.length
      actor = $game_actors[i]
      actor_cores[i] = actor.skillcores.map {|core| core > -1 ? $game_party.skillcores[core][:name] : nil }
    end
    $game_party.skillcores.sort_by! { |core| [core[:icon], core[:name]] }
    for i in 1...$data_actors.length
      actor = $game_actors[i]
      actor.rearrange_skillcores(actor_cores[i])
    end
    @cores_window.refresh
    @equip_window.refresh
    on_cores_cancel
  end

  def remove_all_cores
    @actor.remove_all_skillcores
    @cores_window.refresh
    @equip_window.refresh
    on_cores_cancel
  end
end

Got it.
Once again, I applaud you for this. Thank you so much, it seems to work perfectly so far. I will be sure of any further errors if I ever encounter them.

One day I may even commission you. I really wish I could afford it, when I can I will definitely consider you.
Always happy to help. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/dainekoichis-skill-core-script-add-on-request-automatic-skill-core-sorting-remova-all-actor-skill-cores-in-menu.123388/