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
b9f7c657
Commit
b9f7c657
authored
Apr 27, 2022
by
Benjamin Elsdon
Browse files
Merge remote-tracking branch 'upstream/development' into dev-mail
parents
eb495807
782618cd
Changes
86
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
b9f7c657
...
...
@@ -103,8 +103,8 @@ public final class DispatchServer {
byte
[]
decoded2
=
Base64
.
getDecoder
().
decode
(
query_cur_region
);
QueryCurrRegionHttpRsp
regionQuery
=
QueryCurrRegionHttpRsp
.
parseFrom
(
decoded2
);
List
<
RegionSimpleInfo
>
servers
=
new
ArrayList
<
RegionSimpleInfo
>();
List
<
String
>
usedNames
=
new
ArrayList
<
String
>();
// List to check for potential naming conflicts
List
<
RegionSimpleInfo
>
servers
=
new
ArrayList
<>();
List
<
String
>
usedNames
=
new
ArrayList
<>();
// List to check for potential naming conflicts
if
(
Grasscutter
.
getConfig
().
RunMode
.
equalsIgnoreCase
(
"HYBRID"
))
{
// Automatically add the game server if in
// hybrid mode
RegionSimpleInfo
server
=
RegionSimpleInfo
.
newBuilder
()
...
...
@@ -126,10 +126,10 @@ public final class DispatchServer {
servers
.
add
(
server
);
RegionInfo
serverRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
.
setIp
((
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
.
isEmpty
()
.
set
Gateserver
Ip
((
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
Ip
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
))
.
setPort
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
!=
0
.
set
Gateserver
Port
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
!=
0
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
Port
)
.
setSecretKey
(
ByteString
...
...
@@ -169,8 +169,8 @@ public final class DispatchServer {
servers
.
add
(
server
);
RegionInfo
serverRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
.
setIp
(
regionInfo
.
Ip
)
.
setPort
(
regionInfo
.
Port
)
.
set
Gateserver
Ip
(
regionInfo
.
Ip
)
.
set
Gateserver
Port
(
regionInfo
.
Port
)
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
.
build
();
...
...
@@ -181,7 +181,7 @@ public final class DispatchServer {
}
QueryRegionListHttpRsp
regionList
=
QueryRegionListHttpRsp
.
newBuilder
()
.
addAll
Servers
(
servers
)
.
addAll
RegionList
(
servers
)
.
setClientSecretKey
(
rl
.
getClientSecretKey
())
.
setClientCustomConfigEncrypted
(
rl
.
getClientCustomConfigEncrypted
())
.
setEnableLoginPc
(
true
)
...
...
@@ -268,7 +268,10 @@ public final class DispatchServer {
Grasscutter
.
getLogger
()
.
info
(
String
.
format
(
"[Dispatch] Client %s request: query_region_list"
,
t
.
getRemoteAddress
()));
responseHTML
(
t
,
regionListBase64
);
// Invoke event.
QueryAllRegionsEvent
event
=
new
QueryAllRegionsEvent
(
regionListBase64
);
event
.
call
();
// Respond with event result.
responseHTML
(
t
,
event
.
getRegionList
());
});
for
(
String
regionName
:
regions
.
keySet
())
{
...
...
src/main/java/emu/grasscutter/server/event/ServerEvent.java
View file @
b9f7c657
...
...
@@ -10,6 +10,10 @@ public abstract class ServerEvent extends Event {
this
.
type
=
type
;
}
public
Type
getServerType
()
{
return
this
.
type
;
}
public
enum
Type
{
DISPATCH
,
GAME
...
...
src/main/java/emu/grasscutter/server/event/game/ServerTickEvent.java
0 → 100644
View file @
b9f7c657
package
emu.grasscutter.server.event.game
;
import
emu.grasscutter.server.event.ServerEvent
;
public
final
class
ServerTickEvent
extends
ServerEvent
{
public
ServerTickEvent
()
{
super
(
Type
.
GAME
);
}
}
src/main/java/emu/grasscutter/server/event/internal/ServerStartEvent.java
0 → 100644
View file @
b9f7c657
package
emu.grasscutter.server.event.internal
;
import
emu.grasscutter.server.event.ServerEvent
;
import
java.time.OffsetDateTime
;
public
final
class
ServerStartEvent
extends
ServerEvent
{
private
final
OffsetDateTime
startTime
;
public
ServerStartEvent
(
Type
type
,
OffsetDateTime
startTime
)
{
super
(
type
);
this
.
startTime
=
startTime
;
}
public
OffsetDateTime
getStartTime
()
{
return
this
.
startTime
;
}
}
src/main/java/emu/grasscutter/server/event/internal/ServerStopEvent.java
0 → 100644
View file @
b9f7c657
package
emu.grasscutter.server.event.internal
;
import
emu.grasscutter.server.event.ServerEvent
;
import
java.time.OffsetDateTime
;
public
final
class
ServerStopEvent
extends
ServerEvent
{
private
final
OffsetDateTime
stopTime
;
public
ServerStopEvent
(
Type
type
,
OffsetDateTime
stopTime
)
{
super
(
type
);
this
.
stopTime
=
stopTime
;
}
public
OffsetDateTime
getStopTime
()
{
return
this
.
stopTime
;
}
}
src/main/java/emu/grasscutter/server/game/GameServer.java
View file @
b9f7c657
package
emu.grasscutter.server.game
;
import
java.net.InetSocketAddress
;
import
java.time.OffsetDateTime
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -20,7 +21,10 @@ import emu.grasscutter.game.shop.ShopManager;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail
;
import
emu.grasscutter.netty.MihoyoKcpServer
;
import
org.greenrobot.eventbus.EventBus
;
import
emu.grasscutter.server.event.ServerEvent
;
import
emu.grasscutter.server.event.game.ServerTickEvent
;
import
emu.grasscutter.server.event.internal.ServerStartEvent
;
import
emu.grasscutter.server.event.internal.ServerStopEvent
;
public
final
class
GameServer
extends
MihoyoKcpServer
{
private
final
InetSocketAddress
address
;
...
...
@@ -36,18 +40,10 @@ public final class GameServer extends MihoyoKcpServer {
private
final
MultiplayerManager
multiplayerManager
;
private
final
DungeonManager
dungeonManager
;
private
final
CommandMap
commandMap
;
public
EventBus
OnGameServerStartFinish
;
public
EventBus
OnGameServerTick
;
public
EventBus
OnGameServerStop
;
public
GameServer
(
InetSocketAddress
address
)
{
super
(
address
);
OnGameServerStartFinish
=
EventBus
.
builder
().
throwSubscriberException
(
true
).
logNoSubscriberMessages
(
false
).
build
();
OnGameServerTick
=
EventBus
.
builder
().
throwSubscriberException
(
true
).
logNoSubscriberMessages
(
false
).
build
();
OnGameServerStop
=
EventBus
.
builder
().
throwSubscriberException
(
true
).
logNoSubscriberMessages
(
false
).
build
();
this
.
setServerInitializer
(
new
GameServerInitializer
(
this
));
this
.
address
=
address
;
this
.
packetHandler
=
new
GameServerPacketHandler
(
PacketHandler
.
class
);
...
...
@@ -178,12 +174,8 @@ public final class GameServer extends MihoyoKcpServer {
world
.
onTick
();
}
for
(
GenshinPlayer
player
:
this
.
getPlayers
().
values
())
{
player
.
onTick
();
}
OnGameServerTick
.
post
(
new
GameServerTickEvent
());
ServerTickEvent
event
=
new
ServerTickEvent
();
event
.
call
();
}
public
void
registerWorld
(
World
world
)
{
...
...
@@ -198,12 +190,11 @@ public final class GameServer extends MihoyoKcpServer {
@Override
public
void
onStartFinish
()
{
Grasscutter
.
getLogger
().
info
(
"Game Server started on port "
+
address
.
getPort
());
OnGameServerStartFinish
.
post
(
new
GameServerStartFinishEvent
());
ServerStartEvent
event
=
new
ServerStartEvent
(
ServerEvent
.
Type
.
GAME
,
OffsetDateTime
.
now
());
event
.
call
();
}
public
void
onServerShutdown
()
{
OnGame
ServerStop
.
post
(
new
GameServerStopEvent
()
);
ServerStop
Event
event
=
new
ServerStopEvent
(
ServerEvent
.
Type
.
GAME
,
OffsetDateTime
.
now
());
event
.
call
(
);
// Kick and save all players
List
<
GenshinPlayer
>
list
=
new
ArrayList
<>(
this
.
getPlayers
().
size
());
...
...
src/main/java/emu/grasscutter/server/game/GameServerPacketHandler.java
View file @
b9f7c657
...
...
@@ -89,7 +89,7 @@ public class GameServerPacketHandler {
// Log unhandled packets
if
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
LOG_PACKETS
)
{
//
Grasscutter.getLogger().info("Unhandled packet (" + opcode + "): " + PacketOpcodesUtil.getOpcodeName(opcode));
Grasscutter
.
getLogger
().
info
(
"Unhandled packet ("
+
opcode
+
"): "
+
emu
.
grasscutter
.
net
.
packet
.
PacketOpcodesUtil
.
getOpcodeName
(
opcode
));
}
}
}
src/main/java/emu/grasscutter/server/game/GameSession.java
View file @
b9f7c657
...
...
@@ -3,11 +3,14 @@ package emu.grasscutter.server.game;
import
java.io.File
;
import
java.net.InetSocketAddress
;
import
java.nio.ByteBuffer
;
import
java.util.HashSet
;
import
java.util.Set
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodesUtil
;
import
emu.grasscutter.netty.MihoyoKcpChannel
;
import
emu.grasscutter.server.event.game.SendPacketEvent
;
...
...
@@ -177,10 +180,20 @@ public class GameSession extends MihoyoKcpChannel {
//Grasscutter.getLogger().info("SEND: " + PacketOpcodesUtil.getOpcodeName(opcode));
//System.out.println(Utils.bytesToHex(genshinPacket.getData()));
}
private
static
final
Set
<
Integer
>
loopPacket
=
Set
.
of
(
PacketOpcodes
.
PingReq
,
PacketOpcodes
.
PingRsp
,
PacketOpcodes
.
WorldPlayerRTTNotify
,
PacketOpcodes
.
UnionCmdNotify
,
PacketOpcodes
.
QueryPathReq
);
private
void
logPacket
(
GenshinPacket
genshinPacket
)
{
Grasscutter
.
getLogger
().
info
(
"SEND: "
+
PacketOpcodesUtil
.
getOpcodeName
(
genshinPacket
.
getOpcode
())
+
" ("
+
genshinPacket
.
getOpcode
()
+
")"
);
System
.
out
.
println
(
Utils
.
bytesToHex
(
genshinPacket
.
getData
()));
if
(!
loopPacket
.
contains
(
genshinPacket
.
getOpcode
()))
{
Grasscutter
.
getLogger
().
info
(
"SEND: "
+
PacketOpcodesUtil
.
getOpcodeName
(
genshinPacket
.
getOpcode
())
+
" ("
+
genshinPacket
.
getOpcode
()
+
")"
);
System
.
out
.
println
(
Utils
.
bytesToHex
(
genshinPacket
.
getData
()));
}
}
@Override
...
...
@@ -226,8 +239,10 @@ public class GameSession extends MihoyoKcpChannel {
// Log packet
if
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
LOG_PACKETS
)
{
Grasscutter
.
getLogger
().
info
(
"RECV: "
+
PacketOpcodesUtil
.
getOpcodeName
(
opcode
)
+
" ("
+
opcode
+
")"
);
System
.
out
.
println
(
Utils
.
bytesToHex
(
payload
));
if
(!
loopPacket
.
contains
(
opcode
))
{
Grasscutter
.
getLogger
().
info
(
"RECV: "
+
PacketOpcodesUtil
.
getOpcodeName
(
opcode
)
+
" ("
+
opcode
+
")"
);
System
.
out
.
println
(
Utils
.
bytesToHex
(
payload
));
}
}
// Handle
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java
View file @
b9f7c657
...
...
@@ -19,12 +19,12 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
for
(
CombatInvokeEntry
entry
:
notif
.
getInvokeListList
())
{
switch
(
entry
.
getArgumentType
())
{
case
C
ombatEvtBeingHit
:
case
C
OMBAT_EVT_BEING_HIT
:
// Handle damage
EvtBeingHitInfo
hitInfo
=
EvtBeingHitInfo
.
parseFrom
(
entry
.
getCombatData
());
session
.
getPlayer
().
getScene
().
handleAttack
(
hitInfo
.
getAttackResult
());
break
;
case
E
ntityMove
:
case
E
NTITY_MOVE
:
// Handle movement
EntityMoveInfo
moveInfo
=
EntityMoveInfo
.
parseFrom
(
entry
.
getCombatData
());
GenshinEntity
entity
=
session
.
getPlayer
().
getScene
().
getEntityById
(
moveInfo
.
getEntityId
());
...
...
src/main/java/emu/grasscutter/server/packet/recv/Handle
Sit
Req.java
→
src/main/java/emu/grasscutter/server/packet/recv/Handle
rCombine
Req.java
View file @
b9f7c657
...
...
@@ -3,22 +3,18 @@ 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.net.proto.
Sit
ReqOuterClass
;
import
emu.grasscutter.net.proto.
Combine
ReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSitRsp
;
import
emu.grasscutter.utils.Position
;
@Opcodes
(
PacketOpcodes
.
SitReq
)
public
class
HandleSitReq
extends
PacketHandler
{
@Opcodes
(
PacketOpcodes
.
CombineReq
)
public
class
HandlerCombineReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SitReqOuterClass
.
SitReq
req
=
SitReqOuterClass
.
SitReq
.
parseFrom
(
payload
);
float
x
=
req
.
getPosition
().
getX
();
float
y
=
req
.
getPosition
().
getY
();
float
z
=
req
.
getPosition
().
getZ
();
CombineReqOuterClass
.
CombineReq
req
=
CombineReqOuterClass
.
CombineReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketSitRsp
(
req
.
getChairId
(),
new
Position
(
x
,
y
,
z
),
session
.
getPlayer
().
getTeamManager
().
getCurrentAvatarEntity
().
getId
()));
}
}
\ No newline at end of file
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java
View file @
b9f7c657
...
...
@@ -32,7 +32,7 @@ public class HandlerMarkMapReq extends PacketHandler {
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
MarkMapReq
req
=
MarkMapReq
.
parseFrom
(
payload
);
if
(
req
.
getOp
()
!=
Operation
.
A
dd
)
{
if
(
req
.
getOp
()
!=
MarkMapReq
.
Operation
.
A
DD
)
{
return
;
}
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerGetForceQuitBanInfoReq.java
View file @
b9f7c657
...
...
@@ -3,6 +3,7 @@ package emu.grasscutter.server.packet.recv;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPlayerGetForceQuitBanInfoRsp
;
...
...
@@ -14,10 +15,10 @@ public class HandlerPlayerGetForceQuitBanInfoReq extends PacketHandler {
if
(
session
.
getServer
().
getMultiplayerManager
().
leaveCoop
(
session
.
getPlayer
()))
{
// Success
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
0
));
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
RetcodeOuterClass
.
Retcode
.
RET_SUCC_VALUE
));
}
else
{
// Fail
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
1
));
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
RetcodeOuterClass
.
Retcode
.
RET_SVR_ERROR_VALUE
));
}
}
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneEntityDrownReq.java
0 → 100644
View file @
b9f7c657
src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeNotify.java
View file @
b9f7c657
...
...
@@ -11,7 +11,7 @@ public class PacketAvatarChangeCostumeNotify extends GenshinPacket {
super
(
PacketOpcodes
.
AvatarChangeCostumeNotify
);
AvatarChangeCostumeNotify
proto
=
AvatarChangeCostumeNotify
.
newBuilder
()
.
setEntity
(
entity
.
toProto
())
.
setEntity
Info
(
entity
.
toProto
())
.
build
();
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketAvatarChangeCostumeRsp.java
View file @
b9f7c657
...
...
@@ -3,6 +3,7 @@ package emu.grasscutter.server.packet.send;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AvatarChangeCostumeRspOuterClass.AvatarChangeCostumeRsp
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
public
class
PacketAvatarChangeCostumeRsp
extends
GenshinPacket
{
...
...
@@ -21,7 +22,7 @@ public class PacketAvatarChangeCostumeRsp extends GenshinPacket {
super
(
PacketOpcodes
.
AvatarChangeCostumeRsp
);
AvatarChangeCostumeRsp
proto
=
AvatarChangeCostumeRsp
.
newBuilder
()
.
setRetcode
(
1
)
.
setRetcode
(
RetcodeOuterClass
.
Retcode
.
RET_SVR_ERROR_VALUE
)
.
build
();
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketAvatarWearFlycloakRsp.java
View file @
b9f7c657
...
...
@@ -3,6 +3,7 @@ package emu.grasscutter.server.packet.send;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AvatarWearFlycloakRspOuterClass.AvatarWearFlycloakRsp
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
public
class
PacketAvatarWearFlycloakRsp
extends
GenshinPacket
{
public
PacketAvatarWearFlycloakRsp
(
long
avatarGuid
,
int
costumeId
)
{
...
...
@@ -20,7 +21,7 @@ public class PacketAvatarWearFlycloakRsp extends GenshinPacket {
super
(
PacketOpcodes
.
AvatarWearFlycloakRsp
);
AvatarWearFlycloakRsp
proto
=
AvatarWearFlycloakRsp
.
newBuilder
()
.
setRetcode
(
1
)
.
setRetcode
(
RetcodeOuterClass
.
Retcode
.
RET_SVR_ERROR_VALUE
)
.
build
();
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketCalcWeaponUpgradeReturnItemsRsp.java
View file @
b9f7c657
...
...
@@ -4,9 +4,9 @@ import java.util.List;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.Retcode
;
import
emu.grasscutter.net.proto.CalcWeaponUpgradeReturnItemsRspOuterClass.CalcWeaponUpgradeReturnItemsRsp
;
import
emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
public
class
PacketCalcWeaponUpgradeReturnItemsRsp
extends
GenshinPacket
{
...
...
@@ -25,7 +25,7 @@ public class PacketCalcWeaponUpgradeReturnItemsRsp extends GenshinPacket {
super
(
PacketOpcodes
.
CalcWeaponUpgradeReturnItemsRsp
);
CalcWeaponUpgradeReturnItemsRsp
proto
=
CalcWeaponUpgradeReturnItemsRsp
.
newBuilder
()
.
setRetcode
(
Retcode
.
FAIL
)
.
setRetcode
(
Retcode
OuterClass
.
Retcode
.
RET_SVR_ERROR_VALUE
)
.
build
();
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketChangeAvatarRsp.java
View file @
b9f7c657
...
...
@@ -3,6 +3,7 @@ package emu.grasscutter.server.packet.send;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ChangeAvatarRspOuterClass.ChangeAvatarRsp
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
public
class
PacketChangeAvatarRsp
extends
GenshinPacket
{
...
...
@@ -10,8 +11,8 @@ public class PacketChangeAvatarRsp extends GenshinPacket {
super
(
PacketOpcodes
.
ChangeAvatarRsp
);
ChangeAvatarRsp
p
=
ChangeAvatarRsp
.
newBuilder
()
.
setRetcode
(
0
)
.
setCur
r
Guid
(
guid
)
.
setRetcode
(
RetcodeOuterClass
.
Retcode
.
RET_SVR_ERROR_VALUE
)
.
setCurGuid
(
guid
)
.
build
();
this
.
setData
(
p
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketCombineRsp.java
0 → 100644
View file @
b9f7c657
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.CombineReqOuterClass
;
import
emu.grasscutter.net.proto.CombineRspOuterClass
;
import
emu.grasscutter.net.proto.ItemParamOuterClass
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
public
class
PacketCombineRsp
extends
GenshinPacket
{
public
PacketCombineRsp
()
{
super
(
PacketOpcodes
.
CombineRsp
);
CombineRspOuterClass
.
CombineRsp
proto
=
CombineRspOuterClass
.
CombineRsp
.
newBuilder
()
.
setRetcode
(
RetcodeOuterClass
.
Retcode
.
RET_SVR_ERROR_VALUE
).
build
();
this
.
setData
(
proto
);
}
public
PacketCombineRsp
(
int
retcode
)
{
super
(
PacketOpcodes
.
CombineRsp
);
CombineRspOuterClass
.
CombineRsp
proto
=
CombineRspOuterClass
.
CombineRsp
.
newBuilder
()
.
setRetcode
(
retcode
).
build
();
this
.
setData
(
proto
);
}
public
PacketCombineRsp
(
CombineReqOuterClass
.
CombineReq
combineReq
,
Iterable
<
ItemParamOuterClass
.
ItemParam
>
costItemList
,
Iterable
<
ItemParamOuterClass
.
ItemParam
>
resultItemList
,
Iterable
<
ItemParamOuterClass
.
ItemParam
>
totalRandomItemList
,
Iterable
<
ItemParamOuterClass
.
ItemParam
>
totalReturnItemList
,
Iterable
<
ItemParamOuterClass
.
ItemParam
>
totalExtraItemList
)
{
super
(
PacketOpcodes
.
CombineRsp
);
CombineRspOuterClass
.
CombineRsp
proto
=
CombineRspOuterClass
.
CombineRsp
.
newBuilder
()
.
setRetcode
(
RetcodeOuterClass
.
Retcode
.
RET_SUCC_VALUE
)
.
setCombineId
(
combineReq
.
getCombineId
())
.
setCombineCount
(
combineReq
.
getCombineCount
())
.
setAvatarGuid
(
combineReq
.
getAvatarGuid
())
.
addAllCostItemList
(
costItemList
)
.
addAllResultItemList
(
resultItemList
)
.
addAllTotalRandomItemList
(
totalRandomItemList
)
.
addAllTotalReturnItemList
(
totalReturnItemList
)
.
addAllTotalExtraItemList
(
totalExtraItemList
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketDoGachaRsp.java
View file @
b9f7c657
...
...
@@ -7,6 +7,7 @@ import emu.grasscutter.net.packet.GenshinPacket;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.DoGachaRspOuterClass.DoGachaRsp
;
import
emu.grasscutter.net.proto.GachaItemOuterClass.GachaItem
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
public
class
PacketDoGachaRsp
extends
GenshinPacket
{
...
...
@@ -33,7 +34,7 @@ public class PacketDoGachaRsp extends GenshinPacket {
super
(
PacketOpcodes
.
DoGachaRsp
);
DoGachaRsp
p
=
DoGachaRsp
.
newBuilder
()
.
setRetcode
(
1
)
.
setRetcode
(
RetcodeOuterClass
.
Retcode
.
RET_SVR_ERROR_VALUE
)
.
build
();
this
.
setData
(
p
);
...
...
Prev
1
2
3
4
5
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