Пример #1
0
        public static string GetStats(SteamAPI.SteamID steamID)
        {
            try
            {
                if (!Global.MediaPlayer.IsOnline) return "Error: {ls}Unable to retrieve data{rs}";

                WebClient wc = new WebClient();
                string result = wc.DownloadString("http://steamp3.ta0soft.com/stats.php?xml=1&id=" + steamID.ToUInt64().ToString());

                XmlDocument xml = new XmlDocument();
                xml.LoadXml(result);
                XmlNodeList users = xml.SelectNodes("Steamp3.Stats/Users/User");

                foreach (XmlNode user in users)
                {
                    if (GetXmlValue(user, "ID", "0") == steamID.ToUInt64().ToString())
                    {
                        int achieved = 0;
                        XmlNode achievements = user.SelectSingleNode("Achievements");

                        int commandsUsed = StringToInt(GetXmlValue(user, "CommandsUsed", "0"));
                        int songsPlayed = StringToInt(GetXmlValue(user, "SongsPlayed", "0"));
                        int songsCompleted = StringToInt(GetXmlValue(user, "SongsCompleted", "0"));
                        string song = GetXmlValue(user, "Song", "N/A");
                        string userSince = ConvertUnixDate(StringToInt(GetXmlValue(user, "UserSince", "0")), "Never");
                        string lastOnline = ConvertUnixDate(StringToInt(GetXmlValue(user, "LastOnline", "0")), "Never");
                        string playTime = ConvertSeconds(StringToInt(GetXmlValue(user, "PlayTime", "0")), false);
                        string runTime = ConvertSeconds(StringToInt(GetXmlValue(user, "RunTime", "0")), false);

                        int chattyCathy = StringToInt(GetXmlValue(achievements, "ChattyCathy", "0"));
                        int jukeboxHero = StringToInt(GetXmlValue(achievements, "JukeboxHero", "0"));
                        int leetHaxor = StringToInt(GetXmlValue(achievements, "LeetHaxor", "0"));
                        int mp3Playah = StringToInt(GetXmlValue(achievements, "MP3Playah", "0"));
                        int radioStar = StringToInt(GetXmlValue(achievements, "RadioStar", "0"));
                        int repetition = StringToInt(GetXmlValue(achievements, "Repetition", "0"));
                        int shamelessPlug = StringToInt(GetXmlValue(achievements, "ShamelessPlug", "0"));
                        int shortStop = StringToInt(GetXmlValue(achievements, "ShortStop", "0"));
                        int skinnyDipper = StringToInt(GetXmlValue(achievements, "SkinnyDipper", "0"));

                        UI.Achievement achievement = Global.MainWindow.AchievementList.GetItemByID("cc");
                        if (achievement != null && chattyCathy == achievement.Maximum) achieved++;

                        achievement = Global.MainWindow.AchievementList.GetItemByID("jh");
                        if (achievement != null && jukeboxHero == achievement.Maximum) achieved++;

                        achievement = Global.MainWindow.AchievementList.GetItemByID("lh");
                        if (achievement != null && leetHaxor == achievement.Maximum) achieved++;

                        achievement = Global.MainWindow.AchievementList.GetItemByID("mp");
                        if (achievement != null && mp3Playah == achievement.Maximum) achieved++;

                        achievement = Global.MainWindow.AchievementList.GetItemByID("rs");
                        if (achievement != null && radioStar == achievement.Maximum) achieved++;

                        achievement = Global.MainWindow.AchievementList.GetItemByID("rp");
                        if (achievement != null && repetition == achievement.Maximum) achieved++;

                        achievement = Global.MainWindow.AchievementList.GetItemByID("sh");
                        if (achievement != null && shamelessPlug == achievement.Maximum) achieved++;

                        achievement = Global.MainWindow.AchievementList.GetItemByID("ss");
                        if (achievement != null && shortStop == achievement.Maximum) achieved++;

                        achievement = Global.MainWindow.AchievementList.GetItemByID("sd");
                        if (achievement != null && skinnyDipper == achievement.Maximum) achieved++;

                        return "STEAMp3 stats for: {ls}" + Steam.Client.GetFriendPersonaName(steamID) + "{rs}" + Environment.NewLine + "Achievements: {ls}" + achieved.ToString() + " / " + FormatNumber(Global.MainWindow.AchievementList.Items.Count) + "{rs} Commands used: {ls}" + FormatNumber(commandsUsed) + "{rs}" + Environment.NewLine + "Songs played: {ls}" + FormatNumber(songsPlayed) + "{rs} Songs completed: {ls}" + FormatNumber(songsCompleted) + "{rs}" + Environment.NewLine + "User since: {ls}" + userSince + "{rs} Last online: {ls}" + lastOnline + "{rs}" + Environment.NewLine + "Play-time: {ls}" + playTime + "{rs} Run-time: {ls}" + runTime + "{rs}" + Environment.NewLine + "Recently played: {ls}" + song + "{rs}";
                    }
                }

                return "User not found: {ls}" + Steam.Client.GetFriendPersonaName(steamID) + "{rs}";
            }
            catch
            {
                return "Error: {ls}Unable to retrieve data{rs}";
            }
        }
