Esempio n. 1
0
 public override void OnDoubleClick(Mobile from)
 {
     if (from.AccessLevel >= AccessLevel.Batisseur)
     {
         m_Owner = from;
     }
     if (m_Owner == null)
     {
         from.SendMessage("This is not yours. The Item has been deleted.");
         if (m_Owner != null)
         {
             m_Owner.SendMessage("{0} Tried to illegaly use an ArmyController.", from.Name);
         }
         Delete();
         PageQueue.Enqueue(new PageEntry(from, "Ce Page a ete envoye par le server: ce joueur a essaye d'utiliser un ArmyControler qui n'etait pas le sien.", PageType.Other));
     }
     else
     {
         if (from == m_Owner)
         {
             from.SendGump(new ArmyGump(this));
         }
         else
         {
             from.SendMessage("This is not yours. The Item has been deleted.");
             if (m_Owner != null)
             {
                 m_Owner.SendMessage("{0} Tried to illegaly use an ArmyController.", from.Name);
             }
             Delete();
             PageQueue.Enqueue(new PageEntry(from, "Ce Page a ete envoye par le server: ce joueur a essaye d'utiliser un ArmyControler qui n'etait pas le sien.", PageType.Other));
         }
     }
 }
Esempio n. 2
0
        private void ParsePage(Page p)
        {
            try
            {
                if (p.IsExternal && !MainSite.ExternalLinks)
                {
                    return;
                }

                var time = new Stopwatch();
                time.Start();
                var doc = _pageManager.DownloadPage(new Uri(p.Url));
                time.Stop();
                decimal ms = time.ElapsedMilliseconds;

                if (string.IsNullOrWhiteSpace(doc?.DocumentNode.OuterHtml))
                {
                    return;
                }

                AddPage(doc, p.Url, ms, p.Depth, p.IsExternal, p.ParentUrl);

                if (p.Depth >= MainSite.Depth)
                {
                    return;
                }

                var links = _pageManager.GetLinks(doc, MainUrl);

                if (links == null)
                {
                    return;
                }

                foreach (var link in links)
                {
                    if (LinksUrl.TryAdd(link))
                    {
                        PageQueue.Enqueue(new Page
                        {
                            Url        = link,
                            Depth      = p.Depth + 1,
                            IsExternal = IsExternal(link),
                            ParentUrl  = p.Url
                        });
                    }
                }
            }
            catch
            {
                //Console.WriteLine(e.Message);
            }
        }
Esempio n. 3
0
        private static void SendPage(Mobile m, string speech, bool jailed, bool banned)
        {
            if (m == null || m.Deleted || !m.Player || String.IsNullOrWhiteSpace(speech) || !CMOptions.PageStaff)
            {
                return;
            }

            PageEntry entry = PageQueue.GetEntry(m);

            if (entry == null || !entry.Message.StartsWith("[Warning: Advertising Detected]"))
            {
                PageQueue.Enqueue(
                    new PageEntry(
                        m, "[Warning: Advertising Detected]: " + GetDetectedString(m, speech, jailed, banned), PageType.Account));
            }
        }
        /*public void CheckSoldiersStatus()
         * {
         *  bool finnished = false;
         *  while (!finnished)
         *  {
         *      if (Soldiers.Count <= 0)
         *          finnished = true;
         *      else
         *          for (int i = 0; i < Soldiers.Count; i++)
         *          {
         *              BaseCreature soldier = (BaseCreature)Soldiers[i];
         *              if (soldier.Deleted || !(soldier.Alive))
         *              {
         *                  Soldiers.RemoveAt(i);
         *                  i = Soldiers.Count;
         *              }
         *              else
         *              {
         *                  if (i >= Soldiers.Count - 1)
         *                      finnished = true;
         *              }
         *          }
         *  }
         *  int delete = 0;
         *  int y = Soldiers.Count;
         *  for (int i = 0; i < y; i++)
         *  {
         *      BaseCreature soldier = (BaseCreature)Soldiers[i];
         *      if (ArmySize > CalculateMaxFollowers(this.Owner))
         *      {
         *          delete++;
         *          soldier.Say("My commander can no longer lead me.");
         *          y--;
         *      }
         *  }
         *  if (delete > 0)
         *  {
         *      for (int x = 0; x < delete; x++)
         *      {
         *          Soldiers.RemoveAt(x);
         *      }
         *  }
         * }*/

        public override void OnDoubleClick(Mobile from)
        {
            //if (from.AccessLevel >= AccessLevel.GameMaster)
            m_Owner = from;
            if (m_Owner == null)
            {
                from.SendMessage("This is not yours. You have been reported.");
                if (m_Owner != null)
                {
                    m_Owner.SendMessage("{0} Tried to illegaly use an ArmyController.", from.Name);
                }
                //Delete();
                PageQueue.Enqueue(new PageEntry(from, "Ce Page a ete envoye par le server: ce joueur a essaye d'utiliser un ArmyControler qui n'etait pas le sien.", PageType.Other));
            }
            else
            {
                if (from == m_Owner)
                {
                    //if(ArmyGump != null)
                    //{
                    from.CloseGump(typeof(ArmyGump));
                    //}
                    from.SendGump(new ArmyGump(this));
                }
                else
                {
                    from.SendMessage("This is not yours. You have been reported.");
                    if (m_Owner != null)
                    {
                        m_Owner.SendMessage("{0} Tried to illegaly use an ArmyController.", from.Name);
                    }
                    //Delete();
                    PageQueue.Enqueue(new PageEntry(from, "Ce Page a ete envoye par le server: ce joueur a essaye d'utiliser un ArmyControler qui n'etait pas le sien.", PageType.Other));
                }
            }
        }
