Exemplo n.º 1
0
        /// <summary>
        /// Add a list of objectives for a particular module.
        /// </summary>
        /// <param name="moduleID">The module the objectives should be identified with.</param>
        /// <param name="objectivesList">The objectives to add for the given module.</param>
        public static void addAll(int moduleID, IList objectivesList)
        {
            SqlCommand   command       = new SqlCommand();
            SqlParameter moduleIDParam = new SqlParameter("@ModuleID", SqlDbType.Int, 4, "ModuleID");
            SqlParameter bloomParam    = new SqlParameter("@BloomLevel", SqlDbType.VarChar);
            SqlParameter textParam     = new SqlParameter("@ObjectiveText", SqlDbType.VarChar);
            SqlParameter orderIDParam  = new SqlParameter("@OrderID", SqlDbType.Int, 4, "OrderID");

            command.Connection  = new SqlConnection(Globals.ConnectionString);
            command.CommandText =
                "INSERT INTO Objectives(ModuleID, BloomLevel, ObjectiveText, OrderID) " +
                "VALUES (@ModuleID, @BloomLevel, @ObjectiveText, @OrderID)";
            moduleIDParam.Value = moduleID;
            command.Parameters.Add(moduleIDParam);
            command.Parameters.Add(bloomParam);
            command.Parameters.Add(textParam);
            command.Parameters.Add(orderIDParam);

            try {
                command.Connection.Open();

                for (int i = 0; i < objectivesList.Count; i++)
                {
                    ObjectiveInfo oi = (ObjectiveInfo)objectivesList[i];
                    bloomParam.Value   = oi.BloomLevel;
                    textParam.Value    = oi.Text;
                    orderIDParam.Value = i + 1;
                    command.ExecuteNonQuery();
                }
            } catch (SqlException e) {
                throw;
            } finally {
                command.Connection.Close();
            }
        }
Exemplo n.º 2
0
 public static List <ObjectiveInfo> GetADObjectives(List <ObjectiveInfoData> list)
 {
     try
     {
         List <ObjectiveInfo> od = new List <ObjectiveInfo>();
         if (list != null)
         {
             list.ForEach(o =>
             {
                 ObjectiveInfo odi = new ObjectiveInfo
                 {
                     Id     = o.Id,
                     Status = o.Status,
                     Unit   = o.Unit,
                     Value  = o.Value
                 };
                 od.Add(odi);
             });
         }
         return(od);
     }
     catch (Exception ex)
     {
         throw new Exception("AD:GetADObjectives()::" + ex.Message, ex.InnerException);
     }
 }
Exemplo n.º 3
0
 public void CompareInfo(ObjectiveInfo info)
 {
     if (info.objective == objective)
     {
         currentManager.NotifyProgress(info.success?ScenarioStep.Continue:ScenarioStep.Restart);
     }
 }
