示例#1
0
		public void Add(Title title)
		{
			if (title != null)
			{
				Titles.Add(title);
			}
		}
示例#2
0
		public TitleScroll(Title title)
			: base(0x2831)
		{
			Title = title;

			Name = "a title scroll";
			Weight = 2;
			Hue = 1195;
		}
示例#3
0
		public static bool GetTitle(PlayerMobile target, out Title t)
		{
			t = null;

			if (target == null || target.Deleted)
			{
				return false;
			}

			TitleProfile p;

			if (!Profiles.TryGetValue(target, out p) || p == null || p.Owner != target)
			{
				return false;
			}

			t = p.SelectedTitle;
			return true;
		}
示例#4
0
		private void CompileTitleLayout(SuperGumpLayout layout, Title title)
		{
			layout.Add("label/body/title/grantmessage", () => AddLabel(70, 110, 1457, "This scroll grants the title: "));
			layout.Add("label/body/title/grant", () => AddLabel(110, 145, 1461, title.ToString(User.Female)));

			layout.Add("image/body/title/Hbar", () => AddImageTiled(100, 160, 120, 2, 2620));

			layout.Add("label/body/title/raritymessage", () => AddLabel(25, 185, 1457, "Title Rarity: "));
			layout.Add("label/body/title/rarity", () => AddLabel(105, 185, title.GetRarityHue(), title.Rarity.ToString()));

			layout.Add("label/body/title/owned", () => AddLabel(25, 205, 1457, "People who have this title: "));
			layout.Add("label/body/title/ownednumber", () => AddLabel(193, 205, 1461, title.GetOwnerCount().ToString("#,0")));
		}
示例#5
0
		public static bool PurgeTitle(Title title, out string result)
		{
			if (title == null)
			{
				result = "Title can not be null.";
				return false;
			}

			foreach (TitleProfile p in Profiles.Values)
			{
				p.Remove(title);
			}

			if (!TitleRegistry.Remove(title.UID))
			{
				result = "The title '" + title + "' did not exist in the registry.";
				return false;
			}

			result = "The title '" + title + "' has been successfully deleted.";

			return true;
		}
示例#6
0
		public static bool TryGetTitle(string title, out Title value)
		{
			return (value = TitleRegistry.Values.FirstOrDefault(t => t.Match(title))) != null;
		}
示例#7
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;
		}
示例#8
0
		public bool Contains(Title title)
		{
			return title != null && Titles.Contains(title);
		}
示例#9
0
		public bool Remove(Title title)
		{
			return title != null && Titles.Remove(title);
		}
        private static bool DeserializeTitleRegistry(GenericReader reader)
        {
            int version = reader.GetVersion();

            switch (version)
            {
                case 0:
                {
                    reader.ReadBlockDictionary(
                        () =>
                        {
                            var t = new Title(reader);
                            TitleObjectSerial s = t.UID;

                            return new KeyValuePair<TitleObjectSerial, Title>(s, t);
                        },
                        TitleRegistry);
                }
                    break;
            }

            return true;
        }
        public static void WriteTitle(GenericWriter writer, Title title)
        {
            if (title != null)
            {
                writer.Write(true);

                title.UID.Serialize(writer);
            }
            else
            {
                writer.Write(false);
            }
        }