Merged projectswg/holocore into development

This commit is contained in:
Mads Boddum
2015-05-12 06:32:52 +02:00
2 changed files with 23 additions and 4 deletions
@@ -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)
+4 -4
View File
@@ -336,6 +336,7 @@ public class ZoneService extends Service {
if (hair.isEmpty())
return;
TangibleObject hairObj = createTangible(objManager, ClientFactory.formatToSharedFile(hair));
hairObj.setAppearanceData(customization);
creatureObj.setSlot("hair", hairObj);
creatureObj.addEquipment(hairObj);
@@ -372,10 +373,9 @@ public class ZoneService extends Service {
if (player.getSlottedObject("inventory") == null)
return;
for (String template : profTemplates.get(profession).getItems(ClientFactory.formatToSharedFile(race))) {
TangibleObject clothing = createTangible(objManager, template);
player.addChild(clothing);
}
for (String template : profTemplates.get(profession).getItems(ClientFactory.formatToSharedFile(race)))
player.equipItem(createTangible(objManager, template));
}
private void loadProfTemplates() {