Scriptname CHConfigQuestScript extends SKI_ConfigBase
{Script by Alek (mitchalek@yahoo.com).
SkyUI mod configuration implementation.}

; Local vars
int OIDConfigurationPower
int OIDScriptLatencyTest
int OIDControlMode
int OIDMultiTapDelay
int OIDMultiTapCombatOverride
int OIDMultiTapDismountMode
int OIDBoundKeyTalk
int OIDBoundKeyHarvest
int OIDBoundKeyDismount
int OIDBoundKeyInventory
int OIDBoundKeySpecial
int OIDBoundKeyConsolidate
int OIDFactionRelations
int OIDHorseCallFormation
int OIDHorseCallFade
int OIDAnimations
int OIDCameraFix

int OIDHorseArmorMode
int OIDHorseBonusHealth
int OIDHorseBonusStamina
int OIDHorseBonusSpeed
int OIDHorseProtectionMode
int OIDAutoLoot
int OIDHorseCharge
int OIDHorseChargeImpactPrecognitionTime
int OIDHorseBehaviorMode
int OIDHorseFollowEnable
int OIDHorseFollowMode
int OIDHorseFollowDistanceMode
int OIDInventoryRecovery
int OIDBoundKeyInventoryMode

int OIDFollowerModeEnable
int OIDFollowerPreferRidingEnable
int OIDFollowerAutoRetaliateEnable
int OIDFollowerCombatEscapeEnable
int OIDFollowerHorseRecallEnable
int OIDFollowerHorseCallDistanceMode
int OIDFollowerHorseGlobalSkinSelection
int OIDFollowerHorseGlobalSkin
int OIDFollowerHorseGlobalArmorSelection
int OIDFollowerHorseGlobalArmor
int OIDFollowerMountedCombatEnable
int OIDFollowerMountedCombatDamage
int OIDFollowerHorseDynamicSpeedEnable

bool bRecoverInventory
bool bConfigPower
bool bLatencyTest
bool bFollowerHorses
bool bUpdateSkins
bool bUpdateArmor

string[] Armors
string[] Skins

Event OnConfigInit()
	Pages = new string[3]
	Pages[0] = "メイン"
	Pages[1] = "馬"
	Pages[2] = "従者"
	
	Armors = new string[7]
	Armors[0] = " 鎧なし "
	Armors[1] = " 革 "
	Armors[2] = " ノルド "
	Armors[3] = " ドワーフ "
	Armors[4] = " 黒檀 "
	Armors[5] = " デイドラ "
	Armors[6] = " ドラゴンの骨 "

	Skins = new string[6]
	Skins[0] = " ランダム "
	Skins[1] = " 黒 "
	Skins[2] = " 黒 & 白 "
	Skins[3] = " 茶 "
	Skins[4] = " 灰色 "
	Skins[5] = " 月毛 "
EndEvent

Event OnConfigOpen()
	if !CH.IsRunning()
		ShowMessage("Convenient Horsesのメインクエストが動いていません。\n\n設定を進める前に全てのメニューを閉じ、コンソールで (StartQuest CH) を打ち開始して下さい。", false, "OK")
	endif
	bRecoverInventory = false
	bUpdateSkins = false
	bUpdateArmor = false
	bConfigPower = Game.GetPlayer().HasSpell(CHConfigurationPower)
	bLatencyTest = CHLatencyTest.IsRunning()
	bFollowerHorses = CHFollower.IsRunning()
EndEvent

Event OnConfigClose()
	if !CH.IsRunning()
		return
	endif

	if bConfigPower && !Game.GetPlayer().HasSpell(CHConfigurationPower)
		Game.GetPlayer().AddSpell(CHConfigurationPower, false)
	elseif !bConfigPower && Game.GetPlayer().HasSpell(CHConfigurationPower)
		Game.GetPlayer().RemoveSpell(CHConfigurationPower)
	endif
	
	if bLatencyTest && !CHLatencyTest.IsRunning()
		CHLatencyTest.Start()
	elseif !bLatencyTest && CHLatencyTest.IsRunning()
		CHLatencyTest.Stop()
	endif
	
	if bFollowerHorses
		CHFollowerModeEnable.SetValueInt(1)
		if !CHFollower.IsRunning()
			CHFollower.Start()
		elseif bUpdateSkins || bUpdateArmor
			int index = 0
			while index < Followers.Length
				if bUpdateSkins
					Followers[index].HorseType = 666
				endif
				if bUpdateArmor
					Followers[index].HorseArmor = 666
				endif
				index += 1
			endwhile
		endif
	else
		CHFollowerModeEnable.SetValueInt(0)
		if CHFollower.IsRunning()
			CHFollower.Stop()
		endif
	endif
	
	if bRecoverInventory
		Alias_Sack.GetReference().RemoveAllItems(Game.GetPlayer(), true, true)
		CHHorseInventoryRecoveryMessage.Show()
	endif
EndEvent

