mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-14 04:13:14 -04:00
Added Entertainer Missions
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment("terminalType", 2)
|
||||
object.setAttachment("terminalType", 3)
|
||||
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_entertainer', object.getPosition().x, object.getPosition().z, 41, 75, 0)
|
||||
return
|
||||
@@ -0,0 +1,73 @@
|
||||
/*******************************************************************************
|
||||
* 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 resources.objectives;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import main.NGECore;
|
||||
import resources.common.OutOfBand;
|
||||
import resources.datatables.DisplayType;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.mission.MissionObject;
|
||||
import services.mission.MissionObjective;
|
||||
|
||||
public class EntertainerMissionObjective extends MissionObjective{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int entertainerMissionNum;
|
||||
|
||||
public EntertainerMissionObjective(MissionObject parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(NGECore core, CreatureObject player) {
|
||||
|
||||
// This way will allow 2 Entertainer missions at a time.
|
||||
AtomicInteger number = new AtomicInteger();
|
||||
player.getSlottedObject("datapad").viewChildren(player, true, false, (obj) -> {
|
||||
if (obj instanceof MissionObject && ((MissionObject) obj).getMissionType().equals("entertainer")) { number.getAndIncrement(); }
|
||||
});
|
||||
player.setAttachment("entertainerMission" + Integer.valueOf(number.get()), getMissionObject().getObjectID());
|
||||
entertainerMissionNum = number.get();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(NGECore core, CreatureObject player) {
|
||||
int reward = getMissionObject().getCreditReward();
|
||||
player.addBankCredits(getMissionObject().getCreditReward());
|
||||
player.setAttachment("entertainerMission" + Integer.valueOf(entertainerMissionNum), 0);
|
||||
player.sendSystemMessage(OutOfBand.ProsePackage("@mission/mission_generic:success_w_amount", reward), DisplayType.Broadcast);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abort(NGECore core, CreatureObject player) {
|
||||
player.setAttachment("entertainerMission" + Integer.valueOf(entertainerMissionNum), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(NGECore core, CreatureObject player) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,6 +50,7 @@ import resources.objectives.BountyMissionObjective;
|
||||
import resources.objectives.DeliveryMissionObjective;
|
||||
import resources.objectives.DestroyMissionObjective;
|
||||
import resources.objectives.SurveyMissionObjective;
|
||||
import resources.objectives.EntertainerMissionObjective;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.mission.MissionObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
@@ -164,7 +165,7 @@ public class MissionService implements INetworkDispatch {
|
||||
break;
|
||||
|
||||
case TerminalType.ENTERTAINER:
|
||||
//handleMissionListRequest(object, request.getTickCount(), TerminalType.ENTERTAINER);
|
||||
handleMissionListRequest(object, request.getTickCount(), TerminalType.ENTERTAINER);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
@@ -310,6 +311,9 @@ public class MissionService implements INetworkDispatch {
|
||||
else if (type == TerminalType.ARTISAN)
|
||||
return;
|
||||
//randomSurveyMission(player, mission);
|
||||
|
||||
else if (type == TerminalType.ENTERTAINER)
|
||||
randomEntertainerMission(player, mission);
|
||||
|
||||
else
|
||||
return;
|
||||
@@ -328,6 +332,8 @@ public class MissionService implements INetworkDispatch {
|
||||
else if (type == TerminalType.BOUNTY)
|
||||
randomBountyMission(player, mission);
|
||||
|
||||
else if (type == TerminalType.ENTERTAINER)
|
||||
randomEntertainerMission(player, mission);
|
||||
else
|
||||
return;
|
||||
|
||||
@@ -447,6 +453,16 @@ public class MissionService implements INetworkDispatch {
|
||||
surveyObjective.activate(core, creature);
|
||||
|
||||
return surveyObjective;
|
||||
|
||||
case "entertainer":
|
||||
EntertainerMissionObjective entertainerObjective = new EntertainerMissionObjective(mission);
|
||||
|
||||
mission.setObjective(entertainerObjective);
|
||||
|
||||
if (!silent)
|
||||
entertainerObjective.activate(core, creature);
|
||||
|
||||
return entertainerObjective;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -622,6 +638,50 @@ public class MissionService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
private void randomEntertainerMission(SWGObject player, MissionObject mission) {
|
||||
|
||||
CreatureObject creature = (CreatureObject) player;
|
||||
PlayerObject playera = (PlayerObject) creature.getSlottedObject("ghost");
|
||||
|
||||
Point3D playerLocation = player.getWorldPosition();
|
||||
MissionLocation startLocation = new MissionLocation(creature.getPosition(), creature.getObjectId(), player.getPlanet().name);
|
||||
MissionLocation destinationLocation = new MissionLocation(creature.getPosition(), creature.getObjectId(), player.getPlanet().name);
|
||||
|
||||
mission.setMissionType("entertainer");
|
||||
|
||||
String missionStf = null;
|
||||
|
||||
|
||||
if(creature.getFaction() == "rebel"){
|
||||
missionStf = "mission/mission_npc_dancer_rebel_easy";
|
||||
}else if(creature.getFaction() == "imperial"){
|
||||
missionStf = "mission/mission_npc_dancer_imperial_easy";
|
||||
}else{
|
||||
missionStf = "mission/mission_npc_dancer_neutral_easy";
|
||||
}
|
||||
|
||||
mission.setMissionId(10);
|
||||
mission.setTitle("@" + missionStf + ":" + "m" + mission.getMissionId() + "t");
|
||||
mission.setDescription("@" + missionStf + ":" + "m" + mission.getMissionId() + "o");
|
||||
|
||||
if(playera.getProfession() != "entertainer_1a"){
|
||||
mission.setDifficultyLevel(5);
|
||||
}else{
|
||||
mission.setDifficultyLevel(creature.getLevel());
|
||||
}
|
||||
mission.setCreator(nameGenerator.compose(2) + " " + nameGenerator.compose(3));
|
||||
mission.setCreditReward((int) (200 + ((startLocation.getLocation().getDistance2D(destinationLocation.getLocation()) / 10))));
|
||||
|
||||
mission.setTemplateObject(CRC.StringtoCRC("object/tangible/mission/shared_mission_datadisk.iff"));
|
||||
mission.setTargetName("Datadisk");
|
||||
|
||||
System.out.println("missionstf: " + missionStf);
|
||||
System.out.println("Level: " + creature.getLevel());
|
||||
System.out.println("Profession: " + playera.getProfession());
|
||||
System.out.println("Faction: " + creature.getFaction());
|
||||
System.out.println("Difficulty: " + mission.getDifficultyLevel());
|
||||
}
|
||||
|
||||
public enum TerminalType {;
|
||||
public static final int GENERIC = 1;
|
||||
public static final int BOUNTY = 2;
|
||||
|
||||
Reference in New Issue
Block a user