public static void LoadHueRegistry() { DataStoreResult result = HueRegistry.Import(); CMOptions.ToConsole("Result: {0}", result.ToString()); switch (result) { case DataStoreResult.Null: case DataStoreResult.Busy: case DataStoreResult.Error: { if (HueRegistry.HasErrors) { CMOptions.ToConsole("Hues database has errors..."); HueRegistry.Errors.ForEach(CMOptions.ToConsole); } } break; case DataStoreResult.OK: CMOptions.ToConsole("Hues count: {0:#,0}", HueRegistry.Count); break; } }
public static TitleHue ReadTitleHue(GenericReader reader) { if (!reader.ReadBool()) { return(null); } var uid = new TitleObjectSerial(reader); TitleHue hue; return(HueRegistry.TryGetValue(uid, out hue) ? hue : null); }
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 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); }
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()); }