mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-14 14:24:37 +01:00
Fix equipping items on the trailblazer
This commit is contained in:
@@ -40,6 +40,11 @@ public class AvatarStorage extends BasePlayerManager implements Iterable<GameAva
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GameAvatar getAvatarById(int id) {
|
public GameAvatar getAvatarById(int id) {
|
||||||
|
// Check if we are trying to retrieve the hero character
|
||||||
|
if (GameData.getHeroExcelMap().containsKey(id)) {
|
||||||
|
id = GameConstants.TRAILBLAZER_AVATAR_ID;
|
||||||
|
}
|
||||||
|
|
||||||
return getAvatars().get(id);
|
return getAvatars().get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ public class GameItem {
|
|||||||
.setMainAffixId(this.mainAffix);
|
.setMainAffixId(this.mainAffix);
|
||||||
|
|
||||||
if (this.getEquipAvatar() != null) {
|
if (this.getEquipAvatar() != null) {
|
||||||
proto.setEquipAvatarId(this.getEquipAvatar().getAvatarId());
|
proto.setEquipAvatarId(this.getEquipAvatar().getExcel().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.subAffixes != null) {
|
if (this.subAffixes != null) {
|
||||||
@@ -316,7 +316,7 @@ public class GameItem {
|
|||||||
.setRank(this.getRank());
|
.setRank(this.getRank());
|
||||||
|
|
||||||
if (this.getEquipAvatar() != null) {
|
if (this.getEquipAvatar() != null) {
|
||||||
proto.setEquipAvatarId(this.getEquipAvatar().getAvatarId());
|
proto.setEquipAvatarId(this.getEquipAvatar().getExcel().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
return proto;
|
return proto;
|
||||||
|
|||||||
@@ -564,7 +564,7 @@ public class Inventory extends BasePlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean unequipItem(int avatarId, int slot) {
|
public boolean unequipItem(int avatarId, int slot) {
|
||||||
GameAvatar avatar = getPlayer().getAvatars().getAvatarById(avatarId);
|
GameAvatar avatar = getPlayer().getAvatarById(avatarId);
|
||||||
|
|
||||||
if (avatar != null) {
|
if (avatar != null) {
|
||||||
GameItem unequipped = avatar.unequipItem(slot);
|
GameItem unequipped = avatar.unequipItem(slot);
|
||||||
|
|||||||
@@ -328,11 +328,6 @@ public class Player implements Tickable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GameAvatar getAvatarById(int avatarId) {
|
public GameAvatar getAvatarById(int avatarId) {
|
||||||
// Check if we are trying to retrieve the hero character
|
|
||||||
if (GameData.getHeroExcelMap().containsKey(avatarId)) {
|
|
||||||
avatarId = GameConstants.TRAILBLAZER_AVATAR_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getAvatars().getAvatarById(avatarId);
|
return getAvatars().getAvatarById(avatarId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user