Scriptname KA_RemoveOldGear extends ObjectReference

actor property playerRef auto
message property myMessage1 auto
message property myMessage2 auto
quest property myQuest auto
int property myStage auto

armor property KA_ArmorDragonPriestGauntletsDPKonah auto
armor property KA_ArmorDragonPriestBootsDPKonah auto
armor property KA_ClothesDragonPriestRobesDPKonah auto
armor property KA_ArmorDragonPriestRobesDPKonah auto
armor property thisItem auto


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

;selfRef = self
;armor thisItem = (selfRef as form) as armor

	if akNewContainer == PlayerRef
		if myQuest.GetStage() < 2
			myMessage1.show()
			myQuest.setStage(2)
		endIf
		if (thisItem == KA_ClothesDragonPriestRobesDPKonah) && \
		(PlayerRef.GetItemCount(KA_ArmorDragonPriestRobesDPKonah) != 0)
			playerRef.removeItem(thisItem, (PlayerRef.GetItemCount(thisItem)), 1)
			myMessage2.show()
		elseIf PlayerRef.GetItemCount(thisItem) > 1
			playerRef.removeItem(thisItem, ((PlayerRef.GetItemCount(thisItem)) - 1), 1)
			myMessage2.show()	
		endIf
	endIf
endEvent

Event OnEquipped(Actor akActor)
	if ((akActor == Game.GetPlayer()) && (myQuest.GetStage() < 2))		
		myMessage1.show()
		myQuest.setStage(2)		
	endif
endEvent
