Minor AdminEnchant cleanup.
This commit is contained in:
@@ -64,69 +64,69 @@ public class AdminEnchant implements IAdminCommandHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
int armorType = -1;
|
||||
int slot = -1;
|
||||
if (command.startsWith("admin_seteh"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_HEAD;
|
||||
slot = Inventory.PAPERDOLL_HEAD;
|
||||
}
|
||||
else if (command.startsWith("admin_setec"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_CHEST;
|
||||
slot = Inventory.PAPERDOLL_CHEST;
|
||||
}
|
||||
else if (command.startsWith("admin_seteg"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_GLOVES;
|
||||
slot = Inventory.PAPERDOLL_GLOVES;
|
||||
}
|
||||
else if (command.startsWith("admin_seteb"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_FEET;
|
||||
slot = Inventory.PAPERDOLL_FEET;
|
||||
}
|
||||
else if (command.startsWith("admin_setel"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_LEGS;
|
||||
slot = Inventory.PAPERDOLL_LEGS;
|
||||
}
|
||||
else if (command.startsWith("admin_setew"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_RHAND;
|
||||
slot = Inventory.PAPERDOLL_RHAND;
|
||||
}
|
||||
else if (command.startsWith("admin_setes"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_LHAND;
|
||||
slot = Inventory.PAPERDOLL_LHAND;
|
||||
}
|
||||
else if (command.startsWith("admin_setle"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_LEAR;
|
||||
slot = Inventory.PAPERDOLL_LEAR;
|
||||
}
|
||||
else if (command.startsWith("admin_setre"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_REAR;
|
||||
slot = Inventory.PAPERDOLL_REAR;
|
||||
}
|
||||
else if (command.startsWith("admin_setlf"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_LFINGER;
|
||||
slot = Inventory.PAPERDOLL_LFINGER;
|
||||
}
|
||||
else if (command.startsWith("admin_setrf"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_RFINGER;
|
||||
slot = Inventory.PAPERDOLL_RFINGER;
|
||||
}
|
||||
else if (command.startsWith("admin_seten"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_NECK;
|
||||
slot = Inventory.PAPERDOLL_NECK;
|
||||
}
|
||||
else if (command.startsWith("admin_setun"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_UNDER;
|
||||
slot = Inventory.PAPERDOLL_UNDER;
|
||||
}
|
||||
else if (command.startsWith("admin_setba"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_CLOAK;
|
||||
slot = Inventory.PAPERDOLL_CLOAK;
|
||||
}
|
||||
else if (command.startsWith("admin_setbe"))
|
||||
{
|
||||
armorType = Inventory.PAPERDOLL_BELT;
|
||||
slot = Inventory.PAPERDOLL_BELT;
|
||||
}
|
||||
|
||||
if (armorType != -1)
|
||||
if (slot != -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -139,7 +139,7 @@ public class AdminEnchant implements IAdminCommandHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
setEnchant(activeChar, ench, armorType);
|
||||
setEnchant(activeChar, ench, slot);
|
||||
}
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e)
|
||||
@@ -166,7 +166,7 @@ public class AdminEnchant implements IAdminCommandHandler
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setEnchant(Player activeChar, int ench, int armorType)
|
||||
private void setEnchant(Player activeChar, int ench, int slot)
|
||||
{
|
||||
// get the target
|
||||
|
||||
@@ -181,10 +181,10 @@ public class AdminEnchant implements IAdminCommandHandler
|
||||
Item itemInstance = null;
|
||||
|
||||
// only attempt to enchant if there is a weapon equipped
|
||||
final Item parmorInstance = player.getInventory().getPaperdollItem(armorType);
|
||||
if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType))
|
||||
final Item paperdollInstance = player.getInventory().getPaperdollItem(slot);
|
||||
if ((paperdollInstance != null) && (paperdollInstance.getLocationSlot() == slot))
|
||||
{
|
||||
itemInstance = parmorInstance;
|
||||
itemInstance = paperdollInstance;
|
||||
}
|
||||
|
||||
if (itemInstance != null)
|
||||
@@ -192,7 +192,7 @@ public class AdminEnchant implements IAdminCommandHandler
|
||||
final int curEnchant = itemInstance.getEnchantLevel();
|
||||
|
||||
// set enchant value
|
||||
player.getInventory().unEquipItemInSlot(armorType);
|
||||
player.getInventory().unEquipItemInSlot(slot);
|
||||
itemInstance.setEnchantLevel(ench);
|
||||
player.getInventory().equipItem(itemInstance);
|
||||
|
||||
|
Reference in New Issue
Block a user