Skip to content

Commit 0c6e538

Browse files
Merge pull request #165 from logicallysynced/chromatics-3.x
Added some extra checks for raid effects and AZERTY layouts
2 parents e3ad6c5 + c2bf910 commit 0c6e538

10 files changed

Lines changed: 121 additions & 43 deletions

File tree

Chromatics/Chromatics.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<TargetFramework>net8.0-windows7.0</TargetFramework>
66
<UseWindowsForms>true</UseWindowsForms>
77
<StartupObject>Chromatics.Program</StartupObject>
8-
<Version>3.1.3.0</Version>
8+
<Version>3.1.3.1</Version>
99
<Authors>Danielle Thompson</Authors>
1010
<ApplicationManifest>app.manifest</ApplicationManifest>
1111
<Copyright>Danielle Thompson 2024</Copyright>

Chromatics/Chromatics.sln

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 25.0.1704.3
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chromatics", "Chromatics.csproj", "{24D17385-5866-4EF5-8595-5276EE0D088A}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
EndGlobalSection
13+
GlobalSection(SolutionProperties) = preSolution
14+
HideSolutionNode = FALSE
15+
EndGlobalSection
16+
GlobalSection(ExtensibilityGlobals) = postSolution
17+
SolutionGuid = {63572831-4136-4B51-BE30-34824AAFAC05}
18+
EndGlobalSection
19+
EndGlobal

Chromatics/Forms/Uc_Mappings.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,19 @@ private void CreateDefaults(KeyValuePair<Guid, IRGBDevice> devicePair)
333333
// Add dynamic layer for keyboards
334334
if (deviceType == RGBDeviceType.Keyboard)
335335
{
336+
var settings = AppSettings.GetSettings();
336337
var x = i;
337-
AddLayer(LayerType.DynamicLayer, deviceGuid, deviceType, 0, x, true, false, true, LedKeyHelper.DefaultKeys_ReactiveWeather, (int)DynamicLayerType.ReactiveWeatherHighlight, true, LayerModes.Interpolate);
338+
339+
if (settings.keyboardLayout == KeyboardLocalization.azerty)
340+
{
341+
AddLayer(LayerType.DynamicLayer, deviceGuid, deviceType, 0, x, true, false, true, LedKeyHelper.DefaultKeys_ReactiveWeather_AZERTY, (int)DynamicLayerType.ReactiveWeatherHighlight, true, LayerModes.Interpolate);
342+
}
343+
else
344+
{
345+
AddLayer(LayerType.DynamicLayer, deviceGuid, deviceType, 0, x, true, false, true, LedKeyHelper.DefaultKeys_ReactiveWeather_QWERTY, (int)DynamicLayerType.ReactiveWeatherHighlight, true, LayerModes.Interpolate);
346+
}
347+
348+
338349
AddLayer(LayerType.DynamicLayer, deviceGuid, deviceType, 0, (x + 1), true, false, true, LedKeyHelper.DefaultKeys_Keybinds, (int)DynamicLayerType.Keybinds, true, LayerModes.Interpolate);
339350
AddLayer(LayerType.DynamicLayer, deviceGuid, deviceType, 0, (x + 2), true, false, true, LedKeyHelper.DefaultKeys_HP, (int)DynamicLayerType.HPTracker, true, LayerModes.Interpolate);
340351
AddLayer(LayerType.DynamicLayer, deviceGuid, deviceType, 0, (x + 3), true, false, true, LedKeyHelper.DefaultKeys_MP, (int)DynamicLayerType.MPTracker, true, LayerModes.Interpolate);

Chromatics/Forms/vDevices/Uc_VirtualKeyboard.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public override void InitializeDevice()
5757

5858
foreach (var led in keycapsLocalized)
5959
{
60-
Debug.WriteLine(led.LedType);
6160
keycaps.Add(new KeyValuePair<int, KeyboardKey>(base_i, led));
6261
base_i++;
6362
}

Chromatics/Helpers/LedKeyHelper.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,7 @@ public static Dictionary<int, LedId> GetAllKeysForDevice(RGBDeviceType device)
21182118
LedId.Unknown128
21192119
};
21202120

