Skip to content

Commit f83cfda

Browse files
committed
新增邮件管理:支持发送物品、装备、装扮、宠物蛋、套装装备
1 parent e974c9e commit f83cfda

File tree

157 files changed

+7043
-264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+7043
-264
lines changed

__重新生成.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
FreeSql.Generator -Razor 1 -NameOptions 0,0,0,1 -NameSpace DofGMTool.Models -DB "MySql,data source=192.168.200.131;port=3306;user id=game;password=uu5!^%jg;initial catalog=taiwan_billing;charset=latin1;sslmode=none;max pool size=2" -FileName "{name}.cs"
2+
FreeSql.Generator -Razor 1 -NameOptions 0,0,0,1 -NameSpace DofGMTool.Models -DB "MySql,data source=192.168.200.131;port=3306;user id=game;password=uu5!^%jg;initial catalog=d_taiwan;charset=latin1;sslmode=none;max pool size=2" -FileName "{name}.cs"

src/DofGMTool.Core/DofGMTool.Core.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
15+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1616
</ItemGroup>
1717
</Project>

src/DofGMTool/App.xaml.cs

+20-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Microsoft.Extensions.DependencyInjection;
1111
using Microsoft.Extensions.Hosting;
1212
using Microsoft.UI.Xaml;
13+
using Microsoft.UI.Xaml.Controls;
1314
using MySqlConnector;
1415
using System.Diagnostics;
1516
using Windows.Storage;
@@ -70,6 +71,7 @@ public App()
7071
services.AddSingleton<IInventoryManageService, InventoryManageService>();
7172
services.AddSingleton<IEquipSlotProcessor, EquipSlotProcessor>();
7273
services.AddSingleton<ICharacterManagerService, CharacterManagerService>();
74+
services.AddSingleton<ISendMailService, SendMailService>();
7375
services.AddSingleton<CharacInfo>();// 注册角色信息服务
7476

7577
// Core Services
@@ -93,7 +95,7 @@ public App()
9395
return new FreeSqlBuilder()
9496
.UseConnectionFactory(DataType.MySql, () =>
9597
{
96-
var conn = new MySqlConnection("data source=192.168.200.131;port=3306;user id=game;password=uu5!^%jg;initial catalog=taiwan_cain;sslmode=none;max pool size=50;Charset=latin1;");
98+
var conn = new MySqlConnection("data source=192.168.200.131;port=3306;user id=game;password=uu5!^%jg;initial catalog=taiwan_cain;sslmode=none;max pool size=50;Charset=latin1;ConvertZeroDateTime=True;");
9799
conn.Open();
98100
MySqlCommand cmd = conn.CreateCommand();
99101
cmd.CommandText = "SET Charset latin1;";
@@ -148,10 +150,24 @@ public App()
148150
UnhandledException += App_UnhandledException;
149151
}
150152

151-
private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
153+
/// <summary>
154+
/// 全局异常处理
155+
/// </summary>
156+
/// <param name="sender"></param>
157+
/// <param name="e"></param>
158+
private async void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
152159
{
153-
// TODO: Log and handle exceptions as appropriate.
154-
// https://docs.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.application.unhandledexception.
160+
e.Handled = true;
161+
162+
var dialog = new ContentDialog
163+
{
164+
Title = "Unhandled Exception",
165+
Content = $"An unhandled exception occurred: {e.Exception.Message}",
166+
CloseButtonText = "我知道了",
167+
XamlRoot = MainWindow.Content.XamlRoot
168+
};
169+
170+
await dialog.ShowAsync();
155171
}
156172

157173

src/DofGMTool/Constant/DatabaseNames.cs

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ public static class DBNames
66
public const string TaiwanCain2nd = "taiwan_cain_2nd";
77
public const string TaiwanLogin = "taiwan_login";
88
public const string TaiwanBilling = "taiwan_billing";
9+
public const string D_Taiwan = "d_taiwan";
910
}

src/DofGMTool/Constant/Filter.cs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace DofGMTool.Constant;
2+
public class EquipTypeFilter
3+
{
4+
public string[] Types { get; set; } = [];
5+
public bool IsInclude { get; set; } = true; // true 表示包含,false 表示不包含
6+
}

src/DofGMTool/Contracts/Services/ICharacterManagerService.cs

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using DofGMTool.Constant;
2+
using DofGMTool.Models;
3+
using System.Collections.ObjectModel;
24

