Пример #1
1
        public CastCommandsModule(Serial serial, string castCommand, CastInfo info)
            : base(serial)
        {
            m_CastCommands = new Dictionary<string, CastInfo>();

            Add(castCommand, info);
        }
Пример #2
0
        public void Add(string castCommand, CastInfo info)
        {
            if (castCommand == null || castCommand.Length == 0 || info == null)
                return;

            if (m_CastCommands.ContainsKey(castCommand.ToLower()))
                m_CastCommands[castCommand.ToLower()] = info;
            else
                m_CastCommands.Add(castCommand.ToLower(), info);
        }
Пример #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_CastCommands = new Dictionary<string, CastInfo>();

            int count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                string s = reader.ReadString();
                CastInfo ii = new CastInfo(reader);
                if (ii.SpellType != null)
                    m_CastCommands.Add(s, ii);
            }
        }
Пример #4
0
        public void RemoveCommandByInfo(CastInfo castInfo)
        {
            string command = "";
            foreach (KeyValuePair<string, CastInfo> kvp in m_CastCommands)
            {
                if (kvp.Value.SpellType == castInfo.SpellType)
                {
                    command = kvp.Key.ToLower();
                    break;
                }
            }

            if (command.Length > 0)
                Remove(command);
        }
Пример #5
0
        public string GetCommandForInfo(CastInfo castInfo)
        {
            foreach (KeyValuePair<string, CastInfo> kvp in m_CastCommands)
            {
                if (kvp.Value.SpellType == castInfo.SpellType)
                {
                    return kvp.Key.ToLower();
                }
            }

            return "";
        }
Пример #6
0
        public ScrollGump(CSpellbook book, CSpellInfo info, string textHue, Mobile sender)
            : base(485, 175)
        {
            if (info == null || book == null || !CSS.Running)
                return;

            m_Info = info;
            m_Book = book;
            m_TextHue = textHue;
            m_CastInfo = new CastInfo(info.Type, info.School);

            Closable = true;
            Disposable = true;
            Dragable = true;
            Resizable = false;

            AddPage(0);
            AddBackground(0, 0, 200, 265, 9380);

            if (info.Name != null)
                AddHtml(30, 3, 140, 20, String.Format("<basefont color=#{0}><center>{1}</center></font>", textHue, info.Name), false, false);

            AddButton(30, 40, info.Icon, info.Icon, 3, GumpButtonType.Reply, 0);

            AddButton(90, 40, 2331, 2338, 1, GumpButtonType.Reply, 0);  //Cast
            AddLabel(120, 38, 0, "Cast");

            //AddButton( 90, 65, 2338, 2331, 2, GumpButtonType.Reply, 0 );  //Scribe
            //AddLabel( 120, 63, 0, "Scribe" );

            //Info
            string InfoString = "";
            if (info.Desc != null)
                InfoString += String.Format("<basefont color=black>{0}</font><br><br>", info.Desc);

            if (info.Regs != null)
            {
                string[] Regs = info.Regs.Split(';');
                InfoString += String.Format("<basefont color=black>Reagents :</font><br><basefont color=#{0}>", textHue);
                foreach (string r in Regs)
                    InfoString += String.Format("-{0}<br>", r.TrimStart());
                InfoString += "</font><br>";
            }

            if (info.Info != null)
            {
                string[] Info = info.Info.Split(';');
                InfoString += String.Format("<basefont color=#{0}>", textHue);
                foreach (string s in Info)
                    InfoString += String.Format("{0}<br>", s.TrimStart());
                InfoString += "</font><br>";
            }
            AddHtml(30, 95, 140, 130, InfoString, false, true);
            //End Info

            #region CastInfo
            if (CentralMemory.Running)
            {
                m_CastCommandModule = (CastCommandsModule)CentralMemory.GetModule(sender.Serial, typeof(CastCommandsModule));

                AddLabel(25, 242, 0, "Key :");
                if (m_CastCommandModule == null)
                    AddTextEntry(70, 242, 100, 20, 0, 5, "");  //Key
                else
                    AddTextEntry(70, 242, 100, 20, 0, 5, m_CastCommandModule.GetCommandForInfo(m_CastInfo));  //Key
                AddButton(175, 247, 2103, 2104, 4, GumpButtonType.Reply, 0);  //KeyButton
            }
            #endregion //CastInfo
        }