// The main method used public static bool UseBluePower(Mobile from, Type t) { if (t == null) { return(false); } else if (Array.IndexOf(m_Spells, t) == -1) { return(false); } else if (t.IsSubclassOf(typeof(BlueMove))) { BlueMove bluemove = NewMove(t, from); if (bluemove != null) { BlueMove.SetCurrentMove(from, bluemove); from.SendMessage("You prepare to use a monster's special attack"); return(true); } } else if (t.IsSubclassOf(typeof(BlueSpell))) { BlueSpell bluespell = BlueSpellInfo.NewSpell(t, from); if (bluespell != null) { bluespell.Cast(); return(true); } } return(false); }
public static bool CheckKnown(Mobile m, Type type, bool learn) { if (m == null) { return(false); } if (!IsBlueMage(m)) { return(false); } else if (!m.Alive) { return(false); } int spellID = BlueSpellInfo.GetNumber(type); if (spellID == 100) { return(false); } bool[] boollist = BlueMageSpells[m.Serial]; if (boollist[spellID]) { return(true); } else if (learn) { boollist[spellID] = true; BlueMageSpells[m.Serial] = boollist; m.SendMessage(1365, "You have learned " + BlueSpellInfo.GetName(spellID)); } return(false); }
// Prints out a file containing every blue mage's account, mobile name, and spells known. public static void PrintBlueMageLog() { if (!Directory.Exists("Data/BlueMagic/")) { Directory.CreateDirectory("Data/BlueMagic/"); } string filepath = @"Data/BlueMagic/SpellsKnownLog.txt"; if (File.Exists(filepath)) { File.Delete(filepath); } StreamWriter sw = new StreamWriter(filepath); sw.WriteLine("Blue Magic for UO was created by Peoharen"); sw.WriteLine(" "); sw.WriteLine(" "); foreach (KeyValuePair <Serial, bool[]> kvp in BlueMageSpells) { Mobile mobile = GetMobile(kvp.Key); if (mobile != null) { sw.WriteLine("Account: " + mobile.Account.ToString()); sw.WriteLine("\tCharacter: " + mobile.Name); } else { Serial s = kvp.Key; sw.WriteLine("Unknown Account"); sw.WriteLine("\tUnknown Mobile (Serial ID #" + s.ToString() + "): "); } bool knowsany = false; for (int j = 0; j < kvp.Value.Length; j++) { if (kvp.Value[j]) { if (!knowsany) { sw.WriteLine("\t\tSpells Known"); knowsany = true; } sw.WriteLine("\t\t\t" + BlueSpellInfo.GetName(j)); } } if (!knowsany) { sw.WriteLine("\t\tKnows no spells"); } sw.WriteLine(""); sw.WriteLine(""); } sw.Close(); }