Skip to content

Commit

Permalink
Merge branch 'Arch-Mina:main' into bugfix/custom-copy-id
Browse files Browse the repository at this point in the history
  • Loading branch information
felipe2g authored Nov 30, 2024
2 parents 096a083 + b698359 commit 558996c
Show file tree
Hide file tree
Showing 11 changed files with 940 additions and 235 deletions.
412 changes: 325 additions & 87 deletions Assets Editor/Appearances.cs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Assets Editor/AssetsEditor.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<Page Update="LegacyDatEditor.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="LogView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="MainWindow.xaml">
<SubType>Designer</SubType>
</Page>
Expand Down
11 changes: 11 additions & 0 deletions Assets Editor/DatEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@
<materialDesign:PackIcon Kind="LayersSearchOutline" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Logger" Click="ShowLogger">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="MathLog" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Header="_About">
<MenuItem Header="About" Click="About_Click">
Expand All @@ -183,6 +188,11 @@
<xctk:IntegerUpDown x:Name="A_FlagId" Margin="30,0,0,0" Width="100" Minimum="1"/>
<Button x:Name="A_FlagIdCheck" Margin="35,0,0,0" Height="20" Content="{materialDesign:PackIcon Check}" ToolTip="Validate Id" PreviewMouseLeftButtonDown="A_FlagIdCheck_PreviewMouseLeftButtonDown"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Height="20">
<CheckBox x:Name="A_FlagTransparency" Content="Transparency" Width="130" Margin="0,0,0,5" Padding="4,0,0,0"/>
<Label Content="Level:" Width="100" Padding="0,0,0,0" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<xctk:IntegerUpDown x:Name="A_FlagTransparencyLevel" Margin="0,0,0,0" Width="80" Minimum="0" Maximum="255"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Height="20">
<CheckBox x:Name="A_FlagGround" Content="Ground" Width="130" Margin="0,0,0,5" Padding="4,0,0,0"/>
<Label Content="Speed:" Width="100" Padding="0,0,0,0" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
Expand Down Expand Up @@ -338,6 +348,7 @@
<ComboBoxItem Content="Tibia Coins"/>
<ComboBoxItem Content="Creature Products"/>
<ComboBoxItem Content="Quiver"/>
<ComboBoxItem Content="SoulCores"/>
</ComboBox>
</StackPanel>
<StackPanel Width="320" Orientation="Horizontal" HorizontalAlignment="Left" Height="20">
Expand Down
612 changes: 480 additions & 132 deletions Assets Editor/DatEditor.xaml.cs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Assets Editor/LegacyAppearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ public static bool WriteLegacyDat(string fn, uint signature, Appearances appeara

public static void WriteAppearance1098(BinaryWriter w, Appearance item)
{
if (item.Flags == null)
{
item.Flags = new();
MainWindow.Log("Export to 1098: missing flags for client id " + item.Id);
}

if (item.Flags.Bank != null)
{
w.Write((byte)AppearanceFlag1098.Ground);
Expand Down
6 changes: 6 additions & 0 deletions Assets Editor/LegacyDatEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@
<materialDesign:PackIcon Kind="LayersSearchOutline" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Logger" Click="ShowLogger">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="MathLog" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Header="_About">
<MenuItem Header="About" Click="About_Click">
Expand Down Expand Up @@ -298,6 +303,7 @@
<ComboBoxItem Content="Tibia Coins"/>
<ComboBoxItem Content="Creature Products"/>
<ComboBoxItem Content="Quiver"/>
<ComboBoxItem Content="SoulCores"/>
</ComboBox>
</StackPanel>
<StackPanel Width="320" Orientation="Horizontal" HorizontalAlignment="Left" Height="20">
Expand Down
5 changes: 5 additions & 0 deletions Assets Editor/LegacyDatEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,11 @@ private void About_Click(object sender, RoutedEventArgs e)
aboutWindow.Show();
}

private void ShowLogger(object sender, RoutedEventArgs e)
{
MainWindow.logView.Show();
}

}
public class ArithmeticConverter : IValueConverter
{
Expand Down
20 changes: 20 additions & 0 deletions Assets Editor/LogView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Window x:Class="Assets_Editor.LogView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Assets_Editor"
mc:Ignorable="d"
Title="LogView" Height="450" Width="800">
<Grid>
<ListView Name="LogListView">
<ListView.View>
<GridView>
<GridViewColumn Header="Time" DisplayMemberBinding="{Binding Timestamp}"/>
<GridViewColumn Header="Level" DisplayMemberBinding="{Binding Level}"/>
<GridViewColumn Header="Message" DisplayMemberBinding="{Binding Message}"/>
</GridView>
</ListView.View>
</ListView>
</Grid>
</Window>
45 changes: 45 additions & 0 deletions Assets Editor/LogView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Assets_Editor
{
/// <summary>
/// Interaction logic for LogView.xaml
/// </summary>
public partial class LogView : Window
{
public class LogEntry
{
public DateTime Timestamp { get; set; }
public string Level { get; set; }
public string Message { get; set; }
}
public ObservableCollection<LogEntry> LogEntries { get; } = new ObservableCollection<LogEntry>();
public LogView()
{
InitializeComponent();
LogListView.ItemsSource = LogEntries;
}
public void AddLogEntry(LogEntry entry)
{
if (!Dispatcher.CheckAccess())
{
Dispatcher.Invoke(() => AddLogEntry(entry));
return;
}
LogEntries.Add(entry);
}
}
}
17 changes: 17 additions & 0 deletions Assets Editor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Collections.Concurrent;
using System.ComponentModel;
using System.Diagnostics;
using static Assets_Editor.LogView;

namespace Assets_Editor
{
Expand All @@ -34,13 +35,19 @@ public partial class MainWindow : Window
public static Dictionary<uint, Sprite> sprites = new Dictionary<uint, Sprite>();
public static SpriteStorage MainSprStorage;
readonly BackgroundWorker worker = new BackgroundWorker();
public static LogView logView = new LogView();
public MainWindow()
{
InitializeComponent();
worker.WorkerReportsProgress = true;
worker.ProgressChanged += Worker_ProgressChanged;
worker.DoWork += Worker_DoWork;
worker.RunWorkerCompleted += Worker_Completed;
logView.Closing += (sender, e) =>
{
e.Cancel = true;
logView.Hide();
};
}

public class Catalog
Expand Down Expand Up @@ -305,5 +312,15 @@ public static MemoryStream getSpriteStream(int spriteId)
}
return SprLists[spriteId];
}
public static void Log(string message, string level = "Info")
{
var entry = new LogEntry
{
Timestamp = DateTime.Now,
Level = level,
Message = message
};
logView.AddLogEntry(entry);
}
}
}
38 changes: 22 additions & 16 deletions Assets Editor/appearances.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ message SpriteAnimation {
optional ANIMATION_LOOP_TYPE loop_type = 4;
optional uint32 loop_count = 5;
repeated SpritePhase sprite_phase = 6;
optional ANIMATION_ANIMATION_MODE animation_mode = 7;
optional ANIMATION_ANIMATION_MODE animation_mode = 7;
}

