Skip to content
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
15 changes: 8 additions & 7 deletions src/RealTime/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
- source: 作者原创
- version:1.4.4.9
- introduce:
- The local time will be synchronized every 8 seconds, so there may be a brief mismatch between the server and the local time.
- And the blood moon and solar eclipse will automatically end 20 minutes after they are started, and the frost moon and Halloween will automatically end 40 minutes after they are started.
- Angler quest and moon phases refresh every 24 minutes
- Since NPCs do not spawn at night, the old man and the Lunatic Cultist are detected every 24 minutes. If they do not exist, they are summoned. The summoning location is in the dungeon.
- Random weather function during the day, updated every 24 minutes
- NPC check-in function at night
- When an event occurs, force it to open PVP mode! ! !
- Local time will be synchronized every 8 seconds, so there may be brief moments when the server time does not match the local time.
- Blood Moon and Solar Eclipse will automatically end 20 minutes after starting; Frost Moon and Halloween will automatically end 40 minutes after starting.
- Fisherman quests and moon phases refresh every 24 minutes.
- Since NPCs do not spawn at night, the Elder and the Moon Worship Cultists check every 24 minutes, and if they do not exist, one will be summoned at the dungeon.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): 请澄清并修正有关上古之人和月之崇拜邪教徒那句话的语法问题。

请重新表述这句话,以明确主语并修正语法。例如:"Since NPCs do not spawn at night, the Elder and Moon Worship Cultists are checked every 24 minutes, and if they do not exist, one will be summoned at the dungeon." 请根据实际的游戏行为和术语适当调整措辞。

Suggested change
- Since NPCs do not spawn at night, the Elder and the Moon Worship Cultists check every 24 minutes, and if they do not exist, one will be summoned at the dungeon.
- Since NPCs do not spawn at night, the Elder and the Moon Worship Cultists are checked every 24 minutes, and if they do not exist, one will be summoned at the dungeon.
Original comment in English

issue (typo): Clarify and fix grammar in the sentence about the Elder and Moon Worship Cultists.

Please rephrase this to clarify the subject and fix the grammar. For example: "Since NPCs do not spawn at night, the Elder and Moon Worship Cultists are checked every 24 minutes, and if they do not exist, one will be summoned at the dungeon." Adjust the wording to best match the actual in‑game behavior and terminology.

Suggested change
- Since NPCs do not spawn at night, the Elder and the Moon Worship Cultists check every 24 minutes, and if they do not exist, one will be summoned at the dungeon.
- Since NPCs do not spawn at night, the Elder and the Moon Worship Cultists are checked every 24 minutes, and if they do not exist, one will be summoned at the dungeon.

- Random daytime weather feature updates every 10 minutes.
- Nighttime NPC settlement feature.
- When an event occurs, it forcibly enables PVP mode!!!
- Traveling merchant stays feature, items for sale update every 24 minutes.

## instruction

Expand Down
2 changes: 1 addition & 1 deletion src/RealTime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
```

## 更新日志
### v2.6
### v2.7
-新增旅商常驻功能,优化天气、月相刷新代码
### v2.6
- 新增旅商24分钟更新一次售卖物品
Expand Down
16 changes: 6 additions & 10 deletions src/RealTime/RealTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public class RealTime : TerrariaPlugin
public override string Author => "十七";
public override string Description => GetString("同步现实时间");
public override string Name => System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!;
public override Version Version => new Version(2, 7, 0, 0);
private Hook? unspawnHook;
public override Version Version => new Version(2, 7, 0, 5);
private static readonly Random rand = new Random();
public RealTime(Main game) : base(game)
{
Expand All @@ -24,28 +23,25 @@ public override void Initialize()
ServerApi.Hooks.GameUpdate.Register(this, this.OnGameUpdate);
On.Terraria.Main.UpdateTime += this.NPCS;
GetDataHandlers.PlayerTeam += this.Team;
var method = typeof(WorldGen).GetMethod("UnspawnTravelNPC",
BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

if (method != null)
unspawnHook = new Hook(method, BlockUnspawn);
On.Terraria.WorldGen.UnspawnTravelNPC += this.BlockUnspawn;
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
ServerApi.Hooks.GameUpdate.Deregister(this, this.OnGameUpdate);
On.Terraria.Main.UpdateTime -= this.NPCS;
GetDataHandlers.PlayerTeam -= this.Team;
unspawnHook?.Dispose();
On.Terraria.WorldGen.UnspawnTravelNPC -= this.BlockUnspawn;
}
base.Dispose(disposing);
}
public static void BlockUnspawn(Action orig)//拦截旅商被删除的函数,旅商永久驻留

private void BlockUnspawn(On.Terraria.WorldGen.orig_UnspawnTravelNPC orig)//拦截旅商被删除的函数,旅商永久驻留
{
return;
}

private void Team(object? o, GetDataHandlers.PlayerTeamEventArgs args)//队伍判断
{
if (Main.bloodMoon == true || Main.eclipse == true || Main.pumpkinMoon == true || Main.snowMoon == true)
Expand Down
Loading