forked from Grasscutters/Grasscutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ability to buy resin with primogems (Grasscutters#2104)
* feat: add ability to buy resin with primogems * ResinManager#buy returns RetCode value
- Loading branch information
1 parent
aa9778f
commit 3c03bfe
Showing
7 changed files
with
81 additions
and
68 deletions.
There are no files selected for viewing
50 changes: 0 additions & 50 deletions
50
src/generated/main/java/emu/grasscutter/net/proto/ResinChangeNotifyOuterClass.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/emu/grasscutter/server/packet/recv/HandlerBuyResinReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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.PacketBuyResinRsp; | ||
|
||
@Opcodes(PacketOpcodes.BuyResinReq) | ||
public class HandlerBuyResinReq extends PacketHandler { | ||
@Override | ||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { | ||
var player = session.getPlayer(); | ||
session.send(new PacketBuyResinRsp(player, player.getResinManager().buy())); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/emu/grasscutter/server/packet/send/PacketBuyResinRsp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package emu.grasscutter.server.packet.send; | ||
|
||
import emu.grasscutter.game.player.Player; | ||
import emu.grasscutter.game.props.PlayerProperty; | ||
import emu.grasscutter.net.packet.BasePacket; | ||
import emu.grasscutter.net.packet.PacketOpcodes; | ||
import emu.grasscutter.net.proto.BuyResinRspOuterClass; | ||
|
||
public class PacketBuyResinRsp extends BasePacket { | ||
public PacketBuyResinRsp(Player player, int ret) { | ||
super(PacketOpcodes.BuyResinRsp); | ||
|
||
this.setData(BuyResinRspOuterClass.BuyResinRsp.newBuilder() | ||
.setCurValue(player.getProperty(PlayerProperty.PROP_PLAYER_RESIN)) | ||
.setRetcode(ret) | ||
.build()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters