mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 05:44:36 +01:00
Add proper score rewards to SU finish screen
This commit is contained in:
@@ -6,6 +6,7 @@ import emu.lunarcore.data.GameDepot;
|
||||
import emu.lunarcore.data.GameResource;
|
||||
import emu.lunarcore.data.ResourceType;
|
||||
import emu.lunarcore.data.ResourceType.LoadPriority;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@@ -14,6 +15,7 @@ public class RogueAreaExcel extends GameResource {
|
||||
private int RogueAreaID;
|
||||
private int AreaProgress;
|
||||
private int Difficulty;
|
||||
private Int2IntOpenHashMap ScoreMap;
|
||||
|
||||
private transient int mapId;
|
||||
private transient List<RogueMapExcel> sites;
|
||||
|
||||
@@ -54,6 +54,9 @@ public class RogueInstance {
|
||||
private int aeonId;
|
||||
private int aeonBuffType;
|
||||
private int maxAeonBuffs;
|
||||
|
||||
private int roomScore;
|
||||
private int earnedTalentCoin;
|
||||
private boolean isWin;
|
||||
|
||||
@Deprecated // Morphia only!
|
||||
@@ -289,6 +292,21 @@ public class RogueInstance {
|
||||
return nextRoom;
|
||||
}
|
||||
|
||||
public void onFinish() {
|
||||
// Calculate completed rooms
|
||||
int completedRooms = Math.max(this.currentRoomProgress - (this.isWin() ? 0 : 1), 0);
|
||||
|
||||
// Calculate score and talent point rewards
|
||||
this.roomScore = this.getExcel().getScoreMap().get(completedRooms);
|
||||
this.earnedTalentCoin = this.roomScore / 10;
|
||||
|
||||
// Add
|
||||
if (this.earnedTalentCoin > 0) {
|
||||
this.getPlayer().addTalentPoints(this.earnedTalentCoin);
|
||||
this.getPlayer().save();
|
||||
}
|
||||
}
|
||||
|
||||
// Dialogue stuff
|
||||
|
||||
public void selectDialogue(int dialogueEventId) {
|
||||
@@ -311,8 +329,15 @@ public class RogueInstance {
|
||||
|
||||
public synchronized void onBattleFinish(Battle battle, BattleEndStatus result, BattleStatistics stats) {
|
||||
if (result == BattleEndStatus.BATTLE_END_WIN) {
|
||||
int amount = battle.getNpcMonsters().size();
|
||||
this.createBuffSelect(amount);
|
||||
int roomType = this.getCurrentRoom().getExcel().getRogueRoomType();
|
||||
if (roomType == RogueRoomType.BOSS.getVal()) {
|
||||
// Final boss
|
||||
this.isWin = true;
|
||||
} else {
|
||||
// Give blessings to player
|
||||
int amount = battle.getNpcMonsters().size();
|
||||
this.createBuffSelect(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,6 +455,8 @@ public class RogueInstance {
|
||||
|
||||
// Create rogue finish info
|
||||
var proto = RogueFinishInfo.newInstance()
|
||||
.setTotalScore(this.getRoomScore())
|
||||
.setTalentCoin(this.getEarnedTalentCoin())
|
||||
.setAreaId(this.getAreaId())
|
||||
.setIsWin(this.isWin())
|
||||
.setPassRoomCount(this.getCurrentSiteId())
|
||||
|
||||
@@ -153,6 +153,8 @@ public class RogueManager extends BasePlayerManager {
|
||||
return;
|
||||
}
|
||||
|
||||
getPlayer().getRogueInstance().onFinish();
|
||||
|
||||
getPlayer().getSession().send(CmdId.QuitRogueScRsp);
|
||||
getPlayer().getSession().send(new PacketSyncRogueFinishScNotify(getPlayer()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user