mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-19 10:24:47 +01:00
Implement Resin (#1257)
* Basic resin usage/refresh. * Honor resin config, move some logic to logon. * Add resin usage to DungeonChallenge * Make fragile and transient resin usable. * Get resin cost from dungeon excel. * Add ability to unlock combine diagrams. * Refactor CombineManager to use Inventory.payItems, enabling crafting of condensed resin. * Refactor ForgingManager to use Inventory.payItems, to prepare for eventually forging Mystic Enhancement Ores using resin. * Remove comment * Check resin usage in addResin
This commit is contained in:
@@ -13,7 +13,7 @@ public class HandlerGadgetInteractReq extends PacketHandler {
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
GadgetInteractReq req = GadgetInteractReq.parseFrom(payload);
|
||||
|
||||
session.getPlayer().interactWith(req.getGadgetEntityId());
|
||||
session.getPlayer().interactWith(req.getGadgetEntityId(), req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.CombineDataNotifyOuterClass.CombineDataNotify;
|
||||
|
||||
public class PacketCombineDataNotify extends BasePacket {
|
||||
|
||||
public PacketCombineDataNotify(Iterable<Integer> unlockedCombines) {
|
||||
super(PacketOpcodes.CombineDataNotify);
|
||||
|
||||
CombineDataNotify proto = CombineDataNotify.newBuilder()
|
||||
.addAllCombineIdList(unlockedCombines)
|
||||
.build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.CombineFormulaDataNotifyOuterClass.CombineFormulaDataNotify;
|
||||
|
||||
public class PacketCombineFormulaDataNotify extends BasePacket {
|
||||
|
||||
public PacketCombineFormulaDataNotify(int combineId) {
|
||||
super(PacketOpcodes.CombineFormulaDataNotify);
|
||||
|
||||
CombineFormulaDataNotify proto = CombineFormulaDataNotify.newBuilder()
|
||||
.setCombineId(combineId)
|
||||
.setIsLocked(false)
|
||||
.build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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.ResinChangeNotifyOuterClass.ResinChangeNotify;
|
||||
|
||||
public class PacketResinChangeNotify extends BasePacket {
|
||||
|
||||
public PacketResinChangeNotify(Player player) {
|
||||
super(PacketOpcodes.ResinChangeNotify);
|
||||
|
||||
ResinChangeNotify proto = ResinChangeNotify.newBuilder()
|
||||
.setCurValue(player.getProperty(PlayerProperty.PROP_PLAYER_RESIN))
|
||||
.setNextAddTimestamp(player.getNextResinRefresh())
|
||||
.build();
|
||||
|
||||
// ToDo: Add ability to buy resin with primogems, has to be included here.
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user