Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新:宵禁 v2.7.3 #270

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using TShockAPI;
using Microsoft.Xna.Framework;

namespace DisableMonsCoin
namespace DisableMonsLoot
{
public class Commands
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using TShockAPI;

namespace DisableMonsCoin
namespace DisableMonsLoot
{
internal class Configuration
{
Expand Down
6 changes: 3 additions & 3 deletions DisableMonsCoin/Plugin.cs → DisableMonsLoot/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
using TerrariaApi.Server;
using TShockAPI;
using TShockAPI.Hooks;
using static DisableMonsCoin.Configuration;
using static DisableMonsCoin.Commands;
using static DisableMonsLoot.Configuration;
using static DisableMonsLoot.Commands;


namespace DisableMonsCoin;
namespace DisableMonsLoot;

[ApiVersion(2, 1)]
public class Plugin : TerrariaPlugin
Expand Down
2 changes: 1 addition & 1 deletion DisableMonsCoin/README.md → DisableMonsLoot/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DisableMonsCoin 禁怪物掉落
# DisableMonsLoot 禁怪物掉落

- 作者: 羽学
- 出处: [github](https://gitee.com/Crafty/bean-points)
Expand Down
13 changes: 13 additions & 0 deletions GoodNight/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;
using Terraria;
using TShockAPI;
using static Org.BouncyCastle.Math.EC.ECCurve;

namespace Goodnight
{
Expand Down Expand Up @@ -84,6 +85,17 @@ public static void GnCmd(CommandArgs args)
}
#endregion

#region 清理允许召唤表
if (args.Parameters.Count == 1 && args.Parameters[0].ToLower() == "clear")
{
Goodnight.Config.NpcDead.Clear();
Goodnight.KillCounters.Clear();
args.Player.SendSuccessMessage($"已清理《允许召唤表》的怪物ID");
Goodnight.Config.Write();
return;
}
#endregion

#region 修改禁止怪物ID + 修改解禁怪物在线人数
if (args.Parameters.Count == 2)
{
Expand Down Expand Up @@ -258,6 +270,7 @@ private static void HelpCmd(TSPlayer player)
"/gn kick —— 开启|关闭断连功能\n" +
"/gn pos —— 开启|关闭召唤区\n" +
"/gn all —— 开启|关闭召唤区需所有人在场\n" +
"/gn clear —— 清理《允许召唤表》\n" +
"/gn boss 次数 —— 设置加入《允许召唤表》击杀要求次数\n" +
"/gn reset ID —— 设置重置《允许召唤表》的怪物ID\n" +
"/gn plr 人数 —— 设置无视《禁止怪物表》在线人数\n" +
Expand Down
19 changes: 10 additions & 9 deletions GoodNight/Goodnight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Goodnight : TerrariaPlugin
#region 变量与插件信息
public override string Name => "宵禁";
public override string Author => "Jonesn 羽学 少司命";
public override Version Version => new Version(2, 7, 2);
public override Version Version => new Version(2, 7, 3);
public override string Description => "设置服务器无法进入或禁止生成怪物的时段";
internal static Configuration Config;
#endregion
Expand Down Expand Up @@ -116,7 +116,7 @@ private void OnSpawn(NpcSpawnEventArgs args)
{
if (BcstSwitchOFF || (BcstDefault && BcstSwitch))
TShock.Utils.Broadcast(
$"【宵禁】当前[c/338AE1:服务器]存在 [c/FF3A4B:{PlayerCount}/{Config.MaxPlayers}]个玩家! \n" +
$"【宵禁】当前[c/338AE1:服务器]存在 [c/FF3A4B:{PlayerCount}]/{Config.MaxPlayers}个玩家! \n" +
$"检测到{RegionInfo}已在【[c/E2FA76:{Config.RegionName}]】\n" +
$"允许召唤以下怪物:\n" +
$"[c/6EABE9:{NpcDeadInfo}]", Color.Aquamarine);
Expand All @@ -125,7 +125,7 @@ private void OnSpawn(NpcSpawnEventArgs args)
{
if (BcstSwitchOFF || (BcstDefault && BcstSwitch))
TShock.Utils.Broadcast(
$"【宵禁】当前[c/338AE1:服务器]存在 [c/FF3A4B:{PlayerCount}/{Config.MaxPlayers}]个玩家! \n" +
$"【宵禁】当前[c/338AE1:服务器]存在 [c/FF3A4B:{PlayerCount}]/{Config.MaxPlayers}]个玩家! \n" +
$"允许召唤表为[c/6EABE9:空],请在满足[c/FF3A4B:{Config.MaxPlayers}人]\n" +
$"或[c/338AE1:宵禁时段]外: [c/DF95EC:{Config.Time.Start}] — [c/FF9187:{Config.Time.Stop}]\n" +
$"尽可能击败该怪物([c/FF3A4B:{Config.DeadCount}次])来获取允许召唤权", Color.AntiqueWhite);
Expand Down Expand Up @@ -182,7 +182,7 @@ private void OnSpawn(NpcSpawnEventArgs args)
if (BcstSwitchOFF || (BcstDefault && BcstSwitch))
TShock.Utils.Broadcast(
$"【宵禁】当前服务器处于维护时间\n" +
$"当前在线人数不满足:[c/FF3A4B:{PlayerCount}/{Config.MaxPlayers}人" +
$"当前在线人数不满足:[c/FF3A4B:{PlayerCount}]/{Config.MaxPlayers}人\n" +
$"且处于宵禁时段: [c/DF95EC:{Config.Time.Start}] — [c/FF9187:{Config.Time.Stop}]\n"+
$"仅允许召唤以下怪物:\n" +
$"[c/6EABE9:{NpcDeadInfo}]\n", Color.Aquamarine);
Expand Down Expand Up @@ -280,14 +280,15 @@ private void OnTransform(NpcTransformationEventArgs args)
#endregion

#region 判断杀怪计数到《允许召唤表》方法
private Dictionary<int, int> KillCounters = new Dictionary<int, int>();
internal static Dictionary<int, int> KillCounters = new Dictionary<int, int>();
private void OnNPCKilled(NpcKilledEventArgs args)
{
if (!Config.Enabled || args.npc == null) return;

int KillNpc = args.npc.netID;
string npcName = TShock.Utils.GetNPCById(KillNpc)?.FullName ?? "未知NPC";
var NpcListInfo = string.Join(", ", Config.NpcDead.Select(x => TShock.Utils.GetNPCById(x)?.FullName + $"({x})"));

if (Config.Npcs.Contains(KillNpc))
{
if (!KillCounters.ContainsKey(KillNpc))
Expand Down Expand Up @@ -353,10 +354,10 @@ private static bool InRegion2()
{
foreach (var plr in TShock.Players)
{
if (plr != null
&& plr.Active
&& plr.CurrentRegion != null
&& plr.CurrentRegion.Name == Config.RegionName)
if (plr != null &&
plr.Active &&
plr.CurrentRegion != null &&
plr.CurrentRegion.Name == Config.RegionName)
return true;
}
return false;
Expand Down
5 changes: 5 additions & 0 deletions GoodNight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
## 更新日志

```
v2.7.3
修正一些广播格式
加入了清理《允许召唤表》的指令(/gn clear)

v2.7.2
修复检测到没有配置文件时,创建的配置没有参数
不会因为使用/reload重复写入或覆盖原来参数等问题
Expand Down Expand Up @@ -92,6 +96,7 @@ v2.0.0
| /gn kick | 无 | goodnight.admin | 开启或关闭断连功能 |
| /gn pos | 无 | goodnight.admin | 开启或关闭召唤区 |
| /gn all | 无 | goodnight.admin | 开启或关闭召唤区需所有人在场 |
| /gn clear | 无 | goodnight.admin | 清理《允许召唤表》的怪物ID |
| /gn boss 次数 | 无 | goodnight.admin | 设置加入《允许召唤表》击杀要求次数 |
| /gn reset 怪物ID | 无 | goodnight.admin | 设置重置《允许召唤表》的怪物ID |
| /gn plr 人数 | 无 | goodnight.admin | 设置无视《禁止怪物表》在线人数 |
Expand Down
20 changes: 10 additions & 10 deletions Plugin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CGive", "CGive\CGive.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisableGodMod", "DisableGodMod\DisableGodMod.csproj", "{5C7C65FD-E104-4BDA-B7E5-4FC1BF0D2F16}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisableMonsCoin", "DisableMonsCoin\DisableMonsCoin.csproj", "{C8B631CB-F176-4921-B313-6E49A4AAC3AC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisableSurfaceProjectiles", "DisableSurfaceProjectiles\DisableSurfaceProjectiles.csproj", "{CD5A7945-D416-4DEE-8079-DF0B9B3652ED}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NormalDropsBags", "NormalDropsBags\NormalDropsBags.csproj", "{D169A104-9372-4DB4-AF39-B511087885A0}"
Expand Down Expand Up @@ -190,6 +188,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpclPerm", "SpclPerm\SpclPe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonsterRegen", "MonsterRegen\MonsterRegen.csproj", "{9C2892C6-0F71-443D-9DF8-6FBF3BDCBE9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisableMonsLoot", "DisableMonsLoot\DisableMonsLoot.csproj", "{98A03E00-1A75-426C-8172-3C954130EEA1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -342,14 +342,6 @@ Global
{5C7C65FD-E104-4BDA-B7E5-4FC1BF0D2F16}.Release|Any CPU.Build.0 = Release|Any CPU
{5C7C65FD-E104-4BDA-B7E5-4FC1BF0D2F16}.Release|x64.ActiveCfg = Release|Any CPU
{5C7C65FD-E104-4BDA-B7E5-4FC1BF0D2F16}.Release|x64.Build.0 = Release|Any CPU
{C8B631CB-F176-4921-B313-6E49A4AAC3AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8B631CB-F176-4921-B313-6E49A4AAC3AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8B631CB-F176-4921-B313-6E49A4AAC3AC}.Debug|x64.ActiveCfg = Debug|Any CPU
{C8B631CB-F176-4921-B313-6E49A4AAC3AC}.Debug|x64.Build.0 = Debug|Any CPU
{C8B631CB-F176-4921-B313-6E49A4AAC3AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8B631CB-F176-4921-B313-6E49A4AAC3AC}.Release|Any CPU.Build.0 = Release|Any CPU
{C8B631CB-F176-4921-B313-6E49A4AAC3AC}.Release|x64.ActiveCfg = Release|Any CPU
{C8B631CB-F176-4921-B313-6E49A4AAC3AC}.Release|x64.Build.0 = Release|Any CPU
{CD5A7945-D416-4DEE-8079-DF0B9B3652ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD5A7945-D416-4DEE-8079-DF0B9B3652ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD5A7945-D416-4DEE-8079-DF0B9B3652ED}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -926,6 +918,14 @@ Global
{9C2892C6-0F71-443D-9DF8-6FBF3BDCBE9D}.Release|Any CPU.Build.0 = Release|Any CPU
{9C2892C6-0F71-443D-9DF8-6FBF3BDCBE9D}.Release|x64.ActiveCfg = Release|Any CPU
{9C2892C6-0F71-443D-9DF8-6FBF3BDCBE9D}.Release|x64.Build.0 = Release|Any CPU
{98A03E00-1A75-426C-8172-3C954130EEA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98A03E00-1A75-426C-8172-3C954130EEA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98A03E00-1A75-426C-8172-3C954130EEA1}.Debug|x64.ActiveCfg = Debug|Any CPU
{98A03E00-1A75-426C-8172-3C954130EEA1}.Debug|x64.Build.0 = Debug|Any CPU
{98A03E00-1A75-426C-8172-3C954130EEA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98A03E00-1A75-426C-8172-3C954130EEA1}.Release|Any CPU.Build.0 = Release|Any CPU
{98A03E00-1A75-426C-8172-3C954130EEA1}.Release|x64.ActiveCfg = Release|Any CPU
{98A03E00-1A75-426C-8172-3C954130EEA1}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
| [BridgeBuilder](BridgeBuilder/README.md) | 快速铺桥 | 无 |
| [OnlineGiftPackage](OnlineGiftPackage/README.md) | 在线礼包 | 无 |
| [LifemaxExtra](LifemaxExtra/README.md) | 吃更多生命果/水晶 | 无 |
| [DisableMonsCoin](DisableMonsCoin/README.md) | 禁怪物掉落 | 无 |
| [DisableMonsLoot](DisableMonsLoot/README.md) | 禁怪物掉落 | 无 |
| [PermaBuff](PermaBuff/README.md) | 永久 Buff | 无 |
| [ShortCommand](ShortCommand/README.md) | 简短指令 | 无 |
| [ProgressBag](ProgressBag/README.md) | 进度礼包 | 无 |
Expand Down
Loading