message Box {
Expand All @@ -42,13 +42,13 @@ message SpriteInfo {
optional SpriteAnimation animation = 6;
optional bool is_opaque = 8;
repeated Box bounding_box_per_direction = 9;
optional uint32 pattern_size = 10;
optional uint32 pattern_layers = 11;
optional uint32 pattern_size = 10;
optional uint32 pattern_layers = 11;
optional uint32 pattern_x = 12;
optional uint32 pattern_y = 13;
optional uint32 pattern_z = 14;
optional uint32 pattern_frames = 15;
optional bool is_animation = 16;
optional uint32 pattern_frames = 15;
optional bool is_animation = 16;
}

message FrameGroup {
Expand All @@ -63,8 +63,8 @@ message Appearance {
optional AppearanceFlags flags = 3;
optional string name = 4;
optional string description = 5;
optional APPEARANCE_TYPE appearance_type = 6;
repeated bytes sprite_data = 7;
optional APPEARANCE_TYPE appearance_type = 6;
repeated bytes sprite_data = 7;
}

message AppearanceFlags {
Expand Down Expand Up @@ -125,9 +125,10 @@ message AppearanceFlags {
optional bool expire = 55;
optional bool expirestop = 56;
optional bool deco_item_kit = 57;
optional bool hook_south = 58;
optional bool hook_east = 59;

reserved 58 to 69;;
optional bool hook_south = 70;
optional bool hook_east = 71;
optional AppearanceFlagTransparencyLevel transparencylevel = 72;
}

message AppearanceFlagBank {
Expand Down Expand Up @@ -170,8 +171,8 @@ message AppearanceFlagMarket {
optional uint32 show_as_object_id = 3;
repeated VOCATION restrict_to_vocation = 5;
optional uint32 minimum_level = 6;
optional string name = 7;
optional VOCATION vocation = 8;
optional string name = 7;
optional VOCATION vocation = 8;
}

message AppearanceFlagNPC {
Expand Down Expand Up @@ -207,6 +208,10 @@ message AppearanceFlagUpgradeClassification {
optional uint32 upgrade_classification = 1;
}

message AppearanceFlagTransparencyLevel {
optional uint32 level = 1;
}

message SpecialMeaningAppearanceIds {
optional uint32 gold_coin_id = 1;
optional uint32 platinum_coin_id = 2;
Expand Down Expand Up @@ -263,11 +268,12 @@ enum ITEM_CATEGORY {
ITEM_CATEGORY_TIBIA_COINS = 23;
ITEM_CATEGORY_CREATURE_PRODUCTS = 24;
ITEM_CATEGORY_QUIVER = 25;
ITEM_CATEGORY_TWOHANDWEAPON = 26;
ITEM_CATEGORY_HELMETS = 27;
ITEM_CATEGORY_BACKPACK = 28;
ITEM_CATEGORY_ONEHANDWEAPON = 29;
ITEM_CATEGORY_TWOHANDWEAPON = 26;
ITEM_CATEGORY_HELMETS = 27;
ITEM_CATEGORY_BACKPACK = 28;
ITEM_CATEGORY_ONEHANDWEAPON = 29;
ITEM_CATEGORY_ARROW = 30;
ITEM_CATEGORY_SOULCORES = 31;
}

enum VOCATION {
Expand Down

0 comments on commit 558996c

Please sign in to comment.