35
namespace DofGMTool.Contracts.Services;
46
public interface ICharacterManagerService
@@ -22,5 +24,27 @@ public interface ICharacterManagerService
2224
/// <param name="mid"></param>
2325
/// <param name="payValue"></param>
2426
/// <param name="pay"></param>
25-
void AccountRecharge(int mid, int payValue, Pay pay);
27+
void AccountRecharge( int payValue, Pay pay);
28+
29+
/// <summary>
30+
/// 转职
31+
/// </summary>
32+
/// <param name="characNo"></param>
33+
/// <param name="job"></param>
34+
/// <param name="growType"></param>
35+
void ChangeGrowType(int characNo, int job, int growType);
36+
37+
/// <summary>
38+
/// 获取已穿戴装扮
39+
/// </summary>
40+
/// <param name="characNo"></param>
41+
/// <returns></returns>
42+
ObservableCollection<Equipments> GetAvatar(int characNo);
43+
44+
/// <summary>
45+
/// 获取已佩戴的宠物
46+
/// </summary>
47+
/// <param name="characNo"></param>
48+
/// <returns></returns>
49+
ObservableCollection<Equipments> GetCreature(int characNo);
2650
}

src/DofGMTool/Contracts/Services/IDatabaseService.cs

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using DofGMTool.Models;
22
using FreeSql;
3+
using MySqlConnector;
34
using System.Diagnostics;
45

56
namespace DofGMTool.Contracts.Services;
@@ -12,12 +13,19 @@ public class DatabaseService : IDatabaseService
1213
{
1314
public IFreeSql<MySqlFlag> GetMySqlConnection(string databaseName)
1415
{
15-
string connectionString = $"data source=192.168.200.131;port=3306;user id=game;password=uu5!^%jg;initial catalog={databaseName};sslmode=none;max pool size=2;Charset=latin1;Allow User Variables=True";
16-
IFreeSql<MySqlFlag> fsql = new FreeSqlBuilder().UseConnectionString(DataType.MySql, connectionString)
16+
IFreeSql<MySqlFlag> fsql = new FreeSqlBuilder()
17+
.UseConnectionFactory(DataType.MySql, () =>
18+
{
19+
var conn = new MySqlConnection($"data source=192.168.200.131;port=3306;user id=game;password=uu5!^%jg;initial catalog={databaseName};sslmode=none;max pool size=50;Charset=latin1;ConvertZeroDateTime=True;");
20+
conn.Open();
21+
MySqlCommand cmd = conn.CreateCommand();
22+
cmd.CommandText = "SET Charset latin1;";
23+
cmd.ExecuteNonQuery();
24+
return conn;
25+
})
1726
.UseMonitorCommand(cmd => Debug.WriteLine($"Sql£º{cmd.CommandText}"))
1827
.Build<MySqlFlag>();
1928
return fsql;
2029
}
21-
22-
2330
}
31+

src/DofGMTool/Contracts/Services/IInventoryManageService.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using DofGMTool.Models;
1+
using DofGMTool.Constant;
2+
using DofGMTool.Models;
23
using System.Collections.ObjectModel;
34

45
namespace DofGMTool.Contracts.Services;
@@ -14,5 +15,6 @@ public interface IInventoryManageService
1415
Task<int> DeleteEquipmentData(string guid);
1516

1617
//Task<(ObservableCollection<Equipments> Equipments, int TotalCount)> GetEquipmentDataPaged(int pageNumber, int pageSize);
17-
Task<(ObservableCollection<Equipments> Equipments, int TotalCount)> GetEquipmentDataPaged(int pageNumber, int pageSize, string? itemId = null, string? itemName = null, RarityOption? rarityOption = null);
18+
Task<(ObservableCollection<Equipments> Equipments, int TotalCount)> GetEquipmentDataPaged(int pageNumber, int pageSize, string? itemId = null, string? itemName = null, RarityOption? rarityOption = null, EquipTypeFilter? equipTypeFilter = null);
19+
Task InsertEquipmentPartsets(ObservableCollection<EquipmentPartset> partsets);
1820
}

src/DofGMTool/Contracts/Services/IPvfExtensionsService.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface IPvfExtensionsService
3131
/// 解析消耗品物品
3232
/// </summary>
3333
/// <param name="pvf"></param>
34-
void AnalysisStackables(PvfFile pvf);
34+
Task<ObservableCollection<Equipments>> GetStackables(PvfFile pvf);
3535

