mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-16 15:24:44 +01:00
Fix incorrect consumable buff count
This commit is contained in:
@@ -12,6 +12,7 @@ public class ItemUseExcel extends GameResource {
|
|||||||
private int UseDataID;
|
private int UseDataID;
|
||||||
private int ConsumeType;
|
private int ConsumeType;
|
||||||
private int MazeBuffID;
|
private int MazeBuffID;
|
||||||
|
private int ActivityCount;
|
||||||
|
|
||||||
private double PreviewHPRecoveryPercent;
|
private double PreviewHPRecoveryPercent;
|
||||||
private int PreviewHPRecoveryValue;
|
private int PreviewHPRecoveryValue;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class ItemUseHandler {
|
|||||||
|
|
||||||
// Add food buff to player
|
// Add food buff to player
|
||||||
if (excel.getConsumeType() == 1 || excel.getConsumeType() == 2) {
|
if (excel.getConsumeType() == 1 || excel.getConsumeType() == 2) {
|
||||||
player.addFoodBuff(excel.getConsumeType(), excel.getMazeBuffID());
|
player.addFoodBuff(excel.getConsumeType(), excel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO send buff refresh packet
|
// TODO send buff refresh packet
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import emu.lunarcore.data.GameData;
|
|||||||
import emu.lunarcore.data.config.AnchorInfo;
|
import emu.lunarcore.data.config.AnchorInfo;
|
||||||
import emu.lunarcore.data.config.FloorInfo;
|
import emu.lunarcore.data.config.FloorInfo;
|
||||||
import emu.lunarcore.data.config.PropInfo;
|
import emu.lunarcore.data.config.PropInfo;
|
||||||
|
import emu.lunarcore.data.excel.ItemUseExcel;
|
||||||
import emu.lunarcore.data.excel.MapEntranceExcel;
|
import emu.lunarcore.data.excel.MapEntranceExcel;
|
||||||
import emu.lunarcore.data.excel.MazePlaneExcel;
|
import emu.lunarcore.data.excel.MazePlaneExcel;
|
||||||
import emu.lunarcore.game.account.Account;
|
import emu.lunarcore.game.account.Account;
|
||||||
@@ -551,13 +552,14 @@ public class Player implements Tickable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean addFoodBuff(int type, int mazeBuffId) {
|
public synchronized boolean addFoodBuff(int type, ItemUseExcel itemUseExcel) {
|
||||||
// Get maze excel
|
// Get maze excel
|
||||||
var excel = GameData.getMazeBuffExcel(mazeBuffId, 1);
|
var excel = GameData.getMazeBuffExcel(itemUseExcel.getMazeBuffID(), 1);
|
||||||
if (excel == null) return false;
|
if (excel == null) return false;
|
||||||
|
|
||||||
// Create new buff
|
// Create new buff
|
||||||
var buff = new SceneBuff(mazeBuffId);
|
var buff = new SceneBuff(itemUseExcel.getMazeBuffID());
|
||||||
|
buff.setCount(Math.max(itemUseExcel.getActivityCount(), 1));
|
||||||
|
|
||||||
int avatarEntityId = getCurrentLeaderAvatar().getEntityId();
|
int avatarEntityId = getCurrentLeaderAvatar().getEntityId();
|
||||||
var oldBuff = this.getFoodBuffs().put(type, buff);
|
var oldBuff = this.getFoodBuffs().put(type, buff);
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ package emu.lunarcore.game.scene;
|
|||||||
|
|
||||||
import emu.lunarcore.proto.BuffInfoOuterClass.BuffInfo;
|
import emu.lunarcore.proto.BuffInfoOuterClass.BuffInfo;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class SceneBuff {
|
public class SceneBuff {
|
||||||
private int casterAvatarId; // Owner avatar id
|
private int casterAvatarId; // Owner avatar id
|
||||||
private int buffId;
|
private int buffId;
|
||||||
private int buffLevel;
|
private int buffLevel;
|
||||||
private int count;
|
@Setter private int count;
|
||||||
|
|
||||||
private float duration;
|
private float duration;
|
||||||
private long createTime;
|
private long createTime;
|
||||||
private long expiry;
|
private long expiry;
|
||||||
|
|||||||
Reference in New Issue
Block a user