mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-12 20:34:36 +01:00
Implement adding titles
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user