コード例 #1
0
        public IconPlacementGump(CSpellbook book, Mobile from, int x, int y, int i, int icon, Type spellType, int background, School school) : base(0, 0)
        {
            m_Book = book;
            m_From = from;

            m_X          = x;
            m_Y          = y;
            m_I          = i;
            m_Icon       = icon;
            m_Spell      = spellType;
            m_Background = background;
            m_School     = school;

            string xtext = m_X.ToString();
            string ytext = m_Y.ToString();
            string itext = m_I.ToString();

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

            AddPage(0);

            AddImage(260, 160, 5011);
            AddLabel(353, 230, 1153, "Icon Placement");

            CSpellInfo si = SpellInfoRegistry.GetInfo(m_School, m_Spell);

            if (si == null)
            {
                return;
            }

            AddLabel(338, 350, 1153, si.Name);

            AddButton(412, 288, 2444, 2443, 1, GumpButtonType.Reply, 0);
            AddButton(325, 288, 2444, 2443, 2, GumpButtonType.Reply, 0);
            AddLabel(425, 290, 1153, "Apply");
            AddLabel(339, 290, 1153, "Move");

            AddButton(377, 178, 4500, 4500, 3, GumpButtonType.Reply, 0);               //Up
            AddButton(474, 276, 4502, 4502, 4, GumpButtonType.Reply, 0);               //Right
            AddButton(377, 375, 4504, 4504, 5, GumpButtonType.Reply, 0);               //Down
            AddButton(278, 276, 4506, 4506, 6, GumpButtonType.Reply, 0);               //Left

            AddBackground(348, 260, 105, 20, 9300);
            AddBackground(348, 318, 105, 20, 9300);
            AddBackground(388, 290, 25, 20, 9300);

            AddTextEntry(348, 260, 105, 20, 1153, 7, "" + xtext);
            AddTextEntry(348, 318, 105, 20, 1153, 8, "" + ytext);
            AddTextEntry(388, 290, 25, 20, 1153, 9, "" + itext);

            AddBackground(x, y, 54, 56, background);
            AddImage(x + 45, y, 9008);
            AddImage(x + 5, y + 5, icon);
        }
コード例 #2
0
        private static void CSSCast_OnCommand(CommandEventArgs e)
        {
            if (e.Length == 1)
            {
                if (!CentralMemory.Running || !CSS.Running)
                {
                    e.Mobile.SendMessage("The Central Memory is not running.  This command is disabled.");
                    return;
                }

                if (!Multis.DesignContext.Check(e.Mobile))
                {
                    e.Mobile.SendMessage("You cannot cast while customizing!");
                    return;
                }

                CastCommandsModule module = (CastCommandsModule)CentralMemory.GetModule(e.Mobile.Serial, typeof(CastCommandsModule));
                if (module == null)
                {
                    e.Mobile.SendMessage("You do not have any commands to cast stored.");
                    return;
                }

                CastInfo info = module.Get(e.GetString(0));
                if (info == null)
                {
                    e.Mobile.SendMessage("You have not assigned that command to any spells.");
                    return;
                }

                if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(e.Mobile, info.SpellType))
                {
                    e.Mobile.SendMessage("You are not allowed to cast this spell.");
                    return;
                }

                if (!CSpellbook.MobileHasSpell(e.Mobile, info.School, info.SpellType))
                {
                    e.Mobile.SendMessage("You do not have this spell.");
                    return;
                }

                Spell spell = SpellInfoRegistry.NewSpell(info.SpellType, info.School, e.Mobile, null);
                if (spell != null)
                {
                    spell.Cast();
                }
                else
                {
                    e.Mobile.SendMessage("This spell has been disabled.");
                }
            }
            else
            {
                e.Mobile.SendMessage("Format: Cast <text>");
            }
        }
