Пример #1
0
 protected override void OnTick()
 {
     if (m.Map != Map.Internal)
     {
         NetState ns = m.NetState;
         if (ns != null)
         {
             Account mAccount = ns.Account as Account;
             if (mAccount != null)
             {
                 CommandLogging.WriteLine(m, "{0} {1} {2} ", m.AccessLevel, CommandLogging.Format(m), "Kicked.");
                 m.Say("I've been kicked for unattended macroing!");
                 ns.Dispose();
             }
         }
     }
 }
Пример #2
0
        private static void AllSpells_OnTarget(Mobile from, object obj)
        {
            if (obj is Spellbook)
            {
                Spellbook book = (Spellbook)obj;

                if (book.BookCount == 64)
                {
                    book.Content = ulong.MaxValue;
                }
                else
                {
                    book.Content = (1ul << book.BookCount) - 1;
                }

                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(AllSpells_OnTarget));
                from.SendMessage("That is not a spellbook. Try again.");
            }
        }
Пример #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_State == null)
            {
                return;
            }

            Mobile focus = m_State.Mobile;
            Mobile from  = state.Mobile;

            if (focus == null)
            {
                from.SendMessage("That character is no longer online.");
                return;
            }
            else if (focus.Deleted)
            {
                from.SendMessage("That character no longer exists.");
                return;
            }
            else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel && (!(focus is PlayerMobile) || !((PlayerMobile)focus).VisibilityList.Contains(from)))
            {
                from.SendMessage("That character is no longer visible.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // Tell
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    focus.SendMessage(0x482, "{0} tells you:", from.Name);
                    focus.SendMessage(0x482, text.Text);

                    CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                }

                from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 4:                     // Props
            {
                Resend(from, info);

                if (!BaseCommand.IsAccessible(from, focus))
                {
                    from.SendMessage("That is not accessible.");
                }
                else
                {
                    from.SendGump(new PropertiesGump(from, focus));
                    CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 5:                     // Go to
            {
                if (focus.Map == null || focus.Map == Map.Internal)
                {
                    from.SendMessage("That character is not in the world.");
                }
                else
                {
                    from.MoveToWorld(focus.Location, focus.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map);
                }

                break;
            }

            case 6:                     // Get
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    from.SendMessage("You cannot bring that person here.");
                }
                else
                {
                    focus.MoveToWorld(from.Location, from.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map);
                }

                break;
            }

            case 7:                     // Move
            {
                from.Target = new MoveTarget(focus);
                Resend(from, info);

                break;
            }

            case 8:                     // Kick
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Say("I've been kicked!");

                    m_State.Dispose();

                    CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 9:                     // Kill
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Kill();
                    CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 10:                     //Res
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.PlaySound(0x214);
                    focus.FixedEffect(0x376A, 10, 16);

                    focus.Resurrect();

                    CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 11:                     // Skills
            {
                Resend(from, info);

                if (from.AccessLevel > focus.AccessLevel)
                {
                    from.SendGump(new SkillsGump(from, (Mobile)focus));
                    CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }
            }
        }
Пример #4
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.");
            }
        }
Пример #5
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile mob  = (Mobile)obj;
            Mobile from = e.Mobile;

            CommandLogging.WriteLine(from, "{0} {1} {2} {3} \"{4}\"", from.AccessLevel, CommandLogging.Format(from),
                                     m_InGump ? "messaging" : "telling", CommandLogging.Format(mob), e.ArgString);

            if (m_InGump)
            {
                mob.SendGump(new MessageSentGump(mob, from.Name, e.ArgString));
            }
            else
            {
                mob.SendMessage(e.ArgString);
            }
        }
Пример #6
0
        protected override void OnTarget(Mobile from, object o)
        {
            IPoint3D p = o as IPoint3D;

            if (p != null)
            {
                if (!BaseCommand.IsAccessible(from, m_Object))
                {
                    from.SendMessage("That is not accessible.");
                    return;
                }

                if (p is Item)
                {
                    p = ((Item)p).GetWorldTop();
                }

                CommandLogging.WriteLine(from, "{0} {1} moving {2} to {3}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m_Object), new Point3D(p));

                if (m_Object is Item)
                {
                    Item item = (Item)m_Object;

                    if (!item.Deleted)
                    {
                        item.MoveToWorld(new Point3D(p), from.Map);
                    }
                }
                else if (m_Object is Mobile)
                {
                    Mobile m = (Mobile)m_Object;

                    if (!m.Deleted)
                    {
                        m.MoveToWorld(new Point3D(p), from.Map);
                    }
                }
            }
        }
Пример #7
0
        public static void HWInfo_OnTarget(Mobile from, object obj)
        {
            if (obj is Mobile mobile && mobile.Player)
            {
                Mobile m = mobile;

                if (m.Account is Account acct)
                {
                    HardwareInfo hwInfo = acct.HardwareInfo;

                    if (hwInfo != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} viewing hardware info of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m));
                    }

                    if (hwInfo != null)
                    {
                        from.SendGump(new Gumps.PropertiesGump(from, hwInfo));
                    }
                    else
                    {
                        from.SendMessage("No hardware information for that account was found.");
                    }
                }
                else
                {
                    from.SendMessage("No account has been attached to that player.");
                }
            }
Пример #8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                PlayerMobile pm = targeted as PlayerMobile;

                if (pm == null)
                {
                    from.SendMessage("Speech logs aren't supported on that target.");
                }
                else if (from != targeted && from.AccessLevel <= pm.AccessLevel && from.AccessLevel != AccessLevel.Owner)
                {
                    from.SendMessage("You don't have the required access level to view {0} speech log.", pm.Female ? "her" : "his");
                }
                else if (pm.SpeechLog == null)
                {
                    from.SendMessage("{0} has no speech log.", pm.Female ? "She" : "He");
                }
                else
                {
                    CommandLogging.WriteLine(from, "{0} {1} viewing speech log of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted));

                    Gump gump = new SpeechLogGump(pm, pm.SpeechLog);
                    from.SendGump(gump);
                }
            }
