mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-27 12:12:51 -04:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -31,16 +31,14 @@ def run(core, actor, target, commandString):
|
||||
actor.setFaction('')
|
||||
actor.sendSystemMessage('@faction_recruiter:resign_complete', 0)
|
||||
|
||||
if commandString == 'neutral':
|
||||
if commandString == 'neutral' or commandString == 'resign':
|
||||
time.sleep(1)
|
||||
actor.setFaction('')
|
||||
actor.setPvpStatus(PvpStatus.Player, False)
|
||||
actor.sendSystemMessage('@faction_recruiter:resign_complete', 0)
|
||||
return
|
||||
|
||||
time.sleep(1)
|
||||
actor.setFaction(commandString)
|
||||
actor.setPvpStatus(PvpStatus.Player, True)
|
||||
return
|
||||
|
||||
if faction == 'neutral' or faction == '':
|
||||
@@ -53,7 +51,6 @@ def run(core, actor, target, commandString):
|
||||
time.sleep(1)
|
||||
actor.setFactionStatus(FactionStatus.Combatant)
|
||||
actor.setPvpStatus(PvpStatus.GoingCovert, False)
|
||||
actor.setPvpStatus(PvpStatus.Enemy, True)
|
||||
actor.sendSystemMessage('@faction_recruiter:covert_complete', 0)
|
||||
return
|
||||
|
||||
@@ -63,7 +60,6 @@ def run(core, actor, target, commandString):
|
||||
time.sleep(30)
|
||||
actor.setFactionStatus(FactionStatus.SpecialForces)
|
||||
actor.setPvpStatus(PvpStatus.GoingOvert, False)
|
||||
actor.setPvpStatus(PvpStatus.Overt | PvpStatus.Attackable | PvpStatus.Aggressive, True)
|
||||
actor.sendSystemMessage('@faction_recruiter:overt_complete', 0)
|
||||
return
|
||||
|
||||
@@ -72,7 +68,7 @@ def run(core, actor, target, commandString):
|
||||
actor.setPvpStatus(PvpStatus.GoingCovert, True)
|
||||
time.sleep(300)
|
||||
actor.setFactionStatus(FactionStatus.Combatant)
|
||||
actor.setPvpStatus(PvpStatus.GoingCovert | PvpStatus.Overt | PvpStatus.Attackable | PvpStatus.Aggressive, False)
|
||||
actor.setPvpStatus(PvpStatus.GoingCovert, False)
|
||||
actor.sendSystemMessage('@faction_recruiter:covert_complete', 0)
|
||||
return
|
||||
|
||||
|
||||
@@ -458,7 +458,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
}
|
||||
|
||||
notifyObservers(messageBuilder.buildFactionDelta(faction), true);
|
||||
setPvpStatus(0, true);
|
||||
updatePvpStatus();
|
||||
}
|
||||
|
||||
public int getFactionStatus() {
|
||||
@@ -473,6 +473,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
}
|
||||
|
||||
notifyObservers(messageBuilder.buildFactionStatusDelta(factionStatus), true);
|
||||
updatePvpStatus();
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -1005,8 +1005,8 @@ public class CombatService implements INetworkDispatch {
|
||||
requester.getDuelList().add(target);
|
||||
requester.sendSystemMessage("You accept " + target.getCustomName() + "'s challenge.", (byte) 0);
|
||||
target.sendSystemMessage(requester.getCustomName() + " accepts your challenge.", (byte) 0);
|
||||
target.getClient().getSession().write(new UpdatePVPStatusMessage(requester.getObjectID(), 55, requester.getFaction()).serialize());
|
||||
requester.getClient().getSession().write(new UpdatePVPStatusMessage(target.getObjectID(), 55, target.getFaction()).serialize());
|
||||
target.updatePvpStatus();
|
||||
requester.updatePvpStatus();
|
||||
|
||||
}
|
||||
|
||||
@@ -1021,8 +1021,8 @@ public class CombatService implements INetworkDispatch {
|
||||
target.removeDefender(requester);
|
||||
requester.removeDefender(target);
|
||||
|
||||
target.getClient().getSession().write(new UpdatePVPStatusMessage(requester.getObjectID(), 0x16, requester.getFaction()).serialize());
|
||||
requester.getClient().getSession().write(new UpdatePVPStatusMessage(target.getObjectID(), 0x16, target.getFaction()).serialize());
|
||||
target.updatePvpStatus();
|
||||
requester.updatePvpStatus();
|
||||
|
||||
if(announce)
|
||||
{
|
||||
|
||||
@@ -203,18 +203,36 @@ public class FactionService implements INetworkDispatch {
|
||||
|
||||
int pvpBitmask = target.getPvPBitmask();
|
||||
|
||||
if (target.getSlottedObject("ghost") != null) {
|
||||
if (target.getFaction() == null || (!target.getFaction().equals("rebel") && !target.getFaction().equals("imperial"))) {
|
||||
return 0;
|
||||
}
|
||||
if (target.getFactionStatus() == FactionStatus.Combatant) {
|
||||
pvpBitmask |= PvpStatus.Enemy;
|
||||
}
|
||||
|
||||
if (target.getFactionStatus() == FactionStatus.SpecialForces) {
|
||||
pvpBitmask |= PvpStatus.Overt;
|
||||
|
||||
if (target.getSlottedObject("ghost") != null) {
|
||||
pvpBitmask |= PvpStatus.Enemy;
|
||||
}
|
||||
}
|
||||
|
||||
if (target.getSlottedObject("ghost") != null) {
|
||||
pvpBitmask |= PvpStatus.Player;
|
||||
|
||||
if (player.getFactionStatus() == FactionStatus.SpecialForces &&
|
||||
((CreatureObject) target).getFactionStatus() == FactionStatus.SpecialForces) {
|
||||
if ((!player.getFaction().equals(target.getFaction()) &&
|
||||
player.getFactionStatus() == FactionStatus.SpecialForces &&
|
||||
((CreatureObject) target).getFactionStatus() == FactionStatus.SpecialForces) ||
|
||||
core.combatService.areInDuel(player, (CreatureObject) target)) {
|
||||
pvpBitmask |= (PvpStatus.Attackable | PvpStatus.Aggressive);
|
||||
}
|
||||
|
||||
if (core.combatService.areInDuel(player, (CreatureObject) target)) {
|
||||
//pvpBitmask |= PvpStatus.Dueling;
|
||||
}
|
||||
|
||||
return pvpBitmask;
|
||||
}
|
||||
|
||||
if (player.getFaction().equals(target.getFaction()) {
|
||||
return pvpBitmask;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* 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 services.object;
|
||||
|
||||
import com.sleepycat.persist.model.Entity;
|
||||
|
||||
Reference in New Issue
Block a user