Fix battle in front of glowy stag god (#2188)

* Fix battle in front of glowy stag god

* Don't do a rollback when starting a quest. We're better than that.
This commit is contained in:
Nazrin
2023-06-03 07:54:46 -07:00
committed by GitHub
parent 853a67d48e
commit e28575c80f
6 changed files with 28 additions and 11 deletions

View File

@@ -4,10 +4,11 @@ import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Transient;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.quest.enums.QuestContent;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -29,10 +30,10 @@ public class PlayerProgress {
// keep track of EXEC_ADD_QUEST_PROGRESS count, will be used in CONTENT_ADD_QUEST_PROGRESS
// not sure where to put this, this should be saved to DB but not to individual quest, since
// it will be hard to loop and compare
private Map<Integer, Integer> questProgressCountMap;
private Map<String, Integer> questProgressCountMap;
public PlayerProgress() {
this.questProgressCountMap = new Int2IntOpenHashMap();
this.questProgressCountMap = new ConcurrentHashMap<>();
this.completedDungeons = new IntArrayList();
this.itemHistory = new Int2ObjectOpenHashMap<>();
}
@@ -70,15 +71,15 @@ public class PlayerProgress {
return itemEntry.addToObtainedCount(count);
}
public int getCurrentProgress(int progressId) {
public int getCurrentProgress(String progressId) {
return questProgressCountMap.getOrDefault(progressId, -1);
}
public int addToCurrentProgress(int progressId, int count) {
public int addToCurrentProgress(String progressId, int count) {
return questProgressCountMap.merge(progressId, count, Integer::sum);
}
public int resetCurrentProgress(int progressId) {
public int resetCurrentProgress(String progressId) {
return questProgressCountMap.merge(progressId, 0, Integer::min);
}