Пример #9
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1)               // Add Email
            {
                Mobile  from     = state.Mobile;
                Account acct     = (Account)from.Account;
                string  cpass    = (string)info.GetTextEntry(1).Text;
                string  newpass  = (string)info.GetTextEntry(2).Text;
                string  newpass2 = (string)info.GetTextEntry(3).Text;

                if (acct.CheckPassword(cpass))
                {
                    if (newpass == null || newpass2 == null)
                    {
                        from.SendMessage(38, "You must type in a new password and confirm it.");
                    }
                    else if (newpass.Length <= m_PassLength)
                    {
                        from.SendMessage(38, "Your new password must be at least characters {0} long.", m_PassLength);
                    }
                    else if (newpass == newpass2)
                    {
                        from.SendMessage("Your password has been changed to {0}.", newpass);
                        acct.SetPassword(newpass);
                        CommandLogging.WriteLine(from, "{0} {1} has changed thier password for account {2} using the [accountlogin command", from.AccessLevel, CommandLogging.Format(from), acct.Username);
                    }
                    else
                    {
                        from.SendMessage(38, "Your new password did not match your confirm password. Please check your spelling and try again.");
                        from.SendMessage(38, "Just a reminder. Passwords are case sensitive.");
                    }
                }
                else
                {
                    from.SendMessage(38, "The current password you typed in did not match your current password on record. Please check your spelling and try again.");
                    from.SendMessage(38, "Just a reminder. Passwords are case sensitive.");
                }
            }
        }
Пример #10
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Item.Deleted)
            {
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
                return;
            }
            else if (!BaseCommand.IsAccessible(m_From, m_Item))
            {
                m_From.SendMessage("That is no longer accessible.");
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
                return;
            }

            switch (info.ButtonID)
            {
            case 0:
            case 1:
            {
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
                break;
            }

            case 2:     // Properties
            {
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                m_From.SendGump(new PropertiesGump(m_From, m_Item));
                break;
            }

            case 3:     // Delete
            {
                CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel, CommandLogging.Format(m_From), CommandLogging.Format(m_Item));
                m_Item.Delete();
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
                break;
            }

            case 4:     // Go there
            {
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                InvokeCommand(string.Format("Go {0}", m_Item.Serial.Value));
                break;
            }

            case 5:     // Move to target
            {
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                m_From.Target = new MoveTarget(m_Item);
                break;
            }

            case 6:     // Bring to pack
            {
                Mobile owner = m_Item.RootParent as Mobile;

                if (owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible(m_From, owner) /* !m_From.CanSee( owner )*/)
                {
                    m_From.SendMessage("You can not get what you can not see.");
                }
                else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= m_From.AccessLevel)
                {
                    m_From.SendMessage("You can not get what you can not see.");
                }
                else
                {
                    m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                    m_From.AddToBackpack(m_Item);
                }

                break;
            }
            }
        }
Пример #11
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Mobile.Deleted)
            {
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
                return;
            }
            else if (!BaseCommand.IsAccessible(m_From, m_Mobile))
            {
                m_From.SendMessage("That is no longer accessible.");
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
                return;
            }

            switch (info.ButtonID)
            {
            case 0:
            case 1:
            {
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
                break;
            }

            case 2:     // Properties
            {
                m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
                m_From.SendGump(new PropertiesGump(m_From, m_Mobile));
                break;
            }

            case 3:     // Delete
            {
                if (!m_Mobile.Player)
                {
                    CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel, CommandLogging.Format(m_From), CommandLogging.Format(m_Mobile));
                    m_Mobile.Delete();
                    m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
                }

                break;
            }

            case 4:     // Go there
            {
                m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
                InvokeCommand(string.Format("Go {0}", m_Mobile.Serial.Value));
                break;
            }

            case 5:     // Bring them here
            {
                if (m_From.Map == null || m_From.Map == Map.Internal)
                {
                    m_From.SendMessage("You cannot bring that person here.");
                }
                else
                {
                    m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
                    m_Mobile.MoveToWorld(m_From.Location, m_From.Map);
                }

                break;
            }

            case 6:     // Move to target
            {
                m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
                m_From.Target = new MoveTarget(m_Mobile);
                break;
            }

            case 7:     // Kill
            {
                if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel)
                {
                    m_Mobile.Kill();
                }

                m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));

                break;
            }

            case 8:     // Res
            {
                if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel)
                {
                    m_Mobile.PlaySound(0x214);
                    m_Mobile.FixedEffect(0x376A, 10, 16);

                    m_Mobile.Resurrect();
                }

                m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));

                break;
            }

            case 9:     // Client
            {
                m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));

                if (m_Mobile.NetState != null)
                {
                    m_From.SendGump(new ClientGump(m_From, m_Mobile.NetState));
                }

                break;
            }
            }
        }
