mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-31 01:15:57 -04:00
calculatePvpStatus() used for everything, more...
This ensures nothing is ever missed out of the pvpStatus calculation, such as faction standing. It should calculate the following: On Leave/neutral players should be #16 Combatant players should be #35 Opposing faction SF players should be #55 Opposing Combatant NPCs should be #19 Ally SF NPCs (ie.; hoth commandos) should be #4 Enemy SF NPCs (ie. hoth resistance) should be #7 Same faction NPCs should be #0 (pink) Attackable NPCs should be #1 Aggressive NPCs should be #2 or #3 NPCs you have negative faction standing with should be #2 or #3
This commit is contained in:
@@ -22,10 +22,14 @@
|
||||
package resources.objects.tangible;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayClientEffectObjectMessage;
|
||||
import protocol.swg.StopClientEffectObjectByLabel;
|
||||
@@ -58,7 +62,7 @@ public class TangibleObject extends SWGObject {
|
||||
protected int optionsBitmask = 0;
|
||||
private int maxDamage = 1000;
|
||||
private boolean staticObject = true;
|
||||
protected String faction = "neutral"; // Says you're "Imperial Special Forces" if it's 0 for some reason
|
||||
protected String faction = ""; // Says you're "Imperial Special Forces" if it's 0 for some reason
|
||||
@NotPersistent
|
||||
private Vector<TangibleObject> defendersList = new Vector<TangibleObject>(); // unused in packets but useful for the server
|
||||
@NotPersistent
|
||||
@@ -218,6 +222,20 @@ public class TangibleObject extends SWGObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updatePvpStatus();
|
||||
}
|
||||
|
||||
public void updatePvpStatus() {
|
||||
HashSet<Client> observers = new HashSet<Client>(getObservers());
|
||||
|
||||
for (Iterator<Client> it = observers.iterator(); it.hasNext();) {
|
||||
Client observer = it.next();
|
||||
|
||||
if (observer.getParent() != null) {
|
||||
observer.getSession().write(new UpdatePVPStatusMessage(this.getObjectID(), NGECore.getInstance().factionService.calculatePvpStatus(observer, this), getFaction()).serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getFaction() {
|
||||
@@ -230,6 +248,8 @@ public class TangibleObject extends SWGObject {
|
||||
synchronized(objectMutex) {
|
||||
this.faction = faction;
|
||||
}
|
||||
|
||||
updatePvpStatus();
|
||||
}
|
||||
|
||||
public Vector<TangibleObject> getDefendersList() {
|
||||
|
||||
Reference in New Issue
Block a user