public async Task ChangeClassAsync(CharacterClassType classType) { if (Class == classType) { _logger.Error( GameLanguage.Instance.GetMessageFromKey(LanguageKey.CANT_CHANGE_SAME_CLASS, Session.Account.Language)); return; } if (InventoryService.Any(s => s.Value.Type == NoscorePocketType.Wear)) { await SendPacketAsync(new MsgPacket { Message = GameLanguage.Instance.GetMessageFromKey(LanguageKey.EQ_NOT_EMPTY, AccountLanguage), Type = MessageType.White }).ConfigureAwait(false); return; } JobLevel = 1; JobLevelXp = 0; await SendPacketAsync(new NpInfoPacket()).ConfigureAwait(false); await SendPacketAsync(new PclearPacket()).ConfigureAwait(false); if (classType == CharacterClassType.Adventurer) { HairStyle = HairStyle > HairStyleType.HairStyleB ? 0 : HairStyle; } LoadSpeed(); Class = classType; Hp = MaxHp; Mp = MaxMp; var itemsToAdd = new List <BasicEquipment>(); foreach (var(key, _) in _worldConfiguration.Value.BasicEquipments) { switch (key) { case nameof(CharacterClassType.Adventurer) when Class == CharacterClassType.Adventurer: case nameof(CharacterClassType.Archer) when Class == CharacterClassType.Archer: case nameof(CharacterClassType.Mage) when Class == CharacterClassType.Mage: case nameof(CharacterClassType.MartialArtist) when Class == CharacterClassType.MartialArtist: case nameof(CharacterClassType.Swordsman) when Class == CharacterClassType.Swordsman: itemsToAdd.AddRange(_worldConfiguration.Value.BasicEquipments[key]); break; default: break; } } foreach (var inv in itemsToAdd .Select(itemToAdd => InventoryService.AddItemToPocket(InventoryItemInstance.Create(ItemProvider.Create(itemToAdd.VNum, itemToAdd.Amount), CharacterId), itemToAdd.NoscorePocketType)) .Where(inv => inv != null)) { await SendPacketsAsync( inv !.Select(invItem => invItem.GeneratePocketChange((PocketType)invItem.Type, invItem.Slot))).ConfigureAwait(false); } await SendPacketAsync(this.GenerateTit()).ConfigureAwait(false); await SendPacketAsync(GenerateStat()).ConfigureAwait(false); await MapInstance.SendPacketAsync(this.GenerateEq()).ConfigureAwait(false); await MapInstance.SendPacketAsync(this.GenerateEff(8)).ConfigureAwait(false); //TODO: Faction await SendPacketAsync(this.GenerateCond()).ConfigureAwait(false); await SendPacketAsync(GenerateLev()).ConfigureAwait(false); await SendPacketAsync(this.GenerateCMode()).ConfigureAwait(false); await SendPacketAsync(new MsgPacket { Message = GameLanguage.Instance.GetMessageFromKey(LanguageKey.CLASS_CHANGED, Session.Account.Language), Type = MessageType.White }).ConfigureAwait(false); QuicklistEntries = new List <QuicklistEntryDto> { new QuicklistEntryDto { Id = Guid.NewGuid(), CharacterId = CharacterId, QuickListIndex = 0, Slot = 9, Type = 1, IconType = 3, IconVNum = 1 } }; await MapInstance.SendPacketAsync(this.GenerateIn(Prefix ?? ""), new EveryoneBut(Session !.Channel !.Id)).ConfigureAwait(false); await MapInstance.SendPacketAsync(Group !.GeneratePidx(this)).ConfigureAwait(false); await MapInstance.SendPacketAsync(this.GenerateEff(6)).ConfigureAwait(false); await MapInstance.SendPacketAsync(this.GenerateEff(198)).ConfigureAwait(false); }