Skip to content

Commit

Permalink
ChaosTool fix
Browse files Browse the repository at this point in the history
- updated ChaosTool for the MaterialDesignThemes migration
- added ThrowScript to chaos
  • Loading branch information
Sichii committed May 20, 2024
1 parent 364e95d commit fecc823
Show file tree
Hide file tree
Showing 21 changed files with 190 additions and 108 deletions.
1 change: 1 addition & 0 deletions Chaos/PersistentIdUInt64.json.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
52 changes: 52 additions & 0 deletions Chaos/Scripting/SkillScripts/ThrowScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Chaos.Common.Definitions;
using Chaos.Extensions.Geometry;
using Chaos.Models.Data;
using Chaos.Models.Panel;
using Chaos.Models.World;
using Chaos.Scripting.SkillScripts.Abstractions;

namespace Chaos.Scripting.SkillScripts;

public class ThrowScript : SkillScriptBase
{
private readonly Animation ThrowAnimation = new()
{
AnimationSpeed = 100,
TargetAnimation = 123
};

/// <inheritdoc />
public ThrowScript(Skill subject)
: base(subject) { }

/// <inheritdoc />
public override void OnUse(ActivationContext context)
{
var throwDirection = context.Source.Direction;
var thrownPoint = context.Source.DirectionalOffset(throwDirection);
var thrownAislings = context.TargetMap.GetEntitiesAtPoint<Aisling>(thrownPoint);
var targetPoint = thrownPoint.DirectionalOffset(throwDirection);

//potential points are the throw point, and the 3 points around it
var potentialTargetPoints = targetPoint.GenerateCardinalPoints()
.WithConsistentDirectionBias(throwDirection)
.SkipLast(1)
.Prepend(targetPoint)
.ToList();

foreach (var aisling in thrownAislings)
{
foreach (var point in potentialTargetPoints)
if (context.SourceMap.IsWalkable(point, CreatureType.Aisling, false))
{
var aislingPoint = Point.From(aisling);
aisling.WarpTo(point);

context.SourceMap.ShowAnimation(ThrowAnimation.GetPointEffectAnimation(aislingPoint));
context.SourceMap.ShowAnimation(ThrowAnimation.GetPointEffectAnimation(point));

break;
}
}
}
}
1 change: 1 addition & 0 deletions Data/Configuration/Access/bonk/password.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
151CB6E025DB67AFAD566C0CC80406E39179551DA952E921DA8D24FB7DDF63A16A128B83690A16CB9A388BA6B782C961952076D672AE982D5D2E645037340AC5
29 changes: 29 additions & 0 deletions Data/Configuration/Templates/Skills/throw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"learningRequirements": {
"itemRequirements": [
{
"amountRequired": 20,
"itemTemplateKey": "apple"
}
],
"requiredGold": 5000,
"requiredStats": {
"con": 1,
"dex": 2,
"int": 1,
"str": 1,
"wis": 1
},
"prerequisiteSkills": [],
"prerequisiteSpells": []
},
"class": "Monk",
"cooldownMs": 15000,
"description": "Throws the target 1 or 2 spaces.",
"level": 10,
"name": "Throw",
"panelSprite": 42,
"scriptKeys": ["throw"],
"scriptVars": {},
"templateKey": "throw"
}
3 changes: 1 addition & 2 deletions Tools/ChaosTool/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
<materialDesign:BundledTheme BaseTheme="Dark"
PrimaryColor="Grey"
SecondaryColor="DeepPurple" />
<ResourceDictionary
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign2.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/Generic.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/MaterialDesignDarkTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Name="AddBtn"
Content="Add"
Margin="10"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="AddButton_Click" />
</Grid>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
HorizontalAlignment="Left"
Margin="10,353,0,0"
VerticalAlignment="Top"
Style="{StaticResource MaterialDesignSwitchAccentToggleButton}"
Style="{StaticResource MaterialDesignSwitchSecondaryToggleButton}"
IsChecked="{Binding Contextual}" />
<TextBox Grid.Column="1"
Name="TextBoxLengthTbox"
Expand Down Expand Up @@ -269,7 +269,7 @@
MaxWidth="20"
Margin="0, 0, -8, 2"
Content="{materialDesign:PackIcon Kind=CloseBold}"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="DeleteDialogOptionBtn_Click" />
<TextBox Grid.Row="1"
MaxLines="1"
Expand All @@ -294,7 +294,7 @@
MaxWidth="20"
MaxHeight="20"
Margin="5"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="AddDialogOptionBtn_Click" />
</Grid>
<Grid Grid.Column="3"
Expand Down Expand Up @@ -344,7 +344,7 @@
MaxWidth="20"
Margin="0, 0, -8, 2"
Content="{materialDesign:PackIcon Kind=CloseBold}"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="DeleteScriptKeyBtn_Click" />
</Grid>
</DataTemplate>
Expand All @@ -358,7 +358,7 @@
MaxWidth="20"
MaxHeight="20"
Margin="5"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="AddScriptKeyBtn_Click" />
</Grid>
<!-- #endregion -->
Expand All @@ -370,7 +370,7 @@
HorizontalAlignment="Right"
Margin="0,0,200,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="DeleteBtn_OnClick" />
<Button Grid.Row="1"
Grid.ColumnSpan="99"
Expand All @@ -379,7 +379,7 @@
HorizontalAlignment="Right"
Margin="0,0,100,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="RevertBtn_Click" />
<Button Grid.Row="1"
Grid.ColumnSpan="99"
Expand All @@ -388,7 +388,7 @@
HorizontalAlignment="Right"
Margin="0,0,10,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="SaveBtn_Click" />
<materialDesign:Snackbar Name="Snackbar"
Grid.RowSpan="99"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
VerticalAlignment="Top"
Margin="10"
Content="Perform Integrity Check"
Style="{StaticResource MaterialDesignFlatAccentBgButton}" />
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}" />

