mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-12 22:45:31 -04:00
Added MissionObject Baselines, Waypoints can be added via Planetary Map now
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
|
||||
commandArgs = commandString.split("(^-,=+_)color_13548(,+-=_^)=1")
|
||||
|
||||
newString = commandArgs[1]
|
||||
print (newString)
|
||||
cmdService = core.commandService
|
||||
cmdService.callCommand(actor, 'waypoint', None, newString) # No need to re-create a script
|
||||
return
|
||||
@@ -67,6 +67,24 @@ def run(core, actor, target, commandString):
|
||||
actorPlayer.waypointAdd(waypoint)
|
||||
actor.sendSystemMessage('A waypoint has been created in your datapad at your location.', 0)
|
||||
return
|
||||
|
||||
#/wp planet x z y name
|
||||
elif len(commandArgs) >= 3 and isFloat(commandArgs[2]) and isFloat(commandArgs[3]) and isFloat(commandArgs[4]):
|
||||
waypoint = core.objectService.createObject('object/waypoint/shared_waypoint.iff', core.terrainService.getPlanetByName(commandArgs[1]), float(commandArgs[2]), float(commandArgs[4]), float(commandArgs[3]))
|
||||
waypoint.setActive(True)
|
||||
waypoint.setColor(WaypointObject.BLUE)
|
||||
name = commandString.split(" ", 5)
|
||||
print (name)
|
||||
if name == "":
|
||||
name = "Waypoint"
|
||||
|
||||
waypoint.setName(name[5])
|
||||
waypoint.setPlanetCRC(crc.StringtoCRC(actor.getPlanet().getName()))
|
||||
actorPlayer.getWaypoints().add(waypoint)
|
||||
actorPlayer.waypointAdd(waypoint)
|
||||
actor.sendSystemMessage('A waypoint has been created in your datapad at your location.', 0)
|
||||
return
|
||||
|
||||
#/wp NAME
|
||||
else:
|
||||
waypoint = core.objectService.createObject('object/waypoint/shared_waypoint.iff', actor.getPlanet(), actor.getWorldPosition().x, actor.getWorldPosition().z, actor.getWorldPosition().y)
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package protocol.swg.objectControllerObjects;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import resources.common.Console;
|
||||
import resources.common.StringUtilities;
|
||||
|
||||
public class MissionListRequest extends ObjControllerObject {
|
||||
|
||||
private long objectId;
|
||||
private long terminalId;
|
||||
private int tickCount;
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
Console.println("MissionListRequest: " + StringUtilities.bytesToHex(data.array()));
|
||||
setObjectId(data.getLong());
|
||||
data.get(); // unk byte
|
||||
setTickCount(data.get());
|
||||
setTerminalId(data.getLong());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
public long getTerminalId() {
|
||||
return terminalId;
|
||||
}
|
||||
|
||||
public void setTerminalId(long terminalId) {
|
||||
this.terminalId = terminalId;
|
||||
}
|
||||
|
||||
public int getTickCount() {
|
||||
return tickCount;
|
||||
}
|
||||
|
||||
public void setTickCount(int tickCount) {
|
||||
this.tickCount = tickCount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,5 +31,5 @@ public class ObjControllerOpcodes {
|
||||
public static final int SECURE_TRADE = 0x15010000;
|
||||
public static final int USE_OBJECT = 0xC5040000;
|
||||
public static final int BUFF_BUILDER_CHANGE = 0x5A020000;
|
||||
|
||||
public static final int MISSION_LIST_REQUEST = 0x5F000000;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,126 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.mission;
|
||||
|
||||
public class MissionMessageBuilder {
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.common.CRC;
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
|
||||
public class MissionMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
public MissionMessageBuilder(MissionObject missionObject) {
|
||||
setObject(missionObject);
|
||||
}
|
||||
|
||||
public IoBuffer buildBaseline3() {
|
||||
MissionObject mission = (MissionObject) object;
|
||||
IoBuffer buffer = IoBuffer.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
|
||||
buffer.putShort((short) 11);
|
||||
|
||||
buffer.putFloat(mission.getMissionComplexity());
|
||||
buffer.put(getAsciiString("mission/mission_object"));
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString(mission.getStfName()));
|
||||
|
||||
if (mission.getCustomName() == null) { buffer.put(getUnicodeString("")); }
|
||||
else { buffer.put(getUnicodeString(mission.getCustomName())); }
|
||||
|
||||
buffer.putInt(mission.getVolume());
|
||||
buffer.putInt(0); // unused
|
||||
buffer.putInt(mission.getMissionLevel());
|
||||
|
||||
buffer.putFloat(mission.getMissionStartX());
|
||||
buffer.putFloat(0); // missionStartZ
|
||||
buffer.putFloat(mission.getMissionStartY());
|
||||
|
||||
buffer.putLong(0); // ??
|
||||
|
||||
buffer.putInt(CRC.StringtoCRC(mission.getMissionStartPlanet()));
|
||||
|
||||
buffer.put(getUnicodeString(mission.getMissionCreator()));
|
||||
buffer.putInt(mission.getMissionCredits());
|
||||
|
||||
buffer.putFloat(mission.getMissionDestinationX());
|
||||
buffer.putFloat(0); // missionDestinationZ
|
||||
buffer.putFloat(mission.getMissionDestinationY());
|
||||
|
||||
buffer.putLong(0); // ??
|
||||
|
||||
buffer.putInt(CRC.StringtoCRC(mission.getMissionDestinationPlanet()));
|
||||
|
||||
buffer.putInt(CRC.StringtoCRC(mission.getMissionTemplateObject()));
|
||||
|
||||
buffer.put(getAsciiString(mission.getMissionDescription()));
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString(mission.getMissionDescId()));
|
||||
|
||||
buffer.put(getAsciiString(mission.getMissionTitle()));
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString(mission.getMissionTitleId()));
|
||||
|
||||
buffer.putInt(0); // refresh counter
|
||||
|
||||
buffer.putInt(CRC.StringtoCRC(mission.getMissionType()));
|
||||
|
||||
buffer.put(getAsciiString(mission.getMissionTargetName()));
|
||||
|
||||
WaypointObject wp = mission.getMissionAttachedWaypoint();
|
||||
|
||||
if (wp == null) {
|
||||
buffer.putInt(0);
|
||||
buffer.putFloat(0); // x
|
||||
buffer.putFloat(0); // z
|
||||
buffer.putFloat(0); // y
|
||||
buffer.putLong(0); // target id
|
||||
buffer.putInt(0); // planet crc
|
||||
buffer.put(getUnicodeString(""));
|
||||
buffer.putLong(0); // waypoint id
|
||||
buffer.put((byte) 0); // color
|
||||
buffer.put((byte) 0x01); //active
|
||||
} else {
|
||||
buffer.putInt(wp.getCellId());
|
||||
buffer.putFloat(wp.getPosition().x);
|
||||
buffer.putFloat(wp.getPosition().z);
|
||||
buffer.putFloat(wp.getPosition().y);
|
||||
buffer.putLong(0);
|
||||
buffer.putInt(CRC.StringtoCRC(wp.getPlanet().name));
|
||||
}
|
||||
int size = buffer.position();
|
||||
buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
|
||||
|
||||
buffer.flip();
|
||||
buffer = createBaseline("MISO", (byte) 3, buffer, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildBaseline6() {
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(121); // unk
|
||||
|
||||
int size = buffer.position();
|
||||
buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
|
||||
|
||||
buffer.flip();
|
||||
buffer = createBaseline("MISO", (byte) 6, buffer, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,269 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.mission;
|
||||
|
||||
public class MissionObject {
|
||||
import com.sleepycat.je.Environment;
|
||||
import com.sleepycat.je.Transaction;
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.objects.IPersistent;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
public class MissionObject extends SWGObject implements IPersistent {
|
||||
|
||||
private String stfName;
|
||||
private String customName;
|
||||
private int volume;
|
||||
|
||||
private float missionComplexity;
|
||||
private float missionDestinationX;
|
||||
private float missionDestinationY;
|
||||
private float missionDestinationZ;
|
||||
private float missionStartX;
|
||||
private float missionStartY;
|
||||
private float missionStartZ;
|
||||
private String missionStartPlanet;
|
||||
private int missionLevel; // Difficulty level displayed in details
|
||||
private String missionDestinationPlanet;
|
||||
private int missionRepeatCounter; // increases for each player using the mission; used for redisplaying on mission term too
|
||||
private int missionCredits;
|
||||
private String missionCreator;
|
||||
private String missionDescription;
|
||||
private String missionTitle;
|
||||
private String missionTargetName; // target/destination
|
||||
private String missionDescId;
|
||||
private String missionTitleId;
|
||||
private String missionType;
|
||||
private WaypointObject missionAttachedWaypoint;
|
||||
|
||||
private String missionTemplateObject;
|
||||
|
||||
@NotPersistent
|
||||
MissionMessageBuilder messageBuilder = new MissionMessageBuilder(this);
|
||||
|
||||
@NotPersistent
|
||||
private Transaction txn;
|
||||
|
||||
|
||||
public MissionObject(long objectID, Planet planet, String template) {
|
||||
super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), template);
|
||||
}
|
||||
|
||||
public String getStfName() {
|
||||
return stfName;
|
||||
}
|
||||
|
||||
public void setStfName(String stfName) {
|
||||
this.stfName = stfName;
|
||||
}
|
||||
|
||||
public String getCustomName() {
|
||||
return customName;
|
||||
}
|
||||
|
||||
public void setCustomName(String customName) {
|
||||
this.customName = customName;
|
||||
}
|
||||
|
||||
public int getVolume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public void setVolume(int volume) {
|
||||
this.volume = volume;
|
||||
}
|
||||
|
||||
public float getMissionComplexity() {
|
||||
return missionComplexity;
|
||||
}
|
||||
|
||||
public void setMissionComplexity(float missionComplexity) {
|
||||
this.missionComplexity = missionComplexity;
|
||||
}
|
||||
|
||||
public float getMissionStartX() {
|
||||
return missionStartX;
|
||||
}
|
||||
|
||||
public void setMissionStartX(float missionStartX) {
|
||||
this.missionStartX = missionStartX;
|
||||
}
|
||||
|
||||
public float getMissionStartY() {
|
||||
return missionStartY;
|
||||
}
|
||||
|
||||
public void setMissionStartY(float missionStartY) {
|
||||
this.missionStartY = missionStartY;
|
||||
}
|
||||
|
||||
public float getMissionStartZ() {
|
||||
return missionStartZ;
|
||||
}
|
||||
|
||||
public void setMissionStartZ(float missionStartZ) {
|
||||
this.missionStartZ = missionStartZ;
|
||||
}
|
||||
|
||||
public float getMissionDestinationX() {
|
||||
return missionDestinationX;
|
||||
}
|
||||
|
||||
public void setMissionDestinationX(float missionDestinationX) {
|
||||
this.missionDestinationX = missionDestinationX;
|
||||
}
|
||||
|
||||
public float getMissionDestinationY() {
|
||||
return missionDestinationY;
|
||||
}
|
||||
|
||||
public void setMissionDestinationY(float missionDestinationY) {
|
||||
this.missionDestinationY = missionDestinationY;
|
||||
}
|
||||
|
||||
public float getMissionDestinationZ() {
|
||||
return missionDestinationZ;
|
||||
}
|
||||
|
||||
public void setMissionDestinationZ(float missionDestinationZ) {
|
||||
this.missionDestinationZ = missionDestinationZ;
|
||||
}
|
||||
|
||||
public String getMissionDestinationPlanet() {
|
||||
return missionDestinationPlanet;
|
||||
}
|
||||
|
||||
public void setMissionDestinationPlanet(String missionDestinationPlanet) {
|
||||
this.missionDestinationPlanet = missionDestinationPlanet;
|
||||
}
|
||||
|
||||
public int getMissionLevel() {
|
||||
return missionLevel;
|
||||
}
|
||||
|
||||
public void setMissionLevel(int missionLevel) {
|
||||
this.missionLevel = missionLevel;
|
||||
}
|
||||
|
||||
public String getMissionStartPlanet() {
|
||||
return missionStartPlanet;
|
||||
}
|
||||
|
||||
public void setMissionStartPlanet(String missionStartPlanetCRC) {
|
||||
this.missionStartPlanet = missionStartPlanetCRC;
|
||||
}
|
||||
|
||||
public int getMissionRepeatCounter() {
|
||||
return missionRepeatCounter;
|
||||
}
|
||||
|
||||
public void setMissionRepeatCounter(int missionRepeatCounter) {
|
||||
this.missionRepeatCounter = missionRepeatCounter;
|
||||
}
|
||||
|
||||
public int getMissionCredits() {
|
||||
return missionCredits;
|
||||
}
|
||||
|
||||
public void setMissionCredits(int missionCredits) {
|
||||
this.missionCredits = missionCredits;
|
||||
}
|
||||
|
||||
public String getMissionCreator() {
|
||||
return missionCreator;
|
||||
}
|
||||
|
||||
public void setMissionCreator(String missionCreator) {
|
||||
this.missionCreator = missionCreator;
|
||||
}
|
||||
|
||||
public String getMissionDescription() {
|
||||
return missionDescription;
|
||||
}
|
||||
|
||||
public void setMissionDescription(String missionDescription) {
|
||||
this.missionDescription = missionDescription;
|
||||
}
|
||||
|
||||
public String getMissionTitle() {
|
||||
return missionTitle;
|
||||
}
|
||||
|
||||
public void setMissionTitle(String missionTitle) {
|
||||
this.missionTitle = missionTitle;
|
||||
}
|
||||
|
||||
public String getMissionTargetName() {
|
||||
return missionTargetName;
|
||||
}
|
||||
|
||||
public void setMissionTargetName(String missionTargetName) {
|
||||
this.missionTargetName = missionTargetName;
|
||||
}
|
||||
|
||||
public WaypointObject getMissionAttachedWaypoint() {
|
||||
return missionAttachedWaypoint;
|
||||
}
|
||||
|
||||
public void setMissionAttachedWaypoint(WaypointObject missionAttachedWaypoint) {
|
||||
this.missionAttachedWaypoint = missionAttachedWaypoint;
|
||||
}
|
||||
|
||||
public String getMissionTemplateObject() {
|
||||
return missionTemplateObject;
|
||||
}
|
||||
|
||||
public void setMissionTemplateObject(String missionTemplateObject) {
|
||||
this.missionTemplateObject = missionTemplateObject;
|
||||
}
|
||||
|
||||
public String getMissionDescId() {
|
||||
return missionDescId;
|
||||
}
|
||||
|
||||
public void setMissionDescId(String missionDescId) {
|
||||
this.missionDescId = missionDescId;
|
||||
}
|
||||
|
||||
public String getMissionTitleId() {
|
||||
return missionTitleId;
|
||||
}
|
||||
|
||||
public void setMissionTitleId(String missionTitleId) {
|
||||
this.missionTitleId = missionTitleId;
|
||||
}
|
||||
|
||||
public String getMissionType() {
|
||||
return missionType;
|
||||
}
|
||||
|
||||
public void setMissionType(String missionType) {
|
||||
this.missionType = missionType;
|
||||
}
|
||||
|
||||
public Transaction getTransaction() {
|
||||
return txn;
|
||||
}
|
||||
|
||||
public void createTransaction(Environment env) {
|
||||
txn = env.beginTransaction(null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
if(destination == null || destination.getSession() == null) {
|
||||
System.out.println("NULL session");
|
||||
return;
|
||||
}
|
||||
|
||||
destination.getSession().write(messageBuilder.buildBaseline3());
|
||||
destination.getSession().write(messageBuilder.buildBaseline6());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package services;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
|
||||
import resources.common.ObjControllerOpcodes;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
|
||||
public class MissionService implements INetworkDispatch {
|
||||
|
||||
@Override
|
||||
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> swgOpcodes, Map<Integer, INetworkRemoteEvent> objControllerOpcodes) {
|
||||
objControllerOpcodes.put(ObjControllerOpcodes.MISSION_LIST_REQUEST, new INetworkRemoteEvent() {
|
||||
|
||||
@Override
|
||||
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -144,6 +144,7 @@ public class SimulationService implements INetworkDispatch {
|
||||
core.commandService.registerCommand("getplayerid");
|
||||
core.commandService.registerCommand("inspire");
|
||||
core.commandService.registerCommand("setgodmode");
|
||||
core.commandService.registerCommand("requestwaypointatposition");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ import resources.objects.cell.CellObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.guild.GuildObject;
|
||||
import resources.objects.mission.MissionObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.staticobject.StaticObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
@@ -203,7 +204,11 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
object = new WaypointObject(objectID, planet, position);
|
||||
|
||||
} else {
|
||||
} else if(Template.startsWith("object/mission")) {
|
||||
|
||||
object = new MissionObject(objectID, planet, Template);
|
||||
|
||||
} else {
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user