Ejemplo n.º 1
0
        /// <summary>
        /// Processes the actions involved with an engagement
        /// </summary>
        /// <returns>bool indicating whether engagement was processed successfully</returns>
        public bool ProcessEngagement()
        {
            bool success = false;

            // get interested parties
            PlayerCharacter headOfFamilyBride = null;
            PlayerCharacter headOfFamilyGroom = null;
            Character       bride             = null;
            Character       groom             = null;

            for (int i = 0; i < this.personae.Length; i++)
            {
                string   thisPersonae      = this.personae[i];
                string[] thisPersonaeSplit = thisPersonae.Split('|');

                switch (thisPersonaeSplit[1])
                {
                case "headOfFamilyBride":
                    headOfFamilyBride = Globals_Game.pcMasterList[thisPersonaeSplit[0]];
                    break;

                case "headOfFamilyGroom":
                    headOfFamilyGroom = Globals_Game.pcMasterList[thisPersonaeSplit[0]];
                    break;

                case "bride":
                    bride = Globals_Game.npcMasterList[thisPersonaeSplit[0]];
                    break;

                case "groom":
                    if (Globals_Game.pcMasterList.ContainsKey(thisPersonaeSplit[0]))
                    {
                        groom = Globals_Game.pcMasterList[thisPersonaeSplit[0]];
                    }
                    else if (Globals_Game.npcMasterList.ContainsKey(thisPersonaeSplit[0]))
                    {
                        groom = Globals_Game.npcMasterList[thisPersonaeSplit[0]];
                    }
                    break;

                default:
                    break;
                }
            }

            // ID
            uint replyID = Globals_Game.GetNextJournalEntryID();

            // date
            uint year   = Globals_Game.clock.currentYear;
            byte season = Globals_Game.clock.currentSeason;

            if (season == 3)
            {
                season = 0;
                year++;
            }
            else
            {
                season++;
            }

            // personae
            string headOfFamilyBrideEntry = headOfFamilyBride.charID + "|headOfFamilyBride";
            string headOfFamilyGroomEntry = headOfFamilyGroom.charID + "|headOfFamilyGroom";
            string thisBrideEntry         = bride.charID + "|bride";
            string thisGroomEntry         = groom.charID + "|groom";

            string[] marriagePersonae = new string[] { headOfFamilyGroomEntry, headOfFamilyBrideEntry, thisBrideEntry, thisGroomEntry };

            // type
            string type = "marriage";

            // create and add a marriage entry to the scheduledEvents journal
            JournalEntry marriageEntry = new JournalEntry(replyID, year, season, marriagePersonae, type, null);

            success = Globals_Game.AddScheduledEvent(marriageEntry);

            // show bride and groom as engaged
            if (success)
            {
                bride.fiancee = groom.charID;
                groom.fiancee = bride.charID;
            }

            return(success);
        }