public static void RemoveLanguage(string name) { string path = Path.Combine(LESettings.VisualLocFilePath, name + LEConstants.VisualFileExtension); string logicalPath = Path.Combine(LESettings.LogicalLocFilePath, name + LEConstants.LogicalFileExtension); // Delete the language file File.Delete(path); File.Delete(logicalPath); // Remove the language from the collection AllLangsVisual.Remove(name); AllLangsLogical.Remove(name); // If the deleted language is currently selected, unset it if (CurrentLanguage.Equals(name)) { CurrentLanguage = string.Empty; } if (AllLangsLogical.Count == 0) { MasterKeys.Clear(); } NeedsSave = true; }
public virtual void ActivateEncounter(Mobile from) { KeyStopTimer(); from.SendLocalizedMessage(1072678); // You have awakened the master of this realm. You need to hurry to defeat it in time! BeginSequence(from); for (int k = 0; k < KeyCount; k++) { from.SendLocalizedMessage(1072680); // You have been given the key to the boss. MasterKey key = MasterKey; if (key != null) { key.Altar = this; key.PeerlessMap = Map; if (!from.AddToBackpack(key)) { key.MoveToWorld(from.Location, from.Map); } MasterKeys.Add(key); } } Timer.DelayCall(TimeSpan.FromSeconds(1), () => ClearContainer()); KeyValidation = null; }
private void buttonGenerateAndSaveMasterKeypair_Click(object sender, EventArgs e) { try { IGatewayService gwProxy = GetServiceProxy(); gwProxy.InitializeSystem(this.myId); IPreService proxy = GetPreProxy(); this.masterKeypair = proxy.GenerateKeyPair(); string filename = FileDialogs.AskUserForFileNameToSaveIn(); if (!string.IsNullOrEmpty(filename)) { if (!Path.HasExtension(filename)) { filename = filename + ".xml"; } MasterKeys mk = new MasterKeys(); mk.MasterKeyPublicKey = Convert.ToBase64String(this.masterKeypair.Public); mk.MasterKeyPrivateKey = Convert.ToBase64String(this.masterKeypair.Private); XmlFile.WriteFile(mk, filename); MessageBox.Show("Done"); } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); Logger.LogError("Error generating master keypair", ex); } }
public virtual void OnPeerlessDeath() { SendMessage(1072681); // The master of this realm has been slain! You may only stay here so long. StopSlayTimer(); // delete master keys MasterKeys.ForEach(x => x.Delete()); MasterKeys.Clear(); m_DeadlineTimer = Timer.DelayCall(DelayAfterBossSlain, new TimerCallback(FinishSequence)); }
private void buttonPickMasterKeys_Click(object sender, EventArgs e) { string filename = FileDialogs.AskUserForFileNameToOpen(); if (filename != null) { MasterKeys masterKeys = XmlFile.ReadFile <MasterKeys>(filename); this.masterKeypair = new KeyPair(); this.masterKeypair.Public = Convert.FromBase64String(masterKeys.MasterKeyPublicKey); this.masterKeypair.Private = Convert.FromBase64String(masterKeys.MasterKeyPrivateKey); } }
static void RebuildMasterKeys() { MasterKeys.Clear(); foreach (var string_table in AllLangsLogical.Values) { foreach (var key in string_table.Keys) { if (!MasterKeys.Contains(key)) { MasterKeys.Add(key); } } } }
public static void AddNewLanguage(string name) { LELangDict newLang = new LELangDict(); LELangDict newVisLang = new LELangDict(); MasterKeys.ForEach(masterKey => { newLang.Add(masterKey, string.Empty); newVisLang.Add(Logical2Visual(masterKey), string.Empty); }); AllLangsLogical.Add(name, newLang); AllLangsVisual.Add(name, newVisLang); NeedsSave = true; }
public virtual void FinishSequence() { StopTimers(); if (Owner != null) { Owner = null; } // delete peerless if (Peerless != null) { if (Peerless.Corpse != null && !Peerless.Corpse.Deleted) { Peerless.Corpse.Delete(); } if (!Peerless.Deleted) { Peerless.Delete(); } } // teleport party to exit if not already there Fighters.ForEach(x => Exit(x)); // delete master keys MasterKeys.ForEach(x => x.Delete()); if (MasterKeys != null) { MasterKeys.Clear(); } if (Fighters != null) { Fighters.Clear(); } // delete any remaining helpers CleanupHelpers(); // reset summoner, boss Peerless = null; Deadline = DateTime.MinValue; }
public static void RemoveString(string key) { // Remove from visual table string visKey = Logical2Visual(key); foreach (var string_table in AllLangsVisual.Values) { string_table.Remove(visKey); } // Remove from logical table foreach (var string_table in AllLangsLogical.Values) { string_table.Remove(key); } MasterKeys.Remove(key); NeedsSave = true; }
public static void AddNewString(string key, string value) { // Add to logical tables foreach (var string_table in AllLangsLogical.Values) { string_table.Add(key, value); } // Add to the visual tables string visKey = Logical2Visual(key); string visValue = Logical2Visual(value); foreach (var string_table in AllLangsVisual.Values) { string_table.Add(visKey, visValue); } Dbg.Assert(!MasterKeys.Contains(key)); MasterKeys.Add(key); NeedsSave = true; }
public static void UpdateKey(string oldKey, string newKey) { // Update the logical tables string value; foreach (var string_table in AllLangsLogical.Values) { value = string.Empty; if (string_table.TryGetValue(oldKey, out value)) { string_table.Remove(oldKey); string_table.Add(newKey, value); } } // Update the visual tables string visKey = Logical2Visual(oldKey); string newVisKey = Logical2Visual(newKey); foreach (var string_table in AllLangsVisual.Values) { value = string.Empty; if (string_table.TryGetValue(visKey, out value)) { string_table.Remove(visKey); string_table.Add(newVisKey, value); } } int index = MasterKeys.IndexOf(oldKey); MasterKeys.Remove(oldKey); MasterKeys.Insert(index, newKey); NeedsSave = true; }
public override bool OnDragDrop(Mobile from, Item dropped) { if (IsKey(dropped)) { if (Owner != null) { if (Peerless != null && Peerless.CheckAlive()) { from.SendLocalizedMessage(1075213); // The master of this realm has already been summoned and is engaged in combat. Your opportunity will come after he has squashed the current batch of intruders! } else { from.SendLocalizedMessage(1072683, Owner.Name); // ~1_NAME~ has already activated the Prism, please wait... } return(false); } for (int i = 0; i < Keys.Length; i++) { if (i == 0) { Owner = from; KeyStartTimer(from); from.SendLocalizedMessage(1074575); // You have activated this object! } if (Keys.Length == (i + 1)) { KeyStopTimer(); from.SendLocalizedMessage(1072678); // You have awakened the master of this realm. You need to hurry to defeat it in time! for (int k = 0; k < KeyCount; k++) { from.SendLocalizedMessage(1072680); // You have been given the key to the boss. MasterKey key = MasterKey; if (key != null) { key.Altar = this; key._Map = Map; if (!from.AddToBackpack(key)) { key.MoveToWorld(from.Location, from.Map); } MasterKeys.Add(key); } } dropped.Delete(); ClearContainer(); } } } else { from.SendLocalizedMessage(1072682); // This is not the proper key. return(false); } return(base.OnDragDrop(from, dropped)); }
public override bool OnDragDrop(Mobile from, Item dropped) { if (Owner != null && Owner != from) { if (Peerless != null && Peerless.CheckAlive()) { from.SendLocalizedMessage(1075213); // The master of this realm has already been summoned and is engaged in combat. Your opportunity will come after he has squashed the current batch of intruders! } else { from.SendLocalizedMessage(1072683, Owner.Name); // ~1_NAME~ has already activated the Prism, please wait... } return(false); } if (IsKey(dropped) && MasterKeys.Count() == 0) { if (KeyValidation == null) { KeyValidation = new List <PeerlessKeyArray>(); Keys.ToList().ForEach(x => KeyValidation.Add(new PeerlessKeyArray { Key = x, Active = false })); } if (KeyValidation.Any(x => x.Active == true)) { if (KeyValidation.Any(x => x.Key == dropped.GetType() && x.Active == false)) { KeyValidation.Find(s => s.Key == dropped.GetType()).Active = true; } else { from.SendLocalizedMessage(1072682); // This is not the proper key. return(false); } } else { Owner = from; KeyStartTimer(from); from.SendLocalizedMessage(1074575); // You have activated this object! KeyValidation.Find(s => s.Key == dropped.GetType()).Active = true; } if (KeyValidation.Where(x => x.Active == true).Count() == Keys.Count()) { KeyStopTimer(); from.SendLocalizedMessage(1072678); // You have awakened the master of this realm. You need to hurry to defeat it in time! BeginSequence(from); for (int k = 0; k < KeyCount; k++) { from.SendLocalizedMessage(1072680); // You have been given the key to the boss. MasterKey key = MasterKey; if (key != null) { key.Altar = this; key._Map = Map; if (!from.AddToBackpack(key)) { key.MoveToWorld(from.Location, from.Map); } MasterKeys.Add(key); } } Timer.DelayCall(TimeSpan.FromSeconds(1), () => ClearContainer()); KeyValidation = null; } } else { from.SendLocalizedMessage(1072682); // This is not the proper key. return(false); } return(base.OnDragDrop(from, dropped)); }