Ejemplo n.º 1
0
        public override void Execute(Server.Commands.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(0x35, "{0} tells you: {1}", from.Name, e.ArgString);

            AddResponse(String.Format("You tell them: {0}", e.ArgString));
        }
Ejemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;
                    if (from != targ)
                    {
                        from.SendMessage("You may only set your own body to GM style.");
                    }

                    else
                    {
                        m_Mobile = from;

                        CommandLogging.WriteLine(from, "{0} {1} is assuming a GM body", from.AccessLevel, CommandLogging.Format(from));

                        Container pack = from.Backpack;

                        if (pack == null)
                        {
                            pack         = new Backpack();
                            pack.Movable = false;

                            from.AddItem(pack);
                        }

                        from.Body   = 0x190;
                        from.Fame   = 0;
                        from.Karma  = 0;
                        from.Kills  = 0;
                        from.Hidden = true;
                        from.Hits   = from.HitsMax;
                        from.Mana   = from.ManaMax;
                        from.Stam   = from.StamMax;

                        if (from.AccessLevel >= AccessLevel.GameMaster)
                        {
                            EquipItem(new StaffRing());
                            Spellbook book1 = new Spellbook((ulong)18446744073709551615);
                            Spellbook book2 = new NecromancerSpellbook((ulong)0xffff);
                            Spellbook book3 = new BookOfChivalry();

                            PackItem(book1);
                            PackItem(book2);
                            PackItem(book3);
                            PackItem(new EtherealHorse());

                            from.RawStr = 100;
                            from.RawDex = 100;
                            from.RawInt = 100;
                            from.Hits   = from.HitsMax;
                            from.Mana   = from.ManaMax;
                            from.Stam   = from.StamMax;

                            for (int i = 0; i < targ.Skills.Length; ++i)
                            {
                                targ.Skills[i].Base = 120;
                            }
                        }

                        if (from.AccessLevel == AccessLevel.Counselor)
                        {
                            EquipItem(new CounselorRobe());
                            EquipItem(new ThighBoots(3));
                            PackItem(new CounselorHide());
                            from.Title = "[Counselor]";
                            from.AddItem(new ShortHair(3));
                            from.AddItem(new Vandyke(3));
                        }

                        if (from.AccessLevel == AccessLevel.GameMaster)
                        {
                            EquipItem(new GMRobe());
                            EquipItem(new ThighBoots(39));
                            PackItem(new SeerHide(39));
                            from.Title = "[GM]";
                            from.AddItem(new ShortHair(39));
                            from.AddItem(new Vandyke(39));
                        }

                        if (from.AccessLevel == AccessLevel.Seer)
                        {
                            EquipItem(new SeerRobe());
                            EquipItem(new ThighBoots(467));
                            PackItem(new SeerHide());
                            from.Title = "[Seer]";
                            from.AddItem(new ShortHair(467));
                            from.AddItem(new Vandyke(467));
                        }

                        if (from.AccessLevel == AccessLevel.Administrator)
                        {
                            EquipItem(new AdminRobe());
                            EquipItem(new ThighBoots(1001));
                            PackItem(new AdminHide());
                            from.Title = "[Admin]";
                            from.AddItem(new ShortHair(1001));
                            from.AddItem(new Vandyke(1001));
                        }
                    }
                }
            }
Ejemplo n.º 3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Mobile.Deleted)
            {
                m_From.SendGump(new InterfaceGump(m_From, m_List, m_Page));
                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_List, m_Page));
                return;
            }

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

            case 2:                     // Properties
            {
                m_From.SendGump(new InterfaceMobileGump(m_From, 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_List, m_Page));
                }

                break;
            }

            case 4:                     // Go there
            {
                m_From.SendGump(new InterfaceMobileGump(m_From, 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_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_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_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_List, m_Page, m_Mobile));

                break;
            }

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

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

                break;
            }
            }
        }
Ejemplo n.º 4
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.");
     }
 }
Ejemplo n.º 5
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.");
            }
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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 = (Item)mob.Items[i];

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

                    if (mount != null)
                    {
                        mount.Rider = null;
                        if (mob is TeiravonMobile)
                        {
                            TeiravonMobile tm = (TeiravonMobile)mob;
                            tm.Dismounted();
                        }
                        takenAction = true;
                    }

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

            for (int i = 0; i < mob.Items.Count; ++i)
            {
                Item 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.");
            }
        }
