mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-12 02:13:48 -04:00
Comm message when accepting bounties, basework for probe droids
This commit is contained in:
@@ -205,9 +205,13 @@ public class MissionService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void handleMissionAbort(CreatureObject creature, MissionObject mission) {
|
||||
handleMissionAbort(creature, mission, false);
|
||||
}
|
||||
|
||||
public void handleMissionAbort(CreatureObject creature, MissionObject mission, boolean silent) {
|
||||
MissionObjective objective = mission.getObjective();
|
||||
|
||||
if (objective != null)
|
||||
if (objective != null && !silent)
|
||||
objective.abort(core, creature);
|
||||
|
||||
core.objectService.destroyObject(mission.getObjectId());
|
||||
@@ -217,7 +221,7 @@ public class MissionService implements INetworkDispatch {
|
||||
File missionFolder = new File("./clientdata/string/en/mission");
|
||||
File[] missionFiles = missionFolder.listFiles();
|
||||
|
||||
int missionStrings = 0;
|
||||
//int missionStrings = 0;
|
||||
for (int i = 0; i < missionFiles.length; i++) {
|
||||
if (missionFiles[i].getName().contains("_easy") || missionFiles[i].getName().contains("_medium") || missionFiles[i].getName().contains("_hard")) {
|
||||
|
||||
@@ -239,7 +243,7 @@ public class MissionService implements INetworkDispatch {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) { e.printStackTrace(); }
|
||||
missionStrings++;
|
||||
//missionStrings++;
|
||||
}
|
||||
}
|
||||
//System.out.println("Loaded " + missionStrings + " mission entry counts.");
|
||||
@@ -279,14 +283,13 @@ public class MissionService implements INetworkDispatch {
|
||||
|
||||
MissionObject mission = (MissionObject) obj;
|
||||
|
||||
if (typeOneCount.get() < 4) {
|
||||
if (typeOneCount.get() < 5) {
|
||||
|
||||
if (type == TerminalType.GENERIC)
|
||||
randomDeliveryMission(player, mission);
|
||||
|
||||
else if (type == TerminalType.BOUNTY)
|
||||
//randomBountyMission(player, mission);
|
||||
return;
|
||||
randomBountyMission(player, mission);
|
||||
|
||||
else if (type == TerminalType.ARTISAN)
|
||||
return;
|
||||
@@ -297,7 +300,7 @@ public class MissionService implements INetworkDispatch {
|
||||
mission.setRepeatCount(requestCounter);
|
||||
typeOneCount.incrementAndGet();
|
||||
|
||||
} else if (typeTwoCount.get() < 4) {
|
||||
} else if (typeTwoCount.get() < 5) {
|
||||
|
||||
if (type == TerminalType.GENERIC)
|
||||
return;
|
||||
@@ -440,7 +443,7 @@ public class MissionService implements INetworkDispatch {
|
||||
}
|
||||
}
|
||||
|
||||
if (bountyTarget == null)
|
||||
if (bountyTarget == null || bountyTarget.getAssignedHunters().contains(player.getObjectId()))
|
||||
return;
|
||||
|
||||
mission.setMissionType("bounty");
|
||||
@@ -448,17 +451,20 @@ public class MissionService implements INetworkDispatch {
|
||||
String missionStf = "mission/mission_bounty_jedi";
|
||||
|
||||
if (!bountyTarget.getProfession().equals("")) { // TODO: Smuggler mission checks.
|
||||
if (bountyTarget.getFaction().equals("neutral")) {
|
||||
if (bountyTarget.getFaction().equals("neutral")) { // There were no neutral bounty missions. Remove this when done testing.
|
||||
mission.setMissionTargetName("@mission/mission_bounty_jedi:neutral_jedi");
|
||||
mission.setMissionId(3);
|
||||
mission.setCreator("Corporate Sector Authority");
|
||||
}
|
||||
else if (bountyTarget.getFaction().equals("rebel")) {
|
||||
mission.setMissionTargetName("@mission/mission_bounty_jedi:rebel_jedi");
|
||||
mission.setMissionTargetName("Rebel Bounty");
|
||||
mission.setMissionId(2);
|
||||
mission.setCreator("The Galactic Empire");
|
||||
}
|
||||
else if (bountyTarget.getFaction().equals("imperial")) {
|
||||
mission.setMissionTargetName("@mission/mission_bounty_jedi:imperial_jedi");
|
||||
mission.setMissionTargetName("Imperial Bounty");
|
||||
mission.setMissionId(1);
|
||||
mission.setCreator("The Alliance");
|
||||
}
|
||||
mission.setMissionTitle(missionStf);
|
||||
mission.setMissionDescription(missionStf);
|
||||
@@ -477,7 +483,7 @@ public class MissionService implements INetworkDispatch {
|
||||
mission.setMissionDescription(missionStf, "s");
|
||||
}
|
||||
|
||||
mission.setMissionLevel(90);
|
||||
mission.setMissionLevel(new Random().nextInt(100 - 95) + 95);
|
||||
|
||||
mission.setCreditReward(bountyTarget.getCreditReward());
|
||||
|
||||
@@ -526,9 +532,7 @@ public class MissionService implements INetworkDispatch {
|
||||
if (placer != 0)
|
||||
bounty.getBountyPlacers().add(placer);
|
||||
|
||||
Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null);
|
||||
bountiesODB.put(bounty, Long.class, BountyListItem.class, txn);
|
||||
txn.commitSync();
|
||||
updateBounty(bounty);
|
||||
|
||||
bountyList.add(bounty);
|
||||
|
||||
@@ -536,41 +540,45 @@ public class MissionService implements INetworkDispatch {
|
||||
return bounty;
|
||||
}
|
||||
|
||||
public boolean addToExistingBounty(CreatureObject bountyTarget, long placer, int amountToAdd) {
|
||||
public boolean addToExistingBounty(long bountyTarget, long placer, int amountToAdd) {
|
||||
|
||||
BountyListItem bounty = getBountyListItem(bountyTarget.getObjectId());
|
||||
BountyListItem bounty = getBountyListItem(bountyTarget);
|
||||
|
||||
if (bounty == null)
|
||||
return false;
|
||||
|
||||
bounty.addBounty(amountToAdd);
|
||||
|
||||
if (placer != 0)
|
||||
if (placer != 0 && !bounty.getBountyPlacers().contains(placer))
|
||||
bounty.getBountyPlacers().add(placer);
|
||||
|
||||
Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null);
|
||||
bountiesODB.put(bounty, Long.class, BountyListItem.class, txn);
|
||||
txn.commitSync();
|
||||
updateBounty(bounty);
|
||||
|
||||
//System.out.println("Added bounty of " + amountToAdd + " to " + bounty.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean removeBounty(CreatureObject bountyTarget, boolean listRemove) {
|
||||
public boolean removeBounty(long bountyTarget, boolean listRemove) {
|
||||
Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null);
|
||||
|
||||
if (listRemove)
|
||||
bountyList.remove(bountiesODB.get(bountyTarget.getObjectId(), Long.class, BountyListItem.class));
|
||||
bountyList.remove(bountiesODB.get(bountyTarget, Long.class, BountyListItem.class));
|
||||
|
||||
bountiesODB.delete(bountyTarget.getObjectId(), Long.class, BountyListItem.class, txn);
|
||||
bountiesODB.delete(bountyTarget, Long.class, BountyListItem.class, txn);
|
||||
txn.commitSync();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean removeBounty(CreatureObject bountyTarget) {
|
||||
public boolean removeBounty(long bountyTarget) {
|
||||
return removeBounty(bountyTarget, true);
|
||||
}
|
||||
|
||||
public void updateBounty(BountyListItem bounty) {
|
||||
Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null);
|
||||
bountiesODB.put(bounty, Long.class, BountyListItem.class, txn);
|
||||
txn.commitSync();
|
||||
}
|
||||
|
||||
private void cleanupBounties() {
|
||||
AtomicInteger bountyCount = new AtomicInteger();
|
||||
Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null);
|
||||
|
||||
Reference in New Issue
Block a user