local KeyMapper = import('/lua/keymap/keymapper.lua')
local Prefs = import('/lua/user/prefs.lua')
local orderbegin = 800

function Init()
-- general Grouping keys
	KeyMapper.SetUserKeyAction('filter_to_battalion', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FilterToBattalion()', category = 'selection', order = orderbegin})
	KeyMapper.SetUserKeyAction('factory_selection_curr', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect()', category = 'selection', order = orderbegin + 1})
	KeyMapper.SetUserKeyAction('select_next_unit', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectNextUnitFromBattalion()', category = 'selection', order = orderbegin + 2})
	KeyMapper.SetUserKeyAction('select_next_unit_append', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectNextUnitFromBattalion(true)', category = 'selection', order = orderbegin + 3})
    KeyMapper.SetUserKeyAction('select_next_subgroup', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectNextSquadFromBattalion()', category = 'selection', order = orderbegin + 4})
    KeyMapper.SetUserKeyAction('select_next_subgroup_append', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectNextSquadFromBattalion(true)', category = 'selection', order = orderbegin + 5})
	KeyMapper.SetUserKeyAction('fill_current_battalion_type', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(9,true)', category = 'selection', order = orderbegin + 6})
	KeyMapper.SetUserKeyAction('fill_current_battalion_divide', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(3)', category = 'selection', order = orderbegin + 7})
    KeyMapper.SetUserKeyAction('set_return_fire', {action =	'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").ReturnFire()', category = 'orders', order = orderbegin + 8})
    KeyMapper.SetUserKeyAction('set_hold_fire', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").HoldFire()', category = 'orders', order = orderbegin + 9})
    KeyMapper.SetUserKeyAction('set_cascade_fire_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CascadeFire(1)', category = 'orders', order = orderbegin + 10})
    KeyMapper.SetUserKeyAction('set_cascade_fire_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CascadeFire(2)', category = 'orders', order = orderbegin + 11})
    KeyMapper.SetUserKeyAction('toggle_autoselect_inversion', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").ToggleAutoselectInversion()', category = 'selection', order = orderbegin + 12})

-- Grouping selection keys
    KeyMapper.SetUserKeyAction('select_subgroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(1)', category = 'selection', order = orderbegin + 20})
    KeyMapper.SetUserKeyAction('select_subgroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(2)', category = 'selection', order = orderbegin + 21})
    KeyMapper.SetUserKeyAction('select_subgroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(3)', category = 'selection', order = orderbegin + 22})
    KeyMapper.SetUserKeyAction('select_subgroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(4)', category = 'selection', order = orderbegin + 23})
    KeyMapper.SetUserKeyAction('select_subgroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(5)', category = 'selection', order = orderbegin + 24})
    KeyMapper.SetUserKeyAction('select_subgroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(6)', category = 'selection', order = orderbegin + 25})
    KeyMapper.SetUserKeyAction('select_subgroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(7)', category = 'selection', order = orderbegin + 26})
    KeyMapper.SetUserKeyAction('select_subgroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(8)', category = 'selection', order = orderbegin + 27})
    KeyMapper.SetUserKeyAction('select_subgroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(9)', category = 'selection', order = orderbegin + 28})
    KeyMapper.SetUserKeyAction('select_subgroup_0', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectSquad(10)', category = 'selection', order = orderbegin + 29})

    KeyMapper.SetUserKeyAction('select_supergroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(1)', category = 'selection', order = orderbegin + 30})
    KeyMapper.SetUserKeyAction('select_supergroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(2)', category = 'selection', order = orderbegin + 31})
    KeyMapper.SetUserKeyAction('select_supergroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(3)', category = 'selection', order = orderbegin + 32})
    KeyMapper.SetUserKeyAction('select_supergroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(4)', category = 'selection', order = orderbegin + 33})
    KeyMapper.SetUserKeyAction('select_supergroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(5)', category = 'selection', order = orderbegin + 34})
    KeyMapper.SetUserKeyAction('select_supergroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(6)', category = 'selection', order = orderbegin + 35})
    KeyMapper.SetUserKeyAction('select_supergroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(7)', category = 'selection', order = orderbegin + 36})
    KeyMapper.SetUserKeyAction('select_supergroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(8)', category = 'selection', order = orderbegin + 37})
    KeyMapper.SetUserKeyAction('select_supergroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(9)', category = 'selection', order = orderbegin + 38})
    KeyMapper.SetUserKeyAction('select_supergroup_0', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").SelectBattalion(10)', category = 'selection', order = orderbegin + 39})

    KeyMapper.SetUserKeyAction('create_subgroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(1)', category = 'selection', order = orderbegin + 40})
    KeyMapper.SetUserKeyAction('create_subgroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(2)', category = 'selection', order = orderbegin + 41})
    KeyMapper.SetUserKeyAction('create_subgroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(3)', category = 'selection', order = orderbegin + 42})
    KeyMapper.SetUserKeyAction('create_subgroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(4)', category = 'selection', order = orderbegin + 43})
    KeyMapper.SetUserKeyAction('create_subgroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(5)', category = 'selection', order = orderbegin + 44})
    KeyMapper.SetUserKeyAction('create_subgroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(6)', category = 'selection', order = orderbegin + 45})
    KeyMapper.SetUserKeyAction('create_subgroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(7)', category = 'selection', order = orderbegin + 46})
    KeyMapper.SetUserKeyAction('create_subgroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(8)', category = 'selection', order = orderbegin + 47})
    KeyMapper.SetUserKeyAction('create_subgroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(9)', category = 'selection', order = orderbegin + 48})
    KeyMapper.SetUserKeyAction('create_subgroup_0', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").CreateSquad(10)', category = 'selection', order = orderbegin + 49})

    KeyMapper.SetUserKeyAction('add_to_subgroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(1)', category = 'selection', order = orderbegin + 50})
    KeyMapper.SetUserKeyAction('add_to_subgroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(2)', category = 'selection', order = orderbegin + 51})
    KeyMapper.SetUserKeyAction('add_to_subgroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(3)', category = 'selection', order = orderbegin + 52})
    KeyMapper.SetUserKeyAction('add_to_subgroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(4)', category = 'selection', order = orderbegin + 53})
    KeyMapper.SetUserKeyAction('add_to_subgroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(5)', category = 'selection', order = orderbegin + 54})
    KeyMapper.SetUserKeyAction('add_to_subgroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(6)', category = 'selection', order = orderbegin + 55})
    KeyMapper.SetUserKeyAction('add_to_subgroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(7)', category = 'selection', order = orderbegin + 56})
    KeyMapper.SetUserKeyAction('add_to_subgroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(8)', category = 'selection', order = orderbegin + 57})
    KeyMapper.SetUserKeyAction('add_to_subgroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(9)', category = 'selection', order = orderbegin + 58})
    KeyMapper.SetUserKeyAction('add_to_subgroup_0', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendToSquad(10)', category = 'selection', order = orderbegin + 59})

    KeyMapper.SetUserKeyAction('append_supergroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(1)', category = 'selection', order = orderbegin + 60})
    KeyMapper.SetUserKeyAction('append_supergroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(2)', category = 'selection', order = orderbegin + 61})
    KeyMapper.SetUserKeyAction('append_supergroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(3)', category = 'selection', order = orderbegin + 62})
    KeyMapper.SetUserKeyAction('append_supergroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(4)', category = 'selection', order = orderbegin + 63})
    KeyMapper.SetUserKeyAction('append_supergroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(5)', category = 'selection', order = orderbegin + 64})
    KeyMapper.SetUserKeyAction('append_supergroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(6)', category = 'selection', order = orderbegin + 65})
    KeyMapper.SetUserKeyAction('append_supergroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(7)', category = 'selection', order = orderbegin + 66})
    KeyMapper.SetUserKeyAction('append_supergroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(8)', category = 'selection', order = orderbegin + 67})
    KeyMapper.SetUserKeyAction('append_supergroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(9)', category = 'selection', order = orderbegin + 68})
    KeyMapper.SetUserKeyAction('append_supergroup_0', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendBattalionToSelection(10)', category = 'selection', order = orderbegin + 69})

    KeyMapper.SetUserKeyAction('append_subgroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(1)', category = 'selection', order = orderbegin + 70})
    KeyMapper.SetUserKeyAction('append_subgroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(2)', category = 'selection', order = orderbegin + 71})
    KeyMapper.SetUserKeyAction('append_subgroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(3)', category = 'selection', order = orderbegin + 72})
    KeyMapper.SetUserKeyAction('append_subgroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(4)', category = 'selection', order = orderbegin + 73})
    KeyMapper.SetUserKeyAction('append_subgroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(5)', category = 'selection', order = orderbegin + 74})
    KeyMapper.SetUserKeyAction('append_subgroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(6)', category = 'selection', order = orderbegin + 75})
    KeyMapper.SetUserKeyAction('append_subgroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(7)', category = 'selection', order = orderbegin + 76})
    KeyMapper.SetUserKeyAction('append_subgroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(8)', category = 'selection', order = orderbegin + 77})
    KeyMapper.SetUserKeyAction('append_subgroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(9)', category = 'selection', order = orderbegin + 78})
    KeyMapper.SetUserKeyAction('append_subgroup_0', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").AppendSquadToSelection(10)', category = 'selection', order = orderbegin + 79})

    KeyMapper.SetUserKeyAction('create_supergroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(1,true)', category = 'selection', order = orderbegin + 80})
    KeyMapper.SetUserKeyAction('create_supergroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(2,true)', category = 'selection', order = orderbegin + 81})
    KeyMapper.SetUserKeyAction('create_supergroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(3,true)', category = 'selection', order = orderbegin + 82})
    KeyMapper.SetUserKeyAction('create_supergroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(4,true)', category = 'selection', order = orderbegin + 83})
    KeyMapper.SetUserKeyAction('create_supergroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(5,true)', category = 'selection', order = orderbegin + 84})
    KeyMapper.SetUserKeyAction('create_supergroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(6,true)', category = 'selection', order = orderbegin + 85})
    KeyMapper.SetUserKeyAction('create_supergroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(7,true)', category = 'selection', order = orderbegin + 86})
    KeyMapper.SetUserKeyAction('create_supergroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(8,true)', category = 'selection', order = orderbegin + 87})
    KeyMapper.SetUserKeyAction('create_supergroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(9,true)', category = 'selection', order = orderbegin + 88})
    KeyMapper.SetUserKeyAction('create_supergroup_0', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillBattalion(10,true)', category = 'selection', order = orderbegin + 89})

    KeyMapper.SetUserKeyAction('divide_supergroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(1)', category = 'selection', order = orderbegin + 90})
    KeyMapper.SetUserKeyAction('divide_supergroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(2)', category = 'selection', order = orderbegin + 91})
    KeyMapper.SetUserKeyAction('divide_supergroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(3)', category = 'selection', order = orderbegin + 92})
    KeyMapper.SetUserKeyAction('divide_supergroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(4)', category = 'selection', order = orderbegin + 93})
    KeyMapper.SetUserKeyAction('divide_supergroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(5)', category = 'selection', order = orderbegin + 94})
    KeyMapper.SetUserKeyAction('divide_supergroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(6)', category = 'selection', order = orderbegin + 95})
    KeyMapper.SetUserKeyAction('divide_supergroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(7)', category = 'selection', order = orderbegin + 96})
    KeyMapper.SetUserKeyAction('divide_supergroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(8)', category = 'selection', order = orderbegin + 97})
    KeyMapper.SetUserKeyAction('divide_supergroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(9)', category = 'selection', order = orderbegin + 98})
    KeyMapper.SetUserKeyAction('divide_supergroup_10', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FillCurrentBattalion(10)', category = 'selection', order = orderbegin + 99})

    KeyMapper.SetUserKeyAction('factories_supergroup_1', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(1)', category = 'selection', order = orderbegin + 100})
    KeyMapper.SetUserKeyAction('factories_supergroup_2', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(2)', category = 'selection', order = orderbegin + 101})
    KeyMapper.SetUserKeyAction('factories_supergroup_3', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(3)', category = 'selection', order = orderbegin + 102})
    KeyMapper.SetUserKeyAction('factories_supergroup_4', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(4)', category = 'selection', order = orderbegin + 103})
    KeyMapper.SetUserKeyAction('factories_supergroup_5', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(5)', category = 'selection', order = orderbegin + 104})
    KeyMapper.SetUserKeyAction('factories_supergroup_6', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(6)', category = 'selection', order = orderbegin + 105})
    KeyMapper.SetUserKeyAction('factories_supergroup_7', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(7)', category = 'selection', order = orderbegin + 106})
    KeyMapper.SetUserKeyAction('factories_supergroup_8', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(8)', category = 'selection', order = orderbegin + 107})
    KeyMapper.SetUserKeyAction('factories_supergroup_9', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(9)', category = 'selection', order = orderbegin + 108})
    KeyMapper.SetUserKeyAction('factories_supergroup_10', {action = 'UI_Lua import("/mods/W_Groups/modules/groupinterface.lua").FactorySelect(10)', category = 'selection', order = orderbegin + 109})
end