Scriptname aaaa_MCM_Quest extends SKI_ConfigBase  Conditional

String Name
Form[] Property EquippedItem auto ; slot mask http://www.creationkit.com/Slot_Masks_-_Armor
String[] Property ItemName Auto
Spell Property GetActorSpell Auto
int[] Property kSlotMask Auto
int[]	IDs

Event Oninit()
	IDs = New Int[35]
	ItemName = New String[35]
	GetSpell()
endEvent

Event OnPlayerLoadGame()
	GetSpell()
endEvent

Function GetSpell()
	if !Game.GetPlayer().HasSpell(GetActorSpell)
		Game.GetPlayer().AddSpell(GetActorSpell)
	endif
endFunction

Event OnPageReset(String a_Page)
	int index = 0
	int max = SetSlot()
	SetCursorFillMode(TOP_TO_BOTTOM)
	While index < max
		if ItemName[index]
			IDs[index] = AddTextOption(SlotName(index), ItemName[index])
		endif
		index += 1

		if index == 3
			AddEmptyOption()
		elseif index == 11
			SetCursorPosition(1)
		elseif index == 23
			SetCursorPosition(26)
		elseif index == 29
			SetCursorPosition(27)
		endif
	endWhile
endEvent

int Function SetSlot()
	kSlotMask = New int[35]
	kSlotMask[0]  = 0x00000000	;left
	kSlotMask[1]  = 0x00000001	;right
	kSlotMask[2]  = 0x00000002	;shout
	kSlotMask[3]  = 0x00000001
	kSlotMask[4]  = 0x00000002
	kSlotMask[5]  = 0x00000004
	kSlotMask[6]  = 0x00000008
	kSlotMask[7]  = 0x00000010
	kSlotMask[8]  = 0x00000020
	kSlotMask[9]  = 0x00000040
	kSlotMask[10] = 0x00000080
	kSlotMask[11] = 0x00000100
	kSlotMask[12] = 0x00000200
	kSlotMask[13] = 0x00000400
	kSlotMask[14] = 0x00000800
	kSlotMask[15] = 0x00001000
	kSlotMask[16] = 0x00002000
	kSlotMask[17] = 0x00004000
	kSlotMask[18] = 0x00008000
	kSlotMask[19] = 0x00010000
	kSlotMask[20] = 0x00020000
	kSlotMask[21] = 0x00040000
	kSlotMask[22] = 0x00080000
	kSlotMask[23] = 0x00100000
	kSlotMask[24] = 0x00200000
	kSlotMask[25] = 0x00400000
	kSlotMask[26] = 0x00800000
	kSlotMask[27] = 0x01000000
	kSlotMask[28] = 0x02000000
	kSlotMask[29] = 0x04000000
	kSlotMask[30] = 0x08000000
	kSlotMask[31] = 0x10000000
	kSlotMask[32] = 0x20000000
	kSlotMask[33] = 0x40000000
	kSlotMask[34] = 0x80000000
	return kSlotMask.length
endFunction

String Function SlotName(int i)
	if i == 0
		return "LeftHand"
	elseif i == 1
		return "RightHand"
	elseif i == 2
		return "Shout"
	elseif i == 3
		return "Head(30)"
	elseif i == 4
		return "Hair(31)"
	elseif i == 5
		return "Body(32)"
	elseif i == 6
		return "Hands(33)"
	elseif i == 7
		return "Forearms(34)"
	elseif i == 8
		return "Amulet(35)"
	elseif i == 9
		return "Ring(36)"
	elseif i == 10
		return "Feet(37)"
	elseif i == 11
		return "Calves(38)"
	elseif i == 12
		return "Shield(39)"
	elseif i == 13
		return "Tail(40)"
	elseif i == 14
		return "LongHair(41)"
	elseif i == 15
		return "Circlet(42)"
	elseif i == 16
		return "Ears(43)"
	elseif i == 17
		return "Face/Mouth(44)"
	elseif i == 18
		return "Neck(45)"
	elseif i == 19
		return "Chest1(46)"
	elseif i == 20
		return "Back(47)"
	elseif i == 21
		return "Misc/FX(48)"
	elseif i == 22
		return "Pelvis1(49)"
	elseif i == 23
		return "DecapitateHead(50)"
	elseif i == 24
		return "Decapitate(51)"
	elseif i == 25
		return "Pelvis2(52)"
	elseif i == 26
		return "Leg1(53)"
	elseif i == 27
		return "Leg2(54)"
	elseif i == 28
		return "Face/Jewelry(55)"
	elseif i == 29
		return "Chest2(56)"
	elseif i == 30
		return "Shoulder(57)"
	elseif i == 31
		return "Arm2(58)"
	elseif i == 32
		return "Arm1(59)"
	elseif i == 33
		return "Misc/FX(60)"
	elseif i == 34
		return "FX01(61)"
	endif
	return None
endFunction