Пример #1
0
 public void RemoveContributions(Contributor _Contributor)
 {
     foreach (var playerData in Players)
     {
         PlayersHistory[playerData.Key].RollbackPlayer(playerData.Value, _Contributor);
     }
 }
Пример #2
0
 internal void Update(Contributor _Contributor)
 {
     Name          = _Contributor.Name;
     UserID        = _Contributor.UserID;
     IP            = _Contributor.IP;
     ContributorID = _Contributor.ContributorID;
     TrustWorthy   = _Contributor.TrustWorthy;
 }
Пример #3
0
        public void UpdatePlayer(System.Xml.XmlNode _PlayerNode, Contributor _Contributor, Func <int, VF.SQLUploadID> _GetSQLUploadIDFunc)
        {
            string   playerName = PlayerData.DataParser.ParsePlayerName(_PlayerNode);
            DateTime lastSeen   = PlayerData.DataParser.ParseLastSeenUTC(_PlayerNode);

            if (lastSeen > DateTime.UtcNow)
            {
                if (lastSeen > DateTime.UtcNow.AddMinutes(2))
                {
                    //Tillåt inte data som är från framtiden(wtf) flagga Contributor som opålitlig
                    _Contributor.SetWarningFlag(Contributor.WarningFlag.DataFromFuture);
                    return;
                }
                lastSeen = DateTime.UtcNow;                 //Om det är OK så sätter vi LastSeen till UtcNow istället.
            }
            if ((DateTime.UtcNow - lastSeen).TotalDays > 5) //Tillåt inte data som är äldre än 5 dagar
            {
                return;
            }
            //if (lastSeen < DATE_HONOR_CORRUPTION)// Honor corruption occured the 16th January, uncomment this line after 5 days have passed!
            //{
            //    Logger.ConsoleWriteLine("Someone submitted data that was during the Honor Corruption. Good thing i implemented this code!!!", ConsoleColor.Red);
            //    return;
            //}
            var uploadID = _Contributor.GetUploadID(lastSeen);

            PlayerData.Player        currPlayer        = GetPlayer(playerName);
            PlayerData.PlayerHistory currPlayerHistory = GetPlayerHistory(playerName);
            currPlayer.Update(_PlayerNode, uploadID, lastSeen, currPlayerHistory, WowVersion, _GetSQLUploadIDFunc);
            try
            {
                //ANVÄND INTE = tecken innuti savedvariables data!!!!!!!!! då buggar det ur totalt
                string extraData = XMLUtility.GetChildValue(_PlayerNode, "ExtraData", "");
                if (extraData != "")
                {
                    VF.SQLPlayerID playerID;
                    using (VF.SQLComm comm = new VF.SQLComm())
                    {
                        if (comm.GetPlayerID(Realm, playerName, out playerID) == false)
                        {
                            Logger.ConsoleWriteLine("Could not find SQL PlayerID for Player \"" + playerName + "\"");
                        }
                    }
                    var currPlayerExtraData = GetPlayerExtraData(playerName);
                    currPlayerExtraData.AddData(uploadID, extraData, playerID, _GetSQLUploadIDFunc);
                }
            }
            catch (NpgsqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            Updated = true;
        }
Пример #4
0
 public ContributorDBElement(string _Key, Contributor _Contributor, string _AddedBy)
 {
     Key           = _Key;
     Name          = _Contributor.Name;
     UserID        = _Contributor.UserID;
     IP            = _Contributor.IP;
     ContributorID = _Contributor.ContributorID;
     TrustWorthy   = _Contributor.TrustWorthy;
     AddedBy       = _AddedBy;
 }
Пример #5
0
 public RPPContribution(Contributor _Contributor, string _Filename)
 {
     m_Contributor = _Contributor;
     m_Filename    = _Filename;
 }
Пример #6
0
        public void UpdatePlayer(System.Xml.XmlNode _PlayerNode, Contributor _Contributor, Func <int, VF.SQLUploadID> _GetSQLUploadIDFunc)
        {
            string   playerName = PlayerData.DataParser.ParsePlayerName(_PlayerNode);
            DateTime lastSeen   = PlayerData.DataParser.ParseLastSeenUTC(_PlayerNode);

            if (lastSeen > DateTime.UtcNow)
            {
                if (lastSeen > DateTime.UtcNow.AddMinutes(2))
                {
                    //Tillåt inte data som är från framtiden(wtf) flagga Contributor som opålitlig
                    _Contributor.SetWarningFlag(Contributor.WarningFlag.DataFromFuture);
                    return;
                }
                lastSeen = DateTime.UtcNow;                                                        //Om det är OK så sätter vi LastSeen till UtcNow istället.
            }
            if ((DateTime.UtcNow - lastSeen).TotalDays > 5)                                        //Tillåt inte data som är äldre än 5 dagar
            {
                if (Realm == WowRealm.Northdale && lastSeen < new DateTime(2018, 6, 23, 12, 0, 0)) //Do not allow inspects before server even opened...
                {
                    return;
                }
                if (DateTime.UtcNow < new DateTime(2018, 9, 1) && lastSeen > new DateTime(2018, 4, 1))
                {
                    //Special case, allow this! We are temporary allowing adding some old data!
                }
                else
                {
                    return;
                }
            }
            //if (lastSeen < DATE_HONOR_CORRUPTION)// Honor corruption occured the 16th January, uncomment this line after 5 days have passed!
            //{
            //    Logger.ConsoleWriteLine("Someone submitted data that was during the Honor Corruption. Good thing i implemented this code!!!", ConsoleColor.Red);
            //    return;
            //}
            var uploadID = _Contributor.GetUploadID(lastSeen);

            PlayerData.Player        currPlayer        = GetPlayer(playerName);
            PlayerData.PlayerHistory currPlayerHistory = GetPlayerHistory(playerName);
            currPlayer.Update(_PlayerNode, uploadID, lastSeen, currPlayerHistory, WowVersion, _GetSQLUploadIDFunc);
            try
            {
                //ANVÄND INTE = tecken innuti savedvariables data!!!!!!!!! då buggar det ur totalt
                string extraData = XMLUtility.GetChildValue(_PlayerNode, "ExtraData", "");
                if (extraData != "")
                {
#if UPDATE_SQL_DB
                    VF.SQLPlayerID playerID;
                    using (VF.SQLComm comm = new VF.SQLComm())
                    {
                        if (comm.GetPlayerID(Realm, playerName, out playerID) == false)
                        {
                            Logger.ConsoleWriteLine("Could not find SQL PlayerID for Player \"" + playerName + "\"");
                        }
                    }
                    var currPlayerExtraData = GetPlayerExtraData(playerName);
                    currPlayerExtraData.AddData(uploadID, extraData, playerID, _GetSQLUploadIDFunc);
#else
                    if (_GetSQLUploadIDFunc != null)
                    {
                        while (true)
                        {
                            Console.WriteLine("ERROR, SQL USAGE CONFUSION"); System.Threading.Thread.Sleep(5000);
                        }
                    }
                    var currPlayerExtraData = GetPlayerExtraData(playerName);
                    currPlayerExtraData.AddData(uploadID, extraData, null, null);
#endif
                }
            }
            catch (NpgsqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            Updated = true;
        }