mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-14 06:14:45 +01:00
Implement first met timestamp for avatars
This commit is contained in:
@@ -5,10 +5,10 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Indexed;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.data.GameData;
|
||||
@@ -30,9 +30,9 @@ import emu.lunarcore.proto.MotionInfoOuterClass.MotionInfo;
|
||||
import emu.lunarcore.proto.SceneActorInfoOuterClass.SceneActorInfo;
|
||||
import emu.lunarcore.proto.SceneEntityInfoOuterClass.SceneEntityInfo;
|
||||
import emu.lunarcore.proto.SpBarInfoOuterClass.SpBarInfo;
|
||||
import emu.lunarcore.proto.VectorOuterClass.Vector;
|
||||
import emu.lunarcore.server.packet.send.PacketPlayerSyncScNotify;
|
||||
import emu.lunarcore.util.Position;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -55,6 +55,7 @@ public class GameAvatar implements GameEntity {
|
||||
private int currentHp;
|
||||
private int currentSp;
|
||||
private Set<Integer> takenRewards;
|
||||
private long timestamp;
|
||||
|
||||
private transient int entityId;
|
||||
private transient Int2ObjectMap<GameItem> equips;
|
||||
@@ -70,7 +71,6 @@ public class GameAvatar implements GameEntity {
|
||||
this.currentSp = 0;
|
||||
}
|
||||
|
||||
// On creation
|
||||
public GameAvatar(int avatarId) {
|
||||
this(GameData.getAvatarExcelMap().get(avatarId));
|
||||
}
|
||||
@@ -78,13 +78,14 @@ public class GameAvatar implements GameEntity {
|
||||
public GameAvatar(AvatarExcel excel) {
|
||||
this();
|
||||
this.avatarId = excel.getId();
|
||||
this.takenRewards = new HashSet<>();
|
||||
this.timestamp = System.currentTimeMillis() / 1000;
|
||||
this.setExcel(excel);
|
||||
}
|
||||
|
||||
public GameAvatar(HeroPath path) {
|
||||
this();
|
||||
this.avatarId = GameConstants.TRAILBLAZER_AVATAR_ID;
|
||||
this.timestamp = System.currentTimeMillis() / 1000;
|
||||
this.setHeroPath(path);
|
||||
}
|
||||
|
||||
@@ -244,7 +245,8 @@ public class GameAvatar implements GameEntity {
|
||||
.setLevel(this.getLevel())
|
||||
.setExp(this.getExp())
|
||||
.setPromotion(this.getPromotion())
|
||||
.setRank(this.getRank());
|
||||
.setRank(this.getRank())
|
||||
.setFirstMetTimestamp(this.getTimestamp());
|
||||
|
||||
for (var equip : this.getEquips().values()) {
|
||||
if (equip.getItemMainType() == ItemMainType.Relic) {
|
||||
@@ -258,9 +260,11 @@ public class GameAvatar implements GameEntity {
|
||||
proto.addSkilltreeList(AvatarSkillTree.newInstance().setPointId(skill.getKey()).setLevel(skill.getValue()));
|
||||
}
|
||||
|
||||
for (int i : this.getTakenRewards()) {
|
||||
if (this.takenRewards != null) {
|
||||
for (int i : this.takenRewards) {
|
||||
proto.addAllTakenRewards(i);
|
||||
}
|
||||
}
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user