3636
/// <summary>
3737
/// 解析职业
@@ -50,4 +50,5 @@ public interface IPvfExtensionsService
5050
/// </summary>
5151
/// <param name="pvf"></param>
5252
void AnalysisQuest(PvfFile pvf);
53+
Task<ObservableCollection<EquipmentPartset>> GetPartsets(PvfFile pvf);
5354
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using DofGMTool.Models;
2+
using System.Collections.ObjectModel;
3+
4+
namespace DofGMTool.Contracts.Services;
5+
public interface ISendMailService
6+
{
7+
void DeletePostal(int id);
8+
9+
Task<ObservableCollection<Equipments>> GetEquipmentExAsync(int partsetIndex, string? partsetName = null);
10+
Task<ObservableCollection<EquipmentPartset>> GetEquipmentPartsetAsync(string query);
11+
Task<ObservableCollection<Equipments>> GetItemsList(MailType type, string? query = null);
12+
ObservableCollection<_Postal> GetPostals();
13+
string? GetRoleNameById(int characNo);
14+
int SendMail(MailType type, MailModel mailModel, ObservableCollection<Equipments>? equipments = null);
15+
}

src/DofGMTool/DofGMTool.csproj

+12-7
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@
4747

4848
<ItemGroup>
4949
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
50-
<PackageReference Include="FreeSql" Version="3.5.104" />
51-
<PackageReference Include="FreeSql.Provider.MySqlConnector" Version="3.5.104" />
52-
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.5.104" />
53-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
54-
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250108002" />
55-
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
50+
<PackageReference Include="FreeSql" Version="3.5.106" />
51+
<PackageReference Include="FreeSql.DbContext" Version="3.5.106" />
52+
<PackageReference Include="FreeSql.Provider.MySqlConnector" Version="3.5.106" />
53+
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.5.106" />
54+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.2" />
55+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250205002" />
56+
<!--<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="3.0.0" />-->
5657
<PackageReference Include="SharpZipLib" Version="1.4.2" />
57-
<PackageReference Include="System.Drawing.Common" Version="9.0.1" />
58+
<PackageReference Include="System.Drawing.Common" Version="9.0.2" />
5859
<PackageReference Include="TraditionalChineseToSimplifiedConverter" Version="1.0.0" />
5960
<PackageReference Include="WinUI.TableView" Version="1.2.2" />
6061
<PackageReference Include="WinUICommunity.Components" Version="7.1.0" />
@@ -127,6 +128,10 @@
127128
<ProjectCapability Include="Msix" />
128129
</ItemGroup>
129130

131+
<ItemGroup>
132+
<Folder Include="Models\Entity\d_taiwan\" />
133+
</ItemGroup>
134+
130135
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
131136
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
132137
</PropertyGroup>

src/DofGMTool/Enums/IncreaseType.cs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace DofGMTool.Enums;
2+
3+
public enum IncreaseType
4+
{
5+
体力 = 1,
6+
精神 = 2,
7+
力量 = 3,
8+
智力 = 4
9+
}

src/DofGMTool/Models/Entity/AutoPunishBlackipInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public partial class AutoPunishBlackipInfo {
2424
[JsonProperty, Column(Name = "apply_flag", DbType = "tinyint(4)")]
2525
public sbyte ApplyFlag { get; set; } = 0;
2626

27-
[JsonProperty, Column(Name = "reg_date", DbType = "datetime", InsertValueSql = "0000-00-00 00:00:00")]
27+
[JsonProperty, Column(Name = "reg_date", DbType = "datetime")]
2828
public DateTime RegDate { get; set; }
2929

3030
}

src/DofGMTool/Models/Entity/CreatureItems.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public partial class CreatureItems
4343
[JsonProperty, Column(Name = "no_charge", DbType = "tinyint(4)")]
4444
public sbyte NoCharge { get; set; } = 0;
4545

46-
[JsonProperty, Column(Name = "reg_date", DbType = "datetime", InsertValueSql = "0000-00-00 00:00:00")]
46+
[JsonProperty, Column(Name = "reg_date", DbType = "datetime")]
4747
public DateTime RegDate { get; set; }
4848

4949
[JsonProperty, Column(Name = "slot")]

src/DofGMTool/Models/Entity/Letter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public partial class Letter
1616
[JsonProperty, Column(Name = "letter_text", IsNullable = false)]
1717
public string LetterText { get; set; }
1818

19-
[JsonProperty, Column(Name = "reg_date", DbType = "datetime", InsertValueSql = "0000-00-00 00:00:00")]
19+
[JsonProperty, Column(Name = "reg_date", DbType = "datetime")]
2020
public DateTime RegDate { get; set; }
2121

