diff --git a/scripts/commands/editbiography.py b/scripts/commands/editbiography.py new file mode 100644 index 00000000..cfdb755f --- /dev/null +++ b/scripts/commands/editbiography.py @@ -0,0 +1,10 @@ +import sys +from protocol.swg.objectControllerObjects import BiographyUpdate +from protocol.swg import ObjControllerMessage + +def setup(): + return + +def run(core, actor, target, commandString): + print ('do you do anything?!') + return \ No newline at end of file diff --git a/scripts/commands/lfg.py b/scripts/commands/lfg.py index dc0033c5..4d22f5ca 100644 --- a/scripts/commands/lfg.py +++ b/scripts/commands/lfg.py @@ -1,4 +1,4 @@ -from resources.common import PlayerFlags +from resources.datatables import PlayerFlags import sys def setup(): diff --git a/scripts/commands/newbiehelper.py b/scripts/commands/newbiehelper.py index cce8079c..277ecd01 100644 --- a/scripts/commands/newbiehelper.py +++ b/scripts/commands/newbiehelper.py @@ -1,4 +1,4 @@ -from resources.common import PlayerFlags +from resources.datatables import PlayerFlags import sys def setup(): diff --git a/scripts/commands/requestbiography.py b/scripts/commands/requestbiography.py new file mode 100644 index 00000000..41ed2382 --- /dev/null +++ b/scripts/commands/requestbiography.py @@ -0,0 +1,24 @@ +import sys +from protocol.swg.objectControllerObjects import BiographyUpdate +from protocol.swg import ObjControllerMessage + + +# Called when open Character tab +def setup(): + return + +def run(core, actor, target, commandString): + + if actor is None: + return + + if target is None: + return + + tGhost = target.getSlottedObject('ghost') + + bioUpdate = BiographyUpdate(actor.getObjectId(), target.getObjectId(), tGhost.getBiography()) + objMsg = ObjControllerMessage(11, bioUpdate) + actor.getClient().getSession().write(objMsg.serialize()) + + return \ No newline at end of file diff --git a/scripts/commands/roleplay.py b/scripts/commands/roleplay.py index a862303d..312e93fc 100644 --- a/scripts/commands/roleplay.py +++ b/scripts/commands/roleplay.py @@ -1,5 +1,5 @@ from java.lang import Integer -from resources.common import PlayerFlags +from resources.datatables import PlayerFlags import sys def setup(): diff --git a/scripts/commands/setbiography.py b/scripts/commands/setbiography.py new file mode 100644 index 00000000..2d113622 --- /dev/null +++ b/scripts/commands/setbiography.py @@ -0,0 +1,25 @@ +import sys +from protocol.swg.objectControllerObjects import BiographyUpdate +from protocol.swg import ObjControllerMessage + +def setup(): + return + +def run(core, actor, target, commandString): + if actor is None: + return + + if len(commandString) > 200: + return + + ghost = actor.getSlottedObject('ghost') + + if ghost is None: + return + + ghost.setBiography(commandString) + + bioUpdate = BiographyUpdate(actor.getObjectId(), actor.getObjectId(), commandString) + objMsg = ObjControllerMessage(11, bioUpdate) + actor.getClient().getSession().write(objMsg.serialize()) + return \ No newline at end of file diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 43449a42..f6dc2f4e 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -48,5 +48,7 @@ def run(core, actor, target, commandString): elif command == 'anim' and arg1: actor.setCurrentAnimation(arg1) actor.sendSystemMessage('Performed ' + arg1 ,0) - + + elif command == 'changeBio' and arg1: + actor.getSlottedObject('ghost').setBiography(arg1) return diff --git a/src/protocol/swg/objectControllerObjects/BiographyUpdate.java b/src/protocol/swg/objectControllerObjects/BiographyUpdate.java new file mode 100644 index 00000000..30e2f1a2 --- /dev/null +++ b/src/protocol/swg/objectControllerObjects/BiographyUpdate.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * 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 . + * + * 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 BiographyUpdate extends ObjControllerObject { + + private long objectId; + private long targetObjectId; + + private String biography; + + public BiographyUpdate(long objectId, long targetObjectId, String biography) { + this.objectId = objectId; + this.biography = biography; + this.targetObjectId = targetObjectId; + } + + @Override + public void deserialize(IoBuffer data) { + + + } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(28 + (biography.length() * 2)).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(0x000001DB); + buffer.putLong(objectId); // requester + buffer.putInt(0); + buffer.putLong(targetObjectId); + buffer.put(getUnicodeString(biography)); + + return buffer.flip(); + } + + +} diff --git a/src/protocol/swg/objectControllerObjects/SecureTrade.java b/src/protocol/swg/objectControllerObjects/SecureTrade.java index e621072f..bd61aad4 100644 --- a/src/protocol/swg/objectControllerObjects/SecureTrade.java +++ b/src/protocol/swg/objectControllerObjects/SecureTrade.java @@ -27,8 +27,7 @@ public class SecureTrade extends ObjControllerObject{ @Override public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); - result.setAutoExpand(true); + IoBuffer result = IoBuffer.allocate(40).order(ByteOrder.LITTLE_ENDIAN); result.putInt(ObjControllerMessage.SPACIAL_CHAT); result.putInt(1); diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index 7d6e6b21..a7cac034 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -33,5 +33,4 @@ public class ObjControllerOpcodes { public static final int BUFF_BUILDER_CHANGE = 0x5A020000; public static final int MISSION_LIST_REQUEST = 0xF5000000; public static final int ChangeRoleIconChoice = 0x4D040000; - } diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 44cd7b84..53929d98 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -41,7 +41,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=3) +@Persistent(version=4) public class PlayerObject extends IntangibleObject { // PLAY 3 @@ -116,6 +116,8 @@ public class PlayerObject extends IntangibleObject { private int jediState = 0; // unused in NGE + private String biography = ""; + @NotPersistent private PlayerMessageBuilder messageBuilder; @@ -664,6 +666,16 @@ public class PlayerObject extends IntangibleObject { } } + public String getBiography() { + return biography; + } + + public void setBiography(String biography) { + synchronized(objectMutex) { + this.biography = biography; + } + } + public int getFlagBitmask() { synchronized(objectMutex) { return flagBitmask; diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 5c861834..b5c0bc2b 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -578,7 +578,6 @@ public class PlayerService implements INetworkDispatch { return; player.getTitleList().add(title); - Console.println("Added title" + title); } diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index b3adb121..475f9cc3 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -159,6 +159,9 @@ public class SimulationService implements INetworkDispatch { core.commandService.registerCommand("roleplay"); core.commandService.registerAlias("afk", "toggleawayfromkeyboard"); core.commandService.registerCommand("toggledisplayingfactionrank"); + core.commandService.registerCommand("editbiography"); + core.commandService.registerCommand("setbiography"); + core.commandService.registerCommand("requestbiography"); } @@ -620,7 +623,7 @@ public class SimulationService implements INetworkDispatch { PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); core.weatherService.sendWeather(object); - + if (!object.hasSkill(ghost.getProfessionWheelPosition())) { object.showFlyText("cbt_spam", "skill_up", (float) 2.5, new RGB(154, 205, 50), 0); object.playEffectObject("clienteffect/skill_granted.cef", "");