mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-26 18:22:54 +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<SceneData> sceneDataMap = new Int2ObjectLinkedOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
private static final Int2ObjectMap<FetterCharacterCardData> fetterCharacterCardDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
private static Map<Integer, List<Integer>> fetters = new HashMap<>();
|
private static Map<Integer, List<Integer>> fetters = new HashMap<>();
|
||||||
@ -119,6 +120,10 @@ public class GenshinData {
|
|||||||
return avatarFetterLevelDataMap;
|
return avatarFetterLevelDataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Int2ObjectMap<FetterCharacterCardData> getFetterCharacterCardDataMap() {
|
||||||
|
return fetterCharacterCardDataMap;
|
||||||
|
}
|
||||||
|
|
||||||
public static Int2ObjectMap<AvatarLevelData> getAvatarLevelDataMap() {
|
public static Int2ObjectMap<AvatarLevelData> getAvatarLevelDataMap() {
|
||||||
return avatarLevelDataMap;
|
return avatarLevelDataMap;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ public class AvatarData extends GenshinResource {
|
|||||||
private IntList abilities;
|
private IntList abilities;
|
||||||
|
|
||||||
private List<Integer> fetters;
|
private List<Integer> fetters;
|
||||||
|
private int nameCardRewardId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getId(){
|
public int getId(){
|
||||||
@ -199,6 +200,10 @@ public class AvatarData extends GenshinResource {
|
|||||||
return fetters;
|
return fetters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNameCardRewardId() {
|
||||||
|
return nameCardRewardId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
this.skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.SkillDepotId);
|
this.skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.SkillDepotId);
|
||||||
@ -206,6 +211,10 @@ public class AvatarData extends GenshinResource {
|
|||||||
// Get fetters from GenshinData
|
// Get fetters from GenshinData
|
||||||
this.fetters = GenshinData.getFetterDataEntries().get(this.Id);
|
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();
|
int size = GenshinData.getAvatarCurveDataMap().size();
|
||||||
this.hpGrowthCurve = new float[size];
|
this.hpGrowthCurve = new float[size];
|
||||||
this.attackGrowthCurve = new float[size];
|
this.attackGrowthCurve = 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() {
|
||||||
|
}
|
||||||
|
}
|
@ -93,6 +93,8 @@ public class GenshinAvatar {
|
|||||||
private int fetterLevel = 1;
|
private int fetterLevel = 1;
|
||||||
private int fetterExp;
|
private int fetterExp;
|
||||||
|
|
||||||
|
private int nameCardRewardId;
|
||||||
|
|
||||||
public GenshinAvatar() {
|
public GenshinAvatar() {
|
||||||
// Morhpia only!
|
// Morhpia only!
|
||||||
this.equips = new Int2ObjectOpenHashMap<>();
|
this.equips = new Int2ObjectOpenHashMap<>();
|
||||||
@ -110,6 +112,7 @@ public class GenshinAvatar {
|
|||||||
public GenshinAvatar(AvatarData data) {
|
public GenshinAvatar(AvatarData data) {
|
||||||
this();
|
this();
|
||||||
this.avatarId = data.getId();
|
this.avatarId = data.getId();
|
||||||
|
this.nameCardRewardId = data.getNameCardRewardId();
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.bornTime = (int) (System.currentTimeMillis() / 1000);
|
this.bornTime = (int) (System.currentTimeMillis() / 1000);
|
||||||
this.flyCloak = 140001;
|
this.flyCloak = 140001;
|
||||||
@ -172,6 +175,14 @@ public class GenshinAvatar {
|
|||||||
this.satiation = satiation;
|
this.satiation = satiation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNameCardRewardId() {
|
||||||
|
return nameCardRewardId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameCardRewardId(int nameCardRewardId) {
|
||||||
|
this.nameCardRewardId = nameCardRewardId;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSatiationPenalty() {
|
public int getSatiationPenalty() {
|
||||||
return satiationPenalty;
|
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