-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add statue promo data * implement levelup city feature * fix get level city when enter game * format code * fix typo, remove some property in the player, add the field cityInfoData to player class
- Loading branch information
1 parent
d0dde1c
commit bdc4b5a
Showing
8 changed files
with
214 additions
and
5 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
src/main/java/emu/grasscutter/data/excels/StatuePromoteData.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,21 @@ | ||
package emu.grasscutter.data.excels; | ||
|
||
import emu.grasscutter.data.GameResource; | ||
import emu.grasscutter.data.ResourceType; | ||
import emu.grasscutter.data.common.ItemParamData; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@ResourceType(name = "StatuePromoteExcelConfigData.json") | ||
public class StatuePromoteData extends GameResource { | ||
@Getter @Setter private int level; | ||
@Getter @Setter private int cityId; | ||
@Getter @Setter private ItemParamData[] costItems; | ||
@Getter @Setter private int[] rewardIdList; | ||
@Getter @Setter private int stamina; | ||
|
||
@Override | ||
public int getId() { | ||
return (cityId << 8) + level; | ||
} | ||
} |
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,28 @@ | ||
package emu.grasscutter.game.city; | ||
|
||
import dev.morphia.annotations.Entity; | ||
import emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Entity | ||
public class CityInfoData { | ||
@Getter @Setter private int cityId; | ||
|
||
@Getter @Setter | ||
private int level = 1; // level of the city (include level SotS, level Frostbearing Trees, etc.) | ||
|
||
@Getter @Setter private int numCrystal = 0; // number of crystals in the city | ||
|
||
public CityInfoData(int cityId) { | ||
this.cityId = cityId; | ||
} | ||
|
||
public CityInfo toProto() { | ||
return CityInfo.newBuilder() | ||
.setCityId(cityId) | ||
.setLevel(level) | ||
.setCrystalNum(numCrystal) | ||
.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
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
22 changes: 22 additions & 0 deletions
22
src/main/java/emu/grasscutter/server/packet/recv/HandlerLevelupCityReq.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,22 @@ | ||
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.LevelupCityReqOuterClass.LevelupCityReq; | ||
import emu.grasscutter.server.game.GameSession; | ||
|
||
@Opcodes(PacketOpcodes.LevelupCityReq) | ||
public class HandlerLevelupCityReq extends PacketHandler { | ||
|
||
@Override | ||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { | ||
LevelupCityReq req = LevelupCityReq.parseFrom(payload); | ||
|
||
// Level up city | ||
session | ||
.getPlayer() | ||
.getSotsManager() | ||
.levelUpSotS(req.getAreaId(), req.getSceneId(), req.getItemNum()); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
src/main/java/emu/grasscutter/server/packet/send/PacketLevelupCityRsp.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,29 @@ | ||
package emu.grasscutter.server.packet.send; | ||
|
||
import emu.grasscutter.net.packet.BasePacket; | ||
import emu.grasscutter.net.packet.PacketOpcodes; | ||
import emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo; | ||
import emu.grasscutter.net.proto.LevelupCityRspOuterClass.LevelupCityRsp; | ||
|
||
public class PacketLevelupCityRsp extends BasePacket { | ||
|
||
public PacketLevelupCityRsp( | ||
int sceneId, int level, int cityId, int crystalNum, int areaId, int retcode) { | ||
super(PacketOpcodes.LevelupCityRsp); | ||
|
||
LevelupCityRsp proto = | ||
LevelupCityRsp.newBuilder() | ||
.setSceneId(sceneId) | ||
.setCityInfo( | ||
CityInfo.newBuilder() | ||
.setCityId(cityId) | ||
.setLevel(level) | ||
.setCrystalNum(crystalNum) | ||
.build()) | ||
.setAreaId(areaId) | ||
.setRetcode(retcode) | ||
.build(); | ||
|
||
this.setData(proto); | ||
} | ||
} |