mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-16 06:13:45 -04:00
Added handling of deathblow for bounties
This commit is contained in:
@@ -8,12 +8,12 @@ def createRadial(core, owner, target, radials):
|
||||
def handleSelection(core, owner, target, option):
|
||||
|
||||
if option == 138 and target:
|
||||
id = owner.getAttachment('bountyMissionId')
|
||||
id = owner.getPlayerObject().getBountyMissionId()
|
||||
if id is None or id == 0:
|
||||
owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0)
|
||||
return
|
||||
|
||||
mission = core.objectService.getObject(owner.getAttachment('bountyMissionId'))
|
||||
mission = core.objectService.getObject(id)
|
||||
if mission is None:
|
||||
owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0)
|
||||
return
|
||||
|
||||
@@ -13,12 +13,12 @@ def createRadial(core, owner, target, radials):
|
||||
def handleSelection(core, owner, target, option):
|
||||
|
||||
if option == 136 and target or option == 138 and target:
|
||||
id = owner.getAttachment('bountyMissionId')
|
||||
id = owner.getPlayerObject().getBountyMissionId()
|
||||
if id is None or id == 0:
|
||||
owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0)
|
||||
return
|
||||
|
||||
mission = core.objectService.getObject(owner.getAttachment('bountyMissionId'))
|
||||
mission = core.objectService.getObject(id)
|
||||
if mission is None:
|
||||
owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0)
|
||||
return
|
||||
|
||||
@@ -55,6 +55,12 @@ public class ProsePackage {
|
||||
stf.setStfName(stfLabel);
|
||||
}
|
||||
|
||||
public ProsePackage(String stfFile, String stfLabel, String ttCustomString) {
|
||||
stf.setStfFilename(stfFile);
|
||||
stf.setStfName(stfLabel);
|
||||
this.ttCustomString = ttCustomString;
|
||||
}
|
||||
|
||||
public ProsePackage(String stfFile, String stfLabel, long tuObjectId, String tuStfFile, String tuStfLabel, String tuCustomString) {
|
||||
stf.setStfFilename(stfFile);
|
||||
stf.setStfName(stfLabel);
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import protocol.swg.CommPlayerMessage;
|
||||
import protocol.swg.PlayClientEffectLocMessage;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.container.Traverser;
|
||||
import engine.resources.objects.SWGObject;
|
||||
@@ -108,10 +109,16 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
|
||||
player.getClient().getSession().write(comm.serialize());
|
||||
|
||||
player.setAttachment("bountyMissionId", getMissionObject().getObjectId());
|
||||
player.getPlayerObject().setBountyMissionId(getMissionObject().getObjectId());
|
||||
|
||||
/*CreatureObject target = (CreatureObject) core.objectService.getObject(markObjId);
|
||||
if (target != null && target.getPlanetId() == player.getPlanetId()) {
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(player.getObjectID(), core.factionService.calculatePvpStatus(player, target), player.getFaction());
|
||||
player.getClient().getSession().write(upvpm.serialize());
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void complete(NGECore core, CreatureObject player) {
|
||||
BountyListItem bounty = core.missionService.getBountyListItem(markObjId);
|
||||
@@ -131,7 +138,7 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
clearActiveMissions(core, bounty);
|
||||
|
||||
core.missionService.removeBounty(markObjId);
|
||||
player.setAttachment("bountyMissionId", 0);
|
||||
player.getPlayerObject().setBountyMissionId(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,7 +151,7 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
return;
|
||||
|
||||
bounty.removeBountyHunter(player.getObjectId());
|
||||
player.setAttachment("bountyMissionId", 0);
|
||||
player.getPlayerObject().setBountyMissionId(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -150,6 +150,8 @@ public class PlayerObject extends IntangibleObject implements Serializable {
|
||||
@NotPersistent
|
||||
private transient boolean callingCompanion = false;
|
||||
|
||||
private long bountyMissionId;
|
||||
|
||||
public PlayerObject() {
|
||||
super();
|
||||
messageBuilder = new PlayerMessageBuilder(this);
|
||||
@@ -894,10 +896,8 @@ public class PlayerObject extends IntangibleObject implements Serializable {
|
||||
|
||||
public boolean isMemberOfChannel(int roomId) {
|
||||
if (chatChannels.contains(roomId)) {
|
||||
System.out.println("Member of the channel!");
|
||||
return true;
|
||||
}
|
||||
System.out.println("Not a Member of the channel!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -909,6 +909,14 @@ public class PlayerObject extends IntangibleObject implements Serializable {
|
||||
this.callingCompanion = callingCompanion;
|
||||
}
|
||||
|
||||
public long getBountyMissionId() {
|
||||
return bountyMissionId;
|
||||
}
|
||||
|
||||
public void setBountyMissionId(long bountyMissionId) {
|
||||
this.bountyMissionId = bountyMissionId;
|
||||
}
|
||||
|
||||
public ObjectMessageBuilder getMessageBuilder() {
|
||||
return messageBuilder;
|
||||
}
|
||||
|
||||
@@ -43,11 +43,15 @@ import protocol.swg.objectControllerObjects.StartTask;
|
||||
import resources.buffs.Buff;
|
||||
import resources.buffs.DamageOverTime;
|
||||
import resources.common.FileUtilities;
|
||||
import resources.common.OutOfBand;
|
||||
import resources.common.ProsePackage;
|
||||
import resources.datatables.Options;
|
||||
import resources.datatables.Elemental;
|
||||
import resources.datatables.Posture;
|
||||
import resources.datatables.WeaponType;
|
||||
import resources.objectives.BountyMissionObjective;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.mission.MissionObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
@@ -800,8 +804,10 @@ public class CombatService implements INetworkDispatch {
|
||||
}, target.getIncapTimer(), TimeUnit.SECONDS);
|
||||
target.setIncapTask(incapTask);
|
||||
core.buffService.addBuffToCreature(target, "incapWeaken", target);
|
||||
if(target.getSlottedObject("ghost") != null)
|
||||
attacker.sendSystemMessage("You incapacitate " + target.getCustomName() + ".", (byte) 0);
|
||||
if(target.getSlottedObject("ghost") != null) {
|
||||
target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_incap", attacker.getCustomName())), (byte) 0);
|
||||
attacker.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_target_incap", target.getCustomName())), (byte) 0);
|
||||
}
|
||||
return;
|
||||
} else if(target.getHealth() - damage <= 0 && target.getAttachment("AI") != null) {
|
||||
synchronized(target.getMutex()) {
|
||||
@@ -983,17 +989,50 @@ public class CombatService implements INetworkDispatch {
|
||||
target.stopIncapTask();
|
||||
target.setIncapTask(null);
|
||||
target.setPosture((byte) 14);
|
||||
attacker.sendSystemMessage("You have killed " + target.getCustomName() + ".", (byte) 0);
|
||||
target.sendSystemMessage("@base_player:victim_dead", (byte) 0);
|
||||
|
||||
if (target.getSlottedObject("ghost") != null && attacker.getSlottedObject("ghost") != null) {
|
||||
boolean bountyWindow = true;
|
||||
if (target.getPlayerObject().getBountyMissionId() != 0) {
|
||||
MissionObject mission = (MissionObject) core.objectService.getObject(target.getPlayerObject().getBountyMissionId());
|
||||
if (mission != null && mission.getBountyObjId() == attacker.getObjectId()) {
|
||||
bountyWindow = false;
|
||||
target.sendSystemMessage(new OutOfBand(new ProsePackage("bounty_hunter", "bounty_failed_hunter", attacker.getCustomName())), (byte) 0);
|
||||
|
||||
ProsePackage pp = new ProsePackage("bounty_hunter", "bounty_failed_target", attacker.getCustomName());
|
||||
pp.setToCustomString("their");
|
||||
attacker.sendSystemMessage(new OutOfBand(pp), (byte) 0);
|
||||
|
||||
core.missionService.handleMissionAbort(target, mission);
|
||||
}
|
||||
} else if (attacker.getPlayerObject().getBountyMissionId() != 0) {
|
||||
MissionObject mission = (MissionObject) core.objectService.getObject(attacker.getPlayerObject().getBountyMissionId());
|
||||
if (mission != null && mission.getBountyObjId() == target.getObjectId()) {
|
||||
bountyWindow = false;
|
||||
ProsePackage targetProse = new ProsePackage("bounty_hunter", "bounty_success_target", attacker.getCustomName());
|
||||
targetProse.setDiInteger(mission.getCreditReward());
|
||||
target.sendSystemMessage(new OutOfBand(targetProse), (byte) 0);
|
||||
|
||||
ProsePackage attackerProse = new ProsePackage("bounty_hunter", "bounty_success_hunter", attacker.getCustomName());
|
||||
attackerProse.setToCustomString("their"); // should be his or her: http://youtu.be/BqeDQQSETJI?t=2m19s
|
||||
attackerProse.setDiInteger(mission.getCreditReward());
|
||||
attacker.sendSystemMessage(new OutOfBand(attackerProse), (byte) 0);
|
||||
|
||||
core.missionService.handleMissionAbort(target, mission);
|
||||
}
|
||||
}
|
||||
|
||||
if(target.getDuelList().contains(attacker))
|
||||
bountyWindow = false;
|
||||
handleEndDuel(target, attacker, false);
|
||||
|
||||
if (bountyWindow) core.playerService.sendSetBountyWindow(target, attacker);
|
||||
} else { attacker.sendSystemMessage("You have killed " + target.getCustomName() + ".", (byte) 0); }
|
||||
|
||||
attacker.removeDefender(target);
|
||||
target.removeDefender(attacker);
|
||||
target.setSpeedMultiplierBase(0);
|
||||
target.setTurnRadius(0);
|
||||
|
||||
if(!target.getDuelList().contains(attacker) && attacker.getSlottedObject("ghost") != null)
|
||||
core.playerService.sendSetBountyWindow(target, attacker);
|
||||
else
|
||||
handleEndDuel(target, attacker, false);
|
||||
target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_dead", attacker.getCustomName())), (byte) 0);
|
||||
|
||||
core.playerService.sendCloningWindow(target, attacker.getSlottedObject("ghost") != null);
|
||||
}
|
||||
|
||||
@@ -250,8 +250,8 @@ public class FactionService implements INetworkDispatch {
|
||||
|
||||
long targetId = target.getObjectID();
|
||||
|
||||
if (object.getSlottedObject("mission_bag") != null) {
|
||||
object.getSlottedObject("mission_bag").viewChildren(object, false, false, (mission) -> {
|
||||
if (object.getSlottedObject("datapad") != null) {
|
||||
object.getSlottedObject("datapad").viewChildren(object, false, false, (mission) -> {
|
||||
if (((MissionObject) mission).getBountyObjId() == targetId) {
|
||||
ref.set(PvpStatus.Attackable | PvpStatus.Aggressive);
|
||||
}
|
||||
@@ -259,8 +259,8 @@ public class FactionService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
if (ghost != null && ghost.getProfession().contains("smuggler") &&
|
||||
target.getSlottedObject("mission_bag") != null) {
|
||||
target.getSlottedObject("mission_bag").viewChildren(target, false, false, (mission) -> {
|
||||
target.getSlottedObject("datapad") != null) {
|
||||
target.getSlottedObject("datapad").viewChildren(target, false, false, (mission) -> {
|
||||
if (((MissionObject) mission).getBountyObjId() == object.getObjectID()) {
|
||||
ref.set(PvpStatus.Attackable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user