コード例 #3
0
        public IconPlacementGump( CSpellbook book, Mobile from, int x, int y, int i, int icon, Type spellType, int background, School school )
            : base(0, 0)
        {
            m_Book = book;
            m_From = from;

            m_X = x;
            m_Y = y;
            m_I = i;
            m_Icon = icon;
            m_Spell = spellType;
            m_Background = background;
            m_School = school;

            string xtext = m_X.ToString();
            string ytext = m_Y.ToString();
            string itext = m_I.ToString();

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

            AddPage(0);

            AddImage( 260, 160, 5011 );
            AddLabel( 353, 230, 1153, "Icon Placement" );

            CSpellInfo si = SpellInfoRegistry.GetInfo( m_School, m_Spell );
            if( si == null )
                return;

            AddLabel( 338, 350, 1153, si.Name );

            AddButton( 412, 288, 2444, 2443, 1, GumpButtonType.Reply, 0 );
            AddButton( 325, 288, 2444, 2443, 2, GumpButtonType.Reply, 0 );
            AddLabel( 425, 290, 1153, "Apply" );
            AddLabel( 339, 290, 1153, "Move" );

            AddButton( 377, 178, 4500, 4500, 3, GumpButtonType.Reply, 0 ); //Up
            AddButton( 474, 276, 4502, 4502, 4, GumpButtonType.Reply, 0 ); //Right
            AddButton( 377, 375, 4504, 4504, 5, GumpButtonType.Reply, 0 ); //Down
            AddButton( 278, 276, 4506, 4506, 6, GumpButtonType.Reply, 0 ); //Left

            AddBackground( 348, 260, 105, 20, 9300 );
            AddBackground( 348, 318, 105, 20, 9300 );
            AddBackground( 388, 290, 25, 20, 9300 );

            AddTextEntry( 348, 260, 105, 20, 1153, 7, "" + xtext );
            AddTextEntry( 348, 318, 105, 20, 1153, 8, "" + ytext );
            AddTextEntry( 388, 290, 25, 20, 1153, 9, "" + itext );

            AddBackground( x, y, 54, 56, background );
            AddImage( x+45, y, 9008 );
            AddImage( x+5, y+5, icon );
        }
コード例 #4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (!CSS.Running || !CentralMemory.Running)
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 1:
            {
                IconsModule mod = new IconsModule(state.Mobile.Serial, m_Info);
                CentralMemory.AppendModule(state.Mobile.Serial, (Module)mod, true);
                state.Mobile.SendMessage("That icon has been removed and will not open again.");
                break;
            }

            case 2:
            {
                if (!Multis.DesignContext.Check(state.Mobile))
                {
                    state.Mobile.SendMessage("You cannot cast while customizing!");
                    state.Mobile.SendGump(new SpellIconGump(m_Info));
                    return;
                }
                if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.SpellType))
                {
                    state.Mobile.SendMessage("You are not allowed to cast this spell.");
                    return;
                }

                if (!CSpellbook.MobileHasSpell(state.Mobile, m_Info.School, m_Info.SpellType))
                {
                    state.Mobile.SendMessage("You do not have this spell.");
                    goto case 1;
                }

                Spell spell = SpellInfoRegistry.NewSpell(m_Info.SpellType, m_Info.School, state.Mobile, null);
                if (spell != null)
                {
                    spell.Cast();
                }
                else
                {
                    state.Mobile.SendMessage("This spell has been disabled.");
                    goto case 1;
                }

                state.Mobile.SendGump(new SpellIconGump(m_Info));
                break;
            }
            }
        }