Ejemplo n.º 8
0
 public override void OnResponse(NetState state, int index)
 {
     if (index == 0)
     {
         CommandLogging.WriteLine(state.Mobile, "{0} {1} moving equip item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format(state.Mobile), CommandLogging.Format(m_Item), CommandLogging.Format(m_Mobile));
         state.Mobile.Target = new MoveTarget(m_Item);
     }
     else if (index == 1)
     {
         CommandLogging.WriteLine(state.Mobile, "{0} {1} deleting equip item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format(state.Mobile), CommandLogging.Format(m_Item), CommandLogging.Format(m_Mobile));
         m_Item.Delete();
     }
     else if (index == 2)
     {
         CommandLogging.WriteLine(state.Mobile, "{0} {1} opening props for equip item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format(state.Mobile), CommandLogging.Format(m_Item), CommandLogging.Format(m_Mobile));
         state.Mobile.SendGump(new PropertiesGump(state.Mobile, m_Item));
     }
 }
Ejemplo n.º 9
0
        private static void PlaySound(Mobile m, int index, bool toAll)
        {
            Map map = m.Map;

            if (map == null)
            {
                return;
            }

            CommandLogging.WriteLine(m, "{0} {1} playing sound {2} (toAll={3})", m.AccessLevel, CommandLogging.Format(m), index, toAll);

            Packet p = GenericPackets.PlaySound(index, m.Location);

            p.Acquire();

            foreach (NetState state in m.GetClientsInRange(12))
            {
                if (toAll || state.Mobile.CanSee(m))
                {
                    state.Send(p);
                }
            }

            p.Release();
        }
Ejemplo n.º 10
0
        public static void GetFollowers_OnTarget(Mobile from, object obj)
        {
            if (obj is Mobile && ((Mobile)obj).Player)
            {
                Mobile    master = (Mobile)obj;
                ArrayList pets   = new ArrayList();

                foreach (Mobile m in World.Mobiles)
                {
                    if (m is BaseCreature)
                    {
                        BaseCreature bc = (BaseCreature)m;

                        if ((bc.Controlled && bc.ControlMaster == master) || (bc.Summoned && bc.SummonMaster == master))
                        {
                            pets.Add(bc);
                        }
                    }
                }

                if (pets.Count > 0)
                {
                    CommandLogging.WriteLine(from, "{0} {1} getting all followers of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(master));

                    from.SendMessage("That player has {0} pet{1}.", pets.Count, pets.Count != 1 ? "s" : "");

                    for (int i = 0; i < pets.Count; ++i)
                    {
                        Mobile pet = (Mobile)pets[i];

                        if (pet is IMount)
                        {
                            ((IMount)pet).Rider = null;                                // make sure it's dismounted
                        }

                        pet.MoveToWorld(from.Location, from.Map);
                    }
                }
                else
                {
                    from.SendMessage("There were no pets found for that player.");
                }
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(GetFollowers_OnTarget));
                from.SendMessage("That is not a player. Try again.");
            }
        }
Ejemplo n.º 11
0
                public EquipMenu(Mobile from, Mobile m, ItemListEntry[] entries)
                    : base("Equipment", entries)
                {
                    m_Mobile = m;

                    CommandLogging.WriteLine(from, "{0} {1} getting equip for {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m));
                }
Ejemplo n.º 12
0
        public static void ClearFacet_OnCommand(CommandEventArgs e)
        {
            Map map = e.Mobile.Map;

            if (map == null || map == Map.Internal)
            {
                e.Mobile.SendMessage("You may not run that command here.");
                return;
            }

            ArrayList list = new ArrayList();

            foreach (Item item in World.Items)
            {
                if (item.Map == map && item.Parent == null)
                {
                    list.Add(item);
                }
            }

            foreach (Mobile m in World.Mobiles)
            {
                if (m.Map == map && !m.Player)
                {
                    list.Add(m);
                }
            }

            if (list.Count > 0)
            {
                CommandLogging.WriteLine(e.Mobile, "{0} {1} starting facet clear of {2} ({3} objects)", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), map, list.Count);

                e.Mobile.SendGump(new WarningGump(1060635, 30720, String.Format("You are about to delete {0} object{1} from this facet.  Do you really wish to continue?", list.Count, list.Count == 1 ? "" : "s"), 0xFFC000, 360, 260, new WarningGumpCallback(DeleteList_Callback), list));
            }
            else
            {
                e.Mobile.SendMessage("There were no objects found to delete.");
            }
        }
Ejemplo n.º 13
0
        public static void DeleteList_Callback(Mobile from, bool okay, object state)
        {
            if (okay)
            {
                ArrayList list = (ArrayList)state;

                CommandLogging.WriteLine(from, "{0} {1} deleting {2} objects", from.AccessLevel, CommandLogging.Format(from), list.Count);

                for (int i = 0; i < list.Count; ++i)
                {
                    object obj = list[i];

                    if (obj is Item)
                    {
                        ((Item)obj).Delete();
                    }
                    else if (obj is Mobile)
                    {
                        ((Mobile)obj).Delete();
                    }
                }

                from.SendMessage("You have deleted {0} object{1}.", list.Count, list.Count == 1 ? "" : "s");
            }
            else
            {
                from.SendMessage("You have chosen not to delete those objects.");
            }
        }
Ejemplo n.º 14
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Item item = ((Mobile)targeted).FindItemOnLayer(m_Layer);

                    if (item != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} deleting item on layer {2} of {3}", from.AccessLevel, CommandLogging.Format(from), m_Layer, CommandLogging.Format(targeted));
                        item.Delete();
                    }
                }
                else
                {
                    from.SendMessage("Target a mobile.");
                }
            }
