mrbot/settings/settings.iss
2023-12-08 15:07:11 -06:00

188 lines
4.5 KiB
Plaintext

; objectdef CastStackAbility
; {
; variable string Name
; variable string AbilityTarget
; variable string AbilityType
; variable int Percentage
; variable string Tag
; method Initialize(jsonvalueref jo)
; {
; This:FromJSON[jo]
; }
; method FromJSON(jsonvalueref jo)
; {
; Name:Set["${jo.Get[Name]~}"]
; AbilityTarget:Set["${jo.Get[AbilityTarget]~}"]
; AbilityType:Set["${jo.Get[AbilityType]~}"]
; Percentage:Set[${jo.Get[Percentage]~}]
; ; Tag:Set["${jo.Get[Tag]~}"]
; }
; member:jsonvalueref AsJSON()
; {
; variable jsonvalue jo="{}"
; jo:SetString[Name, "${Name~}"]
; jo:SetString[AbilityTarget, "${AbilityTarget~}"]
; jo:SetString[AbilityType, "${AbilityType~}"]
; jo:SetString[Percentage, ${Percentage~}]
; jo:SetString[Tag, "${Tag~}"]
; return jo
; }
; }
; objectdef CastStackContainer
; {
; variable index:CastStackAbility Abilities
; method AddAbilityFromJSON(jsonvalueref jo)
; {
; if !${jo.Type.Equal[object]}
; {
; return FALSE
; }
; Abilities:Insert[jo]
; }
; member:jsonvalueref AsJSON()
; {
; variable jsonvalue jo="[]"
; variable iterator abilityIterator
; Abilities:GetIterator[abilityIterator]
; if ${abilityIterator:First(exists)}
; {
; do
; {
; jo:Add["${abilityIterator.Value.AsJSON~}"]
; }
; while ${abilityIterator:Next(exists)}
; }
; return jo
; }
; }
; objectdef Profile
; {
; variable string Name
; variable jsonvalue Settings = "{}"
; variable jsonvalue Setup
; variable jsonvalue Aliases
; variable CastStackContainer CastStack
; method Initialize(jsonvalueref jo)
; {
; This:FromJSON[jo]
; }
; member:bool GetSettingValue(string key)
; {
; echo "Profile.GetSettingValue[${key}]"
; return ${This.Settings.Get["${key}"]}
; }
; method FromJSON(jsonvalueref jo)
; {
; Name:Set["${jo.Get["Name"]~}"]
; Settings:SetValue["${jo.Get["Settings"]~}"]
; Setup:SetValue["${jo.Get["Setup"]~}"]
; Aliases:SetValue["${jo.Get["Aliases"]~}"]
; jo.Get["CastStack"]:ForEach["CastStack:AddAbilityFromJSON[ForEach.Value]"]
; }
; member:jsonvalueref AsJSON()
; {
; variable jsonvalue jo="{}"
; jo:Set["Name", "${This.Name.AsJSON~}"]
; jo:Set["Settings", "${Settings.AsJSON~}"]
; jo:Set["Setup", "${Setup.AsJSON~}"]
; jo:Set["Aliases", "${Aliases.AsJSON~}"]
; jo:Set["CastStack", "${CastStack.AsJSON~}"]
; return jo
; }
; }
; objectdef BotSettings
; {
; variable string DefaultProfile
; variable collection:Profile Profiles
; method FromFile(string filename)
; {
; variable jsonvalue settingsJson
; variable BotSettings settings
; settingsJson:ParseFile["${filename}"]
; This:FromJSON[settingsJson]
; }
; member:bool IsSettingChecked(string key)
; {
; echo "BotSettings.IsSettingChecked[${key}]"
; return ${This.CurrentProfile.GetSettingValue["${key}"].Equal[TRUE]}
; }
; method FromJSON(jsonvalueref jo)
; {
; DefaultProfile:Set[${jo.Get["DefaultProfile"]}]
; variable jsoniterator profileIterator
; jo.Get["Profiles"]:GetIterator[profileIterator]
; if ${profileIterator:First(exists)}
; {
; do
; {
; Profiles:Set[${profileIterator.Key}, profileIterator.Value]
; }
; while ${profileIterator:Next(exists)}
; }
; }
; member:jsonvalueref AsJSON()
; {
; variable jsonvalue jo="{}"
; jo:Set[DefaultProfile, "${DefaultProfile.AsJSON~}"]
; jo:Set[Profiles, "${Profiles.AsJSON~}"]
; return jo
; }
; member:weakref CurrentProfile()
; {
; return Profiles.Element["${This.DefaultProfile}"]
; }
; }
objectdef SettingsController
{
method Initialize()
{
LGUI2:LoadPackageFile["${LavishScript.HomeDirectory}/scripts/mr/common/MRSkin.json"]
LGUI2:LoadPackageFile["settings.json"]
}
method Shutdown()
{
LGUI2:UnloadPackageFile["settings.json"]
Event[OnBotClose]:Execute
}
method OnClose()
{
Script:End
}
}
variable(global) SettingsController MRSettingsController
function main()
{
while 1
{
wait 5
}
}