Exemple #1
0
 /// <summary>
 /// Sets the player's DonatorTier to the specified tier and creates a new message in their logs informing them such.
 /// </summary>
 /// <param name="tier">The new tier to set the player to</param>
 public void SetTier(int tier)
 {
     DonatorLevel = tier;
     if (tier > 0)
     {
         PlayerLogs.Add(PlayerLog.Create(this, "<b>An admin has set your donator status to Tier " + tier + ".  <span class='good'>Thank you for supporting Transformania Time!</span></b>", DateTime.UtcNow, true));
     }
     else
     {
         PlayerLogs.Add(PlayerLog.Create(this, "<b>An admin has set your donator status to Tier " + tier + ".</b>", DateTime.UtcNow, true));
     }
 }
Exemple #2
0
    public void Start()
    {
        CheckForInternetConnection();
        PlayerLogs pl = PlayerLogs.LoadLogs();

        if (pl != null)
        {
            GameStateManager.Login    = pl.Login;
            GameStateManager.Password = pl.Password;
            startPassword             = pl.Password;
            isHashNeeded = false;
        }
    }
Exemple #3
0
        public static void WriteLog(LogType type, string text, LogColor color)
        {
            switch (type)
            {
            case LogType.Player:
                PlayerLogs.Write(text, color);
                break;

            case LogType.System:
                SystemLogs.Write(text, color);
                break;
            }
        }
Exemple #4
0
    public static List <PlayerLogs> getLogsToUpload()
    {
        List <PlayerLogs> uploadList = new List <PlayerLogs>();

        _dbc = new SqliteConnection(_constr);
        _dbc.Open();
        _dbcm             = _dbc.CreateCommand();
        sql               = "SELECT * FROM player_logs WHERE is_uploaded = 0 AND game_progress = 'FINISHED';";
        _dbcm.CommandText = sql;
        _idr              = _dbcm.ExecuteReader();

        while (_idr.Read())
        {
            PlayerLogs temp = new PlayerLogs();
            temp.log_id        = _idr.GetInt32(_idr.GetOrdinal("log_id"));
            temp.player_id     = _idr.GetInt32(_idr.GetOrdinal("player_id"));
            temp.test_id       = _idr.GetInt32(_idr.GetOrdinal("test_id"));
            temp.time_start    = _idr["time_start"].ToString();
            temp.time_end      = _idr["time_end"].ToString();
            temp.prev_status   = _idr["prev_status"].ToString();
            temp.new_status    = _idr["new_status"].ToString();
            temp.game_progress = _idr["game_progress"].ToString();
            temp.is_uploaded   = _idr.GetInt32(_idr.GetOrdinal("is_uploaded"));

            uploadList.Add(temp);
        }

        _idr.Close();
        _idr = null;
        _dbcm.Dispose();
        _dbcm = null;
        _dbc.Close();
        _dbc = null;

        return(uploadList);
    }