Пример #12
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_State == null)
            {
                return;
            }

            Mobile focus = m_State.Mobile;
            Mobile from  = state.Mobile;

            if (focus == null)
            {
                from.SendMessage("Le personnage n'est plus connecte.");
                return;
            }
            else if (focus.Deleted)
            {
                from.SendMessage("Le personnage n'existe plus.");
                return;
            }
            else if (focus.AccessLevel > from.AccessLevel && from.AccessLevel == AccessLevel.Player)
            {
                from.SendMessage("Vous ne pouvez envoyer un message à un maitre du jeu. Veuillez utiliser le systèmes de pages.");
                return;
            }
            else if (from != focus && (focus.Hidden && focus.HideAdmin && from.AccessLevel < focus.AccessLevel))
            {
                from.SendMessage("Le personnage n'est plus visible.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:     // Tell
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    focus.SendMessage(0x482, "{0} {1} vous a envoye un message HRP: ", from.GetNameUsedBy(focus));
                    focus.SendMessage(0x482, text.Text);

                    CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                }

                from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 2:     // Tell + Reply Gump
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    string name = from.GetNameUsedBy(focus);
                    if (focus is PlayerMobile)
                    {
                        PlayerMobile pm = focus as PlayerMobile;
                        int          q  = (int)pm.QuiOptions;
                        bool         cantBeDelivered = (q & 0x100) != 0 || (name == "Anonyme" && (q & 0x001) != 0) || (name == "Identite Cachee" && (q & 0x010) != 0);
                        Console.WriteLine("q = {0:X}, canBeDelivered = {1}, q & 0x100 = {2}, name == \"Anonyme\" = {3}", q, cantBeDelivered, q & 0x100, name == "Anonyme");
                        if (from.AccessLevel > AccessLevel.Player || !cantBeDelivered)
                        {
                            focus.SendGump(new ClientGump(focus, state, from.GetNameUsedBy(focus), "", text.Text));
                            CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                        }
                        else
                        {
                            from.SendMessage("{0} refuse de recevoir votre message", focus.GetNameUsedBy(from));
                        }
                    }
                }

                //from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 4:     // Props
            {
                Resend(from, info);

                if (!BaseCommand.IsAccessible(from, focus))
                {
                    from.SendMessage("Cela ne vous est pas accessible.");
                }
                else
                {
                    from.SendGump(new PropertiesGump(from, focus));
                    CommandLogging.WriteLine(from, "{0} {1} ouverture des propriétés de {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 5:     // Go to
            {
                if (focus.Map == null || focus.Map == Map.Internal)
                {
                    from.SendMessage("Ce personnage n'est pas dans ce monde.");
                }
                else
                {
                    from.MoveToWorld(focus.Location, focus.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} se dirige sur {2}, Localisation {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map);
                }

                break;
            }

            case 6:     // Get
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    from.SendMessage("Vous ne pouvez pas amener ce personnage en ce lieu.");
                }
                else
                {
                    focus.MoveToWorld(from.Location, from.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} amène {2} à la Localisation {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map);
                }

                break;
            }

            case 7:     // Move
            {
                from.Target = new MoveTarget(focus);
                Resend(from, info);

                break;
            }

            case 8:     // Kick
            {
                if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Say("I've been kicked!");

                    m_State.Dispose();

                    CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 9:     // Kill
            {
                if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Kill();
                    CommandLogging.WriteLine(from, "{0} {1} tue {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 10:     //Res
            {
                if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel)
                {
                    focus.PlaySound(0x214);
                    Effects.SendTargetEffect(focus, 0x376A, 10, 16);

                    focus.Resurrect();

                    CommandLogging.WriteLine(from, "{0} {1} résurrecte {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 11:     // .Voir
            {
                Resend(from, info);

                /*if (from is PlayerMobile && focus is PlayerMobile && from.AccessLevel > AccessLevel.GameMaster && focus.AccessLevel == AccessLevel.Player)
                 * {
                 *  from.SendGump(new CotationVoirGump((PlayerMobile)from, (PlayerMobile)focus));
                 * }*/

                break;
            }
            }
        }
Пример #13
0
            public override void Execute(CommandEventArgs e, object obj)
            {
                Mobile       from = e.Mobile;
                PlayerMobile pm   = obj as PlayerMobile;

                if (pm == null)
                {
                    LogFailure("That is not a player.");
                    return;
                }

                CommandLogging.WriteLine(from, "{0} {1} viewing quest overview of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(pm));
                from.SendGump(new QuestLogGump(pm, false));
            }
Пример #14
0
        public static void DeleteUnusedCrops_OnCommand(CommandEventArgs e)
        {
            int       i_Count  = 0;
            ArrayList toDelete = new ArrayList();

            try
            {
                foreach (Item item in World.Items.Values)
                {
                    if (item is AsparagusCrop || item is AsparagusSeedling || item is BananaCrop || item is BananaSeedling || item is BeetCrop || item is BeetSeedling || item is BitterHopsCrop || item is BitterHopsSeedling || item is BlackberryCrop || item is BlackberrySeedling || item is BlackRaspberryCrop || item is BlackRaspberrySeedling ||
                        item is BlueberryCrop || item is BlueberrySeedling || item is BroccoliCrop || item is BroccoliSeedling || item is CabbageCrop || item is CabbageSeedling || item is CantaloupeCrop || item is CantaloupeSeedling || item is CarrotCrop || item is CarrotSeedling || item is CauliflowerCrop || item is CauliflowerSeedling ||
                        item is CeleryCrop || item is CelerySeedling || item is ChiliPepperCrop || item is ChiliPepperSeedling || item is CoconutCrop || item is CoconutSeedling || item is CornCrop || item is CornSeedling || item is CottonCrop || item is CottonSeedling || item is CranberryCrop || item is CranberrySeedling || item is CucumberCrop || item is CucumberSeedling ||
                        item is DateCrop || item is DateSeedling || item is EggplantCrop || item is EggplantSeedling || item is ElvenHopsCrop || item is ElvenHopsSeedling || item is FieldCornCrop || item is FieldCornSeedling || item is FlaxCrop || item is FlaxSeedling || item is GarlicCrop || item is GarlicSeedling || item is GinsengCrop || item is GinsengSeedling ||
                        item is GreenBeanCrop || item is GreenBeanSeedling || item is GreenPepperCrop || item is GreenPepperSeedling || item is GreenSquashCrop || item is GreenSquashSeedling || item is HayCrop || item is HaySeedling || item is HoneydewMelonCrop || item is HoneydewMelonSeedling || item is IrishRoseCrop || item is IrishRoseSeedling ||
                        item is LettuceCrop || item is LettuceSeedling || item is MandrakeCrop || item is MandrakeSeedling || item is MiniAlmondCrop || item is MiniAlmondSeedling || item is MiniAppleCrop || item is MiniAppleSeedling || item is MiniApricotCrop || item is MiniApricotSeedling || item is MiniAvocadoCrop || item is MiniAvocadoSeedling ||
                        item is MiniCherryCrop || item is MiniCherrySeedling || item is MiniCocoaCrop || item is MiniCocoaSeedling || item is MiniCoffeeCrop || item is MiniCoffeeSeedling || item is MiniGrapefruitCrop || item is MiniGrapefruitSeedling || item is MiniKiwiCrop || item is MiniKiwiSeedling || item is MiniMangoCrop || item is MiniMangoSeedling ||
                        item is MiniOrangeCrop || item is MiniOrangeSeedling || item is MiniPeachCrop || item is MiniPeachSeedling || item is MiniPearCrop || item is MiniPearSeedling || item is MiniPistacioCrop || item is MiniPistacioSeedling || item is MiniPomegranateCrop || item is MiniPomegranateSeedling || item is NightshadeCrop || item is NightshadeSeedling ||
                        item is OatsCrop || item is OatsSeedling || item is OnionCrop || item is OnionSeedling || item is OrangePepperCrop || item is OrangePepperSeedling || item is PansyCrop || item is PansySeedling || item is PeanutCrop || item is PeanutSeedling || item is PeasCrop || item is PeasSeedling || item is PineappleCrop || item is PineappleSeedling ||
                        item is PinkCarnationCrop || item is PinkCarnationSeedling || item is PoppyCrop || item is PoppySeedling || item is PotatoCrop || item is PotatoSeedling || item is PumpkinCrop || item is PumpkinSeedling || item is RadishCrop || item is RadishSeedling || item is RedMushroomCrop || item is RedMushroomSeedling ||
                        item is RedPepperCrop || item is RedPepperSeedling || item is RedRaspberryCrop || item is RedRaspberrySeedling || item is RedRoseCrop || item is RedRoseSeedling || item is RiceCrop || item is RiceSeedling || item is SmallBananaCrop || item is SmallBananaSeedling || item is SnapdragonCrop || item is SnapdragonSeedling ||
                        item is SnowHopsCrop || item is SnowHopsSeedling || item is SnowPeasCrop || item is SnowPeasSeedling || item is SoyCrop || item is SoySeedling || item is SpinachCrop || item is SpinachSeedling || item is SpiritRoseCrop || item is SpiritRoseSeedling || item is SquashCrop || item is SquashSeedling || item is StrawberryCrop || item is StrawberrySeedling ||
                        item is SugarcaneCrop || item is SugarcaneSeedling || item is SunFlowerCrop || item is SunFlowerSeedling || item is SweetHopsCrop || item is SweetHopsSeedling || item is SweetPotatoCrop || item is SweetPotatoSeedling || item is TanGingerCrop || item is TanGingerSeedling || item is TanMushroomCrop || item is TanMushroomSeedling ||
                        item is TeaCrop || item is TeaSeedling || item is TomatoCrop || item is TomatoSeedling || item is TurnipCrop || item is TurnipSeedling || item is WatermelonCrop || item is WatermelonSeedling || item is WheatCrop || item is WheatSeedling || item is WhiteRoseCrop || item is WhiteRoseSeedling || item is YellowPepperCrop || item is YellowPepperSeedling ||
                        item is YellowRoseCrop || item is YellowRoseSeedling
                        )
                    {
                        if (item.Map == Server.Map.Felucca || item.Map == Server.Map.Trammel || item.Map == Server.Map.Ilshenar || item.Map == Server.Map.Malas || item.Map == Server.Map.Tokuno)
                        {
                            string sSowerProp = Properties.GetValue(e.Mobile, item, "Sower");
                            if (sSowerProp == "Sower = (-null-)" || sSowerProp == "Sower = null" || sSowerProp == "null")
                            {
                                i_Count++;
                                CommandLogging.WriteLine(e.Mobile, "{0} {1} delete {2} [{3}]: {4} ({5} '{6}'))", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), item.Location, item.Map, item.GetType().Name, item.Name, sSowerProp);
                                e.Mobile.SendMessage("{0}", sSowerProp);
                                toDelete.Add(item);
                            }
                        }
                    }
                }

                for (int i = 0; i < toDelete.Count; ++i)
                {
                    if (toDelete[i] is Item)
                    {
                        ((Item)toDelete[i]).Delete();
                    }
                }

                e.Mobile.SendMessage(i_Count + " Item's deleted.");
            }
            catch (Exception err)
            {
                e.Mobile.SendMessage("Exception: " + err.Message);
            }
        }
Пример #15
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile mob  = (Mobile)obj;
            Mobile from = e.Mobile;

            if (m_Value)
            {
                if (!mob.Alive)
                {
                    LogFailure("They are already dead.");
                }
                else if (!mob.CanBeDamaged())
                {
                    LogFailure("They cannot be harmed.");
                }
                else
                {
                    CommandLogging.WriteLine(from, "{0} {1} killing {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob));
                    mob.Kill();

                    AddResponse("They have been killed.");
                }
            }
            else
            {
                if (mob.IsDeadBondedPet)
                {
                    BaseCreature bc = mob as BaseCreature;

                    if (bc != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} resurrecting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob));

                        bc.PlaySound(0x214);
                        bc.FixedEffect(0x376A, 10, 16);

                        bc.ResurrectPet();

                        AddResponse("It has been resurrected.");
                    }
                }
                else if (!mob.Alive)
                {
                    CommandLogging.WriteLine(from, "{0} {1} resurrecting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob));

                    mob.PlaySound(0x214);
                    mob.FixedEffect(0x376A, 10, 16);

                    mob.Resurrect();

                    AddResponse("They have been resurrected.");
                }
                else
                {
                    LogFailure("They are not dead.");
                }
            }
        }
Пример #16
0
        public static void Freeze(Mobile from, Map targetMap, Point3D start3d, Point3D end3d)
        {
            Hashtable mapTable = new Hashtable();

            if (start3d == NullP3D && end3d == NullP3D)
            {
                if (targetMap == null)
                {
                    CommandLogging.WriteLine(from, "{0} {1} invoking freeze for every item in every map", from.AccessLevel, CommandLogging.Format(from));
                }
                else
                {
                    CommandLogging.WriteLine(from, "{0} {1} invoking freeze for every item in {0}", from.AccessLevel, CommandLogging.Format(from), targetMap);
                }

                foreach (Item item in World.Items.Values)
                {
                    if (targetMap != null && item.Map != targetMap)
                    {
                        continue;
                    }

                    if (item.Parent != null)
                    {
                        continue;
                    }

                    if (item is Static || item is BaseFloor || item is BaseWall)
                    {
                        Map itemMap = item.Map;

                        if (itemMap == null || itemMap == Map.Internal)
                        {
                            continue;
                        }

                        Hashtable table = (Hashtable)mapTable[itemMap];

                        if (table == null)
                        {
                            mapTable[itemMap] = table = new Hashtable();
                        }

                        Point2D p = new Point2D(item.X >> 3, item.Y >> 3);

                        DeltaState state = (DeltaState)table[p];

                        if (state == null)
                        {
                            table[p] = state = new DeltaState(p);
                        }

                        state.m_List.Add(item);
                    }
                }
            }
            else if (targetMap != null)
            {
                Point2D start = targetMap.Bound(new Point2D(start3d)), end = targetMap.Bound(new Point2D(end3d));

                CommandLogging.WriteLine(from, "{0} {1} invoking freeze from {2} to {3} in {4}", from.AccessLevel, CommandLogging.Format(from), start, end, targetMap);

                IPooledEnumerable eable = targetMap.GetItemsInBounds(new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1));

                foreach (Item item in eable)
                {
                    if (item is Static || item is BaseFloor || item is BaseWall)
                    {
                        Map itemMap = item.Map;

                        if (itemMap == null || itemMap == Map.Internal)
                        {
                            continue;
                        }

                        Hashtable table = (Hashtable)mapTable[itemMap];

                        if (table == null)
                        {
                            mapTable[itemMap] = table = new Hashtable();
                        }

                        Point2D p = new Point2D(item.X >> 3, item.Y >> 3);

                        DeltaState state = (DeltaState)table[p];

                        if (state == null)
                        {
                            table[p] = state = new DeltaState(p);
                        }

                        state.m_List.Add(item);
                    }
                }

                eable.Free();
            }

            if (mapTable.Count == 0)
            {
                from.SendGump(new NoticeGump(1060637, 30720, "No freezable items were found.  Only the following item types are frozen:<br> - Static<br> - BaseFloor<br> - BaseWall", 0xFFC000, 320, 240, null, null));
                return;
            }

            bool badDataFile = false;

            int totalFrozen = 0;

            foreach (DictionaryEntry de in mapTable)
            {
                Map       map   = (Map)de.Key;
                Hashtable table = (Hashtable)de.Value;

                TileMatrix matrix = map.Tiles;

                using (FileStream idxStream = OpenWrite(matrix.IndexStream))
                {
                    using (FileStream mulStream = OpenWrite(matrix.DataStream))
                    {
                        if (idxStream == null || mulStream == null)
                        {
                            badDataFile = true;
                            continue;
                        }

                        BinaryReader idxReader = new BinaryReader(idxStream);

                        BinaryWriter idxWriter = new BinaryWriter(idxStream);
                        BinaryWriter mulWriter = new BinaryWriter(mulStream);

                        foreach (DeltaState state in table.Values)
                        {
                            int          oldTileCount;
                            StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, state.m_X, state.m_Y, matrix.BlockWidth, matrix.BlockHeight, out oldTileCount);

                            if (oldTileCount < 0)
                            {
                                continue;
                            }

                            int          newTileCount = 0;
                            StaticTile[] newTiles     = new StaticTile[state.m_List.Count];

                            for (int i = 0; i < state.m_List.Count; ++i)
                            {
                                Item item = (Item)state.m_List[i];

                                int xOffset = item.X - (state.m_X * 8);
                                int yOffset = item.Y - (state.m_Y * 8);

                                if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8)
                                {
                                    continue;
                                }

                                StaticTile newTile = new StaticTile();

                                newTile.m_ID  = (short)(item.ItemID & 0x3FFF);
                                newTile.m_X   = (byte)xOffset;
                                newTile.m_Y   = (byte)yOffset;
                                newTile.m_Z   = (sbyte)item.Z;
                                newTile.m_Hue = (short)item.Hue;

                                newTiles[newTileCount++] = newTile;

                                item.Delete();

                                ++totalFrozen;
                            }

                            int mulPos = -1;
                            int length = -1;
                            int extra  = 0;

                            if ((oldTileCount + newTileCount) > 0)
                            {
                                mulWriter.Seek(0, SeekOrigin.End);

                                mulPos = (int)mulWriter.BaseStream.Position;
                                length = (oldTileCount + newTileCount) * 7;
                                extra  = 1;

                                for (int i = 0; i < oldTileCount; ++i)
                                {
                                    StaticTile toWrite = oldTiles[i];

                                    mulWriter.Write((short)toWrite.m_ID);
                                    mulWriter.Write((byte)toWrite.m_X);
                                    mulWriter.Write((byte)toWrite.m_Y);
                                    mulWriter.Write((sbyte)toWrite.m_Z);
                                    mulWriter.Write((short)toWrite.m_Hue);
                                }

                                for (int i = 0; i < newTileCount; ++i)
                                {
                                    StaticTile toWrite = newTiles[i];

                                    mulWriter.Write((short)toWrite.m_ID);
                                    mulWriter.Write((byte)toWrite.m_X);
                                    mulWriter.Write((byte)toWrite.m_Y);
                                    mulWriter.Write((sbyte)toWrite.m_Z);
                                    mulWriter.Write((short)toWrite.m_Hue);
                                }

                                mulWriter.Flush();
                            }

                            int idxPos = ((state.m_X * matrix.BlockHeight) + state.m_Y) * 12;

                            idxWriter.Seek(idxPos, SeekOrigin.Begin);
                            idxWriter.Write(mulPos);
                            idxWriter.Write(length);
                            idxWriter.Write(extra);

                            idxWriter.Flush();

                            matrix.SetStaticBlock(state.m_X, state.m_Y, null);
                        }
                    }
                }
            }

            if (totalFrozen == 0 && badDataFile)
            {
                from.SendGump(new NoticeGump(1060637, 30720, "Output data files could not be opened and the freeze operation has been aborted.<br><br>This probably means your server and client are using the same data files.  Instructions on how to resolve this can be found in the first warning window.", 0xFFC000, 320, 240, null, null));
            }
            else
            {
                from.SendGump(new NoticeGump(1060637, 30720, String.Format("Freeze operation completed successfully.<br><br>{0} item{1} frozen.<br><br>You must restart your client and update it's data files to see the changes.", totalFrozen, totalFrozen != 1 ? "s were" : " was"), 0xFFC000, 320, 240, null, null));
            }
        }
