|
|
@ -11,6 +11,7 @@ package engine.devcmd.cmds; |
|
|
|
|
|
|
|
|
|
|
|
import engine.devcmd.AbstractDevCmd; |
|
|
|
import engine.devcmd.AbstractDevCmd; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.objects.*; |
|
|
|
|
|
|
|
import engine.powers.EffectsBase; |
|
|
|
|
|
|
|
|
|
|
|
public class EnchantCmd extends AbstractDevCmd { |
|
|
|
public class EnchantCmd extends AbstractDevCmd { |
|
|
|
|
|
|
|
|
|
|
@ -55,21 +56,9 @@ public class EnchantCmd extends AbstractDevCmd { |
|
|
|
this.setResult(String.valueOf(item.getObjectUUID())); |
|
|
|
this.setResult(String.valueOf(item.getObjectUUID())); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
int cnt = words.length; |
|
|
|
int cnt = words.length; |
|
|
|
for (int i = 1; i < cnt; i++) { |
|
|
|
String enchant = words[1]; |
|
|
|
String enchant = words[i]; |
|
|
|
enchant = EffectsBase.getItemEffectsByName(enchant.toLowerCase()); |
|
|
|
boolean valid = true; |
|
|
|
item.addPermanentEnchantmentForDev(enchant, 0); |
|
|
|
for (Effect eff : item.getEffects().values()) { |
|
|
|
|
|
|
|
if (eff.getEffectsBase().getIDString().equals(enchant)) { |
|
|
|
|
|
|
|
throwbackError(pc, "This item already has that enchantment"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (valid) { |
|
|
|
|
|
|
|
item.addPermanentEnchantmentForDev(enchant, rank); |
|
|
|
|
|
|
|
this.setResult(String.valueOf(item.getObjectUUID())); |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cim.updateInventory(); |
|
|
|
cim.updateInventory(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|