mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 03:42:53 +08:00
AvatarFetterLevelReward
This commit is contained in:
parent
48db644692
commit
7ccecda07c
@ -58,6 +58,7 @@ public class GenshinData {
|
||||
|
||||
private static final Int2ObjectMap<SceneData> sceneDataMap = new Int2ObjectLinkedOpenHashMap<>();
|
||||
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<FetterCharacterCardData> fetterCharacterCardDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
// Cache
|
||||
private static Map<Integer, List<Integer>> fetters = new HashMap<>();
|
||||
@ -119,6 +120,10 @@ public class GenshinData {
|
||||
return avatarFetterLevelDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<FetterCharacterCardData> getFetterCharacterCardDataMap() {
|
||||
return fetterCharacterCardDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarLevelData> getAvatarLevelDataMap() {
|
||||
return avatarLevelDataMap;
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ public class AvatarData extends GenshinResource {
|
||||
private IntList abilities;
|
||||
|
||||
private List<Integer> fetters;
|
||||
private int nameCardRewardId;
|
||||
|
||||
@Override
|
||||
public int getId(){
|
||||
@ -199,12 +200,20 @@ public class AvatarData extends GenshinResource {
|
||||
return fetters;
|
||||
}
|
||||
|
||||
public int getNameCardRewardId() {
|
||||
return nameCardRewardId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.SkillDepotId);
|
||||
|
||||
// Get fetters from GenshinData
|
||||
this.fetters = GenshinData.getFetterDataEntries().get(this.Id);
|
||||
|
||||
if (GenshinData.getFetterCharacterCardDataMap().get(this.Id) != null) {
|
||||
this.nameCardRewardId = GenshinData.getFetterCharacterCardDataMap().get(this.Id).getRewardId();
|
||||
}
|
||||
|
||||
int size = GenshinData.getAvatarCurveDataMap().size();
|
||||
this.hpGrowthCurve = new float[size];
|
||||
|
@ -0,0 +1,24 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
|
||||
@ResourceType(name = "FetterCharacterCardExcelConfigData.json", loadPriority = LoadPriority.HIGHEST)
|
||||
public class FetterCharacterCardData extends GenshinResource {
|
||||
private int AvatarId;
|
||||
private int RewardId;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return AvatarId;
|
||||
}
|
||||
|
||||
public int getRewardId() {
|
||||
return RewardId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
}
|
||||
}
|
@ -92,6 +92,8 @@ public class GenshinAvatar {
|
||||
|
||||
private int fetterLevel = 1;
|
||||
private int fetterExp;
|
||||
|
||||
private int nameCardRewardId;
|
||||
|
||||
public GenshinAvatar() {
|
||||
// Morhpia only!
|
||||
@ -110,6 +112,7 @@ public class GenshinAvatar {
|
||||
public GenshinAvatar(AvatarData data) {
|
||||
this();
|
||||
this.avatarId = data.getId();
|
||||
this.nameCardRewardId = data.getNameCardRewardId();
|
||||
this.data = data;
|
||||
this.bornTime = (int) (System.currentTimeMillis() / 1000);
|
||||
this.flyCloak = 140001;
|
||||
@ -172,6 +175,14 @@ public class GenshinAvatar {
|
||||
this.satiation = satiation;
|
||||
}
|
||||
|
||||
public int getNameCardRewardId() {
|
||||
return nameCardRewardId;
|
||||
}
|
||||
|
||||
public void setNameCardRewardId(int nameCardRewardId) {
|
||||
this.nameCardRewardId = nameCardRewardId;
|
||||
}
|
||||
|
||||
public int getSatiationPenalty() {
|
||||
return satiationPenalty;
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package emu.grasscutter.server.packet.recv;
|
||||
|
||||
import emu.grasscutter.net.packet.Opcodes;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.AvatarFetterLevelRewardReqOuterClass.AvatarFetterLevelRewardReq;
|
||||
import emu.grasscutter.server.game.GameSession;
|
||||
import emu.grasscutter.server.packet.send.PacketAvatarFetterLevelRewardRsp;
|
||||
import emu.grasscutter.net.packet.PacketHandler;
|
||||
|
||||
@Opcodes(PacketOpcodes.AvatarFetterLevelRewardReq)
|
||||
public class HandlerAvatarFetterLevelRewardReq extends PacketHandler {
|
||||
@Override
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
AvatarFetterLevelRewardReq req = AvatarFetterLevelRewardReq.parseFrom(payload);
|
||||
if (req.getFetterLevel() < 10) {
|
||||
// You don't have a full level of fetter level, why do you want to get a divorce certificate?
|
||||
session.send(new PacketAvatarFetterLevelRewardRsp(req.getAvatarGuid(), req.getFetterLevel()));
|
||||
} else {
|
||||
long avatarGuid = req.getAvatarGuid();
|
||||
|
||||
int rewardId = session
|
||||
.getPlayer()
|
||||
.getAvatars()
|
||||
.getAvatarByGuid(avatarGuid)
|
||||
.getNameCardRewardId();
|
||||
|
||||
// Here need to send the packets, I am not at all clear ah!
|
||||
|
||||
session.send(new PacketAvatarFetterLevelRewardRsp(avatarGuid, req.getFetterLevel(), rewardId));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.GenshinPacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.AvatarFetterLevelRewardRspOuterClass.AvatarFetterLevelRewardRsp;
|
||||
|
||||
public class PacketAvatarFetterLevelRewardRsp extends GenshinPacket {
|
||||
|
||||
public PacketAvatarFetterLevelRewardRsp(long guid, int fetterLevel, int rewardId) {
|
||||
super(PacketOpcodes.AvatarFetterLevelRewardRsp);
|
||||
|
||||
AvatarFetterLevelRewardRsp proto = AvatarFetterLevelRewardRsp.newBuilder()
|
||||
.setAvatarGuid(guid)
|
||||
.setFetterLevel(fetterLevel)
|
||||
.setRetcode(0)
|
||||
.setRewardId(rewardId)
|
||||
.build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public PacketAvatarFetterLevelRewardRsp(long guid, int fetterLevel) {
|
||||
super(PacketOpcodes.AvatarFetterLevelRewardRsp);
|
||||
|
||||
AvatarFetterLevelRewardRsp proto = AvatarFetterLevelRewardRsp.newBuilder()
|
||||
.setAvatarGuid(guid)
|
||||
.setFetterLevel(fetterLevel)
|
||||
.setRetcode(1)
|
||||
.setRewardId(0)
|
||||
.build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user