Пример #17
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile m = (Mobile)obj;

            CommandLogging.WriteLine(e.Mobile, "{0} {1} {2} {3}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), m_Value ? "hiding" : "unhiding", CommandLogging.Format(m));

            Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z + 4), m.Map, 0x3728, 13);
            Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z), m.Map, 0x3728, 13);
            Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y, m.Z - 4), m.Map, 0x3728, 13);
            Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z + 4), m.Map, 0x3728, 13);
            Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z), m.Map, 0x3728, 13);
            Effects.SendLocationEffect(new Point3D(m.X, m.Y + 1, m.Z - 4), m.Map, 0x3728, 13);

            Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 11), m.Map, 0x3728, 13);
            Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 7), m.Map, 0x3728, 13);
            Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z + 3), m.Map, 0x3728, 13);
            Effects.SendLocationEffect(new Point3D(m.X + 1, m.Y + 1, m.Z - 1), m.Map, 0x3728, 13);

            m.PlaySound(0x228);
            m.Hidden = m_Value;

            if (m_Value)
            {
                AddResponse("They have been hidden.");
            }
            else
            {
                AddResponse("They have been revealed.");
            }
        }
Пример #18
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile   from  = e.Mobile;
            Mobile   targ  = (Mobile)obj;
            NetState state = targ.NetState;

            if (state != null)
            {
                CommandLogging.WriteLine(from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ));

                try
                {
                    Firewall.Add(((IPEndPoint)state.Socket.RemoteEndPoint).Address);
                    AddResponse("They have been firewalled.");
                }
                catch (Exception ex)
                {
                    LogFailure(ex.Message);
                }
            }
            else
            {
                LogFailure("They are not online.");
            }
        }
