mirror of
https://github.com/Melledy/LunarCore.git
synced 2026-02-06 01:56:52 +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.GameResource;
|
||||||
import emu.lunarcore.data.ResourceType;
|
import emu.lunarcore.data.ResourceType;
|
||||||
import emu.lunarcore.data.ResourceType.LoadPriority;
|
import emu.lunarcore.data.ResourceType.LoadPriority;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -14,6 +15,7 @@ public class RogueAreaExcel extends GameResource {
|
|||||||
private int RogueAreaID;
|
private int RogueAreaID;
|
||||||
private int AreaProgress;
|
private int AreaProgress;
|
||||||
private int Difficulty;
|
private int Difficulty;
|
||||||
|
private Int2IntOpenHashMap ScoreMap;
|
||||||
|
|
||||||
private transient int mapId;
|
private transient int mapId;
|
||||||
private transient List<RogueMapExcel> sites;
|
private transient List<RogueMapExcel> sites;
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ public class RogueInstance {
|
|||||||
private int aeonId;
|
private int aeonId;
|
||||||
private int aeonBuffType;
|
private int aeonBuffType;
|
||||||
private int maxAeonBuffs;
|
private int maxAeonBuffs;
|
||||||
|
|
||||||
|
private int roomScore;
|
||||||
|
private int earnedTalentCoin;
|
||||||
private boolean isWin;
|
private boolean isWin;
|
||||||
|
|
||||||
@Deprecated // Morphia only!
|
@Deprecated // Morphia only!
|
||||||
@@ -289,6 +292,21 @@ public class RogueInstance {
|
|||||||
return nextRoom;
|
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
|
// Dialogue stuff
|
||||||
|
|
||||||
public void selectDialogue(int dialogueEventId) {
|
public void selectDialogue(int dialogueEventId) {
|
||||||
@@ -311,10 +329,17 @@ public class RogueInstance {
|
|||||||
|
|
||||||
public synchronized void onBattleFinish(Battle battle, BattleEndStatus result, BattleStatistics stats) {
|
public synchronized void onBattleFinish(Battle battle, BattleEndStatus result, BattleStatistics stats) {
|
||||||
if (result == BattleEndStatus.BATTLE_END_WIN) {
|
if (result == BattleEndStatus.BATTLE_END_WIN) {
|
||||||
|
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();
|
int amount = battle.getNpcMonsters().size();
|
||||||
this.createBuffSelect(amount);
|
this.createBuffSelect(amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
|
|
||||||
@@ -430,6 +455,8 @@ public class RogueInstance {
|
|||||||
|
|
||||||
// Create rogue finish info
|
// Create rogue finish info
|
||||||
var proto = RogueFinishInfo.newInstance()
|
var proto = RogueFinishInfo.newInstance()
|
||||||
|
.setTotalScore(this.getRoomScore())
|
||||||
|
.setTalentCoin(this.getEarnedTalentCoin())
|
||||||
.setAreaId(this.getAreaId())
|
.setAreaId(this.getAreaId())
|
||||||
.setIsWin(this.isWin())
|
.setIsWin(this.isWin())
|
||||||
.setPassRoomCount(this.getCurrentSiteId())
|
.setPassRoomCount(this.getCurrentSiteId())
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ public class RogueManager extends BasePlayerManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPlayer().getRogueInstance().onFinish();
|
||||||
|
|
||||||
getPlayer().getSession().send(CmdId.QuitRogueScRsp);
|
getPlayer().getSession().send(CmdId.QuitRogueScRsp);
|
||||||
getPlayer().getSession().send(new PacketSyncRogueFinishScNotify(getPlayer()));
|
getPlayer().getSession().send(new PacketSyncRogueFinishScNotify(getPlayer()));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user