Beispiel #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.GetVersion();

            switch (version)
            {
            case 1:
                Display = reader.ReadFlag <TitleDisplay>();
                goto case 0;

            case 0:
            {
                MaleTitle   = reader.ReadString();
                FemaleTitle = reader.ReadString();
            }
            break;
            }

            if (version < 1)
            {
                Display = TitleDisplay.BeforeName;
            }
        }
 public void ClearVars()
 {
     _AddHue         = 0;
     _AddRarity      = TitleRarity.Common;
     _AddDisplay     = TitleDisplay.BeforeName;
     _AddTitleFemale = null;
     _AddTitleMale   = null;
 }
Beispiel #3
0
		public Title(
			string maleTitle,
			string femalTitle,
			TitleRarity rarity = TitleRarity.Common,
			TitleDisplay display = TitleDisplay.BeforeName)
			: base(rarity)
		{
			MaleTitle = maleTitle;
			FemaleTitle = femalTitle;

			Display = display;
		}
Beispiel #4
0
        public Title(
            string maleTitle,
            string femalTitle,
            TitleRarity rarity   = TitleRarity.Common,
            TitleDisplay display = TitleDisplay.BeforeName)
            : base(rarity)
        {
            MaleTitle   = maleTitle;
            FemaleTitle = femalTitle;

            Display = display;
        }
Beispiel #5
0
        public static Title CreateTitle(
            string maleValue, string femaleValue, TitleRarity rarity, TitleDisplay display, out string result)
        {
            if (String.IsNullOrWhiteSpace(maleValue))
            {
                result = "The male title can not be whitespace.";
                return(null);
            }

            if (String.IsNullOrWhiteSpace(femaleValue))
            {
                femaleValue = maleValue;
                //result = "The female title can not be whitespace.";
                //return null;
            }

            //Allow female and male titles to be the same to specify gender neutral titles

            /*if (maleValue == femaleValue)
             * {
             *      result = "The male and female titles must differ.";
             *      return null;
             * }*/

            if (TitleRegistry.Any(x => x.Value.MaleTitle == maleValue))
            {
                result = "The male title '" + maleValue + "' already exists in the registry.";
                return(null);
            }

            if (TitleRegistry.Any(x => x.Value.FemaleTitle == femaleValue))
            {
                result = "The female title '" + femaleValue + "' already exists in the registry.";
                return(null);
            }

            var title = new Title(maleValue, femaleValue, rarity, display);

            TitleRegistry.Add(title.UID, title);

            foreach (TitleProfile p in
                     Profiles.Values.AsParallel()
                     .Where(p => p != null && p.Owner != null && p.Owner.AccessLevel >= AccessLevel.GameMaster))
            {
                p.Add(title);
            }

            result = "The title '" + title + "' was successfully added to the registry.";
            return(title);
        }
