mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 22:04:36 +01:00
Add basic drops for opening chests
This commit is contained in:
@@ -15,8 +15,6 @@ public class GameConstants {
|
|||||||
public static final String DEFAULT_NAME = "Trailblazer";
|
public static final String DEFAULT_NAME = "Trailblazer";
|
||||||
public static final int TRAILBLAZER_AVATAR_ID = 8001;
|
public static final int TRAILBLAZER_AVATAR_ID = 8001;
|
||||||
public static final int MAX_TRAILBLAZER_LEVEL = 70;
|
public static final int MAX_TRAILBLAZER_LEVEL = 70;
|
||||||
public static final int MATERIAL_HCOIN_ID = 1; // Material id for jades. DO NOT CHANGE
|
|
||||||
public static final int MATERIAL_COIN_ID = 2; // Material id for credits. DO NOT CHANGE
|
|
||||||
public static final int MAX_STAMINA = 240;
|
public static final int MAX_STAMINA = 240;
|
||||||
public static final int MAX_STAMINA_RESERVE = 2400;
|
public static final int MAX_STAMINA_RESERVE = 2400;
|
||||||
public static final int MAX_AVATARS_IN_TEAM = 4;
|
public static final int MAX_AVATARS_IN_TEAM = 4;
|
||||||
@@ -30,6 +28,10 @@ public class GameConstants {
|
|||||||
public static final int START_ENTRY_ID = 2000101;
|
public static final int START_ENTRY_ID = 2000101;
|
||||||
public static final Position START_POS = new Position(99, 62, -4800);
|
public static final Position START_POS = new Position(99, 62, -4800);
|
||||||
|
|
||||||
|
public static final int MATERIAL_HCOIN_ID = 1; // Material id for jades. DO NOT CHANGE
|
||||||
|
public static final int MATERIAL_COIN_ID = 2; // Material id for credits. DO NOT CHANGE
|
||||||
|
public static final int TRAILBLAZER_EXP_ID = 22;
|
||||||
|
|
||||||
// Challenge
|
// Challenge
|
||||||
public static final int CHALLENGE_ENTRANCE = 100000103;
|
public static final int CHALLENGE_ENTRANCE = 100000103;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package emu.lunarcore.game.drops;
|
package emu.lunarcore.game.drops;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import emu.lunarcore.GameConstants;
|
||||||
import emu.lunarcore.data.GameData;
|
import emu.lunarcore.data.GameData;
|
||||||
import emu.lunarcore.data.common.ItemParam;
|
import emu.lunarcore.data.common.ItemParam;
|
||||||
import emu.lunarcore.game.battle.Battle;
|
import emu.lunarcore.game.battle.Battle;
|
||||||
@@ -56,4 +60,15 @@ public class DropService extends BaseGameService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO filler
|
||||||
|
public List<GameItem> calculateDropsFromProp(int propId) {
|
||||||
|
List<GameItem> drops = new ArrayList<>();
|
||||||
|
|
||||||
|
drops.add(new GameItem(GameConstants.MATERIAL_HCOIN_ID, 5));
|
||||||
|
drops.add(new GameItem(GameConstants.TRAILBLAZER_EXP_ID, 5));
|
||||||
|
drops.add(new GameItem(GameConstants.MATERIAL_COIN_ID, Utils.randomRange(20, 100)));
|
||||||
|
|
||||||
|
return drops;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -413,7 +413,10 @@ public class Player {
|
|||||||
if (prop.getState() == PropState.ChestClosed) {
|
if (prop.getState() == PropState.ChestClosed) {
|
||||||
// Open chest
|
// Open chest
|
||||||
prop.setState(PropState.ChestUsed);
|
prop.setState(PropState.ChestUsed);
|
||||||
// TODO handle drops
|
// Handle drops
|
||||||
|
var drops = this.getServer().getDropService().calculateDropsFromProp(prop.getPropId());
|
||||||
|
this.getInventory().addItems(drops, true);
|
||||||
|
// Done
|
||||||
return prop;
|
return prop;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user