mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-15 05:44:36 +01:00
Implement basic quest stuff
This commit is contained in:
47
src/main/java/emu/nebula/game/quest/GameQuest.java
Normal file
47
src/main/java/emu/nebula/game/quest/GameQuest.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package emu.nebula.game.quest;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
|
||||
import emu.nebula.data.resources.DailyQuestDef;
|
||||
import emu.nebula.proto.Public.Quest;
|
||||
import emu.nebula.proto.Public.QuestProgress;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Entity(useDiscriminator = false)
|
||||
public class GameQuest {
|
||||
private int id;
|
||||
private int type;
|
||||
private int curProgress;
|
||||
private int maxProgress;
|
||||
|
||||
@Deprecated
|
||||
public GameQuest() {
|
||||
|
||||
}
|
||||
|
||||
public GameQuest(DailyQuestDef data) {
|
||||
this.id = data.getId();
|
||||
this.type = QuestType.Daily;
|
||||
this.maxProgress = data.getCompleteCondParams()[0];
|
||||
}
|
||||
|
||||
public void resetProgress() {
|
||||
this.curProgress = 0;
|
||||
}
|
||||
|
||||
// Proto
|
||||
|
||||
public Quest toProto() {
|
||||
var progress = QuestProgress.newInstance()
|
||||
.setCur(this.getCurProgress())
|
||||
.setMax(this.getMaxProgress());
|
||||
|
||||
var proto = Quest.newInstance()
|
||||
.setId(this.getId())
|
||||
.setTypeValue(this.getType())
|
||||
.addProgress(progress);
|
||||
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user