Merge remote-tracking branch 'upstream/master'

This commit is contained in:
CharonInferar
2014-04-10 18:46:58 +02:00
100 changed files with 726 additions and 530 deletions
+1 -4
View File
@@ -61,9 +61,6 @@ odb/resourcehistory/je.info.*
odb/resourceroots/je.info.*
odb/resources/je.info.*
# PSWG Configs
options.cfg
# External tool builders
.externalToolBuilders/
@@ -214,4 +211,4 @@ pip-log.txt
#############
## PyCharm
#############
.idea
.idea
-13
View File
@@ -1,13 +0,0 @@
from resources.datatables import PlayerFlags
import sys
def setup():
return
def run(core, actor, target, commandString):
command = core.commandService.getCommandByName("toggleawayfromkeyboard")
if command:
core.commandService.processCommand(actor, target, command, 0, commandString)
return
+38
View File
@@ -0,0 +1,38 @@
import sys
from engine.resources.scene import Point3D
def setup():
return
def run(core, actor, target, commandString):
tarObj = core.objectService.getObject(actor.getTargetId())
container = actor.getContainer()
parsedMsg = commandString.split(' ', 2)
if core.housingService.getPermissions(actor, container): # i should probably relook into my permissions system... it kinda sucks
if parsedMsg[0] == "up":
core.simulationService.transform(tarObj, Point3D(0, float(parsedMsg[1]) * 0.01, 0))
return
elif parsedMsg[0] == "down":
core.simulationService.transform(tarObj, Point3D(0, float(parsedMsg[1]) * -0.01, 0))
return
elif parsedMsg[0] == "forward":
core.simulationService.transform(tarObj, Point3D(0, 0, float(parsedMsg[1]) * 0.01))
return
elif parsedMsg[0] == "back":
core.simulationService.transform(tarObj, Point3D(0, 0, float(parsedMsg[1]) * -0.01))
return
elif parsedMsg[0] == "right":
core.simulationService.transform(tarObj, Point3D(float(parsedMsg[1]) * 0.01, 0, 0))
return
elif parsedMsg[0] == "left":
core.simulationService.transform(tarObj, Point3D(float(parsedMsg[1]) * -0.01, 0, 0))
return
elif container.getTemplate() == "object/cell/shared_cell.iff":
actor.sendSystemMessage("You do not have permission to access that container!", 0)
return
return
+29
View File
@@ -0,0 +1,29 @@
import sys
from engine.resources.scene import Point3D
def setup():
return
def run(core, actor, target, commandString):
tarObj = core.objectService.getObject(actor.getTargetId())
container = actor.getContainer()
parsedMsg = commandString.split(' ', 2)
if core.housingService.getPermissions(actor, container): # i should probably relook into my permissions system... it kinda sucks
if parsedMsg[0] == "pitch":
core.simulationService.transform(tarObj, float(parsedMsg[1]), Point3D(1, 0, 0)) # this is messed up ???
return
elif parsedMsg[0] == "yaw":
core.simulationService.transform(tarObj, float(parsedMsg[1]), Point3D(0, 1, 0)) # this is correct
return
elif parsedMsg[0] == "roll":
core.simulationService.transform(tarObj, float(parsedMsg[1]), Point3D(0, 0, 1)) # this is messed up ???
return
elif container.getTemplate() == "object/cell/shared_cell.iff":
actor.sendSystemMessage("You do not have permission to access that container!", 0)
return
return
+16 -5
View File
@@ -1,18 +1,29 @@
import sys
from engine.resources.scene import Quaternion
def setup():
return
def run(core, actor, target, commandString):
parsedMsg = commandString.split(' ', 3)
objService = core.objectService
containerID = long(parsedMsg[1])
container = objService.getObject(containerID)
actorContainer = actor.getContainer()
if actorContainer != None and (container.getTemplate() == "object/cell/shared_cell.iff") & core.housingService.getPermissions(actor, actorContainer):
target.getContainer().transferTo(actor, container, target)
core.simulationService.teleport(target, actor.getPosition(), Quaternion(1,0,0,0), containerID)
return
elif actorContainer != None and container.getTemplate() == "object/cell/shared_cell.iff":
actor.sendSystemMessage("You do not have permission to access that container!", 0)
return
if core.equipmentService.canEquip(actor, target) is False:
actor.sendSystemMessage('@error_message:insufficient_skill', 0)
return
parsedMsg = commandString.split(' ', 3)
objService = core.objectService
containerID = long(parsedMsg[1])
container = objService.getObject(containerID)
if target and container and target.getContainer():
oldContainer = target.getContainer()
+25
View File
@@ -0,0 +1,25 @@
from resources.common import RadialOptions
import sys
def createRadial(core, owner, target, radials):
radials.clear()
radials.add(RadialOptions(0, 11, 1, ''))
radials.add(RadialOptions(0, 55, 0, ''))
radials.add(RadialOptions(3, 56, 1, ''))
radials.add(RadialOptions(3, 57, 1, ''))
radials.add(RadialOptions(3, 58, 1, ''))
radials.add(RadialOptions(3, 59, 1, ''))
radials.add(RadialOptions(0, 52, 0, ''))
radials.add(RadialOptions(4, 53, 1, ''))
radials.add(RadialOptions(4, 54, 1, ''))
return
def handleSelection(core, owner, target, option):
if option == 56:
core.commandService.callCommand(owner, 'movefurniture', target, 'forward 10')
return
+3 -3
View File
@@ -49,8 +49,8 @@ def corelliaPoints(core, planet):
def dantooinePoints(core, planet):
trvSvc = core.travelService
trvSvc.addTravelPoint(planet, "Imperial Outpost", -635, 3, 2507)
trvSvc.addTravelPoint(planet, "Mining Outpost", -4208, 3, -2350)
trvSvc.addTravelPoint(planet, "Mining Outpost", -635, 3, 2507)
trvSvc.addTravelPoint(planet, "Imperial Outpost", -4208, 3, -2350)
trvSvc.addTravelPoint(planet, "Agro Outpost", 1569, 4, -6415)
return
@@ -149,4 +149,4 @@ def mustafarPoints(core, planet):
trvSvc = core.travelService
trvSvc.addTravelPoint(planet, "Mensix Mining Facility", 405, 230, -1352)
return
return
+1 -1
View File
@@ -43,7 +43,7 @@ import org.apache.mina.core.session.IoSession;
import com.sleepycat.je.Transaction;
import com.sleepycat.persist.EntityCursor;
import protocol.swg.ChatSystemMessage;
import protocol.swg.chat.ChatSystemMessage;
import net.engio.mbassy.bus.config.BusConfiguration;
import resources.common.RadialOptions;
import resources.common.ThreadMonitor;
@@ -22,7 +22,6 @@
package protocol.swg;
import java.nio.ByteOrder;
import java.util.Map.Entry;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.buffer.SimpleBufferAllocator;
@@ -25,8 +25,6 @@ import java.nio.ByteOrder;
import java.util.Map;
import java.util.Map.Entry;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import services.collections.ServerFirst;
-1
View File
@@ -27,7 +27,6 @@ import org.apache.mina.core.buffer.IoBuffer;
import resources.common.Console;
import resources.common.StringUtilities;
import engine.resources.common.CRC;
public class CommPlayerMessage extends SWGMessage {
@@ -2,9 +2,6 @@ package protocol.swg;
import org.apache.mina.core.buffer.IoBuffer;
import resources.common.Console;
import resources.common.StringUtilities;
public class GuildRequestMessage extends SWGMessage {
private long characterId;
@@ -25,11 +25,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import resources.common.Console;
import resources.common.StringUtilities;
import resources.guild.Guild;
import resources.objects.creature.CreatureObject;
public class GuildResponseMessage extends SWGMessage {
private long player;
@@ -32,7 +32,6 @@ import protocol.swg.objectControllerObjects.DataTransform;
import protocol.swg.objectControllerObjects.DataTransformWithParent;
import protocol.swg.objectControllerObjects.ObjControllerObject;
import protocol.swg.objectControllerObjects.UnknownObjController;
import resources.common.StringUtilities;
public class ObjControllerMessage extends SWGMessage {
@@ -34,8 +34,6 @@ import protocol.swg.SWGMessage;
import resources.objects.creature.CreatureObject;
import resources.objects.resource.GalacticResource;
import resources.objects.tangible.TangibleObject;
import resources.objects.tool.SurveyTool;
public class ResourceListForSurveyMessage extends SWGMessage {
@@ -71,7 +69,7 @@ public class ResourceListForSurveyMessage extends SWGMessage {
Vector<GalacticResource> planetVector = core.resourceService.getSpawnedResourcesByPlanetAndType(surveyor.getPlanetId(),generalType);
resourceList = new ArrayList(planetVector);
resourceList = new ArrayList<GalacticResource>(planetVector);
}
+1
View File
@@ -24,6 +24,7 @@ package protocol.swg;
import java.nio.ByteBuffer;
import protocol.Message;
import protocol.swg.chat.ChatInstantMessageToCharacter;
public class SWGMessageFactory {
+1 -1
View File
@@ -63,7 +63,7 @@ public class SurveyMapUpdateMessage extends SWGMessage {
highestConcentration = concentration;
}
}
int size = buffer.position();
//int size = buffer.position();
buffer.flip();
}
@@ -19,10 +19,12 @@
* 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;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatCreateRoom extends SWGMessage {
@@ -19,10 +19,12 @@
* 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;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatDeletePersistentMessage extends SWGMessage {
@@ -19,11 +19,11 @@
* 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;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import resources.common.StringUtilities;
import protocol.swg.SWGMessage;
public class ChatEnterRoomById extends SWGMessage {
@@ -34,7 +34,6 @@ public class ChatEnterRoomById extends SWGMessage {
@Override
public void deserialize(IoBuffer data) {
StringUtilities.printBytes(data.array());
data.getShort();
data.getInt();
@@ -1,4 +1,4 @@
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -6,6 +6,8 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatFriendsListUpdate extends SWGMessage {
private String friendName;
@@ -19,13 +19,15 @@
* 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;
package protocol.swg.chat;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
@SuppressWarnings("unused")
public class ChatInstantMessageToCharacter extends SWGMessage {
@@ -19,12 +19,14 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatInstantMessagetoClient extends SWGMessage{
@@ -19,12 +19,14 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnAddFriend extends SWGMessage {
@Override
@@ -19,7 +19,7 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -27,6 +27,7 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import engine.resources.config.Config;
public class ChatOnChangeFriendStatus extends SWGMessage {
@@ -0,0 +1,48 @@
/*******************************************************************************
* 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.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnConnectAvatar extends SWGMessage {
public ChatOnConnectAvatar() { }
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 1);
buffer.putInt(0xD72FE9BE);
return buffer.flip();
}
}
@@ -19,7 +19,7 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -27,6 +27,7 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import services.chat.ChatRoom;
public class ChatOnCreateRoom extends SWGMessage {
@@ -19,7 +19,7 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -27,6 +27,7 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import engine.resources.common.CRC;
import resources.common.Opcodes;
@@ -1,4 +1,4 @@
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import java.util.List;
@@ -7,6 +7,7 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import resources.objects.player.PlayerObject;
// This is possibly unused
@@ -19,12 +19,14 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnSendInstantMessage extends SWGMessage {
private int errorType;
@@ -19,12 +19,14 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnSendPersistentMessage extends SWGMessage {
@@ -19,12 +19,14 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnSendRoomMessage extends SWGMessage {
private int errorCode;
@@ -19,11 +19,14 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
import java.util.List;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import services.chat.WaypointAttachment;
@@ -19,13 +19,16 @@
* 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;
package protocol.swg.chat;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import services.chat.WaypointAttachment;
@@ -0,0 +1,113 @@
/*******************************************************************************
* 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.chat;
import java.nio.ByteOrder;
import java.util.Vector;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import resources.objects.creature.CreatureObject;
import services.chat.ChatRoom;
public class ChatQueryRoomResults extends SWGMessage {
private ChatRoom room;
private int requestId;
public ChatQueryRoomResults(ChatRoom room, int requestId) {
this.room = room;
this.requestId = requestId;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
String server = NGECore.getInstance().getGalaxyName();
IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 7);
buffer.putInt(0xC4DE864E);
Vector<CreatureObject> users = room.getUserList();
buffer.putInt(users.size());
if (users.size() > 0) {
for (CreatureObject creo : users) {
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(creo.getCustomName()));
}
}
buffer.putInt(0); // TODO: Invited list for chat rooms
Vector<CreatureObject> moderators = room.getModeratorList();
buffer.putInt(moderators.size());
if (moderators.size() > 0) {
for (CreatureObject creo : users) {
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(creo.getCustomName()));
}
}
Vector<CreatureObject> banned = room.getBanList();
buffer.putInt(banned.size());
if (banned.size() > 0) {
for (CreatureObject creo : users) {
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(creo.getCustomName()));
}
}
buffer.putInt(requestId);
buffer.putInt(room.getRoomId());
buffer.putInt(room.isPrivateRoom() ? 0 : 1);
buffer.put((byte) (room.isModeratorsOnly() ? 1 : 0));
buffer.put(getAsciiString(room.getRoomAddress()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(room.getOwner()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(room.getCreator()));
buffer.put(getUnicodeString(room.getDescription()));
buffer.putInt(0); // moderator list
buffer.putInt(0); // user list
return buffer.flip();
}
}
@@ -19,10 +19,12 @@
* 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;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatRequestPersistentMessage extends SWGMessage {
@@ -19,7 +19,7 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
import java.util.concurrent.ConcurrentHashMap;
@@ -28,6 +28,7 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import services.chat.ChatRoom;
public class ChatRoomList extends SWGMessage {
@@ -46,7 +47,7 @@ public class ChatRoomList extends SWGMessage {
@Override
public IoBuffer serialize() {
String server = NGECore.getInstance().getGalaxyName();
IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
IoBuffer buffer = IoBuffer.allocate(53).order(ByteOrder.LITTLE_ENDIAN);
buffer.setAutoExpand(true);
buffer.putShort((short) 2);
@@ -70,7 +71,9 @@ public class ChatRoomList extends SWGMessage {
buffer.putInt(0); // user list (not used by client)
}
});
return buffer.flip();
buffer.flip();
//StringUtilities.printBytes(buffer.array());
return buffer;
}
}
@@ -19,7 +19,7 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -27,6 +27,8 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatRoomMessage extends SWGMessage {
private String character;
@@ -19,10 +19,12 @@
* 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;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatSendToRoom extends SWGMessage {
private String message;
@@ -0,0 +1,44 @@
/*******************************************************************************
* 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.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatServerStatus extends SWGMessage {
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(7).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 2);
buffer.putInt(0x7102B15F);
buffer.put((byte) 1);
return buffer.flip();
}
}
@@ -19,12 +19,13 @@
* 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;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import resources.common.Opcodes;
public class ChatSystemMessage extends SWGMessage{
@@ -25,10 +25,6 @@ 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 BiographyUpdate extends ObjControllerObject {
private long objectId;
@@ -33,9 +33,9 @@ public class CombatSpam extends ObjControllerObject{
private long attackerId;
private long defenderId;
private int damage;
private String file;
private String text;
private byte colorFlag;
//private String file;
//private String text;
//private byte colorFlag;
private boolean hit = true;
private boolean critical = false;
private boolean dodge = false;
@@ -21,8 +21,6 @@
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Vector;
@@ -30,7 +28,6 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.IDAttribute;
import resources.common.StringUtilities;
public class ImageDesignMessage extends ObjControllerObject {
@@ -21,11 +21,8 @@
******************************************************************************/
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;
@@ -26,7 +26,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ObjControllerOpcodes;
import resources.common.OutOfBand;
public class NpcConversationMessage extends ObjControllerObject {
@@ -28,17 +28,14 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ConversationOption;
import resources.common.ObjControllerOpcodes;
public class NpcConversationOptions extends ObjControllerObject {
private long npcId;
private long objectId;
private Vector<ConversationOption> conversationOptions = new Vector<ConversationOption>();
public NpcConversationOptions(long objectId, long npcId) {
public NpcConversationOptions(long objectId) {
this.objectId = objectId;
this.npcId = npcId;
}
@Override
@@ -26,8 +26,6 @@ import java.nio.ByteBuffer;
import org.apache.mina.core.buffer.IoBuffer;
import engine.resources.common.Utilities;
public class SetProfessionTemplate extends ObjControllerObject {
private String profession;
@@ -27,7 +27,6 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.RGB;
import resources.common.StringUtilities;
public class ShowFlyText extends ObjControllerObject {
@@ -22,14 +22,12 @@
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import java.util.List;
import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
import engine.resources.objects.SWGObject;
import protocol.swg.ObjControllerMessage;
import resources.common.StringUtilities;
public class ShowLootBox extends ObjControllerObject {
@@ -26,7 +26,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ObjControllerOpcodes;
public class StartNpcConversation extends ObjControllerObject {
@@ -26,7 +26,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ObjControllerOpcodes;
public class StopNpcConversation extends ObjControllerObject {
-2
View File
@@ -21,9 +21,7 @@
******************************************************************************/
package resources.common;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
public class Cooldown {
private long startTimestamp;
-2
View File
@@ -21,8 +21,6 @@
******************************************************************************/
package resources.common;
import java.math.BigInteger;
public class IDAttribute {
private float floatValue;
+2 -1
View File
@@ -187,7 +187,8 @@ public class ThreadMonitor {
return true;
}
private void parseMBeanInfo() throws IOException {
@SuppressWarnings("unused")
private void parseMBeanInfo() throws IOException {
try {
MBeanOperationInfo[] mopis = server.getMBeanInfo(objname).getOperations();
-2
View File
@@ -36,8 +36,6 @@ import resources.objects.creature.CreatureObject;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.DatatableVisitor;
import engine.resources.common.CRC;
@Persistent(version=10)
@@ -30,9 +30,7 @@ import resources.objects.tangible.TangibleObject;
import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.NotPersistent;
import engine.clients.Client;
import engine.resources.container.Traverser;
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;
@@ -30,7 +30,6 @@ import org.apache.mina.core.buffer.IoBuffer;
import com.sleepycat.persist.model.Persistent;
import engine.resources.common.CRC;
import resources.common.StringUtilities;
import resources.objects.Buff;
import resources.objects.ObjectMessageBuilder;
import resources.objects.SkillMod;
@@ -28,18 +28,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ChatSystemMessage;
import protocol.swg.ObjControllerMessage;
import protocol.swg.PlayClientEffectObjectMessage;
import protocol.swg.PlayMusicMessage;
import protocol.swg.UpdatePostureMessage;
import protocol.swg.UpdatePVPStatusMessage;
import protocol.swg.chat.ChatSystemMessage;
import protocol.swg.objectControllerObjects.Animation;
import protocol.swg.objectControllerObjects.Posture;
@@ -64,7 +61,6 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
import resources.objects.weapon.WeaponObject;
@Entity(version=6)
public class CreatureObject extends TangibleObject implements IPersistent {
@@ -1090,8 +1086,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
appearanceEquipmentList.get().remove(object);
}
}
@SuppressWarnings("unused")
@Override
public void sendBaselines(Client destination) {
@@ -27,8 +27,6 @@ import java.util.Map.Entry;
import org.apache.mina.core.buffer.IoBuffer;
import engine.resources.common.CRC;
import resources.common.StringUtilities;
import resources.objects.ObjectMessageBuilder;
import resources.objects.waypoint.WaypointObject;
@@ -28,7 +28,6 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import resources.common.Console;
import resources.objects.intangible.IntangibleObject;
import resources.objects.resource.ResourceContainerObject;
import resources.objects.tool.SurveyTool;
@@ -838,7 +837,7 @@ public class PlayerObject extends IntangibleObject {
public boolean deductLots(int amount)
{
if(this.lotsRemaining - amount > 0)
if(this.lotsRemaining - amount >= 0)
{
this.lotsRemaining -= amount;
return true;
@@ -24,20 +24,17 @@ package resources.objects.resource;
import java.util.List;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.TimeUnit;
import main.NGECore;
import protocol.swg.SurveyMapUpdateMessage;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
import resources.objects.waypoint.WaypointObject;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
import engine.clients.Client;
import engine.resources.objects.IPersistent;
@@ -27,7 +27,7 @@ public class ResourceConcentration {
return coordsZ;
}
public void setCoordsZ(float coordsY) {
public void setCoordsZ(float coordsZ) {
this.coordsZ = coordsZ;
}
@@ -70,6 +70,7 @@ public class ResourceContainerObject extends TangibleObject {
private short overallQuality;
private short flavor;
/*
private static byte CONTAINER_TYPE_INORGANIC_MINERALS = 0;
private static byte CONTAINER_TYPE_INORGANIC_CHEMICALS = 1;
private static byte CONTAINER_TYPE_INORGANIC_GAS = 2;
@@ -127,6 +128,7 @@ public class ResourceContainerObject extends TangibleObject {
"object/resource_container/shared_resource_container_energy_radioactive.iff",
"object/resource_container/shared_resource_container_energy_solid.iff"
};
*/
@NotPersistent
public static int maximalStackCapacity = 100000;
@@ -31,8 +31,6 @@ import java.util.Map;
import java.util.Set;
import java.util.Vector;
import javax.xml.bind.DatatypeConverter;
import main.NGECore;
import protocol.swg.ObjControllerMessage;
import protocol.swg.PlayClientEffectObjectMessage;
@@ -42,7 +40,6 @@ import protocol.swg.objectControllerObjects.ShowFlyText;
import resources.common.RGB;
import resources.objects.creature.CreatureObject;
import resources.visitors.IDManagerVisitor;
import services.ai.AIActor;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
-1
View File
@@ -178,7 +178,6 @@ public class BuffService implements INetworkDispatch {
// I'm not sure if all aura effects follow the same rules, so this is simply restricted to officer aura's atm
ScheduledFuture<?> task = scheduler.scheduleAtFixedRate(new Runnable() {
@SuppressWarnings("unused")
@Override
public void run() {
if (buffer == null || buffer.getClient() == null)
+1 -1
View File
@@ -124,7 +124,7 @@ public class ConversationService implements INetworkDispatch {
conversationHandlers.put(player, handler);
NpcConversationOptions convoOptions = new NpcConversationOptions(player.getObjectID(), npc.getObjectID());
NpcConversationOptions convoOptions = new NpcConversationOptions(player.getObjectID());
options.forEach(convoOptions::addOption);
ObjControllerMessage objController = new ObjControllerMessage(0x0B, convoOptions);
player.getClient().getSession().write(objController.serialize());
+2 -2
View File
@@ -67,7 +67,7 @@ public class DevService implements INetworkDispatch {
public void sendCharacterBuilderSUI(CreatureObject creature, int childMenu)
{
Map<Long, String> suiOptions = new HashMap<Long, String>();
switch(childMenu)
{
case 0: // Root
@@ -85,7 +85,7 @@ public class DevService implements INetworkDispatch {
suiOptions.put((long) 22, "Misc Items");
suiOptions.put((long) 23, "Jedi Items");
suiOptions.put((long) 110, "Survey Devices");
//suiOptions.put((long) 120, "House Deeds");
if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds");
break;
case 3: // [Items] Weapons
suiOptions.put((long) 30, "Jedi Weapons");
-10
View File
@@ -2,10 +2,8 @@ package services;
import java.nio.ByteOrder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
@@ -19,25 +17,18 @@ import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import protocol.swg.ObjControllerMessage;
import protocol.swg.OkMessage;
import protocol.swg.PlayClientEffectObjectMessage;
import protocol.swg.objectControllerObjects.BuffBuilderChangeMessage;
import protocol.swg.objectControllerObjects.BuffBuilderEndMessage;
import protocol.swg.objectControllerObjects.BuffBuilderStartMessage;
import protocol.swg.objectControllerObjects.ImageDesignMessage;
import resources.common.BuffBuilder;
import resources.common.Console;
import resources.common.IDAttribute;
import resources.common.MathUtilities;
import resources.common.ObjControllerOpcodes;
import resources.common.Performance;
import resources.common.PerformanceEffect;
import resources.common.RGB;
import resources.common.StringUtilities;
import resources.datatables.Posture;
import resources.objects.Buff;
import resources.objects.BuffItem;
import resources.objects.SWGList;
import resources.objects.SkillMod;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
@@ -45,7 +36,6 @@ import resources.objects.tangible.TangibleObject;
import resources.visitors.IDManagerVisitor;
import services.sui.SUIService.InputBoxType;
import services.sui.SUIWindow;
import services.sui.SUIWindow.SUICallback;
import services.sui.SUIWindow.Trigger;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.DatatableVisitor;
-3
View File
@@ -35,7 +35,6 @@ import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.TreeMap;
import org.python.antlr.ast.Str;
import org.python.core.Py;
import org.python.core.PyObject;
@@ -46,9 +45,7 @@ import engine.resources.objects.SWGObject;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
import services.equipment.BonusSetTemplate;
import services.spawn.MobileTemplate;
public class EquipmentService implements INetworkDispatch {
-1
View File
@@ -28,7 +28,6 @@ import java.util.Map;
import resources.objects.Buff;
import resources.objects.creature.CreatureObject;
import resources.objects.group.GroupObject;
import services.chat.ChatRoom;
import main.NGECore;
import engine.clients.Client;
import engine.resources.objects.SWGObject;
-1
View File
@@ -36,7 +36,6 @@ import java.util.concurrent.TimeUnit;
import resources.objects.building.BuildingObject;
import resources.objects.creature.CreatureObject;
import resources.objects.group.GroupObject;
import services.object.ObjectService;
import main.NGECore;
import engine.clientdata.ClientFileManager;
-2
View File
@@ -24,7 +24,6 @@ package services;
import java.nio.ByteOrder;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import main.NGECore;
@@ -44,7 +43,6 @@ import engine.clientdata.visitors.DatatableVisitor;
import engine.clients.Client;
import engine.resources.container.Traverser;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
+24 -3
View File
@@ -60,15 +60,15 @@ import engine.resources.scene.Quaternion;
import engine.resources.scene.quadtree.QuadTree;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
import protocol.swg.ChatFriendsListUpdate;
import protocol.swg.ChatOnChangeFriendStatus;
import protocol.swg.ChatOnGetFriendsList;
import protocol.swg.CmdStartScene;
import protocol.swg.HeartBeatMessage;
import protocol.swg.ObjControllerMessage;
import protocol.swg.OpenedContainerMessage;
import protocol.swg.UpdateTransformMessage;
import protocol.swg.UpdateTransformWithParentMessage;
import protocol.swg.chat.ChatFriendsListUpdate;
import protocol.swg.chat.ChatOnChangeFriendStatus;
import protocol.swg.chat.ChatOnGetFriendsList;
import protocol.swg.objectControllerObjects.DataTransform;
import protocol.swg.objectControllerObjects.DataTransformWithParent;
import protocol.swg.objectControllerObjects.TargetUpdate;
@@ -886,6 +886,24 @@ public class SimulationService implements INetworkDispatch {
}
public void transform(TangibleObject obj, Point3D position)
{
Point3D oldPosition = obj.getPosition();
Point3D newPosition = new Point3D(oldPosition.x + position.x, oldPosition.y + position.y, oldPosition.z + position.z);
teleport(obj, newPosition, obj.getOrientation(), obj.getParentId());
}
public void transform(SWGObject obj, float rotation, Point3D axis)
{
rotation *= (Math.PI / 180);
Quaternion oldRotation = obj.getOrientation();
Quaternion newRotation = resources.common.MathUtilities.rotateQuaternion(oldRotation, rotation, axis);
teleport(obj, obj.getPosition(), newRotation, obj.getParentId());
}
public void teleport(SWGObject obj, Point3D position, Quaternion orientation, long cellId) {
if(cellId == 0) {
@@ -900,6 +918,9 @@ public class SimulationService implements INetworkDispatch {
DataTransformWithParent dataTransform = new DataTransformWithParent(new Point3D(position.x, position.y, position.z), orientation, obj.getMovementCounter(), obj.getObjectID(), cellId);
ObjControllerMessage objController = new ObjControllerMessage(0x1B, dataTransform);
obj.notifyObservers(objController, true);
obj.setPosition(position);
obj.setOrientation(orientation);
}
}
-13
View File
@@ -22,7 +22,6 @@
package services;
import java.util.Map;
import java.util.Observable;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.Executors;
@@ -31,27 +30,19 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import protocol.swg.PlayClientEffectLocMessage;
import protocol.swg.SceneCreateObjectByCrc;
import protocol.swg.SceneEndBaselines;
import protocol.swg.SurveyMapUpdateMessage;
import protocol.swg.UpdateContainmentMessage;
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;
import resources.objects.tool.SurveyTool;
import resources.objects.waypoint.WaypointObject;
import services.sui.SUIWindow;
import services.sui.SUIWindow.SUICallback;
import services.sui.SUIWindow.Trigger;
import main.NGECore;
import engine.resources.common.CRC;
import engine.resources.container.Traverser;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Point3D;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
@@ -479,7 +470,6 @@ public class SurveyService implements INetworkDispatch {
returnList.add("List.lstList:SelectedRow");
window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() {
@SuppressWarnings("unchecked")
@Override
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
int index = Integer.parseInt(returnList.get(0));
@@ -627,7 +617,6 @@ public class SurveyService implements INetworkDispatch {
final SurveyTool outerSurveyTool = (SurveyTool)target;
window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() {
@SuppressWarnings("unchecked")
@Override
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
CreatureObject crafter = (CreatureObject)owner;
@@ -673,14 +662,12 @@ public class SurveyService implements INetworkDispatch {
final SurveyTool outerSurveyTool = (SurveyTool)target;
window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() {
@SuppressWarnings("unchecked")
@Override
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
((CreatureObject)owner).sendSystemMessage("Rad confirmed", (byte) 0);
}
});
window.addHandler(1, "", Trigger.TRIGGER_CANCEL, returnList, new SUICallback() {
@SuppressWarnings("unchecked")
@Override
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
((CreatureObject)owner).sendSystemMessage("Rad declined", (byte) 0);
-6
View File
@@ -24,22 +24,16 @@ package services;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import resources.common.FileUtilities;
import resources.common.collidables.CollidableCircle;
import resources.objects.building.BuildingObject;
import resources.objects.cell.CellObject;
import resources.objects.creature.CreatureObject;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.DatatableVisitor;
import engine.resources.config.Config;
import engine.resources.container.Traverser;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
-2
View File
@@ -22,7 +22,6 @@
package services.ai;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
@@ -42,7 +41,6 @@ import services.ai.states.AttackState;
import services.ai.states.DeathState;
import services.ai.states.IdleState;
import services.ai.states.RetreatState;
import services.ai.states.SpawnState;
import services.combat.CombatEvents.DamageTaken;
import services.spawn.MobileTemplate;
-3
View File
@@ -26,14 +26,11 @@ import java.util.Map.Entry;
import java.util.Random;
import java.util.Vector;
import resources.objects.cell.CellObject;
import resources.objects.creature.CreatureObject;
import resources.objects.group.GroupObject;
import resources.objects.player.PlayerObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import main.NGECore;
-2
View File
@@ -21,9 +21,7 @@
******************************************************************************/
package services.ai.states;
import resources.objects.creature.CreatureObject;
import services.ai.AIActor;
import services.ai.states.AIState.StateResult;
public class RetreatState extends AIState {
-13
View File
@@ -21,7 +21,6 @@
******************************************************************************/
package services.chat;
import java.util.List;
import java.util.Vector;
import resources.objects.creature.CreatureObject;
@@ -29,8 +28,6 @@ import resources.objects.creature.CreatureObject;
import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.PrimaryKey;
import com.sleepycat.persist.model.Relationship;
import com.sleepycat.persist.model.SecondaryKey;
@Entity
public class ChatRoom {
@@ -45,8 +42,6 @@ public class ChatRoom {
@NotPersistent
private Vector<CreatureObject> userList = new Vector<CreatureObject>(); // current users
@NotPersistent
private int requestId; // not-persistent
private boolean moderatorsOnly;
private boolean privateRoom;
private boolean visible;
@@ -92,14 +87,6 @@ public class ChatRoom {
this.userList = userList;
}
public int getRequestId() {
return requestId;
}
public void setRequestId(int requestId) {
this.requestId = requestId;
}
public boolean isModeratorsOnly() {
return moderatorsOnly;
}
+43 -31
View File
@@ -34,8 +34,6 @@ import org.apache.mina.core.session.IoSession;
import com.sleepycat.je.Transaction;
import com.sleepycat.persist.EntityCursor;
import com.sleepycat.persist.PrimaryIndex;
import com.sleepycat.persist.SecondaryIndex;
import engine.clients.Client;
import engine.resources.config.Config;
@@ -49,27 +47,25 @@ import resources.common.*;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import protocol.swg.AddIgnoreMessage;
import protocol.swg.ChatCreateRoom;
import protocol.swg.ChatEnterRoomById;
import protocol.swg.ChatOnChangeFriendStatus;
import protocol.swg.ChatDeletePersistentMessage;
import protocol.swg.ChatFriendsListUpdate;
import protocol.swg.ChatInstantMessageToCharacter;
import protocol.swg.ChatInstantMessagetoClient;
import protocol.swg.ChatOnAddFriend;
import protocol.swg.ChatOnCreateRoom;
import protocol.swg.ChatOnEnteredRoom;
import protocol.swg.ChatOnSendInstantMessage;
import protocol.swg.ChatOnSendPersistentMessage;
import protocol.swg.ChatOnSendRoomMessage;
import protocol.swg.ChatPersistentMessageToClient;
import protocol.swg.ChatPersistentMessageToServer;
import protocol.swg.ChatRequestPersistentMessage;
import protocol.swg.ChatRoomList;
import protocol.swg.ChatRoomMessage;
import protocol.swg.ChatSendToRoom;
import protocol.swg.ChatSystemMessage;
import protocol.swg.ObjControllerMessage;
import protocol.swg.chat.ChatDeletePersistentMessage;
import protocol.swg.chat.ChatEnterRoomById;
import protocol.swg.chat.ChatFriendsListUpdate;
import protocol.swg.chat.ChatInstantMessageToCharacter;
import protocol.swg.chat.ChatInstantMessagetoClient;
import protocol.swg.chat.ChatOnAddFriend;
import protocol.swg.chat.ChatOnChangeFriendStatus;
import protocol.swg.chat.ChatOnEnteredRoom;
import protocol.swg.chat.ChatOnSendInstantMessage;
import protocol.swg.chat.ChatOnSendPersistentMessage;
import protocol.swg.chat.ChatOnSendRoomMessage;
import protocol.swg.chat.ChatPersistentMessageToClient;
import protocol.swg.chat.ChatPersistentMessageToServer;
import protocol.swg.chat.ChatRequestPersistentMessage;
import protocol.swg.chat.ChatRoomList;
import protocol.swg.chat.ChatRoomMessage;
import protocol.swg.chat.ChatSendToRoom;
import protocol.swg.chat.ChatSystemMessage;
import protocol.swg.objectControllerObjects.PlayerEmote;
import protocol.swg.objectControllerObjects.SpatialChat;
import main.NGECore;
@@ -363,15 +359,17 @@ public class ChatService implements INetworkDispatch {
if (obj == null)
return;
ChatRoomList listMessage = new ChatRoomList(chatRooms);
//ChatServerStatus chatServerStatus = new ChatServerStatus();
//client.getSession().write(chatServerStatus.serialize());
ChatRoomList listMessage = new ChatRoomList(chatRooms);
client.getSession().write(listMessage.serialize());
}
});
swgOpcodes.put(Opcodes.ChatCreateRoom, (session, data) -> {
data.order(ByteOrder.LITTLE_ENDIAN);
/*data.order(ByteOrder.LITTLE_ENDIAN);
Client client = core.getClient(session);
@@ -389,19 +387,33 @@ public class ChatService implements INetworkDispatch {
sentPacket.deserialize(data);
ChatRoom room = createChatRoom(sentPacket.getTitle(), sentPacket.getAddress(), creo.getCustomName().toLowerCase(), true, false);
room.setPrivateRoom(sentPacket.isPrivacy());
room.setModeratorsOnly(sentPacket.isModeratorOnly());
if (room != null) {
room.setPrivateRoom(sentPacket.isPrivacy());
room.setModeratorsOnly(sentPacket.isModeratorOnly());
room.getUserList().add(creo);
room.getModeratorList().add(creo);
ChatOnCreateRoom response = new ChatOnCreateRoom(room, 0, sentPacket.getRequest());
session.write(response.serialize());
}
}*/
});
swgOpcodes.put(Opcodes.ChatQueryRoom, (session, data) -> {
data.order(ByteOrder.LITTLE_ENDIAN);
//StringUtilities.printBytes(data.array());
Client client = core.getClient(session);
if(client == null)
return;
SWGObject obj = client.getParent();
if (obj == null)
return;
});
swgOpcodes.put(Opcodes.ChatSendToRoom, (session, data) -> {
@@ -441,7 +453,7 @@ public class ChatService implements INetworkDispatch {
joinChatRoom((CreatureObject) obj, sentPacket.getRoomId());
System.out.println("Entering room... " + sentPacket.getRoomId());
//System.out.println("Entering room... " + sentPacket.getRoomId());
});
}
@@ -728,15 +740,15 @@ public class ChatService implements INetworkDispatch {
if (creator.contains(" "))
creator = creator.split(" ")[0];
ChatRoom room = new ChatRoom();
room.setDescription(roomName);
if (!address.startsWith("SWG."))
room.setRoomAddress("SWG." + core.getGalaxyName() + "." + address);
else
room.setRoomAddress(address);
room.setCreator(creator);
room.setOwner(creator);
room.setCreator(creator.toLowerCase());
room.setOwner(creator.toLowerCase());
room.setVisible(showInList);
room.setRoomId(generateChatRoomId());
-1
View File
@@ -21,7 +21,6 @@
******************************************************************************/
package services.combat;
import services.command.CombatCommand;
import main.NGECore;
public class CombatCommands {
+3 -4
View File
@@ -36,7 +36,6 @@ import org.apache.mina.core.session.IoSession;
import protocol.swg.ObjControllerMessage;
import protocol.swg.PlayClientEffectLocMessage;
import protocol.swg.UpdatePVPStatusMessage;
import protocol.swg.objectControllerObjects.CombatAction;
import protocol.swg.objectControllerObjects.CombatSpam;
import protocol.swg.objectControllerObjects.CommandEnqueueRemove;
@@ -52,6 +51,7 @@ import resources.objects.waypoint.WaypointObject;
import resources.objects.weapon.WeaponObject;
import services.ai.AIActor;
import services.combat.CombatEvents.DamageTaken;
import services.command.BaseSWGCommand;
import services.command.CombatCommand;
import services.sui.SUIService.MessageBoxType;
import services.sui.SUIWindow;
@@ -400,7 +400,7 @@ public class CombatService implements INetworkDispatch {
}
private void sendCombatPackets(CreatureObject attacker, TangibleObject target, WeaponObject weapon, CombatCommand command, int actionCounter, float damage, int armorAbsorbed, int hitType) {
private void sendCombatPackets(CreatureObject attacker, TangibleObject target, WeaponObject weapon, BaseSWGCommand command, int actionCounter, float damage, int armorAbsorbed, int hitType) {
String animationStr = command.getRandomAnimation(weapon);
CombatAction combatAction = new CombatAction(CRC.StringtoCRC(animationStr), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC());
@@ -429,7 +429,7 @@ public class CombatService implements INetworkDispatch {
}
private void sendHealPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) {
private void sendHealPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, BaseSWGCommand command, int actionCounter) {
CombatAction combatAction = new CombatAction(CRC.StringtoCRC(command.getDefaultAnimations()[0]), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC());
ObjControllerMessage objController = new ObjControllerMessage(0x1B, combatAction);
@@ -820,7 +820,6 @@ public class CombatService implements INetworkDispatch {
target.getEventBus().publish(event);
}
@SuppressWarnings("unused")
public void doDrainHeal(CreatureObject receiver, int drainAmount) {
synchronized(receiver.getMutex()) {
receiver.setHealth(receiver.getHealth() + drainAmount);
+183 -5
View File
@@ -27,6 +27,9 @@ import engine.resources.common.CRC;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import resources.objects.weapon.WeaponObject;
public class BaseSWGCommand implements Cloneable {
@@ -34,7 +37,6 @@ public class BaseSWGCommand implements Cloneable {
private String clientEffectSelf;
private String clientEffectTarget;
private int commandCRC;
private boolean isGmCommand = false;
private String characterAbility;
private int target;
private int targetType;
@@ -55,6 +57,21 @@ public class BaseSWGCommand implements Cloneable {
private Byte[] invalidPostures;
private Long[] invalidStates;
private String[] defaultAnimations = new String[]{};
private String[] oneHandedAnimations = new String[]{};
private String[] twoHandedAnimations = new String[]{};
private String[] polearmAnimations = new String[]{};
private String[] unarmedAnimations = new String[]{};
private String[] pistolAnimations = new String[]{};
private String[] carbineAnimations = new String[]{};
private String[] lightRifleAnimations = new String[]{};
private String[] rifleAnimations = new String[]{};
private String[] heavyWpnAnimations = new String[]{};
private String[] oneHandedLSAnimations = new String[]{};
private String[] twoHandedLSAnimations = new String[]{};
private String[] polearmLSAnimations = new String[]{};
private String[] thrownAnimations = new String[]{};
public BaseSWGCommand(String commandName) {
setCommandName(commandName);
setCommandCRC(CRC.StringtoCRC(commandName));
@@ -222,10 +239,6 @@ public class BaseSWGCommand implements Cloneable {
return (godLevel > 0);
}
public void setGmCommand(boolean isGmCommand) {
this.isGmCommand = isGmCommand;
}
public String getCharacterAbility() {
return characterAbility;
}
@@ -362,4 +375,169 @@ public class BaseSWGCommand implements Cloneable {
this.warmupTime = warmupTime;
}
public String[] getDefaultAnimations() {
return defaultAnimations;
}
public void setDefaultAnimations(String[] defaultAnimations) {
this.defaultAnimations = defaultAnimations;
}
public String[] getOneHandedAnimations() {
return oneHandedAnimations;
}
public void setOneHandedAnimations(String[] oneHandedAnimations) {
this.oneHandedAnimations = oneHandedAnimations;
}
public String[] getTwoHandedAnimations() {
return twoHandedAnimations;
}
public void setTwoHandedAnimations(String[] twoHandedAnimations) {
this.twoHandedAnimations = twoHandedAnimations;
}
public String[] getPolearmAnimations() {
return polearmAnimations;
}
public void setPolearmAnimations(String[] polearmAnimations) {
this.polearmAnimations = polearmAnimations;
}
public String[] getUnarmedAnimations() {
return unarmedAnimations;
}
public void setUnarmedAnimations(String[] unarmedAnimations) {
this.unarmedAnimations = unarmedAnimations;
}
public String[] getPistolAnimations() {
return pistolAnimations;
}
public void setPistolAnimations(String[] pistolAnimations) {
this.pistolAnimations = pistolAnimations;
}
public String[] getCarbineAnimations() {
return carbineAnimations;
}
public void setCarbineAnimations(String[] carbineAnimations) {
this.carbineAnimations = carbineAnimations;
}
public String[] getLightRifleAnimations() {
return lightRifleAnimations;
}
public void setLightRifleAnimations(String[] lightRifleAnimations) {
this.lightRifleAnimations = lightRifleAnimations;
}
public String[] getRifleAnimations() {
return rifleAnimations;
}
public void setRifleAnimations(String[] rifleAnimations) {
this.rifleAnimations = rifleAnimations;
}
public String[] getHeavyWpnAnimations() {
return heavyWpnAnimations;
}
public void setHeavyWpnAnimations(String[] heavyWpnAnimations) {
this.heavyWpnAnimations = heavyWpnAnimations;
}
public String[] getOneHandedLSAnimations() {
return oneHandedLSAnimations;
}
public void setOneHandedLSAnimations(String[] oneHandedLSAnimations) {
this.oneHandedLSAnimations = oneHandedLSAnimations;
}
public String[] getTwoHandedLSAnimations() {
return twoHandedLSAnimations;
}
public void setTwoHandedLSAnimations(String[] twoHandedLSAnimations) {
this.twoHandedLSAnimations = twoHandedLSAnimations;
}
public String[] getPolearmLSAnimations() {
return polearmLSAnimations;
}
public void setPolearmLSAnimations(String[] polearmLSAnimations) {
this.polearmLSAnimations = polearmLSAnimations;
}
public String[] getThrownAnimations() {
return thrownAnimations;
}
public void setThrownAnimations(String[] thrownAnimations) {
this.thrownAnimations = thrownAnimations;
}
public String getRandomAnimation(WeaponObject weapon) {
int weaponType = weapon.getWeaponType();
String[] animations;
switch (weaponType) {
case 0:
animations = rifleAnimations;
break;
case 1:
animations = carbineAnimations;
break;
case 2:
animations = pistolAnimations;
break;
case 3:
animations = heavyWpnAnimations;
break;
case 4:
animations = oneHandedAnimations;
break;
case 5:
animations = twoHandedAnimations;
break;
case 6:
animations = defaultAnimations;
break;
case 7:
animations = polearmAnimations;
break;
case 8:
animations = thrownAnimations;
break;
case 9:
animations = oneHandedLSAnimations;
break;
case 10:
animations = twoHandedLSAnimations;
break;
case 11:
animations = polearmLSAnimations;
break;
default:
animations = defaultAnimations;
break;
}
if (animations.length == 0) {
animations = defaultAnimations;
}
return animations[new Random().nextInt(animations.length)];
}
}
+2 -192
View File
@@ -21,28 +21,11 @@
******************************************************************************/
package services.command;
import java.util.Random;
import resources.objects.weapon.WeaponObject;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.DatatableVisitor;
public class CombatCommand extends BaseSWGCommand {
private String[] defaultAnimations = new String[]{};
private String[] oneHandedAnimations = new String[]{};
private String[] twoHandedAnimations = new String[]{};
private String[] polearmAnimations = new String[]{};
private String[] unarmedAnimations = new String[]{};
private String[] pistolAnimations = new String[]{};
private String[] carbineAnimations = new String[]{};
private String[] lightRifleAnimations = new String[]{};
private String[] rifleAnimations = new String[]{};
private String[] heavyWpnAnimations = new String[]{};
private String[] oneHandedLSAnimations = new String[]{};
private String[] twoHandedLSAnimations = new String[]{};
private String[] polearmLSAnimations = new String[]{};
private String[] thrownAnimations = new String[]{};
private byte validTargetType;
private byte hitType;
private byte healType;
@@ -67,16 +50,12 @@ public class CombatCommand extends BaseSWGCommand {
private int damageType, elementalType, elementalValue;
private String performanceSpam;
private byte hitSpam;
//private float cooldown;
private String delayAttackEggTemplate;
private String delayAttackParticle;
private float initialAttackDelay;
private float delayAttackInterval;
private int delayAttackLoops;
private int delayAttackEggPosition;
//private String cooldownGroup;
//private float executeTime;
//private float warmupTime;
private float vigorCost; // for commando kill meter and bm specials
private float criticalChance;
private int attack_rolls;
@@ -166,119 +145,7 @@ public class CombatCommand extends BaseSWGCommand {
e.printStackTrace();
}
}
public String[] getDefaultAnimations() {
return defaultAnimations;
}
public void setDefaultAnimations(String[] defaultAnimations) {
this.defaultAnimations = defaultAnimations;
}
public String[] getOneHandedAnimations() {
return oneHandedAnimations;
}
public void setOneHandedAnimations(String[] oneHandedAnimations) {
this.oneHandedAnimations = oneHandedAnimations;
}
public String[] getTwoHandedAnimations() {
return twoHandedAnimations;
}
public void setTwoHandedAnimations(String[] twoHandedAnimations) {
this.twoHandedAnimations = twoHandedAnimations;
}
public String[] getPolearmAnimations() {
return polearmAnimations;
}
public void setPolearmAnimations(String[] polearmAnimations) {
this.polearmAnimations = polearmAnimations;
}
public String[] getUnarmedAnimations() {
return unarmedAnimations;
}
public void setUnarmedAnimations(String[] unarmedAnimations) {
this.unarmedAnimations = unarmedAnimations;
}
public String[] getPistolAnimations() {
return pistolAnimations;
}
public void setPistolAnimations(String[] pistolAnimations) {
this.pistolAnimations = pistolAnimations;
}
public String[] getCarbineAnimations() {
return carbineAnimations;
}
public void setCarbineAnimations(String[] carbineAnimations) {
this.carbineAnimations = carbineAnimations;
}
public String[] getLightRifleAnimations() {
return lightRifleAnimations;
}
public void setLightRifleAnimations(String[] lightRifleAnimations) {
this.lightRifleAnimations = lightRifleAnimations;
}
public String[] getRifleAnimations() {
return rifleAnimations;
}
public void setRifleAnimations(String[] rifleAnimations) {
this.rifleAnimations = rifleAnimations;
}
public String[] getHeavyWpnAnimations() {
return heavyWpnAnimations;
}
public void setHeavyWpnAnimations(String[] heavyWpnAnimations) {
this.heavyWpnAnimations = heavyWpnAnimations;
}
public String[] getOneHandedLSAnimations() {
return oneHandedLSAnimations;
}
public void setOneHandedLSAnimations(String[] oneHandedLSAnimations) {
this.oneHandedLSAnimations = oneHandedLSAnimations;
}
public String[] getTwoHandedLSAnimations() {
return twoHandedLSAnimations;
}
public void setTwoHandedLSAnimations(String[] twoHandedLSAnimations) {
this.twoHandedLSAnimations = twoHandedLSAnimations;
}
public String[] getPolearmLSAnimations() {
return polearmLSAnimations;
}
public void setPolearmLSAnimations(String[] polearmLSAnimations) {
this.polearmLSAnimations = polearmLSAnimations;
}
public String[] getThrownAnimations() {
return thrownAnimations;
}
public void setThrownAnimations(String[] thrownAnimations) {
this.thrownAnimations = thrownAnimations;
}
public byte getValidTargetType() {
return validTargetType;
}
@@ -550,64 +417,7 @@ public class CombatCommand extends BaseSWGCommand {
public void setHitSpam(byte hitSpam) {
this.hitSpam = hitSpam;
}
public String getRandomAnimation(WeaponObject weapon) {
int weaponType = weapon.getWeaponType();
String[] animations;
switch(weaponType) {
case 0:
animations = rifleAnimations;
break;
case 1:
animations = carbineAnimations;
break;
case 2:
animations = pistolAnimations;
break;
case 3:
animations = heavyWpnAnimations;
break;
case 4:
animations = oneHandedAnimations;
break;
case 5:
animations = twoHandedAnimations;
break;
case 6:
animations = defaultAnimations;
break;
case 7:
animations = polearmAnimations;
break;
case 8:
animations = thrownAnimations;
break;
case 9:
animations = oneHandedLSAnimations;
break;
case 10:
animations = twoHandedLSAnimations;
break;
case 11:
animations = polearmLSAnimations;
break;
default:
animations = defaultAnimations;
break;
}
if(animations.length == 0)
animations = defaultAnimations;
return animations[new Random().nextInt(animations.length)];
}
public String getDelayAttackEggTemplate() {
return delayAttackEggTemplate;
}
+46 -88
View File
@@ -27,7 +27,6 @@ import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import main.NGECore;
@@ -43,7 +42,6 @@ import engine.resources.scene.Point3D;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
import resources.common.*;
import resources.datatables.StateStatus;
import protocol.swg.ObjControllerMessage;
import protocol.swg.objectControllerObjects.CommandEnqueue;
import protocol.swg.objectControllerObjects.CommandEnqueueRemove;
@@ -56,6 +54,7 @@ import resources.objects.weapon.WeaponObject;
public class CommandService implements INetworkDispatch {
private Vector<BaseSWGCommand> commandLookup = new Vector<BaseSWGCommand>();
private ConcurrentHashMap<Integer, Integer> aliases = new ConcurrentHashMap<Integer, Integer>();
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
private NGECore core;
@@ -63,6 +62,10 @@ public class CommandService implements INetworkDispatch {
this.core = core;
}
public void registerAlias(String name, String target) {
aliases.put(CRC.StringtoCRC(name.toLowerCase()), CRC.StringtoCRC(target.toLowerCase()));
}
public boolean callCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) {
if (actor == null) {
return false;
@@ -80,7 +83,7 @@ public class CommandService implements INetworkDispatch {
return false;
}
if (command.getGodLevel() > 0 && !actor.getClient().isGM()) {
if (command.getGodLevel() > 0 && (actor.getClient() == null || !actor.getClient().isGM())) {
return false;
}
@@ -94,14 +97,14 @@ public class CommandService implements INetworkDispatch {
return false;
}
// The two below statements need testing before use
for (long state : command.getInvalidStates()) {
if ((actor.getStateBitmask() & state) == state) {
//return false;
}
}
// This SHOULD be invalid locomotions but we don't track these currently.
// Postures are the best we can do.
for (byte posture : command.getInvalidPostures()) {
if (actor.getPosture() == posture) {
//return false;
@@ -109,9 +112,7 @@ public class CommandService implements INetworkDispatch {
}
switch (command.getTargetType()) {
case 0: // Target Not Used For This Command or Self
target = actor;
case 0: // Target Not Used For This Command
break;
case 1: // Other Only
if (target == null || target == actor) {
@@ -176,7 +177,7 @@ public class CommandService implements INetworkDispatch {
}
// Without this we could be buffing ally NPCs and such
if (object.getSlottedObject("ghost") == null) {
if (actor.getSlottedObject("ghost") != null && object.getSlottedObject("ghost") == null) {
return false;
}
@@ -208,46 +209,20 @@ public class CommandService implements INetworkDispatch {
}
long warmupTime = (long) (command.getWarmupTime() * 1000F);
final CreatureObject actorObject = actor;
final SWGObject targetObject = target;
if (warmupTime != 0) {
scheduler.schedule(new Runnable() {
@Override
public void run() {
processCommand(actorObject, targetObject, command, actionCounter, commandArgs);
}
}, warmupTime, TimeUnit.MILLISECONDS);
} else {
processCommand(actor, target, command, actionCounter, commandArgs);
try {
Thread.sleep(warmupTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
processCommand(actor, target, command, actionCounter, commandArgs);
return true;
}
public void callCommand(SWGObject actor, String commandName, SWGObject target, String commandArgs) {
if (actor == null)
return;
BaseSWGCommand command = getCommandByName(commandName);
if (command == null)
return;
if(command instanceof CombatCommand) {
CombatCommand command2;
try {
command2 = (CombatCommand) command.clone();
processCombatCommand((CreatureObject) actor, target, command2, 0, "");
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return;
}
core.scriptService.callScript("scripts/commands/", command.getCommandName(), "run", core, actor, target, commandArgs);
callCommand((CreatureObject) actor, target, getCommandByName(commandName), 0, commandArgs);
}
public BaseSWGCommand getCommandByCRC(int commandCRC) {
@@ -284,15 +259,7 @@ public class CommandService implements INetworkDispatch {
sub += 5;
}
boolean isCombatCommand = false;
System.out.println(((String) visitor.getObject(i, 85-sub)));
if(((String) visitor.getObject(i, 3)).equals("failSpecialAttack") || ((String) visitor.getObject(i, 85-sub)).equals("defaultattack"))
isCombatCommand = true;
if (hasCharacterAbility || isCombatCommand) {
if (hasCharacterAbility || isCombatCommand(name)) {
CombatCommand command = new CombatCommand(name.toLowerCase());
commandLookup.add(command);
return command;
@@ -348,13 +315,7 @@ public class CommandService implements INetworkDispatch {
sub += 5;
}
boolean isCombatCommand = false;
if(((String) visitor.getObject(i, 3)).equals("failSpecialAttack") || ((String) visitor.getObject(i, 85-sub)).equals("defaultattack"))
isCombatCommand = true;
// "isCombatCommand" needs to be changed so that non-combat commands that are flagged to added to a combat queue are not considered combat commands
if (hasCharacterAbility || isCombatCommand) {
if (hasCharacterAbility || isCombatCommand(commandName)) {
CombatCommand command = new CombatCommand(commandName);
commandLookup.add(command);
return command;
@@ -374,27 +335,37 @@ public class CommandService implements INetworkDispatch {
return null;
}
public boolean isCombatCommand(String commandName) {
try {
DatatableVisitor visitor = ClientFileManager.loadFile("datatables/combat/combat_data.iff", DatatableVisitor.class);
for (int i = 0; i < visitor.getRowCount(); i++) {
if (visitor.getObject(i, 0) != null && ((String) (visitor.getObject(i, 0))).equalsIgnoreCase(commandName)) {
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public void processCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) {
actor.addCooldown(command.getCooldownGroup(), command.getCooldown());
if (command instanceof CombatCommand) {
processCombatCommand(actor, target, (CombatCommand) command, actionCounter, commandArgs);
} else {
if (FileUtilities.doesFileExist("scripts/commands/" + command.getCommandName() + ".py")) {
core.scriptService.callScript("scripts/commands/", command.getCommandName(), "run", core, actor, target, commandArgs);
} else if (FileUtilities.doesFileExist("scripts/commands/combat/" + command.getCommandName() + ".py")) {
core.scriptService.callScript("scripts/commands/combat/", command.getCommandName(), "run", core, actor, target, commandArgs);
}
}
}
public void processCombatCommand(CreatureObject attacker, SWGObject target, CombatCommand command, int actionCounter, String commandArgs) {
// Check if the person has access to this ability.
// Abilities (inc expertise ones) are added automatically as they level
// by reading the datatables.
// disabled for now (breaks all combat)
//if (!attacker.hasAbility(command.getCommandName())) {
// return;
//}
if(FileUtilities.doesFileExist("scripts/commands/combat/" + command.getCommandName() + ".py"))
{
core.scriptService.callScript("scripts/commands/combat/", command.getCommandName(), "setup", core, attacker, target, command);
@@ -502,7 +473,6 @@ public class CommandService implements INetworkDispatch {
@Override
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
data.order(ByteOrder.LITTLE_ENDIAN);
Client client = core.getClient(session);
@@ -514,7 +484,13 @@ public class CommandService implements INetworkDispatch {
CommandEnqueue commandEnqueue = new CommandEnqueue();
commandEnqueue.deserialize(data);
BaseSWGCommand command = getCommandByCRC(commandEnqueue.getCommandCRC());
int commandCRC = commandEnqueue.getCommandCRC();
if (aliases.containsKey(commandEnqueue.getCommandCRC())) {
commandCRC = aliases.get(commandCRC);
}
BaseSWGCommand command = getCommandByCRC(commandCRC);
if (command == null) {
//System.out.println("Unknown Command CRC: " + commandEnqueue.getCommandCRC());
@@ -553,26 +529,8 @@ public class CommandService implements INetworkDispatch {
}
public CombatCommand registerCombatCommand(String name) {
BaseSWGCommand command = getCommandByName(name);
if (command == null) {
return null;
}
if (command instanceof CombatCommand) {
return (CombatCommand) command;
} else {
System.out.println("Warning: Forced to make non-combat command " + name + " a combat command.");
commandLookup.remove(command);
CombatCommand combatCommand = new CombatCommand(name.toLowerCase());
commandLookup.add(combatCommand);
return combatCommand;
}
}
public BaseSWGCommand registerCombatCommand(String name) { return getCommandByName(name); }
public BaseSWGCommand registerCommand(String name) { return getCommandByName(name); }
public BaseSWGCommand registerGmCommand(String name) { return getCommandByName(name); }
public void registerAlias(String name, String target) { }
}
-1
View File
@@ -37,7 +37,6 @@ import protocol.swg.FactionResponseMessage;
import resources.common.FileUtilities;
import resources.common.Opcodes;
import resources.datatables.FactionStatus;
import resources.datatables.Options;
import resources.datatables.PvpStatus;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
-1
View File
@@ -23,7 +23,6 @@ package services.guild;
import java.util.Map;
import resources.common.Console;
import resources.guild.Guild;
import resources.objects.SWGList;
import resources.objects.guild.GuildObject;
+1 -1
View File
@@ -57,7 +57,7 @@ public class HouseTemplate
public boolean canBePlacedOn(String planetName)
{
if(placeablePlanets.contains(planetName)) return true;
else return false;
return false;
}
public int getLotCost()
{
+1 -7
View File
@@ -33,16 +33,11 @@ import java.util.Map;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import com.sleepycat.persist.EntityCursor;
import main.NGECore;
import protocol.swg.EnterStructurePlacementModeMessage;
import resources.objects.building.BuildingObject;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
import services.chat.Mail;
import services.equipment.BonusSetTemplate;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@@ -97,12 +92,11 @@ public class HousingService implements INetworkDispatch {
}
// Lot stuff
if(actor.getPlayerObject().getLotsRemaining() - structureLotCost < 0)
if(!actor.getPlayerObject().deductLots(structureLotCost))
{
actor.sendSystemMessage("You do not have enough available lots to place this structure.", (byte) 0); // should probably load this from an stf
return;
}
actor.getPlayerObject().deductLots(structureLotCost);
// Calculate our orientation and height
Quaternion quaternion = new Quaternion(1, 0, 0, 0);
+14 -4
View File
@@ -58,10 +58,6 @@ import com.sleepycat.persist.EntityCursor;
import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.PrimaryKey;
import protocol.swg.ChatFriendsListUpdate;
import protocol.swg.ChatOnChangeFriendStatus;
import protocol.swg.ChatOnGetFriendsList;
import protocol.swg.ChatRoomList;
import protocol.swg.CmdSceneReady;
import protocol.swg.CmdStartScene;
import protocol.swg.HeartBeatMessage;
@@ -70,6 +66,12 @@ import protocol.swg.ParametersMessage;
import protocol.swg.SelectCharacter;
import protocol.swg.ServerTimeMessage;
import protocol.swg.UnkByteFlag;
import protocol.swg.chat.ChatFriendsListUpdate;
import protocol.swg.chat.ChatOnChangeFriendStatus;
import protocol.swg.chat.ChatOnConnectAvatar;
import protocol.swg.chat.ChatOnGetFriendsList;
import protocol.swg.chat.ChatRoomList;
import protocol.swg.chat.ChatServerStatus;
import protocol.swg.objectControllerObjects.UiPlayEffect;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.CrcStringTableVisitor;
@@ -783,10 +785,18 @@ public class ObjectService implements INetworkDispatch {
core.chatService.loadMailHeaders(client);
core.simulationService.handleZoneIn(client);
creature.makeAware(creature);
ChatServerStatus chatStatus = new ChatServerStatus();
creature.getClient().getSession().write(chatStatus.serialize());
ChatOnConnectAvatar chatConnect = new ChatOnConnectAvatar();
creature.getClient().getSession().write(chatConnect.serialize());
ChatRoomList chatRooms = new ChatRoomList(core.chatService.getChatRooms());
creature.getClient().getSession().write(chatRooms.serialize());
//ChatOnGetFriendsList friendsListMessage = new ChatOnGetFriendsList(ghost);
//client.getSession().write(friendsListMessage.serialize());
@@ -28,7 +28,6 @@ import java.util.Random;
import java.util.Vector;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import com.sleepycat.persist.EntityCursor;
import main.NGECore;
import engine.resources.common.CRC;
-1
View File
@@ -25,7 +25,6 @@ import net.engio.mbassy.listener.Handler;
import resources.common.collidables.AbstractCollidable;
import resources.common.collidables.AbstractCollidable.EnterEvent;
import resources.common.collidables.AbstractCollidable.ExitEvent;
import services.SimulationService.MoveEvent;
import engine.resources.scene.Planet;
public class DynamicSpawnArea extends SpawnArea {
-2
View File
@@ -23,10 +23,8 @@ package services.spawn;
import java.util.Vector;
import main.NGECore;
import resources.datatables.Options;
import resources.datatables.PvpStatus;
import resources.objects.weapon.WeaponObject;
public class MobileTemplate {
-1
View File
@@ -28,7 +28,6 @@ import net.engio.mbassy.listener.Handler;
import resources.common.collidables.AbstractCollidable;
import resources.common.collidables.AbstractCollidable.EnterEvent;
import resources.common.collidables.AbstractCollidable.ExitEvent;
import services.SimulationService.MoveEvent;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
-2
View File
@@ -38,8 +38,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import org.python.core.Py;
import resources.common.collidables.CollidableCircle;
import resources.datatables.Options;
import resources.datatables.PvpStatus;
-1
View File
@@ -25,7 +25,6 @@ import net.engio.mbassy.listener.Handler;
import resources.common.collidables.AbstractCollidable;
import resources.common.collidables.AbstractCollidable.EnterEvent;
import resources.common.collidables.AbstractCollidable.ExitEvent;
import services.SimulationService.MoveEvent;
import engine.resources.scene.Planet;
public class StaticSpawnArea extends SpawnArea {
+10 -1
View File
@@ -23,7 +23,6 @@ package services.sui;
import java.nio.ByteOrder;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
@@ -82,6 +81,16 @@ public class SUIService implements INetworkDispatch {
if(target == null || owner == null)
return;
if(target.getGrandparent() != null && target.getGrandparent().getAttachment("structureAdmins") != null)
{
if(core.housingService.getPermissions(owner, target.getContainer()))
{
core.scriptService.callScript("scripts/radial/", "moveable", "createRadial", core, owner, target, request.getRadialOptions());
sendRadial(owner, target, request.getRadialOptions(), request.getRadialCount());
return;
}
}
core.scriptService.callScript("scripts/radial/", getRadialFilename(target), "createRadial", core, owner, target, request.getRadialOptions());
if(getRadialFilename(target).equals("default"))
return;
-1
View File
@@ -25,7 +25,6 @@ import java.nio.ByteOrder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
+1 -1
View File
@@ -56,7 +56,7 @@ public class CharonPacketUtils {
public static void printAnalysis(IoBuffer pack){
if (!NGECore.getInstance().PACKET_DEBUG)
if (!NGECore.PACKET_DEBUG)
return;
byte[] packArray = pack.array();