Exemple #5
0
    protected override void OnMenuGUI()
    {
        Screen.lockCursor = false;
        Cursor.visible    = true;

        GUIStyle centeredStyle = new GUIStyle(GUI.skin.label);

        centeredStyle.alignment        = TextAnchor.MiddleCenter;
        centeredStyle.normal.textColor = Color.red;

        if (loginFailed && Time.time - lastLoginFailed < 5f)
        {
            GUILayout.Label(failedMessage, centeredStyle, GUILayout.Width(490));
        }
        else if (Time.time - lastLoginFailed >= 5f)
        {
            loginFailed = false;
        }

        if (!internetConnection)
        {
            failedMessage = "No internet connection";
            loginFailed   = true;

            if (GUILayout.Button("Play offline", GUILayout.Width(490)))
            {
                SwitchTo <MainMenu>();
            }
        }
        else
        {
            if (disconnected)
            {
                disconnected = false;
                OnDisconnected();
            }
            else if (GameStateManager.loggedIn)
            {
                SwitchTo <MainMenu>();
            }

            GUILayout.BeginHorizontal(GUILayout.Width(490));
            GUILayout.Label("Login: "******"Password: "******"Signup", GUILayout.ExpandWidth(true)))
            {
                SwitchTo <Signup>();
            }


            if (GameStateManager.Password != "" && GameStateManager.Login != "")
            {
                if (GUILayout.Button("Login", GUILayout.Width(245)))
                {
                    confirm = true;
                }

                if (confirm)
                {
                    RegexUtilities rg = new RegexUtilities();
                    confirm = false;

                    using (WebClient wb = new WebClient())
                    {
                        string hashString = GameStateManager.Password;
                        if (hashString != startPassword)
                        {
                            isHashNeeded = true;
                        }
                        NameValueCollection data = new NameValueCollection();
                        if (isHashNeeded)
                        {
                            hashString = Signup.HashString(GameStateManager.Password);
                        }

                        data["id"]   = GameStateManager.Login;
                        data["psw"]  = hashString;
                        data["mode"] = "in";

                        byte[] response = wb.UploadValues(MainMenu.url, "POST", data);
                        using (MD5 md5Hash = MD5.Create())
                        {
                            if (!Signup.VerifyMd5Hash(md5Hash, "no", System.Text.Encoding.UTF8.GetString(response)))
                            {
                                GameStateManager.connectionID = System.Text.Encoding.UTF8.GetString(response);
                                GameStateManager.loggedIn     = true;
                                GameStateManager.Password     = hashString;
                                GameStateManager.startProcess = true;
                                GameStateManager.version      = checkVersion();
                                PlayerLogs pl = new PlayerLogs();
                                pl.Login    = GameStateManager.Login;
                                pl.Password = GameStateManager.Password;
                                pl.SerializeLogs();
                                SwitchTo <MainMenu>();
                            }
                            else
                            {
                                loginFailed     = true;
                                failedMessage   = "Login failed";
                                lastLoginFailed = Time.time;
                            }
                        }
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
    }
 public void AddLog(
     PlayerReportModel model)
 {
     PlayerLogs.Add(model);
 }
 public static void Load()
 {
     Timers.TimerStart();
     if (TeleportCheck.IsEnabled)
     {
         TeleportCheck.DetectionLogsDir();
     }
     if (FlightCheck.IsEnabled)
     {
         FlightCheck.DetectionLogsDir();
     }
     if (HatchElevator.IsEnabled)
     {
         HatchElevator.DetectionLogsDir();
     }
     if (PlayerLogs.IsEnabled)
     {
         PlayerLogs.PlayerLogsDir();
     }
     if (Report.IsEnabled)
     {
         Report.ReportLogsDir();
     }
     if (PlayerStatCheck.IsEnabled)
     {
         PlayerStatCheck.DetectionLogsDir();
     }
     if (UndergroundCheck.IsEnabled)
     {
         UndergroundCheck.DetectionLogsDir();
     }
     if (Bank.IsEnabled)
     {
         Bank.CreateFolder();
     }
     if (AuctionBox.IsEnabled)
     {
         AuctionBox.CreateFolder();
     }
     if (Bounties.IsEnabled)
     {
         Players.CreateFolder();
     }
     if (CredentialCheck.IsEnabled)
     {
         CredentialCheck.CreateFolder();
     }
     if (DupeLog.IsEnabled)
     {
         DupeLog.CreateFolder();
     }
     Poll.CreateFolder();
     if (PersistentContainer.Instance.PollOpen)
     {
         Poll.Check();
     }
     if (ChatHook.Special_Player_Name_Coloring)
     {
         ChatHook.SpecialIdCheck();
     }
     if (ClanManager.IsEnabled)
     {
         PersistentContainer.Instance.Players.GetClans();
         ClanManager.BuildList();
     }
     if (!ClanManager.IsEnabled)
     {
         PersistentContainer.Instance.Players.clans.Clear();
         ClanManager.ClanMember.Clear();
     }
     if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
     {
         InfoTicker.Unload();
     }
     if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
     {
         InfoTicker.Load();
     }
     if (Gimme.IsRunning && !Gimme.IsEnabled)
     {
         Gimme.Unload();
     }
     if (!Gimme.IsRunning && Gimme.IsEnabled)
     {
         Gimme.Load();
     }
     if (UndergroundCheck.IsRunning && !UndergroundCheck.IsEnabled)
     {
         UndergroundCheck.Unload();
     }
     if (!UndergroundCheck.IsRunning && UndergroundCheck.IsEnabled)
     {
         UndergroundCheck.Load();
     }
     if (Badwords.IsRunning && !Badwords.IsEnabled)
     {
         Badwords.Unload();
     }
     if (!Badwords.IsRunning && Badwords.IsEnabled)
     {
         Badwords.Load();
     }
     if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
     {
         LoginNotice.Load();
     }
     if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
     {
         LoginNotice.Unload();
     }
     if (!Zones.IsRunning && Zones.IsEnabled)
     {
         Zones.Load();
     }
     if (Zones.IsRunning && !Zones.IsEnabled)
     {
         Zones.Unload();
     }
     if (!VoteReward.IsRunning && VoteReward.IsEnabled)
     {
         VoteReward.Load();
     }
     if (VoteReward.IsRunning && !VoteReward.IsEnabled)
     {
         VoteReward.Unload();
     }
     if (!Watchlist.IsRunning && Watchlist.IsEnabled)
     {
         Watchlist.Load();
     }
     if (Watchlist.IsRunning && !Watchlist.IsEnabled)
     {
         Watchlist.Unload();
     }
     if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
     {
         ReservedSlots.Load();
     }
     if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
     {
         ReservedSlots.Unload();
     }
     if (!StartingItems.IsRunning && StartingItems.IsEnabled)
     {
         StartingItems.Load();
     }
     if (StartingItems.IsRunning && !StartingItems.IsEnabled)
     {
         StartingItems.Unload();
     }
     if (!Travel.IsRunning && Travel.IsEnabled)
     {
         Travel.Load();
     }
     if (Travel.IsRunning && !Travel.IsEnabled)
     {
         Travel.Unload();
     }
     if (!Shop.IsRunning && Shop.IsEnabled)
     {
         Shop.Load();
     }
     if (Shop.IsRunning && !Shop.IsEnabled)
     {
         Shop.Unload();
     }
     if (!Motd.IsRunning && Motd.IsEnabled)
     {
         Motd.Load();
     }
     if (Motd.IsRunning && !Motd.IsEnabled)
     {
         Motd.Unload();
     }
     if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
     {
         InventoryCheck.Unload();
     }
     if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
     {
         InventoryCheck.Load();
     }
     if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
     {
         HighPingKicker.Unload();
     }
     if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
     {
         HighPingKicker.Load();
     }
     if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
     {
         CredentialCheck.Unload();
     }
     if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
     {
         CredentialCheck.Load();
     }
     if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
     {
         CustomCommands.Unload();
     }
     if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
     {
         CustomCommands.Load();
     }
     if (DupeLog.IsRunning && !DupeLog.IsEnabled)
     {
         DupeLog.Unload();
     }
     if (!DupeLog.IsRunning && DupeLog.IsEnabled)
     {
         DupeLog.Load();
     }
     if (AuctionBox.IsEnabled)
     {
         AuctionBox.AuctionList();
     }
     if (MutePlayer.IsEnabled)
     {
         MutePlayer.MuteList();
     }
     if (Jail.IsEnabled)
     {
         Jail.JailList();
     }
     if (Animals.IsEnabled)
     {
         Animals.AnimalList();
     }
     if (AutoShutdown.IsEnabled)
     {
         AutoShutdown.ShutdownList();
     }
 }
Exemple #8
0
 /// <summary>
 /// Adds a new player log message of specified importance
 /// </summary>
 /// <param name="logMessage">The log message visible to the player</param>
 /// <param name="isImportant">Whether or not the log is important and should continually appear in the player's logs until dismissed.</param>
 public void AddLog(string logMessage, bool isImportant)
 {
     PlayerLogs.Add(PlayerLog.Create(this, logMessage, DateTime.UtcNow, isImportant));
 }