fixed friend list deltas

This commit is contained in:
Light2
2013-08-24 17:05:18 +02:00
parent b2354a18fd
commit 341b9519bf
5 changed files with 19 additions and 5 deletions
+5 -1
View File
@@ -7,6 +7,8 @@ def setup():
def run(core, actor, target, commandString):
actorFaction = actor.getFaction()
print 'test'
if commandString == ('imperial') and actorFaction != "imperial":
actor.setFaction('imperial')
actor.sendSystemMessage('You are aligned to the Imperial faction', 0)
@@ -21,4 +23,6 @@ def run(core, actor, target, commandString):
actor.setFaction('neutral')
actor.sendSystemMessage('You aren\'t aligned to any faction.', 0)
return
return
return
+2 -1
View File
@@ -7,4 +7,5 @@ def run(core, actor, target, commandString):
ghost = actor.getSlottedObject('ghost')
chatSvc = core.chatService
chatSvc.removeFriend(ghost, commandString, 1)
return
return
@@ -509,9 +509,12 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder {
public IoBuffer buildFriendAddDelta(String friend) {
IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
IoBuffer buffer = bufferPool.allocate(13 + friend.length(), false).order(ByteOrder.LITTLE_ENDIAN);
PlayerObject player = (PlayerObject) object;
buffer.putInt(1);
buffer.putInt(player.getFriendListUpdateCounter());
buffer.put((byte) 1); // updateType (SubType)
buffer.putShort((short) player.getFriendList().indexOf(friend));
@@ -528,9 +531,12 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder {
public IoBuffer buildFriendRemoveDelta(String friend) {
IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
IoBuffer buffer = bufferPool.allocate(11, false).order(ByteOrder.LITTLE_ENDIAN);
PlayerObject player = (PlayerObject) object;
buffer.putInt(1);
buffer.putInt(player.getFriendListUpdateCounter());
buffer.put((byte) 0); // updateType (SubType)
buffer.putShort((short) player.getFriendList().indexOf(friend));
@@ -376,12 +376,14 @@ public class PlayerObject extends SWGObject {
public void friendAdd(String friend) {
synchronized(objectMutex) {
setFriendListUpdateCounter(getFriendListUpdateCounter() + 1);
getContainer().getClient().getSession().write(messageBuilder.buildFriendAddDelta(friend));
}
}
public void friendRemove(String friend) {
synchronized(objectMutex) {
setFriendListUpdateCounter(getFriendListUpdateCounter() + 1);
getContainer().getClient().getSession().write(messageBuilder.buildFriendRemoveDelta(friend));
}
}
+2 -1
View File
@@ -78,8 +78,9 @@ public class CommandService implements INetworkDispatch {
BaseSWGCommand command = getCommandByCRC(commandEnqueue.getCommandCRC());
if(command == null)
if(command == null) {
return;
}
// TODO: command filters for state, posture etc.