fix exp drop issue

This commit is contained in:
Kengxxiao
2022-04-28 20:47:18 +08:00
committed by Melledy
parent a5601e8409
commit ed98ab152d
3 changed files with 43 additions and 33 deletions

View File

@@ -168,7 +168,7 @@ public class Inventory implements Iterable<GameItem> {
} else if (type == ItemType.ITEM_VIRTUAL) {
// Handle
this.addVirtualItem(item.getItemId(), item.getCount());
return null;
return item;
} else if (item.getItemData().getMaterialType() == MaterialType.MATERIAL_AVATAR) {
// Get avatar id
int avatarId = (item.getItemId() % 1000) + 10000000;
@@ -236,9 +236,7 @@ public class Inventory implements Iterable<GameItem> {
private void addVirtualItem(int itemId, int count) {
switch (itemId) {
case 101: // Character exp
for (EntityAvatar entity : getPlayer().getTeamManager().getActiveTeam()) {
getPlayer().getServer().getInventoryManager().upgradeAvatar(player, entity.getAvatar(), count);
}
getPlayer().getServer().getInventoryManager().upgradeAvatar(player, getPlayer().getTeamManager().getCurrentAvatarEntity().getAvatar(), count);
break;
case 102: // Adventure exp
getPlayer().addExpDirectly(count);