Ejemplo n.º 15
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            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);
                        AddResponse("Awaiting user confirmation...");
                        mob.SendGump(new WarningGump(1060637, 30720, String.Format("A game master is requesting to open your web browser to the following URL:<br>{0}", url), 0xFFC000, 320, 240, new WarningGumpCallback(OpenBrowser_Callback), new object[] { from, url }));
                    }
                }
                else
                {
                    LogFailure("That is not a player.");
                }
            }
            else
            {
                LogFailure("Format: OpenBrowser <url>");
            }
        }
Ejemplo n.º 16
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile m = (Mobile)targeted;

                    BankBox box = (m.Player ? m.BankBox : m.FindBankNoCreate());

                    if (box != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} opening bank box of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted));

                        if (from == targeted)
                        {
                            box.Open();
                        }
                        else
                        {
                            box.DisplayTo(from);
                        }
                    }
                    else
                    {
                        from.SendMessage("They have no bank box.");
                    }
                }
            }
Ejemplo n.º 17
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>");
            }
        }
Ejemplo n.º 18
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    CommandLogging.WriteLine(from, "{0} {1} dismounting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted));

                    Mobile targ = (Mobile)targeted;

                    foreach (var mount in targ.GetEquippedItems().OfType <IMountItem>().Select(mountItem => mountItem.Mount))
                    {
                        if (mount != null)
                        {
                            mount.Rider = null;
                        }
                    }

                    foreach (var item in targ.GetEquippedItems())
                    {
                        if (item.Layer == Layer.Mount)
                        {
                            item.Delete();
                        }
                    }
                }
            }
Ejemplo n.º 19
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            IPoint3D p = obj as IPoint3D;

            if (p == null)
            {
                return;
            }

            Mobile from = e.Mobile;

            SpellHelper.GetSurfaceTop(ref p);

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

            Point3D fromLoc = from.Location;
            Point3D toLoc   = new Point3D(p);

            from.Location = toLoc;
            from.ProcessDelta();

            if (!from.Hidden)
            {
                Effects.SendLocationParticles(EffectItem.Create(fromLoc, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                Effects.SendLocationParticles(EffectItem.Create(toLoc, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);

                from.PlaySound(0x1FE);
            }
        }
Ejemplo n.º 20
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;

                    if (targ.NetState != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} opening client menu of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted));
                        from.SendGump(new ClientGump(from, targ.NetState));
                    }
                }
            }
Ejemplo n.º 21
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.");
            }
        }
Ejemplo n.º 22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;

                    NetState state = targ.NetState;

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

                        Firewall.Add(state.Address);
                    }
                }
            }
Ejemplo n.º 23
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.");
                }
            }
        }
