-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathConfiguration.cs
More file actions
138 lines (123 loc) · 5.34 KB
/
Configuration.cs
File metadata and controls
138 lines (123 loc) · 5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
using System;
using System.Collections.Generic;
using Dalamud.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace ReAction;
public class Configuration : PluginConfiguration, IPluginConfiguration
{
public class Action
{
public uint ID = 0;
public bool UseAdjustedID = false;
}
public class ActionStackItem
{
public uint ID = 0;
public uint TargetID = 10_000;
}
public class ActionStack
{
public string Name = string.Empty;
public List<Action> Actions = [];
public List<ActionStackItem> Items = [];
public uint ModifierKeys = 0u;
public bool BlockOriginal = false;
public bool CheckRange = false;
public bool CheckCooldown = false;
}
public class StackSerializer : DefaultSerializationBinder
{
private static readonly Type actionStackType = typeof(ActionStack);
private static readonly Type actionStackItemType = typeof(ActionStackItem);
private static readonly Type actionType = typeof(Action);
private const string actionStackShortName = "s";
private const string actionStackItemShortName = "i";
private const string actionShortName = "a";
private static readonly Dictionary<string, Type> types = new()
{
[actionStackType.FullName!] = actionStackType,
[actionStackShortName] = actionStackType,
[actionStackItemType.FullName!] = actionStackItemType,
[actionStackItemShortName] = actionStackItemType,
[actionType.FullName!] = actionType,
[actionShortName] = actionType
};
private static readonly Dictionary<Type, string> typeNames = new()
{
[actionStackType] = actionStackShortName,
[actionStackItemType] = actionStackItemShortName,
[actionType] = actionShortName
};
public override Type BindToType(string assemblyName, string typeName)
=> types.TryGetValue(typeName, out var t) ? t : base.BindToType(assemblyName, typeName);
public override void BindToName(Type serializedType, out string assemblyName, out string typeName)
{
assemblyName = null;
if (typeNames.TryGetValue(serializedType, out var name))
typeName = name;
else
base.BindToName(serializedType, out assemblyName, out typeName);
}
}
public int Version { get; set; }
public List<ActionStack> ActionStacks = [];
public bool EnableEnhancedAutoFaceTarget = false;
public bool EnableAutoDismount = false;
public bool EnableGroundTargetQueuing = false;
public bool EnableInstantGroundTarget = false;
public bool EnableBlockMiscInstantGroundTargets = false;
public bool EnableAutoCastCancel = false;
public bool EnableAutoTarget = false;
public bool EnableAutoChangeTarget = false;
public bool EnableSpellAutoAttacks = false;
public bool EnableSpellAutoAttacksOutOfCombat = false;
public bool EnableCameraRelativeDashes = false;
public bool EnableNormalBackwardDashes = false;
public bool EnableQueuingMore = false;
public bool EnableFrameAlignment = false;
public bool EnableAutoRefocusTarget = false;
public bool EnableMacroQueue = false;
public bool EnableFractionality = false;
public bool EnablePlayerNamesInCommands = false;
public bool EnableQueueAdjustments = false;
public bool EnableRequeuing = false;
public bool EnableSlidecastQueuing = false;
public bool EnableGCDAdjustedQueueThreshold = false;
public float QueueThreshold = 0.5f;
public float QueueLockThreshold = 0.5f;
public float QueueActionLockout = 0f;
public bool EnableTurboHotbars = false;
public int TurboHotbarInterval = 400;
public int InitialTurboHotbarInterval = 0;
public bool EnableTurboHotbarsOutOfCombat = false;
public HashSet<uint> TurboHotbarBlacklist = [];
public bool EnableCameraRelativeDirectionals = false;
public bool EnableUnassignableActions = false;
public uint AutoFocusTargetID = 0;
public bool EnableAutoFocusTargetOutOfCombat = false;
public bool EnableDecomboLiturgy = false;
public bool EnableDecomboEarthlyStar = false;
public bool EnableDecomboMinorArcana = false;
public bool EnableDecomboFireInRed = false;
public bool EnableDecomboFire2InRed = false;
public bool EnableDecomboBlizzardInCyan = false;
public bool EnableDecomboBlizzard2InCyan = false;
public override void Initialize() { }
private static readonly StackSerializer serializer = new ();
private const string exportPrefix = "RE_";
public static string ExportActionStack(ActionStack stack)
=> Util.CompressString(JsonConvert.SerializeObject(stack, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Objects,
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore,
SerializationBinder = serializer
}), exportPrefix);
public static ActionStack ImportActionStack(string import)
=> JsonConvert.DeserializeObject<ActionStack>(Util.DecompressString(import, exportPrefix), new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Objects,
SerializationBinder = serializer
});
}