Esempio n. 1
0
    public static IEnumerator GetStories()
    {
        WWW wWW = new WWW("http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=252490&count=8&format=json&feeds=steam_community_announcements");

        yield return(wWW);

        JSON.Object objs = JSON.Object.Parse(wWW.text);
        wWW.Dispose();
        if (objs == null)
        {
            yield break;
        }
        JSON.Array array = objs.GetObject("appnews").GetArray("newsitems");
        List <SteamNewsSource.Story> stories = new List <SteamNewsSource.Story>();

        foreach (Value value in array)
        {
            string str = value.Obj.GetString("contents", "Missing URL");
            SteamNewsSource.Story story = new SteamNewsSource.Story()
            {
                name   = value.Obj.GetString("title", "Missing Title"),
                url    = value.Obj.GetString("url", "Missing URL"),
                date   = value.Obj.GetInt("date", 0),
                text   = str,
                author = value.Obj.GetString("author", "Missing Author")
            };
            stories.Add(story);
        }
        SteamNewsSource.Stories = stories.ToArray();
    }
Esempio n. 2
0
 // Token: 0x06004B3A RID: 19258 RVA: 0x00149398 File Offset: 0x00147598
 public static bool IsOfficialServer(string serverIP)
 {
     if (ServerListConfig.instance == null)
     {
         return(false);
     }
     if (!ServerListConfig.instance.config.isLoaded)
     {
         return(false);
     }
     JSON.Array array = ServerListConfig.instance.config.json.GetArray("servers_official");
     foreach (Value value in array)
     {
         if (serverIP.StartsWith(value.Str))
         {
             return(true);
         }
     }
     return(false);
 }
        public void On_PluginInit()
        {
            Author = "Pluton Team";
            About = "Control who can run which commands";
            Version = "0.4";
            IniParser settings = Plugin.CreateIni("Settings");
            if (settings != null)
            {
                settings["Settings"]["Debug"] = "false";
            }
            Commands.Register("permissions").setCallback(Permission).setDescription("Add or Remove people in permissions").setCommand(example);
            if (!Plugin.JsonFileExists("permissions"))
            {
                //{"players":{"734583538534583":["godmode","teleport"],"734582394234223":["jail","pizza","yolo"]},"groups":{"Default":{"name":"default","tag":"[Default]","permissions":["players","help","whois","whatis","whereami","howto","commands"],"players":["*"]},"Admins":{"name":"Admins","tag":"[Admins]","permissions":["godmode","pikachu","squirdle"],"players":["734583538534583","73423422334583"]}}}
                JSON.Object perms = new JSON.Object();

                //Top level
                JSON.Object players = new JSON.Object();
                JSON.Object groups = new JSON.Object();

                // Groups 2nd level (Players is default empty)
                JSON.Object groupsdefault = new JSON.Object();
                JSON.Object groupsadmin = new JSON.Object();
                JSON.Object groupsmod = new JSON.Object();
                JSON.Object groupsdon = new JSON.Object();

                // Groups 3 level - Default
                JSON.Array groupsdefperms = new JSON.Array();
                JSON.Array groupsdefplayers = new JSON.Array();
                groupsdefault["name"] = new JSON.Value("default");
                groupsdefault["tag"] = new JSON.Value("[Default]");
                foreach (string command in dcommands)
                    groupsdefperms.Add(new JSON.Value(command));
                groupsdefault["permissions"] = new JSON.Value(groupsdefperms);
                groupsdefplayers.Add(new JSON.Value("*"));
                groupsdefault["players"] = new JSON.Value(groupsdefplayers);

                // Groups 3 level - Admin
                JSON.Array groupsadmperms = new JSON.Array() { "ban", "kick", "mute" };
                JSON.Array groupsadmplayers = new JSON.Array();
                groupsadmin["name"] = new JSON.Value("admin");
                groupsadmin["tag"] = new JSON.Value("[Admin]");
                //groupsadmperms.Add(new JSON.Value(groupsadmperms));
                groupsadmin["permissions"] = new JSON.Value(groupsadmperms);
                groupsadmplayers.Add(new JSON.Value(""));
                groupsadmin["players"] = new JSON.Value(groupsadmplayers);

                // Groups 3 level - Moderator
                JSON.Array groupsmodperms = new JSON.Array() { "kick", "mute" };
                JSON.Array groupsmodplayers = new JSON.Array();
                groupsmod["name"] = new JSON.Value("moderator");
                groupsmod["tag"] = new JSON.Value("[Mod]");
                //groupsadmperms.Add(new JSON.Value(groupsmodperms));
                groupsmod["permissions"] = new JSON.Value(groupsmodperms);
                groupsmodplayers.Add(new JSON.Value(""));
                groupsmod["players"] = new JSON.Value(groupsmodplayers);

                // Groups 3 level - Donator
                JSON.Array groupsdonperms = new JSON.Array() { "funstuff", "extrakits" };
                JSON.Array groupsdonplayers = new JSON.Array();
                groupsdon["name"] = new JSON.Value("donator");
                groupsdon["tag"] = new JSON.Value("[Donator]");
                //groupsdonperms.Add(new JSON.Value(groupsdonperms));
                groupsdon["permissions"] = new JSON.Value(groupsdonperms);
                groupsdonplayers.Add(new JSON.Value(""));
                groupsdon["players"] = new JSON.Value(groupsdonplayers);

                //Combine all groups into main
                groups["Default"] = new JSON.Value(groupsdefault);
                groups["Admin"] = new JSON.Value(groupsadmin);
                groups["Moderator"] = new JSON.Value(groupsmod);
                groups["Donator"] = new JSON.Value(groupsmod);

                //Finish up by combining players and groups into 1 and stringify
                perms["players"] = new JSON.Value(players);
                perms["groups"] = new JSON.Value(groups);
                string json = perms.ToString();
                Plugin.ToJsonFile("permissions", json);
            }
            IniParser getsettings = Plugin.GetIni("Settings");
            debug = getsettings["Settings"]["Debug"].ToLower() == "true";
            json_perms = Plugin.FromJsonFile("permissions");
        }
        public void On_PluginInit()
        {
            Author  = "Pluton Team";
            About   = "Control who can run which commands";
            Version = "0.4";
            IniParser settings = Plugin.CreateIni("Settings");

            if (settings != null)
            {
                settings["Settings"]["Debug"] = "false";
            }
            Commands.Register("permissions").setCallback(Permission).setDescription("Add or Remove people in permissions").setCommand(example);
            if (!Plugin.JsonFileExists("permissions"))
            {
                //{"players":{"734583538534583":["godmode","teleport"],"734582394234223":["jail","pizza","yolo"]},"groups":{"Default":{"name":"default","tag":"[Default]","permissions":["players","help","whois","whatis","whereami","howto","commands"],"players":["*"]},"Admins":{"name":"Admins","tag":"[Admins]","permissions":["godmode","pikachu","squirdle"],"players":["734583538534583","73423422334583"]}}}
                JSON.Object perms = new JSON.Object();

                //Top level
                JSON.Object players = new JSON.Object();
                JSON.Object groups  = new JSON.Object();

                // Groups 2nd level (Players is default empty)
                JSON.Object groupsdefault = new JSON.Object();
                JSON.Object groupsadmin   = new JSON.Object();
                JSON.Object groupsmod     = new JSON.Object();
                JSON.Object groupsdon     = new JSON.Object();

                // Groups 3 level - Default
                JSON.Array groupsdefperms   = new JSON.Array();
                JSON.Array groupsdefplayers = new JSON.Array();
                groupsdefault["name"] = new JSON.Value("default");
                groupsdefault["tag"]  = new JSON.Value("[Default]");
                foreach (string command in dcommands)
                {
                    groupsdefperms.Add(new JSON.Value(command));
                }
                groupsdefault["permissions"] = new JSON.Value(groupsdefperms);
                groupsdefplayers.Add(new JSON.Value("*"));
                groupsdefault["players"] = new JSON.Value(groupsdefplayers);

                // Groups 3 level - Admin
                JSON.Array groupsadmperms = new JSON.Array()
                {
                    "ban", "kick", "mute"
                };
                JSON.Array groupsadmplayers = new JSON.Array();
                groupsadmin["name"] = new JSON.Value("admin");
                groupsadmin["tag"]  = new JSON.Value("[Admin]");
                //groupsadmperms.Add(new JSON.Value(groupsadmperms));
                groupsadmin["permissions"] = new JSON.Value(groupsadmperms);
                groupsadmplayers.Add(new JSON.Value(""));
                groupsadmin["players"] = new JSON.Value(groupsadmplayers);

                // Groups 3 level - Moderator
                JSON.Array groupsmodperms = new JSON.Array()
                {
                    "kick", "mute"
                };
                JSON.Array groupsmodplayers = new JSON.Array();
                groupsmod["name"] = new JSON.Value("moderator");
                groupsmod["tag"]  = new JSON.Value("[Mod]");
                //groupsadmperms.Add(new JSON.Value(groupsmodperms));
                groupsmod["permissions"] = new JSON.Value(groupsmodperms);
                groupsmodplayers.Add(new JSON.Value(""));
                groupsmod["players"] = new JSON.Value(groupsmodplayers);

                // Groups 3 level - Donator
                JSON.Array groupsdonperms = new JSON.Array()
                {
                    "funstuff", "extrakits"
                };
                JSON.Array groupsdonplayers = new JSON.Array();
                groupsdon["name"] = new JSON.Value("donator");
                groupsdon["tag"]  = new JSON.Value("[Donator]");
                //groupsdonperms.Add(new JSON.Value(groupsdonperms));
                groupsdon["permissions"] = new JSON.Value(groupsdonperms);
                groupsdonplayers.Add(new JSON.Value(""));
                groupsdon["players"] = new JSON.Value(groupsdonplayers);

                //Combine all groups into main
                groups["Default"]   = new JSON.Value(groupsdefault);
                groups["Admin"]     = new JSON.Value(groupsadmin);
                groups["Moderator"] = new JSON.Value(groupsmod);
                groups["Donator"]   = new JSON.Value(groupsmod);

                //Finish up by combining players and groups into 1 and stringify
                perms["players"] = new JSON.Value(players);
                perms["groups"]  = new JSON.Value(groups);
                string json = perms.ToString();
                Plugin.ToJsonFile("permissions", json);
            }
            IniParser getsettings = Plugin.GetIni("Settings");

            debug      = getsettings["Settings"]["Debug"].ToLower() == "true";
            json_perms = Plugin.FromJsonFile("permissions");
        }