mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-13 03:13:26 -04:00
Finished Character Sheet, Fixed TARGET_UPDATE, Able to marry players now
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import sys
|
||||
from engine.resources.scene import Point3D
|
||||
from protocol.swg import CommPlayerMessage
|
||||
from protocol.swg.objectControllerObjects import ShowLootBox
|
||||
from protocol.swg import ObjControllerMessage
|
||||
from engine.resources.objects import SWGObject
|
||||
from jarray import array
|
||||
|
||||
def setup():
|
||||
return
|
||||
@@ -53,24 +48,4 @@ def run(core, actor, target, commandString):
|
||||
actor.addAbility(str(arg1))
|
||||
actor.sendSystemMessage('You have learned ' + arg1 + '')
|
||||
|
||||
elif command == 'anim' and arg1:
|
||||
actor.doSkillAnimation(arg1)
|
||||
actor.sendSystemMessage('Performed ' + arg1 ,0)
|
||||
|
||||
elif command == 'changeBio' and arg1:
|
||||
actor.getSlottedObject('ghost').setBiography(arg1)
|
||||
|
||||
elif command == 'rewardMe':
|
||||
testObject = core.objectService.createObject('object/weapon/ranged/rifle/shared_rifle_t21.iff', actor.getPlanet())
|
||||
testObject.setCustomName('Crush4r')
|
||||
testObject.setStringAttribute('crafter', 'Wavescrub')
|
||||
dGun = core.objectService.createObject('object/weapon/ranged/rifle/shared_rifle_tc22_blaster.iff', actor.getPlanet())
|
||||
dGun.setCustomName('Supertoms Gun')
|
||||
dGun.setStringAttribute('crafter', 'Wavescrub')
|
||||
core.playerService.giveItems(actor, testObject, dGun)
|
||||
return
|
||||
|
||||
elif command == 'comm':
|
||||
comm = CommPlayerMessage(actor.getObjectId())
|
||||
actor.getClient().getSession().write(comm.serialize())
|
||||
return
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from resources.common import RadialOptions
|
||||
from services.sui.SUIWindow import Trigger
|
||||
from java.util import Vector
|
||||
from main import NGECore
|
||||
import sys
|
||||
|
||||
def createRadial(core, owner, target, radials):
|
||||
@@ -7,29 +9,89 @@ 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:
|
||||
|
||||
if ghost.getSpouseName() is None or "":
|
||||
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'))
|
||||
radials.add(RadialOptions(0, 69, 1, '@unity:mnu_propose'))
|
||||
else:
|
||||
radials.add(RadialOptions(0, 70, 1, '@unity:mnu_divorce'))
|
||||
return
|
||||
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)
|
||||
|
||||
if tGhost.getSpouseName() is not None:
|
||||
owner.sendSystemMessage('@unity:target_married', 0)
|
||||
return
|
||||
|
||||
if tGhost.getPosition().getDistance2D(owner.getWorldPosition()) < 50:
|
||||
owner.sendSystemMessage('@unity:out_of_range', 0)
|
||||
return
|
||||
|
||||
else:
|
||||
targetWindow = suiSvc.createMessageBox(3, '@unity:accept_title', owner.getCustomName() + ' is proposing unity to you. Do you wish to accept?', tGhost.getContainer(), owner, 15)
|
||||
returnList = Vector()
|
||||
|
||||
targetWindow.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSUI)
|
||||
targetWindow.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleSUI)
|
||||
tGhost.getContainer().setAttachment("proposer", owner.getCustomName())
|
||||
suiSvc.openSUIWindow(targetWindow)
|
||||
|
||||
target.setAttachment("unity", target)
|
||||
return
|
||||
return
|
||||
|
||||
if option == 70:
|
||||
married = owner.getSlottedObject('ghost').getSpouseName()
|
||||
otherPlayer = NGECore.getInstance().objectService.getObjectByCustomName(married)
|
||||
|
||||
if otherPlayer is None:
|
||||
return
|
||||
ghost = otherPlayer.getSlottedObject('ghost')
|
||||
|
||||
if ghost is None:
|
||||
return
|
||||
|
||||
owner.sendSystemMessage('Your union with ' + married + 'has ended.', 0)
|
||||
|
||||
owner.setSpouseName("")
|
||||
otherPlayer.setSpouseName("")
|
||||
|
||||
target.setAttachment("unity", None)
|
||||
return
|
||||
return
|
||||
|
||||
def handleSUI(owner, window, eventType, returnList):
|
||||
if eventType == 0:
|
||||
ghost = owner.getSlottedObject('ghost')
|
||||
ghost.setSpouseName("Waverunner")
|
||||
return
|
||||
return
|
||||
if eventType == 0:
|
||||
ghost = owner.getSlottedObject('ghost')
|
||||
if ghost is None:
|
||||
return
|
||||
|
||||
print (owner.getAttachment("proposer"))
|
||||
core = NGECore.getInstance()
|
||||
proposer = core.objectService.getObjectByCustomName(owner.getAttachment("proposer"))
|
||||
if proposer is None:
|
||||
return
|
||||
print ('not none')
|
||||
pGhost = proposer.getSlottedObject('ghost')
|
||||
if pGhost is None:
|
||||
return
|
||||
|
||||
ghost.setSpouseName(proposer.getCustomName())
|
||||
pGhost.setSpouseName(owner.getCustomName())
|
||||
|
||||
owner.sendSystemMessage('Your union with ' + proposer.getCustomName() + ' is complete.', 0)
|
||||
proposer.sendSystemMessage('Your union with ' + owner.getCustomName() + ' is complete.', 0)
|
||||
owner.setAttachment("proposer", None)
|
||||
|
||||
return
|
||||
if eventType == 1:
|
||||
proposer = core.objectService.getObjectByCustomName(owner.getAttachment("proposer"))
|
||||
proposer.sendSystemMessage('@unity:declined', 0)
|
||||
owner.setAttachment("proposer", None)
|
||||
return
|
||||
return
|
||||
@@ -16,17 +16,22 @@
|
||||
* 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.
|
||||
* 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 main.NGECore;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Point3D;
|
||||
|
||||
public class CharacterSheetResponseMessage extends SWGMessage {
|
||||
|
||||
@@ -34,7 +39,7 @@ public class CharacterSheetResponseMessage extends SWGMessage {
|
||||
public CharacterSheetResponseMessage(PlayerObject player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
@@ -42,35 +47,63 @@ public class CharacterSheetResponseMessage extends SWGMessage {
|
||||
|
||||
@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)
|
||||
CreatureObject creature = (CreatureObject) player.getContainer();
|
||||
|
||||
if (creature != null) {
|
||||
|
||||
SWGObject desCloner = null;
|
||||
if (creature.getAttachment("preDesignatedCloner") != null)
|
||||
desCloner = NGECore.getInstance().objectService.getObject((long) creature.getAttachment("preDesignatedCloner"));
|
||||
|
||||
String clonerPlanet = "";
|
||||
String spouse = "";
|
||||
|
||||
if (desCloner != null)
|
||||
clonerPlanet = desCloner.getPlanet().getName();
|
||||
|
||||
if (player.getSpouseName() != null)
|
||||
spouse = player.getSpouseName();
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(82 + clonerPlanet.length() + (spouse.length() * 2)).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
buffer.putShort((short) 12);
|
||||
buffer.putInt(CRC.StringtoCRC("CharacterSheetResponseMessage"));
|
||||
|
||||
buffer.putInt(0);
|
||||
else
|
||||
buffer.put(getUnicodeString(player.getSpouseName())); // spouse name <<<<< CORRECT
|
||||
|
||||
buffer.putInt(10); // lots remaining <<<<<<< CORRECT
|
||||
return buffer.flip();
|
||||
buffer.putInt(0);
|
||||
|
||||
if (desCloner != null) {
|
||||
Point3D loc = desCloner.getPosition();
|
||||
buffer.putFloat(loc.x); // bind x
|
||||
buffer.putFloat(loc.y); // bind z
|
||||
buffer.putFloat(loc.z); // bind y
|
||||
buffer.put(getAsciiString(clonerPlanet)); // bind planet
|
||||
} else {
|
||||
buffer.putFloat(0); // bind x
|
||||
buffer.putFloat(0); // bind z
|
||||
buffer.putFloat(0); // bind y
|
||||
buffer.put(getAsciiString("")); // bind planet
|
||||
}
|
||||
|
||||
buffer.putFloat(0); // bank x
|
||||
buffer.putFloat(0); // bank z
|
||||
buffer.putFloat(0); // bank y
|
||||
buffer.put(getAsciiString("tatooine"));
|
||||
|
||||
buffer.putFloat(0); // home x
|
||||
buffer.putFloat(0); // home z
|
||||
buffer.putFloat(0); // home y
|
||||
buffer.put(getAsciiString("")); // home planet
|
||||
|
||||
buffer.put(getAsciiString("")); // Name of city player resides in
|
||||
|
||||
buffer.put(getUnicodeString(spouse));
|
||||
|
||||
buffer.putInt(10); // lots remaining
|
||||
|
||||
return buffer.flip();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TargetUpdate extends ObjControllerObject {
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -684,7 +684,9 @@ public class PlayerObject extends IntangibleObject {
|
||||
}
|
||||
|
||||
public String getSpouseName() {
|
||||
return spouse;
|
||||
synchronized(objectMutex) {
|
||||
return spouse;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpouseName(String spouse) {
|
||||
|
||||
@@ -251,6 +251,11 @@ public class EquipmentService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
if(item.getAttachment("unity") != null) {
|
||||
actor.sendSystemMessage("@unity:cannot_remove_ring", (byte) 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if(actor.getEquipmentList().contains(item))
|
||||
actor.removeObjectFromEquipList(item);
|
||||
|
||||
|
||||
@@ -440,17 +440,16 @@ public class SimulationService implements INetworkDispatch {
|
||||
|
||||
@Override
|
||||
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
|
||||
|
||||
data = data.order(ByteOrder.LITTLE_ENDIAN);
|
||||
data.position(0);
|
||||
|
||||
|
||||
data.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
Client client = core.getClient(session);
|
||||
|
||||
|
||||
if(client == null) {
|
||||
System.out.println("NULL Client");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(client.getParent() == null) {
|
||||
System.out.println("NULL Object");
|
||||
return;
|
||||
@@ -459,18 +458,18 @@ public class SimulationService implements INetworkDispatch {
|
||||
|
||||
TargetUpdate targetUpdate = new TargetUpdate();
|
||||
targetUpdate.deserialize(data);
|
||||
|
||||
|
||||
object.setTargetId(targetUpdate.getTargetId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
objControllerOpcodes.put(ObjControllerOpcodes.HOVER_TARGET, new INetworkRemoteEvent() {
|
||||
|
||||
@Override
|
||||
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user