コード例 #5
0
        public static bool MobileHasSpell(Mobile m, School school, Type type)
        {
            if (m == null || m.Deleted || m.Backpack == null || school == School.Invalid || type == null)
            {
                return(false);
            }

            foreach (Item i in m.Backpack.Items)
            {
                if (i is CSpellbook)
                {
                    CSpellbook book = (CSpellbook)i;
                    if (book.School == school && book.HasSpell(type))
                    {
                        return(true);
                    }
                }
            }

            Item layer = m.FindItemOnLayer(Layer.OneHanded);

            if (layer is CSpellbook)
            {
                CSpellbook book = (CSpellbook)layer;
                if (book.School == school && book.HasSpell(type))
                {
                    return(true);
                }
            }

            layer = m.FindItemOnLayer(Layer.FirstValid);
            if (layer is CSpellbook)
            {
                CSpellbook book = (CSpellbook)layer;
                if (book.School == school && book.HasSpell(type))
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #6
0
        private static void FillBook_OnTarget(Mobile from, object obj)
        {
            if (obj is CSpellbook)
            {
                CSpellbook book = (CSpellbook)obj;

                if (book == null || book.Deleted)
                {
                    return;
                }

                book.Fill();
                book.Full = true;

                from.SendMessage("The spellbook has been filled.");

                CommandLogging.WriteLine(from, "{0} {1} filling spellbook {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(book));
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(FillBook_OnTarget));
                from.SendMessage("That is not a spellbook. Try again.");
            }
        }
コード例 #7
0
        public CSpellbookGump(CSpellbook book)
            : base(50, 100)
        {
            if (!CSS.Running)
            {
                return;
            }

            m_Book   = book;
            m_Spells = book.SchoolSpells;

            Pages = (int)Math.Ceiling((m_Spells.Count / 16.0));

            /*			if( Pages > 1 && book.Mark > 0 )
             *          {
             *              ArrayList temp = new ArrayList();
             *              for( int i = 0; i < book.Mark*16 && i < m_Spells.Count; i++ )
             *                  temp.Add( m_Spells[i] );
             *              m_Spells.RemoveRange( 0, (book.Mark*16)-1 );
             *              m_Spells.AddRange( temp );
             *          }
             */

            AddPage(0);
            AddImage(100, 100, BGImage);

            CurrentPage = 1;

            for (int i = 0; i < Pages; i++, CurrentPage++)
            {
                AddPage(CurrentPage);

                //Hidden Buttons
                for (int j = (CurrentPage - 1) * 16, C = 0; j < CurrentPage * 16 && j < m_Spells.Count; j++, C++)
                {
                    if (HasSpell((Type)m_Spells[j]))
                    {
                        AddButton((C > 7 ? 305 : 145), 142 + (C > 7 ? (C - 8) * 20 : C * 20), 2482, 2482, j + 1000, GumpButtonType.Reply, 0);
                    }
                }
                AddImage(100, 100, BGImage);
                AddHtml(165, 107, 100, 20, String.Format("<basefont color=#{0}><Center>{1}</Center>", TextHue, Label1), false, false);
                AddHtml(285, 107, 100, 20, String.Format("<basefont color=#{0}><Center>{1}</Center>", TextHue, Label2), false, false);
                //End Hidden Buttons

                //Prev/Next Buttons
                if (Pages > 1)
                {
                    AddButton(122, 109, 2205, 2205, 0, GumpButtonType.Page, Pages - CurrentPage - 1);
                    if (CurrentPage < Pages)
                    {
                        AddButton(394, 104, 2206, 2206, 0, GumpButtonType.Page, CurrentPage + 1);
                    }
                }
                //End Prev/Next Buttons

                //Spell Buttons/Labels
                for (int j = (CurrentPage - 1) * 16, C = 0; j < CurrentPage * 16 && j < m_Spells.Count; j++, C++)
                {
                    if (HasSpell((Type)m_Spells[j]))
                    {
                        CSpellInfo info = SpellInfoRegistry.GetInfo(m_Book.School, (Type)m_Spells[j]);
                        if (info == null)
                        {
                            continue;
                        }

                        AddHtml((C > 7 ? 305 : 145), 140 + (C > 7 ? (C - 8) * 20 : C * 20), 120, 20, String.Format("<basefont color=#{0}>{1}</basefont>", TextHue, info.Name), false, false);
                        AddButton((C > 7 ? 285 : 125), 143 + (C > 7 ? (C - 8) * 20 : C * 20), SpellBtn, SpellBtnP, j + 2000, GumpButtonType.Reply, 0);
                        AddButton((C > 7 ? 410 : 250), 142 + (C > 7 ? (C - 8) * 20 : C * 20), 5411, 5411, j + 1000, GumpButtonType.Reply, 0);
                    }
                }
                //End Spell Buttons/Labels
            }
        }
コード例 #8
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0 || !CSS.Running)
            {
                return;
            }

            else if (info.ButtonID >= 1000 && info.ButtonID < (1000 + m_Spells.Count))
            {
                if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Book.School))
                {
                    state.Mobile.SendMessage("You are not allowed to cast this spell.");
                    return;
                }

                CSpellInfo si = SpellInfoRegistry.GetInfo(m_Book.School, (Type)m_Spells[info.ButtonID - 1000]);
                if (si == null)
                {
                    state.Mobile.SendMessage("That spell is disabled.");
                    return;
                }
                state.Mobile.CloseGump(typeof(ScrollGump));
                state.Mobile.SendGump(new ScrollGump(m_Book, si, TextHue, state.Mobile));
                //				m_Book.Mark = (info.ButtonID-1000)/16;
                //				state.Mobile.SendMessage( "{0}", m_Book.Mark );
            }

            else if (info.ButtonID >= 2000 && info.ButtonID < (2000 + m_Spells.Count))
            {
                if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Book.School))
                {
                    state.Mobile.SendMessage("You are not allowed to cast this spell.");
                    return;
                }

                if (!CSpellbook.MobileHasSpell(state.Mobile, m_Book.School, (Type)m_Spells[info.ButtonID - 2000]))
                {
                    state.Mobile.SendMessage("You do not have this spell.");
                    return;
                }

                Spell spell = SpellInfoRegistry.NewSpell((Type)m_Spells[info.ButtonID - 2000], m_Book.School, state.Mobile, null);
                if (spell == null)
                {
                    state.Mobile.SendMessage("That spell is disabled.");
                }
                else
                {
                    spell.Cast();
                }
                //				m_Book.Mark = (info.ButtonID-2000)/16;
                //				state.Mobile.SendMessage( "{0}", m_Book.Mark );
            }

            object[] Params = new object[1] {
                m_Book
            };
            CSpellbookGump gump = Activator.CreateInstance(GumpType, Params) as CSpellbookGump;

            if (gump != null)
            {
                state.Mobile.SendGump(gump);
            }

            //GumpUpTimer
        }
