public void Add(TitleHue hue) { if (hue != null) { Hues.Add(hue); } }
public HueScroll(TitleHue hue) : base(0x2831) { TitleHue = hue; Name = "a title hue scroll"; Weight = 2; Hue = 1195; }
private void CompileHueLayout(SuperGumpLayout layout, TitleHue hue) { layout.Add("label/body/hue/grantmessage", () => AddLabel(65, 110, 1457, "This scroll grants the title hue: ")); layout.Add("label/body/hue/granthue", () => AddLabel(110, 145, hue.Hue - 1, "##########")); layout.Add("image/body/hue/Hbar", () => AddImageTiled(100, 160, 120, 2, 2620)); layout.Add("label/body/hue/raritymessage", () => AddLabel(25, 185, 1457, "Hue Rarity: ")); layout.Add("label/body/hue/rarity", () => AddLabel(105, 185, hue.GetRarityHue(), hue.Rarity.ToString())); layout.Add("label/body/hue/owned", () => AddLabel(25, 205, 1457, "People who have this hue: ")); layout.Add("label/body/hue/ownednumber", () => AddLabel(193, 205, 1461, hue.GetOwnerCount().ToString("#,0"))); }
public static void WriteTitleHue(GenericWriter writer, TitleHue title) { if (title != null) { writer.Write(true); title.UID.Serialize(writer); } else { writer.Write(false); } }
private void CompileHueEntryLayout( SuperGumpLayout layout, int index, int pIndex, int xOffset, int yOffset, TitleHue hue) { layout.AddReplace( "button/list/select/" + index, () => AddButton(xOffset, yOffset + 2, 2224, 2224, btn => SelectEntry(btn, hue))); layout.AddReplace( "label/list/entry/" + index, () => AddLabel(xOffset + 20, yOffset - 3, hue.Hue - 1, "##### " + GetLabelText(index, pIndex, hue))); if (User.AccessLevel >= AccessLevel.Administrator) { layout.Add( "button/list/purge/" + index, () => AddButton(xOffset + 125, yOffset, 22150, 22151, btn => PurgeHue(hue))); } }
public override void OnSingleClick(Mobile m) { if (TitleHue == null) { base.OnSingleClick(m); return; } LabelToExpansion(m); LabelTo(m, this.ResolveName(m), TitleHue.GetRarityHue()); LabelTo(m, TitleHue.Hue, 1049644, "Hue: " + TitleHue.Hue); if (BoundToMobile != null) { LabelTo(m, "Bound to: " + BoundToMobile.Name, TitleHue.GetRarityHue()); } }
public static bool GetTitleHue(PlayerMobile target, out TitleHue h) { h = null; if (target == null || target.Deleted) { return false; } TitleProfile p; if (!Profiles.TryGetValue(target, out p) || p == null || p.Owner != target) { return false; } h = p.SelectedHue; return true; }
public static bool GetTitleHue(PlayerMobile target, out TitleHue h) { h = null; if (target == null || target.Deleted) { return(false); } TitleProfile p; if (!Profiles.TryGetValue(target, out p) || p == null || p.Owner != target) { return(false); } h = p.SelectedHue; return(true); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { Owner = reader.ReadMobile <PlayerMobile>(); Titles = reader.ReadBlockList(CustomTitles.ReadTitle); Hues = reader.ReadBlockList(CustomTitles.ReadTitleHue); SelectedTitle = CustomTitles.ReadTitle(reader); SelectedHue = CustomTitles.ReadTitleHue(reader); } break; } }
public void PurgeHue(TitleHue hue) { if (hue == null) { Refresh(); return; } string result; bool success = CustomTitles.PurgeHue(hue, out result); Refresh(success); new NoticeDialogGump(User) { Title = "Purge Hue Result", Html = result, HtmlColor = success ? Color.LawnGreen : Color.OrangeRed }.Send(); }
public static TitleHue CreateHue(int value, TitleRarity rarity, out string result) { if (HueRegistry.Values.Any(x => x.Hue == value)) { result = "The hue '" + value + "' already exists in the registry."; return(null); } var hue = new TitleHue(value, rarity); HueRegistry.Add(hue.UID, hue); foreach (TitleProfile p in Profiles.Values.AsParallel() .Where(p => p != null && p.Owner != null && p.Owner.AccessLevel >= AccessLevel.GameMaster)) { p.Add(hue); } result = "The Hue: '" + hue + "' was successfully added to the registry."; return(hue); }
public static bool PurgeHue(TitleHue hue, out string result) { if (hue == null) { result = "Hue can not be null."; return(false); } foreach (TitleProfile p in Profiles.Values) { p.Remove(hue); } if (!HueRegistry.Remove(hue.UID)) { result = "The hue '" + hue + "' did not exist in the registry."; return(false); } result = "The hue '" + hue + "' has been successfully deleted."; return(true); }
private static bool DeserializeHueRegistry(GenericReader reader) { int version = reader.GetVersion(); switch (version) { case 0: { reader.ReadBlockDictionary( () => { var h = new TitleHue(reader); TitleObjectSerial s = h.UID; return(new KeyValuePair <TitleObjectSerial, TitleHue>(s, h)); }, HueRegistry); } break; } return(true); }
public bool Remove(TitleHue hue) { return hue != null && Hues.Remove(hue); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { Owner = reader.ReadMobile<PlayerMobile>(); Titles = reader.ReadBlockList(CustomTitles.ReadTitle); Hues = reader.ReadBlockList(CustomTitles.ReadTitleHue); SelectedTitle = CustomTitles.ReadTitle(reader); SelectedHue = CustomTitles.ReadTitleHue(reader); } break; } }
public bool Contains(TitleHue hue) { return hue != null && Hues.Contains(hue); }
public bool Remove(TitleHue hue) { return(hue != null && Hues.Remove(hue)); }
public static bool PurgeHue(TitleHue hue, out string result) { if (hue == null) { result = "Hue can not be null."; return false; } foreach (TitleProfile p in Profiles.Values) { p.Remove(hue); } if (!HueRegistry.Remove(hue.UID)) { result = "The hue '" + hue + "' did not exist in the registry."; return false; } result = "The hue '" + hue + "' has been successfully deleted."; return true; }
public static int GetOwnerCount(this TitleHue hue) { return(hue != null?Profiles.Values.Count(p => p.Contains(hue)) : 0); }
public static bool TryGetHue(int hue, out TitleHue value) { return((value = HueRegistry.Values.FirstOrDefault(h => h.Match(hue))) != null); }
public bool Contains(TitleHue hue) { return(hue != null && Hues.Contains(hue)); }
public static TitleHue CreateHue(int value, TitleRarity rarity, out string result) { if (HueRegistry.Values.Any(x => x.Hue == value)) { result = "The hue '" + value + "' already exists in the registry."; return null; } var hue = new TitleHue(value, rarity); HueRegistry.Add(hue.UID, hue); foreach (TitleProfile p in Profiles.Values.AsParallel() .Where(p => p != null && p.Owner != null && p.Owner.AccessLevel >= AccessLevel.GameMaster)) { p.Add(hue); } result = "The Hue: '" + hue + "' was successfully added to the registry."; return hue; }
public static bool TryGetHue(int hue, out TitleHue value) { return (value = HueRegistry.Values.FirstOrDefault(h => h.Match(hue))) != null; }
private static void CMInvoke() { CommandUtility.Register( "AddCustomTitle", AccessLevel.Administrator, e => { if (!(e.Mobile is PlayerMobile)) { return; } if (!CMOptions.ModuleEnabled) { e.Mobile.SendMessage(0x22, "The Custom Titles module is currently disabled."); return; } if (e.Arguments.Length < 2) { e.Mobile.SendMessage(0x22, "Format: <maleTitle> <femaleTitle> [rarity]"); return; } string maleValue = e.Arguments[0]; string femaleValue = e.Arguments[1]; var rarity = TitleRarity.Common; if (e.Arguments.Length > 2 && !Enum.TryParse(e.Arguments[2], true, out rarity)) { e.Mobile.SendMessage(0x22, "Format: <maleTitle> <femaleTitle> [rarity]"); return; } var display = TitleDisplay.BeforeName; if (e.Arguments.Length > 3 && !Enum.TryParse(e.Arguments[3], true, out display)) { e.Mobile.SendMessage(0x22, "Format: <maleTitle> <femaleTitle> [rarity] [display]"); return; } string result; Title title = CreateTitle(maleValue, femaleValue, rarity, display, out result); e.Mobile.SendMessage(title == null ? 0x22 : 0x33, result); }); CommandUtility.Register( "AddCustomTitleHue", AccessLevel.Administrator, e => { if (!(e.Mobile is PlayerMobile)) { return; } if (!CMOptions.ModuleEnabled) { e.Mobile.SendMessage(0x22, "The Custom Titles module is currently disabled."); return; } if (e.Arguments.Length == 0) { e.Mobile.SendMessage(0x22, "Format: <hue> [rarity]"); return; } int value; if (!Int32.TryParse(e.Arguments[0], out value)) { e.Mobile.SendMessage(0x22, "Format: <hue> [rarity]"); return; } var rarity = TitleRarity.Common; if (e.Arguments.Length > 1 && !Enum.TryParse(e.Arguments[1], true, out rarity)) { e.Mobile.SendMessage(0x22, "Format: <hue> [rarity]"); return; } string result; TitleHue hue = CreateHue(value, rarity, out result); e.Mobile.SendMessage(hue == null ? 0x22 : 0x33, result); }); CommandUtility.Register( "WipeCustomTitles", AccessLevel.Administrator, e => { if (!(e.Mobile is PlayerMobile)) { return; } if (!CMOptions.ModuleEnabled) { e.Mobile.SendMessage(0x22, "The Custom Titles module is currently disabled."); return; } new ConfirmDialogGump((PlayerMobile)e.Mobile) { Title = "Confirm Action: Wipe", Html = "This action will wipe all titles, title hues and title profiles.\nThis action can not be reversed!\n\nClick OK to confirm.", AcceptHandler = b => { Profiles.Values.ForEach(p => VitaNexCore.TryCatch(p.Clear)); Profiles.Clear(); e.Mobile.SendMessage("All title profiles have been cleared."); HueRegistry.Values.ForEach(h => VitaNexCore.TryCatch(h.Clear)); HueRegistry.Clear(); e.Mobile.SendMessage("All title hues have been cleared."); TitleRegistry.Values.ForEach(t => VitaNexCore.TryCatch(t.Clear)); TitleRegistry.Clear(); e.Mobile.SendMessage("All titles have been cleared."); } }.Send(); }); CommandUtility.Register( "GrantCustomTitles", AccessLevel.Administrator, e => { if (!CMOptions.ModuleEnabled) { e.Mobile.SendMessage(0x22, "The Custom Titles module is currently disabled."); return; } GrantTitlesTarget(e.Mobile as PlayerMobile); }); CommandUtility.Register( "RevokeCustomTitles", AccessLevel.Administrator, e => { if (!CMOptions.ModuleEnabled) { e.Mobile.SendMessage(0x22, "The Custom Titles module is currently disabled."); return; } RevokeTitlesTarget(e.Mobile as PlayerMobile); }); CommandUtility.Register( "pg", AccessLevel.Player, e => { if (e.Mobile is PlayerMobile && e.Mobile.Map != Map.ZombieLand) { var player = e.Mobile as PlayerMobile; if (player.RawName == "Savo-" || player.RawName == "Savo" || player.RawName == "Tsavo" || player.RawName == "a evil savo" || player.RawName == "a pirate savo" || player.RawName == "Tsavo-") { player.Frozen = true; if (!player.Mounted) { player.Animate(239, 7, 1, true, false, 0); } player.PublicOverheadMessage(MessageType.Spell, player.SpeechHue, true, "Kal Ort Por", false); Timer.DelayCall(TimeSpan.FromSeconds(0.75 + (0.25 * 3)), () => { player.Frozen = false; player.Hidden = true; BaseCreature.TeleportPets(player, new Point3D(2977, 2893, -4), Map.Felucca, false); player.MoveToWorld(new Point3D(2977, 2893, -4), Map.Felucca); }); } } }); CommandUtility.Register( "he", AccessLevel.Player, e => { if (e.Mobile is PlayerMobile && e.Mobile.Map != Map.ZombieLand) { var player = e.Mobile as PlayerMobile; if (player.RawName == "Savo-" || player.RawName == "Savo" || player.RawName == "Tsavo" || player.RawName == "a evil savo" || player.RawName == "a pirate savo" || player.RawName == "Tsavo-") { player.Frozen = true; if (!player.Mounted) { player.Animate(239, 7, 1, true, false, 0); } player.PublicOverheadMessage(MessageType.Spell, player.SpeechHue, true, "Kal Ort Por", false); Timer.DelayCall(TimeSpan.FromSeconds(0.75 + (0.25 * 3)), () => { player.Frozen = false; player.Hidden = true; BaseCreature.TeleportPets(player, new Point3D(2318, 3755, 0), Map.Felucca, false); player.MoveToWorld(new Point3D(2318, 3755, 0), Map.Felucca); }); } } }); CommandUtility.Register( "CustomTitles", AccessLevel.Player, e => { if (!CMOptions.ModuleEnabled) { e.Mobile.SendMessage(0x22, "The Custom Titles module is currently disabled."); return; } SendTitlesGump(e.Mobile as PlayerMobile); }); CommandUtility.Register( "ConvertMetaDragons", AccessLevel.Developer, e => { foreach (Mobile mob in World.Mobiles.Values.Where(x => x is EvolutionDragon).ToArray()) { var dragon = mob as EvolutionDragon; if (dragon != null) { var newmeta = new MetaDragon(); newmeta.Location = dragon.Location; newmeta.Map = dragon.Map; newmeta.Loyalty = 100; newmeta.ControlMaster = dragon.ControlMaster; newmeta.Controlled = true; newmeta.ControlTarget = null; newmeta.ControlOrder = OrderType.Come; newmeta.IsBonded = true; newmeta.Hue = dragon.Hue; newmeta.RawStr = dragon.RawStr; newmeta.RawDex = dragon.RawDex; newmeta.RawInt = dragon.RawInt; newmeta.Name = dragon.Name; newmeta.Stage = dragon.Stage; newmeta.MaxStage = 7; newmeta.EvolutionPoints = dragon.EvolutionPoints; newmeta.Metaskills = new Dictionary <MetaSkillType, BaseMetaSkill>(); dragon.Delete(); } } }); CommandUtility.Register( "GetAllItems", AccessLevel.Developer, e => { var itemsdict = new Dictionary <int, int>(); foreach (Item item in World.Items.Values.Where(x => x.Movable || x.IsLockedDown).ToArray()) { if (itemsdict.ContainsKey(item.ItemID)) { itemsdict[item.ItemID]++; } else { itemsdict.Add(item.ItemID, 1); } } foreach (KeyValuePair <int, int> kvp in itemsdict.OrderBy(i => i.Value)) { var sb = new StringBuilder(); sb.Append("ItemID: " + kvp.Key + "---------------Count: " + kvp.Value + "\n"); LoggingCustom.Log("ItemsLog/" + IOUtility.GetSafeFileName("Itemslog") + ".log", sb.ToString()); } }); CommandUtility.RegisterAlias("CustomTitles", "Titles"); CommandUtility.Register("FlameSpiral", AccessLevel.GameMaster, e => BeginTarget(e.Mobile)); CommandUtility.Register("FlashEffect", AccessLevel.GameMaster, e => DoFlash(e.Mobile)); CommandUtility.Register("UpgradeAccounts", AccessLevel.Developer, e => UpgradeAccounts()); CommandUtility.Register("LockedDownFix", AccessLevel.Developer, e => LockedDownFix()); }
private static bool DeserializeHueRegistry(GenericReader reader) { int version = reader.GetVersion(); switch (version) { case 0: { reader.ReadBlockDictionary( () => { var h = new TitleHue(reader); TitleObjectSerial s = h.UID; return new KeyValuePair<TitleObjectSerial, TitleHue>(s, h); }, HueRegistry); } break; } return true; }
private void CompileHueLayout(SuperGumpLayout layout, TitleHue hue) { layout.Add("label/body/hue/grantmessage", () => AddLabel(65, 110, 1457, "This scroll grants the title hue: ")); layout.Add("label/body/hue/granthue", () => AddLabel(110, 145, hue.Hue-1, "##########")); layout.Add("image/body/hue/Hbar", () => AddImageTiled(100, 160, 120, 2, 2620)); layout.Add("label/body/hue/raritymessage", () => AddLabel(25, 185, 1457, "Hue Rarity: ")); layout.Add("label/body/hue/rarity", () => AddLabel(105, 185, hue.GetRarityHue(), hue.Rarity.ToString())); layout.Add("label/body/hue/owned", () => AddLabel(25, 205, 1457, "People who have this hue: ")); layout.Add("label/body/hue/ownednumber", () => AddLabel(193, 205, 1461, hue.GetOwnerCount().ToString("#,0"))); }
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())); }