前几天给tr服做转发服务发现又忘记加入服务器的处理过程了, 就顺便记录一下
注: 此文档中的所有包名都按照 TS文档 内的为准
Client 2 Server Server State: ? => 1
1 Connect Request
Terraria238
这样的版本号Server 2 Client Client State: ? => 1
3 player slot
Client 2 Server Stert: Server State: 1 => 2
End: Server State: 2 => 3
4 Player Info
68 Client UUID
16 PlayerHP
42 PlayerMana
50 Update Player Buff
5 Player Slot
6 Request World Data
Server 2 Client Client State: 1 => 2
7 World Info
78 Report Invasion Progress
Client 2 Server Server State: 3 => 4
8? Request Essential Tiles
MessageBuffer
并不会主动发送下一步的包, 而是在 Terraria.Netplay.InnerClientLoop
这个接收客户端信息的地方判断连接的State
, 在从3
变为4
的同时将会开始清理世界, 开始后将State
更改为5
, 作用是等待清理世界(就是加入服务器时显示的那个加载进度). 完成后会将State
更改为6
, 并发送Request Essential Tiles
包请求下一步的连接Server 2 Client Client State: 2 => 3
10 Tile Section
11 Section Tile Frame
21&90 Update Item Drop
22 Update Item Owner
23 NPC Update
27 Projectile Update
49 Complete Connection and Spawn
57 Update Good Evil
103 Moon Lord Countdown
101 Update Shield Strengths
136 Sync Cavern Monster Type
82 NetModules
上述信息发送完成后向客户端发送Complete Connection and Spawn
包允许客户端进入世界, 这也是进行下一步连接所要求的包
之后将会继续发送世界的侵蚀进度(神圣腐化血腥), 又一次世界信息, 月总击杀数, 更新护盾强度?(看起来像是埃特尼亚的东西? 云玩家不太懂), 什么同步洞穴怪物类型?, 最后是旅途模式解锁的东西
Client 2 Server Server State: 6 => 10
12 spawn player
Server 2 Client Client State: 3 => 10
139 Set Counts As Host For Gameplay
74 Angler Quest
129 Finished Connecting To Server
Waiting patiently for you to come home and fuck me! https://bit.ly/3UKFVxa
Feel free to join me on a naked nature walk. http://tiny.cc/gz35vz