mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-27 17:57:22 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from resources.objects.creature import CreatureObject
|
||||
import sys
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
actorFaction = actor.getFaction()
|
||||
|
||||
if commandString == ('imperial') and actorFaction != "imperial":
|
||||
actor.setFaction('imperial')
|
||||
actor.sendSystemMessage('You are aligned to the Imperial faction', 0)
|
||||
return
|
||||
|
||||
if commandString == ('rebel') and actorFaction != "rebel":
|
||||
actor.setFaction('rebel')
|
||||
actor.sendSystemMessage('You are aligned to the Rebellion', 0)
|
||||
return
|
||||
|
||||
if commandString == ('neutral') and actorFaction != "neutral":
|
||||
actor.setFaction('neutral')
|
||||
actor.sendSystemMessage('You aren\'t aligned to any faction.', 0)
|
||||
return
|
||||
return
|
||||
+49
-9
@@ -1,4 +1,5 @@
|
||||
from resources.objects.creature import CreatureObject
|
||||
from protocol.swg import UpdatePVPStatusMessage
|
||||
import sys
|
||||
|
||||
def setup():
|
||||
@@ -7,22 +8,61 @@ def setup():
|
||||
def run(core, actor, target, commandString):
|
||||
actorFaction = actor.getFaction()
|
||||
actorStatus = actor.getFactionStatus()
|
||||
if commandString.startswith('imperial') and actorFaction != "imperial":
|
||||
pvpStatus = UpdatePVPStatusMessage(actor.getObjectId())
|
||||
|
||||
if commandString == ('imperial') and actorFaction != "imperial":
|
||||
actor.setFaction('imperial')
|
||||
return
|
||||
|
||||
if commandString.startswith('rebel') and actorFaction != "rebel":
|
||||
if commandString == ('rebel') and actorFaction != "rebel":
|
||||
actor.setFaction('rebel')
|
||||
return
|
||||
|
||||
if actorStatus != 0 and actorStatus == 1:
|
||||
actor.setFactionStatus(2)
|
||||
actor.sendSystemMessage('@faction_recruiter:overt_complete', 0)
|
||||
if commandString == ('neutral') and actorFaction != "neutral":
|
||||
actor.setFaction('neutral')
|
||||
return
|
||||
|
||||
if actorStatus == 2:
|
||||
#if actorStatus == 0 and actorFaction == "imperial" or "rebel":
|
||||
#actor.setFactionStatus(1)
|
||||
#print ("FactionStatus: " + str(actor.getFactionStatus()))
|
||||
#actor.sendSystemMessage('You are no longer On Leave.', 0)
|
||||
#return
|
||||
|
||||
if actorStatus == 1 and actorFaction == "imperial":
|
||||
actor.setFactionStatus(2)
|
||||
pvpStatus.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial)
|
||||
pvpStatus.setStatus(55)
|
||||
actor.notifyObservers(pvpStatus.serialize(), True)
|
||||
actor.sendSystemMessage('@faction_recruiter:overt_complete', 0)
|
||||
print ("FactionStatus: " + str(actor.getFactionStatus()))
|
||||
return
|
||||
|
||||
if actorStatus == 1 and actorFaction == "rebel":
|
||||
actor.setFactionStatus(2)
|
||||
pvpStatus.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel)
|
||||
pvpStatus.setStatus(55)
|
||||
actor.notifyObservers(pvpStatus.serialize(), True)
|
||||
actor.sendSystemMessage('@faction_recruiter:overt_complete', 0)
|
||||
print ("FactionStatus: " + str(actor.getFactionStatus()))
|
||||
return
|
||||
|
||||
if actorStatus == 2 and actorFaction == "imperial":
|
||||
actor.setFactionStatus(1)
|
||||
pvpStatus.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial)
|
||||
pvpStatus.setStatus(16)
|
||||
actor.notifyObservers(pvpStatus.serialize(), True)
|
||||
actor.sendSystemMessage('@faction_recruiter:covert_complete', 0)
|
||||
return
|
||||
return
|
||||
|
||||
print ("FactionStatus: " + str(actor.getFactionStatus()))
|
||||
return
|
||||
|
||||
if actorStatus == 2 and actorFaction == "rebel":
|
||||
actor.setFactionStatus(1)
|
||||
pvpStatus.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel)
|
||||
pvpStatus.setStatus(16)
|
||||
actor.notifyObservers(pvpStatus.serialize(), True)
|
||||
actor.sendSystemMessage('@faction_recruiter:covert_complete', 0)
|
||||
print ("FactionStatus: " + str(actor.getFactionStatus()))
|
||||
return
|
||||
|
||||
|
||||
return
|
||||
@@ -31,10 +31,10 @@ public class UpdatePVPStatusMessage extends SWGMessage {
|
||||
|
||||
private long objectId;
|
||||
private int pvpStatus;
|
||||
private int faction;
|
||||
|
||||
public UpdatePVPStatusMessage(long objectId, int pvpStatus) {
|
||||
public UpdatePVPStatusMessage(long objectId) {
|
||||
this.objectId = objectId;
|
||||
this.pvpStatus = pvpStatus;
|
||||
}
|
||||
|
||||
public void deserialize(IoBuffer data) {
|
||||
@@ -47,9 +47,21 @@ public class UpdatePVPStatusMessage extends SWGMessage {
|
||||
result.putShort((short)4);
|
||||
result.putInt(0x08A1C126);
|
||||
result.putInt(pvpStatus);
|
||||
result.putInt(0); // faction crc
|
||||
result.putInt(faction);
|
||||
result.putLong(objectId);
|
||||
result.flip();
|
||||
return result;
|
||||
}
|
||||
public enum factionCRC {;
|
||||
public static final int Neutral = 0;
|
||||
public static final int Imperial = 0xDB4ACC54;
|
||||
public static final int Rebel = 0x16148850;
|
||||
}
|
||||
public void setFaction(int factionCRC) {
|
||||
this.faction = factionCRC;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.pvpStatus = status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,12 +737,37 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
|
||||
UpdatePostureMessage upm = new UpdatePostureMessage(getObjectID(), (byte) 0);
|
||||
destination.getSession().write(upm.serialize());
|
||||
|
||||
if(destination != getClient()) {
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID(), 55);
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID());
|
||||
if (factionStatus == 1 && faction == "imperial") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial);
|
||||
upvpm.setStatus(16);
|
||||
}
|
||||
|
||||
if (factionStatus == 1 && faction == "rebel") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel);
|
||||
upvpm.setStatus(16);
|
||||
}
|
||||
|
||||
if (factionStatus == 2 && faction == "imperial") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial);
|
||||
upvpm.setStatus(55);
|
||||
}
|
||||
if (factionStatus == 2 && faction == "rebel") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel);
|
||||
upvpm.setStatus(55);
|
||||
}
|
||||
if(factionStatus == 0 && faction == "neutral") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral);
|
||||
upvpm.setStatus(16);
|
||||
}
|
||||
else {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral);
|
||||
upvpm.setStatus(16);
|
||||
}
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void sendSystemMessage(String message, byte displayType) {
|
||||
|
||||
@@ -124,7 +124,7 @@ public class SimulationService implements INetworkDispatch {
|
||||
core.commandService.registerCommand("pvp");
|
||||
core.commandService.registerCommand("setcurrentskilltitle");
|
||||
core.commandService.registerCommand("tip");
|
||||
|
||||
core.commandService.registerCommand("faction");
|
||||
}
|
||||
|
||||
public void add(SWGObject object, int x, int y) {
|
||||
|
||||
Reference in New Issue
Block a user