<ScrollViewer Grid.Row="1">
<ItemsControl Name="IntegrityViolationsControl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ private async Task AddViolationAsync(string violation, RoutedEventHandler handle
var button = new Button
{
Content = violation,
Style = Application.Current.Resources["MaterialDesignFlatAccentBgButton"] as Style,
Style = Application.Current.Resources["MaterialDesignFlatSecondaryMidBgButton"] as Style,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@
HorizontalAlignment="Left"
Margin="10,293,0,0"
VerticalAlignment="Top"
Style="{StaticResource MaterialDesignSwitchAccentToggleButton}"
Style="{StaticResource MaterialDesignSwitchSecondaryToggleButton}"
IsChecked="{Binding AccountBound}" />
<TextBox Grid.Column="1"
x:Name="BuyCostTbox"
Expand Down Expand Up @@ -459,7 +459,7 @@
HorizontalAlignment="Left"
Margin="10,533,0,0"
VerticalAlignment="Top"
Style="{StaticResource MaterialDesignSwitchAccentToggleButton}"
Style="{StaticResource MaterialDesignSwitchSecondaryToggleButton}"
IsChecked="{Binding RequiresMaster}" />
<TextBox Grid.Column="2"
x:Name="AtkSpeedPctTbox"
Expand Down Expand Up @@ -635,21 +635,21 @@
HorizontalAlignment="Left"
Margin="10,173,0,0"
VerticalAlignment="Top"
Style="{StaticResource MaterialDesignSwitchAccentToggleButton}"
Style="{StaticResource MaterialDesignSwitchSecondaryToggleButton}"
IsChecked="{Binding IsDyeable}" />
<CheckBox Grid.Column="3"
x:Name="IsModifiableCbox"
HorizontalAlignment="Left"
Margin="10,203,0,0"
VerticalAlignment="Top"
Style="{StaticResource MaterialDesignSwitchAccentToggleButton}"
Style="{StaticResource MaterialDesignSwitchSecondaryToggleButton}"
IsChecked="{Binding IsModifiable}" />
<CheckBox Grid.Column="3"
x:Name="NoTradeCbox"
HorizontalAlignment="Left"
Margin="10,233,0,0"
VerticalAlignment="Top"
Style="{StaticResource MaterialDesignSwitchAccentToggleButton}"
Style="{StaticResource MaterialDesignSwitchSecondaryToggleButton}"
IsChecked="{Binding NoTrade}" />
<TextBox Grid.Column="3"
x:Name="CategoryTbox"
Expand Down Expand Up @@ -724,7 +724,7 @@
MaxWidth="20"
Margin="0, 0, -8, 2"
Content="{materialDesign:PackIcon Kind=CloseBold}"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="DeleteScriptKeyBtn_Click" />
</Grid>
</DataTemplate>
Expand All @@ -738,7 +738,7 @@
MaxWidth="20"
MaxHeight="20"
Margin="5"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="AddScriptKeyBtn_Click" />
</Grid>
<!-- #endregion -->
Expand All @@ -750,7 +750,7 @@
HorizontalAlignment="Right"
Margin="0,0,200,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="DeleteBtn_OnClick" />
<Button Grid.Row="1"
Grid.ColumnSpan="99"
Expand All @@ -759,7 +759,7 @@
HorizontalAlignment="Right"
Margin="0,0,100,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="RevertBtn_Click" />
<Button Grid.Row="1"
Grid.ColumnSpan="99"
Expand All @@ -768,7 +768,7 @@
HorizontalAlignment="Right"
Margin="0,0,10,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="SaveBtn_Click" />
<materialDesign:Snackbar x:Name="Snackbar"
Grid.RowSpan="99"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
MaxWidth="20"
Margin="0, 0, -8, 2"
Content="{materialDesign:PackIcon Kind=CloseBold}"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="DeleteLootDropBtn_Click" />
<TextBox Grid.Row="1"
MaxLines="1"
Expand All @@ -174,7 +174,7 @@
MaxWidth="20"
MaxHeight="20"
Margin="5"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="AddLootDropBtn_Click" />
</Grid>
<!-- #endregion -->
Expand All @@ -186,7 +186,7 @@
HorizontalAlignment="Right"
Margin="0,0,200,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="DeleteBtn_OnClick" />
<Button Grid.Row="1"
Grid.ColumnSpan="99"
Expand All @@ -195,7 +195,7 @@
HorizontalAlignment="Right"
Margin="0,0,100,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="RevertBtn_Click" />
<Button Grid.Row="1"
Grid.ColumnSpan="99"
Expand All @@ -204,7 +204,7 @@
HorizontalAlignment="Right"
Margin="0,0,10,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="SaveBtn_Click" />
<materialDesign:Snackbar Name="Snackbar"
Grid.RowSpan="99"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
MaxWidth="20"
Margin="0, 0, -8, 2"
Content="{materialDesign:PackIcon Kind=CloseBold}"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="DeleteScriptKeyBtn_Click" />
</Grid>
</DataTemplate>
Expand All @@ -136,7 +136,7 @@
MaxWidth="20"
MaxHeight="20"
Margin="5"
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
Style="{StaticResource MaterialDesignFloatingActionMiniSecondaryButton}"
Click="AddScriptKeyBtn_Click" />
</Grid>
<!-- #endregion -->
Expand All @@ -153,15 +153,15 @@
HorizontalAlignment="Right"
Margin="0,0,200,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}" />
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}" />
<Button Grid.Row="1"
Grid.ColumnSpan="99"
Name="RevertBtn"
Content="Revert"
HorizontalAlignment="Right"
Margin="0,0,100,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="RevertBtn_Click" />
<Button Grid.Row="1"
Grid.ColumnSpan="99"
Expand All @@ -170,7 +170,7 @@
HorizontalAlignment="Right"
Margin="0,0,10,10"
VerticalAlignment="Bottom"
Style="{StaticResource MaterialDesignFlatAccentBgButton}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
Click="SaveBtn_Click" />
<materialDesign:Snackbar Name="Snackbar"
Grid.RowSpan="99"
Expand Down
Loading

0 comments on commit fecc823

Please sign in to comment.