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
ebab89d4
Commit
ebab89d4
authored
Jun 14, 2022
by
ImmuState
Committed by
Melledy
Jun 14, 2022
Browse files
Don't show internal server error on gacha with full inventory.
parent
e0d38610
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/gacha/GachaManager.java
View file @
ebab89d4
...
@@ -31,6 +31,7 @@ import emu.grasscutter.net.proto.GachaItemOuterClass.GachaItem;
...
@@ -31,6 +31,7 @@ import emu.grasscutter.net.proto.GachaItemOuterClass.GachaItem;
import
emu.grasscutter.net.proto.GachaTransferItemOuterClass.GachaTransferItem
;
import
emu.grasscutter.net.proto.GachaTransferItemOuterClass.GachaTransferItem
;
import
emu.grasscutter.net.proto.GetGachaInfoRspOuterClass.GetGachaInfoRsp
;
import
emu.grasscutter.net.proto.GetGachaInfoRspOuterClass.GetGachaInfoRsp
;
import
emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam
;
import
emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam
;
import
emu.grasscutter.net.proto.RetcodeOuterClass.Retcode
;
import
emu.grasscutter.server.game.GameServer
;
import
emu.grasscutter.server.game.GameServer
;
import
emu.grasscutter.server.game.GameServerTickEvent
;
import
emu.grasscutter.server.game.GameServerTickEvent
;
import
emu.grasscutter.server.packet.send.PacketDoGachaRsp
;
import
emu.grasscutter.server.packet.send.PacketDoGachaRsp
;
...
@@ -244,7 +245,7 @@ public class GachaManager {
...
@@ -244,7 +245,7 @@ public class GachaManager {
}
}
Inventory
inventory
=
player
.
getInventory
();
Inventory
inventory
=
player
.
getInventory
();
if
(
inventory
.
getInventoryTab
(
ItemType
.
ITEM_WEAPON
).
getSize
()
+
times
>
inventory
.
getInventoryTab
(
ItemType
.
ITEM_WEAPON
).
getMaxCapacity
())
{
if
(
inventory
.
getInventoryTab
(
ItemType
.
ITEM_WEAPON
).
getSize
()
+
times
>
inventory
.
getInventoryTab
(
ItemType
.
ITEM_WEAPON
).
getMaxCapacity
())
{
player
.
sendPacket
(
new
PacketDoGachaRsp
());
player
.
sendPacket
(
new
PacketDoGachaRsp
(
Retcode
.
RET_ITEM_EXCEED_LIMIT
));
return
;
return
;
}
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketDoGachaRsp.java
View file @
ebab89d4
...
@@ -8,6 +8,7 @@ import emu.grasscutter.net.packet.BasePacket;
...
@@ -8,6 +8,7 @@ import emu.grasscutter.net.packet.BasePacket;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.DoGachaRspOuterClass.DoGachaRsp
;
import
emu.grasscutter.net.proto.DoGachaRspOuterClass.DoGachaRsp
;
import
emu.grasscutter.net.proto.GachaItemOuterClass.GachaItem
;
import
emu.grasscutter.net.proto.GachaItemOuterClass.GachaItem
;
import
emu.grasscutter.net.proto.RetcodeOuterClass.Retcode
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
public
class
PacketDoGachaRsp
extends
BasePacket
{
public
class
PacketDoGachaRsp
extends
BasePacket
{
...
@@ -42,4 +43,14 @@ public class PacketDoGachaRsp extends BasePacket {
...
@@ -42,4 +43,14 @@ public class PacketDoGachaRsp extends BasePacket {
this
.
setData
(
p
);
this
.
setData
(
p
);
}
}
public
PacketDoGachaRsp
(
Retcode
retcode
)
{
super
(
PacketOpcodes
.
DoGachaRsp
);
DoGachaRsp
p
=
DoGachaRsp
.
newBuilder
()
.
setRetcode
(
retcode
.
getNumber
())
.
build
();
this
.
setData
(
p
);
}
}
}
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