private void ExecuteHandler(ClientSession session) { if (session.HasCurrentMapInstance) { return; } AccountDTO account = DAOFactory.AccountDAO.LoadById(session.Account.AccountId); if (account == null) { return; } if (account.Password.ToLower() == CryptographyBase.Sha512(Password)) { CharacterDTO character = DAOFactory.CharacterDAO.LoadBySlot(account.AccountId, Slot); if (character == null) { return; } GameLogger.Instance.LogCharacterDeletion(ServerManager.Instance.ChannelId, session.Account.Name, session.Account.AccountId, character); // this was removed. propably baguettes idea, idk. //DAOFactory.GeneralLogDAO.SetCharIdNull(Convert.ToInt64(character.CharacterId)); DAOFactory.CharacterDAO.DeleteByPrimaryKey(account.AccountId, Slot); EntryPointPacket.HandlePacket(session, string.Empty); } else { session.SendPacket($"info {Language.Instance.GetMessageFromKey("BAD_PASSWORD")}"); } }
private void ExecuteHandler(ClientSession session, string packet) { if (session.HasCurrentMapInstance) { return; } long accountId = session.Account.AccountId; if (Slot <= 2 && DAOFactory.CharacterDAO.LoadBySlot(accountId, Slot) == null && Name.Length > 3 && Name.Length < 15) { Regex rg = new Regex(@"^[A-Za-z0-9_äÄöÖüÜß~*<>°+-.!_-Й¤£±†‡×ßø^\S]+$"); if (rg.Matches(Name).Count == 1) { if (DAOFactory.CharacterDAO.LoadByName(Name) == null) { GameLogger.Instance.LogCharacterCreation(ServerManager.Instance.ChannelId, session.Account.Name, session.Account.AccountId, Name, Slot, Gender, HairStyle, HairColor); CharacterDTO newCharacter = new CharacterDTO { Class = (byte)ClassType.Adventurer, Gender = Gender, HairColor = HairColor, HairStyle = HairStyle, Hp = 221, JobLevel = 1, Level = 1, MapId = 1, MapX = (short)ServerManager.RandomNumber(78, 81), MapY = (short)ServerManager.RandomNumber(114, 118), Mp = 221, MaxMateCount = 10, SpPoint = 10000, SpAdditionPoint = 0, Name = Name, Slot = Slot, AccountId = accountId, MaxPartnerCount = 3, MinilandMessage = "Welcome on Xarion", State = CharacterState.Active, MinilandPoint = 2000 }; DAOFactory.CharacterDAO.InsertOrUpdate(ref newCharacter); CharacterSkillDTO sk1 = new CharacterSkillDTO { CharacterId = newCharacter.CharacterId, SkillVNum = 200 }; CharacterSkillDTO sk2 = new CharacterSkillDTO { CharacterId = newCharacter.CharacterId, SkillVNum = 201 }; CharacterSkillDTO sk3 = new CharacterSkillDTO { CharacterId = newCharacter.CharacterId, SkillVNum = 209 }; QuicklistEntryDTO qlst1 = new QuicklistEntryDTO { CharacterId = newCharacter.CharacterId, Type = 1, Slot = 1, Pos = 1 }; QuicklistEntryDTO qlst2 = new QuicklistEntryDTO { CharacterId = newCharacter.CharacterId, Q2 = 1, Slot = 2 }; QuicklistEntryDTO qlst3 = new QuicklistEntryDTO { CharacterId = newCharacter.CharacterId, Q2 = 8, Type = 1, Slot = 1, Pos = 16 }; QuicklistEntryDTO qlst4 = new QuicklistEntryDTO { CharacterId = newCharacter.CharacterId, Q2 = 9, Type = 1, Slot = 3, Pos = 1 }; DAOFactory.QuicklistEntryDAO.InsertOrUpdate(qlst1); DAOFactory.QuicklistEntryDAO.InsertOrUpdate(qlst2); DAOFactory.QuicklistEntryDAO.InsertOrUpdate(qlst3); DAOFactory.QuicklistEntryDAO.InsertOrUpdate(qlst4); DAOFactory.CharacterSkillDAO.InsertOrUpdate(sk1); DAOFactory.CharacterSkillDAO.InsertOrUpdate(sk2); DAOFactory.CharacterSkillDAO.InsertOrUpdate(sk3); using (Inventory startupInventory = new Inventory(new Character(newCharacter))) { startupInventory.AddNewToInventory(901, 1, InventoryType.Equipment); startupInventory.AddNewToInventory(903, 1, InventoryType.Equipment); startupInventory.AddNewToInventory(905, 1, InventoryType.Equipment); startupInventory.AddNewToInventory(884, 1, InventoryType.Equipment); startupInventory.AddNewToInventory(885, 1, InventoryType.Equipment); startupInventory.AddNewToInventory(886, 1, InventoryType.Equipment); startupInventory.AddNewToInventory(887, 1, InventoryType.Equipment); startupInventory.AddNewToInventory(5228, 1, InventoryType.Main); startupInventory.AddNewToInventory(1, 1, InventoryType.Wear, 7, 8); startupInventory.AddNewToInventory(8, 1, InventoryType.Wear, 7, 8); startupInventory.AddNewToInventory(12, 1, InventoryType.Wear, 7, 8); startupInventory.AddNewToInventory(2081, 255, InventoryType.Etc); startupInventory.ForEach(i => DAOFactory.ItemInstanceDAO.InsertOrUpdate(i)); EntryPointPacket.HandlePacket(session, packet); } } else { session.SendPacketFormat($"info {Language.Instance.GetMessageFromKey("ALREADY_TAKEN")}"); } } else { session.SendPacketFormat($"info {Language.Instance.GetMessageFromKey("INVALID_CHARNAME")}"); } } }
public static void HandlePacket(object session, string packet) { EntryPointPacket entryPointPacket = new EntryPointPacket(); entryPointPacket.ExecuteHandler(session as ClientSession, packet); }