feat: add minigame room player service
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
053a95b4fb
commit
31afce6882
@@ -83,6 +83,14 @@ namespace XWorld.Framework.Protocol
|
||||
w.WriteString(p.Name);
|
||||
w.WriteBool(p.IsAI);
|
||||
}
|
||||
w.WriteVarUInt((uint)Players.Count);
|
||||
foreach (var p in Players)
|
||||
{
|
||||
w.WriteVarInt(p.PlayerId);
|
||||
w.WriteVarInt(p.Level);
|
||||
w.WriteVarInt(p.AppearanceType);
|
||||
w.WriteVarInt(p.AvatarId);
|
||||
}
|
||||
return w.ToArray();
|
||||
}
|
||||
|
||||
@@ -105,6 +113,24 @@ namespace XWorld.Framework.Protocol
|
||||
IsAI = r.ReadBool(),
|
||||
});
|
||||
}
|
||||
if (r.HasMore)
|
||||
{
|
||||
uint extendedCount = r.ReadVarUInt();
|
||||
uint count = extendedCount < (uint)m.Players.Count ? extendedCount : (uint)m.Players.Count;
|
||||
for (uint i = 0; i < extendedCount; i++)
|
||||
{
|
||||
int playerId = r.ReadVarInt();
|
||||
int level = r.ReadVarInt();
|
||||
int appearanceType = r.ReadVarInt();
|
||||
int avatarId = r.ReadVarInt();
|
||||
if (i < count && m.Players[(int)i].PlayerId == playerId)
|
||||
{
|
||||
m.Players[(int)i].Level = level;
|
||||
m.Players[(int)i].AppearanceType = appearanceType;
|
||||
m.Players[(int)i].AvatarId = avatarId;
|
||||
}
|
||||
}
|
||||
}
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user