Code:
package tld.removed.old.fs.archive.config.build;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import tld.removed.old.fs.archive.build.ConfigBuilder;
import tld.removed.old.fs.archive.config.ItemDefinition;
/**
* A {@link ConfigBuilder} for {@link ItemDefinition}s.
*
* @author Major
*/
public final class ItemDefinitionBuilder extends ConfigBuilder<ItemDefinition> {
/**
* The default equipment model ids.
*/
protected static final List<Integer> DEFAULT_EQUIP_IDS = Arrays.asList(-1, -1, -1);
/**
* The default ground scale values.
*/
protected static final List<Integer> DEFAULT_GROUND_SCALES = Arrays.asList(128, 128, 128);
/**
* The default head piece ids.
*/
protected static final List<Integer> DEFAULT_HEAD_PIECES = Arrays.asList(-1, -1);
/**
* The description of this item.
*/
protected String description = "null";
/**
* The female primary, secondary, and tertiary equipment ids of this item.
*/
protected List<Integer> femaleEquipIds = new ArrayList<>(DEFAULT_EQUIP_IDS);
/**
* The y-translation for the female equipment piece of this item.
*/
protected int femaleEquipTranslation = 0;
/**
* The female head piece ids.
*/
protected List<Integer> femaleHeadPieces = new ArrayList<>(DEFAULT_HEAD_PIECES);
/**
* The ground menu actions of this item.
*/
protected List<String> groundMenuActions = new ArrayList<>(5);
/**
* The x, y, and z ground scale values of this item.
*/
protected List<Integer> groundScales = new ArrayList<>(DEFAULT_GROUND_SCALES);
/**
* The inventory menu actions of this item.
*/
protected List<String> inventoryMenuActions = new ArrayList<>(5);
/**
* The light ambience of this item.
*/
protected int lightAmbience = 0;
/**
* The light diffusion of this item.
*/
protected int lightDiffusion = 0;
/**
* The male primary, secondary, and tertiary equipment ids of this item.
*/
protected List<Integer> maleEquipIds = new ArrayList<>(DEFAULT_EQUIP_IDS);
/**
* The y-translation for the male equipment piece of this item.
*/
protected int maleEquipTranslation = 0;
/**
* The male head piece ids.
*/
protected List<Integer> maleHeadPieces = new ArrayList<>(DEFAULT_HEAD_PIECES);
/**
* The members flag of this item.
*/
protected boolean members = false;
/**
* The id of this item's model.
*/
protected int modelId = 0;
/**
* The name of this item.
*/
protected String name = "null";
/**
* The note info id of this item.
*/
protected int noteInfoId = -1;
/**
* The note template id of this item.
*/
protected int noteTemplateId = -1;
/**
* The map of original model colours to replacement colours for this item.
*/
protected Map<Integer, Integer> replacementColours = new HashMap<>(3);
/**
* The camera roll of this item's sprite.
*/
protected int spriteCameraRoll = 0;
/**
* The sprite camera yaw of this item.
*/
protected int spriteCameraYaw = 0;
/**
* The pitch of this item's sprite.
*/
protected int spritePitch = 0;
/**
* The scale of this item's sprite.
*/
protected int spriteScale = 2000;
/**
* The x-translation of this item's sprite.
*/
protected int spriteTranslateX = 0;
/**
* The y-translation of this item's sprite.
*/
protected int spriteTranslateY = 0;
/**
* The stackable flag of this item.
*/
protected boolean stackable = false;
/**
* The stack amounts of this item.
*/
protected List<Integer> stackAmounts = new ArrayList<>();
/**
* The stack model ids of this item.
*/
protected List<Integer> stackModelIds = new ArrayList<>();
/**
* The team id of this item.
*/
protected int team = 0;
/**
* The value of this item.
*/
protected int value = 1;
/**
* Creates the item definition builder.
*
* @param id The id of the item.
*/
protected ItemDefinitionBuilder(int id) {
super(id);
}
/**
* Builds and returns {@link ItemDefinition}.
*
* @return The item definition.
*/
@Override
public ItemDefinition build() {
return new ItemDefinition(description, femaleEquipIds, femaleEquipTranslation, femaleHeadPieces,
groundMenuActions, groundScales, id, inventoryMenuActions, lightAmbience, lightDiffusion, maleEquipIds,
maleEquipTranslation, maleHeadPieces, members, modelId, name, noteInfoId, noteTemplateId,
replacementColours, spriteCameraRoll, spriteCameraYaw, spritePitch, spriteScale, spriteTranslateX,
spriteTranslateY, stackable, stackAmounts, stackModelIds, team, value);
}
/**
* Sets the description of this item.
*
* @param description The description.
*/
public final void setDescription(String description) {
this.description = description;
}
/**
* Sets a female equip id of this item.
*
* @param index The index.
* @param femaleEquipId The female equip id.
*/
public final void setFemaleEquipId(int index, int femaleEquipId) {
femaleEquipIds.add(femaleEquipId);
}
/**
* Sets the female equip translation of this item.
*
* @param femaleEquipTranslation The female equip translation.
*/
public final void setFemaleEquipTranslation(int femaleEquipTranslation) {
this.femaleEquipTranslation = femaleEquipTranslation;
}
/**
* Sets a ground scale value. TODO use an enum for direction.
*
* @param direction The direction.
* @param scale The scale.
*/
public final void setGroundScale(int direction, int scale) {
groundScales.add(scale);
}
/**
* Sets a female head piece of the item.
*
* @param index The index
* @param femaleHeadPiece The female head piece.
*/
public final void setFemaleHeadPiece(int index, int femaleHeadPiece) {
femaleHeadPieces.add(femaleHeadPiece);
}
/**
* Sets the ground menu action at the specified index.
*
* @param index The index.
* @param action The action string.
*/
public final void setGroundAction(int index, String action) {
groundMenuActions.add(action);
}
/**
* Sets the inventory menu action at the specified index.
*
* @param index The action index.
* @param action The action string.
*/
public final void setInventoryAction(int index, String action) {
inventoryMenuActions.add(action);
}
/**
* Sets the light ambience of this item.
*
* @param lightAmbience The light ambience.
*/
public final void setLightAmbience(int lightAmbience) {
this.lightAmbience = lightAmbience;
}
/**
* Sets the light diffusion of this item.
*
* @param lightDiffusion The light diffusion.
*/
public final void setLightDiffusion(int lightDiffusion) {
this.lightDiffusion = lightDiffusion;
}
/**
* Sets a male equip id of this item.
*
* @param index The index.
* @param maleEquipId The male equip id.
*/
public final void setMaleEquipId(int index, int maleEquipId) {
maleEquipIds.add(maleEquipId);
}
/**
* Sets the male equip translation of this item.
*
* @param maleEquipTranslation The male equip translation.
*/
public final void setMaleEquipTranslation(int maleEquipTranslation) {
this.maleEquipTranslation = maleEquipTranslation;
}
/**
* Sets a male head piece of the item.
*
* @param maleHeadPiece The male head piece.
*/
public final void setMaleHeadPiece(int index, int maleHeadPiece) {
maleHeadPieces.add(maleHeadPiece);
}
/**
* Sets the members flag of this item.
*
* @param members The members flag.
*/
public final void setMembers(boolean members) {
this.members = members;
}
/**
* Sets the model id of this item.
*
* @param modelId The model id.
*/
public final void setModelId(int modelId) {
this.modelId = modelId;
}
/**
* Sets the name of this item.
*
* @param name The name.
*/
public final void setName(String name) {
this.name = name;
}
/**
* Sets the note info id of this item.
*
* @param noteInfoId The note info id.
*/
public final void setNoteInfoId(int noteInfoId) {
this.noteInfoId = noteInfoId;
}
/**
* Sets the note template id of this item.
*
* @param noteTemplateId The note template id.
*/
public final void setNoteTemplateId(int noteTemplateId) {
this.noteTemplateId = noteTemplateId;
}
/**
* Sets the replacement model colours of this item.
*
* @param replacementColours The replacement model colours.
*/
public final void setReplacementColours(Map<Integer, Integer> replacementColours) {
this.replacementColours = replacementColours;
}
/**
* Sets the sprite camera roll of this item.
*
* @param spriteCameraRoll The sprite camera roll.
*/
public final void setSpriteCameraRoll(int spriteCameraRoll) {
this.spriteCameraRoll = spriteCameraRoll;
}
/**
* Sets the sprite camera yaw of this item.
*
* @param spriteCameraYaw The sprite camera yaw.
*/
public final void setSpriteCameraYaw(int spriteCameraYaw) {
this.spriteCameraYaw = spriteCameraYaw;
}
/**
* Sets the sprite pitch of this item.
*
* @param spritePitch The sprite pitch.
*/
public final void setSpritePitch(int spritePitch) {
this.spritePitch = spritePitch;
}
/**
* Sets the sprite scale of this item.
*
* @param spriteScale The sprite scale.
*/
public final void setSpriteScale(int spriteScale) {
this.spriteScale = spriteScale;
}
/**
* Sets the sprite x translation of this item.
*
* @param spriteTranslateX The sprite x translation.
*/
public final void setSpriteTranslateX(int spriteTranslateX) {
this.spriteTranslateX = spriteTranslateX;
}
/**
* Sets the sprite y translation of this item.
*
* @param spriteTranslateY The sprite y translation.
*/
public final void setSpriteTranslateY(int spriteTranslateY) {
this.spriteTranslateY = spriteTranslateY;
}
/**
* Sets the stackable flag of this item.
*
* @param stackable The stackable flag.
*/
public final void setStackable(boolean stackable) {
this.stackable = stackable;
}
/**
* Sets a stack amount of this item.
*
* @param index The index.
* @param stackAmount The stack amount.
*/
public final void setStackAmount(int index, int stackAmount) {
stackAmounts.add(stackAmount);
}
/**
* Sets a stack model id of this item.
*
* @param index The index.
* @param stackModelId The stack model id.
*/
public final void setStackModelIds(int index, int stackModelId) {
stackModelIds.add(stackModelId);
}
/**
* Sets the team of this item.
*
* @param team The team.
*/
public final void setTeam(int team) {
this.team = team;
}
/**
* Sets the value of this item.
*
* @param value The value.
*/
public final void setValue(int value) {
this.value = value;
}
}