diff --git a/scripts/object/tangible/terminal/terminal_bank.py b/scripts/object/tangible/terminal/terminal_bank.py index 4f068472..64205c68 100644 --- a/scripts/object/tangible/terminal/terminal_bank.py +++ b/scripts/object/tangible/terminal/terminal_bank.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'bank') + object.setAttachment('radial_filename', 'terminal/bank') core.mapService.addLocation(object.getPlanet(), 'Bank Terminal', object.getPosition().x, object.getPosition().z, 41, 42, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_cloning.py b/scripts/object/tangible/terminal/terminal_cloning.py index 91f80095..dc256f9a 100644 --- a/scripts/object/tangible/terminal/terminal_cloning.py +++ b/scripts/object/tangible/terminal/terminal_cloning.py @@ -1,6 +1,6 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'cloning_terminal') + object.setAttachment('radial_filename', 'terminal/cloning_terminal') return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_travel.py b/scripts/object/tangible/terminal/terminal_travel.py index 160aac1c..07222fe6 100644 --- a/scripts/object/tangible/terminal/terminal_travel.py +++ b/scripts/object/tangible/terminal/terminal_travel.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'travel_terminal') + object.setAttachment('radial_filename', 'terminal/travel_terminal') return \ No newline at end of file diff --git a/scripts/object/tangible/travel/ticket_collector/ticket_collector.py b/scripts/object/tangible/travel/ticket_collector/ticket_collector.py index d243308d..a4dcc12f 100644 --- a/scripts/object/tangible/travel/ticket_collector/ticket_collector.py +++ b/scripts/object/tangible/travel/ticket_collector/ticket_collector.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'npc_ticket_collector') + object.setAttachment('radial_filename', 'npc/npc_ticket_collector') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/aakuan_ring.py b/scripts/object/tangible/wearables/ring/aakuan_ring.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/aakuan_ring.py +++ b/scripts/object/tangible/wearables/ring/aakuan_ring.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_bounty_hunter_ring_01_02.py b/scripts/object/tangible/wearables/ring/item_bounty_hunter_ring_01_02.py index 3040d4eb..e8042f0b 100644 --- a/scripts/object/tangible/wearables/ring/item_bounty_hunter_ring_01_02.py +++ b/scripts/object/tangible/wearables/ring/item_bounty_hunter_ring_01_02.py @@ -8,4 +8,5 @@ def setup(core, object): object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 6) object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 6) object.setStringAttribute('class_required', 'Bounty Hunter') + object.setAttachment('radial_filename', 'ring/unity') return diff --git a/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_01_02.py b/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_01_02.py index fa564825..1219d4db 100644 --- a/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_01_02.py +++ b/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_01_02.py @@ -8,4 +8,5 @@ def setup(core, object): object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 6) object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 6) object.setStringAttribute('class_required', 'Jedi') + object.setAttachment('radial_filename', 'ring/unity') return diff --git a/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_02_01.py b/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_02_01.py index 90985ac0..7fc2c243 100644 --- a/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_02_01.py +++ b/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_02_01.py @@ -8,4 +8,5 @@ def setup(core, object): object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 5) object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 5) object.setStringAttribute('class_required', 'Jedi') + object.setAttachment('radial_filename', 'ring/unity') return diff --git a/scripts/object/tangible/wearables/ring/ring_gcw_imperial.py b/scripts/object/tangible/wearables/ring/ring_gcw_imperial.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_gcw_imperial.py +++ b/scripts/object/tangible/wearables/ring/ring_gcw_imperial.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_gcw_rebel.py b/scripts/object/tangible/wearables/ring/ring_gcw_rebel.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_gcw_rebel.py +++ b/scripts/object/tangible/wearables/ring/ring_gcw_rebel.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_mark_hero.py b/scripts/object/tangible/wearables/ring/ring_mark_hero.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_mark_hero.py +++ b/scripts/object/tangible/wearables/ring/ring_mark_hero.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_nightsister.py b/scripts/object/tangible/wearables/ring/ring_nightsister.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_nightsister.py +++ b/scripts/object/tangible/wearables/ring/ring_nightsister.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_s01.py b/scripts/object/tangible/wearables/ring/ring_s01.py index dc6ea0b1..83da2342 100644 --- a/scripts/object/tangible/wearables/ring/ring_s01.py +++ b/scripts/object/tangible/wearables/ring/ring_s01.py @@ -1,6 +1,7 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return def equip(core, actor, object): diff --git a/scripts/object/tangible/wearables/ring/ring_s02.py b/scripts/object/tangible/wearables/ring/ring_s02.py index 2ca3d3ca..f594fe2b 100644 --- a/scripts/object/tangible/wearables/ring/ring_s02.py +++ b/scripts/object/tangible/wearables/ring/ring_s02.py @@ -1,6 +1,7 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return def equip(core, actor, object): diff --git a/scripts/object/tangible/wearables/ring/ring_s03.py b/scripts/object/tangible/wearables/ring/ring_s03.py index 418b5aa4..c4aa2f2f 100644 --- a/scripts/object/tangible/wearables/ring/ring_s03.py +++ b/scripts/object/tangible/wearables/ring/ring_s03.py @@ -1,6 +1,7 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return def equip(core, actor, object): diff --git a/scripts/object/tangible/wearables/ring/ring_s03_quest.py b/scripts/object/tangible/wearables/ring/ring_s03_quest.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_s03_quest.py +++ b/scripts/object/tangible/wearables/ring/ring_s03_quest.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_s04.py b/scripts/object/tangible/wearables/ring/ring_s04.py index 6410d76f..8eee5461 100644 --- a/scripts/object/tangible/wearables/ring/ring_s04.py +++ b/scripts/object/tangible/wearables/ring/ring_s04.py @@ -1,6 +1,7 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return def equip(core, actor, object): diff --git a/scripts/radial/lifeday_gift.py b/scripts/radial/lifeday_gift.py index 696d7662..f498c4bc 100644 --- a/scripts/radial/lifeday_gift.py +++ b/scripts/radial/lifeday_gift.py @@ -53,5 +53,5 @@ def handleSelection(core, actor, object, option): inventory.add(reward1) inventory.add(reward2) - core.objectService.destroyObject(object) + core.commandService.callCommand(actor, 'serverdestroyobject', object, None) return diff --git a/scripts/radial/npc_ticket_collector.py b/scripts/radial/npc/npc_ticket_collector.py similarity index 100% rename from scripts/radial/npc_ticket_collector.py rename to scripts/radial/npc/npc_ticket_collector.py diff --git a/scripts/radial/ring/unity.py b/scripts/radial/ring/unity.py new file mode 100644 index 00000000..704268a4 --- /dev/null +++ b/scripts/radial/ring/unity.py @@ -0,0 +1,35 @@ +from resources.common import RadialOptions +from services.sui.SUIWindow import Trigger +import sys + +def createRadial(core, owner, target, radials): + + ghost = owner.getSlottedObject('ghost') + if ghost is None: + return + print (owner.getTargetId()) + print (owner.getObjectId()) + if ghost.getSpouseName() is None: + targetPlayer = core.objectService.getObject(owner.getTargetId()) + if targetPlayer is not None and targetPlayer.getSlottedObject('ghost') is not None: + radials.add(RadialOptions(0, 69, 1, 'Propose Unity')) + return + +def handleSelection(core, owner, target, option): + if option == 69 and target: + tGhost = core.objectService.getObject(owner.getTargetId()).getSlottedObject('ghost') + suiSvc = core.suiService + targetWindow = suiSvc.createMessageBox(3, 'Proposal', owner.getCustomName() + ' would like to marry you. Would you like to marry?', tGhost, owner, 10) + returnList = Vector() + targetWindow.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSUI) + targetWindow.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleSUI) + suiSvc.openSUIWindow(targetWindow) + return + return + +def handleSUI(owner, window, eventType, returnList): + if eventType == 0: + ghost = owner.getSlottedObject('ghost') + ghost.setSpouseName("Waverunner") + return + return \ No newline at end of file diff --git a/scripts/radial/bank.py b/scripts/radial/terminal/bank.py similarity index 100% rename from scripts/radial/bank.py rename to scripts/radial/terminal/bank.py diff --git a/scripts/radial/cloning_terminal.py b/scripts/radial/terminal/cloning_terminal.py similarity index 100% rename from scripts/radial/cloning_terminal.py rename to scripts/radial/terminal/cloning_terminal.py diff --git a/scripts/radial/travel_terminal.py b/scripts/radial/terminal/travel_terminal.py similarity index 100% rename from scripts/radial/travel_terminal.py rename to scripts/radial/terminal/travel_terminal.py diff --git a/scripts/radial/travel_ticket.py b/scripts/radial/travel_ticket.py index a42df278..fd898498 100644 --- a/scripts/radial/travel_ticket.py +++ b/scripts/radial/travel_ticket.py @@ -21,7 +21,7 @@ def handleSelection(core, owner, target, option): if tp.isShuttleAvailable() is True: core.travelService.doTransport(owner, core.travelService.getTravelPointByName(target.getStringAttribute('@obj_attr_n:travel_arrival_planet'), target.getStringAttribute('@obj_attr_n:travel_arrival_point'))) - core.objectService.destroyObject(target) + core.commandService.callCommand(owner, 'serverdestroyobject', target, None) return return else: diff --git a/src/protocol/swg/CharacterSheetResponseMessage.java b/src/protocol/swg/CharacterSheetResponseMessage.java new file mode 100644 index 00000000..3e3dbc81 --- /dev/null +++ b/src/protocol/swg/CharacterSheetResponseMessage.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * 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; + +import java.nio.ByteOrder; + +import org.apache.mina.core.buffer.IoBuffer; + +import resources.objects.player.PlayerObject; +import engine.resources.common.CRC; + +public class CharacterSheetResponseMessage extends SWGMessage { + + private PlayerObject player; + public CharacterSheetResponseMessage(PlayerObject player) { + this.player = player; + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + buffer.putShort((short) 12); + buffer.putInt(CRC.StringtoCRC("CharacterSheetResponseMessage")); + buffer.putShort((short) 0); //unk + buffer.putInt(1); // unk + + + buffer.putFloat(0); // bind x + buffer.putFloat(0); // bind z + buffer.putFloat(0); // bind y + buffer.putInt(0); // planet + + buffer.putFloat(0); // bank x + buffer.putFloat(0); // bank z + buffer.putFloat(0); // bank y + buffer.put(getAsciiString("tatooine")); // planet + + buffer.putFloat(0); // home x + buffer.putFloat(0); // home z + buffer.putFloat(0); // home y + buffer.putInt(0); // home planet + + if (player.getSpouseName() == null) + buffer.putInt(0); + else + buffer.put(getUnicodeString(player.getSpouseName())); // spouse name <<<<< CORRECT + + buffer.putInt(10); // lots remaining <<<<<<< CORRECT + return buffer.flip(); + } + +} diff --git a/src/resources/objects/player/PlayerMessageBuilder.java b/src/resources/objects/player/PlayerMessageBuilder.java index fdbb53cc..d01c78ff 100644 --- a/src/resources/objects/player/PlayerMessageBuilder.java +++ b/src/resources/objects/player/PlayerMessageBuilder.java @@ -28,6 +28,7 @@ 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; @@ -362,24 +363,19 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { PlayerObject player = (PlayerObject) object; player.setXpListUpdateCounter(player.getXpListUpdateCounter() + 1); - // Some problem with createDelta() - IoBuffer result = bufferPool.allocate(42 + type.length(), false).order(ByteOrder.LITTLE_ENDIAN); - result.putShort((short) 5); - result.putInt(CRC.StringtoCRC("DeltasMessage")); - result.putLong(object.getContainer().getObjectID()); - result.put("YALP".getBytes()); - result.put((byte) 8); - result.putInt(19 + type.length()); - result.putShort((short) 1); - result.putShort((short) 0); - result.putInt(1); + IoBuffer result = bufferPool.allocate(15 + type.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + result.putInt(player.getXpList().size()); result.putInt(player.getXpListUpdateCounter()); result.put((byte) ((alreadyExists) ? 2 : 0)); - result.putShort((short) type.length()); - result.put(type.getBytes()); + result.put(getAsciiString(type)); result.putInt(amount); - return result.flip(); + int size = result.position(); + result.flip(); + //StringUtilities.printBytes(result.array()); + result = createDelta("PLAY", (byte) 8, (short) 1, (short) 0, result, size + 4); + return result; } public IoBuffer buildProfessionWheelPositionDelta(String professionWheelPosition) { diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 90d9d507..5a5732dc 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import resources.common.Console; import resources.objects.intangible.IntangibleObject; import resources.objects.waypoint.WaypointObject; @@ -41,7 +42,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=4) +@Persistent(version=5) public class PlayerObject extends IntangibleObject { // PLAY 3 @@ -117,6 +118,7 @@ public class PlayerObject extends IntangibleObject { private int jediState = 0; // unused in NGE private String biography = ""; + private String spouse; @NotPersistent private PlayerMessageBuilder messageBuilder; @@ -229,6 +231,8 @@ public class PlayerObject extends IntangibleObject { synchronized(objectMutex) { xpExists = xpList.containsKey(type); xpList.put(type, amount); + Console.println("Put " + type + " exp of " + amount + " in the map."); + Console.println("Map is now: " + xpList.get(type).intValue()); } if (getContainer() != null && getContainer().getClient() != null && getContainer().getClient().getSession() != null) { @@ -679,6 +683,16 @@ public class PlayerObject extends IntangibleObject { } } + public String getSpouseName() { + return spouse; + } + + public void setSpouseName(String spouse) { + synchronized(objectMutex) { + this.spouse = spouse; + } + } + public int getFlagBitmask() { synchronized(objectMutex) { return flagBitmask; diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index cb5d8dd8..dd870159 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -345,8 +345,7 @@ public class CharacterService implements INetworkDispatch { session.write(core.loginService.getLoginCluster().serialize()); session.write(core.loginService.getLoginClusterStatus(client).serialize()); - session.write(success.serialize()); - session.write((new ClientMfdStatusUpdateMessage((float) 2, "/GroundHUD.MFDStatus.vsp.role.targetLevel")).serialize()); + session.write(success.serialize()); } }); diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 20dffc73..c5d4a4b6 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -37,6 +37,7 @@ import java.util.concurrent.TimeUnit; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; +import protocol.swg.CharacterSheetResponseMessage; import protocol.swg.ClientIdMsg; import protocol.swg.ClientMfdStatusUpdateMessage; import protocol.swg.CreateClientPathMessage; @@ -300,6 +301,13 @@ public class PlayerService implements INetworkDispatch { PlayerMoneyResponse response = new PlayerMoneyResponse(creature.getCashCredits(), creature.getBankCredits()); session.write(response.serialize()); + + PlayerObject ghost = (PlayerObject) player.getSlottedObject("ghost"); + if (ghost == null) + return; + + CharacterSheetResponseMessage msg = new CharacterSheetResponseMessage(ghost); + session.write(msg.serialize()); } });