diff --git a/Core/LiveChat/GuardBuyEventArgs.cs b/Core/LiveChat/GuardBuyEventArgs.cs
index c19fb9113..64ae8a531 100644
--- a/Core/LiveChat/GuardBuyEventArgs.cs
+++ b/Core/LiveChat/GuardBuyEventArgs.cs
@@ -8,61 +8,42 @@
namespace Core.LiveChat
{
- public class SendGiftEventArgs : MessageEventArgs
+ public class GuardBuyEventArgs : MessageEventArgs
{
- public long UserId { get; set; }
-
- public string UserName { get; set; }
-
- public int GuardLevel { get; set; }
- public string GiftAction { get; set; }
- ///
- /// 礼物编号
- ///
- public int GiftId { get; set; }
- ///
- /// 礼物类型
- ///
- public int GiftType { get; set; }
- ///
- /// 礼物名称
- ///
- public string GiftName { get; set; }
///
- /// 礼物价值
+ /// 舰长等级:1-总督 2-提督 3-舰长
///
- public float GiftPrice { get; set; }
+ public int GuardLevel { get; set; }
+
+ public string GuardName { get; set; }
- public int TotalCoin { get; set; }
///
- /// 礼物数量
+ /// 花费:单位金瓜子
///
- public int Amount { get; set; }
+ public int Price { get; set; }
- public bool IsGoldGift { get; set; }
+ public long UserId { get; set; }
- public string CoinType { get; set; }
+ public string UserName { get; set; }
- public long Timestamp { get; set; }
+ //public string GiftId { get; set; }
- public string AvatarUrl { get; set; }
+ ///
+ /// 数量
+ ///
+ public int Number { get; set; }
+ public long Timestamp { get; set; }
- internal SendGiftEventArgs(JsonObject obj) : base(obj)
+ internal GuardBuyEventArgs(JsonObject obj) : base(obj)
{
- UserId = (long)obj["data"]["uid"];
- UserName = (string)obj["data"]["uname"];
- TotalCoin = (int)obj["data"]["total_coin"];
- Amount = (int)obj["data"]["num"];
- GiftName = (string)obj["data"]["giftName"];
- GiftId = (int)obj["data"]["giftId"];
- GiftType = (int)obj["data"]["giftType"];
- GiftPrice = (float)obj["data"]["price"];
GuardLevel = (int)obj["data"]["guard_level"];
- GiftAction = (string)obj["data"]["action"];
- CoinType = (string)obj["data"]["coin_type"];
- IsGoldGift = (string)obj["data"]["coin_type"] == "gold";
- Timestamp = (long)obj["data"]["timestamp"];
- AvatarUrl = (string)obj["data"]["face"];
+ UserId = (long)obj["data"]["uid"];
+ UserName = (string)obj["data"]["username"];
+ GuardName = (string)obj["data"]["gift_name"];
+ Price = (int)obj["data"]["price"];
+ Number = (int)obj["data"]["num"];
+ Timestamp = (long)obj["data"]["start_time"];
+ //GiftId = obj["data"]["gift_id"].Value();//舰长没有
}
}
}
diff --git a/Core/LiveChat/GuardRenewEventArgs.cs b/Core/LiveChat/GuardRenewEventArgs.cs
new file mode 100644
index 000000000..062e8e9b9
--- /dev/null
+++ b/Core/LiveChat/GuardRenewEventArgs.cs
@@ -0,0 +1,55 @@
+using Core.LogModule;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json.Nodes;
+using System.Threading.Tasks;
+
+namespace Core.LiveChat
+{
+ public class GuardRenewEventArgs : MessageEventArgs
+ {
+ ///
+ /// 舰长等级:1-总督 2-提督 3-舰长
+ ///
+ public int GuardLevel { get; set; }
+
+ public string GuardName { get; set; }
+
+ ///
+ /// 花费:单位金瓜子
+ ///
+ public int Price { get; set; }
+
+ public long UserId { get; set; }
+
+ public string UserName { get; set; }
+
+ ///
+ /// 数量
+ ///
+ public int Number { get; set; }
+ public long Timestamp { get; set; }
+
+ internal GuardRenewEventArgs(JsonObject obj) : base(obj)
+ {
+ try
+ {
+ GuardLevel = (int)obj["data"]["guard_info"]["guard_level"];
+ UserId = (long)obj["data"]["sender_uinfo"]["uid"];
+ UserName = (string)obj["data"]["sender_uinfo"]["base"]["name"];
+ GuardName = (string)obj["data"]["guard_info"]["role_name"];
+ Price = (int)obj["data"]["pay_info"]["price"];
+ Number = (int)obj["data"]["pay_info"]["num"];
+ Timestamp = (long)obj["data"]["guard_info"]["start_time"];
+ }
+ catch (Exception ex)
+ {
+ Log.Warn(nameof(GuardRenewEventArgs), "转换大航海信息发生错误,可能阿B修改了数据结构,请检查数据格式", ex);
+ }
+ //GiftId = obj["data"]["gift_id"].Value();//舰长没有
+ }
+ }
+}
diff --git a/Core/LiveChat/LiveChatListener.cs b/Core/LiveChat/LiveChatListener.cs
index f594e23b9..4d4525ad0 100644
--- a/Core/LiveChat/LiveChatListener.cs
+++ b/Core/LiveChat/LiveChatListener.cs
@@ -503,6 +503,10 @@ private void _parse(string jsonBody)
break;
//续费舰长
case "USER_TOAST_MSG":
+ MessageReceived(this, new GuardRenewEventArgs(obj));
+ break;
+ case "USER_TOAST_MSG_V2":
+ MessageReceived(this, new GuardRenewEventArgs(obj));
break;
//在房间内续费了舰长
case "NOTICE_MSG":
diff --git a/Core/LiveChat/SendGiftEventArgs.cs b/Core/LiveChat/SendGiftEventArgs.cs
index a4af0f570..c19fb9113 100644
--- a/Core/LiveChat/SendGiftEventArgs.cs
+++ b/Core/LiveChat/SendGiftEventArgs.cs
@@ -8,42 +8,61 @@
namespace Core.LiveChat
{
- public class GuardBuyEventArgs : MessageEventArgs
+ public class SendGiftEventArgs : MessageEventArgs
{
- ///
- /// 舰长等级:1-总督 2-提督 3-舰长
- ///
- public int GuardLevel { get; set; }
+ public long UserId { get; set; }
- public string GuardName { get; set; }
+ public string UserName { get; set; }
+ public int GuardLevel { get; set; }
+ public string GiftAction { get; set; }
+ ///
+ /// 礼物编号
+ ///
+ public int GiftId { get; set; }
+ ///
+ /// 礼物类型
+ ///
+ public int GiftType { get; set; }
///
- /// 花费:单位金瓜子
+ /// 礼物名称
///
- public int Price { get; set; }
+ public string GiftName { get; set; }
+ ///
+ /// 礼物价值
+ ///
+ public float GiftPrice { get; set; }
- public int UserId { get; set; }
+ public int TotalCoin { get; set; }
+ ///
+ /// 礼物数量
+ ///
+ public int Amount { get; set; }
- public string UserName { get; set; }
+ public bool IsGoldGift { get; set; }
- //public string GiftId { get; set; }
+ public string CoinType { get; set; }
- ///
- /// 数量
- ///
- public int Number { get; set; }
public long Timestamp { get; set; }
- internal GuardBuyEventArgs(JsonObject obj) : base(obj)
+ public string AvatarUrl { get; set; }
+
+ internal SendGiftEventArgs(JsonObject obj) : base(obj)
{
+ UserId = (long)obj["data"]["uid"];
+ UserName = (string)obj["data"]["uname"];
+ TotalCoin = (int)obj["data"]["total_coin"];
+ Amount = (int)obj["data"]["num"];
+ GiftName = (string)obj["data"]["giftName"];
+ GiftId = (int)obj["data"]["giftId"];
+ GiftType = (int)obj["data"]["giftType"];
+ GiftPrice = (float)obj["data"]["price"];
GuardLevel = (int)obj["data"]["guard_level"];
- UserId = (int)obj["data"]["uid"];
- UserName = (string)obj["data"]["username"];
- GuardName = (string)obj["data"]["gift_name"];
- Price = (int)obj["data"]["price"];
- Number = (int)obj["data"]["num"];
- Timestamp = (long)obj["data"]["start_time"];
- //GiftId = obj["data"]["gift_id"].Value();//舰长没有
+ GiftAction = (string)obj["data"]["action"];
+ CoinType = (string)obj["data"]["coin_type"];
+ IsGoldGift = (string)obj["data"]["coin_type"] == "gold";
+ Timestamp = (long)obj["data"]["timestamp"];
+ AvatarUrl = (string)obj["data"]["face"];
}
}
}
diff --git a/Core/RuntimeObject/Download/Basics.cs b/Core/RuntimeObject/Download/Basics.cs
index 5c81404af..8e2ef1ee2 100644
--- a/Core/RuntimeObject/Download/Basics.cs
+++ b/Core/RuntimeObject/Download/Basics.cs
@@ -466,6 +466,22 @@ public static void LiveChatListener_MessageReceived(object? sender, Core.LiveCha
});
break;
}
+ case GuardRenewEventArgs guardRenewEvent:
+ {
+
+ liveChatListener.DanmuMessage.GuardBuy.Add(new Danmu.GuardBuyInfo()
+ {
+ GuardLevel = guardRenewEvent.GuardLevel,
+ GuradName = guardRenewEvent.GuardName,
+ Number = guardRenewEvent.Number,
+ Price = guardRenewEvent.Price,
+ Time = liveChatListener.TimeStopwatch.ElapsedMilliseconds / 1000.00,
+ Timestamp = guardRenewEvent.Timestamp,
+ UserId = guardRenewEvent.UserId,
+ UserName = guardRenewEvent.UserName
+ });
+ break;
+ }
case SendGiftEventArgs sendGiftEventArgs:
{
liveChatListener.DanmuMessage.Gift.Add(new Danmu.GiftInfo()
diff --git a/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs b/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs
index 4b71618d0..10c459973 100644
--- a/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs
+++ b/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs
@@ -85,6 +85,11 @@ private void LiveChatListener_MessageReceived(object? sender, Core.LiveChat.Mess
msg.Message = $"{GuardBuyEvent.UserName}:购买大航海[{(GuardBuyEvent.GuardLevel == 1 ? "总督" : GuardBuyEvent.GuardLevel == 2 ? "提督" : "舰长")}]一共[{GuardBuyEvent.Number}]个月";
break;
}
+ case GuardRenewEventArgs guardRenewEvent:
+ {
+ msg.Message = $"{guardRenewEvent.UserName}:购买大航海[{(guardRenewEvent.GuardLevel == 1 ? "总督" : guardRenewEvent.GuardLevel == 2 ? "提督" : "舰长")}]一共[{guardRenewEvent.Number}]个月";
+ break;
+ }
case SendGiftEventArgs sendGiftEventArgs:
{
msg.Message = $"{sendGiftEventArgs.UserName}:赠送[{sendGiftEventArgs.GiftName}]礼物[{sendGiftEventArgs.Amount}]个";