56 lines
1.0 KiB
JavaScript
56 lines
1.0 KiB
JavaScript
import Item from '../item';
|
|
|
|
export default class ItemBuilder {
|
|
constructor() {
|
|
this.item = new Item();
|
|
}
|
|
|
|
withID(ID) {
|
|
this.item.id = ID;
|
|
return this;
|
|
}
|
|
|
|
withName(name) {
|
|
this.item.name = name;
|
|
return this;
|
|
}
|
|
|
|
withDescription(description) {
|
|
this.item.description = description;
|
|
return this;
|
|
}
|
|
|
|
isUsable(value) {
|
|
this.item.usable = value;
|
|
return this;
|
|
}
|
|
|
|
isTakeable(value) {
|
|
this.item.takeable = value;
|
|
return this;
|
|
}
|
|
|
|
withUseCallback(callback) {
|
|
this.item.addUseCallback(callback);
|
|
return this;
|
|
}
|
|
|
|
withTakeCallback(callback) {
|
|
this.item.addTakeCallback(callback);
|
|
return this;
|
|
}
|
|
|
|
withDropCallback(callback) {
|
|
this.item.addDropCallback(callback);
|
|
return this;
|
|
}
|
|
|
|
withTickCallback(callback) {
|
|
this.item.addTickCallback(callback);
|
|
return this;
|
|
}
|
|
|
|
create() {
|
|
return this.item;
|
|
}
|
|
} |