コード例 #9
0
        private static void Refresh()
        {
            if (m_Loaded == null || m_Loaded.Count == 0)
            {
                return;
            }

            Console.WriteLine("\n    - Checking Spell Registry:");

            ArrayList books;
            ArrayList oldsr;
            ArrayList newsr;
            bool      changed;

            foreach (DictionaryEntry de in m_Loaded)
            {
                changed = false;

                oldsr = (ArrayList)de.Value;

                newsr = SpellInfoRegistry.GetSpellsForSchool((School)de.Key);
                if (newsr == null)
                {
                    continue;
                }

                if (oldsr.Count != newsr.Count)
                {
                    changed = true;
                }

                for (int i = 0; i < oldsr.Count && !changed; i++)
                {
                    if (((CSpellInfo)oldsr[i]).Type != (Type)newsr[i])
                    {
                        changed = true;
                    }
                }

                for (int i = 0; i < oldsr.Count; i++)
                {
                    if (!((CSpellInfo)oldsr[i]).Enabled)
                    {
                        SpellInfoRegistry.DisEnable((School)de.Key, ((CSpellInfo)oldsr[i]).Type, false);
                    }
                }

                if (!changed)
                {
                    continue;
                }

                Console.WriteLine("      - Changes in {0} detected - refreshing all books.", (School)de.Key);

                books = new ArrayList();
                foreach (Item i in World.Items.Values)
                {
                    if ((i is CSpellbook))
                    {
                        CSpellbook book = i as CSpellbook;
                        if (book == null || book.Deleted || book.School != (School)de.Key)
                        {
                            continue;
                        }
                        books.Add(book);
                    }
                }

                for (int i = 0; i < books.Count; i++)
                {
                    if (((CSpellbook)books[i]).Full)
                    {
                        ((CSpellbook)books[i]).Fill();
                        continue;
                    }

                    ulong oldcontent = ((CSpellbook)books[i]).Content;
                    ((CSpellbook)books[i]).Content = (ulong)0;

                    for (int j = 0; j < oldsr.Count; j++)
                    {
                        if ((oldcontent & ((ulong)1 << j)) != 0)
                        {
                            ((CSpellbook)books[i]).AddSpell(((CSpellInfo)oldsr[j]).Type);
                        }
                    }

                    ((CSpellbook)books[i]).InvalidateProperties();
                }
            }
        }