Пример #19
0
        protected override void OnTarget(Mobile from, object o)
        {
            IPoint3D     p      = o as IPoint3D;
            PlayerMobile pm     = (PlayerMobile)from;
            bool         market = false;


            if (p != null)
            {
                if (p is Item)
                {
                    p = ((Item)p).GetWorldTop();
                }

                CommandLogging.WriteLine(from, "{0} {1} moving {2} to {3}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m_Object), new Point3D(p));

                Point3D pt  = new Point3D(p.X, p.Y, p.Z);
                Region  reg = Region.Find(pt, from.Map);


                if (reg is CityMarketRegion)
                {
                    if (((CityMarketRegion)reg).Stone == pm.City)
                    {
                        market = true;
                    }
                }



                if ((reg is PlayerCityRegion && reg == pm.City.PCRegion) || market)
                {
                    if (m_Object is Item)
                    {
                        Item item = (Item)m_Object;

                        if (!item.Deleted)
                        {
                            item.MoveToWorld(new Point3D(p), from.Map);
                        }
                    }
                    else if (m_Object is Mobile)
                    {
                        Mobile m = (Mobile)m_Object;

                        if (m is CityRentedVendor && reg is PlayerCityRegion)
                        {
                            from.SendMessage("You may not move rented vendors outside the mall!");
                        }

                        else if (!m.Deleted)
                        {
                            m.MoveToWorld(new Point3D(p), from.Map);
                        }
                    }
                }
                else
                {
                    from.SendMessage("You may only place this in a public area of your town!");
                }
            }
        }
Пример #20
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile from = e.Mobile;
            Mobile targ = (Mobile)obj;

            if (from.AccessLevel > targ.AccessLevel)
            {
                NetState fromState = from.NetState, targState = targ.NetState;

                if (fromState != null && targState != null)
                {
                    Account fromAccount = fromState.Account as Account;
                    Account targAccount = targState.Account as Account;

                    if (fromAccount != null && targAccount != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} {2} {3}", from.AccessLevel, CommandLogging.Format(from), m_Ban ? "banning" : "kicking", CommandLogging.Format(targ));

                        targ.Say("I've been {0}!", m_Ban ? "banned" : "kicked");

                        AddResponse(String.Format("They have been {0}.", m_Ban ? "banned" : "kicked"));

                        targState.Dispose();

                        if (m_Ban)
                        {
                            targAccount.Banned = true;
                            targAccount.SetUnspecifiedBan(from);
                            from.SendGump(new BanDurationGump(targAccount));
                        }
                    }
                }
                else if (targState == null)
                {
                    LogFailure("They are not online.");
                }
            }
            else
            {
                LogFailure("You do not have the required access level to do this.");
            }
        }
