Beispiel #1
0
        public override void HandleResponse(JObject response)
        {
            if ((int)response["meta"]["next_check"] > 0)
            {
                Tebex.Instance.nextCheck = (int)response["meta"]["next_check"];
                //Tebex.Instance.nextCheck = 60;
            }

            if ((bool)response["meta"]["execute_offline"])
            {
                try
                {
                    TebexCommandRunner.doOfflineCommands();
                }
                catch (Exception e)
                {
                    Tebex.logError(e.ToString());
                }
            }

            JArray players = (JArray)response["players"];

            var onlinePlayers = MySession.Static.Players.GetOnlinePlayers();

            if (onlinePlayers.Count == 0)
            {
                return;
            }

            foreach (var player in players)
            {
                try
                {
                    ulong      steamId      = (ulong)player["uuid"];
                    long       identityId   = MySession.Static.Players.TryGetIdentityId(steamId);
                    MyIdentity targetPlayer = MySession.Static.Players.TryGetIdentity(identityId);

                    bool playerOnline = false;
                    foreach (var onlinePlr in onlinePlayers)
                    {
                        if (onlinePlr.Id.SteamId == steamId)
                        {
                            playerOnline = true;
                        }
                    }

                    if (playerOnline)
                    {
                        Tebex.logWarning("Execute commands for " + (string)targetPlayer.DisplayName + "(ID: " + steamId.ToString() + ")");
                        TebexCommandRunner.doOnlineCommands((int)player["id"], (string)targetPlayer.DisplayName,
                                                            steamId.ToString());
                    }
                }
                catch (Exception e)
                {
                    Tebex.logError(e.Message);
                }
            }
        }
Beispiel #2
0
 public void TebexInfo()
 {
     try
     {
         TebexApiClient wc = new TebexApiClient();
         wc.setPlugin(Tebex.Instance);
         wc.DoGet("information", this);
         wc.Dispose();
     }
     catch (TimeoutException)
     {
         Tebex.logWarning("Timeout!");
     }
 }
Beispiel #3
0
        public override void HandleResponse(JObject response)
        {
            Tebex.Instance.information.id             = (int)response["account"]["id"];
            Tebex.Instance.information.domain         = (string)response["account"]["domain"];
            Tebex.Instance.information.gameType       = (string)response["account"]["game_type"];
            Tebex.Instance.information.name           = (string)response["account"]["name"];
            Tebex.Instance.information.currency       = (string)response["account"]["currency"]["iso_4217"];
            Tebex.Instance.information.currencySymbol = (string)response["account"]["currency"]["symbol"];
            Tebex.Instance.information.serverId       = (int)response["server"]["id"];
            Tebex.Instance.information.serverName     = (string)response["server"]["name"];

            Tebex.logWarning("Your secret key has been validated! Webstore Name: " + Tebex.Instance.information.name);
            Context.Respond("Your secret key has been validated! Webstore Name: " + Tebex.Instance.information.name);
        }
Beispiel #4
0
 public void TebexForcecheck()
 {
     Tebex.logWarning("Checking for commands to be executed...");
     try
     {
         TebexApiClient wc = new TebexApiClient();
         wc.setPlugin(Tebex.Instance);
         wc.DoGet("queue", this);
         wc.Dispose();
     }
     catch (TimeoutException)
     {
         Tebex.logWarning("Timeout!");
     }
 }
Beispiel #5
0
        public void TebexSecret(string secret)
        {
            Tebex.Instance.Config.Secret = secret;

            try
            {
                TebexApiClient wc = new TebexApiClient();
                wc.setPlugin(Tebex.Instance);
                wc.DoGet("information", this);
                wc.Dispose();
            }
            catch (TimeoutException)
            {
                Tebex.logWarning("Timeout!");
            }
        }
Beispiel #6
0
        public override void HandleResponse(JObject response)
        {
            Tebex.Instance.information.id             = (int)response["account"]["id"];
            Tebex.Instance.information.domain         = (string)response["account"]["domain"];
            Tebex.Instance.information.gameType       = (string)response["account"]["game_type"];
            Tebex.Instance.information.name           = (string)response["account"]["name"];
            Tebex.Instance.information.currency       = (string)response["account"]["currency"]["iso_4217"];
            Tebex.Instance.information.currencySymbol = (string)response["account"]["currency"]["symbol"];
            Tebex.Instance.information.serverId       = (int)response["server"]["id"];
            Tebex.Instance.information.serverName     = (string)response["server"]["name"];

            Tebex.logInfo("Server Information");
            Tebex.logInfo("=================");
            Tebex.logInfo("Server " + Tebex.Instance.information.serverName + " for webstore " + Tebex.Instance.information.name + "");
            Tebex.logInfo("Server prices are in " + Tebex.Instance.information.currency + "");
            Tebex.logInfo("Webstore domain: " + Tebex.Instance.information.domain + "");
        }
Beispiel #7
0
 public override void HandleError(Exception e)
 {
     Tebex.logError("We are unable to fetch your server details. Please check your secret key.");
 }
Beispiel #8
0
 public override void HandleError(Exception e)
 {
     Tebex.logError("We were unable to validate your secret key.");
     Context.Respond("We were unable to validate your secret key.");
 }
Beispiel #9
0
 public override void HandleError(Exception e)
 {
     Tebex.logError("We are unable to fetch your server queue. Please check your secret key.");
     Tebex.logError(e.ToString());
 }