Exemplo n.º 1
0
        public static void PrintWaipoint(string target)
        {
            if (waipointHt == null)
            {
                waipointHt = new Hashtable();
            }

            if (target == "none")
            {
                Notepad.Write(World.Player.X + "." + World.Player.Y + "|");
                World.Player.PrintMessage("[Print...]");
            }
            else
            {
                TargetInfo info = new TargetInfo(target).GetTarget();
                if (info.Success && waipointHt[info.Character.Serial] == null)
                {
                    waipointHt[info.Character.Serial] = info;
                    string name = String.Empty;
                    if (info.Object.Exist && String.IsNullOrEmpty(info.Object.Name))
                    {
                        info.Object.Click();
                        Game.Wait(100);
                    }

                    name = info.Object.Name;

                    Notepad.Write(info.StaticTarget.X + "." + info.StaticTarget.Y + (String.IsNullOrEmpty(name) ? "" : "//" + name) + "|");

                    info.Character.PrintMessage("[Print...]");
                }
                else
                {
                    World.Player.PrintMessage("Neni klamak", Game.Val_LightPurple);
                }
            }
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------------------------------

        public static DateTime GetTimeFromUrl(string url)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;


            if (String.IsNullOrEmpty(url))
            {
                url = "https://www.darkparadise.eu/api.php?lastsave";
            }

            string data = String.Empty;

            using (WebClient client = new WebClient())
            {
                try
                {
                    data = client.DownloadString(url);
                    UO.Wait(300);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Ex" + ex.Message);
                    System.Diagnostics.Debug.WriteLine("" + ex.Message);
                    System.Diagnostics.Debug.WriteLine("" + ex.StackTrace);
                    Notepad.Write(ex.StackTrace);
                }
            }

            var matches = Regex.Matches(data, "\"(?<name>[a-z]+)\": \"(?<value>\\d+)\"");

            int hour   = 0;
            int minute = 0;
            int day    = 1;
            int month  = 1;
            int year   = 1;

            string shour   = "";
            string sminute = "";
            string sday    = "";
            string smonth  = "";
            string syear   = "";

            foreach (Match m in matches)
            {
                string name  = m.Groups["name"].Value;
                string value = m.Groups["value"].Value;

                switch (name)
                {
                case "hour":
                    shour = m.Groups["value"].Value;
                    hour  = Int32.Parse(m.Groups["value"].Value);
                    break;

                case "minute":
                    sminute = m.Groups["value"].Value;
                    minute  = Int32.Parse(m.Groups["value"].Value);
                    break;

                case "day":
                    sday = m.Groups["value"].Value;
                    day  = Int32.Parse(m.Groups["value"].Value);
                    break;

                case "month":
                    smonth = m.Groups["value"].Value;
                    month  = Int32.Parse(m.Groups["value"].Value);
                    break;

                case "year":
                    syear = m.Groups["value"].Value;
                    year  = Int32.Parse(m.Groups["value"].Value);
                    break;
                }
            }

            System.Diagnostics.Debug.WriteLine(String.Format("GetTimeFromUrl: " + url + " {0:g}", new DateTime(year, month, day, hour, minute, 0)));
            System.Diagnostics.Debug.WriteLine(String.Format("GetTimeFromUrl RAW data: " + url + " {0}", data));
            System.Diagnostics.Debug.WriteLine(String.Format("GetTimeFromUrl RAW: " + url + " {0}, {1}, {2}, {3}, {4}", shour, sminute, sday, smonth, syear));

            return(new DateTime(year, month, day, hour, minute, 0));
        }