Exemplo n.º 4
0
        public static ObjectiveInfo AddObjective(string title = "", bool show = false)
        {
            ObjectiveInfo objectiveInfo = new ObjectiveInfo();

            objectives.Add(objectiveInfo);
            return(objectiveInfo);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add new objective info to your Major Objective.
        /// </summary>
        /// <returns></returns>
        public ObjectiveInfo addEmptyObjectiveInfo()
        {
            ObjectiveInfo objInfo = new ObjectiveInfo();

            objInfo.MissionInstance = mission;
            objectives.Add(objInfo);
            return(objInfo);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Used to remove a single Objective from the Major Objective.
 /// </summary>
 /// <param name="obj"></param>
 public void removeMinorObjective(ObjectiveInfo obj)
 {
     if (objectives.Contains(obj))
     {
         mission.removeObjectiveForAll(obj);
         objectives.Remove(obj);
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Queue an objective to be removed.
        /// </summary>
        /// <param name="obj"></param>
        public void queueMinorObjectiveForRemoval(ObjectiveInfo obj)
        {
            if (removeableObjectives.Contains(obj))
            {
                return;
            }

            removeableObjectives.Add(obj);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Removes an objective based on location.
        /// </summary>
        /// <param name="location"></param>
        public void removeObjectiveForAll(ObjectiveInfo objInfo)
        {
            foreach (Client ally in players)
            {
                if (objInfo.Type == Objective.ObjectiveTypes.BreakIntoVehicle)
                {
                    API.triggerClientEvent(ally, "End_Lock_Pick_Minigame");
                }

                API.triggerClientEvent(ally, "Mission_Remove_Objective", objInfo.ObjectiveID);
                API.triggerClientEvent(ally, "Mission_Head_Notification", "~b~Minor Objective Complete", "Objective");
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Removes a specific ObjectiveInfo from the master objective.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="mission"></param>
        public void forceRemoveObjective(ObjectiveInfo obj, Mission mission)
        {
            if (objectives.Contains(obj))
            {
                objectives.Remove(obj);
            }

            mission.setupTeamSync();

            if (objectives.Count >= 1)
            {
                return;
            }

            mission.goToNextObjective();
        }
Exemplo n.º 10
0
        public void startShortRangeTruckingJob(Client player, params object[] arguments)
        {
            if (player.position.DistanceTo(startPoint) >= 5)
            {
                return;
            }

            Mission mission;

            if (API.hasEntityData(player, "Mission"))
            {
                mission = API.getEntityData(player, "Mission");
                if (mission.MissionObjectiveCount > 0)
                {
                    API.sendChatMessageToPlayer(player, "~r~You seem to already have a mission running.");
                    return;
                }
                API.setEntitySyncedData(player, "Mission_New_Instance", true);
                API.setEntityData(player, "Mission", mission);
                mission.addPlayer(player);
            }
            else
            {
                mission = new Mission();
                API.setEntitySyncedData(player, "Mission_New_Instance", true);
                API.setEntityData(player, "Mission", mission);
                mission.addPlayer(player);
            }

            // Basic Setup.
            mission.useTimer();
            mission.MissionTime   = 60 * 5;
            mission.MissionReward = reward;
            mission.MissionTitle  = "Short Range Trucking";

            // Queue System
            DateTime  startTime = DateTime.Now;
            SpawnInfo openSpot  = null;

            while (openSpot == null)
            {
                openSpot = Utility.findOpenSpawn(spawns, mission);

                if (openSpot != null)
                {
                    openSpot.Vehicle = player;
                    break;
                }
            }
            // Setup a unique ID for the vehicle we'll be using.
            int uniqueID = new Random().Next(1, 50000);
            // == First Major Objective
            // = Create an empty objective to house information. Create an empty ObjectiveInfo Add our first objective, and associate the Vehicle ID with our objective.
            Objective objective = mission.addEmptyObjective(mission);

            objective.addObjectiveVehicle(mission, openSpot.Position, VehicleHash.Comet3, rotation: openSpot.Rotation, uniqueID: uniqueID);

            ObjectiveInfo objectiveInfo = objective.addEmptyObjectiveInfo();

            objectiveInfo.Location        = openSpot.Position;
            objectiveInfo.Type            = Objective.ObjectiveTypes.RetrieveVehicle;
            objectiveInfo.UniqueVehicleID = uniqueID;

            objectiveInfo = objective.addEmptyObjectiveInfo();
            NetHandle boxObject = API.createObject(-719727517, new Vector3(-1321.264, -253.4067, 41.13453), new Vector3());

            objectiveInfo.Location  = new Vector3(-1321.264, -253.4067, 41.13453);
            objectiveInfo.Type      = Objective.ObjectiveTypes.PickupObject;
            objectiveInfo.AddObject = boxObject;

            // == Second Major Objective
            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = midPoint;
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleLocation;
            objectiveInfo.UniqueVehicleID = uniqueID;

            // == Third Major Objective
            int missionIndex = new Random().Next(0, locations.Count);

            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = locations[missionIndex];
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleCapture;
            objectiveInfo.UniqueVehicleID = uniqueID;

            // == Fourth Major Objective
            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = endPoint;
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleLocation;
            objectiveInfo.UniqueVehicleID = uniqueID;

            // == Fifth Major Objective
            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = startPoint;
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleLocation;
            objectiveInfo.UniqueVehicleID = uniqueID;

            // == Start Mission
            mission.startMission();
        }
Exemplo n.º 11
0
        public void startChopShopJob(Client player, params object[] arguments)
        {
            if (player.position.DistanceTo(startPoint) >= 5)
            {
                return;
            }

            Mission mission;

            if (API.hasEntityData(player, "Mission"))
            {
                mission = API.getEntityData(player, "Mission");
                if (mission.MissionObjectiveCount > 0)
                {
                    API.sendChatMessageToPlayer(player, "~r~You seem to already have a mission running.");
                    return;
                }
                API.setEntitySyncedData(player, "Mission_New_Instance", true);
                API.setEntityData(player, "Mission", mission);
                mission.addPlayer(player);
            }
            else
            {
                mission = new Mission();
                API.setEntitySyncedData(player, "Mission_New_Instance", true);
                API.setEntityData(player, "Mission", mission);
                mission.addPlayer(player);
            }

            // Basic Setup.
            mission.useTimer();
            mission.MissionTime              = 60 * 5;
            mission.MissionReward            = reward;
            mission.MissionTitle             = "Chop Shop";
            mission.RemoveFromMissionOnDeath = true;

            StashInfo stash = StashManager.getStashInfoByID(1);

            if (stash == null)
            {
                API.sendChatMessageToPlayer(player, "~r~Something went wrong with stashes. Contact an administrator.");
                return;
            }

            mission.AttachStashInfo = stash;

            // Setup a unique ID for the vehicle we'll be using.
            int uniqueID = new Random().Next(1, 50000);
            // == First Major Objective
            // = Create an empty objective to house information. Create an empty ObjectiveInfo Add our first objective, and associate the Vehicle ID with our objective.
            Objective     objective     = mission.addEmptyObjective(mission);
            ObjectiveInfo objectiveInfo = objective.addEmptyObjectiveInfo();

            objectiveInfo.Location = midPoint;
            objectiveInfo.Type     = Objective.ObjectiveTypes.Location;
            objectiveInfo.Lockpick = new minigames.Lockpick();

            // == Second Major Objective
            int     missionIndex = new Random().Next(0, locations.Count);
            int     carIndex     = new Random().Next(0, vehicleList.Count);
            Vector3 location     = locations[missionIndex].Location;
            Vector3 rotation     = locations[missionIndex].Rotation;

            objective              = mission.addEmptyObjective(mission);
            objectiveInfo          = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location = location;
            objectiveInfo.Type     = Objective.ObjectiveTypes.BreakIntoVehicle;
            objectiveInfo.Lockpick = new minigames.Lockpick();
            NetHandle vehicle = objective.addObjectiveVehicle(mission, location.Add(new Vector3(0, 0, 0.2)), API.vehicleNameToModel(vehicleList[carIndex]), rotation, uniqueID);

            API.setVehiclePrimaryColor(vehicle, new Random().Next(0, 159));
            API.setVehicleSecondaryColor(vehicle, new Random().Next(0, 159));

            API.setEntityPositionFrozen(vehicle, true);
            API.delay(5000, true, () =>
            {
                API.setVehicleLocked(vehicle, true);
                API.setVehicleEngineStatus(vehicle, false);
                API.setEntityPositionFrozen(vehicle, false);
            });

            // == Third Major Objective - Take Vehicle
            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = location;
            objectiveInfo.Type            = Objective.ObjectiveTypes.RetrieveVehicle;
            objectiveInfo.UniqueVehicleID = uniqueID;
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Type            = Objective.ObjectiveTypes.UnlockVehicles;
            objectiveInfo.Location        = new Vector3();
            objectiveInfo.UniqueVehicleID = uniqueID;

            // == Parse End Point
            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = endPoint;
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleLocation;
            objectiveInfo.UniqueVehicleID = uniqueID;

            // == Start Mission

            mission.startMission();
        }
Exemplo n.º 12
0
        public void startLongRangeTruckingJob(Client player, params object[] arguments)
        {
            if (player.position.DistanceTo(startPoint) >= 5)
            {
                return;
            }

            if (API.hasEntityData(player, "Mission"))
            {
                API.sendChatMessageToPlayer(player, "~r~You're already in a party, ~w~/leaveparty ~r~if you want to abandon your allies.");
                return;
            }

            // Basic Setup.
            Mission mission = new Mission();

            mission.MissionReward = reward;
            mission.MissionTitle  = "Long Distance Trucking";

            API.setEntitySyncedData(player, "Mission_New_Instance", true);
            API.setEntityData(player, "Mission", mission);
            mission.addPlayer(player);

            // Try and find an open spot.
            SpawnInfo openSpot = null;

            while (openSpot == null)
            {
                foreach (SpawnInfo spawn in spawns)
                {
                    if (!spawn.Occupied)
                    {
                        openSpot          = spawn;
                        openSpot.Occupied = true;
                        openSpot.Vehicle  = player;
                        break;
                    }
                }

                if (openSpot != null)
                {
                    break;
                }
            }

            // Generate a unique ID for our objectives.
            int uniqueVehicleID = new Random().Next(1, 20000);

            // 1 - Major Objective - Go to the vehicle.
            Objective     objective     = mission.addEmptyObjective(mission);
            ObjectiveInfo objectiveInfo = objective.addEmptyObjectiveInfo();

            objectiveInfo.Location        = openSpot.Position;
            objectiveInfo.Type            = Objective.ObjectiveTypes.RetrieveVehicle;
            objectiveInfo.UniqueVehicleID = uniqueVehicleID;
            NetHandle vehicle = objective.addObjectiveVehicle(mission, openSpot.Position, VehicleHash.Packer, openSpot.Rotation, uniqueID: uniqueVehicleID);

            API.delay(20000, true, () =>
            {
                NetHandle trailer = objective.addObjectiveVehicle(mission, openSpot.Position.Add(new Vector3(0, 0, 0)), VehicleHash.Trailers, openSpot.Rotation, uniqueID: uniqueVehicleID);
            });

            // All of this will go away on Client Update.
            //API.setEntityData(vehicle, "Mission_Truck_Trailer", true);
            //API.setEntityData(vehicle, "Mission_Truck_Sync_Time", DateTime.Now.AddSeconds(3));
            //API.setEntityData(vehicle, "Mission_Truck_Sync_Distance", truckSpawn);
            // API.setEntityData(vehicle, "Mission_Truck_Trailer_Attachment", trailer);

            // 2 - Major Objective - Drive Vehicle Out
            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = new Vector3(-1080.812, -2231.04, 12.25332);
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleLocation;
            objectiveInfo.UniqueVehicleID = uniqueVehicleID;

            // 3 - Major Objective - Halfway Point
            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = midPoint;
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleLocation;
            objectiveInfo.UniqueVehicleID = uniqueVehicleID;

            // 4 - Major Objective - Get Random Point
            int locationIndex = new Random().Next(0, locations.Count);

            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = locations[locationIndex];
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleCapture;
            objectiveInfo.UniqueVehicleID = uniqueVehicleID;

            // 5 - Major Objective - Go back to depot.
            objective                     = mission.addEmptyObjective(mission);
            objectiveInfo                 = objective.addEmptyObjectiveInfo();
            objectiveInfo.Location        = endPoint;
            objectiveInfo.Type            = Objective.ObjectiveTypes.VehicleLocation;
            objectiveInfo.UniqueVehicleID = uniqueVehicleID;

            // 6 - Start the mission.
            mission.startMission();
        }
Exemplo n.º 13
0
 public static void RemoveObjective(ObjectiveInfo objectiveInfo)
 {
     sourceDescriptorList.Remove(objectiveInfo.sourceDescriptor);
     objectives.Remove(objectiveInfo);
 }