Esempio n. 5
0
        public static void Password_OnCommand(CommandEventArgs e)
        {
            Mobile  from = e.Mobile;
            Account acct = from.Account as Account;

            if (acct == null)
            {
                return;
            }

            IPAddress[] accessList = acct.LoginIPs;

            if (accessList.Length == 0)
            {
                return;
            }

            NetState ns = from.NetState;

            if (ns == null)
            {
                return;
            }

            if (e.Length == 0)
            {
                from.SendMessage("You must specify the new password.");
                return;
            }
            else if (e.Length == 1)
            {
                from.SendMessage("To prevent potential typing mistakes, you must type the password twice. Use the format:");
                from.SendMessage("Password \"(newPassword)\" \"(repeated)\"");
                return;
            }

            string pass  = e.GetString(0);
            string pass2 = e.GetString(1);

            if (pass != pass2)
            {
                from.SendMessage("The passwords do not match.");
                return;
            }

            bool isSafe = true;

            for (int i = 0; isSafe && i < pass.Length; ++i)
            {
                isSafe = (pass[i] >= 0x20 && pass[i] < 0x7F);
            }

            if (!isSafe)
            {
                from.SendMessage("That is not a valid password.");
                return;
            }

            try
            {
                IPAddress ipAddress = ns.Address;

                if (Utility.IPMatchClassC(accessList[0], ipAddress))
                {
                    acct.SetPassword(pass);
                    from.SendMessage("The password to your account has changed.");
                }
                else
                {
                    PageEntry entry = PageQueue.GetEntry(from);

                    if (entry != null)
                    {
                        if (entry.Message.StartsWith("[Automated: Change Password]"))
                        {
                            from.SendMessage("You already have a password change request in the help system queue.");
                        }
                        else
                        {
                            from.SendMessage("Your IP address does not match that which created this account.");
                        }
                    }
                    else if (PageQueue.CheckAllowedToPage(from))
                    {
                        from.SendMessage("Your IP address does not match that which created this account.  A page has been entered into the help system on your behalf.");

                        from.SendLocalizedMessage(501234, "", 0x35); /* The next available Counselor/Game Master will respond as soon as possible.
                                                                      * Please check your Journal for messages every few minutes.
                                                                      */

                        PageQueue.Enqueue(new PageEntry(from, string.Format("[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0]), PageType.Account));
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 6
0
        public static void Password_OnCommand(CommandEventArgs e)
        {
            Mobile  from = e.Mobile;
            Account acct = from.Account as Account;

            if (acct == null)
            {
                return;
            }

            IPAddress[] accessList = acct.LoginIPs;

            if (accessList.Length == 0)
            {
                return;
            }

            NetState ns = from.NetState;

            if (ns == null)
            {
                return;
            }

            if (e.Length == 0)
            {
                from.SendMessage("Musis specifikovat nove heslo.");
                return;
            }
            else if (e.Length == 1)
            {
                from.SendMessage("Kvuly prevenci prekliknuti pri psani hesla, musis zadat sve heslo dvakrat. Pouzij tento format:");
                from.SendMessage(".Heslo \"(Noveheslo)\" \"(ZnovuNoveHeslo)\"");
                return;
            }

            string pass  = e.GetString(0);
            string pass2 = e.GetString(1);

            if (pass != pass2)
            {
                from.SendMessage("Heslo se neshoduje!");
                return;
            }

            bool isSafe = true;

            for (int i = 0; isSafe && i < pass.Length; ++i)
            {
                isSafe = (pass[i] >= 0x20 && pass[i] < 0x80);
            }

            if (!isSafe)
            {
                from.SendMessage("Toto neni platne heslo.");
                return;
            }

            try
            {
                IPAddress ipAddress = ns.Address;

                if (Utility.IPMatchClassC(accessList[0], ipAddress))
                {
                    acct.SetPassword(pass);
                    from.SendMessage("The password to your account has changed.");
                }
                else
                {
                    PageEntry entry = PageQueue.GetEntry(from);

                    if (entry != null)
                    {
                        if (entry.Message.StartsWith("[Automated: Change Password]"))
                        {
                            from.SendMessage("You already have a password change request in the help system queue.");
                        }
                        else
                        {
                            from.SendMessage("Your IP address does not match that which created this account.");
                        }
                    }
                    else if (PageQueue.CheckAllowedToPage(from))
                    {
                        from.SendMessage("Your IP address does not match that which created this account.  A page has been entered into the help system on your behalf.");

                        from.SendLocalizedMessage(501234, "", 0x35);                           /* The next available Counselor/Game Master will respond as soon as possible.
                                                                                                * Please check your Journal for messages every few minutes.
                                                                                                */

                        PageQueue.Enqueue(new PageEntry(from, String.Format("[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0]), PageType.Account));
                    }
                }
            }
            catch
            {
            }
        }