2222
[JsonProperty, Column(Name = "send_charac_name", StringLength = 20, IsNullable = false)]
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1-
using FreeSql.DatabaseModel;using System;
2-
using System.Collections;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Reflection;
6-
using System.Threading.Tasks;
1+
using FreeSql.DataAnnotations;
72
using Newtonsoft.Json;
8-
using FreeSql.DataAnnotations;
93

10-
namespace DofGMTool.Models {
4+
namespace DofGMTool.Models;
115

12-
[JsonObject(MemberSerialization.OptIn), Table(Name = "member_captcha_info", DisableSyncStructure = true)]
13-
public partial class MemberCaptchaInfo {
6+
[JsonObject(MemberSerialization.OptIn), Table(Name = "member_captcha_info", DisableSyncStructure = true)]
7+
public partial class MemberCaptchaInfo
8+
{
149

15-
[JsonProperty, Column(Name = "m_id", IsPrimary = true)]
16-
public uint MId { get; set; } = 0;
10+
[JsonProperty, Column(Name = "m_id", IsPrimary = true)]
11+
public uint MId { get; set; } = 0;
1712

18-
[JsonProperty, Column(Name = "cert_time")]
19-
public uint CertTime { get; set; } = 0;
13+
[JsonProperty, Column(Name = "cert_time")]
14+
public uint CertTime { get; set; } = 0;
2015

21-
[JsonProperty, Column(Name = "fail_count")]
22-
public byte FailCount { get; set; } = 0;
23-
24-
}
16+
[JsonProperty, Column(Name = "fail_count")]
17+
public byte FailCount { get; set; } = 0;
2518

2619
}
+21-28
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,34 @@
1-
using FreeSql.DatabaseModel;using System;
2-
using System.Collections;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Reflection;
6-
using System.Threading.Tasks;
1+
using FreeSql.DataAnnotations;
72
using Newtonsoft.Json;
8-
using FreeSql.DataAnnotations;
93

10-
namespace DofGMTool.Models {
4+
namespace DofGMTool.Models;
115

12-
[JsonObject(MemberSerialization.OptIn), Table(Name = "member_join_info", DisableSyncStructure = true)]
13-
public partial class MemberJoinInfo {
6+
[JsonObject(MemberSerialization.OptIn), Table(Name = "member_join_info", DisableSyncStructure = true)]
7+
public partial class d_taiwan_MemberJoinInfo
8+
{
149

15-
[JsonProperty, Column(Name = "m_id", IsPrimary = true)]
16-
public uint MId { get; set; } = 0;
10+
[JsonProperty, Column(Name = "m_id", IsPrimary = true)]
11+
public uint MId { get; set; } = 0;
1712

18-
[JsonProperty, Column(Name = "contry_code")]
19-
public byte ContryCode { get; set; } = 0;
13+
[JsonProperty, Column(Name = "contry_code")]
14+
public byte ContryCode { get; set; } = 0;
2015

21-
[JsonProperty, Column(Name = "error_type")]
22-
public byte ErrorType { get; set; } = 0;
16+
[JsonProperty, Column(Name = "error_type")]
17+
public byte ErrorType { get; set; } = 0;
2318

24-
[JsonProperty, Column(Name = "game_use_history")]
25-
public byte GameUseHistory { get; set; } = 0;
19+
[JsonProperty, Column(Name = "game_use_history")]
20+
public byte GameUseHistory { get; set; } = 0;
2621

27-
[JsonProperty, Column(Name = "ip", StringLength = 15, IsNullable = false)]
28-
public string Ip { get; set; }
22+
[JsonProperty, Column(Name = "ip", StringLength = 15, IsNullable = false)]
23+
public string Ip { get; set; }
2924

30-
[JsonProperty, Column(Name = "login_ip", StringLength = 15, IsNullable = false)]
31-
public string LoginIp { get; set; }
25+
[JsonProperty, Column(Name = "login_ip", StringLength = 15, IsNullable = false)]
26+
public string LoginIp { get; set; }
3227

33-
[JsonProperty, Column(Name = "login_time")]
34-
public int LoginTime { get; set; } = 0;
28+
[JsonProperty, Column(Name = "login_time")]
29+
public int LoginTime { get; set; } = 0;
3530

36-
[JsonProperty, Column(Name = "reg_date")]
37-
public int RegDate { get; set; } = 0;
38-
39-
}
31+
[JsonProperty, Column(Name = "reg_date")]
32+
public int RegDate { get; set; } = 0;
4033

4134
}

0 commit comments

Comments
 (0)