Event OnPageReset(String Page)
	SetInfoText("")
	if Page == ""
		LoadCustomContent("CH/CH_logo.dds", 0, 68)
		return
	else
		UnloadCustomContent()
	endif

	; *** Page 1 ***
	if Page == Pages[0]
		SetCursorFillMode(TOP_TO_BOTTOM)

		AddHeaderOption("全般")
		OIDControlMode = AddTextOption("操作方法", TXTControlMode)
		OIDFactionRelations = AddTextOption("馬の友好関係", TXTFactionRelations)
		OIDConfigurationPower = AddTextOption("設定のパワー", TXTConfigurationPower)
		OIDScriptLatencyTest = AddTextOption("ゲームプレイスクリプト遅延テスト", TXTScriptLatencyTest)
		OIDInventoryRecovery = AddTextOption("馬の所持品の復元", TXTInventoryRecovery)

		AddHeaderOption("その他")
		OIDAnimations = AddToggleOption("追尾切替 & 口笛のアニメーション", CHAnimationsEnable.GetValueInt())
		OIDCameraFix = AddToggleOption("騎乗戦闘カメラ自動修正", CHMountedCombatCameraFixEnable.GetValueInt())		

		SetCursorPosition(1)

		AddHeaderOption("マルチタップ設定")
		OIDMultiTapDelay = AddSliderOption("マルチタップ遅延", CHMultiTapDelay.GetValue() * 1000, "{0} ミリ秒")
		OIDMultiTapCombatOverride = AddToggleOption("戦闘の優先", CHMultiTapCombatOverride.GetValueInt())
		OIDMultiTapDismountMode = AddTextOption("高速下馬", TXTMultiTapDismountMode)

		AddHeaderOption("キー割り当て設定")
		OIDBoundKeyInventoryMode = AddTextOption("所持品アクセス方法", TXTBoundKeyInventoryMode)
		OIDBoundKeyConsolidate = AddToggleOption("統合 話す/取出/採取", CHBoundKeyConsolidate.GetValueInt())
		OIDBoundKeyTalk = AddKeyMapOption("話す/取出 キー", CHKeyTalk.GetValueInt())
		OIDBoundKeyHarvest = AddKeyMapOption("素材採取 キー", CHKeyHarvest.GetValueInt(), (OPTION_FLAG_DISABLED * (CHBoundKeyConsolidate.GetValueInt() != 0) as Int))
		OIDBoundKeyDismount = AddKeyMapOption("高速下馬 キー", CHKeyDismount.GetValueInt())
		OIDBoundKeyInventory = AddKeyMapOption("馬の所持品 キー", CHKeyInventory.GetValueInt())
		OIDBoundKeySpecial = AddKeyMapOption("追従切替 キー", CHKeySpecial.GetValueInt())

	; *** Page 2 ***
	elseif Page == Pages[1]
		SetCursorFillMode(TOP_TO_BOTTOM)

		AddHeaderOption("馬の鎧")
		OIDHorseArmorMode = AddMenuOption("馬の鎧", TXTHorseArmorMode)

		AddHeaderOption("馬の能力ボーナス")
		OIDHorseBonusHealth = AddSliderOption("体力ボーナス", CHHorseBonusHealth.GetValueInt(), "{0}")
		OIDHorseBonusStamina = AddSliderOption("スタミナボーナス", CHHorseBonusStamina.GetValueInt(), "{0}")
		OIDHorseBonusSpeed = AddSliderOption("速度ボーナス", CHHorseBonusSpeed.GetValueInt(), "{0}%")

		AddHeaderOption("馬の保護")
		OIDHorseProtectionMode = AddTextOption("保護方法", TXTHorseProtectionMode)

		AddHeaderOption("騎乗戦闘")
		OIDAutoLoot = AddToggleOption("自動拾得", CHAutoLootEnable.GetValueInt())
		OIDHorseCharge = AddToggleOption("馬の突進攻撃", CHHorseChargeEnable.GetValueInt())
		OIDHorseChargeImpactPrecognitionTime = AddSliderOption("衝撃の予測", CHHorseChargeImpactPrecognitionTime.GetValue() * 1000, "{0} ミリ秒", (OPTION_FLAG_DISABLED * (CHHorseChargeEnable.GetValueInt() == 0) as Int))

		SetCursorPosition(1)

		AddHeaderOption("馬のAI")
		OIDHorseBehaviorMode = AddTextOption("戦闘の挙動", TXTHorseBehaviorMode)
		OIDHorseFollowEnable = AddToggleOption("馬の追従", CHHorseFollowEnable.GetValueInt())
		OIDHorseFollowMode = AddTextOption("追従モード", TXTHorseFollowMode)
		OIDHorseFollowDistanceMode = AddTextOption("追従距離", TXTHorseFollowDistanceMode)

		AddHeaderOption("馬の呼出設定")
		OIDHorseCallFormation = AddToggleOption("馬の呼出時のくさび形隊形", CHHorseCallFormationEnable.GetValueInt())
		OIDHorseCallFade = AddToggleOption("馬の呼出時のフェード", CHHorseCallFadeEnable.GetValueInt())

	; *** Page 3 ***
	elseif Page == Pages[2]
		SetCursorFillMode(TOP_TO_BOTTOM)
		AddHeaderOption("全般")
		OIDFollowerModeEnable = AddToggleOption("従者の馬", bFollowerHorses)

		AddHeaderOption("騎乗", OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerPreferRidingEnable = AddToggleOption("騎乗優先", CHFollowerPreferRidingEnable.GetValueInt(), OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerAutoRetaliateEnable = AddToggleOption("自動反撃", CHFollowerAutoRetaliateEnable.GetValueInt(), OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerCombatEscapeEnable = AddToggleOption("戦闘離脱", CHFollowerCombatEscapeEnable.GetValueInt(), OPTION_FLAG_DISABLED * (!bFollowerHorses || CHFollowerAutoRetaliateEnable.GetValueInt() != 0) as Int)

		AddHeaderOption("馬の呼出", OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerHorseRecallEnable = AddToggleOption("馬の送還", CHFollowerHorseRecallEnable.GetValueInt(), OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerHorseCallDistanceMode = AddTextOption("呼出距離", TXTFollowerHorseCallDistanceMode, OPTION_FLAG_DISABLED * (!bFollowerHorses || CHFollowerHorseRecallEnable.GetValueInt() != 0) as Int)

		AddHeaderOption("騎乗戦闘", OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerMountedCombatEnable = AddToggleOption("騎乗戦闘", CHFollowerMountedCombatEnable.GetValueInt(), OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerMountedCombatDamage = AddSliderOption("騎乗戦闘ダメージ", CHFollowerMountedCombatDamageMult.GetValue() * 100, "{0}%", OPTION_FLAG_DISABLED * (!bFollowerHorses || CHFollowerMountedCombatEnable.GetValueInt() == 0) as Int)

		SetCursorPosition(1)
		
		AddHeaderOption("馬の毛色", OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerHorseGlobalSkinSelection = AddTextOption("毛色の選択", TXTFollowerHorseGlobalSkinSelection, OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerHorseGlobalSkin = AddMenuOption("全馬の毛色", TXTFollowerHorseGlobalSkin, OPTION_FLAG_DISABLED * (!bFollowerHorses || CHFollowerHorseGlobalSkinSelection.GetValueInt() == 0) as Int)

		AddHeaderOption("馬の鎧", OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerHorseGlobalArmorSelection = AddTextOption("Armor Selection", TXTFollowerHorseGlobalArmorSelection, OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerHorseGlobalArmor = AddMenuOption("全馬の鎧", TXTFollowerHorseGlobalArmor, OPTION_FLAG_DISABLED * (!bFollowerHorses || CHFollowerHorseGlobalArmorSelection.GetValueInt() == 0) as Int)
		
		AddHeaderOption("機能", OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
		OIDFollowerHorseDynamicSpeedEnable = AddToggleOption("動的速度", CHFollowerHorseDynamicSpeedEnable.GetValueInt(), OPTION_FLAG_DISABLED * (!bFollowerHorses) as Int)
	endif
EndEvent



Event OnOptionSelect(Int Option)
	; *** Page 1 ***
	if option == OIDControlMode
		CHControlMode.SetValueInt((CHControlMode.GetValueInt() + 1) % 2)
		SetTextOptionValue(OIDControlMode, TXTControlMode)
	elseif option == OIDFactionRelations
		CHFriendlyFactions.SetValueInt((CHFriendlyFactions.GetValueInt() + 2) % 3 - 1)
		SetTextOptionValue(OIDFactionRelations, TXTFactionRelations)
	elseif option == OIDConfigurationPower
		bConfigPower = !bConfigPower
		SetTextOptionValue(OIDConfigurationPower, TXTConfigurationPower)
	elseif option == OIDScriptLatencyTest
		bLatencyTest = !bLatencyTest
		SetTextOptionValue(OIDScriptLatencyTest, TXTScriptLatencyTest)
	elseif option == OIDInventoryRecovery
		bRecoverInventory = !bRecoverInventory
		SetTextOptionValue(OIDInventoryRecovery, TXTInventoryRecovery)
	elseif option == OIDAnimations
		CHAnimationsEnable.SetValueInt((!CHAnimationsEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDAnimations, CHAnimationsEnable.GetValueInt())
	elseif option == OIDCameraFix
		CHMountedCombatCameraFixEnable.SetValueInt((!CHMountedCombatCameraFixEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDCameraFix, CHMountedCombatCameraFixEnable.GetValueInt())
	elseif option == OIDMultiTapCombatOverride
		CHMultiTapCombatOverride.SetValueInt((!CHMultiTapCombatOverride.GetValueInt()) as Int)
		SetToggleOptionValue(OIDMultiTapCombatOverride, CHMultiTapCombatOverride.GetValueInt())
	elseif option == OIDMultiTapDismountMode
		CHMultiTapDismountMode.SetValueInt((CHMultiTapDismountMode.GetValueInt() + 1) % 3)
		SetTextOptionValue(OIDMultiTapDismountMode, TXTMultiTapDismountMode)
	elseif option == OIDBoundKeyInventoryMode
		CHBoundKeyInventoryMode.SetValueInt((CHBoundKeyInventoryMode.GetValueInt() + 1) % 3)
		SetTextOptionValue(OIDBoundKeyInventoryMode, TXTBoundKeyInventoryMode)	
	elseif option == OIDBoundKeyConsolidate
		CHBoundKeyConsolidate.SetValueInt((!CHBoundKeyConsolidate.GetValueInt()) as Int)
		SetToggleOptionValue(OIDBoundKeyConsolidate, CHBoundKeyConsolidate.GetValueInt())
		SetOptionFlags(OIDBoundKeyHarvest, (OPTION_FLAG_DISABLED * (CHBoundKeyConsolidate.GetValueInt() != 0) as Int))

	; *** Page 2 ***
	elseif option == OIDHorseProtectionMode
		CHHorseProtectionMode.SetValueInt((CHHorseProtectionMode.GetValueInt() + 1) % 3)
		SetTextOptionValue(OIDHorseProtectionMode, TXTHorseProtectionMode)
	elseif option == OIDAutoLoot
		CHAutoLootEnable.SetValueInt((!CHAutoLootEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDAutoLoot, CHAutoLootEnable.GetValueInt())
	elseif option == OIDHorseCharge
		CHHorseChargeEnable.SetValueInt((!CHHorseChargeEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDHorseCharge, CHHorseChargeEnable.GetValueInt())
		SetOptionFlags(OIDHorseChargeImpactPrecognitionTime, (OPTION_FLAG_DISABLED * (CHHorseChargeEnable.GetValueInt() == 0) as Int))
	elseif option == OIDHorseBehaviorMode
		CHHorseBehaviorMode.SetValueInt((CHHorseBehaviorMode.GetValueInt() + 1) % 2)
		SetTextOptionValue(OIDHorseBehaviorMode, TXTHorseBehaviorMode)
	elseif option == OIDHorseFollowEnable
		CHHorseFollowEnable.SetValueInt((!CHHorseFollowEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDHorseFollowEnable, CHHorseFollowEnable.GetValueInt())		
	elseif option == OIDHorseFollowMode
		CHHorseFollowMode.SetValueInt((CHHorseFollowMode.GetValueInt() + 1) % 2)
		SetTextOptionValue(OIDHorseFollowMode, TXTHorseFollowMode)		
	elseif option == OIDHorseFollowDistanceMode
		CHHorseFollowDistanceMode.SetValueInt((CHHorseFollowDistanceMode.GetValueInt() + 1) % 3)
		SetTextOptionValue(OIDHorseFollowDistanceMode, TXTHorseFollowDistanceMode)		
	elseif option == OIDHorseCallFormation
		CHHorseCallFormationEnable.SetValueInt((!CHHorseCallFormationEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDHorseCallFormation, CHHorseCallFormationEnable.GetValueInt())
	elseif option == OIDHorseCallFade
		CHHorseCallFadeEnable.SetValueInt((!CHHorseCallFadeEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDHorseCallFade, CHHorseCallFadeEnable.GetValueInt())

	; *** Page 3 ***
	elseif option == OIDFollowerModeEnable
		bFollowerHorses = !bFollowerHorses
		SetToggleOptionValue(OIDFollowerModeEnable, bFollowerHorses)
		ForcePageReset()
	elseif option == OIDFollowerPreferRidingEnable
		CHFollowerPreferRidingEnable.SetValueInt((!CHFollowerPreferRidingEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDFollowerPreferRidingEnable, CHFollowerPreferRidingEnable.GetValueInt())
	elseif option == OIDFollowerAutoRetaliateEnable
		CHFollowerAutoRetaliateEnable.SetValueInt((!CHFollowerAutoRetaliateEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDFollowerAutoRetaliateEnable, CHFollowerAutoRetaliateEnable.GetValueInt())
		SetOptionFlags(OIDFollowerCombatEscapeEnable, OPTION_FLAG_DISABLED * (CHFollowerAutoRetaliateEnable.GetValueInt() != 0) as Int)
	elseif option == OIDFollowerCombatEscapeEnable
		CHFollowerCombatEscapeEnable.SetValueInt((!CHFollowerCombatEscapeEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDFollowerCombatEscapeEnable, CHFollowerCombatEscapeEnable.GetValueInt())
	elseif option == OIDFollowerHorseRecallEnable
		CHFollowerHorseRecallEnable.SetValueInt((!CHFollowerHorseRecallEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDFollowerHorseRecallEnable, CHFollowerHorseRecallEnable.GetValueInt())
		SetOptionFlags(OIDFollowerHorseCallDistanceMode, OPTION_FLAG_DISABLED * (CHFollowerHorseRecallEnable.GetValueInt() != 0) as Int)
	elseif option == OIDFollowerHorseCallDistanceMode
		CHFollowerHorseCallDistanceMode.SetValueInt((CHFollowerHorseCallDistanceMode.GetValueInt() + 1) % 4)
		SetTextOptionValue(OIDFollowerHorseCallDistanceMode, TXTFollowerHorseCallDistanceMode)
	elseif option == OIDFollowerMountedCombatEnable
		CHFollowerMountedCombatEnable.SetValueInt((!CHFollowerMountedCombatEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDFollowerMountedCombatEnable, CHFollowerMountedCombatEnable.GetValueInt())
		SetOptionFlags(OIDFollowerMountedCombatDamage, OPTION_FLAG_DISABLED * (CHFollowerMountedCombatEnable.GetValueInt() == 0) as Int)
	elseif option == OIDFollowerHorseGlobalSkinSelection
		CHFollowerHorseGlobalSkinSelection.SetValueInt((!CHFollowerHorseGlobalSkinSelection.GetValueInt()) as Int)
		SetTextOptionValue(OIDFollowerHorseGlobalSkinSelection, TXTFollowerHorseGlobalSkinSelection)
		SetOptionFlags(OIDFollowerHorseGlobalSkin, OPTION_FLAG_DISABLED * (CHFollowerHorseGlobalSkinSelection.GetValueInt() == 0) as Int)
		bUpdateSkins = true
	elseif option == OIDFollowerHorseGlobalArmorSelection
		CHFollowerHorseGlobalArmorSelection.SetValueInt((!CHFollowerHorseGlobalArmorSelection.GetValueInt()) as Int)
		SetTextOptionValue(OIDFollowerHorseGlobalArmorSelection, TXTFollowerHorseGlobalArmorSelection)
		SetOptionFlags(OIDFollowerHorseGlobalArmor, OPTION_FLAG_DISABLED * (CHFollowerHorseGlobalArmorSelection.GetValueInt() == 0) as Int)
		bUpdateArmor = true
	elseif option == OIDFollowerHorseDynamicSpeedEnable
		CHFollowerHorseDynamicSpeedEnable.SetValueInt((!CHFollowerHorseDynamicSpeedEnable.GetValueInt()) as Int)
		SetToggleOptionValue(OIDFollowerHorseDynamicSpeedEnable, CHFollowerHorseDynamicSpeedEnable.GetValueInt())
	endif
EndEvent

Event OnOptionSliderOpen(Int Option)
	if option == OIDMultiTapDelay
		SetSliderDialogStartValue(CHMultiTapDelay.GetValue() * 1000)
		SetSliderDialogDefaultValue(300)
		SetSliderDialogRange(100, 1000)
		SetSliderDialogInterval(1)
	elseif Option == OIDHorseBonusHealth
		SetSliderDialogStartValue(CHHorseBonusHealth.GetValueInt())
		SetSliderDialogDefaultValue(0)
		SetSliderDialogRange(0, 1000)
		SetSliderDialogInterval(1)
	elseif Option == OIDHorseBonusStamina
		SetSliderDialogStartValue(CHHorseBonusStamina.GetValueInt())
		SetSliderDialogDefaultValue(0)
		SetSliderDialogRange(0, 1000)
		SetSliderDialogInterval(1)
	elseif Option == OIDHorseBonusSpeed
		SetSliderDialogStartValue(CHHorseBonusSpeed.GetValueInt())
		SetSliderDialogDefaultValue(0)
		SetSliderDialogRange(0, 100)
		SetSliderDialogInterval(1)
	elseif Option == OIDHorseChargeImpactPrecognitionTime
		SetSliderDialogStartValue(CHHorseChargeImpactPrecognitionTime.GetValue() * 1000)
		SetSliderDialogDefaultValue(100)
		SetSliderDialogRange(0, 1000)
		SetSliderDialogInterval(1)
	elseif Option == OIDFollowerMountedCombatDamage
		SetSliderDialogStartValue(CHFollowerMountedCombatDamageMult.GetValue() * 100)
		SetSliderDialogDefaultValue(100)
		SetSliderDialogRange(0, 300)
		SetSliderDialogInterval(1)
	endif
EndEvent

Event OnOptionSliderAccept(Int Option, Float Value)
	if option == OIDMultiTapDelay
		CHMultiTapDelay.SetValue(Value * 0.001)
		SetSliderOptionValue(OIDMultiTapDelay, Value, "{0} ミリ秒")
	elseif Option == OIDHorseBonusHealth
		CHHorseBonusHealth.SetValueInt(Value as Int)
		SetSliderOptionValue(OIDHorseBonusHealth, Value, "{0}")
	elseif Option == OIDHorseBonusStamina
		CHHorseBonusStamina.SetValueInt(Value as Int)
		SetSliderOptionValue(OIDHorseBonusStamina, Value, "{0}")
	elseif Option == OIDHorseBonusSpeed
		CHHorseBonusSpeed.SetValueInt(Value as Int)
		SetSliderOptionValue(OIDHorseBonusSpeed, Value, "{0}%")
	elseif Option == OIDHorseChargeImpactPrecognitionTime
		CHHorseChargeImpactPrecognitionTime.SetValue(Value * 0.001)
		SetSliderOptionValue(OIDHorseChargeImpactPrecognitionTime, Value, "{0} ミリ秒")
	elseif Option == OIDFollowerMountedCombatDamage
		CHFollowerMountedCombatDamageMult.SetValue(Value * 0.01)
		SetSliderOptionValue(OIDFollowerMountedCombatDamage, Value, "{0}%")
	endif
EndEvent

Event OnOptionKeyMapChange(Int Option, Int KeyCode, String ConflictControl, String ConflictName)
	if KeyCode == 1	; ESC
		return
	endif
	if KeyCode > 265
		ShowMessage("キー割り当てモードでゲームパッドは使用できません", false, "OK")
		return
	endif
	; Set new key
	Int KeyCodeOld
	if option == OIDBoundKeyTalk
		KeyCodeOld = CHKeyTalk.GetValueInt()
		CHKeyTalk.SetValueInt(KeyCode)
		SetKeyMapOptionValue(OIDBoundKeyTalk, CHKeyTalk.GetValueInt())
	elseif option == OIDBoundKeyHarvest
		KeyCodeOld = CHKeyHarvest.GetValueInt()
		CHKeyHarvest.SetValueInt(KeyCode)
		SetKeyMapOptionValue(OIDBoundKeyHarvest, CHKeyHarvest.GetValueInt())
	elseif option == OIDBoundKeyDismount
		KeyCodeOld = CHKeyDismount.GetValueInt()
		CHKeyDismount.SetValueInt(KeyCode)
		SetKeyMapOptionValue(OIDBoundKeyDismount, CHKeyDismount.GetValueInt())
	elseif option == OIDBoundKeyInventory
		KeyCodeOld = CHKeyInventory.GetValueInt()
		CHKeyInventory.SetValueInt(KeyCode)
		SetKeyMapOptionValue(OIDBoundKeyInventory, CHKeyInventory.GetValueInt())
	elseif option == OIDBoundKeySpecial
		KeyCodeOld = CHKeySpecial.GetValueInt()
		CHKeySpecial.SetValueInt(KeyCode)
		SetKeyMapOptionValue(OIDBoundKeySpecial, CHKeySpecial.GetValueInt())
	endif
	; Swap key if duplicate
	if option != OIDBoundKeyTalk && KeyCode == CHKeyTalk.GetValueInt()
		CHKeyTalk.SetValueInt(KeyCodeOld)
		SetKeyMapOptionValue(OIDBoundKeyTalk, CHKeyTalk.GetValueInt())
	elseif option != OIDBoundKeyHarvest && KeyCode == CHKeyHarvest.GetValueInt()
		CHKeyHarvest.SetValueInt(KeyCodeOld)
		SetKeyMapOptionValue(OIDBoundKeyHarvest, CHKeyHarvest.GetValueInt())
	elseif option != OIDBoundKeyDismount && KeyCode == CHKeyDismount.GetValueInt()
		CHKeyDismount.SetValueInt(KeyCodeOld)
		SetKeyMapOptionValue(OIDBoundKeyDismount, CHKeyDismount.GetValueInt())
	elseif option != OIDBoundKeyInventory && KeyCode == CHKeyInventory.GetValueInt()
		CHKeyInventory.SetValueInt(KeyCodeOld)
		SetKeyMapOptionValue(OIDBoundKeyInventory, CHKeyInventory.GetValueInt())
	elseif option != OIDBoundKeySpecial && KeyCode == CHKeySpecial.GetValueInt()
		CHKeySpecial.SetValueInt(KeyCodeOld)
		SetKeyMapOptionValue(OIDBoundKeySpecial, CHKeySpecial.GetValueInt())
	endif
EndEvent

Event OnOptionMenuOpen(Int Option)
	if Option == OIDHorseArmorMode
		SetMenuDialogOptions(Armors)
		SetMenuDialogStartIndex(CHHorseArmorMode.GetValueInt())
		SetMenuDialogDefaultIndex(0)
	elseif Option == OIDFollowerHorseGlobalSkin
		SetMenuDialogOptions(Skins)
		SetMenuDialogStartIndex(CHFollowerHorseGlobalSkin.GetValueInt())
		SetMenuDialogDefaultIndex(0)
	elseif Option == OIDFollowerHorseGlobalArmor
		SetMenuDialogOptions(Armors)
		SetMenuDialogStartIndex(CHFollowerHorseGlobalArmor.GetValueInt())
		SetMenuDialogDefaultIndex(0)
	endif
EndEvent

Event OnOptionMenuAccept(Int Option, Int Index)
	if Option == OIDHorseArmorMode
		CHHorseArmorMode.SetValueInt(Index)
		SetMenuOptionValue(OIDHorseArmorMode, TXTHorseArmorMode)
	elseif Option == OIDFollowerHorseGlobalSkin
		CHFollowerHorseGlobalSkin.SetValueInt(Index)
		SetMenuOptionValue(OIDFollowerHorseGlobalSkin, TXTFollowerHorseGlobalSkin)
		bUpdateSkins = true
	elseif Option == OIDFollowerHorseGlobalArmor
		CHFollowerHorseGlobalArmor.SetValueInt(Index)
		SetMenuOptionValue(OIDFollowerHorseGlobalArmor, TXTFollowerHorseGlobalArmor)
		bUpdateArmor = true
	endif
EndEvent

Event OnOptionDefault(Int Option)
	; *** Page 1 ***
	if option == OIDControlMode
		CHControlMode.SetValueInt(0)
		SetTextOptionValue(OIDControlMode, TXTControlMode)
	elseif option == OIDFactionRelations
		CHFriendlyFactions.SetValueInt(1)
		SetTextOptionValue(OIDFactionRelations, TXTFactionRelations)
	elseif option == OIDConfigurationPower
		bConfigPower = true
		SetTextOptionValue(OIDConfigurationPower, TXTConfigurationPower)
	elseif option == OIDScriptLatencyTest
		bLatencyTest = false
		SetTextOptionValue(OIDScriptLatencyTest, TXTScriptLatencyTest)
	elseif option == OIDInventoryRecovery
		bRecoverInventory = false
		SetTextOptionValue(OIDInventoryRecovery, TXTInventoryRecovery)
	elseif option == OIDAnimations
		CHAnimationsEnable.SetValueInt(1)
		SetToggleOptionValue(OIDAnimations, true)
	elseif option == OIDCameraFix
		CHMountedCombatCameraFixEnable.SetValueInt(0)
		SetToggleOptionValue(OIDCameraFix, false)
	elseif option == OIDMultiTapDelay
		CHMultiTapDelay.SetValue(0.3)
		SetSliderOptionValue(OIDMultiTapDelay, 300, "{0} ミリ秒")
	elseif option == OIDMultiTapCombatOverride
		CHMultiTapCombatOverride.SetValueInt(1)
		SetToggleOptionValue(OIDMultiTapCombatOverride, true)
	elseif option == OIDMultiTapDismountMode
		CHMultiTapDismountMode.SetValueInt(1)
		SetTextOptionValue(OIDMultiTapDismountMode, TXTMultiTapDismountMode)
	elseif option == OIDBoundKeyInventoryMode
		CHBoundKeyInventoryMode.SetValueInt(1)
		SetTextOptionValue(OIDBoundKeyInventoryMode, TXTBoundKeyInventoryMode)	
	elseif option == OIDBoundKeyConsolidate
		CHBoundKeyConsolidate.SetValueInt(0)
		SetToggleOptionValue(OIDBoundKeyConsolidate, false)
		SetOptionFlags(OIDBoundKeyHarvest, OPTION_FLAG_NONE)
	elseif option == OIDBoundKeyTalk
		CHKeyTalk.SetValueInt(0)
		SetKeyMapOptionValue(OIDBoundKeyTalk, 0)
	elseif option == OIDBoundKeyHarvest
		CHKeyHarvest.SetValueInt(0)
		SetKeyMapOptionValue(OIDBoundKeyHarvest, 0)
	elseif option == OIDBoundKeyDismount
		CHKeyDismount.SetValueInt(0)
		SetKeyMapOptionValue(OIDBoundKeyDismount, 0)
	elseif option == OIDBoundKeyInventory
		CHKeyInventory.SetValueInt(0)
		SetKeyMapOptionValue(OIDBoundKeyInventory, 0)
	elseif option == OIDBoundKeySpecial
		CHKeySpecial.SetValueInt(0)
		SetKeyMapOptionValue(OIDBoundKeySpecial, 0)

	; *** Page 2 ***
	elseif Option == OIDHorseArmorMode
		CHHorseArmorMode.SetValueInt(0)
		SetMenuOptionValue(OIDHorseArmorMode, TXTHorseArmorMode)
	elseif Option == OIDHorseBonusHealth
		CHHorseBonusHealth.SetValueInt(0)
		SetSliderOptionValue(OIDHorseBonusHealth, 0, "{0}")
	elseif Option == OIDHorseBonusStamina
		CHHorseBonusStamina.SetValueInt(0)
		SetSliderOptionValue(OIDHorseBonusStamina, 0, "{0}")
	elseif Option == OIDHorseBonusSpeed
		CHHorseBonusSpeed.SetValueInt(0)
		SetSliderOptionValue(OIDHorseBonusSpeed, 0, "{0}%")
	elseif option == OIDHorseProtectionMode
		CHHorseProtectionMode.SetValueInt(0)
		SetTextOptionValue(OIDHorseProtectionMode, TXTHorseProtectionMode)
	elseif option == OIDAutoLoot
		CHAutoLootEnable.SetValueInt(1)
		SetToggleOptionValue(OIDAutoLoot, true)
	elseif option == OIDHorseCharge
		CHHorseChargeEnable.SetValueInt(1)
		SetToggleOptionValue(OIDHorseCharge, true)
	elseif Option == OIDHorseChargeImpactPrecognitionTime
		CHHorseChargeImpactPrecognitionTime.SetValue(0.1)
		SetSliderOptionValue(OIDHorseChargeImpactPrecognitionTime, 100, "{0} ミリ秒")
	elseif option == OIDHorseBehaviorMode
		CHHorseBehaviorMode.SetValueInt(0)
		SetTextOptionValue(OIDHorseBehaviorMode, TXTHorseBehaviorMode)
	elseif option == OIDHorseFollowEnable
		CHHorseFollowEnable.SetValueInt(0)
		SetToggleOptionValue(OIDHorseFollowEnable, false)		
	elseif option == OIDHorseFollowMode
		CHHorseFollowMode.SetValueInt(0)
		SetTextOptionValue(OIDHorseFollowMode, TXTHorseFollowMode)		
	elseif option == OIDHorseFollowDistanceMode
		CHHorseFollowDistanceMode.SetValueInt(1)
		SetTextOptionValue(OIDHorseFollowDistanceMode, TXTHorseFollowDistanceMode)		
	elseif option == OIDHorseCallFormation
		CHHorseCallFormationEnable.SetValueInt(1)
		SetToggleOptionValue(OIDHorseCallFormation, CHHorseCallFormationEnable.GetValueInt())
	elseif option == OIDHorseCallFade
		CHHorseCallFadeEnable.SetValueInt(0)
		SetToggleOptionValue(OIDHorseCallFade, false)

	; *** Page 3 ***
	elseif option == OIDFollowerModeEnable
		bFollowerHorses = false
		SetToggleOptionValue(OIDFollowerModeEnable, false)
		ForcePageReset()
	elseif option == OIDFollowerPreferRidingEnable
		CHFollowerPreferRidingEnable.SetValueInt(0)
		SetToggleOptionValue(OIDFollowerPreferRidingEnable, false)
	elseif option == OIDFollowerAutoRetaliateEnable
		CHFollowerAutoRetaliateEnable.SetValueInt(0)
		SetToggleOptionValue(OIDFollowerAutoRetaliateEnable, false)
		SetOptionFlags(OIDFollowerCombatEscapeEnable, OPTION_FLAG_NONE)
	elseif option == OIDFollowerCombatEscapeEnable
		CHFollowerCombatEscapeEnable.SetValueInt(1)
		SetToggleOptionValue(OIDFollowerCombatEscapeEnable, true)
	elseif option == OIDFollowerHorseRecallEnable
		CHFollowerHorseRecallEnable.SetValueInt(0)
		SetToggleOptionValue(OIDFollowerHorseRecallEnable, false)
		SetOptionFlags(OIDFollowerHorseCallDistanceMode, OPTION_FLAG_NONE)
	elseif option == OIDFollowerHorseCallDistanceMode
		CHFollowerHorseCallDistanceMode.SetValueInt(2)
		SetTextOptionValue(OIDFollowerHorseCallDistanceMode, TXTFollowerHorseCallDistanceMode)
	elseif option == OIDFollowerMountedCombatEnable
		CHFollowerMountedCombatEnable.SetValueInt(1)
		SetToggleOptionValue(OIDFollowerMountedCombatEnable, true)
		SetOptionFlags(OIDFollowerMountedCombatDamage, OPTION_FLAG_NONE)
	elseif Option == OIDFollowerMountedCombatDamage
		CHFollowerMountedCombatDamageMult.SetValue(1.00)
		SetSliderOptionValue(OIDFollowerMountedCombatDamage, 100, "{0}%")
	elseif option == OIDFollowerHorseGlobalSkinSelection
		CHFollowerHorseGlobalSkinSelection.SetValueInt(0)
		SetTextOptionValue(OIDFollowerHorseGlobalSkinSelection, TXTFollowerHorseGlobalSkinSelection)
		SetOptionFlags(OIDFollowerHorseGlobalSkin, OPTION_FLAG_DISABLED)
		bUpdateSkins = true
	elseif Option == OIDFollowerHorseGlobalSkin
		CHFollowerHorseGlobalSkin.SetValueInt(0)
		SetMenuOptionValue(OIDFollowerHorseGlobalSkin, TXTFollowerHorseGlobalSkin)
		bUpdateSkins = true
	elseif option == OIDFollowerHorseGlobalArmorSelection
		CHFollowerHorseGlobalArmorSelection.SetValueInt(0)
		SetTextOptionValue(OIDFollowerHorseGlobalArmorSelection, TXTFollowerHorseGlobalArmorSelection)
		SetOptionFlags(OIDFollowerHorseGlobalArmor, OPTION_FLAG_DISABLED)
		bUpdateArmor = true
	elseif Option == OIDFollowerHorseGlobalArmor
		CHFollowerHorseGlobalArmor.SetValueInt(0)
		SetMenuOptionValue(OIDFollowerHorseGlobalArmor, TXTFollowerHorseGlobalArmor)
		bUpdateArmor = true
	elseif option == OIDFollowerHorseDynamicSpeedEnable
		CHFollowerHorseDynamicSpeedEnable.SetValueInt(1)
		SetToggleOptionValue(OIDFollowerHorseDynamicSpeedEnable, true)
	endif
EndEvent

Event OnOptionHighlight(Int Option)
	; *** Page 1 ***
	if option == OIDControlMode
		if CHControlMode.GetValueInt() == 0
			SetInfoText("キー割り当てモード: 次の機能をそれぞれ別のキーに割り当てします (話す/取出, 採取, 高速下馬, 所持品・追従切替)。 ゲームパッド使用かSKSEが検出されない場合マルチタップモードになります")
		elseif CHControlMode.GetValueInt() == 1
			SetInfoText("マルチタップモード: 馬に対して [アクティベート] ボタンを特定回数押します (シングルタップ - 騎乗/下馬, 下馬時ダブルタップ - 所持品, 下馬時トリプルタップ - 追従切替, 騎乗時複数タップ - 話す/取出/採取).")
		else
			SetInfoText("")
		endif
	elseif option == OIDFactionRelations
		if CHFriendlyFactions.GetValueInt() < 0
			SetInfoText("更新したら、友好関係がゲームに保存されます。\n友好的か中立かを選択し、友好関係を更新できます。\n新たにサポートされたSkyrimのDLCがインストールされていたら、友好関係の更新がその度に必要となります。")
		elseif CHFriendlyFactions.GetValueInt() == 0
			SetInfoText("中立関係(ゲームデフォルト) - 馬は攻撃的なアクターの攻撃対象となり、戦闘に参加する可能性があります。\n派閥関係の更新待ちになります。")
		else
			SetInfoText("友好関係(modデフォルト) - 馬は何者も攻撃することなく、またMODで追加された以外のどの勢力からも攻撃を受けません。\n派閥関係の更新待ちになります。")
		endif
	elseif option == OIDConfigurationPower
		SetInfoText("魔法メニューからの古い設定用パワーを表示するかどうか。隠されたままでもMCMの機能なしでロードされれば自動的に表示されます。")
	elseif option == OIDScriptLatencyTest
		SetInfoText("スクリプトの遅延を測定しプレイ中数秒ごとに通知を表示します。 理想的な遅延なら50ミリ秒辺りを維持し100ミリ秒を超えることはありません。メニューモードでの誤った結果は無視すべきです。")
	elseif option == OIDInventoryRecovery
		SetInfoText("If queued for recovery any items stored in horse invetory will be automatically trasnfered to the player when configuration is closed.")
	elseif option == OIDAnimations
		SetInfoText("馬を呼ぶ口笛と追従切替のアニメーションを有効または無効化します。")
	elseif option == OIDCameraFix
		SetInfoText("プレイヤーの武器を素早く再描画することによる騎乗戦闘でのカメラ自動補正を有効または無効化します。ゲームはプレイヤーとNPCが同じアニメーションイベントのトリガーがあった場合に違う認識をしないために、カメラバグはフォロワーが騎乗するときまたは騎乗戦闘後武器を収めるときに発生します。")
	elseif option == OIDMultiTapDelay
		SetInfoText("マルチタップ・モードで[アクティベート]ボタンのタップ数を認識する前に待機する時間。数値が小さいほど、精度を犠牲にして応答時間を短縮できます。数字が大きいほど、応答時間を犠牲にして、より精度が得られます。")
	elseif option == OIDMultiTapCombatOverride
		SetInfoText("戦闘中に騎乗/下馬の応答時間を最大にすることでマルチタップ処理を無効にします。")
	elseif option == OIDMultiTapDismountMode
		SetInfoText("高速下馬の必要があるときは通常の下馬の代わりに実行する")
	elseif option == OIDBoundKeyInventoryMode
		if CHBoundKeyInventoryMode.GetValueInt() == 0
			SetInfoText("近接: 馬が近くにいる時のみ開けるように、所持品へのアクセスを制限します。")
		elseif CHBoundKeyInventoryMode.GetValueInt() == 1
			SetInfoText("移動: 馬の近くにいなくても所持品キーを押し続けることにより馬へと高速移動し所持品を開き、閉じると元の場所へ移動します。移動によるアクセスは騎乗可能な場所、主要都市、店、プレーヤーの家、ギルドの家、城や宿屋で利用できます。")
		elseif CHBoundKeyInventoryMode.GetValueInt() == 2
			SetInfoText("遠隔: 距離に関係なく瞬時のアクセスを可能にします。遠隔によるアクセスは騎乗可能な場所、主要都市、店、プレーヤーの家、ギルドの家、城や宿屋でのみ利用可能です。")
		else
			SetInfoText("")
		endif
	elseif option == OIDBoundKeyConsolidate
		SetInfoText("話す/取出キーで対象が見つからないときに採取を実行します。")
	elseif option == OIDBoundKeyTalk
		SetInfoText("騎乗時に人々と話したり死体から取出しするキーを設定する。\nキーを解除することによりデフォルトに戻ります。解除されているキーは(ESC)と表示されます。")
	elseif option == OIDBoundKeyHarvest
		SetInfoText("騎乗時に素材を採取するキーを設定します。\nキーを解除することによりデフォルトに戻ります。解除されているキーは(ESC)と表示されます。.")
	elseif option == OIDBoundKeyDismount
		SetInfoText("高速下馬のキーを設定します。\nキーを解除することによりデフォルトに戻ります。解除されているキーは(ESC)と表示されます。")
	elseif option == OIDBoundKeyInventory
		SetInfoText("馬の所持品にアクセスする方法を選択します。\nキーを解除することによりデフォルトに戻ります。解除されているキーは(ESC)と表示されます。")
	elseif option == OIDBoundKeySpecial
		SetInfoText("馬の追従切替のキーを設定します。\nキーを解除することによりデフォルトに戻ります。解除されているキーは(ESC)と表示されます。")

	; *** Page 2 ***
	elseif Option == OIDHorseArmorMode
		SetInfoText("鎧をつけた馬は、追加の保護(化粧機能)がない場合、新しい馬に切替えた時自動的に鎧が転送されます。")
	elseif Option == OIDHorseBonusHealth
		SetInfoText("プレイヤーの現在の馬の体力を増加させます。召喚された馬には適用されません。")
	elseif Option == OIDHorseBonusStamina
		SetInfoText("プレイヤーの現在の馬のスタミナを増加させます。召喚された馬には適用されません。")
	elseif Option == OIDHorseBonusSpeed
		SetInfoText("プレイヤーの現在の馬の移動速度を増加させます。召喚された馬には適用されません。")
	elseif option == OIDHorseProtectionMode
		if CHHorseProtectionMode.GetValueInt() == 0
			SetInfoText("プレイヤーの現在の馬は傷つきやすく、死ぬかもしれません。")
		elseif CHHorseProtectionMode.GetValueInt() == 1
			SetInfoText("プレイヤーの現在の馬は不死であり、体力が全て失われても死ぬことはありません。")
		elseif CHHorseProtectionMode.GetValueInt() == 2
			SetInfoText("プレイヤーの現在の馬は無敵であり、体力やスタミナを失うことはなく、無制限にスプリント可能です。")
		else
			SetInfoText("")
		endif	
	elseif option == OIDAutoLoot
		SetInfoText("騎乗戦闘時の自動拾得機能を有効または無効にします。")
	elseif option == OIDHorseCharge
		SetInfoText("騎乗戦闘時の突進攻撃機能を有効または無効にします。")
	elseif option == OIDHorseChargeImpactPrecognitionTime
		SetInfoText("馬の突進攻撃の計算はフレームレートと同期しませんが、事前にヒットイベントの完了と衝撃の瞬間を予測することは可能です。標的が見えない壁にはねられている場合は下げて下さい。いつまでもヒットしないか遅すぎる場合は上げて下さい。")
	elseif option == OIDHorseBehaviorMode
		if CHHorseBehaviorMode.GetValueInt() == 0
			SetInfoText("臆病な馬が脅威から逃げます。友好の派閥関係の設定とペアで使うのがベストです。挙動の変更は、召喚馬を除くプレーヤーの現在の馬にのみ適用されます。")
		elseif CHHorseBehaviorMode.GetValueInt() == 1
			SetInfoText("無鉄砲な馬は常に反撃し通常より大きいダメージを与えます。中立の派閥関係の設定とペアで使うのがベストです。挙動の変更は、召喚馬を除くプレイヤーの現在の馬にのみ適用されます。")
		else
			SetInfoText("")
		endif
	elseif option == OIDHorseFollowEnable
		SetInfoText("馬の所有者への追従を友好または無効にします。ゲーム中の操作でも切替できます。召喚された馬には適用されません。")	
	elseif option == OIDHorseFollowMode
		SetInfoText("スマートな追従ではプレイヤーが隠密状態か、特定の場所の場合、馬は追従を停止します。")	
	elseif option == OIDHorseFollowDistanceMode
		SetInfoText("プレイヤーの馬は追従時、指定された距離を維持しようと努めます。\n1フィート = 21.3 ゲーム単位 または0.3メートル")
	elseif option == OIDHorseCallFormation
		SetInfoText("集団で馬を呼んだ時に、フォロワーがプレイヤーとくさび形の隊形をとります。")
	elseif option == OIDHorseCallFade
		SetInfoText("馬呼び時のテレポーテーションで画面を数秒間黒くフェードさせます。.")

	; *** Page 3 ***
	elseif option == OIDFollowerModeEnable
		SetInfoText("Convenient Horsesはフォロワーに各々の馬と騎乗動作の制御を提供します。\n対応しているフォロワーmods: Extensible Follower Framework, Ultimate Follower Overhaul そして Amazing Follower Tweaks. 最大15頭")
	elseif option == OIDFollowerPreferRidingEnable
		SetInfoText("プレイヤーが騎乗していなくても、フォロワーは騎乗します。フォロワーの1人に話しかけることにより切り替えられます。")
	elseif option == OIDFollowerAutoRetaliateEnable
		SetInfoText("フォロワーはプレイヤーが騎乗時武器を鞘に収めていても戦闘し、終了するまで戦闘を続行します。")
	elseif option == OIDFollowerCombatEscapeEnable
		SetInfoText("フォロワーはプレイヤーが騎乗時武器を鞘に収めている場合、戦闘を中止し騎乗します。")
	elseif option == OIDFollowerHorseRecallEnable
		SetInfoText("フォロワーの馬は騎乗していない時に送還され(テレポートし消えます)、騎乗する時は常に角笛を使います。")
	elseif option == OIDFollowerHorseCallDistanceMode
		SetInfoText("馬との距離が一定の設定値を超えた場合、フォロワーは角笛を使いますが、そうでない場合は馬のもとへ走って行って騎乗します。\n1フィート = 21.3 ゲーム単位または 0.3 メートル")
	elseif option == OIDFollowerMountedCombatEnable
		SetInfoText("フォロワーの騎乗近接戦闘を可能にします。武器は一時的に自動で提供されます。")
	elseif Option == OIDFollowerMountedCombatDamage
		SetInfoText("ダメージはプレイヤーのレベルと対象のフォロワーの関連武器スキル、付呪または増減されたスキルによって変化します。あなたは最終的なダメージの割合を制御出来ます。")
	elseif option == OIDFollowerHorseGlobalSkinSelection
		SetInfoText("全馬の毛色を設定することで全てのフォロワーの馬の毛色を設定するか、会話によって各フォロワーの馬を個別に設定するか")
	elseif Option == OIDFollowerHorseGlobalSkin
		SetInfoText("全フォロワーの馬のタイプを選択して下さい。")
	elseif option == OIDFollowerHorseGlobalArmorSelection
		SetInfoText("全馬の鎧を設定することで全てのフォロワーの馬の鎧を設定するか、会話によって各フォロワーの馬を個別に設定するか")
	elseif Option == OIDFollowerHorseGlobalArmor
		SetInfoText("全てのフォロワーの馬は選択した鎧を装備します。")
	elseif option == OIDFollowerHorseDynamicSpeedEnable
		SetInfoText("フォロワーが騎乗時にプレイヤーにより追い付きやすくする為に動的に速度を変化させます。\n1200ゲーム単位プレイヤーから離れたところから速度が上昇が開始され、式:\n(距離-1200)^0.5 の結果が速度の割合(e.g. もし距離=3700ならフォロワーは騎乗時50%速くなる)。")
	else
		SetInfoText("")
	endif
EndEvent

; *** Auto properties
ReferenceAlias property Alias_Sack auto
Spell property CHConfigurationPower auto
Quest property CHLatencyTest auto
Quest property CHFollower auto
Quest property CH auto
CHFollowerAliasScript[] property Followers auto
Message property CHHorseInventoryRecoveryMessage auto

GlobalVariable property CHControlMode auto
GlobalVariable property CHMultiTapDelay auto
GlobalVariable property CHMultiTapCombatOverride auto
GlobalVariable property CHMultiTapDismountMode auto
GlobalVariable property CHBoundKeyConsolidate auto
GlobalVariable property CHBoundKeyInventoryMode auto

GlobalVariable property CHFriendlyFactions auto

GlobalVariable property CHKeyTalk auto
GlobalVariable property CHKeyHarvest auto
GlobalVariable property CHKeyDismount auto
GlobalVariable property CHKeyInventory auto
GlobalVariable property CHKeySpecial auto

GlobalVariable property CHHorseProtectionMode auto
GlobalVariable property CHHorseBonusHealth auto
GlobalVariable property CHHorseBonusStamina auto
GlobalVariable property CHHorseBonusSpeed auto

GlobalVariable property CHHorseArmorMode auto
GlobalVariable property CHHorseFollowEnable auto
GlobalVariable property CHHorseFollowMode auto
GlobalVariable property CHHorseFollowDistanceMode auto
GlobalVariable property CHHorseBehaviorMode auto

GlobalVariable property CHFollowerModeEnable auto
GlobalVariable property CHFollowerPreferRidingEnable auto
GlobalVariable property CHFollowerAutoRetaliateEnable auto
GlobalVariable property CHFollowerCombatEscapeEnable auto
GlobalVariable property CHFollowerHorseRecallEnable auto
GlobalVariable property CHFollowerHorseCallDistanceMode auto
GlobalVariable property CHFollowerHorseGlobalSkinSelection auto
GlobalVariable property CHFollowerHorseGlobalSkin auto
GlobalVariable property CHFollowerHorseGlobalArmorSelection auto
GlobalVariable property CHFollowerHorseGlobalArmor auto
GlobalVariable property CHFollowerMountedCombatEnable auto
GlobalVariable property CHFollowerMountedCombatDamageMult auto
GlobalVariable property CHFollowerHorseDynamicSpeedEnable auto

GlobalVariable property CHHorseChargeEnable auto
GlobalVariable property CHHorseChargeImpactPrecognitionTime auto
GlobalVariable property CHAutoLootEnable auto

GlobalVariable property CHAnimationsEnable auto
GlobalVariable property CHMountedCombatCameraFixEnable auto
GlobalVariable property CHHorseCallFormationEnable auto
GlobalVariable property CHHorseCallFadeEnable auto

; *** String properties (for menu display)
String Property TXTConfigurationPower Hidden
	String Function Get()
		if bConfigPower
			return "Shown"
		else
			return "Hidden"
		endif
	EndFunction
EndProperty
String Property TXTScriptLatencyTest Hidden
	String Function Get()
		if bLatencyTest
			return "Running"
		else
			return "Stopped"
		endif
	EndFunction
EndProperty
String Property TXTControlMode Hidden
	String Function Get()
		if CHControlMode.GetValueInt() == 0
			return "Bound Key"
		elseif CHControlMode.GetValueInt() == 1
			return "Multi Tap"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTMultiTapDismountMode Hidden
	String Function Get()
		if CHMultiTapDismountMode.GetValueInt() == 0
			return "Never"
		elseif CHMultiTapDismountMode.GetValueInt() == 1
			return "Combat"
		elseif CHMultiTapDismountMode.GetValueInt() == 2
			return "Always"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTInventoryRecovery Hidden
	String Function Get()
		if bRecoverInventory
			return "Recover (Queued)"
		else
			return "Do Not Recover"
		endif
	EndFunction
EndProperty
String Property TXTFactionRelations Hidden
	String Function Get()
		if CHFriendlyFactions.GetValueInt() < 0
			return "Do Not Update"
		elseif CHFriendlyFactions.GetValueInt() == 0
			return "Neutral (Queued)"
		elseif CHFriendlyFactions.GetValueInt() > 0
			return "Friendly (Queued)"
		endif
	EndFunction
EndProperty
String Property TXTHorseProtectionMode Hidden
	String Function Get()
		if CHHorseProtectionMode.GetValueInt() == 0
			return "No Protection"
		elseif CHHorseProtectionMode.GetValueInt() == 1
			return "Essential"
		elseif CHHorseProtectionMode.GetValueInt() == 2
			return "Invulnerable"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTHorseArmorMode Hidden
	String Function Get()
		if CHHorseArmorMode.GetValueInt() >= 0 && CHHorseArmorMode.GetValueInt() < Armors.Length
			return Armors[CHHorseArmorMode.GetValueInt()]
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTHorseBehaviorMode Hidden
	String Function Get()
		if CHHorseBehaviorMode.GetValueInt() == 0
			return "Cowardly"
		elseif CHHorseBehaviorMode.GetValueInt() == 1
			return "Foolhardy"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTHorseFollowMode Hidden
	String Function Get()
		if CHHorseFollowMode.GetValueInt() == 0
			return "Smart"
		elseif CHHorseFollowMode.GetValueInt() == 1
			return "Always"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTHorseFollowDistanceMode Hidden
	String Function Get()
		if CHHorseFollowDistanceMode.GetValueInt() == 0
			return "Short (14-18 feet)"
		elseif CHHorseFollowDistanceMode.GetValueInt() == 1
			return "Medium (28-37 feet)"
		elseif CHHorseFollowDistanceMode.GetValueInt() == 2
			return "Long (56-75 feet)"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTBoundKeyInventoryMode Hidden
	String Function Get()
		if CHBoundKeyInventoryMode.GetValueInt() == 0
			return "Local"
		elseif CHBoundKeyInventoryMode.GetValueInt() == 1
			return "Travel"
		elseif CHBoundKeyInventoryMode.GetValueInt() == 2
			return "Remote"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTFollowerHorseCallDistanceMode Hidden
	String Function Get()
		if CHFollowerHorseCallDistanceMode.GetValueInt() == 0
			return "Short (56 feet)"
		elseif CHFollowerHorseCallDistanceMode.GetValueInt() == 1
			return "Medium (112 feet)"
		elseif CHFollowerHorseCallDistanceMode.GetValueInt() == 2
			return "Long (168 feet)"
		elseif CHFollowerHorseCallDistanceMode.GetValueInt() == 3
			return "Very Long (225 feet)"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTFollowerHorseGlobalSkinSelection Hidden
	String Function Get()
		if CHFollowerHorseGlobalSkinSelection.GetValueInt() == 0
			return "Per Follower"
		elseif CHFollowerHorseGlobalSkinSelection.GetValueInt() == 1
			return "Global"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTFollowerHorseGlobalSkin Hidden
	String Function Get()
		if CHFollowerHorseGlobalSkin.GetValueInt() >= 0 && CHFollowerHorseGlobalSkin.GetValueInt() < Skins.Length
			return Skins[CHFollowerHorseGlobalSkin.GetValueInt()]
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTFollowerHorseGlobalArmorSelection Hidden
	String Function Get()
		if CHFollowerHorseGlobalArmorSelection.GetValueInt() == 0
			return "Per Follower"
		elseif CHFollowerHorseGlobalArmorSelection.GetValueInt() == 1
			return "Global"
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
String Property TXTFollowerHorseGlobalArmor Hidden
	String Function Get()
		if CHFollowerHorseGlobalArmor.GetValueInt() >= 0 && CHFollowerHorseGlobalArmor.GetValueInt() < Armors.Length
			return Armors[CHFollowerHorseGlobalArmor.GetValueInt()]
		else
			return "Invalid Entry"
		endif
	EndFunction
EndProperty