Ejemplo n.º 24
0
 protected override void OnTarget(Mobile from, object o)
 {
     if (!(o is PlayerMobile) || o == null)
     {
         from.SendMessage("Invalid target, must be a player.");
     }
     else
     {
         Mobile   t  = (Mobile)o;
         NetState ns = t.NetState;
         if (t.Deleted || t.Map == Map.Internal)
         {
             from.SendMessage("Invalid target, must be an online player.");
         }
         else if (t.AccessLevel != AccessLevel.Player)
         {
             from.SendMessage("Invalid target, not AccessLevel.Player.");
         }
         else if (ns == null)
         {
             from.SendMessage("Invalid target, this player is either disconnected or logging out.");
         }
         else
         {
             Account acct = t.Account as Account;
             if (acct != null)
             {
                 string   s_LastAFKCheck = acct.GetTag("LastAFKCheck");
                 DateTime LastAFKCheck   = DateTime.Now.Subtract(TimeSpan.FromHours(5));
                 if (s_LastAFKCheck != null)
                 {
                     try
                     {
                         LastAFKCheck = DateTime.Parse(s_LastAFKCheck);
                     }
                     catch { };
                 }
                 else
                 {
                     LastAFKCheck = DateTime.Now.Subtract(TimeSpan.FromHours(5));
                 }
                 if (DateTime.Now - LastAFKCheck > TimeSpan.FromHours(4) || tForce)
                 {
                     t.CloseGump(typeof(AFKCheckGump));
                     t.SendGump(new AFKCheckGump(from, t, 0, MaxRetries, 0, MaxSeconds, null, tKick, tJail, MoveToLoc, MoveToMap, WebSite, null));
                     from.SendMessage(1150, "AFK check gump sent to {0}.", t.Name);
                     CommandLogging.WriteLine(from, "{0} {1} Issuing AFK Check to: {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(t));
                     acct.SetTag("LastAFKCheck", DateTime.Now.ToString());
                     acct.SetTag("LastAFKCheckBy", from.Name);
                 }
                 else
                 {
                     from.SendMessage(36, "Last AFKCheck under 4 hours.");
                     from.SendMessage(36, "Use FORCE option.");
                     from.SendGump(new AFKInfoGump(t));
                 }
             }
             else
             {
                 from.SendMessage("Invalid target, Account property = null!");
             }
         }
     }
 }
Ejemplo n.º 25
0
            protected override void OnTarget(Mobile from, object targ)
            {
                bool done = false;

                if (!(targ is Item))
                {
                    from.SendMessage("You can only dupe items.");
                    return;
                }

                CommandLogging.WriteLine(from, "{0} {1} duping {2} (inBag={3}; amount={4})", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ), m_InBag, m_Amount);

                Item      copy = (Item)targ;
                Container pack;

                if (m_InBag)
                {
                    if (copy.Parent is Container)
                    {
                        pack = (Container)copy.Parent;
                    }
                    else if (copy.Parent is Mobile)
                    {
                        pack = ((Mobile)copy.Parent).Backpack;
                    }
                    else
                    {
                        pack = null;
                    }
                }
                else
                {
                    pack = from.Backpack;
                }

                Type t = copy.GetType();

                ConstructorInfo[] info = t.GetConstructors();

                foreach (ConstructorInfo c in info)
                {
                    //if ( !c.IsDefined( typeof( ConstructableAttribute ), false ) ) continue;

                    ParameterInfo[] paramInfo = c.GetParameters();

                    if (paramInfo.Length == 0)
                    {
                        object[] objParams = new object[0];

                        try
                        {
                            from.SendMessage("Duping {0}...", m_Amount);
                            for (int i = 0; i < m_Amount; i++)
                            {
                                object o = c.Invoke(objParams);

                                if (o != null && o is Item)
                                {
                                    Item newItem = (Item)o;
                                    CopyProperties(newItem, copy);                                       //copy.Dupe( item, copy.Amount );
                                    newItem.Parent = null;

                                    if (Miscellanious.ValidateLabeling(newItem))
                                    {
                                        newItem.Cheater_Name = String.Format("This item duped by GM {0}", from.Name);
                                    }

                                    if (pack != null)
                                    {
                                        pack.DropItem(newItem);
                                    }
                                    else
                                    {
                                        newItem.MoveToWorld(from.Location, from.Map);
                                    }
                                }
                            }
                            from.SendMessage("Done");
                            done = true;
                        }
                        catch
                        {
                            from.SendMessage("Error!");
                            return;
                        }
                    }
                }

                if (!done)
                {
                    from.SendMessage("Unable to dupe.  Item must have a 0 parameter constructor.");
                }
            }
