예제 #1
0
        protected override void OnRun(CommandDetails details)
        {
            if (details.Args.Length == 0)
            {
                IRC.Instance.Send(details.Channel, "{0}: SteamID argument required", details.Sender.Nickname);
                return;
            }

            var     inputId = details.Args[0];
            SteamID steamId;

            if (!SteamUtils.TryDeduceSteamID(inputId, out steamId))
            {
                IRC.Instance.Send(details.Channel, "{0}: Unable to deduce SteamID from given input", details.Sender.Nickname);
                return;
            }

            IRC.Instance.Send(details.Channel, "{0}: {1}", details.Sender.Nickname, SteamUtils.ExpandSteamID(steamId));

            if (!Steam.Instance.Connected)
            {
                IRC.Instance.Send(details.Channel, details.Sender.Nickname + ": Unable to request persona info: not connected to Steam!");
                return;
            }

            if (steamId.IsIndividualAccount || steamId.IsClanAccount)
            {
                AddRequest(details, new Request {
                    SteamID = steamId
                });
                Steam.Instance.Friends.RequestFriendInfo(steamId, ( EClientPersonaStateFlag )short.MaxValue);
            }
        }
예제 #2
0
        protected override void OnRun(CommandDetails details)
        {
            if (details.Args.Length == 0)
            {
                IRC.Instance.Send(details.Channel, "{0}: SteamID argument required", details.Sender.Nickname);
                return;
            }

            var     inputId = details.Args[0];
            SteamID steamId;

            if (!SteamUtils.TryDeduceSteamID(inputId, out steamId))
            {
                IRC.Instance.Send(details.Channel, "{0}: Unable to deduce SteamID from given input", details.Sender.Nickname);
                return;
            }

            if (!Steam.Instance.Connected)
            {
                IRC.Instance.Send(details.Channel, "{0}: Unable to request profile info: not connected to Steam!", details.Sender.Nickname);
                return;
            }

            if (steamId.IsIndividualAccount)
            {
                var jobId = Steam.Instance.Friends.RequestProfileInfo(steamId);
                AddRequest(details, new Request {
                    JobID = jobId, SteamID = steamId
                });
            }
            else
            {
                IRC.Instance.Send(details.Channel, "{0}: Unable to request profile info: Not an individual account!", details.Sender.Nickname);
            }
        }
예제 #3
0
        protected override void OnRun(CommandDetails details)
        {
            if (details.Args.Length == 0)
            {
                IRC.Instance.Send(details.Channel, "{0}: SteamID argument required", details.Sender.Nickname);
                return;
            }

            var     inputId = details.Args[0];
            SteamID steamId;

            if (!SteamUtils.TryDeduceSteamID(inputId, out steamId))
            {
                IRC.Instance.Send(details.Channel, "{0}: Unable to deduce SteamID from given input", details.Sender.Nickname);
                return;
            }

            if (!Steam.Instance.Connected)
            {
                IRC.Instance.Send(details.Channel, details.Sender.Nickname + ": Unable to request steam level: not connected to Steam!");
                return;
            }

            JobID job = Steam.Instance.Levels.RequestLevels(new SteamID[] { steamId });

            AddRequest(details, new Request {
                Job = job, SteamID = steamId
            });
        }
예제 #4
0
        protected override void OnRun(CommandDetails details)
        {
            if (details.Args.Length == 0)
            {
                IRC.Instance.Send(details.Channel, "{0}: GameID argument required", details.Sender.Nickname);
                return;
            }

            ulong gameId;

            if (!ulong.TryParse(details.Args[0], out gameId))
            {
                IRC.Instance.Send(details.Channel, "{0}: Invalid GameID", details.Sender.Nickname);
                return;
            }

            IRC.Instance.Send(details.Channel, "{0}: {1}", details.Sender.Nickname, SteamUtils.ExpandGameID(gameId));
        }
예제 #5
0
        protected override void OnRun(CommandDetails details)
        {
            if (details.Args.Length == 0)
            {
                IRC.Instance.Send(details.Channel, "{0}: GID argument required", details.Sender.Nickname);
                return;
            }

            var inputGid = details.Args[0];

            ulong ulGid;

            if (!ulong.TryParse(inputGid, out ulGid))
            {
                IRC.Instance.Send(details.Channel, "{0}: Invalid GID", details.Sender.Nickname);
                return;
            }

            GlobalID gid = ulGid;

            IRC.Instance.Send(details.Channel, "{0}: {1}", details.Sender.Nickname, SteamUtils.ExpandGID(gid));
        }
예제 #6
0
        protected override void OnRun(CommandDetails details)
        {
            if (details.Args.Length < 4)
            {
                IRC.Instance.Send(details.Channel, "{0}: Usage: !makesid <universe> <type> <instance> <id>", details.Sender.Nickname);
                return;
            }

            string univ     = details.Args[0];
            string type     = details.Args[1];
            string instance = details.Args[2];
            string id       = details.Args[3];

            EUniverse eUniv;

            if (!Enum.TryParse(univ, true, out eUniv))
            {
                IRC.Instance.Send(details.Channel, "{0}: Invalid universe, should be one of: {1}",
                                  details.Sender.Nickname, string.Join(", ", Enum.GetNames(typeof(EUniverse)))
                                  );

                return;
            }

            EAccountType eType;

            if (!Enum.TryParse(type, true, out eType))
            {
                IRC.Instance.Send(details.Channel, "{0}: Invalid account type, should be one of: {1}",
                                  details.Sender.Nickname, string.Join(", ", Enum.GetNames(typeof(EAccountType)))
                                  );

                return;
            }

            uint uiInstance = 0;

            switch (instance.ToLower())
            {
            case "desktop":
                uiInstance = SteamID.DesktopInstance;
                break;

            case "console":
                uiInstance = SteamID.ConsoleInstance;
                break;

            case "web":
                uiInstance = SteamID.WebInstance;
                break;

            case "all":
                uiInstance = SteamID.AllInstances;
                break;

            default:
                SteamID.ChatInstanceFlags instanceFlags;
                if (Enum.TryParse(instance, true, out instanceFlags))
                {
                    uiInstance = ( uint )instanceFlags;
                    break;
                }

                if (!uint.TryParse(instance, out uiInstance))
                {
                    IRC.Instance.Send(details.Channel, "{0}: Invalid instance! (desktop, console, web, all, clan, lobby, mmslobby, #)", details.Sender.Nickname);
                    return;
                }
                break;
            }

            uint accountId;

            if (!uint.TryParse(id, out accountId))
            {
                SteamID steamId;
                if (!SteamUtils.TryDeduceSteamID(id, out steamId))
                {
                    IRC.Instance.Send(details.Channel, "{0}: Invalid (or undeducible) account id!", details.Sender.Nickname);
                    return;
                }

                accountId = steamId.AccountID;
            }

            SteamID steamID = new SteamID(accountId, uiInstance, eUniv, eType);

            var sidCommand = IRC.Instance.CommandManager.RegisteredCommands
                             .SingleOrDefault(c => c is SIDCommand);

            if (sidCommand != null)
            {
                // loading up on the dirty hacks
                details.Args = new string[] { steamID.ConvertToUInt64().ToString() };
                sidCommand.DoRun(details);
            }
            else
            {
                IRC.Instance.Send(details.Channel, "{0}: An internal error has occurred", details.Sender.Nickname);
                Log.WriteError("MakeSIDCommand", "Unable to find SIDCommand!");
            }
        }