Added an equipItem() method in CreatureObject

This commit is contained in:
Ziggy
2015-05-11 10:29:31 +02:00
parent 86f050de5e
commit 8cbc346811
@@ -27,6 +27,8 @@
***********************************************************************************/
package resources.objects.creature;
import java.util.List;
import network.packets.swg.zone.SceneEndBaselines;
import network.packets.swg.zone.UpdatePostureMessage;
import network.packets.swg.zone.UpdatePvpStatusMessage;
@@ -109,6 +111,23 @@ public class CreatureObject extends TangibleObject {
initBaseAttributes();
}
/**
* It is only recommended that this method be used when you have
* an item and you won't know which slots it will occupy until you've
* looped through the arrangement list that resides within SWGObject.
*
* If you know the slot which your object is supposed to occupy, it's
* recommended that you instead use setSlot(), effectively skipping
* the process of looping.
*
* @param item to equip
*/
public void equipItem(TangibleObject item) {
for(List<String> slotNameList : item.getArrangement())
for(String slotName : slotNameList)
super.setSlot(slotName, item);
}
public void addEquipment(SWGObject obj) {
synchronized(equipmentList) {
if (obj instanceof WeaponObject)