Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
7e6b20de
Commit
7e6b20de
authored
Apr 30, 2022
by
BaiSugar
Committed by
GitHub
Apr 29, 2022
Browse files
Added interface display for multiplayer games (#360)
parent
79165aa4
Changes
3
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java
View file @
7e6b20de
...
...
@@ -83,6 +83,9 @@ public class GiveAllCommand implements CommandHandler {
Avatar
avatar
=
new
Avatar
(
avatarData
);
avatar
.
setLevel
(
90
);
avatar
.
setPromoteLevel
(
6
);
for
(
int
i
=
1
;
i
<=
6
;++
i
){
avatar
.
getTalentIdList
().
add
((
avatar
.
getAvatarId
()-
10000000
)*
10
+
i
);
}
// This will handle stats and talents
avatar
.
recalcStats
();
player
.
addAvatar
(
avatar
);
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetOnlinePlayerListReq.java
0 → 100644
View file @
7e6b20de
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetOnlinePlayerListRsp
;
@Opcodes
(
PacketOpcodes
.
GetOnlinePlayerListReq
)
public
class
HandlerGetOnlinePlayerListReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketGetOnlinePlayerListRsp
(
session
.
getPlayer
()));
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketGetOnlinePlayerListRsp.java
0 → 100644
View file @
7e6b20de
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.GetOnlinePlayerListReqOuterClass
;
import
emu.grasscutter.net.proto.GetOnlinePlayerListRspOuterClass.*
;
import
emu.grasscutter.net.proto.MpSettingTypeOuterClass
;
import
emu.grasscutter.net.proto.OnlinePlayerInfoOuterClass.OnlinePlayerInfo
;
import
emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
public
class
PacketGetOnlinePlayerListRsp
extends
BasePacket
{
public
PacketGetOnlinePlayerListRsp
(
Player
session
){
super
(
PacketOpcodes
.
GetOnlinePlayerListRsp
);
Map
<
Integer
,
Player
>
playersMap
=
Grasscutter
.
getGameServer
().
getPlayers
();
GetOnlinePlayerListRsp
.
Builder
proto
=
GetOnlinePlayerListRsp
.
newBuilder
();
if
(
playersMap
.
size
()
!=
0
){
List
<
OnlinePlayerInfo
>
playerInfoList
=
new
ArrayList
<>();
for
(
Player
player:
playersMap
.
values
()){
ProfilePicture
.
Builder
picture
=
ProfilePicture
.
newBuilder
();
OnlinePlayerInfo
.
Builder
playerInfo
=
OnlinePlayerInfo
.
newBuilder
();
if
(
player
.
getUid
()
==
session
.
getUid
())
continue
;
picture
.
setAvatarId
(
player
.
getProfile
().
getAvatarId
())
.
build
();
System
.
out
.
println
(
player
.
getHeadImage
());
playerInfo
.
setUid
(
player
.
getUid
())
.
setNickname
(
player
.
getNickname
())
.
setPlayerLevel
(
player
.
getLevel
())
.
setMpSettingType
(
MpSettingTypeOuterClass
.
MpSettingType
.
MP_SETTING_ENTER_AFTER_APPLY
)
.
setCurPlayerNumInWorld
(
player
.
getWorld
().
getPlayerCount
())
.
setWorldLevel
(
player
.
getWorldLevel
())
.
setNameCardId
(
player
.
getNameCardId
())
.
setProfilePicture
(
picture
);
if
(!
Objects
.
equals
(
player
.
getSignature
(),
""
)){
playerInfo
.
setSignature
(
player
.
getSignature
());
}
playerInfoList
.
add
(
playerInfo
.
build
());
}
for
(
OnlinePlayerInfo
onlinePlayerInfo
:
playerInfoList
)
{
proto
.
addPlayerInfoList
(
onlinePlayerInfo
).
build
();
}
}
this
.
setData
(
proto
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment