mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-19 17:19:58 +02:00
Add skins to the giveall command
Example usage: `!giveall skins` Description: Gives all non-basic/non-ascension skins for trekkers owned by the target player. Requires handbook generation to be enabled.
This commit is contained in:
@@ -13,6 +13,7 @@ import emu.nebula.game.inventory.ItemSubType;
|
|||||||
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.net.NetMsgId;
|
||||||
|
import emu.nebula.proto.Public.Item;
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
label = "giveall",
|
label = "giveall",
|
||||||
@@ -67,7 +68,7 @@ public class GiveAllCommand implements CommandHandler {
|
|||||||
// Send message
|
// Send message
|
||||||
message.append("Giving " + target.getName() + " " + items.size() + " items.\n");
|
message.append("Giving " + target.getName() + " " + items.size() + " items.\n");
|
||||||
}
|
}
|
||||||
case "d", "discs" -> {
|
case "d", "disc", "discs" -> {
|
||||||
// Get all discs
|
// Get all discs
|
||||||
for (var data : GameData.getDiscDataTable()) {
|
for (var data : GameData.getDiscDataTable()) {
|
||||||
// Skip unavailable discs
|
// Skip unavailable discs
|
||||||
@@ -97,7 +98,7 @@ public class GiveAllCommand implements CommandHandler {
|
|||||||
// Send message
|
// Send message
|
||||||
message.append("Giving " + target.getName() + " all discs.\n");
|
message.append("Giving " + target.getName() + " all discs.\n");
|
||||||
}
|
}
|
||||||
case "c", "characters", "trekkers", "t" -> {
|
case "c", "char", "characters", "trekkers", "t" -> {
|
||||||
// Get all characters
|
// Get all characters
|
||||||
for (var data : GameData.getCharacterDataTable()) {
|
for (var data : GameData.getCharacterDataTable()) {
|
||||||
// Skip unavailable characters
|
// Skip unavailable characters
|
||||||
@@ -127,6 +128,40 @@ public class GiveAllCommand implements CommandHandler {
|
|||||||
// Send message
|
// Send message
|
||||||
message.append("Giving " + target.getName() + " all characters.\n");
|
message.append("Giving " + target.getName() + " all characters.\n");
|
||||||
}
|
}
|
||||||
|
case "skin", "skins" -> {
|
||||||
|
// Skins count
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
// Get all paid skins
|
||||||
|
for (var data : GameData.getCharacterSkinDataTable()) {
|
||||||
|
// Skip basic/ascension skins
|
||||||
|
if (data.getType() != 3) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure player has the character the skin is for
|
||||||
|
if (!target.getCharacters().hasCharacter(data.getCharId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure skin is released
|
||||||
|
if (!data.isReleased()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add skin for player, will return true if we successfully added the skin
|
||||||
|
if (target.getInventory().addSkin(data.getId())) {
|
||||||
|
// Increment counter
|
||||||
|
count++;
|
||||||
|
|
||||||
|
// Add change info
|
||||||
|
change.add(Item.newInstance().setId(data.getId()).setQty(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send message
|
||||||
|
message.append("Giving " + count + " skins.\n");
|
||||||
|
}
|
||||||
default -> {
|
default -> {
|
||||||
// Ignored
|
// Ignored
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package emu.nebula.data.resources;
|
|||||||
import emu.nebula.data.BaseDef;
|
import emu.nebula.data.BaseDef;
|
||||||
import emu.nebula.data.ResourceType;
|
import emu.nebula.data.ResourceType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ResourceType(name = "CharacterSkin.json")
|
@ResourceType(name = "CharacterSkin.json")
|
||||||
@@ -11,6 +12,9 @@ public class CharacterSkinDef extends BaseDef {
|
|||||||
private int CharId;
|
private int CharId;
|
||||||
private int Type;
|
private int Type;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
private transient boolean released;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return Id;
|
return Id;
|
||||||
|
|||||||
@@ -77,6 +77,14 @@ public class Handbook {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hacky way of checking if a skin is released or not
|
||||||
|
if (data.getItemType() == ItemType.CharacterSkin) {
|
||||||
|
var skinData = GameData.getCharacterSkinDataTable().get(id);
|
||||||
|
if (skinData != null) {
|
||||||
|
skinData.setReleased(itemLanguageKey.containsKey(data.getTitle()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
writer.println("");
|
writer.println("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user