mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-16 06:13:45 -04:00
Fixed #266 and added stealth for GM
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
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
|
||||
@@ -59,25 +56,11 @@ def run(core, actor, target, commandString):
|
||||
|
||||
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())
|
||||
|
||||
elif command == 'spawn' and arg1 and arg2:
|
||||
pos = actor.getWorldPosition()
|
||||
core.spawnService.spawnCreature(arg1, actor.getPlanet().getName(), 0, pos.x, pos.y, pos.z, 1, 0, 1, 0, int(arg2))
|
||||
|
||||
core.spawnService.spawnCreature(arg1, actor.getPlanet().getName(), 0, pos.x, pos.y, pos.z, 1, 0, 1, 0, int(arg2))
|
||||
elif command == 'instance' and arg1:
|
||||
core.instanceService.queue(arg1, actor)
|
||||
|
||||
@@ -89,5 +72,14 @@ def run(core, actor, target, commandString):
|
||||
|
||||
elif command == 'id':
|
||||
actor.sendSystemMessage('Your id is: ' + str(actor.getObjectId()), 0)
|
||||
|
||||
|
||||
elif command == 'stealth':
|
||||
if (actor.isInStealth()):
|
||||
actor.setInStealth(False)
|
||||
actor.setRadarVisible(True)
|
||||
actor.sendSystemMessage('You are now visible to other players.', 0)
|
||||
else:
|
||||
actor.setInStealth(True)
|
||||
actor.setRadarVisible(False)
|
||||
actor.sendSystemMessage('You are now hidden from players. "Stealth Effect" is not implemented, however players still won\'t be able to see you. Type /setgodmode stealth again to be visible.', 0)
|
||||
return
|
||||
|
||||
@@ -342,7 +342,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
buffer.putShort((short) 0); // costume
|
||||
//buffer.put(getAsciiString("appearance/gungan_m.sat"));
|
||||
buffer.put((byte) 1); // visible boolean. default: true. cloaked if false.
|
||||
buffer.put((byte) (creature.isInStealth() ? 0 : 1));
|
||||
|
||||
if(creature.getBuffList().isEmpty()) {
|
||||
buffer.putInt(0);
|
||||
@@ -385,7 +385,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
buffer.put((byte) 0); // performing? boolean
|
||||
buffer.put((byte) (creature.isStationary() ? 1 : 0)); // if the server accepts transforms from the object
|
||||
buffer.put(creature.getDifficulty());
|
||||
|
||||
if(creature.isHologram())
|
||||
@@ -393,7 +393,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
else
|
||||
buffer.putInt(0xFFFFFFFF);
|
||||
|
||||
buffer.put((byte) 1); // visibleOnRadar? boolean
|
||||
buffer.put((byte) (creature.isRadarVisible() ? 1 : 0));
|
||||
buffer.put((byte) 0); // no effect for 1?
|
||||
buffer.put((byte) 0); // no effect for 1?
|
||||
|
||||
@@ -1188,6 +1188,24 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer = createDelta("CREO", (byte) 3, (short) 1, (short) 0x0D, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildStealthFlagDelta(boolean flag) {
|
||||
IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.put((byte) (flag ? 0 : 1));
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x19, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildRadarVisibleFlagDelta(boolean flag) {
|
||||
IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.put((byte) (flag ? 1 : 0));
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x1E, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
switch (viewType) {
|
||||
|
||||
@@ -59,7 +59,7 @@ import engine.resources.scene.Quaternion;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
|
||||
@Entity(version=3)
|
||||
@Entity(version=4)
|
||||
public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
|
||||
@NotPersistent
|
||||
@@ -147,7 +147,11 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
private SWGList<SWGObject> appearanceEquipmentList;
|
||||
@NotPersistent
|
||||
private int appearanceEquipmentListUpdateCounter = 0;
|
||||
|
||||
|
||||
private boolean inStealth = false;
|
||||
private boolean radarVisible = true; // radar
|
||||
private boolean stationary = false;
|
||||
|
||||
// non-baseline vars
|
||||
@NotPersistent
|
||||
private List<CreatureObject> duelList = Collections.synchronizedList(new ArrayList<CreatureObject>());
|
||||
@@ -1709,4 +1713,42 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
this.performingFlourish = performingFlourish;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInStealth() {
|
||||
synchronized(objectMutex) {
|
||||
return inStealth;
|
||||
}
|
||||
}
|
||||
|
||||
public void setInStealth(boolean inStealth) {
|
||||
synchronized(objectMutex) {
|
||||
this.inStealth = inStealth;
|
||||
}
|
||||
notifyObservers(messageBuilder.buildStealthFlagDelta(inStealth), false);
|
||||
}
|
||||
|
||||
public boolean isRadarVisible() {
|
||||
synchronized(objectMutex) {
|
||||
return radarVisible;
|
||||
}
|
||||
}
|
||||
|
||||
public void setRadarVisible(boolean radarVisible) {
|
||||
synchronized(objectMutex) {
|
||||
this.radarVisible = radarVisible;
|
||||
}
|
||||
notifyObservers(messageBuilder.buildRadarVisibleFlagDelta(radarVisible), false);
|
||||
}
|
||||
|
||||
public boolean isStationary() {
|
||||
synchronized(objectMutex) {
|
||||
return stationary;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStationary(boolean stationary) {
|
||||
synchronized(objectMutex) {
|
||||
this.stationary = stationary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -979,6 +979,8 @@ public class CombatService implements INetworkDispatch {
|
||||
target.sendSystemMessage("@base_player:victim_dead", (byte) 0);
|
||||
attacker.removeDefender(target);
|
||||
target.removeDefender(attacker);
|
||||
target.setSpeedMultiplierBase(0);
|
||||
target.setTurnRadius(0);
|
||||
|
||||
if(target.getDuelList().contains(attacker)) handleEndDuel(target, attacker, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user