Volume limit now set based on template files, Refactored zoning to account for ghost slot, Added inventory and datapad on creation

This commit is contained in:
Waverunner
2014-12-14 10:52:47 -05:00
parent 92fcafe2eb
commit 96a44952cd
3 changed files with 22 additions and 28 deletions
+7 -23
View File
@@ -5,11 +5,9 @@ import intents.swgobject_events.SWGObjectEventIntent;
import intents.swgobject_events.SWGObjectMovedIntent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import main.ProjectSWG;
import network.packets.swg.zone.HeartBeatMessage;
@@ -28,7 +26,6 @@ import resources.client_info.visitors.ObjectData;
import resources.client_info.visitors.SlotArrangementData;
import resources.client_info.visitors.SlotDefinitionData;
import resources.client_info.visitors.SlotDescriptorData;
import resources.containers.ObjectSlot;
import resources.control.Intent;
import resources.control.Manager;
import resources.objects.SWGObject;
@@ -86,8 +83,6 @@ public class ObjectManager extends Manager {
});
clientFac = new ClientFactory();
// Load up the slot definitions to the datamap in clientFac so we don't have to load it later
SlotDefinitionData def = (SlotDefinitionData) clientFac.getInfoFromFile("abstract/slot/slot_definition/slot_definitions.iff");
return super.initialize();
}
@@ -144,12 +139,11 @@ public class ObjectManager extends Manager {
}
private void addObjectAttributes(SWGObject obj, String template) {
System.out.println("Adding attributes for template " + template);
ObjectData attributes = (ObjectData) clientFac.getInfoFromFile(ClientFactory.formatToSharedFile(template));
obj.setStf((String) attributes.getAttribute(ObjectData.OBJ_STF));
obj.setDetailStf((String) attributes.getAttribute(ObjectData.DETAIL_STF));
obj.setVolume((Integer) attributes.getAttribute(ObjectData.VOLUME_LIMIT));
addSlotsToObject(obj, attributes);
}
@@ -157,24 +151,16 @@ public class ObjectManager extends Manager {
private void addSlotsToObject(SWGObject obj, ObjectData attributes) {
if ((String) attributes.getAttribute(ObjectData.SLOT_DESCRIPTOR) != null) {
SlotDefinitionData slotDefs = (SlotDefinitionData) clientFac.getInfoFromFile("abstract/slot/slot_definition/slot_definitions.iff");
// TODO: These are the slots that the object HAS
System.out.println("SlotDescriptor: " + (String) attributes.getAttribute(ObjectData.SLOT_DESCRIPTOR));
SlotDescriptorData descriptor = (SlotDescriptorData) clientFac.getInfoFromFile((String) attributes.getAttribute(ObjectData.SLOT_DESCRIPTOR));
for (String slotName : descriptor.getSlots()) {
System.out.println("Slot: " + slotName);
obj.addObjectSlot(new ObjectSlot(slotName));
obj.addObjectSlot(slotName, null);
}
}
if ((String) attributes.getAttribute(ObjectData.ARRANGEMENT_FILE) != null) {
// This is what slots the object *USES*
System.out.println("Arrangement: " + (String) attributes.getAttribute(ObjectData.ARRANGEMENT_FILE));
// This is what slots the object *USES*
SlotArrangementData arrangementData = (SlotArrangementData) clientFac.getInfoFromFile((String) attributes.getAttribute(ObjectData.ARRANGEMENT_FILE));
obj.setArrangment(arrangementData.getArrangement());
@@ -210,12 +196,10 @@ public class ObjectManager extends Manager {
System.err.println("ObjectManager: Failed to start zone - CreatureObject could not be fetched from database");
throw new NullPointerException("CreatureObject for ID: " + characterId + " cannot be null!");
}
player.setCreatureObject(creature);
for (SWGObject obj : creature.getChildren()) {
if (obj instanceof PlayerObject) {
player.setPlayerObject(obj);
break;
}
player.setCreatureObject(creature); // CreatureObject contains the player object!
if (player.getPlayerObject() == null) {
System.err.println("FATAL: " + player.getUsername() + "'s CreatureObject has a null ghost!");
}
}