mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-23 21:47:39 +00:00
Merge pull request #180 from Yazawazi/development
Fix the property prompt issue in fetter system
This commit is contained in:
commit
d04a4856df
@ -35,7 +35,9 @@ public final class SetFetterLevelCommand implements CommandHandler {
|
|||||||
GenshinAvatar avatar = sender.getTeamManager().getCurrentAvatarEntity().getAvatar();
|
GenshinAvatar avatar = sender.getTeamManager().getCurrentAvatarEntity().getAvatar();
|
||||||
|
|
||||||
avatar.setFetterLevel(fetterLevel);
|
avatar.setFetterLevel(fetterLevel);
|
||||||
avatar.setFetterExp(GenshinData.getAvatarFetterLevelDataMap().get(fetterLevel).getExp());
|
if (fetterLevel != 10) {
|
||||||
|
avatar.setFetterExp(GenshinData.getAvatarFetterLevelDataMap().get(fetterLevel).getExp());
|
||||||
|
}
|
||||||
avatar.save();
|
avatar.save();
|
||||||
|
|
||||||
sender.sendPacket(new PacketAvatarFetterDataNotify(avatar));
|
sender.sendPacket(new PacketAvatarFetterDataNotify(avatar));
|
||||||
|
@ -743,9 +743,14 @@ public class GenshinAvatar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AvatarInfo toProto() {
|
public AvatarInfo toProto() {
|
||||||
|
int fetterLevel = this.getFetterLevel();
|
||||||
AvatarFetterInfo.Builder avatarFetter = AvatarFetterInfo.newBuilder()
|
AvatarFetterInfo.Builder avatarFetter = AvatarFetterInfo.newBuilder()
|
||||||
.setExpLevel(this.getFetterLevel())
|
.setExpLevel(fetterLevel);
|
||||||
.setExpNumber(this.getFetterExp());
|
|
||||||
|
if (fetterLevel != 10) {
|
||||||
|
avatarFetter.setExpNumber(this.getFetterExp());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.getFetterList() != null) {
|
if (this.getFetterList() != null) {
|
||||||
for (int i = 0; i < this.getFetterList().size(); i++) {
|
for (int i = 0; i < this.getFetterList().size(); i++) {
|
||||||
@ -757,11 +762,10 @@ public class GenshinAvatar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int rewardId = this.getNameCardRewardId();
|
|
||||||
int cardId = this.getNameCardId();
|
int cardId = this.getNameCardId();
|
||||||
|
|
||||||
if (this.getPlayer().getNameCardList().contains(cardId)) {
|
if (this.getPlayer().getNameCardList().contains(cardId)) {
|
||||||
avatarFetter.addRewardedFetterLevelList(rewardId);
|
avatarFetter.addRewardedFetterLevelList(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
AvatarInfo.Builder avatarInfo = AvatarInfo.newBuilder()
|
AvatarInfo.Builder avatarInfo = AvatarInfo.newBuilder()
|
||||||
|
@ -9,6 +9,7 @@ import emu.grasscutter.net.packet.Opcodes;
|
|||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
import emu.grasscutter.net.proto.AvatarFetterLevelRewardReqOuterClass.AvatarFetterLevelRewardReq;
|
import emu.grasscutter.net.proto.AvatarFetterLevelRewardReqOuterClass.AvatarFetterLevelRewardReq;
|
||||||
import emu.grasscutter.server.game.GameSession;
|
import emu.grasscutter.server.game.GameSession;
|
||||||
|
import emu.grasscutter.server.packet.send.PacketAvatarDataNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
|
import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketAvatarFetterLevelRewardRsp;
|
import emu.grasscutter.server.packet.send.PacketAvatarFetterLevelRewardRsp;
|
||||||
import emu.grasscutter.server.packet.send.PacketItemAddHintNotify;
|
import emu.grasscutter.server.packet.send.PacketItemAddHintNotify;
|
||||||
@ -46,8 +47,9 @@ public class HandlerAvatarFetterLevelRewardReq extends PacketHandler {
|
|||||||
session.getPlayer().getInventory().addItem(item);
|
session.getPlayer().getInventory().addItem(item);
|
||||||
session.getPlayer().sendPacket(new PacketItemAddHintNotify(item, ActionReason.FetterLevelReward));
|
session.getPlayer().sendPacket(new PacketItemAddHintNotify(item, ActionReason.FetterLevelReward));
|
||||||
session.getPlayer().sendPacket(new PacketUnlockNameCardNotify(cardId));
|
session.getPlayer().sendPacket(new PacketUnlockNameCardNotify(cardId));
|
||||||
session.send(new PacketAvatarFetterLevelRewardRsp(avatarGuid, req.getFetterLevel(), rewardId));
|
|
||||||
session.send(new PacketAvatarFetterDataNotify(avatar));
|
session.send(new PacketAvatarFetterDataNotify(avatar));
|
||||||
|
session.send(new PacketAvatarDataNotify(avatar.getPlayer()));
|
||||||
|
session.send(new PacketAvatarFetterLevelRewardRsp(avatarGuid, req.getFetterLevel(), rewardId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,14 @@ public class PacketAvatarFetterDataNotify extends GenshinPacket {
|
|||||||
public PacketAvatarFetterDataNotify(GenshinAvatar avatar) {
|
public PacketAvatarFetterDataNotify(GenshinAvatar avatar) {
|
||||||
super(PacketOpcodes.AvatarFetterDataNotify);
|
super(PacketOpcodes.AvatarFetterDataNotify);
|
||||||
|
|
||||||
|
int fetterLevel = avatar.getFetterLevel();
|
||||||
|
|
||||||
AvatarFetterInfo.Builder avatarFetter = AvatarFetterInfo.newBuilder()
|
AvatarFetterInfo.Builder avatarFetter = AvatarFetterInfo.newBuilder()
|
||||||
.setExpLevel(avatar.getFetterLevel())
|
.setExpLevel(avatar.getFetterLevel());
|
||||||
.setExpNumber(avatar.getFetterExp());
|
|
||||||
|
if (fetterLevel != 10) {
|
||||||
|
avatarFetter.setExpNumber(avatar.getFetterExp());
|
||||||
|
}
|
||||||
|
|
||||||
if (avatar.getFetterList() != null) {
|
if (avatar.getFetterList() != null) {
|
||||||
for (int i = 0; i < avatar.getFetterList().size(); i++) {
|
for (int i = 0; i < avatar.getFetterList().size(); i++) {
|
||||||
@ -27,11 +32,10 @@ public class PacketAvatarFetterDataNotify extends GenshinPacket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int rewardId = avatar.getNameCardRewardId();
|
|
||||||
int cardId = avatar.getNameCardId();
|
int cardId = avatar.getNameCardId();
|
||||||
|
|
||||||
if (avatar.getPlayer().getNameCardList().contains(cardId)) {
|
if (avatar.getPlayer().getNameCardList().contains(cardId)) {
|
||||||
avatarFetter.addRewardedFetterLevelList(rewardId);
|
avatarFetter.addRewardedFetterLevelList(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
AvatarFetterInfo avatarFetterInfo = avatarFetter.build();
|
AvatarFetterInfo avatarFetterInfo = avatarFetter.build();
|
||||||
|
Loading…
Reference in New Issue
Block a user