void OnGUI() { GUILayout.Label("Base Settings", EditorStyles.boldLabel); if (!generatedGameTeam ? GUILayout.Button("generate GameTeam") : false) { InitGameTeam(); generatedGameTeam = true; } if (generatedGameTeam) { GUILayout.Label("Character Settings", EditorStyles.boldLabel); teamNumber = EditorGUILayout.IntPopup("Select team number", teamNumber, new string[] { "team 1", "team 2" }, new int[] { 1, 2 }); typeCharacter = EditorGUILayout.IntPopup("Select type Character", typeCharacter, listMouvementString, listMouvementInt); typeWeapon = EditorGUILayout.IntPopup("Select type Weapon", typeWeapon, listWeaponString, listWeaponInt); } if (teamNumber >= 0 && typeCharacter >= 0 && typeWeapon >= 0) { GUILayout.Label("Please select one or more case(s) in the editor", EditorStyles.boldLabel); if (selectionDone) { if (GUILayout.Button("attach character to case(s)")) { createCharacter = ScriptableObject.CreateInstance <CreateCharacter>(); AttachCharacters(); } } } }
/// <summary> /// 类型:方法 /// 名称:OnOperationRequest /// 作者:taixihuase /// 作用:响应并处理客户端发来的请求 /// 编写日期:2015/7/14 /// </summary> /// <param name="operationRequest"></param> /// <param name="sendParameters"></param> protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters) { switch (operationRequest.OperationCode) { // 账号注册 case (byte)OperationCode.Regist: Regist.OnRequest(operationRequest, sendParameters, this); break; // 账号登陆 case (byte)OperationCode.Login: Login.OnRequest(operationRequest, sendParameters, this); break; // 创建新角色 case (byte)OperationCode.CreateCharacter: CreateCharacter.OnRequest(operationRequest, sendParameters, this); break; // 角色进入场景 case (byte)OperationCode.WorldEnter: WorldEnter.OnRequest(operationRequest, sendParameters, this); break; } }
public async Task <IActionResult> CreateCharacter([FromBody] CreateCharacter model) { try { if (model == null) { return(BadRequest("Beer object is null")); } if (!ModelState.IsValid) { return(BadRequest("Invalid model object")); } Character entity = _mapper.Map <Character>(model); await _db.Characters.AddAsync(entity); await _db.SaveChangesAsync(); return(Ok()); } catch (Exception ex) { _logger.LogError($"Error in CreateCharacter action: {ex.Message}"); return(StatusCode(500, "Internal server error")); } }
public ActionResult Create(CreateCharacter viewModel) { if (string.IsNullOrWhiteSpace(viewModel.Name) || string.IsNullOrWhiteSpace(viewModel.FamilyName)) { return(Json(new { Success = false, Content = "All fields are required" })); } if (viewModel.Name.Length < 4 || viewModel.Name.Length > 40) { return(Json(new { Success = false, Content = "The characters name must be between 4 and 40 characters long." })); } if (viewModel.FamilyName.Length < 4 || viewModel.FamilyName.Length > 40) { return(Json(new { Success = false, Content = "The characters family name must be between 4 and 40 characters long." })); } Lib.Entity.User user = Lib.DatabaseManager.UserManager.Current.Get(Int32.Parse(User.Identity.Name)); user.CharName = viewModel.Name; user.CharFamilyName = viewModel.FamilyName; user.CharGender = viewModel.Gender; user.CharBloodStatus = viewModel.BloodStatus; user.Status = Lib.Entity.User.UserStatus.NeedsShopping; Lib.DatabaseManager.UserManager.Current.Update(user); return(Json(new { Success = true, Redirect = Url.Action("DiagonAlley", "Shopping") })); }
public ActionResult CreateCharacterView(CreateCharacter cmodel) { User user = userClient.Find(User.Identity.Name); if (characterClient.Find(cmodel.Name) != null) { ModelState.AddModelError("", "This Character already exist"); return(RedirectToAction("CreateCharacterView", user.Characters)); } try { Character character = new Character { Name = cmodel.Name, Level = cmodel.Level, Class = cmodel.Class, BackGroundStory = cmodel.BackGroundStory, }; user.Characters.Add(character); userClient.Update(user); characterClient.Create(character); // does not set the foreign key as intended. return(RedirectToAction("CharacterView", user.Characters)); } catch (Exception ex) { Console.WriteLine(ex); return(View("CreateCharacterView")); } }
public void OnCreateCharacter(IncomingPacket packet) { CreateCharacter request = new CreateCharacter(packet); Account account = ClusterServer.LoginDatabase.Accounts[this.Username]; Character character = new Character(); character.CharacterId = SharpFly_Utility_Library.Database.ClusterDatabase.Queries.Character.Instance.GetNewCharacterId(); character.Name = request.CharacterName; character.ClusterId = (uint)ClusterServer.Config.GetSetting("ClusterId"); character.Skinset = request.Skinset; character.HairStyle = request.HairStyle; character.HairColor = request.HairColor; character.HeadMesh = request.HeadMesh; character.Face = request.Face; character.Gender = request.Gender; character.Strength = 15; character.Stamina = 15; character.Dexterity = 15; character.Intelligence = 15; character.SkillPoints = 0; character.StatPoints = 0; character.Level = 1; character.Experience = 0; character.Map = 1; character.Position = new SharpFly_Utility_Library.Math.Vector4 <float>(0, 0, 0, 0); // temp character.Penya = 0; character.FlyingLevel = 0; character.FlyingExp = 0; character.HP = 1; // temp character.MP = 1; // temp character.Size = 1; character.PvPPoints = 0; character.PKPoints = 0; character.GuildId = 0; character.Bag1TimeLeft = 0; character.Bag2TimeLeft = 0; character.MsgState = 0; character.MotionFlags = 0; character.MovementFlags = 0; character.PlayerFlags = 0; CharacterSlot charSlot = new CharacterSlot(); charSlot.AccountId = account.Id; charSlot.CharacterId = character.CharacterId; charSlot.SlotId = request.Slot; // Add character to database SharpFly_Utility_Library.Database.ClusterDatabase.Queries.Character.Instance.AddCharacter(character); ClusterServer.ClusterDatabase.AddCharacter(character); // Add characterslot to database SharpFly_Utility_Library.Database.ClusterDatabase.Queries.CharacterSlot.Instance.AddCharacterSlot(charSlot); ClusterServer.ClusterDatabase.AddCharacterSlot(charSlot); SendCharacterList(0); }
private void playerToolStripMenuItem_Click(object sender, EventArgs e) { CreateCharacter lvCreateCharacter = new CreateCharacter(); pnlDisplay.Controls.Clear(); pnlDisplay.Controls.Add(lvCreateCharacter); pnlDisplay.BringToFront(); }
private void createCharacter_Click(object sender, EventArgs e) { Thread messageThread = new Thread(LoadingMessage); messageThread.Start(); CreateCharacter creatCharScreen = new CreateCharacter(); creatCharScreen.Show(); }
public static ServerResponse CreateCharacter(string characterName, string characterGreeting) { Command command = new CreateCharacter(characterName, characterGreeting); Aggregate character = AggregateRepository.GetOrCreate(typeof(CharacterAggregate), characterName); bool success = CommandHandler.HandleCommand(character, characterName, command); ServerResponse response = new ServerResponse(characterName, ModelNameGetter.GetModelName(character.GetType()), !success); return(response); }
public async Task <CharacterView> CreateCharacterAsync(CreateCharacter command) { var character = _characterFactory.BuildCharacter(command); await _characterRepository.SaveAsync(character); var characterView = new CharacterView(character); await _eventBus.PublishAsync <CharacterView>(characterView); return(characterView); }
public static void SavePlayer(CreateCharacter player, string saveSlot) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/" + saveSlot + ".txt"; FileStream stream = new FileStream(path, FileMode.Create); Player_data data = new Player_data(player); formatter.Serialize(stream, data); stream.Close(); }
private Event[] CreateCharacter(CreateCharacter command) { if (this.id != Aggregate.NullId) { throw new ValidationException("id", "Already exists."); } return(new Event[] { new CharacterCreated(command.name, command.greeting) }); }
private void btnLevelUp_Click(object sender, EventArgs e) { CreateCharacter lvCreateCharacter = new CreateCharacter(); Form lvForm = new Form(); lvForm.Controls.Add(lvCreateCharacter); lvForm.Width = lvCreateCharacter.Width + 20; lvForm.Height = lvCreateCharacter.Height + 20; lvForm.Show(); lvForm.BringToFront(); }
public Player_data(CreateCharacter player) { classesString = player.PlayerClass; saveSlot = player.saveSlot; lvl = player.lvl; Name = player.Name; classesInt = player.curent; Intellect = player.Intellect; Agility = player.Agility; Strength = player.Strength; Stamina = player.Stamina; character = player.characterIMG; }
private void btnCreate_Click(object sender, EventArgs e) { CreateCharacter lvCreateCharacter = new CreateCharacter(); Form lvForm = new Form(); lvForm.Controls.Add(lvCreateCharacter); lvForm.Width = lvCreateCharacter.Width + 20; lvForm.Height = lvCreateCharacter.Height + 20; lvForm.Show(); lvForm.BringToFront(); Global.PlaySound(Global.Music_Theme, true); lvForm.Closed += CloseCreateForm; }
void InitializeCharacter(int listPos) { Character newCharacter = CreateCharacter.Create(); if (newCharacter) { string relPath = AssetDatabase.GetAssetPath(newCharacter); //EditorPrefs.SetString("CharacterObjectPath_" + System.DateTime.Now.Millisecond, relPath); if (characters && (characters.allCharacters != null)) { characters.allCharacters[listPos] = newCharacter; } } }
protected virtual GameOperationResponse HandleOperationCreateCharacter(GameOperationRequest operationRequest, MessageParameters parameters) { var operation = new CreateCharacter(this.peer.Protocol, operationRequest); if (!operation.IsValid) { return(operation.GetErrorResponse((short)ResultCode.InvalidOperationParameter, operation.GetErrorMessage())); } ThreadPool.QueueUserWorkItem( o => this.ExecUserOperation(() => this.HandleCreateCharacter(operationRequest.ClientId, operation), operationRequest.ClientId, parameters)); return(null); }
public async Task <CreateCharacter> CreateCharacter(Guid _CustomerGUID, Guid _UserSessionGUID, string _CharacterName, string _ClassName) { CreateCharacter OutputObject = new CreateCharacter(); try { string errorMessage = ""; using (Connection) { var p = new DynamicParameters(); p.Add("CustomerGUID", _CustomerGUID); p.Add("UserSessionGUID", _UserSessionGUID); p.Add("CharacterName", _CharacterName); p.Add("ClassName", _ClassName); p.Add("ErrorMessage", dbType: DbType.String, direction: ParameterDirection.Output, size: 50); await Connection.ExecuteAsync("AddCharacter", p, commandType : CommandType.StoredProcedure); errorMessage = p.Get <string>("ErrorMessage"); } if (String.IsNullOrEmpty(errorMessage)) { OutputObject.Success = true; OutputObject.ErrorMessage = ""; OutputObject.CharacterName = _CharacterName; } else { OutputObject.Success = false; OutputObject.ErrorMessage = errorMessage; OutputObject.CharacterName = _CharacterName; } return(OutputObject); } catch (Exception ex) { OutputObject.Success = false; OutputObject.ErrorMessage = ex.Message; OutputObject.CharacterName = ""; return(OutputObject); } }
void CreateNewCharacter(int counter = 0) { //if (counter == 0) counter = System.DateTime.Now.Millisecond; Character newCharacter = CreateCharacter.Create(); if (newCharacter) { string relPath = AssetDatabase.GetAssetPath(newCharacter); //EditorPrefs.SetString("CharacterObjectPath_" + counter, relPath); if (characters && (characters.allCharacters != null)) { characters.allCharacters.Add(newCharacter); viewIndex++; EditorUtility.SetDirty(characters); } } }
private void CharacterPortrait_Load(object sender, EventArgs e) { // ensures that the createChar object is correctly cast as the starting form int i = 0; while (createChar == null) { if (Application.OpenForms[i] is CreateCharacter) { createChar = (CreateCharacter)Application.OpenForms[i]; } else { i++; } } }
public async Task <IActionResult> CreateCharacter([FromBody] CreateCharacter data) { var character = new Character { Name = data.Name }; await _context.AddAsync(character); await _context.SaveChangesAsync(); return(Created(character.Id.ToString(), new CharacterViewModel { Id = character.Id, Name = character.Name })); }
public Base(string characterName) { InitializeComponent(); if (characterName == null) { _character = CreateCharacter.GetNewCharacter(); } else { _character = CreateCharacter.LoadCharacter(characterName); } _descriptionControl = new DescriptionControl(_character, this); _abilityScoreControl = new AbilityScoreControl(_character, this); _initControl = new InitiativeControl(_character, this); _healthControl = new HealthControl(_character, this); _attackControl = new AttackControl(_character, this); _savingThrowControl = new SavingThrowControl(_character, this); _abilitiesControl = new AbilitiesControl(_character, this); _featsControl = new FeatsControl(_character, this); _weaponsControl = new WeaponsControl(_character, this); _equipmentControl = new EquipmentControl(_character, this); _wearableControl = new WearableControl(_character, this); _armorControl = new ArmorControl(_character, this); _skillControl = new SkillControl(_character, this); _spellsControl = new SpellsControl(_character, this); _summaryControl = new SummaryControl(_character, this); pnlTopLeft.Controls.Add(_descriptionControl); pnlBottomLeft.Controls.Add(_abilityScoreControl); pnlMiddle.Controls.Add(_skillControl); pnlInitiative.Controls.Add(_initControl); pnlHealth.Controls.Add(_healthControl); pnlArmor.Controls.Add(_armorControl); pnlAttackBonus.Controls.Add(_attackControl); pnlSavingThrows.Controls.Add(_savingThrowControl); pnlAbilities.Controls.Add(_abilitiesControl); pnlFeats.Controls.Add(_featsControl); pnlWeapons.Controls.Add(_weaponsControl); pnlEquipment.Controls.Add(_equipmentControl); pnlWearables.Controls.Add(_wearableControl); pnlSpells.Controls.Add(_spellsControl); pnlSummary.Controls.Add(_summaryControl); }
public async Task <CreateCharacter> CreateCharacter(Guid customerGUID, Guid userSessionGUID, string characterName, string className) { CreateCharacter outputObject = new CreateCharacter(); try { using (Connection) { var p = new DynamicParameters(); p.Add("CustomerGUID", customerGUID); p.Add("UserSessionGUID", userSessionGUID); p.Add("CharacterName", characterName); p.Add("ClassName", className); p.Add("ErrorMessage", dbType: DbType.String, direction: ParameterDirection.Output, size: 50); outputObject = await Connection.QuerySingleAsync <CreateCharacter>("AddCharacter", p, commandType : CommandType.StoredProcedure); //await Connection.ExecuteAsync("AddCharacter", // p, // commandType: CommandType.StoredProcedure); //errorMessage = p.Get<string>("ErrorMessage"); } if (String.IsNullOrEmpty(outputObject.ErrorMessage)) { outputObject.Success = true; } else { outputObject.Success = false; } return(outputObject); } catch (Exception ex) { outputObject.Success = false; outputObject.ErrorMessage = ex.Message; return(outputObject); } }
public AboutViewModel() { Title = "Настройки"; FillPaladinCommand = new Command(async() => { await PaladinSpells.FillSpells(); await PaladinSpells.FillVengeanceSpells(); }); FillXGTECommand = new Command(async() => await PaladinSpells.FillXGTESpells()); FillBaseCommand = new Command(async() => await ClericSpells.FillSpells()); FillForgeCommand = new Command(async() => await ClericSpells.FillForge()); FillTempestCommand = new Command(async() => await ClericSpells.FillTempest()); DropBaseCommand = new Command(async() => await App.Database.ClearSpellBase()); CreateClericCommand = new Command(async() => await CreateCharacter.NewCleric()); CreateInventoryCommand = new Command(async() => await CreateInventory.NewInventory()); }
public Character BuildCharacter(CreateCharacter command) { int constitutionMod = StatService.CalcCurrentModifier(StatNames.Constitution, command.Stats.Constitution, command.Items); int hp = _hitDiceService.CalculateInitialHP(command.Classes, constitutionMod); var hitPoints = new HitPoints(hp); if (command.Defenses != null) { AddDamageModifiers(hitPoints, command.Defenses); } if (command.Items != null) { var itemDefenses = command.Items .Where((x) => x.Defenses != null) .SelectMany((x) => x.Defenses); AddDamageModifiers(hitPoints, itemDefenses); } return(new Character(command.Name, hitPoints)); }
public Possessed(CreateCharacter createChar) { _formCreation = createChar; //_formCreation.tblEnvy.BackColor = Color.Transparent; //_formCreation.tblEnvy.BackgroundImage = Global.SetImageOpacity(new Bitmap(_Vestment_Img_Folder + "Envy_Image.jpg"), 0.25F); //_formCreation.tblGluttony.BackColor = Color.Transparent; //_formCreation.tblGluttony.BackgroundImage = Global.SetImageOpacity(new Bitmap(_Vestment_Img_Folder + "Gluttony_Image.jpg"), 0.25F); //_formCreation.tblGreed.BackColor = Color.Transparent; //_formCreation.tblGreed.BackgroundImage = Global.SetImageOpacity(new Bitmap(_Vestment_Img_Folder + "Greed_Image.jpg"), 0.25F); //_formCreation.tblLust.BackColor = Color.Transparent; //_formCreation.tblLust.BackgroundImage = Global.SetImageOpacity(new Bitmap(_Vestment_Img_Folder + "Lust_Image.jpg"), 0.25F); //_formCreation.tblPride.BackColor = Color.Transparent; //_formCreation.tblPride.BackgroundImage = Global.SetImageOpacity(new Bitmap(_Vestment_Img_Folder + "Pride_Image.jpg"), 0.25F); //_formCreation.tblSloth.BackColor = Color.Transparent; //_formCreation.tblSloth.BackgroundImage = Global.SetImageOpacity(new Bitmap(_Vestment_Img_Folder + "Sloth_Image.jpg"), 0.25F); //_formCreation.tblWrath.BackColor = Color.Transparent; //_formCreation.tblWrath.BackgroundImage = Global.SetImageOpacity(new Bitmap(_Vestment_Img_Folder + "Wrath_Image.jpg"), 0.25F); }
void OnGUI() { GUILayout.Label("Character Editor", EditorStyles.boldLabel); characterName = EditorGUILayout.TextField("Name", characterName); GUILayout.BeginHorizontal(); if (GUILayout.Button("Load Character")) { // Check if the asset with the entered name exists if (AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Characters/" + characterName + ".asset") != null) { loadedCharacter = AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Characters/" + characterName + ".asset"); Debug.Log("\'" + characterName + ".asset\' loaded."); characterName = loadedCharacter.name; } else { Debug.Log("Asset not found!"); } } if (GUILayout.Button("Save Character")) { CreateCharacter.Create(characterName); } GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.Label("Conversation", EditorStyles.boldLabel); nodeText = EditorGUILayout.TextField("Text", nodeText); if (GUILayout.Button("Create Node")) { CreateDialogueNode.Create(characterName, nodeText); } }
public void createCharacters(loadCharacters characters) { int length = characters.names.Length; List <List <Equip> > equips = (List <List <Equip> >)Tools.byteArrayToObject(characters.itemsEquip); List <string[]> colors = (List <string[]>)Tools.byteArrayToObject(characters.colorScheme); Debug.Log("Equips size:" + equips.Count); for (int i = 0; i < length; i++) { GameObject child = (GameObject)Instantiate(playerModel, Vector3.zero, Quaternion.identity); GameObject[] skin = Tools.getChildren(child.transform.GetChild(1).gameObject, "BodyModel", "HeadModel"); GameObject[] eyes = Tools.getChildren(child.transform.GetChild(1).gameObject, "Eye_L_Model", "Eye_R_Model"); setSkinColor(skin, colors[i][2]); setEyeColor(eyes, colors[i][1]); child.transform.SetParent(this.charSelect.transform.GetChild(i)); child.transform.localPosition = Vector3.zero; this.charSelect.transform.GetChild(i).transform.localRotation = Quaternion.Euler(0, 135, 0); PickCharacter pickChar = this.charSelect.transform.GetChild(i).GetChild(0).gameObject.AddComponent <PickCharacter>(); pickChar.name = characters.names[i]; pickChar.setLogin(this); equipItems(equips[i], pickChar); this.gameObject.transform.parent.GetComponent <RectTransform>().localPosition = new Vector3(1200, 0, 0); this.charSelect.transform.GetChild(i).GetChild(0).GetChild(0).gameObject.GetComponent <TextMesh>().text = characters.names[i]; pickChar.camera = camera.gameObject.GetComponent <Camera>(); } for (int i = length; i < this.charSelect.transform.childCount; i++) { GameObject child = (GameObject)Instantiate(signModel, Vector3.zero, Quaternion.identity); child.transform.SetParent(this.charSelect.transform.GetChild(i)); child.transform.localPosition = new Vector3(0, -3, 0); child.transform.localRotation = Quaternion.Euler(0, -108, 0); child.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); this.charSelect.transform.GetChild(i).transform.localRotation = Quaternion.Euler(0, 135, 0); CreateCharacter charCreate = this.charSelect.transform.GetChild(i).GetChild(0).gameObject.AddComponent <CreateCharacter>(); charCreate.setCamera(this.camera); charCreate.setCharacter(this.charCreate, playerModel); charCreate.setUI(createCharacterUI); } }
public void CreateCharacterGetBytesTest() { ClientVersion version = ClientVersion.vMAX; SkillValuePair[] skills = new SkillValuePair[] { new SkillValuePair() { Skill = (Skill)25, Value = 50 }, new SkillValuePair() { Skill = (Skill)26, Value = 50 }, new SkillValuePair() { Skill = (Skill)0, Value = 0 } }; CharStats stats = new CharStats() { Strength = 50, Dexterity = 24, Intelligence = 1 }; RaceAndGender raceandgender = new RaceAndGender(version, RaceAndGender.RaceType.Human, RaceAndGender.GenderType.Female); Hue pantscolor = (Hue)999; BeardStyle beardstyle = (BeardStyle)33; CreateCharacter target = new CreateCharacter(version, "David", ClientFlag.LBR, (Profession)1, raceandgender, stats, skills, 0, 0, 0, (BeardStyle)33, 0, 0, 0, IPAddress.None, 0, pantscolor); int expectedPacketLen = 104; PacketWriter packet = target.GetWriter(); Assert.AreEqual(expectedPacketLen, packet.Length); Assert.AreEqual(skills[2].Skill, target.StartSkills[2].Skill); Assert.AreEqual(pantscolor, target.PantsColor); Assert.AreEqual(beardstyle, target.FacialHairStyle); }
protected override bool OnHandleMessage(IMessage message, PhotonServerPeer serverPeer) { Log.DebugFormat("on handle in login server create character handler hit"); var para = new Dictionary <byte, object> { { (byte)ClientParameterCode.PeerId, message.Parameters[(byte)ClientParameterCode.PeerId] }, { (byte)ClientParameterCode.SubOperationCode, message.Parameters[(byte)ClientParameterCode.SubOperationCode] } }; var operation = new CreateCharacter(serverPeer.Protocol, message); if (!operation.IsValid) { Log.DebugFormat("operation invalid"); serverPeer.SendOperationResponse( new OperationResponse(message.Code) { ReturnCode = (int)ErrorCode.OperationInvalid, DebugMessage = operation.GetErrorMessage(), Parameters = para }, new SendParameters()); return(true); } try { using (var session = NHibernateHelper.OpenSession()) { using (var transaction = session.BeginTransaction()) { var user = session.QueryOver <User>().Where(u => u.Id == operation.UserId).List().FirstOrDefault(); var profile = session.QueryOver <UserProfile>().Where(up => up.UserId == user).List().FirstOrDefault(); var characters = session.QueryOver <ComplexCharacter>().Where(cc => cc.UserId == user).List(); if (profile != null && profile.CharacterSlots <= characters.Count) { Log.DebugFormat("profile invalid or no slots"); serverPeer.SendOperationResponse( new OperationResponse(message.Code) { ReturnCode = (int)ErrorCode.InvalidCharacter, DebugMessage = "No free character slots", Parameters = para }, new SendParameters()); } else { var mySerializer = new XmlSerializer(typeof(CharacterCreateDetails)); var reader = new StringReader(operation.CharacterCreateDetails); var createCharacter = (CharacterCreateDetails)mySerializer.Deserialize(reader); var character = session.QueryOver <ComplexCharacter>() .Where(cc => cc.Name == createCharacter.CharacterName).List().FirstOrDefault(); if (character != null) { Log.DebugFormat("null character"); transaction.Commit(); serverPeer.SendOperationResponse( new OperationResponse(message.Code) { ReturnCode = (int)ErrorCode.InvalidCharacter, DebugMessage = "Character name taken", Parameters = para }, new SendParameters()); } else { Log.DebugFormat("creating character"); var newChar = new ComplexCharacter { UserId = user, Name = createCharacter.CharacterName, Class = createCharacter.CharacterClass, Sex = createCharacter.Sex, Level = 1 }; session.Save(newChar); transaction.Commit(); serverPeer.SendOperationResponse( new OperationResponse(message.Code) { ReturnCode = (int)ErrorCode.Ok, Parameters = para }, new SendParameters()); } } } } return(true); } catch (Exception e) { Log.DebugFormat("invalid character"); Log.Error(e); serverPeer.SendOperationResponse( new OperationResponse(message.Code) { ReturnCode = (int)ErrorCode.InvalidCharacter, DebugMessage = e.ToString(), Parameters = para }, new SendParameters()); } return(true); }