コード例 #1
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>");
            }
        }
コード例 #2
0
        public void Remove(string castCommand)
        {
            m_CastCommands.Remove(castCommand.ToLower());

            if (m_CastCommands.Count == 0)
            {
                CentralMemory.RemoveModule(this.Owner, (Module)this);
            }
        }
コード例 #3
0
        public void Remove(Type type)
        {
            m_Icons.Remove(type);

            if (m_Icons.Count == 0)
            {
                CentralMemory.RemoveModule(this.Owner, (Module)this);
            }
        }
コード例 #4
0
        public static LevelableModule GetAttached(Serial serial, Type levelable)
        {
            if (!CentralMemory.Contains(serial))
            {
                AttachLevelables(serial);
            }

            return(CentralMemory.GetModule(serial, levelable) as LevelableModule);
        }
コード例 #5
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;
            }
            }
        }
コード例 #6
0
        public override TimeSpan GetNextBulkOrder(Mobile from)
        {
            BODModule bod_mod = (BODModule)CentralMemory.GetModule(from.Serial, typeof(BODModule));

            if (bod_mod != null && from != null)
            {
                return(bod_mod.NextCarpenterBulkOrder);
            }

            //if ( from is PlayerMobile )
            //	return ((PlayerMobile)from).NextCarpenterBulkOrder;

            return(TimeSpan.Zero);
        }
コード例 #7
0
        public static void registrarModuleJogador(Jogador jogador)
        {
            //modulo de talento
            CentralMemory.AddModule(new TalentoModule(jogador.Serial));

            //modulo de classe
            CentralMemory.AddModule(new ClasseModule(jogador.Serial));

            //modulo de morte
            CentralMemory.AddModule(new MorteModule(jogador.Serial));

            //modulo de raca
            CentralMemory.AddModule(new RacaModule(jogador.Serial));
        }
コード例 #8
0
ファイル: ApplyIcons.cs プロジェクト: zerodowned/kaltar
        private static void EventSink_Login(LoginEventArgs args)
        {
            if (!CentralMemory.Running || !CSS.Running)
            {
                return;
            }

            Mobile m = args.Mobile;

            IconsModule im = (IconsModule)CentralMemory.GetModule(m.Serial, typeof(IconsModule));

            if (im == null)
            {
                return;
            }

            IconsModule imRemove = new IconsModule(m.Serial);

            foreach (KeyValuePair <Type, IconInfo> kvp in im.Icons)
            {
                IconInfo ii = kvp.Value;
                if (ii == null)
                {
                    imRemove.Add(ii);
                    continue;
                }

                if (ii.SpellType == null || ii.School == School.Invalid)
                {
                    imRemove.Add(ii);
                    continue;
                }

                if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(m, ii.School))
                {
                    imRemove.Add(ii);
                    continue;
                }

                m.SendGump(new SpellIconGump(ii));
            }

            if (im.Icons.Count > 0)
            {
                CentralMemory.AppendModule(m.Serial, (Module)imRemove, true);
            }
        }
