Files
lakebane/src/engine/devcmd/cmds/CreateItemCmd.java
T

65 lines
1.9 KiB
Java
Raw Normal View History

2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.objects.AbstractGameObject;
import engine.objects.ItemBase;
import engine.objects.ItemFactory;
import engine.objects.PlayerCharacter;
/**
* @author Eighty
*/
public class CreateItemCmd extends AbstractDevCmd {
2023-07-15 09:23:48 -04:00
public CreateItemCmd() {
2022-04-30 09:41:17 -04:00
super("createitem");
}
2023-07-15 09:23:48 -04:00
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2) {
this.sendUsage(pc);
return;
}
int id;
id = ItemBase.getIDByName(words[0]);
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
if (id == 0)
id = Integer.parseInt(words[0]);
if (id == 7) {
this.throwbackInfo(pc, "use /addgold to add gold.....");
return;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
int size = 1;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
if (words.length < 3) {
size = Integer.parseInt(words[1]);
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
ItemFactory.fillInventory(pc, id, size);
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
@Override
protected String _getHelpString() {
2022-04-30 09:41:17 -04:00
return "Fill your inventory with items";
2023-07-15 09:23:48 -04:00
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
@Override
protected String _getUsageString() {
2022-04-30 09:41:17 -04:00
return "' /createitem <ItembaseID> <quantity>'";
2023-07-15 09:23:48 -04:00
}
2022-04-30 09:41:17 -04:00
}