Beispiel #1
0
        public static void TicketCivilian(string invokerHandle, string first, string last, string reason, float amount)
        {
            Player   invoker = GetPlayerByHandle(invokerHandle); // getting the invoker
            Civilian civ     = GetCivilianByName(first, last);   // finding the civ

            // checking for civ
            if (civ != null)
            {
                int    index = Civs.IndexOf(civ);                    // finding the index of the civ
                Player p     = GetPlayerByIp(Civs[index].SourceIP);  // finding the player that the civ owns
                Civs[index].CitationCount++;                         // adding 1 to the citations
                Civs[index].Tickets.Add(new Ticket(reason, amount)); // adding a ticket to the existing tickets
                // msgs for the civs
                if (p != null)
                {
                    SendMessage(p, "Ticket", new[] { 255, 0, 0 },
                                $"{invoker.Name} tickets you for ${amount.ToString(CultureInfo.InvariantCulture)} because of {reason}");
                }
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 },
                            $"You successfully ticketed {p?.Name ?? "NULL"} for ${amount.ToString(CultureInfo.InvariantCulture)}");
            }
            else
            {
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, "That name doesn't exist in the system");
            }
        }
Beispiel #2
0
        public static void SetName(string handle, string first, string last)
        {
            Player p = GetPlayerByHandle(handle);

            if (GetOfficer(handle) != null) // checking if the civilian has an officer
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You cannot be an officer and a civilian at the same time!");
                return; // return if they do
            }

            if (GetCivilianByName(first, last) != null && GetPlayerByIp(GetCivilianVeh(handle).SourceIP) != p) // checking if the name already exists in the system
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "That name already exists in the system!");
                return; // return if it does
            }

            // checking if the civilian already has a civ in the system
            if (GetCivilian(handle) != null)
            {
                int index = Civs.IndexOf(GetCivilian(handle)); // finding the index of the existing civ

                Civs[index] = new Civilian(p.Identifiers["ip"])
                {
                    First = first, Last = last
                };                                                                                                               // setting the index to an instance of a new civilian

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"New name set to: {Civs[index].First} {Civs[index].Last}"); // saying the new name created
            }
            else // if the civ doesn't exist
            {
                Civs.Add(new Civilian(p.Identifiers["ip"])
                {
                    First = first, Last = last
                });                                                                                                              // add a new civilian to the system
                int index = Civs.IndexOf(GetCivilian(handle));                                                                   // find the index of the civ

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"New name set to: {Civs[index].First} {Civs[index].Last}"); // say the new name was created
#if DEBUG
                SendMessage(p, "", new[] { 0, 0, 0 }, "Creating new civilian profile...");
#endif
            }
            if (GetCivilianVeh(handle) != null)
            {
                // below basically resets the vehicle if it exists

                int index = CivVehs.IndexOf(GetCivilianVeh(handle));

                CivVehs[index] = new CivilianVeh(p.Identifiers["ip"]);
            }
        }
Beispiel #3
0
        public static void ToggleWarrant(string handle)
        {
            Player p = GetPlayerByHandle(handle);

            if (GetCivilian(handle) != null)
            {
                int index = Civs.IndexOf(GetCivilian(handle));          // finding the index
                Civs[index].WarrantStatus = !Civs[index].WarrantStatus; // setting the warrant status of the opposite of before
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"Warrant status set to {Civs[index].WarrantStatus}");
            }
            else
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You must set your name before you can toggle your warrant");
            }
        }
Beispiel #4
0
        public static void SetCitations(string handle, int count)
        {
            Player p = GetPlayerByHandle(handle);

            if (GetCivilian(handle) != null)
            {
                int index = Civs.IndexOf(GetCivilian(handle)); // again finding index
                Civs[index].CitationCount = count;             // setting the count of the citations

                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, $"Citation count set to {count}");
            }
            else
            {
                SendMessage(p, "DispatchSystem", new[] { 0, 0, 0 }, "You must set your name before you can set your citations");
            }
        }
Beispiel #5
0
        public static void AddCivilianNote(string invokerHandle, string first, string last, string note)
        {
            Player   invoker = GetPlayerByHandle(invokerHandle); // getting the invoker
            Civilian civ     = GetCivilianByName(first, last);   // finding the civ

            // checking civ
            if (civ != null)
            {
                int index = Civs.IndexOf(civ);                                                                                   // finding the index
                Civs[index].Notes.Add(note);                                                                                     // adding the note to the civ
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, $"Note of \"{note}\" has been added to the Civilian"); // msg
            }
            else
            {
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, "That name doesn't exist in the system");
            }
        }
Beispiel #6
0
        public static void DisplayCivilianTickets(string invokerHandle, string first, string last)
        {
            Player   invoker = GetPlayerByHandle(invokerHandle); // getting the invoker
            Civilian civ     = GetCivilianByName(first, last);   // finding the civ

            // checking for civ
            if (civ != null)
            {
                int index = Civs.IndexOf(civ); // finding the index of the civ
                // msgs if any tickets
                if (!Civs[index].Tickets.Any())
                {
                    SendMessage(invoker, "", new[] { 0, 0, 0 }, "^7None");
                }
                else
                {
                    Civs[index].Tickets.ForEach(x => SendMessage(invoker, "", new[] { 0, 0, 0 }, $"^7${x.Amount}: {x.Reason}")); // big msgs
                }
            }
            else
            {
                SendMessage(invoker, "DispatchSystem", new[] { 0, 0, 0 }, "That name doesn't exist in the system");
            }
        }