Fix WeightedList error in SU

This commit is contained in:
Melledy
2024-06-21 06:17:07 -07:00
parent 7d88f0b126
commit 39644fe7e8
6 changed files with 26 additions and 9 deletions

View File

@@ -56,14 +56,14 @@ public class GameData {
@Getter private static Int2ObjectMap<RogueMapExcel> rogueMapExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RogueMonsterExcel> rogueMonsterExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<DialogueEventExcel> rogueDialogueEventList = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RogueBuffExcel> rogueBuffTagExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RogueBuffGroupExcel> rogueBuffGroupExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RogueBuffExcel> rogueBuffTagExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<RogueBuffExcel> rogueBuffExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RogueDLCAreaExcel> rogueDLCAreaExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RogueNousMainStoryExcel> rogueNousMainStoryExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RogueNousSubStoryExcel> rogueNousSubStoryExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RogueNousDiceBranchExcel> rogueNousDiceBranchExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<RogueBuffExcel> rogueBuffExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<AvatarPromotionExcel> avatarPromotionExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<AvatarSkillTreeExcel> avatarSkillTreeExcelMap = new Int2ObjectOpenHashMap<>();

View File

@@ -8,6 +8,7 @@ import emu.lunarcore.data.GameResource;
import emu.lunarcore.data.ResourceType;
import emu.lunarcore.data.ResourceType.LoadPriority;
import emu.lunarcore.game.enums.RogueBuffAeonType;
import emu.lunarcore.game.enums.RogueBuffCategory;
import lombok.Getter;
@Getter
@@ -16,9 +17,9 @@ public class RogueBuffExcel extends GameResource {
private int MazeBuffID;
private int MazeBuffLevel;
private int RogueBuffType;
private int RogueBuffRarity;
private int RogueBuffTag;
private int AeonID;
private RogueBuffCategory RogueBuffCategory = emu.lunarcore.game.enums.RogueBuffCategory.None;
private RogueBuffAeonType BattleEventBuffType = RogueBuffAeonType.Normal;
@Override
@@ -33,7 +34,7 @@ public class RogueBuffExcel extends GameResource {
@Override
public void onLoad() {
// Add to random buff list
if (RogueBuffType >= 120 && RogueBuffType <= 128 && RogueBuffRarity >= 1 && RogueBuffRarity <= 3 && MazeBuffLevel == 1 && AeonID == 0) {
if (RogueBuffType >= 120 && RogueBuffType <= 128 && RogueBuffCategory.getVal() >= 1 && RogueBuffCategory.getVal() <= 3 && MazeBuffLevel == 1 && AeonID == 0) {
GameDepot.getRogueRandomBuffList().add(this);
}

View File

@@ -0,0 +1,17 @@
package emu.lunarcore.game.enums;
import lombok.Getter;
@Getter
public enum RogueBuffCategory {
None (0),
Common (1),
Rare (2),
Legendary (3);
private final int val;
private RogueBuffCategory(int value) {
this.val = value;
}
}

View File

@@ -5,7 +5,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import emu.lunarcore.data.GameData;
import emu.lunarcore.data.GameDepot;
import emu.lunarcore.data.excel.RogueBuffExcel;
import emu.lunarcore.proto.ItemCostOuterClass.ItemCost;
@@ -32,7 +31,7 @@ public class RogueBuffSelectMenu {
public RogueBuffSelectMenu() {}
public RogueBuffSelectMenu(RogueInstance rogue) {
this(rogue, false, GameData.getRogueBuffGroupExcelMap().get(110002).getRogueBuffList());
this(rogue, false, new HashSet<>());
}
public RogueBuffSelectMenu(RogueInstance rogue, boolean generateAeonBuffs, Set<RogueBuffData> buffs) {
@@ -76,7 +75,7 @@ public class RogueBuffSelectMenu {
}
// Calculate buff weights
double weight = 10.0 / excel.getExcel().getRogueBuffRarity();
double weight = 10.0 / excel.getExcel().getRogueBuffCategory().getVal();
if (getRogue().getAeonBuffType() == excel.getExcel().getRogueBuffType()) {
weight *= 2;

View File

@@ -300,7 +300,7 @@ public class RogueInstance {
public synchronized RogueBuff enhanceBuff(int buffId) {
var buff = this.getBuffs().get(buffId);
if (buff == null) return null;
var cost = 100 + (buff.getExcel().getRogueBuffRarity() - 1) * 30;
var cost = 100 + (buff.getExcel().getRogueBuffCategory().getVal() - 1) * 30;
if (this.getCoin() < cost) return null;
this.removeCoin(cost);
this.getBuffs().remove(buffId);

View File

@@ -32,7 +32,7 @@ public class PacketGetRogueBuffEnhanceInfoScRsp extends BasePacket {
}
public ItemCostList getItemCostList(RogueBuffExcel excel) {
int cost = 100 + (excel.getRogueBuffRarity() - 1) * 30;
int cost = 100 + (excel.getRogueBuffCategory().getVal() - 1) * 30;
return ItemCostList.newInstance()
.addItemList(ItemCost.newInstance()
.setPileItem(PileItem.newInstance()