Ejemplo n.º 1
0
        private void _AddPet(string _PetData, UploadID _Uploader, VF.SQLPlayerID?_PlayerID = null, Func <int, VF.SQLUploadID> _GetSQLUploadIDFunc = null)
        {
            var petDatas = _PetData.Split(':');

            if (petDatas.Length != 4)
            {
                return;
            }

            string petName  = petDatas[0];
            int    petLevel = 0;

            if (int.TryParse(petDatas[1], out petLevel) == false)
            {
                return;
            }
            string petFamily = petDatas[2];
            string petType   = petDatas[3];

            if (_PlayerID.HasValue && _PlayerID.Value.IsValid() && _GetSQLUploadIDFunc != null)
            {
                using (VF.SQLComm comm = new VF.SQLComm())
                {
                    int petID = comm.GeneratePetID(petName, petLevel, petFamily, petType);
                    if (petID > 0)
                    {
                        comm.AddPlayerPet(_PlayerID.Value, _GetSQLUploadIDFunc(0), _Uploader.GetTime(), petID);
                    }
                }
            }
            _AddPet(petName, petLevel, petFamily, petType, _Uploader);
        }