mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-12 22:45:31 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
This commit is contained in:
@@ -25,7 +25,6 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
|
||||
@@ -304,12 +304,12 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
|
||||
WaypointObject missionWp = mission.getWaypoint();
|
||||
|
||||
if (missionWp == null || missionWp.getPlanetCRC() != CRC.StringtoCRC(target.getPlanet().name)) {
|
||||
if (missionWp == null || missionWp.getPlanetCrc() != CRC.StringtoCRC(target.getPlanet().name)) {
|
||||
WaypointObject waypoint = (WaypointObject) getMissionObject().getWaypoint();
|
||||
waypoint.setActive(true);
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
waypoint.setName(getMissionObject().getTargetName());
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setStringAttribute("", "");
|
||||
waypoint.setPosition(target.getWorldPosition());
|
||||
mission.setWaypoint(waypoint);
|
||||
@@ -352,12 +352,12 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
|
||||
WaypointObject missionWp = mission.getWaypoint();
|
||||
|
||||
if (missionWp == null || missionWp.getPlanetCRC() != CRC.StringtoCRC(target.getPlanet().name)) {
|
||||
if (missionWp == null || missionWp.getPlanetCrc() != CRC.StringtoCRC(target.getPlanet().name)) {
|
||||
WaypointObject waypoint = (WaypointObject) getMissionObject().getWaypoint();
|
||||
waypoint.setActive(true);
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
waypoint.setName(getMissionObject().getTargetName());
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setStringAttribute("", "");
|
||||
waypoint.setPosition(target.getWorldPosition());
|
||||
mission.setWaypoint(waypoint);
|
||||
@@ -388,7 +388,7 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
waypoint.setActive(true);
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
waypoint.setName(getMissionObject().getTargetName());
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setStringAttribute("", "");
|
||||
getMissionObject().setWaypoint(waypoint);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class DeliveryMissionObjective extends MissionObjective {
|
||||
|
||||
if (getObjectivePhase() == 0) {
|
||||
WaypointObject waypoint = getMissionObject().getWaypoint();
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPosition(parent.getStartLocation().getLocation());
|
||||
waypoint.setName("@" + parent.getTitle().getStfFilename() + ":" + "m" + parent.getMissionId() + "t");
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
@@ -63,7 +63,7 @@ public class DeliveryMissionObjective extends MissionObjective {
|
||||
|
||||
} else if (getObjectivePhase() == 1) {
|
||||
WaypointObject waypoint = getMissionObject().getWaypoint();
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPosition(parent.getDestinationLocation().getLocation());
|
||||
waypoint.setName("@" + parent.getTitle().getStfFilename() + ":" + "m" + parent.getMissionId() + "t");
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
@@ -103,7 +103,7 @@ public class DeliveryMissionObjective extends MissionObjective {
|
||||
waypoint.setName("@" + parent.getTitle().getStfFilename() + ":" + "m" + parent.getMissionId() + "t");
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
waypoint.setActive(true);
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(player.getPlanet().name));
|
||||
getMissionObject().setTargetName("Dropoff Location");
|
||||
getMissionObject().setWaypoint(waypoint);
|
||||
break;
|
||||
@@ -113,7 +113,7 @@ public class DeliveryMissionObjective extends MissionObjective {
|
||||
returnWp.setName("@" + parent.getTitle().getStfFilename() + ":" + "m" + parent.getMissionId() + "t");
|
||||
returnWp.setColor(WaypointObject.ORANGE);
|
||||
returnWp.setActive(true);
|
||||
returnWp.setPlanetCRC(CRC.StringtoCRC(player.getPlanet().name));
|
||||
returnWp.setPlanetCrc(CRC.StringtoCRC(player.getPlanet().name));
|
||||
getMissionObject().setTargetName("Return");
|
||||
getMissionObject().setWaypoint(returnWp);
|
||||
break;
|
||||
|
||||
@@ -441,7 +441,7 @@ public class GalacticResource extends SWGObject implements Serializable {
|
||||
if (lastSurveyWaypoint == null) {
|
||||
surveyWaypoint = (WaypointObject) NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", crafter.getPlanet(), smuMsg.getHighestX(), 0, smuMsg.getHighestZ());
|
||||
surveyWaypoint.setName("Survey location");
|
||||
surveyWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(crafter.getPlanet().getName()));
|
||||
surveyWaypoint.setPlanetCrc(engine.resources.common.CRC.StringtoCRC(crafter.getPlanet().getName()));
|
||||
surveyWaypoint.setPosition(new Point3D(smuMsg.getHighestX(), 0, smuMsg.getHighestZ()));
|
||||
player.waypointAdd(surveyWaypoint);
|
||||
surveyWaypoint.setPosition(new Point3D(smuMsg.getHighestX(), 0, smuMsg.getHighestZ()));
|
||||
@@ -450,7 +450,7 @@ public class GalacticResource extends SWGObject implements Serializable {
|
||||
surveyWaypoint.setStringAttribute("", "");
|
||||
player.waypointAdd(surveyWaypoint);
|
||||
surveyWaypoint.setName("Survey location");
|
||||
surveyWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(crafter.getPlanet().getName()));
|
||||
surveyWaypoint.setPlanetCrc(engine.resources.common.CRC.StringtoCRC(crafter.getPlanet().getName()));
|
||||
player.setLastSurveyWaypoint(surveyWaypoint);
|
||||
} else {
|
||||
surveyWaypoint = lastSurveyWaypoint;
|
||||
|
||||
@@ -22,147 +22,162 @@
|
||||
package resources.objects.waypoint;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.buffer.SimpleBufferAllocator;
|
||||
|
||||
import resources.objects.intangible.IntangibleObject;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.common.StringUtilities;
|
||||
import engine.resources.common.UString;
|
||||
import engine.resources.objects.Baseline;
|
||||
import engine.resources.objects.IDelta;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import resources.objects.intangible.IntangibleObject;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
public class WaypointObject extends IntangibleObject implements Serializable, IDelta {
|
||||
public class WaypointObject extends IntangibleObject implements IDelta, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int cellId; // ???
|
||||
private long locationNetworkId;
|
||||
private int planetCRC;
|
||||
private String name = "";
|
||||
private byte color;
|
||||
private boolean isActive;
|
||||
private transient static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
|
||||
public static final byte BLUE = 1, GREEN = 2, ORANGE = 3, YELLOW = 4, PURPLE = 5, WHITE = 6, MULTICOLOR = 7;
|
||||
|
||||
public static final byte BLUE = 1;
|
||||
public static final byte GREEN = 2;
|
||||
public static final byte ORANGE = 3;
|
||||
public static final byte YELLOW = 4;
|
||||
public static final byte PURPLE = 5;
|
||||
public static final byte WHITE = 6;
|
||||
public static final byte MULTICOLOR = 7; // JTL waypoint
|
||||
|
||||
public WaypointObject() { }
|
||||
|
||||
public WaypointObject(long objectID, Planet planet, Point3D position) {
|
||||
super(objectID, planet, position, new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff");
|
||||
super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff");
|
||||
}
|
||||
|
||||
public WaypointObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initAfterDBLoad() {
|
||||
super.init();
|
||||
}
|
||||
|
||||
public synchronized int getCellId() {
|
||||
return cellId;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setCellId(int cellId) {
|
||||
this.cellId = cellId;
|
||||
}
|
||||
|
||||
|
||||
public synchronized long getLocationNetworkId() {
|
||||
return locationNetworkId;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setLocationNetworkId(long locationNetworkId) {
|
||||
this.locationNetworkId = locationNetworkId;
|
||||
}
|
||||
|
||||
|
||||
public synchronized int getPlanetCRC() {
|
||||
return planetCRC;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setPlanetCRC(int planetCRC) {
|
||||
this.planetCRC = planetCRC;
|
||||
}
|
||||
|
||||
|
||||
public synchronized String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public synchronized byte getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setColor(byte color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
||||
public synchronized boolean isActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
|
||||
public void setActive(boolean isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client client) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() {
|
||||
IoBuffer buffer = bufferPool.allocate(42 + name.length() * 2, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
buffer.putInt(getCellId());
|
||||
|
||||
buffer.putFloat(getPosition().x);
|
||||
buffer.putFloat(getPosition().y);
|
||||
buffer.putFloat(getPosition().z);
|
||||
|
||||
buffer.putLong(0); // networklocationId
|
||||
buffer.putInt(getPlanetCRC());
|
||||
|
||||
buffer.put(StringUtilities.getUnicodeString(getName()));
|
||||
buffer.putLong(getObjectID());
|
||||
|
||||
buffer.put((byte) getColor());
|
||||
|
||||
if (isActive())
|
||||
buffer.put((byte) 1);
|
||||
else
|
||||
buffer.put((byte) 0);
|
||||
|
||||
return buffer.flip().array();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(SWGObject arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
public void init(SWGObject object) {
|
||||
|
||||
}
|
||||
|
||||
public Baseline getOtherVariables() {
|
||||
Baseline baseline = super.getOtherVariables();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public Baseline getBaseline3() {
|
||||
Baseline baseline = super.getBaseline3();
|
||||
baseline.put("cellNumber", 0);
|
||||
baseline.put("position", new Point3D(0, 0, 0));
|
||||
baseline.put("targetId", (long) 0);
|
||||
baseline.put("planetCrc", 0);
|
||||
baseline.put("name", new UString("Waypoint"));
|
||||
baseline.put("color", (byte) 1);
|
||||
baseline.put("active", false);
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public Baseline getBaseline6() {
|
||||
Baseline baseline = super.getBaseline6();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Baseline getBaseline8() {
|
||||
Baseline baseline = super.getBaseline8();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Baseline getBaseline9() {
|
||||
Baseline baseline = super.getBaseline9();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public int getCellNumber() {
|
||||
return (int) getBaseline(3).get("cellNumber");
|
||||
}
|
||||
|
||||
public void setCellNumber(int cellNumber) {
|
||||
getBaseline(3).set("cellNumber", cellNumber);
|
||||
}
|
||||
|
||||
public void setPosition(Point3D position) {
|
||||
getBaseline(3).set("position", position);
|
||||
}
|
||||
|
||||
public long getTargetId() {
|
||||
return (long) getBaseline(3).get("targetId");
|
||||
}
|
||||
|
||||
public void setTargetId(long targetId) {
|
||||
getBaseline(3).set("targetId", targetId);
|
||||
}
|
||||
|
||||
public int getPlanetCrc() {
|
||||
return (int) getBaseline(3).get("planetCrc");
|
||||
}
|
||||
|
||||
public void setPlanetCrc(int planetCrc) {
|
||||
getBaseline(3).set("planetCrc", planetCrc);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return ((UString) getBaseline(3).get("name")).get();
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
getBaseline(3).set("name", new UString(name));
|
||||
}
|
||||
|
||||
public byte getColor() {
|
||||
return (byte) getBaseline(3).get("color");
|
||||
}
|
||||
|
||||
public void setColor(byte color) {
|
||||
getBaseline(3).set("color", color);
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return (boolean) getBaseline(3).get("active");
|
||||
}
|
||||
|
||||
public void setActive(boolean active) {
|
||||
getBaseline(3).set("active", active);
|
||||
}
|
||||
|
||||
public void toggleActive() {
|
||||
setActive(!isActive());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
synchronized(objectMutex) {
|
||||
IoBuffer buffer = Baseline.createBuffer(38 + StringUtilities.getUnicodeString(getName()).length);
|
||||
buffer.putInt(getCellNumber());
|
||||
buffer.put(Baseline.toBytes(getBaseline(3).get("position")));
|
||||
buffer.putLong(getTargetId());
|
||||
buffer.putInt(getPlanetCrc());
|
||||
buffer.put(StringUtilities.getUnicodeString(getName()));
|
||||
buffer.putLong(getObjectID());
|
||||
buffer.put(getColor());
|
||||
buffer.put(Baseline.getBoolean(isActive()));
|
||||
return buffer.flip().array();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated public int getCellId() { return getCellNumber(); }
|
||||
|
||||
@Deprecated public void setCellId(int cellId) { setCellNumber(cellId); }
|
||||
|
||||
@Deprecated public long getLocationNetworkId() { return getTargetId(); }
|
||||
|
||||
@Deprecated public void setLocationNetworkId(long locationNetworkId) { setTargetId(locationNetworkId); }
|
||||
|
||||
@Deprecated public int getPlanetCRC() { return getPlanetCrc(); }
|
||||
|
||||
@Deprecated public void setPlanetCRC(int planetCRC) { setPlanetCrc(planetCRC); }
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ import resources.harvest.SurveyTool;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.resource.GalacticResource;
|
||||
import resources.objects.resource.ResourceConcentration;
|
||||
import resources.objects.resource.ResourceContainerObject;
|
||||
import resources.objects.resource.ResourceRoot;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
|
||||
@@ -34,6 +34,7 @@ import resources.datatables.ClientPOIRadius;
|
||||
import services.playercities.ClientRegion;
|
||||
import engine.clientdata.ClientFileManager;
|
||||
import engine.clientdata.visitors.DatatableVisitor;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.config.Config;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
@@ -168,6 +169,16 @@ public class TerrainService {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Planet getPlanetByCrc(int crc) {
|
||||
for (int i = 0; i < planets.size(); i++) {
|
||||
if (CRC.StringtoCRC(planets.get(i).getName().toLowerCase()) == crc) {
|
||||
return planets.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Planet getPlanetByPath(String path) {
|
||||
for (int i = 0; i < planets.size(); i++) {
|
||||
if (planets.get(i).getPath().equals(path)) {
|
||||
|
||||
@@ -1063,7 +1063,7 @@ public class HarvesterService implements INetworkDispatch {
|
||||
WaypointObject constructionWaypoint = (WaypointObject)NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", actor.getPlanet(), harvester.getPosition().x, 0 ,harvester.getPosition().z);
|
||||
String displayname = "@installation_n:"+harvester.getStfName();
|
||||
constructionWaypoint.setName(displayname);
|
||||
constructionWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
constructionWaypoint.setPlanetCrc(CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
constructionWaypoint.setPosition(new Point3D(object.getPosition().x,0, object.getPosition().z));
|
||||
player.waypointAdd(constructionWaypoint);
|
||||
constructionWaypoint.setPosition(new Point3D(object.getPosition().x,0, object.getPosition().z));
|
||||
@@ -1072,13 +1072,13 @@ public class HarvesterService implements INetworkDispatch {
|
||||
constructionWaypoint.setStringAttribute("", "");
|
||||
player.waypointAdd(constructionWaypoint);
|
||||
constructionWaypoint.setName(displayname);
|
||||
constructionWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
constructionWaypoint.setPlanetCrc(CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
player.setLastSurveyWaypoint(constructionWaypoint);
|
||||
|
||||
List<WaypointAttachment> attachments = new ArrayList<WaypointAttachment>();
|
||||
WaypointAttachment attachment = new WaypointAttachment();
|
||||
attachment.active = true;
|
||||
attachment.cellID = constructionWaypoint.getCellId();
|
||||
attachment.cellID = constructionWaypoint.getCellNumber();
|
||||
attachment.color = (byte)1;
|
||||
attachment.name = displayname;
|
||||
attachment.planetCRC = engine.resources.common.CRC.StringtoCRC(actor.getPlanet().getName());
|
||||
@@ -1240,7 +1240,7 @@ public class HarvesterService implements INetworkDispatch {
|
||||
WaypointObject constructionWaypoint = (WaypointObject)core.objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", actor.getPlanet(), harvester.getPosition().x, 0 ,harvester.getPosition().z);
|
||||
String displayname = "@installation_n:"+harvester.getStfName() + " " + counter;
|
||||
constructionWaypoint.setName(displayname);
|
||||
constructionWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
constructionWaypoint.setPlanetCrc(CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
constructionWaypoint.setPosition(new Point3D(spawnCoordsX,0, spawnCoordsZ));
|
||||
player.waypointAdd(constructionWaypoint);
|
||||
constructionWaypoint.setPosition(new Point3D(spawnCoordsX,0, spawnCoordsZ));
|
||||
@@ -1249,7 +1249,7 @@ public class HarvesterService implements INetworkDispatch {
|
||||
constructionWaypoint.setStringAttribute("", "");
|
||||
player.waypointAdd(constructionWaypoint);
|
||||
constructionWaypoint.setName(displayname);
|
||||
constructionWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
constructionWaypoint.setPlanetCrc(CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
player.setLastSurveyWaypoint(constructionWaypoint);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user