コード例 #9
0
        public override Item CreateBulkOrder(Mobile from, bool fromContextMenu)
        {
            PlayerMobile pm      = from as PlayerMobile;
            BODModule    bod_mod = (BODModule)CentralMemory.GetModule(from.Serial, typeof(BODModule));

            if (bod_mod == null && from == null)
            {
                return(null);
            }

            if (bod_mod != null && bod_mod.NextCarpenterBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
            {
                double theirSkill = pm.Skills[SkillName.Carpentry].Base;

                if (theirSkill >= 70.1)
                {
                    bod_mod.NextCarpenterBulkOrder = TimeSpan.FromHours(3.0);
                }
                else if (theirSkill >= 50.1)
                {
                    bod_mod.NextCarpenterBulkOrder = TimeSpan.FromHours(2.0);
                }
                else
                {
                    bod_mod.NextCarpenterBulkOrder = TimeSpan.FromHours(1.0);
                }

                if (theirSkill >= 70.1 && ((theirSkill - 40.0) / 300.0) > Utility.RandomDouble())
                {
                    return(new LargeCarpenterBOD());
                }

                return(SmallCarpenterBOD.CreateRandomFor(from));
            }
            else
            {
                CentralMemory.AppendModule(from.Serial, new BODModule(from.Serial), true);
                from.SendMessage("Please try again");
            }

            return(null);
        }
コード例 #10
0
        public static void AttachLevelables(Serial s)
        {
            Type on = SerialType(s);

            if (on == null)
            {
                return;
            }

            foreach (KeyValuePair <Type, List <Type> > listed in m_Register)
            {
                if (listed.Key == on || on.IsSubclassOf(listed.Key))
                {
                    for (int i = 0; i < listed.Value.Count; i++)
                    {
                        CentralMemory.AddModule(s, listed.Value[i]);
                    }
                }
            }
        }
コード例 #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)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            //Apply
            case 1:
            {
                if (!CentralMemory.Running)
                {
                    from.SendMessage("There is no Central Memory!  Please page an Admin to assist.");
                    return;
                }

                IconInfo ii = new IconInfo(m_Spell, m_Icon, m_X, m_Y, m_Background, m_School);

                if (!CentralMemory.ContainsModule(from.Serial, typeof(IconsModule)))
                {
                    CentralMemory.AddModule(from.Serial, typeof(IconsModule));
                }

                IconsModule im = new IconsModule(from.Serial);
                im.Add(ii);

                CentralMemory.AppendModule(from.Serial, (Module)im, false);

                from.SendGump(new SpellIconGump(ii));
                break;
            }

            //Move
            case 2:
            {
                TextRelay xrelay  = info.GetTextEntry(7);
                TextRelay yrelay  = info.GetTextEntry(8);
                string    xstring = (xrelay == null ? null : xrelay.Text.Trim());
                string    ystring = (yrelay == null ? null : yrelay.Text.Trim());
                if (xstring == null || xstring.Length == 0 || ystring == null || ystring.Length == 0)
                {
                    from.SendMessage("Please enter a X coordinate in the top box and a Y coordinate in the bottom box");
                }
                else
                {
                    int x = m_X;
                    int y = m_Y;
                    try
                    {
                        x   = Int32.Parse(xstring);
                        y   = Int32.Parse(ystring);
                        m_X = x;
                        m_Y = y;
                    }
                    catch
                    {
                        from.SendMessage("Please enter a X coordinate in the top box and a Y coordinate in the bottom box");
                    }
                }
                if (m_X < 0)
                {
                    m_X = 0;
                    from.SendMessage("You cannot go any farther left");
                }
                if (m_Y < 0)
                {
                    m_Y = 0;
                    from.SendMessage("You cannot go any farther up");
                }

                from.CloseGump(typeof(IconPlacementGump));
                from.SendGump(new IconPlacementGump(m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School));
                break;
            }

            //Up
            case 3:
            {
                MakeI(info);
                from.CloseGump(typeof(IconPlacementGump));
                if ((m_Y - m_I) < 0)
                {
                    m_Y = 0;
                    from.SendMessage("You cannot go any farther up");
                    from.SendGump(new IconPlacementGump(m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School));
                }
                else
                {
                    from.SendGump(new IconPlacementGump(m_Book, from, m_X, (m_Y - m_I), m_I, m_Icon, m_Spell, m_Background, m_School));
                }
                break;
            }

            //Right
            case 4:
            {
                MakeI(info);
                from.CloseGump(typeof(IconPlacementGump));
                from.SendGump(new IconPlacementGump(m_Book, from, (m_X + m_I), m_Y, m_I, m_Icon, m_Spell, m_Background, m_School));
                break;
            }

            //Down
            case 5:
            {
                MakeI(info);
                from.CloseGump(typeof(IconPlacementGump));
                from.SendGump(new IconPlacementGump(m_Book, from, m_X, (m_Y + m_I), m_I, m_Icon, m_Spell, m_Background, m_School));
                break;
            }

            //Left
            case 6:
            {
                MakeI(info);
                from.CloseGump(typeof(IconPlacementGump));
                if ((m_X - m_I) < 0)
                {
                    m_X = 0;
                    from.SendMessage("You cannot go any farther left");
                    from.SendGump(new IconPlacementGump(m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School));
                }
                else
                {
                    from.SendGump(new IconPlacementGump(m_Book, from, (m_X - m_I), m_Y, m_I, m_Icon, m_Spell, m_Background, m_School));
                }
                break;
            }
            }
        }
コード例 #13
0
        /**
         * Recupera o modulo de talento
         */
        private ClasseModule getClasseModule()
        {
            ClasseModule tm = (ClasseModule)CentralMemory.GetModule(jogador.Serial, typeof(ClasseModule));

            return(tm);
        }
コード例 #14
0
ファイル: SistemaTalento.cs プロジェクト: zerodowned/kaltar
        /**
         * Recupera o modulo de HabilidadeRacial
         */
        private TalentoModule getTalentoModule()
        {
            TalentoModule tm = (TalentoModule)CentralMemory.GetModule(jogador.Serial, typeof(TalentoModule));

            return(tm);
        }
コード例 #15
0
        /**
         * Recupera o modulo de HabilidadeRacial
         */
        private RacaModule getRacaModule()
        {
            RacaModule tm = (RacaModule)CentralMemory.GetModule(jogador.Serial, typeof(RacaModule));

            return(tm);
        }
コード例 #16
0
ファイル: SistemaMorte.cs プロジェクト: zerodowned/kaltar
        /**
         * Recupera o modulo de talento
         */
        private MorteModule getMorteModule()
        {
            MorteModule tm = (MorteModule)CentralMemory.GetModule(jogador.Serial, typeof(MorteModule));

            return(tm);
        }
コード例 #17
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));
                }
            }
        }