Implement adding titles

This commit is contained in:
Melledy
2025-11-07 19:36:17 -08:00
parent 5ddfbd89e5
commit 8d772b3365

View File

@@ -13,6 +13,7 @@ import emu.nebula.net.NetMsgId;
import emu.nebula.proto.Notify.Skin;
import emu.nebula.proto.Public.Item;
import emu.nebula.proto.Public.Res;
import emu.nebula.proto.Public.Title;
import emu.nebula.proto.Public.UI32;
import emu.nebula.game.player.Player;
import emu.nebula.game.player.PlayerChangeInfo;
@@ -373,6 +374,31 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
this.addSkin(id);
}
}
case Title -> {
// Cannot remove titles
if (amount <= 0) {
break;
}
// Get title data
if (data.getTitleData() == null) {
break;
}
int titleId = data.getTitleData().getId();
// Make sure we don't already have this title
if (!this.getTitles().contains(titleId)) {
// Add title
this.addTitle(titleId);
// Add to change info
var proto = Title.newInstance()
.setTitleId(titleId);
change.add(proto);
}
}
default -> {
// Not implemented
}