2121-
public static Dictionary<int, LedId> DefaultKeys_ReactiveWeather = new Dictionary<int, LedId>()
2121+
public static Dictionary<int, LedId> DefaultKeys_ReactiveWeather_QWERTY = new Dictionary<int, LedId>()
21222122
{
21232123
{ 1, LedId.Keyboard_W },
21242124
{ 2, LedId.Keyboard_A },
@@ -2127,9 +2127,19 @@ public static Dictionary<int, LedId> GetAllKeysForDevice(RGBDeviceType device)
21272127
{ 5, LedId.Keyboard_LeftShift },
21282128
{ 6, LedId.Keyboard_LeftCtrl },
21292129
{ 7, LedId.Keyboard_LeftAlt }
2130-
2131-
21322130
};
2131+
2132+
public static Dictionary<int, LedId> DefaultKeys_ReactiveWeather_AZERTY = new Dictionary<int, LedId>()
2133+
{
2134+
{ 1, LedId.Keyboard_Z },
2135+
{ 2, LedId.Keyboard_Q },
2136+
{ 3, LedId.Keyboard_S },
2137+
{ 4, LedId.Keyboard_D },
2138+
{ 5, LedId.Keyboard_LeftShift },
2139+
{ 6, LedId.Keyboard_LeftCtrl },
2140+
{ 7, LedId.Keyboard_LeftAlt }
2141+
};
2142+
21332143
public static Dictionary<int, LedId> DefaultKeys_Keybinds = new Dictionary<int, LedId>()
21342144
{
21352145
{ 1, LedId.Keyboard_GraveAccentAndTilde },

Chromatics/Layers/BaseLayers/ReactiveWeather.cs

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class ReactiveWeatherProcessor : LayerProcessor
3838
internal static int _previousOffset = 0;
3939
internal static bool dutyComplete = false;
4040
internal static bool raidEffectsRunning = false;
41+
internal static string[] bossNames = null;
4142

4243
public override void Process(IMappingLayer layer)
4344
{
@@ -147,29 +148,38 @@ public override void Process(IMappingLayer layer)
147148

148149
if (chatLogEntries.Count > 0)
149150
{
150-
//Debug.WriteLine($"{chatLogEntries.First().Code}: {chatLogEntries.First().Message}");
151-
152-
if (chatLogEntries.First().Code == "0840" && Regex.IsMatch(chatLogEntries.First().Message, @"completion time: (\d+:\d+)"))
151+
152+
if (chatLogEntries.First().Code == "0840" && Regex.IsMatch(chatLogEntries.First().Message, @"completion time: (\d+:\d+)", RegexOptions.IgnoreCase))
153153
{
154154
dutyComplete = true;
155155
raidEffectsRunning = false;
156+
bossNames = null;
156157
}
157158

158-
else if (chatLogEntries.First().Code == "0839" && Regex.IsMatch(chatLogEntries.First().Message, @"has begun\."))
159+
else if (chatLogEntries.First().Code == "0839" && Regex.IsMatch(chatLogEntries.First().Message, @"has begun\.", RegexOptions.IgnoreCase))
159160
{
160161
dutyComplete = false;
161162
}
162163

163-
else if (chatLogEntries.First().Code == "083E" && Regex.IsMatch(chatLogEntries.First().Message, @"You obtain \d+ Allagan tomestones of \w+\."))
164+
else if (chatLogEntries.First().Code == "083E" && Regex.IsMatch(chatLogEntries.First().Message, @"You obtain \d+ Allagan tomestones of \w+\.", RegexOptions.IgnoreCase))
165+
{
166+
dutyComplete = true;
167+
raidEffectsRunning = false;
168+
bossNames = null;
169+
}
170+
171+
else if (chatLogEntries.First().Code == "0839" && Regex.IsMatch(chatLogEntries.First().Message, @"has ended\.", RegexOptions.IgnoreCase))
164172
{
165173
dutyComplete = true;
166174
raidEffectsRunning = false;
175+
bossNames = null;
167176
}
168177

169-
else if (chatLogEntries.First().Code == "0839" && Regex.IsMatch(chatLogEntries.First().Message, @"has ended\."))
178+
else if (bossNames != null && (chatLogEntries.First().Code == "133A" || chatLogEntries.First().Code == "0B3A") && Regex.IsMatch(chatLogEntries.First().Message, @"(.* defeats|You defeat|You defeat the) (" + string.Join("|", bossNames.Select(Regex.Escape)) + @")\.", RegexOptions.IgnoreCase))
170179
{
171180
dutyComplete = true;
172181
raidEffectsRunning = false;
182+
bossNames = null;
173183
}
174184

175185
}
@@ -193,14 +203,6 @@ public override void Process(IMappingLayer layer)
193203
currentWeather = weatherService.GetCurrentWeather(currentZone).Item1.ToString();
194204
}
195205

196-
/*
197-
if (raidEffectsRunning)
198-
{
199-
model._currentWeather = currentWeather;
200-
201-
}
202-
*/
203-
204206

205207
//var currentWeather = weatherService.GetCurrentWeather(currentZone).Item1.ToString();
206208

@@ -209,10 +211,10 @@ public override void Process(IMappingLayer layer)
209211

210212

211213
//layergroup.Brush = weather_brush;
212-
effectApplied = SetReactiveWeather(layergroup, currentZone, currentWeather, weather_brush, _colorPalette, surface, ledArray, model._gradientEffects, DutyFinderBellExtension.InInstance());
214+
effectApplied = SetReactiveWeather(layergroup, currentZone, currentWeather, weather_brush, _colorPalette, surface, ledArray, model._gradientEffects, DutyFinderBellExtension.InInstance(), layer.deviceGuid);
213215

214216
#if DEBUG
215-
Debug.WriteLine($"{layer.deviceType} Zone Lookup: {currentZone}. Weather: {currentWeather}");
217+
//Debug.WriteLine($"{layer.deviceGuid} Zone Lookup: {currentZone}. Weather: {currentWeather}");
216218
#endif
217219

218220
model._currentWeather = currentWeather;
@@ -317,7 +319,7 @@ private static void StopEffects(ListLedGroup layer, HashSet<LinearGradient> _gra
317319
layer.RemoveAllDecorators();
318320
}
319321

320-
private static bool SetReactiveWeather(ListLedGroup layer, string zone, string weather, SolidColorBrush weather_brush, PaletteColorModel _colorPalette, RGBSurface surface, Led[] ledArray, HashSet<LinearGradient> _gradientEffects, bool inInstance)
322+
private static bool SetReactiveWeather(ListLedGroup layer, string zone, string weather, SolidColorBrush weather_brush, PaletteColorModel _colorPalette, RGBSurface surface, Led[] ledArray, HashSet<LinearGradient> _gradientEffects, bool inInstance, Guid deviceGuid)
321323
{
322324
var effectSettings = RGBController.GetEffectsSettings();
323325
var runningEffects = RGBController.GetRunningEffects();
@@ -344,6 +346,7 @@ private static bool SetReactiveWeather(ListLedGroup layer, string zone, string w
344346
SetEffect(starfield, layer, runningEffects);
345347

346348
raidEffectsRunning = true;
349+
bossNames = ["Zoraal Ja"];
347350

348351
return true;
349352
}
@@ -373,6 +376,7 @@ private static bool SetReactiveWeather(ListLedGroup layer, string zone, string w
373376

374377
runningEffects.Add(layer);
375378
raidEffectsRunning = true;
379+
bossNames = ["Queen Eternal"];
376380

377381
return true;
378382
}
@@ -402,6 +406,7 @@ private static bool SetReactiveWeather(ListLedGroup layer, string zone, string w
402406

403407
runningEffects.Add(layer);
404408
raidEffectsRunning = true;
409+
bossNames = ["Black Cat"];
405410

406411
return true;
407412
}
@@ -417,6 +422,7 @@ private static bool SetReactiveWeather(ListLedGroup layer, string zone, string w
417422
layer.Brush = new SolidColorBrush(baseCol);
418423
SetEffect(arenaLightShow, layer, runningEffects);
419424
raidEffectsRunning = true;
425+
bossNames = ["Honey B. Lovely"];
420426

421427
return true;
422428
}
@@ -445,11 +451,13 @@ private static bool SetReactiveWeather(ListLedGroup layer, string zone, string w
445451

446452
runningEffects.Add(layer);
447453
raidEffectsRunning = true;
454+
bossNames = ["Brute Bomber"];
448455

449456
return true;
450457
}
451458
break;
452459
case "The Thundering":
460+
case "Dalamud's Shadow":
453461
//Raid Zone Effect
454462
if (effectSettings.effect_raideffects && !raidEffectsRunning)
455463
{
@@ -460,6 +468,9 @@ private static bool SetReactiveWeather(ListLedGroup layer, string zone, string w
460468
layer.Brush = new SolidColorBrush(baseCol);
461469
SetEffect(bpmArenaLightShow, layer, runningEffects);
462470
raidEffectsRunning = true;
471+
bossNames = ["Wicked Thunder", "Rafflesia"];
472+
473+
//Logger.WriteConsole(Enums.LoggerTypes.FFXIV, $"Catch X4: Effect Run ({deviceGuid})");
463474

464475
return true;
465476
}
@@ -469,6 +480,7 @@ private static bool SetReactiveWeather(ListLedGroup layer, string zone, string w
469480
}
470481

471482
raidEffectsRunning = false;
483+
bossNames = null;
472484

473485
switch (zone)
474486
{

0 commit comments

Comments
 (0)