Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        // 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();
        }