Beispiel #6
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.GetVersion();

			switch (version)
			{
				case 1:
					Display = reader.ReadFlag<TitleDisplay>();
					goto case 0;
				case 0:
					{
						MaleTitle = reader.ReadString();
						FemaleTitle = reader.ReadString();
					}
					break;
			}

			if (version < 1)
			{
				Display = TitleDisplay.BeforeName;
			}
		}
		public static Title CreateTitle(
			string maleValue, string femaleValue, TitleRarity rarity, TitleDisplay display, out string result)
		{
			if (String.IsNullOrWhiteSpace(maleValue))
			{
				result = "The male title can not be whitespace.";
				return null;
			}

			if (String.IsNullOrWhiteSpace(femaleValue))
			{
				femaleValue = maleValue;
				//result = "The female title can not be whitespace.";
				//return null;
			}

			//Allow female and male titles to be the same to specify gender neutral titles
			/*if (maleValue == femaleValue)
			{
				result = "The male and female titles must differ.";
				return null;
			}*/

			if (TitleRegistry.Any(x => x.Value.MaleTitle == maleValue))
			{
				result = "The male title '" + maleValue + "' already exists in the registry.";
				return null;
			}

			if (TitleRegistry.Any(x => x.Value.FemaleTitle == femaleValue))
			{
				result = "The female title '" + femaleValue + "' already exists in the registry.";
				return null;
			}

			var title = new Title(maleValue, femaleValue, rarity, display);

			TitleRegistry.Add(title.UID, title);

			foreach (TitleProfile p in
				Profiles.Values.AsParallel()
						.Where(p => p != null && p.Owner != null && p.Owner.AccessLevel >= AccessLevel.GameMaster))
			{
				p.Add(title);
			}

			result = "The title '" + title + "' was successfully added to the registry.";
			return title;
		}
 protected virtual void OnTitleDisplay(TitleDisplayEventArgs e)
 {
     TitleDisplay?.Invoke(this, e);
 }
        private void CompileTitleViewLayout(SuperGumpLayout layout)
        {
            layout.Add("label/chest/title/title", () => AddLabel(105, 120, 44, "Titles"));
            layout.Add("label/chest/title/selected/title", () => AddLabel(215, 120, 44, "Current Title: "));
            layout.Add(
                "label/chest/title/selected/value",
                () =>
            {
                TitleHue selectedHue = _TitleProfile.SelectedHue;
                Title selectedTitle  = _TitleProfile.SelectedTitle;
                Mobile owner         = _TitleProfile.Owner ?? User;

                int hue      = selectedHue != null ? selectedHue.Hue - 1 : CustomTitles.CMOptions.DefaultTitleHue;
                string title = selectedTitle != null ? selectedTitle.ToString(owner.Female) : String.Empty;

                if (!String.IsNullOrWhiteSpace(title))
                {
                    AddLabel(305, 120, hue, title);
                }
            });

            layout.Add(
                "button/chest/title/clear/",
                () => AddButton(
                    405,
                    120,
                    22150,
                    22151,
                    btn =>
            {
                _TitleProfile.SelectedTitle = null;
                Refresh(true);
            }));

            layout.Add("label/chest/title/switch", () => AddLabel(450, 115, 44, "To Hues: "));
            layout.Add(
                "button/chest/title/switch",
                () => AddButton(
                    515,
                    115,
                    4006,
                    4005,
                    b =>
            {
                _View = ViewMode.Hue;
                Refresh(true);
            }));

            layout.Add("image/body/title/Hbar", () => AddImageTiled(101, 140, 452, 1, 0x2458));

            CompileRarityLayout(layout);

            if (User.AccessLevel < CustomTitles.Access)
            {
                return;
            }

            layout.Add("image/body/title/Hbaradmintop", () => AddImageTiled(78, 325, 500, 1, 9304));
            //layout.Add("label/body/title/create", () => AddLabel(105, 330, 44, "Create New Title"));
            //layout.Add("image/body/title/Hbarnewunderline", () => AddImageTiled(107, 347, 100, 1, 9304));

            layout.Add("label/body/title/male", () => AddLabel(105, 330, 100, "Male Title"));
            layout.Add("background/body/title/male", () => AddBackground(105, 355, 125, 25, 9350));
            layout.Add(
                "textentry/body/title/male",
                () => AddTextEntryLimited(
                    108,
                    360,
                    125,
                    25,
                    100,
                    _AddTitleMale,
                    15,
                    (b, t) =>
            {
                if (!String.IsNullOrWhiteSpace(t))
                {
                    _AddTitleMale = t;
                }
            }));

            layout.Add("label/body/title/female", () => AddLabel(235, 330, 100, "Female Title"));
            layout.Add("background/body/female", () => AddBackground(235, 355, 125, 25, 9350));
            layout.Add(
                "textentry/body/title/female",
                () => AddTextEntryLimited(
                    238,
                    360,
                    125,
                    25,
                    100,
                    _AddTitleFemale,
                    15,
                    (b, t) =>
            {
                if (!String.IsNullOrWhiteSpace(t))
                {
                    _AddTitleFemale = t;
                }
            }));

            layout.Add("background/body/title/display", () => AddBackground(365, 330, 125, 25, 9350));
            layout.Add(
                "textentry/body/title/display",
                () => AddEnumSelect(
                    365,
                    330,
                    4005,
                    4007,
                    35,
                    2,
                    25,
                    90,
                    TextHue,
                    _AddDisplay,
                    d =>
            {
                _AddDisplay = d;
                Refresh(true);
            }));

            layout.Add("background/body/title/rarity", () => AddBackground(365, 355, 125, 25, 9350));
            layout.Add(
                "menu/body/title/rarity",
                () => AddEnumSelect(
                    365,
                    355,
                    4005,
                    4007,
                    35,
                    2,
                    25,
                    90,
                    _AddRarity.AsHue(),
                    _AddRarity,
                    r =>
            {
                _AddRarity = r;
                Refresh(true);
            }));

            layout.Add("button/body/title/help", () => AddButton(495, 360, 22153, 22154, b => DisplayHelp()));
            layout.Add("button/body/title/accept", () => AddButton(525, 357, 4024, 4025, b => AddTitle()));
        }