Skip to content

Commit 1b496e5

Browse files
committed
Added quest failure text to quest info
1 parent 85ee6df commit 1b496e5

File tree

3 files changed

+75
-4
lines changed

3 files changed

+75
-4
lines changed

RiseQuestEditor/CustomQuest.cs

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public struct QuestInfo_
7878
public string? Client;
7979
public string? Description;
8080
public string? Target;
81+
public string? Fail;
8182

8283
public QuestInfo_(string indentifier)
8384
{
@@ -86,6 +87,7 @@ public QuestInfo_(string indentifier)
8687
Client = "";
8788
Description = "";
8889
Target = "";
90+
Fail = "";
8991
}
9092
}
9193

RiseQuestEditor/MainWindow.xaml

+10-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<CommandBinding Command="e:Command.ApplyShadow" Executed="ApplyTextEditShadow_Click"/>
1919
<CommandBinding Command="e:Command.ApplyGlow" Executed="ApplyTextEditGlow_Click"/>
2020
<CommandBinding Command="e:Command.ApplySize" Executed="ApplyTextEditSize_Click"/>
21+
<CommandBinding Command="e:Command.ApplyColor" Executed="ApplyTextEditColor_Click"/>
2122
</Window.CommandBindings>
2223
<Window.InputBindings>
2324
<KeyBinding Command="New" Key="N" Modifiers="Ctrl"/>
@@ -30,6 +31,7 @@
3031
<KeyBinding Command="e:Command.ApplyShadow" Key="H" Modifiers="Ctrl"/>
3132
<KeyBinding Command="e:Command.ApplyGlow" Key="G" Modifiers="Ctrl"/>
3233
<KeyBinding Command="e:Command.ApplySize" Key="S" Modifiers="Ctrl+Alt"/>
34+
<KeyBinding Command="e:Command.ApplyColor" Key="C" Modifiers="Ctrl+Alt"/>
3335
</Window.InputBindings>
3436
<Grid>
3537
<Grid.Resources>
@@ -80,6 +82,7 @@
8082
<MenuItem Header="_Shadow" Name="ShadowButton" Command="e:Command.ApplyShadow" InputGestureText="Ctrl+H"/>
8183
<MenuItem Header="_Glow" Name="GlowButton" Command="e:Command.ApplyGlow" InputGestureText="Ctrl+G"/>
8284
<MenuItem Header="Si_ze" Name="SizeButton" Command="e:Command.ApplySize" InputGestureText="Ctrl+Alt+S"/>
85+
<MenuItem Header="_Color" Name="ColorButton" Command="e:Command.ApplyColor" InputGestureText="Ctrl+Alt+C"/>
8386
</MenuItem>
8487
</MenuItem>
8588
<MenuItem Header="Help">
@@ -1138,9 +1141,9 @@
11381141
</Grid.RowDefinitions>
11391142

11401143
<ComboBox Grid.Row="0" Name="GameLanguage" Margin="5" SelectionChanged="GameLanguage_SelectionChanged"/>
1141-
<TextBox Grid.Row="1" Name="QuestName" HorizontalContentAlignment="Left" Margin="5" Text=""/>
1142-
<TextBox Grid.Row="2" Name="QuestClient" HorizontalContentAlignment="Left" Margin="5" Text=""/>
1143-
<TextBox Grid.Row="3" Name="QuestDesc" VerticalAlignment="Stretch" Text="">
1144+
<TextBox Grid.Row="1" Name="QuestName" SelectionChanged="QuestInfo_SelectionChanged" HorizontalContentAlignment="Left" Margin="5" Text=""/>
1145+
<TextBox Grid.Row="2" Name="QuestClient" SelectionChanged="QuestInfo_SelectionChanged" HorizontalContentAlignment="Left" Margin="5" Text=""/>
1146+
<TextBox Grid.Row="3" Name="QuestDesc" VerticalAlignment="Stretch" Text="" SelectionChanged="QuestInfo_SelectionChanged">
11441147
<TextBox.HorizontalContentAlignment>Left</TextBox.HorizontalContentAlignment>
11451148
<TextBox.VerticalContentAlignment>Top</TextBox.VerticalContentAlignment>
11461149
<TextBox.Margin>5</TextBox.Margin>
@@ -1150,14 +1153,18 @@
11501153
<TextBox.VerticalScrollBarVisibility>Auto</TextBox.VerticalScrollBarVisibility>
11511154
</TextBox>
11521155
<TextBox Grid.Row="4" Name="QuestTarget" HorizontalContentAlignment="Left" Margin="5" Text=""/>
1156+
<TextBox Grid.Row="5" Name="QuestFail" HorizontalContentAlignment="Left" Margin="5" Text=""/>
11531157
<ComboBox Grid.Row="6" Name="FallbackLanguage" Margin="5"/>
11541158

11551159
<Label Grid.Row="0" Grid.Column="2" Content="Language"/>
11561160
<Label Grid.Row="1" Grid.Column="2" Content="Quest Name"/>
11571161
<Label Grid.Row="2" Grid.Column="2" Content="Quest Client"/>
11581162
<Label Grid.Row="3" Grid.Column="2" Content="Quest Description" VerticalAlignment="Top" Margin="1,5,0,0"/>
11591163
<Label Grid.Row="4" Grid.Column="2" Content="Quest Target"/>
1164+
<Label Grid.Row="5" Grid.Column="2" Content="Quest Failure"/>
11601165
<Label Grid.Row="6" Grid.Column="2" Content="Fallback Language"/>
1166+
1167+
<Rectangle Grid.Row="3" Grid.Column="2" Name="ColorBox" Fill="White" StrokeThickness="1" Stroke="Black" Margin="10,60,0,0" Width="30" Height="30" VerticalAlignment="Top" HorizontalAlignment="Left"/>
11611168
</Grid>
11621169
</TabItem>
11631170
<TabItem Header="Rampage" Name="RampageTab" FontSize="16">

