mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-14 21:34:52 +01:00
Merge ascension/instance/infinite arena/vampire survivor progress into one manager
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package emu.nebula.game.infinitytower;
|
package emu.nebula.game.infinitytower;
|
||||||
|
|
||||||
import dev.morphia.annotations.Id;
|
|
||||||
import emu.nebula.data.GameData;
|
import emu.nebula.data.GameData;
|
||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.player.PlayerChangeInfo;
|
import emu.nebula.game.player.PlayerChangeInfo;
|
||||||
@@ -10,22 +9,11 @@ import lombok.Getter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class InfinityTowerManager extends PlayerManager {
|
public class InfinityTowerManager extends PlayerManager {
|
||||||
@Id
|
private int levelId;
|
||||||
private int uid;
|
private long buildId;
|
||||||
|
|
||||||
private transient int levelId;
|
|
||||||
private transient long buildId;
|
|
||||||
|
|
||||||
@Deprecated // Morphia only
|
|
||||||
public InfinityTowerManager() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public InfinityTowerManager(Player player) {
|
public InfinityTowerManager(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
this.uid = player.getUid();
|
|
||||||
|
|
||||||
//this.save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBountyLevel() {
|
public int getBountyLevel() {
|
||||||
|
|||||||
@@ -2,58 +2,24 @@ package emu.nebula.game.instance;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import dev.morphia.annotations.Entity;
|
|
||||||
import dev.morphia.annotations.Id;
|
|
||||||
import emu.nebula.GameConstants;
|
import emu.nebula.GameConstants;
|
||||||
import emu.nebula.Nebula;
|
|
||||||
import emu.nebula.data.GameData;
|
|
||||||
import emu.nebula.database.GameDatabaseObject;
|
|
||||||
import emu.nebula.game.inventory.ItemParamMap;
|
import emu.nebula.game.inventory.ItemParamMap;
|
||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.player.PlayerChangeInfo;
|
import emu.nebula.game.player.PlayerChangeInfo;
|
||||||
import emu.nebula.game.player.PlayerManager;
|
import emu.nebula.game.player.PlayerManager;
|
||||||
|
import emu.nebula.game.player.PlayerProgress;
|
||||||
import emu.nebula.game.quest.QuestCondType;
|
import emu.nebula.game.quest.QuestCondType;
|
||||||
import emu.nebula.proto.PlayerData.PlayerInfo;
|
|
||||||
import emu.nebula.proto.Public.CharGemInstance;
|
|
||||||
import emu.nebula.proto.Public.DailyInstance;
|
|
||||||
import emu.nebula.proto.Public.RegionBossLevel;
|
|
||||||
import emu.nebula.proto.Public.SkillInstance;
|
|
||||||
import emu.nebula.proto.Public.WeekBossLevel;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Entity(value = "instances", useDiscriminator = false)
|
public class InstanceManager extends PlayerManager {
|
||||||
public class InstanceManager extends PlayerManager implements GameDatabaseObject {
|
private int curInstanceId;
|
||||||
@Id
|
private int rewardType;
|
||||||
private int uid;
|
|
||||||
|
|
||||||
private Int2IntMap dailyInstanceLog;
|
|
||||||
private Int2IntMap regionBossLog;
|
|
||||||
private Int2IntMap skillInstanceLog;
|
|
||||||
private Int2IntMap charGemLog;
|
|
||||||
private Int2IntMap weekBossLog;
|
|
||||||
|
|
||||||
private transient int curInstanceId;
|
|
||||||
private transient int rewardType;
|
|
||||||
|
|
||||||
@Deprecated // Morphia
|
|
||||||
public InstanceManager() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public InstanceManager(Player player) {
|
public InstanceManager(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
this.uid = player.getUid();
|
|
||||||
|
|
||||||
this.dailyInstanceLog = new Int2IntOpenHashMap();
|
|
||||||
this.regionBossLog = new Int2IntOpenHashMap();
|
|
||||||
this.skillInstanceLog = new Int2IntOpenHashMap();
|
|
||||||
this.charGemLog = new Int2IntOpenHashMap();
|
|
||||||
this.weekBossLog = new Int2IntOpenHashMap();
|
|
||||||
|
|
||||||
this.save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurInstanceId(int id) {
|
public void setCurInstanceId(int id) {
|
||||||
@@ -65,18 +31,8 @@ public class InstanceManager extends PlayerManager implements GameDatabaseObject
|
|||||||
this.rewardType = rewardType;
|
this.rewardType = rewardType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveInstanceLog(Int2IntMap log, String logName, int id, int newStar) {
|
private PlayerProgress getProgress() {
|
||||||
// Get current star
|
return this.getPlayer().getProgress();
|
||||||
int star = log.get(id);
|
|
||||||
|
|
||||||
// Check star
|
|
||||||
if (newStar <= star || newStar > 7) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add to log and update database
|
|
||||||
log.put(id, newStar);
|
|
||||||
Nebula.getGameDatabase().update(this, this.getUid(), logName + "." + id, newStar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerChangeInfo settleInstance(InstanceData data, QuestCondType questCondition, Int2IntMap log, String logName, int star) {
|
public PlayerChangeInfo settleInstance(InstanceData data, QuestCondType questCondition, Int2IntMap log, String logName, int star) {
|
||||||
@@ -104,7 +60,7 @@ public class InstanceManager extends PlayerManager implements GameDatabaseObject
|
|||||||
getPlayer().getInventory().addItems(settleData.getFirstRewards(), change);
|
getPlayer().getInventory().addItems(settleData.getFirstRewards(), change);
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
this.saveInstanceLog(log, logName, data.getId(), star);
|
this.getProgress().saveInstanceLog(log, logName, data.getId(), star);
|
||||||
|
|
||||||
// Quest triggers
|
// Quest triggers
|
||||||
this.getPlayer().getQuestManager().triggerQuest(questCondition, 1);
|
this.getPlayer().getQuestManager().triggerQuest(questCondition, 1);
|
||||||
@@ -182,68 +138,4 @@ public class InstanceManager extends PlayerManager implements GameDatabaseObject
|
|||||||
return change.setSuccess(true);
|
return change.setSuccess(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proto
|
|
||||||
|
|
||||||
public void toProto(PlayerInfo proto) {
|
|
||||||
// Init
|
|
||||||
int minStars = 0;
|
|
||||||
|
|
||||||
// Simple hack to unlock all instances
|
|
||||||
if (Nebula.getConfig().getServerOptions().unlockInstances) {
|
|
||||||
minStars = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Daily instance
|
|
||||||
for (var data : GameData.getDailyInstanceDataTable()) {
|
|
||||||
int stars = Math.max(getDailyInstanceLog().get(data.getId()), minStars);
|
|
||||||
|
|
||||||
var p = DailyInstance.newInstance()
|
|
||||||
.setId(data.getId())
|
|
||||||
.setStar(stars);
|
|
||||||
|
|
||||||
proto.addDailyInstances(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Regional boss
|
|
||||||
for (var data : GameData.getRegionBossLevelDataTable()) {
|
|
||||||
int stars = Math.max(getRegionBossLog().get(data.getId()), minStars);
|
|
||||||
|
|
||||||
var p = RegionBossLevel.newInstance()
|
|
||||||
.setId(data.getId())
|
|
||||||
.setStar(stars);
|
|
||||||
|
|
||||||
proto.addRegionBossLevels(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skill instance
|
|
||||||
for (var data : GameData.getSkillInstanceDataTable()) {
|
|
||||||
int stars = Math.max(getSkillInstanceLog().get(data.getId()), minStars);
|
|
||||||
|
|
||||||
var p = SkillInstance.newInstance()
|
|
||||||
.setId(data.getId())
|
|
||||||
.setStar(stars);
|
|
||||||
|
|
||||||
proto.addSkillInstances(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Char gem instance
|
|
||||||
for (var data : GameData.getCharGemInstanceDataTable()) {
|
|
||||||
int stars = Math.max(getCharGemLog().get(data.getId()), minStars);
|
|
||||||
|
|
||||||
var p = CharGemInstance.newInstance()
|
|
||||||
.setId(data.getId())
|
|
||||||
.setStar(stars);
|
|
||||||
|
|
||||||
proto.addCharGemInstances(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Weekly boss
|
|
||||||
for (var data : GameData.getWeekBossLevelDataTable()) {
|
|
||||||
var p = WeekBossLevel.newInstance()
|
|
||||||
.setId(data.getId())
|
|
||||||
.setFirst(this.getWeekBossLog().get(data.getId()) == 1);
|
|
||||||
|
|
||||||
proto.addWeekBossLevels(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ public class Player implements GameDatabaseObject {
|
|||||||
// Managers
|
// Managers
|
||||||
private final transient CharacterStorage characters;
|
private final transient CharacterStorage characters;
|
||||||
private final transient GachaManager gachaManager;
|
private final transient GachaManager gachaManager;
|
||||||
|
private final transient StarTowerManager starTowerManager;
|
||||||
|
private final transient InstanceManager instanceManager;
|
||||||
private final transient InfinityTowerManager infinityTowerManager;
|
private final transient InfinityTowerManager infinityTowerManager;
|
||||||
private final transient VampireSurvivorManager vampireSurvivorManager;
|
private final transient VampireSurvivorManager vampireSurvivorManager;
|
||||||
private final transient ScoreBossManager scoreBossManager;
|
private final transient ScoreBossManager scoreBossManager;
|
||||||
@@ -80,8 +82,7 @@ public class Player implements GameDatabaseObject {
|
|||||||
private transient Inventory inventory;
|
private transient Inventory inventory;
|
||||||
private transient FormationManager formations;
|
private transient FormationManager formations;
|
||||||
private transient Mailbox mailbox;
|
private transient Mailbox mailbox;
|
||||||
private transient StarTowerManager starTowerManager;
|
private transient PlayerProgress progress;
|
||||||
private transient InstanceManager instanceManager;
|
|
||||||
private transient StoryManager storyManager;
|
private transient StoryManager storyManager;
|
||||||
private transient QuestManager questManager;
|
private transient QuestManager questManager;
|
||||||
|
|
||||||
@@ -93,6 +94,8 @@ public class Player implements GameDatabaseObject {
|
|||||||
// Init player managers
|
// Init player managers
|
||||||
this.characters = new CharacterStorage(this);
|
this.characters = new CharacterStorage(this);
|
||||||
this.gachaManager = new GachaManager(this);
|
this.gachaManager = new GachaManager(this);
|
||||||
|
this.starTowerManager = new StarTowerManager(this);
|
||||||
|
this.instanceManager = new InstanceManager(this);
|
||||||
this.infinityTowerManager = new InfinityTowerManager(this);
|
this.infinityTowerManager = new InfinityTowerManager(this);
|
||||||
this.vampireSurvivorManager = new VampireSurvivorManager(this);
|
this.vampireSurvivorManager = new VampireSurvivorManager(this);
|
||||||
this.scoreBossManager = new ScoreBossManager(this);
|
this.scoreBossManager = new ScoreBossManager(this);
|
||||||
@@ -482,18 +485,18 @@ public class Player implements GameDatabaseObject {
|
|||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
// Load from database
|
// Load from database
|
||||||
this.getCharacters().loadFromDatabase();
|
this.getCharacters().loadFromDatabase();
|
||||||
|
this.getStarTowerManager().loadFromDatabase();
|
||||||
|
|
||||||
// Load inventory first
|
// Load inventory before referenced classes
|
||||||
if (this.inventory == null) {
|
if (this.inventory == null) {
|
||||||
this.inventory = this.loadManagerFromDatabase(Inventory.class);
|
this.inventory = this.loadManagerFromDatabase(Inventory.class);
|
||||||
}
|
}
|
||||||
this.getInventory().loadFromDatabase();
|
this.getInventory().loadFromDatabase();
|
||||||
|
|
||||||
// Load referenced classes
|
// Load referenced classes from the database
|
||||||
this.formations = this.loadManagerFromDatabase(FormationManager.class);
|
this.formations = this.loadManagerFromDatabase(FormationManager.class);
|
||||||
this.mailbox = this.loadManagerFromDatabase(Mailbox.class);
|
this.mailbox = this.loadManagerFromDatabase(Mailbox.class);
|
||||||
this.starTowerManager = this.loadManagerFromDatabase(StarTowerManager.class);
|
this.progress = this.loadManagerFromDatabase(PlayerProgress.class);
|
||||||
this.instanceManager = this.loadManagerFromDatabase(InstanceManager.class);
|
|
||||||
this.storyManager = this.loadManagerFromDatabase(StoryManager.class);
|
this.storyManager = this.loadManagerFromDatabase(StoryManager.class);
|
||||||
this.questManager = this.loadManagerFromDatabase(QuestManager.class);
|
this.questManager = this.loadManagerFromDatabase(QuestManager.class);
|
||||||
}
|
}
|
||||||
@@ -646,8 +649,8 @@ public class Player implements GameDatabaseObject {
|
|||||||
proto.addDictionaries(dictionaryProto);
|
proto.addDictionaries(dictionaryProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add instances
|
// Add progress
|
||||||
this.getInstanceManager().toProto(proto);
|
this.getProgress().toProto(proto);
|
||||||
|
|
||||||
// Handbook
|
// Handbook
|
||||||
proto.addHandbook(this.getCharacters().getCharacterHandbook());
|
proto.addHandbook(this.getCharacters().getCharacterHandbook());
|
||||||
|
|||||||
134
src/main/java/emu/nebula/game/player/PlayerProgress.java
Normal file
134
src/main/java/emu/nebula/game/player/PlayerProgress.java
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
package emu.nebula.game.player;
|
||||||
|
|
||||||
|
import dev.morphia.annotations.Entity;
|
||||||
|
import dev.morphia.annotations.Id;
|
||||||
|
import emu.nebula.Nebula;
|
||||||
|
import emu.nebula.data.GameData;
|
||||||
|
import emu.nebula.database.GameDatabaseObject;
|
||||||
|
import emu.nebula.proto.PlayerData.PlayerInfo;
|
||||||
|
import emu.nebula.proto.Public.CharGemInstance;
|
||||||
|
import emu.nebula.proto.Public.DailyInstance;
|
||||||
|
import emu.nebula.proto.Public.RegionBossLevel;
|
||||||
|
import emu.nebula.proto.Public.SkillInstance;
|
||||||
|
import emu.nebula.proto.Public.WeekBossLevel;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Entity(value = "progress", useDiscriminator = false)
|
||||||
|
public class PlayerProgress extends PlayerManager implements GameDatabaseObject {
|
||||||
|
@Id
|
||||||
|
private int uid;
|
||||||
|
|
||||||
|
private Int2IntMap dailyInstanceLog;
|
||||||
|
private Int2IntMap regionBossLog;
|
||||||
|
private Int2IntMap skillInstanceLog;
|
||||||
|
private Int2IntMap charGemLog;
|
||||||
|
private Int2IntMap weekBossLog;
|
||||||
|
|
||||||
|
@Deprecated // Morphia only
|
||||||
|
public PlayerProgress() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerProgress(Player player) {
|
||||||
|
super(player);
|
||||||
|
this.uid = player.getUid();
|
||||||
|
|
||||||
|
// Star Tower
|
||||||
|
|
||||||
|
// Instances
|
||||||
|
this.dailyInstanceLog = new Int2IntOpenHashMap();
|
||||||
|
this.regionBossLog = new Int2IntOpenHashMap();
|
||||||
|
this.skillInstanceLog = new Int2IntOpenHashMap();
|
||||||
|
this.charGemLog = new Int2IntOpenHashMap();
|
||||||
|
this.weekBossLog = new Int2IntOpenHashMap();
|
||||||
|
|
||||||
|
// Infinity Arena
|
||||||
|
|
||||||
|
// Vampire Survivor
|
||||||
|
|
||||||
|
// Save to database
|
||||||
|
this.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveInstanceLog(Int2IntMap log, String logName, int id, int newStar) {
|
||||||
|
// Get current star
|
||||||
|
int star = log.get(id);
|
||||||
|
|
||||||
|
// Check star
|
||||||
|
if (newStar <= star || newStar > 7) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to log and update database
|
||||||
|
log.put(id, newStar);
|
||||||
|
Nebula.getGameDatabase().update(this, this.getUid(), logName + "." + id, newStar);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proto
|
||||||
|
|
||||||
|
public void toProto(PlayerInfo proto) {
|
||||||
|
// Init
|
||||||
|
int minStars = 0;
|
||||||
|
|
||||||
|
// Simple hack to unlock all instances
|
||||||
|
if (Nebula.getConfig().getServerOptions().unlockInstances) {
|
||||||
|
minStars = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Daily instance
|
||||||
|
for (var data : GameData.getDailyInstanceDataTable()) {
|
||||||
|
int stars = Math.max(this.getDailyInstanceLog().get(data.getId()), minStars);
|
||||||
|
|
||||||
|
var p = DailyInstance.newInstance()
|
||||||
|
.setId(data.getId())
|
||||||
|
.setStar(stars);
|
||||||
|
|
||||||
|
proto.addDailyInstances(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Regional boss
|
||||||
|
for (var data : GameData.getRegionBossLevelDataTable()) {
|
||||||
|
int stars = Math.max(this.getRegionBossLog().get(data.getId()), minStars);
|
||||||
|
|
||||||
|
var p = RegionBossLevel.newInstance()
|
||||||
|
.setId(data.getId())
|
||||||
|
.setStar(stars);
|
||||||
|
|
||||||
|
proto.addRegionBossLevels(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skill instance
|
||||||
|
for (var data : GameData.getSkillInstanceDataTable()) {
|
||||||
|
int stars = Math.max(this.getSkillInstanceLog().get(data.getId()), minStars);
|
||||||
|
|
||||||
|
var p = SkillInstance.newInstance()
|
||||||
|
.setId(data.getId())
|
||||||
|
.setStar(stars);
|
||||||
|
|
||||||
|
proto.addSkillInstances(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Char gem instance
|
||||||
|
for (var data : GameData.getCharGemInstanceDataTable()) {
|
||||||
|
int stars = Math.max(this.getCharGemLog().get(data.getId()), minStars);
|
||||||
|
|
||||||
|
var p = CharGemInstance.newInstance()
|
||||||
|
.setId(data.getId())
|
||||||
|
.setStar(stars);
|
||||||
|
|
||||||
|
proto.addCharGemInstances(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Weekly boss
|
||||||
|
for (var data : GameData.getWeekBossLevelDataTable()) {
|
||||||
|
var p = WeekBossLevel.newInstance()
|
||||||
|
.setId(data.getId())
|
||||||
|
.setFirst(this.getWeekBossLog().get(data.getId()) == 1);
|
||||||
|
|
||||||
|
proto.addWeekBossLevels(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,44 +1,29 @@
|
|||||||
package emu.nebula.game.tower;
|
package emu.nebula.game.tower;
|
||||||
|
|
||||||
import dev.morphia.annotations.Entity;
|
|
||||||
import dev.morphia.annotations.Id;
|
|
||||||
import emu.nebula.Nebula;
|
import emu.nebula.Nebula;
|
||||||
import emu.nebula.data.GameData;
|
import emu.nebula.data.GameData;
|
||||||
import emu.nebula.database.GameDatabaseObject;
|
|
||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.player.PlayerChangeInfo;
|
import emu.nebula.game.player.PlayerChangeInfo;
|
||||||
import emu.nebula.game.player.PlayerManager;
|
import emu.nebula.game.player.PlayerManager;
|
||||||
import emu.nebula.game.quest.QuestCondType;
|
import emu.nebula.game.quest.QuestCondType;
|
||||||
import emu.nebula.proto.StarTowerApply.StarTowerApplyReq;
|
import emu.nebula.proto.StarTowerApply.StarTowerApplyReq;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Entity(value = "star_tower", useDiscriminator = false)
|
public class StarTowerManager extends PlayerManager {
|
||||||
public class StarTowerManager extends PlayerManager implements GameDatabaseObject {
|
|
||||||
@Id
|
|
||||||
private int uid;
|
|
||||||
|
|
||||||
// TODO add tower talents here
|
|
||||||
|
|
||||||
// Tower game instance
|
// Tower game instance
|
||||||
private transient StarTowerGame game;
|
private StarTowerGame game;
|
||||||
|
|
||||||
// Tower builds
|
// Tower builds
|
||||||
private transient Long2ObjectMap<StarTowerBuild> builds;
|
private Long2ObjectMap<StarTowerBuild> builds;
|
||||||
private transient StarTowerBuild lastBuild;
|
private StarTowerBuild lastBuild;
|
||||||
|
|
||||||
@Deprecated // Morphia only
|
|
||||||
public StarTowerManager() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public StarTowerManager(Player player) {
|
public StarTowerManager(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
this.uid = player.getUid();
|
|
||||||
|
|
||||||
this.save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long2ObjectMap<StarTowerBuild> getBuilds() {
|
public Long2ObjectMap<StarTowerBuild> getBuilds() {
|
||||||
@@ -167,7 +152,7 @@ public class StarTowerManager extends PlayerManager implements GameDatabaseObjec
|
|||||||
|
|
||||||
// Database
|
// Database
|
||||||
|
|
||||||
private void loadFromDatabase() {
|
public void loadFromDatabase() {
|
||||||
this.builds = new Long2ObjectOpenHashMap<>();
|
this.builds = new Long2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
Nebula.getGameDatabase().getObjects(StarTowerBuild.class, "playerUid", getPlayerUid()).forEach(build -> {
|
Nebula.getGameDatabase().getObjects(StarTowerBuild.class, "playerUid", getPlayerUid()).forEach(build -> {
|
||||||
|
|||||||
@@ -1,35 +1,18 @@
|
|||||||
package emu.nebula.game.vampire;
|
package emu.nebula.game.vampire;
|
||||||
|
|
||||||
import dev.morphia.annotations.Entity;
|
|
||||||
import dev.morphia.annotations.Id;
|
|
||||||
import emu.nebula.data.GameData;
|
import emu.nebula.data.GameData;
|
||||||
import emu.nebula.database.GameDatabaseObject;
|
|
||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.player.PlayerManager;
|
import emu.nebula.game.player.PlayerManager;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Entity(value = "vampire", useDiscriminator = false)
|
public class VampireSurvivorManager extends PlayerManager {
|
||||||
public class VampireSurvivorManager extends PlayerManager implements GameDatabaseObject {
|
|
||||||
@Id
|
|
||||||
private int uid;
|
|
||||||
|
|
||||||
// Game
|
// Game
|
||||||
private transient VampireSurvivorGame game;
|
private transient VampireSurvivorGame game;
|
||||||
|
|
||||||
// TODO talents
|
|
||||||
|
|
||||||
@Deprecated // Morphia only
|
|
||||||
public VampireSurvivorManager() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public VampireSurvivorManager(Player player) {
|
public VampireSurvivorManager(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
this.uid = player.getUid();
|
|
||||||
|
|
||||||
//this.save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public VampireSurvivorGame apply(int levelId) {
|
public VampireSurvivorGame apply(int levelId) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class HandlerCharGemInstanceSettleReq extends NetHandler {
|
|||||||
var changes = player.getInstanceManager().settleInstance(
|
var changes = player.getInstanceManager().settleInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.CharGemInstanceClearTotal,
|
QuestCondType.CharGemInstanceClearTotal,
|
||||||
player.getInstanceManager().getCharGemLog(),
|
player.getProgress().getCharGemLog(),
|
||||||
"charGemLog",
|
"charGemLog",
|
||||||
req.getStar()
|
req.getStar()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class HandlerCharGemInstanceSweepReq extends NetHandler {
|
|||||||
var change = session.getPlayer().getInstanceManager().sweepInstance(
|
var change = session.getPlayer().getInstanceManager().sweepInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.CharGemInstanceClearTotal,
|
QuestCondType.CharGemInstanceClearTotal,
|
||||||
session.getPlayer().getInstanceManager().getCharGemLog(),
|
session.getPlayer().getProgress().getCharGemLog(),
|
||||||
0,
|
0,
|
||||||
req.getTimes()
|
req.getTimes()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class HandlerDailyInstanceRaidReq extends NetHandler {
|
|||||||
var change = session.getPlayer().getInstanceManager().sweepInstance(
|
var change = session.getPlayer().getInstanceManager().sweepInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.DailyInstanceClearTotal,
|
QuestCondType.DailyInstanceClearTotal,
|
||||||
session.getPlayer().getInstanceManager().getDailyInstanceLog(),
|
session.getPlayer().getProgress().getDailyInstanceLog(),
|
||||||
req.getRewardType(),
|
req.getRewardType(),
|
||||||
req.getTimes()
|
req.getTimes()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class HandlerDailyInstanceSettleReq extends NetHandler {
|
|||||||
var changes = player.getInstanceManager().settleInstance(
|
var changes = player.getInstanceManager().settleInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.DailyInstanceClearTotal,
|
QuestCondType.DailyInstanceClearTotal,
|
||||||
player.getInstanceManager().getDailyInstanceLog(),
|
player.getProgress().getDailyInstanceLog(),
|
||||||
"dailyInstanceLog",
|
"dailyInstanceLog",
|
||||||
req.getStar()
|
req.getStar()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class HandlerRegionBossLevelSettleReq extends NetHandler {
|
|||||||
var changes = player.getInstanceManager().settleInstance(
|
var changes = player.getInstanceManager().settleInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.RegionBossClearTotal,
|
QuestCondType.RegionBossClearTotal,
|
||||||
player.getInstanceManager().getRegionBossLog(),
|
player.getProgress().getRegionBossLog(),
|
||||||
"regionBossLog",
|
"regionBossLog",
|
||||||
req.getStar()
|
req.getStar()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class HandlerRegionBossLevelSweepReq extends NetHandler {
|
|||||||
var change = session.getPlayer().getInstanceManager().sweepInstance(
|
var change = session.getPlayer().getInstanceManager().sweepInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.RegionBossClearTotal,
|
QuestCondType.RegionBossClearTotal,
|
||||||
session.getPlayer().getInstanceManager().getRegionBossLog(),
|
session.getPlayer().getProgress().getRegionBossLog(),
|
||||||
0,
|
0,
|
||||||
req.getTimes()
|
req.getTimes()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class HandlerSkillInstanceSettleReq extends NetHandler {
|
|||||||
var changes = player.getInstanceManager().settleInstance(
|
var changes = player.getInstanceManager().settleInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.SkillInstanceClearTotal,
|
QuestCondType.SkillInstanceClearTotal,
|
||||||
player.getInstanceManager().getSkillInstanceLog(),
|
player.getProgress().getSkillInstanceLog(),
|
||||||
"skillInstanceLog",
|
"skillInstanceLog",
|
||||||
req.getStar()
|
req.getStar()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class HandlerSkillInstanceSweepReq extends NetHandler {
|
|||||||
var change = session.getPlayer().getInstanceManager().sweepInstance(
|
var change = session.getPlayer().getInstanceManager().sweepInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.SkillInstanceClearTotal,
|
QuestCondType.SkillInstanceClearTotal,
|
||||||
session.getPlayer().getInstanceManager().getSkillInstanceLog(),
|
session.getPlayer().getProgress().getSkillInstanceLog(),
|
||||||
0,
|
0,
|
||||||
req.getTimes()
|
req.getTimes()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class HandlerWeekBossSettleReq extends NetHandler {
|
|||||||
var changes = player.getInstanceManager().settleInstance(
|
var changes = player.getInstanceManager().settleInstance(
|
||||||
data,
|
data,
|
||||||
QuestCondType.WeekBoosClearSpecificDifficultyAndTotal,
|
QuestCondType.WeekBoosClearSpecificDifficultyAndTotal,
|
||||||
player.getInstanceManager().getWeekBossLog(),
|
player.getProgress().getWeekBossLog(),
|
||||||
"weekBossLog",
|
"weekBossLog",
|
||||||
req.getResult() ? 1 : 0
|
req.getResult() ? 1 : 0
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user