Esempio n. 1
0
        private void _AddCompanion(string _CompanionData, UploadID _Uploader, VF.SQLPlayerID?_PlayerID = null, Func <int, VF.SQLUploadID> _GetSQLUploadIDFunc = null)
        {
            var companionDatas = _CompanionData.Split(':');

            if (companionDatas.Length != 2)
            {
                return;
            }

            string companionName  = companionDatas[0];
            int    companionLevel = 0;

            if (int.TryParse(companionDatas[1], out companionLevel) == false)
            {
                return;
            }

            if (_PlayerID.HasValue && _PlayerID.Value.IsValid() && _GetSQLUploadIDFunc != null)
            {
                using (VF.SQLComm comm = new VF.SQLComm())
                {
                    int companionID = comm.GenerateCompanionID(companionName, companionLevel);
                    if (companionID > 0)
                    {
                        comm.AddPlayerCompanion(_PlayerID.Value, _GetSQLUploadIDFunc(0), _Uploader.GetTime(), companionID);
                    }
                }
            }
            _AddCompanion(companionName, companionLevel, _Uploader);
        }