Пример #21
0
        public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft)
        {
            int badCraft = craftSystem.CanCraft(from, tool, m_Type);

            if (badCraft > 0)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                }
                else
                {
                    from.SendLocalizedMessage(badCraft);
                }

                return;
            }

            int    checkResHue = 0, checkMaxAmount = 0;
            object checkMessage = null;

            // Not enough resource to craft it
            if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                }
                else if (checkMessage is int && (int)checkMessage > 0)
                {
                    from.SendLocalizedMessage((int)checkMessage);
                }
                else if (checkMessage is string)
                {
                    from.SendMessage((string)checkMessage);
                }

                return;
            }
            else if (!ConsumeAttributes(from, ref checkMessage, false))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                }
                else if (checkMessage is int && (int)checkMessage > 0)
                {
                    from.SendLocalizedMessage((int)checkMessage);
                }
                else if (checkMessage is string)
                {
                    from.SendMessage((string)checkMessage);
                }

                return;
            }

            bool toolBroken = false;

            int ignored    = 1;
            int endquality = 1;

            bool allRequiredSkills = true;

            if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
            {
                // Resource
                int resHue    = 0;
                int maxAmount = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }
                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }
                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }
                else if (!ConsumeAttributes(from, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }
                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }
                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }

                tool.UsesRemaining--;

                if (craftSystem is DefBlacksmithy)
                {
                    AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;
                    if (hammer != null && hammer != tool)
                    {
                        hammer.UsesRemaining--;
                        if (hammer.UsesRemaining < 1)
                        {
                            hammer.Delete();
                        }
                    }
                }

                if (tool.UsesRemaining < 1)
                {
                    toolBroken = true;
                }

                if (toolBroken)
                {
                    tool.Delete();
                }

                int num = 0;

                Item item;
                if (customCraft != null)
                {
                    item = customCraft.CompleteCraft(out num);
                }
                else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca)
                {
                    item = new IndecipherableMap();
                    from.SendLocalizedMessage(1070800);                       // The map you create becomes mysteriously indecipherable.
                }
                else
                {
                    item = Activator.CreateInstance(ItemType) as Item;
                }

                if (item != null)
                {
                    if (item is ICraftable)
                    {
                        endquality = ((ICraftable)item).OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, this, resHue);
                    }
                    else if (item.Hue == 0)
                    {
                        item.Hue = resHue;
                    }

                    if (maxAmount > 0)
                    {
                        if (!item.Stackable && item is IUsesRemaining)
                        {
                            ((IUsesRemaining)item).UsesRemaining *= maxAmount;
                        }
                        else
                        {
                            item.Amount = maxAmount;
                        }
                    }

                    from.AddToBackpack(item);

                    if (from.AccessLevel > AccessLevel.Player)
                    {
                        CommandLogging.WriteLine(from, "Crafting {0} with craft system {1}", CommandLogging.Format(item), craftSystem.GetType().Name);
                    }

                    //from.PlaySound( 0x57 );
                }

                if (num == 0)
                {
                    num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this);
                }

                bool queryFactionImbue    = false;
                int  availableSilver      = 0;
                FactionItemDefinition def = null;
                Faction faction           = null;

                if (item is IFactionItem)
                {
                    def = FactionItemDefinition.Identify(item);

                    if (def != null)
                    {
                        faction = Faction.Find(from);

                        if (faction != null)
                        {
                            Town town = Town.FromRegion(from.Region);

                            if (town != null && town.Owner == faction)
                            {
                                Container pack = from.Backpack;

                                if (pack != null)
                                {
                                    availableSilver = pack.GetAmount(typeof(Silver));

                                    if (availableSilver >= def.SilverCost)
                                    {
                                        queryFactionImbue = Faction.IsNearType(from, def.VendorType, 12);
                                    }
                                }
                            }
                        }
                    }
                }

                // TODO: Scroll imbuing

                if (queryFactionImbue)
                {
                    from.SendGump(new FactionImbueGump(quality, item, from, craftSystem, tool, num, availableSilver, faction, def));
                }
                else if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, num));
                }
                else if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
            }
            else if (!allRequiredSkills)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
                }
                else
                {
                    from.SendLocalizedMessage(1044153);                       // You don't have the required skills to attempt this item.
                }
            }
            else
            {
                ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All);
                int         resHue      = 0;
                int         maxAmount   = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }
                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }
                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }

                tool.UsesRemaining--;

                if (tool.UsesRemaining < 1)
                {
                    toolBroken = true;
                }

                if (toolBroken)
                {
                    tool.Delete();
                }

                // SkillCheck failed.
                int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this);

                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, num));
                }
                else if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
            }
        }
