Example #1
0
 /// <summary>
 /// Defines how to spawn an antag for this game mode.
 /// Defaults to picking a random antag from the possible antags list.
 /// </summary>
 public virtual void SpawnAntag(ConnectedPlayer player = null)
 {
     if (PossibleAntags.Count > 0)
     {
         int        randIndex = Random.Range(0, PossibleAntags.Count);
         Antagonist gmAntag   = Instantiate(PossibleAntags[randIndex]);
         AntagManager.Instance.CreateAntag(gmAntag, player);
     }
 }
Example #2
0
        public static NetMessage SendAntagRespawn(string userIdTorespawn, Antagonist antagonist)
        {
            var msg = new NetMessage()
            {
                UserToRespawn       = userIdTorespawn,
                OccupationToRespawn = antagonist.AntagName,
                Type = 2
            };

            Send(msg);
            return(msg);
        }
Example #3
0
 /// <summary>
 /// Checks if the antag preferences have at least one of the possible antags enabled.
 /// Assume the antag is enabled by default if it doesn't appear in the preferences or was never set up.
 /// </summary>
 /// <param name="antagPrefs"></param>
 /// <param name="antag"></param>
 /// <returns></returns>
 protected bool HasAntagEnabled(ref AntagPrefsDict antagPrefs, Antagonist antag)
 {
     if (antag.ShowInPreferences == false)
     {
         return(true);
     }
     if (antagPrefs.ContainsKey(antag.AntagName) && antagPrefs[antag.AntagName] == false)
     {
         //manually set to false by the player
         return(false);
     }
     return(true);
 }
Example #4
0
        public static RequestRespawnPlayer SendAntagRespawn(string userID, string adminToken, string userIdTorespawn,
                                                            Antagonist antagonist)
        {
            var msg = new RequestRespawnPlayer()
            {
                Userid              = userID,
                AdminToken          = adminToken,
                UserToRespawn       = userIdTorespawn,
                OccupationToRespawn = antagonist.AntagName,
                Type = 2
            };

            msg.Send();
            return(msg);
        }
Example #5
0
    public static bool HasAntagEnabled(ConnectedPlayer connectedPlayer, Antagonist antag)
    {
        if (connectedPlayer.CharacterSettings == null)
        {
            if (connectedPlayer.Script.characterSettings == null)
            {
                return(false);
            }

            connectedPlayer.CharacterSettings = connectedPlayer.Script.characterSettings;
        }

        return(!antag.ShowInPreferences ||
               (connectedPlayer.CharacterSettings.AntagPreferences.ContainsKey(antag.AntagName) &&
                connectedPlayer.CharacterSettings.AntagPreferences[antag.AntagName]));
    }
Example #6
0
        public ActionResult Appointment()
        {
            if (!hasValidSessionCookie())
            {
                return(RedirectToAction("LogOn"));
            }
            var dbs = new DatabaseServices();
            var randomMaleParticipant = dbs.GetParticipants(TypeOfGender.Male).OrderBy(x => Guid.NewGuid()).First();
            var ant = new Antagonist();

            byte[] pdfBytes = ant.GetAppointmentPDF(randomMaleParticipant);
            string filename = String.Format("\"AppointmentRequest{0}.{1}\"",
                                            DateTime.Now.ToString("dd_MMM_yyyy_HHmm"), "pdf");

            Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", filename));
            return(new FileContentResult(pdfBytes, MIME_PDF));
        }
Example #7
0
        public ActionResult GetRandomPair()
        {
            if (!hasValidSessionCookie())
            {
                return(RedirectToAction("LogOn"));
            }
            var randomPair = new Antagonist().GetMaleFemaleRandomPair();

            return(new JsonResult()
            {
                Data = new
                {
                    success = true,
                    Message = String.Format("Pssst - what's up with {0}? ...and {1} is being a real jerk today too.",
                                            randomPair.Item1.FullName, randomPair.Item2.FullName)
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #8
0
 public static bool HasAntagEnabled(AntagPrefsDict antagPrefs, Antagonist antag)
 {
     return(!antag.ShowInPreferences ||
            (antagPrefs.ContainsKey(antag.AntagName) && antagPrefs[antag.AntagName]));
 }
Example #9
0
 /// <summary>
 /// Remove the antag status from this mind
 /// </summary>
 public void RemoveAntag()
 {
     Antag = null;
 }
Example #10
0
 /// <summary>
 /// Make this mind a specific antag type
 /// </summary>
 public void SetAntag(Antagonist newAntag)
 {
     Antag       = newAntag;
     Antag.Owner = this;
     ShowObjectives();
 }
Example #11
0
 void Start()
 {
     DontDestroyOnLoad (this.gameObject);
     antagonist = FindObjectOfType<Antagonist> ();
     protagonist = FindObjectOfType<Protagonist> ();
 }
Example #12
0
 void Update()
 {
     UpdateDirection ();
     if (AC.GlobalVariables.GetBooleanValue (2)) {
         TurnOnCoords ();
         AC.GlobalVariables.SetBooleanValue (2, false);
     }
     if (EnableBelt ()) {
         if (antagonist == null) {
             antagonist = FindObjectOfType<Antagonist> ();
         }
         antagonist.SetActive (true);
     }
 }
Example #13
0
 /// <summary>
 /// Set up this newAntag entry
 /// </summary>
 public void Setup(Antagonist newAntag)
 {
     antag = newAntag;
     // Maybe this could include a description and a sprite in future
     antagName.text = newAntag.AntagName;
 }