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.GetPlayer().GetRace()
EndEvent

Function checkForEquipedItems()
  Actor PlayerRef = Game.GetPlayer()
  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 = Game.GetPlayer().GetWornForm(1) as Armor
  armor2 = Game.GetPlayer().GetWornForm(2) as Armor
  armor3 = Game.GetPlayer().GetWornForm(4) as Armor
  armor4 = Game.GetPlayer().GetWornForm(8) as Armor
  armor5 = Game.GetPlayer().GetWornForm(16) as Armor
  armor6 = Game.GetPlayer().GetWornForm(32) as Armor
  armor7 = Game.GetPlayer().GetWornForm(64) as Armor
  armor8 = Game.GetPlayer().GetWornForm(128) as Armor
  armor9 = Game.GetPlayer().GetWornForm(256) as Armor
  armor10 = Game.GetPlayer().GetWornForm(512) as Armor
  armor11 = Game.GetPlayer().GetWornForm(1024) as Armor
  armor12 = Game.GetPlayer().GetWornForm(2048) as Armor
  armor13 = Game.GetPlayer().GetWornForm(4096) as Armor
  armor14 = Game.GetPlayer().GetWornForm(8192) as Armor
EndFunction

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