Add support for the new alert sounds.

This commit is contained in:
GlenCFL
2017-12-07 06:49:25 -05:00
parent 2cf6a5953b
commit 010e0dda31
47 changed files with 1314 additions and 895 deletions

View File

@@ -140,19 +140,19 @@ namespace Filtration.Parser.Services
break;
}
case "ElderItem":
{
AddBooleanItemToBlockItems<ElderItemBlockItem>(block, trimmedLine);
break;
{
AddBooleanItemToBlockItems<ElderItemBlockItem>(block, trimmedLine);
break;
}
case "ShaperItem":
{
AddBooleanItemToBlockItems<ShaperItemBlockItem>(block, trimmedLine);
break;
case "ShaperItem":
{
AddBooleanItemToBlockItems<ShaperItemBlockItem>(block, trimmedLine);
break;
}
case "ShapedMap":
{
AddBooleanItemToBlockItems<ShapedMapBlockItem>(block, trimmedLine);
break;
case "ShapedMap":
{
AddBooleanItemToBlockItems<ShapedMapBlockItem>(block, trimmedLine);
break;
}
case "Sockets":
{
@@ -217,36 +217,35 @@ namespace Filtration.Parser.Services
break;
}
case "PlayAlertSound":
case "PlayAlertSoundPositional":
{
// Only ever use the last PlayAlertSound item encountered as multiples aren't valid.
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
var matches = Regex.Matches(trimmedLine, @"\s+(\d+)");
switch (matches.Count)
{
case 1:
if (matches[0].Success)
{
var blockItemValue = new SoundBlockItem
{
Value = Convert.ToInt16(matches[0].Value),
SecondValue = 79
};
block.BlockItems.Add(blockItemValue);
}
break;
case 2:
if (matches[0].Success && matches[1].Success)
{
var blockItemValue = new SoundBlockItem
{
Value = Convert.ToInt16(matches[0].Value),
SecondValue = Convert.ToInt16(matches[1].Value)
};
block.BlockItems.Add(blockItemValue);
}
break;
}
var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)\s+(\d+)?");
if (match.Success)
{
if (match.Groups.Count == 2)
{
var blockItemValue = new SoundBlockItem
{
Value = match.Groups[1].Value,
SecondValue = 79
};
block.BlockItems.Add(blockItemValue);
}
else if(match.Groups.Count == 3)
{
var blockItemValue = new SoundBlockItem
{
Value = match.Groups[1].Value,
SecondValue = Int16.Parse(match.Groups[2].Value)
};
block.BlockItems.Add(blockItemValue);
}
}
break;
}
}
@@ -373,9 +372,9 @@ namespace Filtration.Parser.Services
{
case "PlayAlertSound":
{
var match = Regex.Match(line, @"\s+(\d+) (\d+)");
var match = Regex.Match(line, @"\s+(\S+) (\d+)");
if (!match.Success) break;
blockItems.Add(new SoundBlockItem(Convert.ToInt16(match.Groups[1].Value), Convert.ToInt16(match.Groups[2].Value)));
blockItems.Add(new SoundBlockItem(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value)));
break;
}
case "SetTextColor":