From 4a7653ec89fea698acb198a1d9cda697a6e6074f Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Thu, 14 Dec 2023 20:39:11 -0800 Subject: [PATCH] Fix drop values for trace/avatar/lightcone exp cocoons --- .../data/excel/MappingInfoExcel.java | 50 +++++++++++++++---- .../emu/lunarcore/game/drops/DropService.java | 2 - 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/main/java/emu/lunarcore/data/excel/MappingInfoExcel.java b/src/main/java/emu/lunarcore/data/excel/MappingInfoExcel.java index 2180506..775bfdd 100644 --- a/src/main/java/emu/lunarcore/data/excel/MappingInfoExcel.java +++ b/src/main/java/emu/lunarcore/data/excel/MappingInfoExcel.java @@ -11,7 +11,6 @@ import emu.lunarcore.data.ResourceType.LoadPriority; import emu.lunarcore.data.common.ItemParam; import emu.lunarcore.game.drops.DropParam; import emu.lunarcore.game.enums.ItemMainType; -import emu.lunarcore.game.enums.ItemRarity; import emu.lunarcore.game.enums.ItemSubType; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -94,35 +93,66 @@ public class MappingInfoExcel extends GameResource { } else if (itemExcel.getItemMainType() == ItemMainType.Material) { // Calculate amount to drop by purpose level DropParam drop = switch (itemExcel.getPurposeType()) { - // Avatar exp. TODO drop rate is not correct - case 1 -> new DropParam(itemParam.getId(), 1); + // Avatar exp. Drop rate is guessed (with data) + case 1 -> { + // Calc amount + double amount = switch (itemExcel.getRarity()) { + case NotNormal -> getWorldLevel() < 3 ? getWorldLevel() + 3 : 2.5; + case Rare -> getWorldLevel() < 3 ? getWorldLevel() + 3 : (getWorldLevel() * 2) - 3; + default -> 1; + }; + + yield new DropParam(itemParam.getId(), amount); + } // Boss materials case 2 -> new DropParam(itemParam.getId(), this.getWorldLevel()); - // Trace materials. TODO drop rate is not correct + // Trace materials. Drop rate is guessed (with data) case 3 -> { var dropInfo = new DropParam(itemParam.getId(), 1); - if (itemExcel.getRarity() == ItemRarity.VeryRare) { - dropInfo.setChance((this.getWorldLevel() - 3) * 75); + switch (itemExcel.getRarity()) { + case NotNormal -> { + double amount = getWorldLevel() >= 1 && getWorldLevel() <= 3 ? 2.5 : 1.5; + dropInfo.setCount(amount); + } + case Rare -> { + dropInfo.setChance(Math.min((getWorldLevel() - 1) * 334, 1000)); + } + case VeryRare -> { + dropInfo.setChance((getWorldLevel() - 3) * 75); + } + default -> { + + } } yield dropInfo; } - // Boss Trace materials. TODO drop rate is not correct + // Boss Trace materials. Drop rate is guessed (with data) case 4 -> new DropParam(itemParam.getId(), (this.getWorldLevel() * 0.5) + 0.5); - // Lightcone exp. TODO drop rate is not correct - case 5 -> new DropParam(itemParam.getId(), 1); + // Lightcone exp. Drop rate is guessed (with data) + case 5 -> { + // Calc amount + double amount = switch (itemExcel.getRarity()) { + case NotNormal -> Math.max(5 - getWorldLevel(), 2.5); + case Rare -> (getWorldLevel() % 3) + 1; + default -> 1; + }; + + yield new DropParam(itemParam.getId(), amount); + } // Lucent afterglow case 11 -> new DropParam(itemParam.getId(), 4 + this.getWorldLevel()); // Unknown default -> null; }; + // Add to drop list if (drop != null) { dropList.add(drop); } } else if (itemExcel.getItemMainType() == ItemMainType.Equipment) { - // Lightcones + // Add lightcones equipmentDrops.add(itemParam.getId()); } } diff --git a/src/main/java/emu/lunarcore/game/drops/DropService.java b/src/main/java/emu/lunarcore/game/drops/DropService.java index f4c792d..f7fd787 100644 --- a/src/main/java/emu/lunarcore/game/drops/DropService.java +++ b/src/main/java/emu/lunarcore/game/drops/DropService.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import emu.lunarcore.GameConstants; -import emu.lunarcore.LunarCore; import emu.lunarcore.data.GameData; import emu.lunarcore.data.common.ItemParam; import emu.lunarcore.data.excel.ItemExcel; @@ -72,7 +71,6 @@ public class DropService extends BaseGameService { } // Create item and add it to player - int itemId = 0; ItemExcel excel = GameData.getItemExcelMap().get(entry.getIntKey()); if (excel == null) continue;