Пример #22
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile from = e.Mobile;

            if (e.Length == 1)
            {
                int    index = e.GetInt32(0);
                Mobile mob   = (Mobile)obj;

                CommandLogging.WriteLine(from, "{0} {1} playing sound {2} for {3}", from.AccessLevel, CommandLogging.Format(from), index, CommandLogging.Format(mob));
                mob.Send(new PlaySound(index, mob.Location));
            }
            else
            {
                from.SendMessage("Format: PrivSound <index>");
            }
        }
Пример #23
0
        public void Execute(CommandEventArgs e, object obj, bool echo)
        {
            if (e.Length == 1)
            {
                Mobile mob  = (Mobile)obj;
                Mobile from = e.Mobile;

                if (mob.Player)
                {
                    NetState ns = mob.NetState;

                    if (ns == null)
                    {
                        LogFailure("That player is not online.");
                    }
                    else
                    {
                        string url = e.GetString(0);

                        CommandLogging.WriteLine(from, "{0} {1} requesting to open web browser of {2} to {3}",
                                                 from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob), url);

                        if (echo)
                        {
                            AddResponse("Awaiting user confirmation...");
                        }
                        else
                        {
                            AddResponse("Open web browser request sent.");
                        }

                        mob.SendGump(new WarningGump(1060637, 30720,
                                                     $"A game master is requesting to open your web browser to the following URL:<br>{url}", 0xFFC000,
                                                     320, 240, okay => OpenBrowser_Callback(mob, okay, from, url, echo)));
                    }
                }
                else
                {
                    LogFailure("That is not a player.");
                }
            }
            else
            {
                LogFailure("Format: OpenBrowser <url>");
            }
        }
Пример #24
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile mob  = (Mobile)obj;
            Mobile from = e.Mobile;

            CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\"", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob), e.ArgString);

            mob.SendMessage(e.ArgString);
        }
Пример #25
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile from = e.Mobile;
            Mobile mob  = (Mobile)obj;

            CommandLogging.WriteLine(from, "{0} {1} dismounting {2}", from.AccessLevel, CommandLogging.Format(from),
                                     CommandLogging.Format(mob));

            bool takenAction = false;

            for (int i = 0; i < mob.Items.Count; ++i)
            {
                Item item = mob.Items[i];

                if (item is IMountItem mountItem)
                {
                    IMount mount = mountItem.Mount;

                    if (mount != null)
                    {
                        mount.Rider = null;
                        takenAction = true;
                    }

                    if (mob.Items.IndexOf(item) == -1)
                    {
                        --i;
                    }
                }
            }

            for (int i = 0; i < mob.Items.Count; ++i)
            {
                Item item = mob.Items[i];

                if (item.Layer == Layer.Mount)
                {
                    takenAction = true;
                    item.Delete();
                    --i;
                }
            }

            if (takenAction)
            {
                AddResponse("They have been dismounted.");
            }
            else
            {
                LogFailure("They were not mounted.");
            }
        }
Пример #26
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            if (obj is BaseVendor)
            {
                CommandLogging.WriteLine(e.Mobile, "{0} {1} restocking {2}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), CommandLogging.Format(obj));

                ((BaseVendor)obj).Restock();
                AddResponse("The vendor has been restocked.");
            }
            else
            {
                AddResponse("That is not a vendor.");
            }
        }
