Added automatic STF parsing for a new object's STF file and detail STF file

This commit is contained in:
Waverunner
2014-12-11 22:16:06 -05:00
parent 6e2376fe74
commit 7dc87b5720
3 changed files with 16 additions and 3 deletions
+16
View File
@@ -21,6 +21,8 @@ import network.packets.swg.zone.insertion.SelectCharacter;
import resources.Location;
import resources.Race;
import resources.Terrain;
import resources.client_info.ClientFactory;
import resources.client_info.visitors.ObjectData;
import resources.control.Intent;
import resources.control.Manager;
import resources.objects.SWGObject;
@@ -40,6 +42,8 @@ public class ObjectManager extends Manager {
private static final double AWARE_RANGE = 200;
private ClientFactory clientFac;
private ObjectDatabase<SWGObject> objects;
private Map <String, QuadTree <SWGObject>> quadTree;
private long maxObjectId;
@@ -74,6 +78,9 @@ public class ObjectManager extends Manager {
}
}
});
clientFac = new ClientFactory();
return super.initialize();
}
@@ -120,6 +127,7 @@ public class ObjectManager extends Manager {
synchronized (objects) {
long objectId = getNextObjectId();
SWGObject obj = createObjectFromTemplate(objectId, template);
addObjectAttributes(obj, template);
obj.setTemplate(template);
obj.setLocation(l);
objects.put(objectId, obj);
@@ -127,6 +135,14 @@ public class ObjectManager extends Manager {
}
}
private void addObjectAttributes(SWGObject obj, String template) {
ObjectData attributes = (ObjectData) clientFac.getInfoFromFile(ClientFactory.formatToSharedFile(template));
obj.setStf((String) attributes.getAttribute("objectName"));
obj.setDetailStf((String) attributes.getAttribute("detailedDescription"));
}
private void zoneInCharacter(PlayerManager playerManager, long netId, long characterId) {
Player player = playerManager.getPlayerFromNetworkId(netId);
if (player != null) {