Added niave toggling of visibility of target based on target type

This commit is contained in:
Malcolm Roberts 2023-12-18 15:43:10 -06:00
parent 2df0795b56
commit fe61d63f26

View File

@ -30,10 +30,15 @@ objectdef SettingsController
variable jsonvalue abilityItem = "{}"
if ${jo.Get["${key}"].Get[1, "spellBookType"]} < 2
{
abilityItem:SetValue[$$>{
"Name": "${key~}"
}<$$]
abilityListItems:Add[${abilityItem}]
abilityItem:SetValue["$$>{
"Name": "${key~}",
"TargetType": ${jo.Get["${key}"].Get[1, "targetType"]},
"IsBeneficial": ${jo.Get["${key}"].Get[1, "isBeneficial"]},
"GroupRestricted": ${jo.Get["${key}"].Get[1, "groupRestricted"]},
"MaxAoeTargets": ${jo.Get["${key}"].Get[1, "maxAoeTargets"]}
}<$$"]
abilityListItems:Add["${abilityItem.AsJSON}"]
}
}
@ -47,8 +52,25 @@ objectdef SettingsController
{
}
method ToggleTargetVisibilityBySelectedAbility(int selectedAbilityIndex)
{
if ${abilityListItems.Get[${selectedAbilityIndex}, "TargetType"]} != 1
{
echo "Hide target: ${abilityListItems.Get[${selectedAbilityIndex}, "TargetType"]}"
LGUI2.Element["castStack.ability.target"].Parent:SetVisibility[Hidden]
}
else
{
echo "Show target: ${abilityListItems.Get[${selectedAbilityIndex}, "TargetType"]}"
LGUI2.Element["castStack.ability.target"].Parent:SetVisibility[Visible]
}
}
method SetCurrentAbility(int selectedIndex)
{
This:ToggleTargetVisibilityBySelectedAbility[${selectedIndex}]
currentSelectedAvailableAbilityIndex:Set[${selectedIndex}]
LGUI2.Element[MRSettingsController.events]:FireEventHandler[onNewCastStackItemChanged]
newCastStackItem:SetValue["$$>{
@ -59,16 +81,11 @@ objectdef SettingsController
method OnCastStackAbilityComboChange(string param)
{
echo "param: ${param}"
echo "OnCastStackAbilityComboChange: ${Context.AsJSON~}"
newCastStackItem:Set["${Context.Source.Name.Token[3, "."]}", "${Context.Source.SelectedItem.Data.AsJSON~}"]
echo "${Context.Source.Name.Token[3, "."]} = ${Context.Source.SelectedItem.Data}"
echo "newCastStackItem: ${newCastStackItem.AsJSON[multiline]~}"
This:SafeSetNewCastStackItemProperty["${Context.Source.Name.Token[3, "."]}", "${Context.Source.SelectedItem.Data.AsJSON~}"]
}
method SafeSetNewCastStackItemProperty(string propertyName, string value)
{
echo "SafeSetNewCastStackItemProperty: ${propertyName} = ${value}"
if ${value(exists)} && ${value.NotEqual[""]}
{
newCastStackItem:Set["${propertyName}", "${value}"]