mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-12 21:34:35 +01:00
Prevent the player from adding more than 1 of the same avatar if they had multiple paths
This commit is contained in:
@@ -5,7 +5,6 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
import org.bson.types.ObjectId;
|
import org.bson.types.ObjectId;
|
||||||
|
|
||||||
import emu.lunarcore.GameConstants;
|
|
||||||
import emu.lunarcore.LunarCore;
|
import emu.lunarcore.LunarCore;
|
||||||
import emu.lunarcore.data.GameData;
|
import emu.lunarcore.data.GameData;
|
||||||
import emu.lunarcore.data.excel.AvatarExcel;
|
import emu.lunarcore.data.excel.AvatarExcel;
|
||||||
@@ -91,9 +90,17 @@ public class AvatarStorage extends BasePlayerManager implements Iterable<GameAva
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dont add more than 1 main character
|
// Check if avatar has multiple paths
|
||||||
if (avatar.isHero() && this.hasAvatar(GameConstants.TRAILBLAZER_AVATAR_ID)) {
|
var pathExcel = GameData.getMultiplePathAvatarExcelMap().get(avatar.getAvatarId());
|
||||||
return false;
|
if (pathExcel != null) {
|
||||||
|
if (pathExcel.isDefault()) {
|
||||||
|
// Apply path to avatar
|
||||||
|
var path = this.getMultiPathById(avatar.getAvatarId());
|
||||||
|
avatar.setMultiPath(path);
|
||||||
|
} else {
|
||||||
|
// Skip if not a default path
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set owner first
|
// Set owner first
|
||||||
|
|||||||
@@ -85,13 +85,6 @@ public class GameAvatar implements GameEntity, IAvatar {
|
|||||||
this.setExcel(excel);
|
this.setExcel(excel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameAvatar(AvatarMultiPath path) {
|
|
||||||
this();
|
|
||||||
this.avatarId = GameConstants.TRAILBLAZER_AVATAR_ID;
|
|
||||||
this.timestamp = System.currentTimeMillis() / 1000;
|
|
||||||
this.setMultiPath(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Scene getScene() {
|
public Scene getScene() {
|
||||||
return this.getOwner().getScene();
|
return this.getOwner().getScene();
|
||||||
|
|||||||
Reference in New Issue
Block a user