diff --git a/scripts/object/tangible/terminal/terminal_cloning.py b/scripts/object/tangible/terminal/terminal_cloning.py index ccad8904..91f80095 100644 --- a/scripts/object/tangible/terminal/terminal_cloning.py +++ b/scripts/object/tangible/terminal/terminal_cloning.py @@ -1,4 +1,6 @@ import sys def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'cloning_terminal') + return + \ No newline at end of file diff --git a/scripts/radial/bank.py b/scripts/radial/bank.py index db6a08a1..e0faaf87 100644 --- a/scripts/radial/bank.py +++ b/scripts/radial/bank.py @@ -61,7 +61,7 @@ def handleSelection(core, owner, target, option): return -def handleTransfer(core, owner, eventType, returnList): +def handleTransfer(owner, window, eventType, returnList): if eventType == 0 and len(returnList) == 2: cashCredits = int(returnList.get(0)) diff --git a/scripts/radial/cloning_terminal.py b/scripts/radial/cloning_terminal.py new file mode 100644 index 00000000..4809d1d6 --- /dev/null +++ b/scripts/radial/cloning_terminal.py @@ -0,0 +1,43 @@ +from resources.common import RadialOptions +from services.sui.SUIService import MessageBoxType +from services.sui.SUIWindow import Trigger +from java.util import Vector +import sys + +def createRadial(core, owner, target, radials): + return + +def handleSelection(core, owner, target, option): + + if option == 21 and target: + suiSvc = core.suiService + suiWindow = suiSvc.createMessageBox(MessageBoxType.MESSAGE_BOX_OK_CANCEL, '@base_player:clone_confirm_title', '@base_player:clone_confirm_prompt', owner, target, 15) + returnParams = Vector() + returnParams.add('btnOk:Text') + returnParams.add('btnCancel:Text') + suiWindow.addHandler(0, '', Trigger.TRIGGER_OK, returnParams, handleSUI) + suiWindow.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnParams, handleSUI) + suiSvc.openSUIWindow(suiWindow) + + return + +def handleSUI(owner, window, eventType, returnList): + + if eventType == 0: + cash = owner.getCashCredits() + bank = owner.getBankCredits() + if bank < 1000 and cash < 1000: + owner.sendSystemMessage('You lack the credits required to cover the cost of cloning.', 0) + return + elif bank > 1000: + owner.setBankCredits(bank - 1000) + elif cash > 1000 and bank < 1000: + owner.setCashCredits(cash - 1000) + + owner.setAttachment('preDesignatedCloner', window.getRangeObject().getGrandparent().getObjectID()) + owner.sendSystemMessage('@base_player:clone_success', 0) + + + return + + \ No newline at end of file diff --git a/src/protocol/swg/objectControllerObjects/StartTask.java b/src/protocol/swg/objectControllerObjects/StartTask.java index da3e74b7..5a9664f0 100644 --- a/src/protocol/swg/objectControllerObjects/StartTask.java +++ b/src/protocol/swg/objectControllerObjects/StartTask.java @@ -48,10 +48,9 @@ public class StartTask extends ObjControllerObject { @Override public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(37).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer result = IoBuffer.allocate(45).order(ByteOrder.LITTLE_ENDIAN); result.putInt(ObjControllerMessage.START_TASK); - result.putLong(objectId); result.putInt(0); result.put((byte) 4); // 0 for no cooldown, 0x26 adds execute time (usually 0.25) diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index c3cb95fa..6dfc165b 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -205,9 +205,18 @@ public class PlayerService implements INetworkDispatch { Map cloneData = new HashMap(); Point3D position = creature.getWorldPosition(); + SWGObject preDesignatedCloner = null; + + if(creature.getAttachment("preDesignatedCloner") != null) { + preDesignatedCloner = core.objectService.getObject((long) creature.getAttachment("preDesignatedCloner")); + if(preDesignatedCloner != null) + cloneData.put(preDesignatedCloner.getObjectID(), core.mapService.getClosestCityName(preDesignatedCloner) /*+ " (" + String.valueOf(position.getDistance2D(cloner.getPosition())) + "m)"*/); + } + for(SWGObject cloner : cloners) { - cloneData.put(cloner.getObjectID(), core.mapService.getClosestCityName(cloner) /*+ " (" + String.valueOf(position.getDistance2D(cloner.getPosition())) + "m)"*/); + if(cloner != preDesignatedCloner) + cloneData.put(cloner.getObjectID(), core.mapService.getClosestCityName(cloner) /*+ " (" + String.valueOf(position.getDistance2D(cloner.getPosition())) + "m)"*/); } @@ -215,6 +224,7 @@ public class PlayerService implements INetworkDispatch { cloneData, creature, null, 0); Vector returnList = new Vector(); returnList.add("List.lstList:SelectedRow"); + window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() { @SuppressWarnings("unchecked") diff --git a/src/services/sui/SUIService.java b/src/services/sui/SUIService.java index 5d1c494a..9722b691 100644 --- a/src/services/sui/SUIService.java +++ b/src/services/sui/SUIService.java @@ -150,7 +150,7 @@ public class SUIService implements INetworkDispatch { PyObject func = window.getFunctionByEventId(suiEvent.getEventType()); if(func != null) - func.__call__(Py.java2py(core), Py.java2py(owner), Py.java2py(suiEvent.getEventType()), Py.java2py(suiEvent.getReturnList())); + func.__call__(Py.java2py(owner), Py.java2py(window), Py.java2py(suiEvent.getEventType()), Py.java2py(suiEvent.getReturnList())); SUICallback callback = window.getCallbackByEventId(suiEvent.getEventType());