mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-19 17:19:58 +02:00
Implement ascension skin change
This commit is contained in:
@@ -17,9 +17,13 @@ import emu.nebula.database.GameDatabaseObject;
|
|||||||
import emu.nebula.game.inventory.ItemParamMap;
|
import emu.nebula.game.inventory.ItemParamMap;
|
||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.player.PlayerChangeInfo;
|
import emu.nebula.game.player.PlayerChangeInfo;
|
||||||
|
import emu.nebula.net.NetMsgId;
|
||||||
|
import emu.nebula.proto.Notify.Skin;
|
||||||
|
import emu.nebula.proto.Notify.SkinChange;
|
||||||
import emu.nebula.proto.Public.Char;
|
import emu.nebula.proto.Public.Char;
|
||||||
import emu.nebula.proto.Public.CharGemPreset;
|
import emu.nebula.proto.Public.CharGemPreset;
|
||||||
import emu.nebula.proto.Public.CharGemSlot;
|
import emu.nebula.proto.Public.CharGemSlot;
|
||||||
|
import emu.nebula.proto.Public.UI32;
|
||||||
import emu.nebula.proto.PublicStarTower.StarTowerChar;
|
import emu.nebula.proto.PublicStarTower.StarTowerChar;
|
||||||
import emu.nebula.proto.PublicStarTower.StarTowerCharGem;
|
import emu.nebula.proto.PublicStarTower.StarTowerCharGem;
|
||||||
import emu.nebula.util.Bitset;
|
import emu.nebula.util.Bitset;
|
||||||
@@ -191,6 +195,22 @@ public class Character implements GameDatabaseObject {
|
|||||||
// Add advance level
|
// Add advance level
|
||||||
this.advance++;
|
this.advance++;
|
||||||
|
|
||||||
|
// Check if we need to add skin
|
||||||
|
if (this.getAdvance() == this.getData().getAdvanceSkinUnlockLevel()) {
|
||||||
|
// Set advance skin
|
||||||
|
this.skin = this.getData().getAdvanceSkinId();
|
||||||
|
|
||||||
|
// Send packets
|
||||||
|
this.getPlayer().addNextPackage(
|
||||||
|
NetMsgId.character_skin_gain_notify,
|
||||||
|
Skin.newInstance().setNew(UI32.newInstance().setValue(this.getSkin()))
|
||||||
|
);
|
||||||
|
this.getPlayer().addNextPackage(
|
||||||
|
NetMsgId.character_skin_change_notify,
|
||||||
|
SkinChange.newInstance().setCharId(this.getCharId()).setSkinId(this.getSkin())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Save to database
|
// Save to database
|
||||||
this.save();
|
this.save();
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,11 @@ import emu.nebula.Nebula;
|
|||||||
import emu.nebula.data.GameData;
|
import emu.nebula.data.GameData;
|
||||||
import emu.nebula.database.GameDatabaseObject;
|
import emu.nebula.database.GameDatabaseObject;
|
||||||
import emu.nebula.game.player.PlayerManager;
|
import emu.nebula.game.player.PlayerManager;
|
||||||
|
import emu.nebula.net.NetMsgId;
|
||||||
|
import emu.nebula.proto.Notify.Skin;
|
||||||
import emu.nebula.proto.Public.Item;
|
import emu.nebula.proto.Public.Item;
|
||||||
import emu.nebula.proto.Public.Res;
|
import emu.nebula.proto.Public.Res;
|
||||||
|
import emu.nebula.proto.Public.UI32;
|
||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.player.PlayerChangeInfo;
|
import emu.nebula.game.player.PlayerChangeInfo;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
@@ -129,6 +132,12 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
|
|||||||
|
|
||||||
// Save to database
|
// Save to database
|
||||||
Nebula.getGameDatabase().addToList(this, this.getUid(), "extraSkins", id);
|
Nebula.getGameDatabase().addToList(this, this.getUid(), "extraSkins", id);
|
||||||
|
|
||||||
|
// Send packet
|
||||||
|
this.getPlayer().addNextPackage(
|
||||||
|
NetMsgId.character_skin_gain_notify,
|
||||||
|
Skin.newInstance().setNew(UI32.newInstance().setValue(id))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntCollection getAllHeadIcons() {
|
public IntCollection getAllHeadIcons() {
|
||||||
|
|||||||
Reference in New Issue
Block a user