Files
Nebula/src/main/java/emu/nebula/game/character/CharacterGemPreset.java
Melledy 495e76a456 Added command to set a trekker's emblem stats
Usage:
`!e [character id] [slot id - this is between 1 and 3] [attr 1] [attr 2] [attr 3] [attr 4]`

Example:
`!e 141 1 1004 1004 1004 1004` = Sets the first emblem of the character to all +ignis damage.

Notes:
Attribute ids can be found in `CharGemAttrValue.json` in the resources/bin folder.
2025-12-19 01:18:37 -08:00

65 lines
1.4 KiB
Java

package emu.nebula.game.character;
import dev.morphia.annotations.Entity;
import emu.nebula.proto.Public.CharGemPreset;
import lombok.Getter;
@Getter
@Entity(useDiscriminator = false)
public class CharacterGemPreset {
private String name;
private int[] gems;
@Deprecated // Morphia only
public CharacterGemPreset() {
}
public CharacterGemPreset(GameCharacter character) {
this.gems = new int[] {-1, -1, -1};
}
public void setName(String name) {
this.name = name;
}
public int getLength() {
return this.getGems().length;
}
public int getGemIndex(int slotId) {
int slotIndex = slotId - 1;
if (slotIndex < 0 || slotIndex >= this.getLength()) {
return -1;
}
return this.getGems()[slotIndex];
}
public boolean setGemIndex(int slotId, int gemIndex) {
int slotIndex = slotId - 1;
if (slotIndex < 0 || slotIndex >= this.getLength()) {
return false;
}
this.getGems()[slotIndex] = gemIndex;
return true;
}
// Proto
public CharGemPreset toProto() {
var proto = CharGemPreset.newInstance()
.addAllSlotGem(this.getGems());
if (this.getName() != null) {
proto.setName(this.getName());
}
return proto;
}
}