Пример #2
0
        public static string GetAchieved(SteamAPI.SteamID steamID)
        {
            try
            {
                if (!Global.MediaPlayer.IsOnline) return "Error: {ls}Unable to retrieve data{rs}";

                WebClient wc = new WebClient();
                string result = wc.DownloadString("http://steamp3.ta0soft.com/stats.php?id=" + steamID.ToUInt64().ToString() + "&xml=1");

                XmlDocument xml = new XmlDocument();
                xml.LoadXml(result);
                XmlNodeList users = xml.SelectNodes("Steamp3.Stats/Users/User");

                foreach (XmlNode user in users)
                {
                    if (GetXmlValue(user, "ID", "0") == steamID.ToUInt64().ToString())
                    {
                        result = "";
                        int achieved = 0;
                        XmlNode achievements = user.SelectSingleNode("Achievements");

                        int chattyCathy = StringToInt(GetXmlValue(achievements, "ChattyCathy", "0"));
                        int jukeboxHero = StringToInt(GetXmlValue(achievements, "JukeboxHero", "0"));
                        int leetHaxor = StringToInt(GetXmlValue(achievements, "LeetHaxor", "0"));
                        int mp3Playah = StringToInt(GetXmlValue(achievements, "MP3Playah", "0"));
                        int radioStar = StringToInt(GetXmlValue(achievements, "RadioStar", "0"));
                        int repetition = StringToInt(GetXmlValue(achievements, "Repetition", "0"));
                        int shamelessPlug = StringToInt(GetXmlValue(achievements, "ShamelessPlug", "0"));
                        int shortStop = StringToInt(GetXmlValue(achievements, "ShortStop", "0"));
                        int skinnyDipper = StringToInt(GetXmlValue(achievements, "SkinnyDipper", "0"));

                        UI.Achievement achievement = Global.MainWindow.AchievementList.GetItemByID("cc");
                        if (achievement != null && chattyCathy == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        achievement = Global.MainWindow.AchievementList.GetItemByID("jh");
                        if (achievement != null && jukeboxHero == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        achievement = Global.MainWindow.AchievementList.GetItemByID("lh");
                        if (achievement != null && leetHaxor == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        achievement = Global.MainWindow.AchievementList.GetItemByID("mp");
                        if (achievement != null && mp3Playah == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        achievement = Global.MainWindow.AchievementList.GetItemByID("rs");
                        if (achievement != null && radioStar == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        achievement = Global.MainWindow.AchievementList.GetItemByID("rp");
                        if (achievement != null && repetition == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        achievement = Global.MainWindow.AchievementList.GetItemByID("sh");
                        if (achievement != null && shamelessPlug == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        achievement = Global.MainWindow.AchievementList.GetItemByID("ss");
                        if (achievement != null && shortStop == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        achievement = Global.MainWindow.AchievementList.GetItemByID("sd");
                        if (achievement != null && skinnyDipper == achievement.Maximum)
                        {
                            achieved++;
                            result += achievement.Name + ", ";
                        }

                        if (!string.IsNullOrEmpty(result)) result = result.Substring(0, result.Length - 2);

                        return "{ls}" + Global.Steam.Client.GetFriendPersonaName(steamID) + "{rs} Achievements earned: {ls}" + achieved.ToString() + " / " +  FormatNumber(Global.MainWindow.AchievementList.Items.Count) + "{rs}" + Environment.NewLine + result;
                    }
                }

                return "User not found: {ls}" + Steam.Client.GetFriendPersonaName(steamID) + "{rs}";
            }
            catch
            {
                return "Error: {ls}Unable to retrieve data{rs}";
            }
        }
Пример #3
0
        public static string GetCommunityID(SteamAPI.SteamID steamID)
        {
            try
            {
                if (!Global.MediaPlayer.IsOnline) return string.Empty;

                WebClient wc = new WebClient();
                //string result = wc.DownloadString("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0001/?key=C341BF941A262342916AF6F150B59031&steamids=" + steamID.ToInt64().ToString() + "&format=xml");
                string result = wc.DownloadString("http://steamcommunity.com/profiles/" + steamID.ToUInt64().ToString() + "?xml=1");
                XmlDocument xml = new XmlDocument();
                xml.LoadXml(result);
                XmlNode id = xml.SelectSingleNode("profile/customURL");

                if (id == null || string.IsNullOrEmpty(id.InnerText)) return steamID.ToUInt64().ToString();
                return id.InnerText;
            }
            catch
            {
                return steamID.ToUInt64().ToString();
            }
        }