Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Ziggeh
2014-03-09 18:43:20 +01:00
29 changed files with 164 additions and 23 deletions
@@ -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
@@ -1,6 +1,6 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'cloning_terminal')
object.setAttachment('radial_filename', 'terminal/cloning_terminal')
return
@@ -1,5 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'travel_terminal')
object.setAttachment('radial_filename', 'terminal/travel_terminal')
return
@@ -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
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
@@ -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
@@ -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
@@ -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
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
@@ -1,6 +1,7 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
def equip(core, actor, object):
@@ -1,6 +1,7 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
def equip(core, actor, object):
@@ -1,6 +1,7 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
def equip(core, actor, object):
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
@@ -1,6 +1,7 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
return
def equip(core, actor, object):
+1 -1
View File
@@ -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
+35
View File
@@ -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
+1 -1
View File
@@ -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:
@@ -0,0 +1,76 @@
/*******************************************************************************
* 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;
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();
}
}
@@ -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) {
+15 -1
View File
@@ -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;
+1 -2
View File
@@ -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());
}
});
+8
View File
@@ -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());
}
});