Ejemplo n.º 26
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.");
            }
        }
Ejemplo n.º 27
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Item.Deleted)
            {
                m_From.SendGump(new InterfaceGump(m_From, m_List, m_Page));
                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_List, m_Page));
                return;
            }

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

            case 2:                     // Properties
            {
                m_From.SendGump(new InterfaceItemGump(m_From, 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_List, m_Page));
                break;
            }

            case 4:                     // Go there
            {
                m_From.SendGump(new InterfaceItemGump(m_From, 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_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) && !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_List, m_Page, m_Item));
                    m_From.AddToBackpack(m_Item);
                }

                break;
            }
            }
        }
Ejemplo n.º 28
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.");
            }
        }
Ejemplo n.º 29
0
        public static void Invoke(Mobile from, Point3D start, Point3D end, string[] args, ArrayList packs)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0} {1} building ", from.AccessLevel, CommandLogging.Format(from));

            if (start == end)
            {
                sb.AppendFormat("at {0} in {1}", start, from.Map);
            }
            else
            {
                sb.AppendFormat("from {0} to {1} in {2}", start, end, from.Map);
            }

            sb.Append(":");

            for (int i = 0; i < args.Length; ++i)
            {
                sb.AppendFormat(" \"{0}\"", args[i]);
            }

            CommandLogging.WriteLine(from, sb.ToString());

            string name = args[0];

            FixArgs(ref args);

            string[,] props = null;

            for (int i = 0; i < args.Length; ++i)
            {
                if (Insensitive.Equals(args[i], "set"))
                {
                    int remains = args.Length - i - 1;

                    if (remains >= 2)
                    {
                        props = new string[remains / 2, 2];

                        remains /= 2;

                        for (int j = 0; j < remains; ++j)
                        {
                            props[j, 0] = args[i + (j * 2) + 1];
                            props[j, 1] = args[i + (j * 2) + 2];
                        }

                        FixSetString(ref args, i);
                    }

                    break;
                }
            }

            Type type = ScriptCompiler.FindTypeByName(name);

            if (type == null)
            {
                from.SendMessage("No type with that name was found.");
                return;
            }

            DateTime time = DateTime.Now;

            int built = BuildObjects(from, type, start, end, args, props, packs);

            if (built > 0)
            {
                from.SendMessage("{0} object{1} generated in {2:F1} seconds.", built, built != 1 ? "s" : "", (DateTime.Now - time).TotalSeconds);
            }
            else
            {
                SendUsage(type, from);
            }
        }
Ejemplo n.º 30
0
            protected override void OnTarget(Mobile from, object targ)
            {
                bool done = false;

                if (!(targ is Item))
                {
                    from.SendMessage("You can only dupe items.");
                    return;
                }

                if (targ is Container)
                {
                    int Total_ItemCount = m_Amount * ((Container)targ).TotalItems;

                    if (Total_ItemCount > 1000)
                    {
                        from.SendMessage("You are trying to create {0} new items on the server!\nSafety Limit is 1000.", Total_ItemCount);
                        return;
                    }
                }

                CommandLogging.WriteLine(from, "{0} {1} duping {2} (inBag={3}; amount={4})", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ), m_InBag, m_Amount);

                Item      copy = (Item)targ;
                Container pack;

                if (m_InBag)
                {
                    if (copy.Parent is Container)
                    {
                        pack = (Container)copy.Parent;
                    }
                    else if (copy.Parent is Mobile)
                    {
                        pack = ((Mobile)copy.Parent).Backpack;
                    }
                    else
                    {
                        pack = null;
                    }
                }
                else
                {
                    pack = from.Backpack;
                }

                try
                {
                    from.SendMessage("Duping {0}...", m_Amount);

                    for (int i = 0; i < m_Amount; i++)
                    {
                        InternalDupe((Item)targ, pack, from);
                    }

                    from.SendMessage("Done");
                    done = true;
                }
                catch
                {
                    from.SendMessage("Error!");
                    return;
                }

                if (!done)
                {
                    from.SendMessage("Unable to dupe. Item must have a 0 parameter constructor.");
                }
            }