Skip to content
Open
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
78 changes: 78 additions & 0 deletions src/RealTime/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System;
using System.IO;
using Newtonsoft.Json;

namespace RealTime;

public class RealTimeConfig
{
[JsonProperty("同步现实时间")]
public bool EnableRealTimeSync { get; set; } = true;

[JsonProperty("同步间隔秒")]
public int RealTimeSyncInterval { get; set; } = 8;

[JsonProperty("事件自动结束")]
public bool EnableEventAutoEnd { get; set; } = true;

[JsonProperty("血月日食持续时间分钟")]
public int BloodMoonEclipseDuration { get; set; } = 20;

[JsonProperty("霜月万圣节持续时间分钟")]
public int PumpkinMoonSnowMoonDuration { get; set; } = 40;

[JsonProperty("渔夫任务刷新")]
public bool EnableAnglerQuest { get; set; } = true;

[JsonProperty("月相刷新")]
public bool EnableMoonPhase { get; set; } = true;

[JsonProperty("NPC综合刷新间隔分钟")]
public int NpcRefreshInterval { get; set; } = 24;

[JsonProperty("老人自动召唤")]
public bool EnableOldManSpawn { get; set; } = true;

[JsonProperty("拜月教徒自动召唤")]
public bool EnableCultistSpawn { get; set; } = true;

[JsonProperty("旅商商品刷新")]
public bool EnableTravelShopRefresh { get; set; } = true;

[JsonProperty("旅商常驻")]
public bool EnableTravelNPCStay { get; set; } = true;

[JsonProperty("随机天气")]
public bool EnableWeatherChange { get; set; } = true;

[JsonProperty("天气更新间隔分钟")]
public int WeatherChangeInterval { get; set; } = 10;

[JsonProperty("夜间NPC入住")]
public bool EnableNightNpcSpawn { get; set; } = true;

[JsonProperty("事件强制PVP")]
public bool EnableEventForcePvp { get; set; } = true;

[JsonProperty("事件禁止切换队伍")]
public bool EnableEventTeamLock { get; set; } = true;

public static RealTimeConfig Load(string path)
{
if (!File.Exists(path))
{
var cfg = new RealTimeConfig();
cfg.Save(path);
return cfg;
}
var json = File.ReadAllText(path);
var config = JsonConvert.DeserializeObject<RealTimeConfig>(json);
return config ?? new RealTimeConfig();
}

public void Save(string path)
{
var json = JsonConvert.SerializeObject(this, Formatting.Indented);
File.WriteAllText(path, json);
}
}
63 changes: 40 additions & 23 deletions src/RealTime/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,65 @@
# RealTime 现实时间

- 作者: 十七
- 出处: 作者原创
- 版本:1.4.4.9
- 介绍:
- 会同步本地时间,每8秒同步一次,所以服务器内可能会有短暂的和本地时间不匹配的情况
- 并且血月和日食开启20分钟后自动结束,霜月、万圣节开启后40分钟自动结束
- 渔夫任务和月相每24分钟刷新一次
- 由于夜晚不生成npc,所以老人和拜月教邪教徒每24分钟检测一次,如果不存在就召唤一个,召唤位置在地牢。
- 白天随机天气功能,24分钟更新一次
- 夜间npc入住功能
- 事件发生时,使其强制开启PVP模式!!!
# RealTime 同步真实时间

- 作者: 十七、星梦优化
- 同步现实时间到游戏内时间,支持事件自动结束、NPC自动召唤、随机天气等功能

## 指令

```
暂无
```
| 语法 | 权限 | 说明 |
|-----|:----:|------|
| /reload | tshock.cfg.reload | 重载插件配置 |
| /rte | realtime.admin | 查看当前所有配置 |
| /rte <序列号> <值> | realtime.admin | 修改指定配置项 |

## 配置
> 配置文件路径:tshock/realtime.json

```json
暂无
```json5
{
"同步现实时间": true, // 是否同步现实时间到游戏内
"同步间隔秒": 8, // 同步间隔(秒)
"事件自动结束": true, // 是否自动结束事件
"血月日食持续时间分钟": 20, // 血月/日食持续时间(分钟)
"霜月万圣节持续时间分钟": 40, // 霜月/万圣节持续时间(分钟)
"渔夫任务刷新": true, // 是否自动刷新渔夫任务
"月相刷新": true, // 是否自动推进月相
"NPC综合刷新间隔分钟": 24, // NPC刷新间隔(分钟)
"老人自动召唤": true, // 是否自动召唤老人
"拜月教徒自动召唤": true, // 是否自动召唤拜月教徒
"旅商商品刷新": true, // 是否刷新旅商商品
"旅商常驻": true, // 是否阻止旅商离开
"随机天气": true, // 是否启用随机天气
"天气更新间隔分钟": 10, // 天气更新间隔(分钟)
"夜间NPC入住": true, // 是否允许夜间NPC入住
"事件强制PVP": true, // 事件期间是否强制PVP
"事件禁止切换队伍": true // 事件期间是否禁止切换队伍
}
```

## 更新日志

### v2.8.0
- 新增 `/rte` 在服务器中快速修改配置

### v2.7
- 新增旅商常驻功能
- 优化天气、月相刷新代码

### v2.6
- 新增旅商24分钟更新一次售卖物品

### v2.5
- 修复强制pvp可以切换队伍的bug
- 修复强制PVP可以切换队伍的bug

### v2.4
- 更改事件发生时,使其强制开启PVP模式

### v2.3
- 新增白天随机天气功能,15分钟更新一次
- 新增白天随机天气功能

### v2.2
- 新增夜间npc入住功能

- 新增夜间NPC入住功能

## 反馈
- 优先发issued -> 共同维护的插件库:https://github.com/UnrealMultiple/TShockPlugin
- 次优先:TShock官方群:816771079
- 大概率看不到但是也可以:国内社区trhub.cn ,bbstr.net , tr.monika.love
Loading