RiseQuestEditor/MainWindow.xaml.cs

+63-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using System.ComponentModel;
1414
using WPFCustomMessageBox;
1515
using System.Collections.Generic;
16+
using System.Windows.Media;
1617
using System.Runtime.InteropServices;
1718

1819
namespace RiseQuestEditor
@@ -467,6 +468,7 @@ private void PopulateEditorFields()
467468
QuestClient.Text = info.Client;
468469
QuestDesc.Text = info.Description;
469470
QuestTarget.Text = info.Target;
471+
QuestFail.Text = info.Fail;
470472
}
471473
}
472474

@@ -680,6 +682,7 @@ private void StoreEditorFields()
680682
info.Client = QuestClient.Text;
681683
info.Description = QuestDesc.Text;
682684
info.Target = QuestTarget.Text;
685+
info.Fail = QuestFail.Text;
683686
text.QuestInfo[i] = info;
684687

685688
break;
@@ -733,7 +736,7 @@ private void StoreEditorFields()
733736
data.SubTargets[3] = (QuestTargetType)(int)RampageSubTarget4.SelectedValue;
734737
data.SubTargets[4] = (QuestTargetType)(int)RampageSubTarget5.SelectedValue;
735738
data.SubTargets[5] = (QuestTargetType)(int)RampageSubTarget6.SelectedValue;
736-
739+
737740

738741
for (int i = 0; i < 3; i++)
739742
{
@@ -987,6 +990,7 @@ private void GameLanguage_SelectionChanged(object sender, SelectionChangedEventA
987990
info.Client = QuestClient.Text;
988991
info.Description = QuestDesc.Text;
989992
info.Target = QuestTarget.Text;
993+
info.Fail = QuestFail.Text;
990994
text.QuestInfo[i] = info;
991995

992996
break;
@@ -1006,6 +1010,7 @@ private void GameLanguage_SelectionChanged(object sender, SelectionChangedEventA
10061010
QuestClient.Text = info.Client;
10071011
QuestDesc.Text = info.Description;
10081012
QuestTarget.Text = info.Target;
1013+
QuestFail.Text = info.Fail;
10091014

10101015
break;
10111016
}
@@ -1019,6 +1024,7 @@ private void GameLanguage_SelectionChanged(object sender, SelectionChangedEventA
10191024
QuestClient.Text = "";
10201025
QuestDesc.Text = "";
10211026
QuestTarget.Text = "";
1027+
QuestFail.Text = "";
10221028
}
10231029

10241030
_selectedLanguage = newIndex;
@@ -1118,6 +1124,62 @@ private void ApplyTextEditSize_Click(object sender, ExecutedRoutedEventArgs e)
11181124
}
11191125
}
11201126
}
1127+
1128+
private void ApplyTextEditColor_Click(object sender, ExecutedRoutedEventArgs e)
1129+
{
1130+
if (_customQuest != null)
1131+
{
1132+
TextBox? textBox = GetSelectedTextBox();
1133+
if (textBox != null)
1134+
{
1135+
1136+
string text = textBox.Text;
1137+
int start = textBox.SelectionStart;
1138+
int end = start + textBox.SelectionLength;
1139+
1140+
textBox.Text = $"{text[..start]}<COLOR 000000>{textBox.SelectedText}</COLOR>{text[end..]}";
1141+
}
1142+
}
1143+
}
1144+
1145+
private void QuestInfo_SelectionChanged(object sender, RoutedEventArgs e)
1146+
{
1147+
bool colorDisplayed = false;
1148+
1149+
if (_customQuest != null)
1150+
{
1151+
Regex regex = new(@"<(COLOR|color) ([0-9a-fA-F]+)>[^<]*</(COLOR|color)>");
1152+
TextBox? textBox = GetSelectedTextBox();
1153+
if (textBox != null)
1154+
{
1155+
Match match = regex.Match(textBox.Text);
1156+
if (match.Success)
1157+
{
1158+
int start = match.Index;
1159+
int end = start + match.Length;
1160+
1161+
if (textBox.SelectionStart >= start && textBox.SelectionStart + textBox.SelectionLength < end)
1162+
{
1163+
int color = int.Parse(match.Groups[2].Value, System.Globalization.NumberStyles.HexNumber);
1164+
1165+
byte r = (byte)((color & 0xFF0000) >> 0x10);
1166+
byte g = (byte)((color & 0x00FF00) >> 0x08);
1167+
byte b = (byte)((color & 0x0000FF) >> 0x00);
1168+
1169+
ColorBox.Visibility = Visibility.Visible;
1170+
ColorBox.Fill = new SolidColorBrush(Color.FromRgb(r, g, b));
1171+
colorDisplayed = true;
1172+
}
1173+
}
1174+
}
1175+
}
1176+
1177+
if (!colorDisplayed)
1178+
{
1179+
ColorBox.Visibility = Visibility.Hidden;
1180+
ColorBox.Fill = Brushes.White;
1181+
}
1182+
}
11211183
}
11221184

11231185
public static class Command

0 commit comments

Comments
 (0)