Пример #27
0
        public static void HWInfo_OnTarget(Mobile from, object obj)
        {
            if (obj is Mobile && ((Mobile)obj).Player)
            {
                Mobile  m    = (Mobile)obj;
                Account acct = m.Account as Account;

                if (acct != null)
                {
                    HardwareInfo hwInfo = acct.HardwareInfo;

                    if (hwInfo != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} viewing hardware info of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m));
                    }

                    if (hwInfo != null)
                    {
                        from.SendGump(new Gumps.PropertiesGump(from, hwInfo));
                    }
                    else
                    {
                        from.SendMessage("No hardware information for that account was found.");
                    }
                }
                else
                {
                    from.SendMessage("No account has been attached to that player.");
                }
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(HWInfo_OnTarget));
                from.SendMessage("That is not a player. Try again.");
            }
        }
Пример #28
0
 public override void Execute(CommandEventArgs e, object obj)
 {
     if (obj is Item)
     {
         CommandLogging.WriteLine(e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), CommandLogging.Format(obj));
         ((Item)obj).Delete();
         AddResponse("The item has been deleted.");
     }
     else if (obj is Mobile && !((Mobile)obj).Player)
     {
         CommandLogging.WriteLine(e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), CommandLogging.Format(obj));
         ((Mobile)obj).Delete();
         AddResponse("The mobile has been deleted.");
     }
     else
     {
         LogFailure("That cannot be deleted.");
     }
 }
Пример #29
0
        public static void Unfreeze(Mobile from, Map map, Point3D start, Point3D end)
        {
            int  totalUnfrozen = 0;
            bool badDataFile   = false;

            if (map == null)
            {
                CommandLogging.WriteLine(from, "{0} {1} invoking unfreeze for every item in every map", from.AccessLevel, CommandLogging.Format(from));

                DoUnfreeze(Map.Felucca, ref badDataFile, ref totalUnfrozen);
                DoUnfreeze(Map.Trammel, ref badDataFile, ref totalUnfrozen);
                DoUnfreeze(Map.Ilshenar, ref badDataFile, ref totalUnfrozen);
                DoUnfreeze(Map.Malas, ref badDataFile, ref totalUnfrozen);
                DoUnfreeze(Map.Tokuno, ref badDataFile, ref totalUnfrozen);
            }
            else if (start == NullP3D && end == NullP3D)
            {
                CommandLogging.WriteLine(from, "{0} {1} invoking unfreeze for every item in {2}", from.AccessLevel, CommandLogging.Format(from), map);

                DoUnfreeze(map, ref badDataFile, ref totalUnfrozen);
            }
            else
            {
                CommandLogging.WriteLine(from, "{0} {1} invoking unfreeze from {2} to {3} in {4}", from.AccessLevel, CommandLogging.Format(from), new Point2D(start), new Point2D(end), map);

                DoUnfreeze(map, new Point2D(start), new Point2D(end), ref badDataFile, ref totalUnfrozen);
            }

            if (totalUnfrozen == 0 && badDataFile)
            {
                from.SendGump(new NoticeGump(1060637, 30720, "Output data files could not be opened and the unfreeze operation has been aborted.<br><br>This probably means your server and client are using the same data files.  Instructions on how to resolve this can be found in the first warning window.", 0xFFC000, 320, 240, null, null));
            }
            else
            {
                from.SendGump(new NoticeGump(1060637, 30720, String.Format("Unfreeze operation completed successfully.<br><br>{0} item{1} unfrozen.<br><br>You must restart your client and update it's data files to see the changes.", totalUnfrozen, totalUnfrozen != 1 ? "s were" : " was"), 0xFFC000, 320, 240, null, null));
            }
        }
Пример #30
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Item.Deleted)
            {
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
                return;
            }
            else if (!BaseCommand.IsAccessible(m_From, m_Item))
            {
                m_From.SendMessage("That is no longer accessible.");
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
                return;
            }

            switch (info.ButtonID)
            {
            case 0:
            case 1:
            {
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
                break;
            }

            case 2:                     // Properties
            {
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                m_From.SendGump(new PropertiesGump(m_From, m_Item));
                break;
            }

            case 3:                     // Delete
            {
                CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel, CommandLogging.Format(m_From), CommandLogging.Format(m_Item));
                m_Item.Delete();
                m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
                break;
            }

            case 4:                     // Go there
            {
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                InvokeCommand(String.Format("Go {0}", m_Item.Serial.Value));
                break;
            }

            case 5:                     // Move to target
            {
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                m_From.Target = new MoveTarget(m_Item);
                break;
            }

            case 6:                     // Bring to pack
            {
                Mobile owner = m_Item.RootParent as Mobile;

                if (owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible(m_From, owner) /* !m_From.CanSee( owner )*/)
                {
                    m_From.SendMessage("You can not get what you can not see.");
                }
                else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= m_From.AccessLevel)
                {
                    m_From.SendMessage("You can not get what you can not see.");
                }
                else
                {
                    m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                    m_From.AddToBackpack(m_Item);
                }

                break;
            }

            case 7:                     // Interface the parent
            {
                if (m_Item.RootParent is Mobile)
                {
                    Mobile parent = m_Item.RootParent as Mobile;
                    m_From.SendGump(new InterfaceGump(m_From, new string[] { "Entity" }, new ArrayList(new Mobile[] { parent }), 0, null));
                }
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                break;
            }

            case 8:                     // Properties of parent
            {
                if (m_Item.RootParent is Mobile)
                {
                    Mobile parent = m_Item.RootParent as Mobile;
                    if (m_From.AccessLevel <= parent.AccessLevel)
                    {
                        m_From.SendMessage("Access is denied");
                    }
                    else
                    {
                        m_From.SendGump(new PropertiesGump(m_From, parent));
                    }
                }
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                break;
            }

            case 9:                     // Go to parent mobile
            {
                if (m_Item.RootParent is Mobile)
                {
                    Mobile parent = m_Item.RootParent as Mobile;
                    InvokeCommand(String.Format("Go {0}", parent.Serial.Value));
                }
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                break;
            }

            case 10:                     // Bring mobile parent to you
            {
                if (m_Item.RootParent is Mobile)
                {
                    Mobile parent = m_Item.RootParent as Mobile;
                    parent.MoveToWorld(m_From.Location, m_From.Map);
                }
                m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
                break;
            }
            }
        }