コード例 #10
0
ファイル: CSpellbookGump.cs プロジェクト: evildude807/kaltar
        public CSpellbookGump(CSpellbook book)
            : base(50, 100)
        {
            if (!CSS.Running)
                return;

            m_Book = book;
            m_Spells = book.SchoolSpells;

            Pages = (int)Math.Ceiling((m_Spells.Count / 16.0));

            /*			if( Pages > 1 && book.Mark > 0 )
                        {
                            ArrayList temp = new ArrayList();
                            for( int i = 0; i < book.Mark*16 && i < m_Spells.Count; i++ )
                                temp.Add( m_Spells[i] );
                            m_Spells.RemoveRange( 0, (book.Mark*16)-1 );
                            m_Spells.AddRange( temp );
                        }
            */

            AddPage(0);
            AddImage(100, 100, BGImage);

            CurrentPage = 1;

            for (int i = 0; i < Pages; i++, CurrentPage++)
            {
                AddPage(CurrentPage);

                //Hidden Buttons
                for (int j = (CurrentPage - 1) * 16, C = 0; j < CurrentPage * 16 && j < m_Spells.Count; j++, C++)
                {
                    if (HasSpell((Type)m_Spells[j]))
                    {
                        AddButton((C > 7 ? 305 : 145), 142 + (C > 7 ? (C - 8) * 20 : C * 20), 2482, 2482, j + 1000, GumpButtonType.Reply, 0);
                    }
                }
                AddImage(100, 100, BGImage);
                AddHtml(165, 107, 100, 20, String.Format("<basefont color=#{0}><Center>{1}</Center>", TextHue, Label1), false, false);
                AddHtml(285, 107, 100, 20, String.Format("<basefont color=#{0}><Center>{1}</Center>", TextHue, Label2), false, false);
                //End Hidden Buttons

                //Prev/Next Buttons
                if (Pages > 1)
                {
                    AddButton(122, 109, 2205, 2205, 0, GumpButtonType.Page, Pages - CurrentPage - 1);
                    if (CurrentPage < Pages)
                        AddButton(394, 104, 2206, 2206, 0, GumpButtonType.Page, CurrentPage + 1);
                }
                //End Prev/Next Buttons

                //Spell Buttons/Labels
                for (int j = (CurrentPage - 1) * 16, C = 0; j < CurrentPage * 16 && j < m_Spells.Count; j++, C++)
                {
                    if (HasSpell((Type)m_Spells[j]))
                    {
                        CSpellInfo info = SpellInfoRegistry.GetInfo(m_Book.School, (Type)m_Spells[j]);
                        if (info == null)
                            continue;

                        AddHtml((C > 7 ? 305 : 145), 140 + (C > 7 ? (C - 8) * 20 : C * 20), 120, 20, String.Format("<basefont color=#{0}>{1}</basefont>", TextHue, info.Name), false, false);
                        AddButton((C > 7 ? 285 : 125), 143 + (C > 7 ? (C - 8) * 20 : C * 20), SpellBtn, SpellBtnP, j + 2000, GumpButtonType.Reply, 0);
                        AddButton((C > 7 ? 410 : 250), 142 + (C > 7 ? (C - 8) * 20 : C * 20), 5411, 5411, j + 1000, GumpButtonType.Reply, 0);
                    }
                }
                //End Spell Buttons/Labels
            }
        }
コード例 #11
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
        }
コード例 #12
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0 || !CSS.Running)
            {
                return;
            }

            else if (info.ButtonID == 1)
            {
                if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.School))
                {
                    state.Mobile.SendMessage("You are not allowed to cast this spell.");
                    return;
                }

                if (!CSpellbook.MobileHasSpell(state.Mobile, m_Info.School, m_Info.Type))
                {
                    state.Mobile.SendMessage("You do not have this spell.");
                    return;
                }

                Spell spell = SpellInfoRegistry.NewSpell(m_Info.Type, m_Info.School, state.Mobile, null);
                if (spell == null)
                {
                    state.Mobile.SendMessage("That spell is disabled.");
                }
                else
                {
                    spell.Cast();
                }
            }

            else if (info.ButtonID == 2)
            {
                //Scribe
            }

            else if (info.ButtonID == 3)
            {
                if (!CentralMemory.Running)
                {
                    return;
                }

                if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.School))
                {
                    return;
                }

                state.Mobile.SendGump(new IconPlacementGump(m_Book, state.Mobile, 100, 100, 10, m_Info.Icon, m_Info.Type, m_Info.Back, m_Book.School));
            }

            else if (info.ButtonID == 4)
            {
                if (!CentralMemory.Running)
                {
                    return;
                }

                string command = info.GetTextEntry(5).Text;

                if (command == null || command.Length == 0)
                {
                    if (m_CastCommandModule == null)
                    {
                        state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile));
                        return;
                    }

                    m_CastCommandModule.RemoveCommandByInfo(m_CastInfo);
                    state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile));
                }
                else
                {
                    if (m_CastCommandModule == null)
                    {
                        CentralMemory.AddModule(new CastCommandsModule(state.Mobile.Serial, command, m_CastInfo));
                        state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile));
                        return;
                    }

                    m_CastCommandModule.Add(command, m_CastInfo);
                    state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile));
                }
            }
        }
コード例 #13
0
ファイル: ScrollGump.cs プロジェクト: evildude807/kaltar
        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
        }