Esempio n. 1
0
        public static async Task ValidateMeAsync(Profile p = null)
        {
            if (!validating)
            {
                validating = true;
                System.Diagnostics.Process.Start(wepAppAdress + "auth\\" + pin);

                MessageBox.Show("Authenticating... Click Ok when Done.");
                validating = false;
                string auth = await client.GetStringAsync(wepAppAdress + "pickup\\" + pin);

                if (auth != "" && auth[0] != '6')
                {
                    DuckStatsNotification.ShowNotification("@TINYLOCK@Local auth set to " + auth, Color.Gray, Color.White);
                    File.WriteAllText(authPath, auth);
                    if (p != null)
                    {
                        UpdateStatsAsync(p);
                    }
                }
                else
                {
                    if (MessageBox.Show("Validate with Steam Before Returning!\n\nTry Again?", "Authentification Failed!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        ValidateMeAsync();
                    }
                    else
                    {
                        DuckStatsNotification.ShowNotification("Auth not established", Color.Orange);
                    }
                }
            }
        }
Esempio n. 2
0
        public void Update(GameTime gameTime)
        {
            if (pin && Level.current is TitleScreen && Level.current.initialized)
            {
                pin = false;

                Vec2 place = statsMod.qol ? new Vec2(240f, 122f) : new Vec2(48, 46);

                Level.Add(new DuckStatsMonkey(place.x, place.y));
                DuckStatsNotification.ShowNotification("Duck Stats by Ziggy", Color.Gold);
            }
        }
Esempio n. 3
0
        public static async Task UpdateStatsAsync(Profile p)
        {
            if (File.Exists(authPath))
            {
                try
                {
                    JObject jo = JObject.FromObject(p.stats);
                    jo.Remove("currentTitle");
                    var response = await client.PostAsync(wepAppAdress + "upload\\" + Steam.user.id, new FormUrlEncodedContent(new Dictionary <string, string>
                    {
                        { "json", jo.ToString() },
                        { "auth", File.ReadAllText(authPath) }
                    }));

                    string resp = await response.Content.ReadAsStringAsync();

                    switch (resp[0])
                    {
                    case '1':
                        DuckStatsNotification.ShowNotification("@CHECK@Stats updated.", Color.Green);
                        SFX.Play("Ding", 0.6f);
                        break;

                    case '0':
                        DuckStatsNotification.ShowNotification("@ONLINEBAD@Invalid Authentification!", Color.Red);
                        ValidateMeAsync(p);
                        break;

                    case '2':
                        DuckStatsNotification.ShowNotification("Invalid Stats!", Color.Red);
                        break;

                    case '3':
                        DuckStatsNotification.ShowNotification("@TICKET@Unkown Duck; Authenticating...", Color.Orange);
                        ValidateMeAsync(p);
                        break;
                    }
                }
                catch
                {
                    DuckStatsNotification.ShowNotification("ERROR Connecting With Server! Better Tell Ziggy!", Color.Red);
                }
            }
            else
            {
                ValidateMeAsync(p);
            }
        }
Esempio n. 4
0
        public static async void OpenStatsViewer(Profile p, UIMenu closeThereFrom)
        {
            try
            {
                string s = await statsWork.client.GetStringAsync(statsWork.wepAppAdress + "stats\\" + p.steamID);

                if (s == "" || s[0] == '8')
                {
                    DuckStatsNotification.ShowNotification("This Duck Has Not Uploaded His Stats");
                }
                else
                {
                    Dictionary <string, string> stats = JsonConvert.DeserializeObject <Dictionary <string, string> >(s);

                    statsMenu = new UIMenu("@PLANET@" + p.name + "'s Stats@PLANET@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, -1, -1);

                    foreach (KeyValuePair <string, string> kv in stats)
                    {
                        UIText i = new UIText(kv.Key + " |GRAY|: |DGBLUE|" + kv.Value, Color.Yellow);
                        i.scale          = new Vec2(statScale, statScale);
                        i.collisionSize *= statScale;
                        statsMenu.Add(i);
                    }

                    statsMenu.SetBackFunction(new UIMenuActionCallFunction(delegate()
                    {
                        CloseStatsViewer(p);
                    }));

                    closeThereFrom?.Close();

                    statsMenu.Resize();
                    MonoMain.pauseMenu = statsMenu;
                    statsMenu.Open();
                    Level.Add(statsMenu);
                }
            }
            catch
            {
                DuckStatsNotification.ShowNotification("@UNPLUG@ERROR viewing stats! Better Tell Ziggy!", Color.Red);
                CloseStatsViewer(p);
                return;
            }
        }