ScriptName playerTransformStorage Extends Quest

;-- Variables ---------------------------------------
Armor armor1
Armor armor10
Armor armor11
Armor armor12
Armor armor13
Armor armor14
Armor armor2
Armor armor3
Armor armor4
Armor armor5
Armor armor6
Armor armor7
Armor armor8
Armor armor9

;-- Properties --------------------------------------
Form Property EquippedItemLeft Auto
Form Property EquippedItemRight Auto
Race Property originalRace Auto
Int Property whatKindLeft Auto
Int Property whatKindRight Auto

;-- Functions ---------------------------------------

; Skipped compiler generated GetState

; Skipped compiler generated GotoState

Event OnInit()
  originalRace =(Game.GetForm(0x14) as Actor).GetRace()
EndEvent

Function checkForEquipedItems()
  Actor PlayerRef = Game.GetForm(0x14) as Actor
  EquippedItemLeft = PlayerRef.GetEquippedObject(0)
  EquippedItemRight = PlayerRef.GetEquippedObject(1)
  If !EquippedItemLeft
    whatKindLeft = 0
  ElseIf EquippedItemLeft as Weapon
    whatKindLeft = 1
  ElseIf EquippedItemLeft as Spell
    whatKindLeft = 2
  Else
    whatKindLeft = 1
  EndIf
  If !EquippedItemRight
    whatKindRight = 0
  ElseIf EquippedItemRight as Weapon
    whatKindRight = 1
  ElseIf EquippedItemRight as Spell
    whatKindRight = 2
  Else
    whatKindLeft = 1
  EndIf
  armor1 = PlayerRef.GetWornForm(1) as Armor
  armor2 = PlayerRef.GetWornForm(2) as Armor
  armor3 = PlayerRef.GetWornForm(4) as Armor
  armor4 = PlayerRef.GetWornForm(8) as Armor
  armor5 = PlayerRef.GetWornForm(16) as Armor
  armor6 = PlayerRef.GetWornForm(32) as Armor
  armor7 = PlayerRef.GetWornForm(64) as Armor
  armor8 = PlayerRef.GetWornForm(128) as Armor
  armor9 = PlayerRef.GetWornForm(256) as Armor
  armor10 = PlayerRef.GetWornForm(512) as Armor
  armor11 = PlayerRef.GetWornForm(1024) as Armor
  armor12 = PlayerRef.GetWornForm(2048) as Armor
  armor13 = PlayerRef.GetWornForm(4096) as Armor
  armor14 = PlayerRef.GetWornForm(8192) as Armor
EndFunction

Function equipeItems()
  Actor PlayerRef = Game.GetForm(0x14) as Actor
  If whatKindRight == 2
    PlayerRef.EquipSpell(EquippedItemRight as Spell, 1)
  Else
	if SKSE.GetVersion()
		PlayerRef.EquipItemEx(EquippedItemRight, 1, False, True)
	else
		PlayerRef.EquipItem(EquippedItemRight, False, True)
	endif
  EndIf
  If whatKindLeft == 2
    PlayerRef.EquipSpell(EquippedItemLeft as Spell, 0)
  Else
	if SKSE.GetVersion()
		PlayerRef.EquipItemEx(EquippedItemLeft, 2, False, True)
	else
		PlayerRef.EquipItem(EquippedItemLeft, False, True)
	endif
  EndIf
  If armor1
    PlayerRef.EquipItem(armor1 as Form, False, True)
  EndIf
  If armor2
    PlayerRef.EquipItem(armor2 as Form, False, True)
  EndIf
  If armor3
    PlayerRef.EquipItem(armor3 as Form, False, True)
  EndIf
  If armor4
    PlayerRef.EquipItem(armor4 as Form, False, True)
  EndIf
  If armor5
    PlayerRef.EquipItem(armor5 as Form, False, True)
  EndIf
  If armor6
    PlayerRef.EquipItem(armor6 as Form, False, True)
  EndIf
  If armor7
    PlayerRef.EquipItem(armor7 as Form, False, True)
  EndIf
  If armor8
    PlayerRef.EquipItem(armor8 as Form, False, True)
  EndIf
  If armor9
    PlayerRef.EquipItem(armor9 as Form, False, True)
  EndIf
  If armor10
    PlayerRef.EquipItem(armor10 as Form, False, True)
  EndIf
  If armor11
    PlayerRef.EquipItem(armor11 as Form, False, True)
  EndIf
  If armor12
    PlayerRef.EquipItem(armor12 as Form, False, True)
  EndIf
  If armor13
    PlayerRef.EquipItem(armor13 as Form, False, True)
  EndIf
  If armor14
    PlayerRef.EquipItem(armor14 as Form, False, True)
  EndIf
EndFunction