Exemplo n.º 1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            int    totalSeconds = (int)(DateTime.UtcNow - UTools.Started).TotalSeconds;
            string str          = "";

            if (totalSeconds >= 86400)
            {
                int num = totalSeconds / 86400;
                str = string.Concat(num.ToString(), "d ");
            }
            if (totalSeconds >= 3600)
            {
                int num1 = totalSeconds / 3600 % 24;
                str = string.Concat(str, num1.ToString(), "h ");
            }
            if (totalSeconds >= 60)
            {
                int num2 = totalSeconds / 60 % 60;
                str = string.Concat(str, num2.ToString(), "m ");
            }
            int num3 = totalSeconds % 60;

            str = string.Concat(str, num3.ToString(), "s");
            TranslationList translationLists = UTools.Instance.Translations.Instance;

            object[] objArray = new object[] { UTools.Started.ToString(), str };
            UnturnedChat.Say(caller, translationLists.Translate("running_since", objArray));
        }
Exemplo n.º 2
0
 public void Execute(IRocketPlayer caller, string[] command)
 {
     //Requires PlayerInfoLib to work, if not loaded time won't be tracked
     if (RocketPlugin.IsDependencyLoaded("PlayerInfoLib"))
     {
         int    totalSeconds = PlayerInfoLib.Database.QueryById(UnturnedPlayer.FromName(caller.DisplayName).CSteamID, true).TotalPlayime;
         string str          = "";
         if (totalSeconds >= 86400)
         {
             int num = totalSeconds / 86400;
             str = string.Concat(num.ToString(), "d ");
         }
         if (totalSeconds >= 3600)
         {
             int num1 = totalSeconds / 3600 % 24;
             str = string.Concat(str, num1.ToString(), "h ");
         }
         if (totalSeconds >= 60)
         {
             int num2 = totalSeconds / 60 % 60;
             str = string.Concat(str, num2.ToString(), "m ");
         }
         int num3 = totalSeconds % 60;
         str = string.Concat(str, num3.ToString(), "s");
         TranslationList translationLists = UTools.Instance.Translations.Instance;
         object[]        objArray         = new object[] { str };
         UnturnedChat.Say(caller, translationLists.Translate("total_playtime", objArray), Color.yellow);
     }
     else
     {
         UnturnedChat.Say(caller, "Playtime is not being tracked!", Color.yellow);
     }
 }
        public override async Task DoAsync()
        {
            TranslationList rocket = await LoadTranslationsAsync();

            if (rocket == null)
            {
                await LogInfo("Could not load Rocket translations!");

                return;
            }

            await LogInfo("Preparing OpenMod translations");

            Dictionary <string, string> errors = new Dictionary <string, string>();

            foreach (string key in ErrorConversions.Keys)
            {
                string value  = rocket.Translate(key);
                string newKey = ErrorConversions[key];
                errors.Add(newKey, value);
            }

            Dictionary <string, string> others = new Dictionary <string, string>();

            foreach (string key in OtherConversions.Keys)
            {
                string value  = rocket.Translate(key);
                string newKey = OtherConversions[key];
                others.Add(newKey, value);
            }

            commands openMod = new commands(others, errors);

            await LogInfo("Saving OpenMod translations");
            await SaveAsync(openMod);
        }