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
7925d1cd
Commit
7925d1cd
authored
Apr 17, 2022
by
Melledy
Browse files
Initial commit
parents
Changes
354
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerStoreNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.inventory.GenshinItem
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ItemOuterClass.Item
;
import
emu.grasscutter.net.proto.PlayerStoreNotifyOuterClass.PlayerStoreNotify
;
import
emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType
;
public
class
PacketPlayerStoreNotify
extends
GenshinPacket
{
public
PacketPlayerStoreNotify
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
PlayerStoreNotify
);
this
.
buildHeader
(
2
);
PlayerStoreNotify
.
Builder
p
=
PlayerStoreNotify
.
newBuilder
()
.
setStoreType
(
StoreType
.
StorePack
)
.
setWeightLimit
(
GenshinConstants
.
LIMIT_ALL
);
for
(
GenshinItem
item
:
player
.
getInventory
())
{
Item
itemProto
=
item
.
toProto
();
p
.
addItemList
(
itemProto
);
}
this
.
setData
(
p
.
build
());
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerTimeNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PlayerTimeNotifyOuterClass.PlayerTimeNotify
;
public
class
PacketPlayerTimeNotify
extends
GenshinPacket
{
public
PacketPlayerTimeNotify
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
PlayerTimeNotify
);
PlayerTimeNotify
proto
=
PlayerTimeNotify
.
newBuilder
()
.
setIsPaused
(
player
.
isPaused
())
.
setPlayerTime
(
player
.
getClientTime
())
.
setServerTime
(
System
.
currentTimeMillis
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPostEnterSceneRsp.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PostEnterSceneRspOuterClass.PostEnterSceneRsp
;
public
class
PacketPostEnterSceneRsp
extends
GenshinPacket
{
public
PacketPostEnterSceneRsp
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
PostEnterSceneRsp
);
PostEnterSceneRsp
p
=
PostEnterSceneRsp
.
newBuilder
()
.
setEnterSceneToken
(
player
.
getEnterSceneToken
())
.
build
();
this
.
setData
(
p
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPrivateChatNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo
;
import
emu.grasscutter.net.proto.PrivateChatNotifyOuterClass.PrivateChatNotify
;
public
class
PacketPrivateChatNotify
extends
GenshinPacket
{
public
PacketPrivateChatNotify
(
int
senderId
,
int
recvId
,
String
message
)
{
super
(
PacketOpcodes
.
PrivateChatNotify
);
ChatInfo
info
=
ChatInfo
.
newBuilder
()
.
setTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
))
.
setUid
(
senderId
)
.
setToUid
(
recvId
)
.
setText
(
message
)
.
build
();
PrivateChatNotify
proto
=
PrivateChatNotify
.
newBuilder
()
.
setChatInfo
(
info
)
.
build
();
this
.
setData
(
proto
);
}
public
PacketPrivateChatNotify
(
int
senderId
,
int
recvId
,
int
emote
)
{
super
(
PacketOpcodes
.
PrivateChatNotify
);
ChatInfo
info
=
ChatInfo
.
newBuilder
()
.
setTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
))
.
setUid
(
senderId
)
.
setToUid
(
recvId
)
.
setIcon
(
emote
)
.
build
();
PrivateChatNotify
proto
=
PrivateChatNotify
.
newBuilder
()
.
setChatInfo
(
info
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillChangeNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ProudSkillChangeNotifyOuterClass.ProudSkillChangeNotify
;
public
class
PacketProudSkillChangeNotify
extends
GenshinPacket
{
public
PacketProudSkillChangeNotify
(
GenshinAvatar
avatar
)
{
super
(
PacketOpcodes
.
ProudSkillChangeNotify
);
ProudSkillChangeNotify
proto
=
ProudSkillChangeNotify
.
newBuilder
()
.
setAvatarGuid
(
avatar
.
getGuid
())
.
setEntityId
(
avatar
.
getEntityId
())
.
setSkillDepotId
(
avatar
.
getSkillDepotId
())
.
addAllProudSkillList
(
avatar
.
getProudSkillList
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketProudSkillExtraLevelNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ProudSkillExtraLevelNotifyOuterClass.ProudSkillExtraLevelNotify
;
public
class
PacketProudSkillExtraLevelNotify
extends
GenshinPacket
{
public
PacketProudSkillExtraLevelNotify
(
GenshinAvatar
avatar
,
int
talentIndex
)
{
super
(
PacketOpcodes
.
ProudSkillExtraLevelNotify
);
ProudSkillExtraLevelNotify
proto
=
ProudSkillExtraLevelNotify
.
newBuilder
()
.
setAvatarGuid
(
avatar
.
getGuid
())
.
setTalentType
(
3
)
// Talent type = 3
.
setTalentIndex
(
talentIndex
)
.
setExtraLevel
(
3
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPullPrivateChatRsp.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PullPrivateChatRspOuterClass.PullPrivateChatRsp
;
public
class
PacketPullPrivateChatRsp
extends
GenshinPacket
{
public
PacketPullPrivateChatRsp
()
{
super
(
PacketOpcodes
.
PullPrivateChatRsp
);
PullPrivateChatRsp
proto
=
PullPrivateChatRsp
.
newBuilder
().
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPullRecentChatRsp.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.Config.ServerOptions
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo
;
import
emu.grasscutter.net.proto.PullRecentChatRspOuterClass.PullRecentChatRsp
;
import
emu.grasscutter.utils.Utils
;
public
class
PacketPullRecentChatRsp
extends
GenshinPacket
{
public
PacketPullRecentChatRsp
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
PullRecentChatRsp
);
ServerOptions
serverOptions
=
Grasscutter
.
getConfig
().
getServerOptions
();
PullRecentChatRsp
.
Builder
proto
=
PullRecentChatRsp
.
newBuilder
();
if
(
serverOptions
.
WelcomeEmotes
!=
null
&&
serverOptions
.
WelcomeEmotes
.
length
>
0
)
{
ChatInfo
welcomeEmote
=
ChatInfo
.
newBuilder
()
.
setTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
))
.
setUid
(
GenshinConstants
.
SERVER_CONSOLE_UID
)
.
setToUid
(
player
.
getId
())
.
setIcon
(
serverOptions
.
WelcomeEmotes
[
Utils
.
randomRange
(
0
,
serverOptions
.
WelcomeEmotes
.
length
-
1
)])
.
build
();
proto
.
addChatInfo
(
welcomeEmote
);
}
if
(
serverOptions
.
WelcomeMotd
!=
null
&&
serverOptions
.
WelcomeMotd
.
length
()
>
0
)
{
ChatInfo
welcomeMotd
=
ChatInfo
.
newBuilder
()
.
setTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
))
.
setUid
(
GenshinConstants
.
SERVER_CONSOLE_UID
)
.
setToUid
(
player
.
getId
())
.
setText
(
Grasscutter
.
getConfig
().
getServerOptions
().
WelcomeMotd
)
.
build
();
proto
.
addChatInfo
(
welcomeMotd
);
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketReliquaryUpgradeRsp.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
java.util.List
;
import
emu.grasscutter.game.inventory.GenshinItem
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ReliquaryUpgradeRspOuterClass.ReliquaryUpgradeRsp
;
public
class
PacketReliquaryUpgradeRsp
extends
GenshinPacket
{
public
PacketReliquaryUpgradeRsp
(
GenshinItem
relic
,
int
rate
,
int
oldLevel
,
List
<
Integer
>
oldAppendPropIdList
)
{
super
(
PacketOpcodes
.
ReliquaryUpgradeRsp
);
ReliquaryUpgradeRsp
proto
=
ReliquaryUpgradeRsp
.
newBuilder
()
.
setTargetReliquaryGuid
(
relic
.
getGuid
())
.
setOldLevel
(
oldLevel
)
.
setCurLevel
(
relic
.
getLevel
())
.
setPowerUpRate
(
rate
)
.
addAllOldAppendPropList
(
oldAppendPropIdList
)
.
addAllCurAppendPropList
(
relic
.
getAppendPropIdList
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneAreaWeatherNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.World
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneAreaWeatherNotifyOuterClass.SceneAreaWeatherNotify
;
public
class
PacketSceneAreaWeatherNotify
extends
GenshinPacket
{
public
PacketSceneAreaWeatherNotify
(
World
world
,
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
SceneAreaWeatherNotify
);
SceneAreaWeatherNotify
proto
=
SceneAreaWeatherNotify
.
newBuilder
()
.
setWeatherAreaId
(
1
)
.
setClimateType
(
world
.
getClimate
().
getValue
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityAppearNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
java.util.Collection
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.entity.GenshinEntity
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneEntityAppearNotifyOuterClass.SceneEntityAppearNotify
;
import
emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType
;
public
class
PacketSceneEntityAppearNotify
extends
GenshinPacket
{
public
PacketSceneEntityAppearNotify
(
GenshinEntity
entity
)
{
super
(
PacketOpcodes
.
SceneEntityAppearNotify
,
true
);
SceneEntityAppearNotify
.
Builder
proto
=
SceneEntityAppearNotify
.
newBuilder
()
.
setAppearType
(
VisionType
.
VisionBorn
)
.
addEntityList
(
entity
.
toProto
());
this
.
setData
(
proto
.
build
());
}
public
PacketSceneEntityAppearNotify
(
GenshinEntity
entity
,
VisionType
vision
,
int
param
)
{
super
(
PacketOpcodes
.
SceneEntityAppearNotify
,
true
);
SceneEntityAppearNotify
.
Builder
proto
=
SceneEntityAppearNotify
.
newBuilder
()
.
setAppearType
(
vision
)
.
setParam
(
param
)
.
addEntityList
(
entity
.
toProto
());
this
.
setData
(
proto
.
build
());
}
public
PacketSceneEntityAppearNotify
(
GenshinPlayer
player
)
{
this
(
player
.
getTeamManager
().
getCurrentAvatarEntity
());
}
public
PacketSceneEntityAppearNotify
(
Collection
<
GenshinEntity
>
entities
,
VisionType
visionType
)
{
super
(
PacketOpcodes
.
SceneEntityAppearNotify
,
true
);
SceneEntityAppearNotify
.
Builder
proto
=
SceneEntityAppearNotify
.
newBuilder
()
.
setAppearType
(
visionType
);
entities
.
forEach
(
e
->
proto
.
addEntityList
(
e
.
toProto
()));
this
.
setData
(
proto
.
build
());
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDisappearNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.entity.GenshinEntity
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneEntityDisappearNotifyOuterClass.SceneEntityDisappearNotify
;
import
emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType
;
public
class
PacketSceneEntityDisappearNotify
extends
GenshinPacket
{
public
PacketSceneEntityDisappearNotify
(
GenshinEntity
entity
,
VisionType
disappearType
)
{
super
(
PacketOpcodes
.
SceneEntityDisappearNotify
);
SceneEntityDisappearNotify
proto
=
SceneEntityDisappearNotify
.
newBuilder
()
.
setDisappearType
(
disappearType
)
.
addEntityList
(
entity
.
getId
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityMoveNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EntityMoveInfoOuterClass.EntityMoveInfo
;
import
emu.grasscutter.net.proto.SceneEntityMoveNotifyOuterClass.SceneEntityMoveNotify
;
public
class
PacketSceneEntityMoveNotify
extends
GenshinPacket
{
public
PacketSceneEntityMoveNotify
(
EntityMoveInfo
moveInfo
)
{
super
(
PacketOpcodes
.
SceneEntityMoveNotify
,
true
);
SceneEntityMoveNotify
proto
=
SceneEntityMoveNotify
.
newBuilder
()
.
setMotionInfo
(
moveInfo
.
getMotionInfo
())
.
setEntityId
(
moveInfo
.
getEntityId
())
.
setSceneTime
(
moveInfo
.
getSceneTime
())
.
setReliableSeq
(
moveInfo
.
getReliableSeq
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneInitFinishRsp.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneInitFinishRspOuterClass.SceneInitFinishRsp
;
public
class
PacketSceneInitFinishRsp
extends
GenshinPacket
{
public
PacketSceneInitFinishRsp
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
SceneInitFinishRsp
,
11
);
SceneInitFinishRsp
p
=
SceneInitFinishRsp
.
newBuilder
().
setEnterSceneToken
(
player
.
getEnterSceneToken
()).
build
();
this
.
setData
(
p
.
toByteArray
());
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneKickPlayerRsp.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneKickPlayerRspOuterClass.SceneKickPlayerRsp
;
public
class
PacketSceneKickPlayerRsp
extends
GenshinPacket
{
public
PacketSceneKickPlayerRsp
(
int
targetUid
)
{
super
(
PacketOpcodes
.
SceneKickPlayerRsp
);
SceneKickPlayerRsp
proto
=
SceneKickPlayerRsp
.
newBuilder
()
.
setTargetUid
(
targetUid
)
.
build
();
this
.
setData
(
proto
);
}
public
PacketSceneKickPlayerRsp
()
{
super
(
PacketOpcodes
.
SceneKickPlayerRsp
);
SceneKickPlayerRsp
proto
=
SceneKickPlayerRsp
.
newBuilder
()
.
setRetcode
(
1
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerInfoNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.World
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ScenePlayerInfoNotifyOuterClass.ScenePlayerInfoNotify
;
import
emu.grasscutter.net.proto.ScenePlayerInfoOuterClass.ScenePlayerInfo
;
public
class
PacketScenePlayerInfoNotify
extends
GenshinPacket
{
public
PacketScenePlayerInfoNotify
(
World
world
)
{
super
(
PacketOpcodes
.
ScenePlayerInfoNotify
);
ScenePlayerInfoNotify
.
Builder
proto
=
ScenePlayerInfoNotify
.
newBuilder
();
for
(
int
i
=
0
;
i
<
world
.
getPlayers
().
size
();
i
++)
{
GenshinPlayer
p
=
world
.
getPlayers
().
get
(
i
);
ScenePlayerInfo
pInfo
=
ScenePlayerInfo
.
newBuilder
()
.
setUid
(
p
.
getId
())
.
setPeerId
(
p
.
getPeerId
())
.
setName
(
p
.
getNickname
())
.
setSceneId
(
world
.
getSceneId
())
.
setOnlinePlayerInfo
(
p
.
getOnlinePlayerInfo
())
.
build
();
proto
.
addPlayerInfoList
(
pInfo
);
}
this
.
setData
(
proto
.
build
());
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerLocationNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify
;
public
class
PacketScenePlayerLocationNotify
extends
GenshinPacket
{
public
PacketScenePlayerLocationNotify
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
ScenePlayerLocationNotify
);
ScenePlayerLocationNotify
.
Builder
proto
=
ScenePlayerLocationNotify
.
newBuilder
()
.
setSceneId
(
player
.
getSceneId
());
for
(
GenshinPlayer
p
:
player
.
getWorld
().
getPlayers
())
{
proto
.
addPlayerLocList
(
p
.
getPlayerLocationInfo
());
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneTeamUpdateNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo
;
import
emu.grasscutter.net.proto.SceneTeamAvatarOuterClass.SceneTeamAvatar
;
import
emu.grasscutter.net.proto.SceneTeamUpdateNotifyOuterClass.SceneTeamUpdateNotify
;
public
class
PacketSceneTeamUpdateNotify
extends
GenshinPacket
{
public
PacketSceneTeamUpdateNotify
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
SceneTeamUpdateNotify
);
SceneTeamUpdateNotify
.
Builder
proto
=
SceneTeamUpdateNotify
.
newBuilder
()
.
setIsInMp
(
player
.
getWorld
().
isMultiplayer
());
for
(
GenshinPlayer
p
:
player
.
getWorld
().
getPlayers
())
{
for
(
EntityAvatar
entityAvatar
:
p
.
getTeamManager
().
getActiveTeam
())
{
SceneTeamAvatar
.
Builder
avatarProto
=
SceneTeamAvatar
.
newBuilder
()
.
setPlayerId
(
p
.
getId
())
.
setAvatarGuid
(
entityAvatar
.
getAvatar
().
getGuid
())
.
setSceneId
(
p
.
getSceneId
())
.
setEntityId
(
entityAvatar
.
getId
())
.
setSceneEntityInfo
(
entityAvatar
.
toProto
())
.
setWeaponGuid
(
entityAvatar
.
getAvatar
().
getWeapon
().
getGuid
())
.
setWeaponEntityId
(
entityAvatar
.
getWeaponEntityId
())
.
setIsPlayerCurAvatar
(
p
.
getTeamManager
().
getCurrentAvatarEntity
()
==
entityAvatar
)
.
setIsOnScene
(
p
.
getTeamManager
().
getCurrentAvatarEntity
()
==
entityAvatar
)
.
setAvatarAbilityInfo
(
AbilitySyncStateInfo
.
newBuilder
())
.
setWeaponAbilityInfo
(
AbilitySyncStateInfo
.
newBuilder
())
.
setAbilityControlBlock
(
entityAvatar
.
getAbilityControlBlock
());
if
(
player
.
getWorld
().
isMultiplayer
())
{
avatarProto
.
setAvatarInfo
(
entityAvatar
.
getAvatar
().
toProto
());
avatarProto
.
setSceneAvatarInfo
(
entityAvatar
.
getSceneAvatarInfo
());
// why mihoyo...
}
proto
.
addSceneTeamAvatarList
(
avatarProto
);
}
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneTimeNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneTimeNotifyOuterClass.SceneTimeNotify
;
public
class
PacketSceneTimeNotify
extends
GenshinPacket
{
public
PacketSceneTimeNotify
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
SceneTimeNotify
);
SceneTimeNotify
proto
=
SceneTimeNotify
.
newBuilder
()
.
setSceneId
(
player
.
getSceneId
())
.
setSceneTime
(
0
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketServerTimeNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ServerTimeNotifyOuterClass.ServerTimeNotify
;
public
class
PacketServerTimeNotify
extends
GenshinPacket
{
public
PacketServerTimeNotify
()
{
super
(
PacketOpcodes
.
ServerTimeNotify
);
ServerTimeNotify
proto
=
ServerTimeNotify
.
newBuilder
()
.
setServerTime
(
System
.
currentTimeMillis
())
.
build
();
this
.
setData
(
proto
);
}
}
Prev
1
…
12
13
14
15
16
17
18
Next
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