diff --git a/ShowUID/ShowUID.cs b/AddUID/AddUID.cs similarity index 94% rename from ShowUID/ShowUID.cs rename to AddUID/AddUID.cs index 088a7fb..20f83b8 100644 --- a/ShowUID/ShowUID.cs +++ b/AddUID/AddUID.cs @@ -1,11 +1,11 @@ using System; using BilibiliDM_PluginFramework; -namespace ShowUID +namespace AddUID { - public class ShowUID : DMPlugin + public class AddUID : DMPlugin { - public ShowUID() + public AddUID() { ReceivedDanmaku += B_ReceivedDanmaku; PluginAuth = "lzblzr"; diff --git a/ShowUID/ShowUID.csproj b/AddUID/AddUID.csproj similarity index 91% rename from ShowUID/ShowUID.csproj rename to AddUID/AddUID.csproj index 449370c..b902cc9 100644 --- a/ShowUID/ShowUID.csproj +++ b/AddUID/AddUID.csproj @@ -7,10 +7,12 @@ {16963E13-5741-4B7E-8295-A4706A0D9542} Library Properties - ShowUID - ShowUID + AddUID + AddUID v4.0 512 + + true @@ -37,7 +39,7 @@ - + diff --git a/ShowUID/Properties/AssemblyInfo.cs b/AddUID/Properties/AssemblyInfo.cs similarity index 90% rename from ShowUID/Properties/AssemblyInfo.cs rename to AddUID/Properties/AssemblyInfo.cs index c9e5c5b..6ed42dd 100644 --- a/ShowUID/Properties/AssemblyInfo.cs +++ b/AddUID/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 -[assembly: AssemblyTitle("ShowUID")] +[assembly: AssemblyTitle("AddUID")] [assembly: AssemblyDescription("在用户名后添加UID")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] @@ -31,5 +31,5 @@ // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.1.0")] +[assembly: AssemblyFileVersion("1.0.1.0")] diff --git a/ShowInfo/Properties/AssemblyInfo.cs b/ShowInfo/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d8f19cc --- /dev/null +++ b/ShowInfo/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("ShowInfo")] +[assembly: AssemblyDescription("显示投喂用户的隐藏信息")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("30d14085-4d54-4a80-b59b-9881ee1dff66")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ShowInfo/ShowInfo.cs b/ShowInfo/ShowInfo.cs new file mode 100644 index 0000000..e5c0f8a --- /dev/null +++ b/ShowInfo/ShowInfo.cs @@ -0,0 +1,98 @@ +using System; +using System.Text.RegularExpressions; +using BilibiliDM_PluginFramework; + +namespace ShowInfo +{ + public class ShowInfo : DMPlugin + { + public ShowInfo() + { + ReceivedDanmaku += B_ReceivedDanmaku; + PluginAuth = "lzblzr"; + PluginName = "用户信息"; + PluginDesc = "显示投喂用户的隐藏信息"; + PluginCont = "lzggzr@gmail.com"; + PluginVer = "v1.0.0"; + } + private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e) + { + if (e.Danmaku.MsgType == MsgTypeEnum.GiftSend) + { + string rawData = e.Danmaku.RawData; + + string defaultLog; + string userLog = defaultLog = e.Danmaku.UserName + " 剩余"; + + Regex gold = new Regex("\"gold\":\"?(\\d+)"); + Match hasGold = gold.Match(rawData); + if (hasGold.Success) + { + string value = hasGold.Groups[1].Value; + if (value != "0") + userLog += String.Format(" {0}金瓜子", value); + } + + Regex silver = new Regex("\"silver\":\"?(\\d+)"); + Match hasSilver = silver.Match(rawData); + if (hasSilver.Success) + { + string value = hasSilver.Groups[1].Value; + if (value != "0") + userLog += String.Format(" {0}银瓜子", value); + } + + Regex package = new Regex("\"eventNum\":\"?(\\d+)"); + Match hasPackage = package.Match(rawData); + if (hasPackage.Success) + { + string value = hasPackage.Groups[1].Value; + if (value != "0") + userLog += String.Format(" {0}{1}", value, e.Danmaku.GiftName); + } + + Regex normalCapsule = new Regex("\"normal\":{ \"coin\":\"?(\\d+)"); + Match hasNormalCapsule = normalCapsule.Match(rawData); + if (hasNormalCapsule.Success) + { + string value = hasNormalCapsule.Groups[1].Value; + if (value != "0") + userLog += String.Format(" {0}普通扭蛋", value); + } + + Regex colorfulCapsule = new Regex("\"colorful\":{ \"coin\":\"?(\\d+)"); + Match hascClorfulCapsule = colorfulCapsule.Match(rawData); + if (hascClorfulCapsule.Success) + { + string value = hascClorfulCapsule.Groups[1].Value; + if (value != "0") + userLog += String.Format(" {0}梦幻扭蛋", value); + } + + if (userLog != defaultLog) + Log(userLog); + } + } + public override void Admin() + { + base.Admin(); + Console.WriteLine("不要点啦, 没用的"); + Log("不要点啦, 没用的"); + AddDM("不要点啦, 没用的", true); + } + public override void Start() + { + base.Start(); + Console.WriteLine("插件已启用"); + Log("插件已启用"); + AddDM("插件已启用", true); + } + public override void Stop() + { + base.Stop(); + Console.WriteLine("插件已禁用"); + Log("插件已禁用"); + AddDM("插件已禁用", true); + } + } +} diff --git a/ShowInfo/ShowInfo.csproj b/ShowInfo/ShowInfo.csproj new file mode 100644 index 0000000..8396dbf --- /dev/null +++ b/ShowInfo/ShowInfo.csproj @@ -0,0 +1,45 @@ + + + + + Debug + AnyCPU + {30D14085-4D54-4A80-B59B-9881EE1DFF66} + Library + Properties + ShowInfo + ShowInfo + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\BilibiliDM_PluginFramework\BilibiliDM_PluginFramework.dll + False + + + + + + + + + + \ No newline at end of file diff --git a/bililive_dm_plugins.sln b/bililive_dm_plugins.sln index 3274e1c..563e2d4 100644 --- a/bililive_dm_plugins.sln +++ b/bililive_dm_plugins.sln @@ -3,10 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26430.13 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowUID", "ShowUID\ShowUID.csproj", "{16963E13-5741-4B7E-8295-A4706A0D9542}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddUID", "AddUID\AddUID.csproj", "{16963E13-5741-4B7E-8295-A4706A0D9542}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoldSilver", "GoldSilver\GoldSilver.csproj", "{1B1AAED6-3040-4E49-AAF5-AE144F7A277B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowInfo", "ShowInfo\ShowInfo.csproj", "{30D14085-4D54-4A80-B59B-9881EE1DFF66}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {1B1AAED6-3040-4E49-AAF5-AE144F7A277B}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B1AAED6-3040-4E49-AAF5-AE144F7A277B}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B1AAED6-3040-4E49-AAF5-AE144F7A277B}.Release|Any CPU.Build.0 = Release|Any CPU + {30D14085-4D54-4A80-B59B-9881EE1DFF66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30D14085-4D54-4A80-B59B-9881EE1DFF66}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30D14085-4D54-4A80-B59B-9881EE1DFF66}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30D14085-4D54-4A80-B59B-9881EE1DFF66}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE