mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-09 04:13:00 +08:00
dungeon drop implementation (#2215)
* dungeon drop implementation * Update src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com> --------- Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
This commit is contained in:
parent
06d5bf7098
commit
4ebe6fbf63
@ -32,6 +32,7 @@ public class DungeonData extends GameResource {
|
||||
@Getter private int passRewardPreviewID;
|
||||
@Getter private int statueCostID;
|
||||
@Getter private int statueCostCount;
|
||||
@Getter private int statueDrop;
|
||||
|
||||
// not part of DungeonExcelConfigData
|
||||
@Getter private RewardPreviewData rewardPreviewData;
|
||||
|
@ -80,6 +80,14 @@ public final class DropSystem extends BaseGameSystem {
|
||||
return dropData.getDropId();
|
||||
}
|
||||
|
||||
public List<GameItem> handleDungeonRewardDrop(int dropId, boolean doubleReward) {
|
||||
if (!dropTable.containsKey(dropId)) return List.of();
|
||||
var dropData = dropTable.get(dropId);
|
||||
List<GameItem> items = new ArrayList<>();
|
||||
processDrop(dropData, doubleReward ? 2 : 1, items);
|
||||
return items;
|
||||
}
|
||||
|
||||
public boolean handleMonsterDrop(EntityMonster monster) {
|
||||
int dropId;
|
||||
int level = monster.getLevel();
|
||||
|
@ -134,7 +134,12 @@ public final class DungeonManager {
|
||||
}
|
||||
|
||||
// Get and roll rewards.
|
||||
List<GameItem> rewards = new ArrayList<>(this.rollRewards(useCondensed));
|
||||
List<GameItem> rewards = player.getServer().getDropSystem().handleDungeonRewardDrop(dungeonData.getStatueDrop(), useCondensed);
|
||||
if (rewards.isEmpty()) {
|
||||
//fallback to legacy drop system
|
||||
Grasscutter.getLogger().debug("dungeon drop failed for {}", dungeonData.getId());
|
||||
rewards = new ArrayList<>(this.rollRewards(useCondensed));
|
||||
}
|
||||
// Add rewards to player and send notification.
|
||||
player.getInventory().addItems(rewards, ActionReason.DungeonStatueDrop);
|
||||
player.sendPacket(new PacketGadgetAutoPickDropInfoNotify(rewards));
|
||||
@ -187,7 +192,7 @@ public final class DungeonManager {
|
||||
amount += Utils.drawRandomListElement(candidateAmounts, entry.getProbabilities());
|
||||
}
|
||||
|
||||
// Double rewards in multiplay mode, if specified.
|
||||
// Double rewards in multiply mode, if specified.
|
||||
if (entry.isMpDouble() && this.getScene().getPlayerCount() > 1) {
|
||||
amount *= 2;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package emu.grasscutter.game.entity.gadget;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.game.dungeons.challenge.DungeonChallenge;
|
||||
import emu.grasscutter.game.entity.EntityGadget;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
|
Loading…
Reference in New Issue
Block a user