mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-12 20:34:36 +01:00
Randomize daily shop gift
This commit is contained in:
@@ -2,6 +2,9 @@ package emu.nebula;
|
||||
|
||||
import java.time.ZoneId;
|
||||
|
||||
import emu.nebula.game.inventory.ItemParam;
|
||||
import emu.nebula.util.WeightedList;
|
||||
|
||||
public class GameConstants {
|
||||
private static final int DATA_VERSION = 48;
|
||||
private static final String VERSION = "1.2.0";
|
||||
@@ -34,6 +37,16 @@ public class GameConstants {
|
||||
public static final int MAX_FRIENDSHIPS = 50;
|
||||
public static final int MAX_PENDING_FRIENDSHIPS = 30;
|
||||
|
||||
// Daily gifts (Custom)
|
||||
|
||||
public static final WeightedList<ItemParam> DAILY_GIFTS = new WeightedList<>();
|
||||
|
||||
static {
|
||||
DAILY_GIFTS.add(1000, new ItemParam(GOLD_ITEM_ID, 8888));
|
||||
DAILY_GIFTS.add(250, new ItemParam(GOLD_ITEM_ID, 18888));
|
||||
DAILY_GIFTS.add(10, new ItemParam(GEM_ITEM_ID, 50));
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
|
||||
public static String getGameVersion() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.Map;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
|
||||
import emu.nebula.GameConstants;
|
||||
import emu.nebula.Nebula;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.data.resources.WorldClassDef;
|
||||
@@ -297,8 +297,8 @@ public class QuestManager extends PlayerManager implements GameDatabaseObject {
|
||||
}
|
||||
|
||||
// Daily shop reward
|
||||
// TODO randomize
|
||||
var change = this.getPlayer().getInventory().addItem(1, 8888);
|
||||
var reward = GameConstants.DAILY_GIFTS.next();
|
||||
var change = this.getPlayer().getInventory().addItem(reward.getId(), reward.getCount());
|
||||
|
||||
// Set and update in database
|
||||
this.hasDailyReward = false;
|
||||
|
||||
Reference in New Issue
Block a user