public void Test_Delete_Friend_When_Disconnected()
        {
            var guid       = Guid.NewGuid();
            var targetGuid = Guid.NewGuid();
            var list       = new List <CharacterDto>
            {
                _session.Character,
                new CharacterDto {
                    CharacterId = 2, Name = "test"
                }
            };

            _characterDao.Setup(s => s.FirstOrDefault(It.IsAny <Expression <Func <CharacterDto, bool> > >()))
            .Returns((Expression <Func <CharacterDto, bool> > exp) => list.FirstOrDefault(exp.Compile()));
            _characterRelationDao.InsertOrUpdate(new[]
            {
                new CharacterRelationDto
                {
                    RelatedCharacterId  = 2,
                    CharacterRelationId = targetGuid,
                    CharacterId         = _session.Character.CharacterId,
                    RelationType        = CharacterRelationType.Blocked
                }
            });
            var blDelPacket = new BlDelPacket
            {
                CharacterId = 2
            };

            _BlDelPacketHandler.Execute(blDelPacket, _session);

            Assert.IsTrue(_characterRelationDao.LoadAll().Count() == 0);
        }
Esempio n. 2
0
        public async Task Test_Delete_Friend_When_Disconnected()
        {
            var targetGuid = Guid.NewGuid();
            var list       = new List <CharacterDto>
            {
                _session !.Character !,
                new CharacterDto {
                    CharacterId = 2, Name = "test"
                }
            };

            _characterDao !.Setup(s => s.FirstOrDefault(It.IsAny <Expression <Func <CharacterDto, bool> > >()))
            .Returns((Expression <Func <CharacterDto, bool> > exp) => list.FirstOrDefault(exp.Compile()));
            _characterRelationDao !.InsertOrUpdate(new[]
            {
                new CharacterRelationDto
                {
                    RelatedCharacterId  = 2,
                    CharacterRelationId = targetGuid,
                    CharacterId         = _session.Character.CharacterId,
                    RelationType        = CharacterRelationType.Blocked
                }
            });
            var blDelPacket = new BlDelPacket
            {
                CharacterId = 2
            };

            await _blDelPacketHandler !.ExecuteAsync(blDelPacket, _session).ConfigureAwait(false);

            Assert.IsTrue(!_characterRelationDao.LoadAll().Any());
        }
Esempio n. 3
0
        public void InsertI18N(string file, LogLanguageKey logLanguageKey)
        {
            var listoftext = _dao.LoadAll().ToDictionary(x => (x.Key, x.RegionType), x => x.Text);

            Parallel.ForEach((RegionType[])Enum.GetValues(typeof(RegionType)), region =>
            {
                var dtos = new Dictionary <string, TDto>();
                try
                {
                    using var stream = new StreamReader(I18NTextFileName(file, region),
                                                        Encoding.Default);
                    while (!stream.EndOfStream)
                    {
                        var line = stream.ReadLine();
                        if (line == null)
                        {
                            continue;
                        }
                        var currentLine = line.Split('\t');
                        if (currentLine.Length > 1 && !listoftext.ContainsKey((currentLine[0], region)) &&
                            !dtos.ContainsKey(currentLine[0]))
                        {
                            dtos.Add(currentLine[0], new TDto()
                            {
                                Key        = currentLine[0],
                                RegionType = region,
                                Text       = currentLine[1],
                            });
                        }
                    }
Esempio n. 4
0
        public void ImportQuests(string folder)
        {
            _questRewards = _questRewardDao.LoadAll().ToDictionary(x => x.QuestRewardId, x => x);

            var actionList = new Dictionary <string, Func <Dictionary <string, string[][]>, object> >
            {
                { nameof(QuestDto.QuestId), chunk => Convert.ToInt16(chunk["VNUM"][0][1]) },
                { nameof(QuestDto.QuestType), chunk => Convert.ToInt32(chunk["VNUM"][0][2]) },
                { nameof(QuestDto.AutoFinish), chunk => chunk["VNUM"][0][3] == "1" },
                { nameof(QuestDto.IsDaily), chunk => chunk["VNUM"][0][4] == "-1" },
                { nameof(QuestDto.RequiredQuestId), chunk => chunk["VNUM"][0][5] != "-1" ? short.Parse(chunk["VNUM"][0][5]) : (short?)null },
                { nameof(QuestDto.IsSecondary), chunk => chunk["VNUM"][0][6] != "-1" },
                { nameof(QuestDto.LevelMin), chunk => Convert.ToByte(chunk["LEVEL"][0][1]) },
                { nameof(QuestDto.LevelMax), chunk => Convert.ToByte(chunk["LEVEL"][0][2]) },
                { nameof(QuestDto.TitleI18NKey), chunk => chunk["TITLE"][0][1] },
                { nameof(QuestDto.DescI18NKey), chunk => chunk["DESC"][0][1] },
                { nameof(QuestDto.TargetX), chunk => chunk["TARGET"][0][1] == "-1" ? (short?)null : Convert.ToInt16(chunk["TARGET"][0][1]) },
                { nameof(QuestDto.TargetY), chunk => chunk["TARGET"][0][2] == "-1"  ? (short?)null : Convert.ToInt16(chunk["TARGET"][0][2]) },
                { nameof(QuestDto.TargetMap), chunk => chunk["TARGET"][0][3] == "-1"  ? (short?)null : Convert.ToInt16(chunk["TARGET"][0][3]) },
                { nameof(QuestDto.StartDialogId), chunk => chunk["TARGET"][0][1] == "-1" ? (int?)null :  Convert.ToInt32(chunk["TALK"][0][1]) },
                { nameof(QuestDto.EndDialogId), chunk => chunk["TARGET"][0][2] == "-1" ? (int?)null :  Convert.ToInt32(chunk["TALK"][0][2]) },
                { nameof(QuestDto.NextQuestId), chunk => chunk["LINK"][0][1] == "-1" ? (short?)null :  Convert.ToInt16(chunk["LINK"][0][1]) },
                { nameof(QuestDto.QuestQuestReward), chunk => ImportQuestQuestRewards(chunk) },
                { nameof(QuestDto.QuestObjective), chunk => ImportQuestObjectives(chunk) },
            };
            var genericParser = new GenericParser <QuestDto>(folder + _fileQuestDat, "END", 0, actionList, _logger);
            var quests        = genericParser.GetDtos();

            _questDao.InsertOrUpdate(quests);
            _questQuestRewardDao.InsertOrUpdate(quests.Where(s => s.QuestQuestReward != null).SelectMany(s => s.QuestQuestReward));
            _questObjectiveDao.InsertOrUpdate(quests.Where(s => s.QuestObjective != null).SelectMany(s => s.QuestObjective));

            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.QUESTS_PARSED), quests.Count);
        }
Esempio n. 5
0
        public void InsertScripts(string folder)
        {
            var allScripts = _scriptDao.LoadAll().ToList();

            using var stream = new StreamReader(folder + FileCardDat, Encoding.Default);
            var    scripts = new List <ScriptDto>();
            string?line;
            byte   scriptId = 0;

            while ((line = stream.ReadLine()) != null)
            {
                var split = line.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                if (line.StartsWith("#"))
                {
                    continue;
                }
                if (split.Length > 1 && split[0] == "script")
                {
                    scriptId = Convert.ToByte(split[1]);
                }
                else if (split.Length > 2 && !allScripts.Any(s => s.ScriptId == scriptId && s.ScriptStepId == Convert.ToInt16(split[0])))
                {
                    var canParse       = short.TryParse(split[2], out var argument1);
                    var stringArgument = !canParse ? split[2] : null;
                    scripts.Add(new ScriptDto()
                    {
                        Id             = Guid.NewGuid(),
                        ScriptStepId   = Convert.ToInt16(split[0]),
                        StepType       = split[1],
                        StringArgument = stringArgument,
                        Argument1      = canParse ? argument1 : (short?)null,
                        Argument2      = split.Length > 3 && short.TryParse(split[3], out var argument2) ? argument2 : (short?)null,
                        Argument3      = split.Length > 4 && short.TryParse(split[4], out var argument3) ? argument3 : (short?)null,
                        ScriptId       = scriptId
                    });
Esempio n. 6
0
        public void Test_Add_Friend()
        {
            _friendRequestHolder.FriendRequestCharacters.TryAdd(Guid.NewGuid(),
                                                                new Tuple <long, long>(_targetSession.Character.CharacterId, _session.Character.CharacterId));
            var finsPacket = new FinsPacket
            {
                CharacterId = _targetSession.Character.CharacterId,
                Type        = FinsPacketType.Accepted
            };

            using var friend = new FriendController(_logger, _characterRelationDao, TestHelpers.Instance.CharacterDao,
                                                    _friendRequestHolder, _connectedAccountHttpClient.Object);
            _friendHttpClient.Setup(s => s.AddFriend(It.IsAny <FriendShipRequest>()))
            .Returns(friend.AddFriend(new FriendShipRequest
            {
                CharacterId = _session.Character.CharacterId, FinsPacket = finsPacket
            }));
            _finsPacketHandler.Execute(finsPacket, _session);
            Assert.IsTrue(_characterRelationDao.LoadAll().Count() == 2);
        }
Esempio n. 7
0
        public static void Main()
        {
            try { Console.Title = Title; } catch (PlatformNotSupportedException) { }
            Core.I18N.Logger.PrintHeader(ConsoleText);
            InitializeConfiguration();
            TypeAdapterConfig.GlobalSettings.Default.IgnoreAttribute(typeof(I18NFromAttribute));
            LogLanguage.Language = DatabaseConfiguration.Language;
            try
            {
                var optionsBuilder = new DbContextOptionsBuilder <NosCoreContext>();
                optionsBuilder.UseNpgsql(DatabaseConfiguration.Database !.ConnectionString);
                DataAccessHelper.Instance.Initialize(optionsBuilder.Options);

                var npcMonsters = _npcMonsterDao.LoadAll().ToList();
                TypeAdapterConfig <MapMonsterDto, GameObject.MapMonster> .NewConfig().ConstructUsing(src => new GameObject.MapMonster(npcMonsters, Logger));

                TypeAdapterConfig <MapNpcDto, GameObject.MapNpc> .NewConfig().ConstructUsing(src => new GameObject.MapNpc(new Mock <IItemProvider>().Object, new Mock <IGenericDao <ShopDto> >().Object, new Mock <IGenericDao <ShopItemDto> >().Object, npcMonsters, Logger, new List <NpcTalkDto>()));

                while (true)
                {
                    Logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.SELECT_MAPID));
                    var input = Console.ReadLine();
                    if ((input == null) || !int.TryParse(input, out var askMapId))
                    {
                        Logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.WRONG_SELECTED_MAPID));
                        continue;
                    }

                    var map = _mapDao.FirstOrDefault(m => m.MapId == askMapId)?.Adapt <GameObject.Map.Map>();

                    if ((!(map?.XLength > 0)) || (map.YLength <= 0))
                    {
                        continue;
                    }

                    if (_guiWindow?.Exists ?? false)
                    {
                        _guiWindow.Exit();
                    }

                    new Thread(() =>
                    {
                        _guiWindow = new GuiWindow(map, 4, map.XLength, map.YLength, GraphicsMode.Default,
                                                   $"NosCore Pathfinder GUI - Map {map.MapId}");
                        _guiWindow.Run(30);
                    }).Start();
                }
            }
            catch
            {
                Console.ReadKey();
            }
        }
Esempio n. 8
0
        public void InsertMapNpcs(List <string[]> packetList)
        {
            var   npcmonsterdb         = _npcMonsterDao.LoadAll().ToList();
            var   mapnpcdb             = _mapNpcDao.LoadAll().ToList();
            var   npcCounter           = 0;
            short map                  = 0;
            var   npcs                 = new List <MapNpcDto>();
            var   npcMvPacketsList     = packetList.Where(o => o.Length > 14 && o[0].Equals("mv") && o[1].Equals("2") && long.Parse(o[2]) < 20000).GroupBy(s => s[2]).Select(s => Convert.ToInt32(s.First()[2])).ToList();
            var   effPacketsDictionary = packetList.Where(o => o[0].Equals("eff") && o[1].Equals("2") && long.Parse(o[2]) <= 20000).GroupBy(s => Convert.ToInt16(s[2])).ToDictionary(x => x.Key, x => Convert.ToInt16(x.First()[3]));
            var   npcTalks             = _npcTalkDao.LoadAll().ToDictionary(s => s.DialogId, s => s);

            foreach (var currentPacket in packetList.Where(o => (o.Length > 7 && o[0].Equals("in") && (o[1] == "2") && long.Parse(o[3]) <= 20000) || o[0].Equals("at")))
            {
                if ((currentPacket.Length > 5) && (currentPacket[0] == "at"))
                {
                    map = short.Parse(currentPacket[2]);
                    continue;
                }

                var mapnpcid = short.Parse(currentPacket[3]);
                var npctest  = new MapNpcDto
                {
                    MapX        = short.Parse(currentPacket[4]),
                    MapY        = short.Parse(currentPacket[5]),
                    MapId       = map,
                    VNum        = short.Parse(currentPacket[2]),
                    MapNpcId    = mapnpcid,
                    Effect      = effPacketsDictionary.ContainsKey(mapnpcid) ? effPacketsDictionary[mapnpcid] : (short)0,
                    EffectDelay = 4750,
                    IsMoving    = npcMvPacketsList.Contains(mapnpcid),
                    Direction   = byte.Parse(currentPacket[6]),
                    Dialog      = npcTalks.ContainsKey(short.Parse(currentPacket[9])) ? short.Parse(currentPacket[9]) : (short?)null,
                    IsSitting   = currentPacket[13] != "1",
                    IsDisabled  = false
                };

                if ((npcmonsterdb.FirstOrDefault(s => s.NpcMonsterVNum.Equals(npctest.VNum)) == null) ||
                    (mapnpcdb.FirstOrDefault(s => s.MapNpcId.Equals(npctest.MapNpcId)) !=
                     null) ||
                    (npcs.Count(i => i.MapNpcId == npctest.MapNpcId) != 0))
                {
                    continue;
                }

                npcs.Add(npctest);
                npcCounter++;
            }

            _mapNpcDao.InsertOrUpdate(npcs);
            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.NPCS_PARSED), npcCounter);
        }
Esempio n. 9
0
        public void InsertShops(List <string[]> packetList)
        {
            var shopCounter = 0;
            var shops       = new List <ShopDto>();
            var mapnpcdb    = _mapNpcDao.LoadAll().ToList();
            var shopdb      = _shopDao.LoadAll().ToList();

            foreach (var currentPacket in packetList.Where(o =>
                                                           (o.Length > 6) && o[0].Equals("shop") && o[1].Equals("2"))
                     )
            {
                var npcid = short.Parse(currentPacket[2]);
                var npc   = mapnpcdb.FirstOrDefault(s => s.MapNpcId == npcid);
                if (npc == null)
                {
                    continue;
                }

                var name = new StringBuilder();
                for (var j = 6; j < currentPacket.Length; j++)
                {
                    name.Append($"{currentPacket[j]}");
                    if (j != currentPacket.Length - 1)
                    {
                        name.Append(" ");
                    }
                }

                var shop = new ShopDto
                {
                    Name     = name.ToString(),
                    MapNpcId = npc.MapNpcId,
                    MenuType = byte.Parse(currentPacket[4]),
                    ShopType = byte.Parse(currentPacket[5])
                };

                if ((shopdb.FirstOrDefault(s => s.MapNpcId == npc.MapNpcId) != null) ||
                    shops.Any(s => s.MapNpcId == npc.MapNpcId))
                {
                    continue;
                }

                shops.Add(shop);
                shopCounter++;
            }

            _shopDao.InsertOrUpdate(shops);
            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.SHOPS_PARSED),
                                shopCounter);
        }
Esempio n. 10
0
        public GuiWindow(Map map, byte gridsize, int width, int height, GraphicsMode mode, string title) : base(
                width * gridsize, height * gridsize, mode, title)
        {
            _originalWidth  = width * gridsize;
            _originalHeight = height * gridsize;
            _map            = map;
            _gridsizeX      = gridsize;
            _gridsizeY      = gridsize;
            _gridsize       = gridsize;
            _monsters       = _mapMonsterDao.Where(s => s.MapId == map.MapId)
                              .Adapt <List <MapMonster> >();
            var npcMonsters = _npcMonsterDao.LoadAll().ToList();
            var mapInstance =
                new MapInstance(map, new Guid(), false, MapInstanceType.BaseMapInstance,
                                new MapItemProvider(new List <IHandler <MapItem, Tuple <MapItem, GetPacket> > >()),
                                null, _logger)
            {
                IsSleeping = false
            };

            foreach (var mapMonster in _monsters)
            {
                mapMonster.PositionX     = mapMonster.MapX;
                mapMonster.PositionY     = mapMonster.MapY;
                mapMonster.MapInstance   = mapInstance;
                mapMonster.MapInstanceId = mapInstance.MapInstanceId;
                mapMonster.Mp            = 100;
                mapMonster.Hp            = 100;
                mapMonster.Speed         = npcMonsters.Find(s => s.NpcMonsterVNum == mapMonster.MapId)?.Speed ?? 0;
                mapMonster.IsAlive       = true;
            }

            _npcs = _mapNpcDao.Where(s => s.MapId == map.MapId).Cast <MapNpc>().ToList();
            foreach (var mapNpc in _npcs)
            {
                mapNpc.PositionX     = mapNpc.MapX;
                mapNpc.PositionY     = mapNpc.MapY;
                mapNpc.MapInstance   = mapInstance;
                mapNpc.MapInstanceId = mapInstance.MapInstanceId;
                mapNpc.Mp            = 100;
                mapNpc.Hp            = 100;
                mapNpc.Speed         = npcMonsters.Find(s => s.NpcMonsterVNum == mapNpc.MapId)?.Speed ?? 0;
                mapNpc.IsAlive       = true;
            }

            Parallel.ForEach(_monsters.Where(s => s.Life == null), monster => monster.StartLife());
            Parallel.ForEach(_npcs.Where(s => s.Life == null), npc => npc.StartLife());
            GetMap();
        }
Esempio n. 11
0
        public BazaarItemsHolder(IGenericDao <BazaarItemDto> bazaarItemDao,
                                 IGenericDao <IItemInstanceDto> itemInstanceDao, IGenericDao <CharacterDto> characterDao)
        {
            var billist           = bazaarItemDao.LoadAll().ToList();
            var bzItemInstanceIds = billist.Select(o => o.ItemInstanceId).ToList();
            var bzCharacterIds    = billist.Select(o => o.SellerId).ToList();
            var itemInstancelist  = itemInstanceDao.Where(s => bzItemInstanceIds.Contains(s.Id)).ToList();
            var characterList     = characterDao.Where(s => bzCharacterIds.Contains(s.CharacterId)).ToList();

            BazaarItems = new ConcurrentDictionary <long, BazaarLink>(billist.ToDictionary(x => x.BazaarItemId,
                                                                                           x => new BazaarLink
            {
                ItemInstance = itemInstancelist.First(s => s.Id == x.ItemInstanceId).Adapt <ItemInstanceDto>(),
                BazaarItem   = x, SellerName = characterList.First(s => s.CharacterId == x.SellerId).Name !
            }));
Esempio n. 12
0
        private void Initialize()
        {
            var mails         = _mailDao.LoadAll().ToList();
            var idcopy        = 0;
            var idmail        = 0;
            var charactersIds = mails.Select(s => s.ReceiverId)
                                .Union(mails.Where(s => s.SenderId != null).Select(s => (long)s.SenderId !));
            var characternames = new Dictionary <long, string?>();

            foreach (var characterId in charactersIds)
            {
                characternames.Add(characterId, _characterDao.FirstOrDefault(s => s.CharacterId == characterId)?.Name);
            }

            foreach (var mail in mails)
            {
                var     itinst = _itemInstanceDao.FirstOrDefault(s => s.Id == mail.ItemInstanceId);
                ItemDto?it     = null;
                if (itinst != null)
                {
                    it = _items.FirstOrDefault(s => s.VNum == itinst.ItemVNum);
                }

                var senderName   = mail.SenderId == null ? "NOSMALL" : characternames[(long)mail.SenderId];
                var receiverName = characternames[mail.ReceiverId];
                var mailId       = mail.IsSenderCopy ? (short)idcopy : (short)idmail;
                this[mail.IsSenderCopy ? mail.SenderId ?? 0 : mail.ReceiverId][mail.IsSenderCopy].TryAdd(mailId,
                                                                                                         new MailData
                {
                    ItemInstance = itinst?.Adapt <ItemInstanceDto>(),
                    SenderName   = senderName,
                    ReceiverName = receiverName,
                    MailId       = mailId,
                    MailDto      = mail,
                    ItemType     = (short?)it?.ItemType ?? -1
                });
                if (mail.IsSenderCopy)
                {
                    idcopy++;
                }
                else
                {
                    idmail++;
                }
            }
        }
Esempio n. 13
0
        public void Initialize()
        {
            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LOADING_MAPINSTANCES));

            var monsters = _mapMonsters.LoadAll().Adapt <IEnumerable <MapMonster> >().GroupBy(u => u.MapId).ToDictionary(group => group.Key, group => group.ToList());
            var npcs     = _mapNpcs.LoadAll().Adapt <IEnumerable <MapNpc> >().GroupBy(u => u.MapId).ToDictionary(group => group.Key, group => group.ToList());
            var portals  = _portalDao.LoadAll().ToList();

            var mapsdic = _maps.ToDictionary(x => x.MapId, x => Guid.NewGuid());

            MapInstances = new ConcurrentDictionary <Guid, MapInstance>(_maps.Adapt <List <Map.Map> >().ToDictionary(
                                                                            map => mapsdic[map.MapId],
                                                                            map =>
            {
                var mapinstance = new MapInstance(map, mapsdic[map.MapId], map.ShopAllowed, MapInstanceType.BaseMapInstance,
                                                  _mapItemProvider, _adapter, _logger);
                if (monsters.ContainsKey(map.MapId))
                {
                    mapinstance.LoadMonsters(monsters[map.MapId]);
                }
                if (npcs.ContainsKey(map.MapId))
                {
                    mapinstance.LoadNpcs(npcs[map.MapId]);
                }
                mapinstance.StartLife();
                return(mapinstance);
            }));

            var mapInstancePartitioner = Partitioner.Create(MapInstances.Values, EnumerablePartitionerOptions.NoBuffering);

            Parallel.ForEach(mapInstancePartitioner, mapInstance =>
            {
                var partitioner = Partitioner.Create(
                    portals.Where(s => s.SourceMapId == mapInstance.Map.MapId).Adapt <List <Portal> >(),
                    EnumerablePartitionerOptions.None);
                var portalList = new ConcurrentDictionary <int, Portal>();
                Parallel.ForEach(partitioner, portal =>
                {
                    portal.SourceMapInstanceId      = mapInstance.MapInstanceId;
                    portal.DestinationMapInstanceId = GetBaseMapInstanceIdByMapId(portal.DestinationMapId);
                    portalList[portal.PortalId]     = portal;
                });
                mapInstance.Portals.AddRange(portalList.Select(s => s.Value));
            });
        }
Esempio n. 14
0
        public void InsertMapMonster(List <string[]> packetList)
        {
            short map = 0;
            var   mobMvPacketsList = packetList.Where(o => o[0].Equals("mv") && o[1].Equals("3"))
                                     .Select(currentPacket => Convert.ToInt32(currentPacket[2])).Distinct().ToList();
            var monsters     = new List <MapMonsterDto>();
            var mapMonsterdb = _mapMonsterDao.LoadAll().ToList();
            var npcMonsterdb = _npcMonsterDao.LoadAll().ToList();

            foreach (var currentPacket in packetList.Where(o => (o.Length > 7 && o[0].Equals("in") && (o[1] == "3") && long.Parse(o[3]) <= 20000) || o[0].Equals("at")))
            {
                if ((currentPacket.Length > 5) && (currentPacket[0] == "at"))
                {
                    map = short.Parse(currentPacket[2]);
                    continue;
                }

                var monster = new MapMonsterDto
                {
                    MapId        = map,
                    VNum         = short.Parse(currentPacket[2]),
                    MapMonsterId = int.Parse(currentPacket[3]),
                    MapX         = short.Parse(currentPacket[4]),
                    MapY         = short.Parse(currentPacket[5]),
                    Direction    = (byte)(currentPacket[6] == string.Empty ? 0 : byte.Parse(currentPacket[6])),
                    IsDisabled   = false,
                    IsMoving     = mobMvPacketsList.Contains(int.Parse(currentPacket[3]))
                };

                if ((npcMonsterdb.FirstOrDefault(s => s.NpcMonsterVNum.Equals(monster.VNum)) == null) ||
                    (mapMonsterdb.FirstOrDefault(s => s.MapMonsterId.Equals(monster.MapMonsterId)) != null) ||
                    (monsters.Count(i => i.MapMonsterId == monster.MapMonsterId) != 0))
                {
                    continue;
                }

                monsters.Add(monster);
            }

            _mapMonsterDao.InsertOrUpdate(monsters);
            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.MONSTERS_PARSED),
                                monsters.Count);
        }
Esempio n. 15
0
        public async Task Test_Delete_Friend()
        {
            var targetSession = TestHelpers.Instance.GenerateSession();
            var guid          = Guid.NewGuid();
            var targetGuid    = Guid.NewGuid();
            var list          = new List <CharacterDto>
            {
                _session !.Character !,
                targetSession.Character !
            };

            _characterDao !.Setup(s => s.FirstOrDefault(It.IsAny <Expression <Func <CharacterDto, bool> > >()))
            .Returns((Expression <Func <CharacterDto, bool> > exp) => list.FirstOrDefault(exp.Compile()));
            _characterRelationDao !.InsertOrUpdate(new[]
            {
                new CharacterRelationDto
                {
                    CharacterId         = targetSession.Character.CharacterId,
                    CharacterRelationId = guid,
                    RelatedCharacterId  = _session.Character.CharacterId,
                    RelationType        = CharacterRelationType.Friend
                },
                new CharacterRelationDto
                {
                    RelatedCharacterId  = targetSession.Character.CharacterId,
                    CharacterRelationId = targetGuid,
                    CharacterId         = _session.Character.CharacterId,
                    RelationType        = CharacterRelationType.Friend
                }
            });
            var fdelPacket = new FdelPacket
            {
                CharacterId = targetSession.Character.CharacterId
            };

            await _fDelPacketHandler !.ExecuteAsync(fdelPacket, _session).ConfigureAwait(false);

            Assert.IsTrue(!_characterRelationDao.LoadAll().Any());
        }
Esempio n. 16
0
        public void Initialize()
        {
            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LOADING_MAPINSTANCES));

            var monsters = _mapMonsters.LoadAll().Adapt <IEnumerable <MapMonster> >().GroupBy(u => u.MapId)
                           .ToDictionary(group => group.Key, group => group.ToList());
            var npcs = _mapNpcs.LoadAll().Adapt <IEnumerable <MapNpc> >().GroupBy(u => u.MapId)
                       .ToDictionary(group => group.Key, group => group.ToList());
            var portals = _portalDao.LoadAll().ToList();

            var mapsdic = _maps.ToDictionary(x => x.MapId, x => Guid.NewGuid());

            MapInstances = new ConcurrentDictionary <Guid, MapInstance>(_maps.Adapt <List <Map.Map> >().ToDictionary(
                                                                            map => mapsdic[map.MapId],
                                                                            map =>
            {
                var mapinstance = CreateMapInstance(map, mapsdic[map.MapId], map.ShopAllowed,
                                                    MapInstanceType.BaseMapInstance, new List <IMapInstanceEventHandler>());

                if (monsters.ContainsKey(map.MapId))
                {
                    mapinstance.LoadMonsters(monsters[map.MapId]);
                }

                if (npcs.ContainsKey(map.MapId))
                {
                    mapinstance.LoadNpcs(npcs[map.MapId]);
                }

                mapinstance.StartLife();
                return(mapinstance);
            }));

            var mapInstancePartitioner =
                Partitioner.Create(MapInstances.Values, EnumerablePartitionerOptions.NoBuffering);

            Parallel.ForEach(mapInstancePartitioner, mapInstance => { LoadPortals(mapInstance, portals); });
        }
Esempio n. 17
0
        public void InsertPortals(List <string[]> packetList)
        {
            var   portalsdb     = _portalDao.LoadAll().ToList();
            var   _maps         = _mapDao.LoadAll().ToList();
            short map           = 0;
            var   portalCounter = 0;
            var   lodPortal     = new PortalDto
            {
                SourceMapId      = 150,
                SourceX          = 172,
                SourceY          = 171,
                DestinationMapId = 98,
                Type             = PortalType.MapPortal,
                DestinationX     = 6,
                DestinationY     = 36,
                IsDisabled       = false
            };
            var portalsave4 = lodPortal;

            if (portalsdb.FirstOrDefault(s => s.SourceMapId == portalsave4.SourceMapId) ==
                null)
            {
                portalCounter++;
                _portalDao.InsertOrUpdate(ref lodPortal);
            }

            var minilandPortal = new PortalDto
            {
                SourceMapId      = 20001,
                SourceX          = 3,
                SourceY          = 8,
                DestinationMapId = 1,
                Type             = PortalType.MapPortal,
                DestinationX     = 48,
                DestinationY     = 132,
                IsDisabled       = false
            };

            var portalsave3 = minilandPortal;

            if (portalsdb.FirstOrDefault(s => s.SourceMapId == portalsave3.SourceMapId) ==
                null)
            {
                portalCounter++;
                _portalDao.InsertOrUpdate(ref minilandPortal);
            }

            var weddingPortal = new PortalDto
            {
                SourceMapId      = 2586,
                SourceX          = 34,
                SourceY          = 54,
                DestinationMapId = 145,
                Type             = PortalType.MapPortal,
                DestinationX     = 61,
                DestinationY     = 165,
                IsDisabled       = false
            };
            var portalsave2 = weddingPortal;

            if (portalsdb.FirstOrDefault(s => s.SourceMapId == portalsave2.SourceMapId) ==
                null)
            {
                portalCounter++;
                _portalDao.InsertOrUpdate(ref weddingPortal);
            }

            var glacerusCavernPortal = new PortalDto
            {
                SourceMapId      = 2587,
                SourceX          = 42,
                SourceY          = 3,
                DestinationMapId = 189,
                Type             = PortalType.MapPortal,
                DestinationX     = 48,
                DestinationY     = 156,
                IsDisabled       = false
            };
            var portalsave1 = glacerusCavernPortal;

            if (portalsdb.FirstOrDefault(s => s.SourceMapId == portalsave1.SourceMapId) ==
                null)
            {
                portalCounter++;
                _portalDao.InsertOrUpdate(ref glacerusCavernPortal);
            }

            foreach (var currentPacket in packetList.Where(o => o[0].Equals("at") || o[0].Equals("gp")))
            {
                if ((currentPacket.Length > 5) && (currentPacket[0] == "at"))
                {
                    map = short.Parse(currentPacket[2]);
                    continue;
                }

                if ((currentPacket.Length <= 4) || (currentPacket[0] != "gp"))
                {
                    continue;
                }

                var portal = new PortalDto
                {
                    SourceMapId      = map,
                    SourceX          = short.Parse(currentPacket[1]),
                    SourceY          = short.Parse(currentPacket[2]),
                    DestinationMapId = short.Parse(currentPacket[3]),
                    Type             = (PortalType)Enum.Parse(typeof(PortalType), currentPacket[4]),
                    DestinationX     = -1,
                    DestinationY     = -1,
                    IsDisabled       = false
                };

                if (_listPortals1.Any(s =>
                                      (s.SourceMapId == map) && (s.SourceX == portal.SourceX) && (s.SourceY == portal.SourceY) &&
                                      (s.DestinationMapId == portal.DestinationMapId)) ||
                    _maps.All(s => s.MapId != portal.SourceMapId) ||
                    _maps.All(s => s.MapId != portal.DestinationMapId))
                {
                    // Portal already in list
                    continue;
                }

                _listPortals1.Add(portal);
            }

            _listPortals1 = _listPortals1.OrderBy(s => s.SourceMapId).ThenBy(s => s.DestinationMapId)
                            .ThenBy(s => s.SourceY).ThenBy(s => s.SourceX).ToList();
            foreach (var portal in _listPortals1)
            {
                var p = _listPortals1.Except(_listPortals2).FirstOrDefault(s =>
                                                                           (s.SourceMapId == portal.DestinationMapId) && (s.DestinationMapId == portal.SourceMapId));
                if (p == null)
                {
                    continue;
                }

                portal.DestinationX = p.SourceX;
                portal.DestinationY = p.SourceY;
                p.DestinationY      = portal.SourceY;
                p.DestinationX      = portal.SourceX;
                _listPortals2.Add(p);
                _listPortals2.Add(portal);
            }


            // so this dude doesnt exist yet in DAOFactory -> insert it
            var portalsDtos = _listPortals2.Where(portal => !portalsdb
                                                  .Where(s => s.SourceMapId.Equals(portal.SourceMapId)).Any(
                                                      s => (s.DestinationMapId == portal.DestinationMapId) && (s.SourceX == portal.SourceX) &&
                                                      (s.SourceY == portal.SourceY))).ToList();

            _portalDao.InsertOrUpdate(portalsDtos);

            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.PORTALS_PARSED),
                                portalsDtos.Count + portalCounter);
        }
Esempio n. 18
0
        public void InsertShopItems(List <string[]> packetList)
        {
            var  shopitems   = new List <ShopItemDto>();
            var  itemCounter = 0;
            byte type        = 0;
            var  shopItemdb  = _shopItemDao.LoadAll().ToList();
            var  shopdb      = _shopDao.LoadAll().ToList();

            foreach (var currentPacket in packetList.Where(o => o[0].Equals("n_inv") || o[0].Equals("shopping")))
            {
                if (currentPacket[0].Equals("n_inv"))
                {
                    var npcid = short.Parse(currentPacket[2]);
                    if (shopdb.FirstOrDefault(s => s.MapNpcId == npcid) == null)
                    {
                        continue;
                    }

                    for (var i = 5; i < currentPacket.Length; i++)
                    {
                        var item = currentPacket[i].Split('.');

                        if (item.Length < 5)
                        {
                            continue;
                        }

                        var sitem = new ShopItemDto
                        {
                            ShopId = shopdb.FirstOrDefault(s => s.MapNpcId == npcid)
                                     .ShopId,
                            Type     = type,
                            Slot     = byte.Parse(item[1]),
                            ItemVNum = short.Parse(item[2]),
                            Rare     = item.Length == 6 ? sbyte.Parse(item[3]) : (short)0,
                            Upgrade  = item.Length == 6 ? byte.Parse(item[4]) : (byte)0
                        };


                        if (shopitems.Any(s =>
                                          s.ItemVNum.Equals(sitem.ItemVNum) && s.ShopId.Equals(sitem.ShopId)) ||
                            shopItemdb.Where(s => s.ShopId == sitem.ShopId)
                            .Any(s => s.ItemVNum.Equals(sitem.ItemVNum)))
                        {
                            continue;
                        }

                        shopitems.Add(sitem);
                        itemCounter++;
                    }
                }
                else if (currentPacket.Length > 3)
                {
                    type = byte.Parse(currentPacket[1]);
                }
            }

            var groups           = shopitems.GroupBy(s => s.ShopId);
            var shopListItemDtos = new List <ShopItemDto>();

            foreach (var group in groups)
            {
                var shopItemDtos = group.OrderBy(s => s.Slot).ToList();
                for (byte i = 0; i < shopItemDtos.Count; i++)
                {
                    shopItemDtos.ElementAt(i).Slot = i;
                }

                shopListItemDtos.AddRange(shopItemDtos);
            }

            _shopItemDao.InsertOrUpdate(shopListItemDtos);
            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.SHOPITEMS_PARSED),
                                itemCounter);
        }
Esempio n. 19
0
        public void InsertI18N(string folder)
        {
            _folder = folder;
            string _line;
            var    actdesclist = _i18NActDescDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var actdescdtos = new List <I18NActDescDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(ActDescTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (actdesclist.Find(s => s.Key == currentLine[0] && s.RegionType == region)
                                == null && currentLine.Length > 1 && !actdescdtos.Exists(s => s.Key == currentLine[0]))
                            {
                                actdescdtos.Add(new I18NActDescDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NActDescDao.InsertOrUpdate(actdescdtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_ACTDESC_PARSED),
                                                actdescdtos.Count,
                                                region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var cardlist = _i18NCardDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var carddtos = new List <I18NCardDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(CardTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (cardlist.Find(s => s.Key == currentLine[0] && s.RegionType == region) == null &&
                                currentLine.Length > 1 && !carddtos.Exists(s => s.Key == currentLine[0]))
                            {
                                carddtos.Add(new I18NCardDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NCardDao.InsertOrUpdate(carddtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_CARD_PARSED), carddtos.Count,
                                                region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var bcardlist = _i18NbCardDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var bcarddtos = new List <I18NbCardDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(BCardTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (bcardlist.Find(s => s.Key == currentLine[0] && s.RegionType == region)
                                == null && currentLine.Length > 1 && !bcarddtos.Exists(s => s.Key == currentLine[0]))
                            {
                                bcarddtos.Add(new I18NbCardDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NbCardDao.InsertOrUpdate(bcarddtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_BCARD_PARSED), bcarddtos.Count,
                                                region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var itemlist = _i18NItemDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var itemdtos = new List <I18NItemDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(ItemTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (itemlist.Find(s => s.Key == currentLine[0] && s.RegionType == region) == null &&
                                currentLine.Length > 1 && !itemdtos.Exists(s => s.Key == currentLine[0]))
                            {
                                itemdtos.Add(new I18NItemDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NItemDao.InsertOrUpdate(itemdtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_ITEM_PARSED), itemdtos.Count,
                                                region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var mapiddatalist = _i18NMapIdDataDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var mapiddatadtos = new List <I18NMapIdDataDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(MapIdDataTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (mapiddatalist.Find(s => s.Key == currentLine[0] && s.RegionType == region)
                                == null && currentLine.Length > 1 &&
                                !mapiddatadtos.Exists(s => s.Key == currentLine[0]))
                            {
                                mapiddatadtos.Add(new I18NMapIdDataDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NMapIdDataDao.InsertOrUpdate(mapiddatadtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_MAPIDDATA_PARSED),
                                                mapiddatadtos.Count, region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var mappointdatalist = _i18NMapPointDataDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var mappointdatadtos = new List <I18NMapPointDataDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(MapPointDataTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (mappointdatalist.Find(s =>
                                                      s.Key == currentLine[0] && s.RegionType == region) == null &&
                                currentLine.Length > 1 &&
                                !mappointdatadtos.Exists(s => s.Key == currentLine[0]))
                            {
                                mappointdatadtos.Add(new I18NMapPointDataDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NMapPointDataDao.InsertOrUpdate(mappointdatadtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_MAPPOINTDATA_PARSED),
                                                mappointdatadtos.Count, region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var npcmonsterlist = _i18NNpcMonsterDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var npcmonsterdto = new List <I18NNpcMonsterDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(MonsterTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (npcmonsterlist.Find(s => s.Key == currentLine[0] && s.RegionType == region)
                                == null && currentLine.Length > 1 &&
                                !npcmonsterdto.Exists(s => s.Key == currentLine[0]))
                            {
                                npcmonsterdto.Add(new I18NNpcMonsterDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NNpcMonsterDao.InsertOrUpdate(npcmonsterdto);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_MPCMONSTER_PARSED),
                                                npcmonsterdto.Count, region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var npcmonstertalklist = _i18NNpcMonsterTalkDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var npctalkdtos = new List <I18NNpcMonsterTalkDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(NpcTalkTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (npcmonstertalklist.Find(
                                    s => s.Key == currentLine[0] && s.RegionType == region) == null &&
                                currentLine.Length > 1 && !npctalkdtos.Exists(s => s.Key == currentLine[0]))
                            {
                                npctalkdtos.Add(new I18NNpcMonsterTalkDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NNpcMonsterTalkDao.InsertOrUpdate(npctalkdtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_NPCMONSTERTALK_PARSED),
                                                npctalkdtos.Count, region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var questlist = _i18NQuestDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var questdtos = new List <I18NQuestDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(QuestTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (questlist.Find(s => s.Key == currentLine[0] && s.RegionType == region)
                                == null && currentLine.Length > 1 && !questdtos.Exists(s => s.Key == currentLine[0]))
                            {
                                questdtos.Add(new I18NQuestDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NQuestDao.InsertOrUpdate(questdtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_QUEST_PARSED), questdtos.Count,
                                                region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }

            var skilllist = _i18NSkillDao.LoadAll().ToList();

            foreach (RegionType region in Enum.GetValues(typeof(RegionType)))
            {
                var skilldtos = new List <I18NSkillDto>();
                try
                {
                    using (var stream = new StreamReader(I18NTextFileName(SkillTxt, region),
                                                         Encoding.Default))
                    {
                        while ((_line = stream.ReadLine()) != null)
                        {
                            var currentLine = _line.Split('\t');
                            if (skilllist.Find(s => s.Key == currentLine[0] && s.RegionType == region)
                                == null && !skilldtos.Exists(s => s.Key == currentLine[0]))
                            {
                                skilldtos.Add(new I18NSkillDto
                                {
                                    Key        = currentLine[0],
                                    RegionType = region,
                                    Text       = currentLine[1]
                                });
                            }
                        }

                        _i18NSkillDao.InsertOrUpdate(skilldtos);

                        _logger.Information(string.Format(
                                                LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.I18N_SKILL_PARSED), skilldtos.Count,
                                                region));
                    }
                }
                catch (FileNotFoundException)
                {
                    _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LANGUAGE_MISSING));
                }
            }
        }
Esempio n. 20
0
        internal void InsertMapTypeMaps()
        {
            var   maptypemaps  = new List <MapTypeMapDto>();
            short mapTypeId    = 1;
            var   mapsdb       = _mapDao.LoadAll().ToList();
            var   maptypemapdb = _mapTypeMapDao.LoadAll().ToList();

            for (var i = 1; i < 300; i++)
            {
                var objectset = false;
                if ((i < 3) || ((i > 48) && (i < 53)) || ((i > 67) && (i < 76)) || (i == 102) ||
                    ((i > 103) && (i < 105)) ||
                    ((i > 144) && (i < 149)))
                {
                    // "act1"
                    mapTypeId = (short)MapTypeType.Act1;
                    objectset = true;
                }
                else if (((i > 19) && (i < 34)) || ((i > 52) && (i < 68)) || ((i > 84) && (i < 101)))
                {
                    // "act2"
                    mapTypeId = (short)MapTypeType.Act2;
                    objectset = true;
                }
                else if (((i > 40) && (i < 45)) || ((i > 45) && (i < 48)) || ((i > 99) && (i < 102)) ||
                         ((i > 104) && (i < 128)))
                {
                    // "act3"
                    mapTypeId = (short)MapTypeType.Act3;
                    objectset = true;
                }
                else if (i == 260)
                {
                    // "act3.2"
                    mapTypeId = (short)MapTypeType.Act32;
                    objectset = true;
                }
                else if (((i > 129) && (i <= 134)) || (i == 135) || (i == 137) || (i == 139) || (i == 141) ||
                         ((i > 150) && (i < 153)))
                {
                    // "act4"
                    mapTypeId = (short)MapTypeType.Act4;
                    objectset = true;
                }
                else if (i == 153)
                {
                    // "act4.2"
                    mapTypeId = (short)MapTypeType.Act42;
                    objectset = true;
                }
                else if ((i > 169) && (i < 205))
                {
                    // "act5.1"
                    mapTypeId = (short)MapTypeType.Act51;
                    objectset = true;
                }
                else if ((i > 204) && (i < 221))
                {
                    // "act5.2"
                    mapTypeId = (short)MapTypeType.Act52;
                    objectset = true;
                }
                else if (((i > 228) && (i < 233)) || ((i > 232) && (i < 238)))
                {
                    mapTypeId = (short)MapTypeType.Act61;
                    objectset = true;
                }
                else if (((i > 239) && (i < 251)) || (i == 299))
                {
                    // "act6.2"
                    mapTypeId = (short)MapTypeType.Act62;
                    objectset = true;
                }
                else if (((i > 260) && (i < 264)) || ((i > 2614) && (i < 2621)))
                {
                    // "Oasis"
                    mapTypeId = (short)MapTypeType.Oasis;
                    objectset = true;
                }
                else if (i == 103)
                {
                    // "Comet plain"
                    mapTypeId = (short)MapTypeType.CometPlain;
                    objectset = true;
                }
                else if (i == 6)
                {
                    // "Mine1"
                    mapTypeId = (short)MapTypeType.Mine1;
                    objectset = true;
                }
                else if ((i > 6) && (i < 9))
                {
                    // "Mine2"
                    mapTypeId = (short)MapTypeType.Mine2;
                    objectset = true;
                }
                else if (i == 3)
                {
                    // "Meadown of mine"
                    mapTypeId = (short)MapTypeType.MeadowOfMine;
                    objectset = true;
                }
                else if (i == 4)
                {
                    // "Sunny plain"
                    mapTypeId = (short)MapTypeType.SunnyPlain;
                    objectset = true;
                }
                else if (i == 5)
                {
                    // "Fernon"
                    mapTypeId = (short)MapTypeType.Fernon;
                    objectset = true;
                }
                else if (((i > 9) && (i < 19)) || ((i > 79) && (i < 85)))
                {
                    // "FernonF"
                    mapTypeId = (short)MapTypeType.FernonF;
                    objectset = true;
                }
                else if ((i > 75) && (i < 79))
                {
                    // "Cliff"
                    mapTypeId = (short)MapTypeType.Cliff;
                    objectset = true;
                }
                else if (i == 150)
                {
                    // "Land of the dead"
                    mapTypeId = (short)MapTypeType.LandOfTheDead;
                    objectset = true;
                }
                else if (i == 138)
                {
                    // "Cleft of Darkness"
                    mapTypeId = (short)MapTypeType.CleftOfDarkness;
                    objectset = true;
                }
                else if (i == 130)
                {
                    // "Citadel"
                    mapTypeId = (short)MapTypeType.CitadelAngel;
                    objectset = true;
                }
                else if (i == 131)
                {
                    mapTypeId = (short)MapTypeType.CitadelDemon;
                    objectset = true;
                }

                // add "act6.1a" and "act6.1d" when ids found
                var i1 = (short)i;
                var id = mapTypeId;
                if (objectset && (mapsdb.FirstOrDefault(s => s.MapId == i) !=
                                  null) &&
                    (maptypemapdb
                     .FirstOrDefault(s => (s.MapId == i1) && (s.MapTypeId == id))
                     == null))
                {
                    maptypemaps.Add(new MapTypeMapDto {
                        MapId = (short)i, MapTypeId = mapTypeId
                    });
                }
            }

            IEnumerable <MapTypeMapDto> mapDtos = maptypemaps;

            _mapTypeMapDao.InsertOrUpdate(mapDtos);
        }
Esempio n. 21
0
        internal void InsertMapTypes()
        {
            var list = _dropDao.LoadAll().ToList();
            var mt1  = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act1,
                MapTypeName      = "Act1",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt1.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt1);
            }

            var mt2 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act2,
                MapTypeName      = "Act2",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt2.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt2);
            }

            var mt3 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act3,
                MapTypeName      = "Act3",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt3.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt3);
            }

            var mt4 = new MapTypeDto
            {
                MapTypeId   = (short)MapTypeType.Act4,
                MapTypeName = "Act4",
                PotionDelay = 5000
            };

            if (list.All(s => s.MapTypeId != mt4.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt4);
            }

            var mt5 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act51,
                MapTypeName      = "Act5.1",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct5,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct5
            };

            if (list.All(s => s.MapTypeId != mt5.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt5);
            }

            var mt6 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act52,
                MapTypeName      = "Act5.2",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct5,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct5
            };

            if (list.All(s => s.MapTypeId != mt6.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt6);
            }

            var mt7 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act61,
                MapTypeName      = "Act6.1",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct6,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt7.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt7);
            }

            var mt8 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act62,
                MapTypeName      = "Act6.2",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct6,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt8.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt8);
            }

            var mt9 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act61A,
                MapTypeName      = "Act6.1a", // angel camp
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct6,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt9.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt9);
            }

            var mt10 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Act61D,
                MapTypeName      = "Act6.1d", // demon camp
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct6,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt10.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt10);
            }

            var mt11 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.CometPlain,
                MapTypeName      = "CometPlain",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt11.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt11);
            }

            var mt12 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Mine1,
                MapTypeName      = "Mine1",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt12.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt12);
            }

            var mt13 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Mine2,
                MapTypeName      = "Mine2",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt13.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt13);
            }

            var mt14 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.MeadowOfMine,
                MapTypeName      = "MeadownOfPlain",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt14.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt14);
            }

            var mt15 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.SunnyPlain,
                MapTypeName      = "SunnyPlain",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt15.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt15);
            }

            var mt16 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Fernon,
                MapTypeName      = "Fernon",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt16.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt16);
            }

            var mt17 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.FernonF,
                MapTypeName      = "FernonF",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt17.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt17);
            }

            var mt18 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Cliff,
                MapTypeName      = "Cliff",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultAct1,
                ReturnMapTypeId  = (long)RespawnType.ReturnAct1
            };

            if (list.All(s => s.MapTypeId != mt18.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt18);
            }

            var mt19 = new MapTypeDto
            {
                MapTypeId   = (short)MapTypeType.LandOfTheDead,
                MapTypeName = "LandOfTheDead",
                PotionDelay = 300
            };

            if (list.All(s => s.MapTypeId != mt19.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt19);
            }

            var mt20 = new MapTypeDto
            {
                MapTypeId   = (short)MapTypeType.Act32,
                MapTypeName = "Act 3.2",
                PotionDelay = 300
            };

            if (list.All(s => s.MapTypeId != mt20.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt20);
            }

            var mt21 = new MapTypeDto
            {
                MapTypeId   = (short)MapTypeType.CleftOfDarkness,
                MapTypeName = "Cleft of Darkness",
                PotionDelay = 300
            };

            if (list.All(s => s.MapTypeId != mt21.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt21);
            }

            var mt23 = new MapTypeDto
            {
                MapTypeId   = (short)MapTypeType.CitadelAngel,
                MapTypeName = "AngelCitadel",
                PotionDelay = 300
            };

            if (list.All(s => s.MapTypeId != mt23.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt23);
            }

            var mt24 = new MapTypeDto
            {
                MapTypeId   = (short)MapTypeType.CitadelDemon,
                MapTypeName = "DemonCitadel",
                PotionDelay = 300
            };

            if (list.All(s => s.MapTypeId != mt24.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt24);
            }

            var mt25 = new MapTypeDto
            {
                MapTypeId        = (short)MapTypeType.Oasis,
                MapTypeName      = "Oasis",
                PotionDelay      = 300,
                RespawnMapTypeId = (long)RespawnType.DefaultOasis,
                ReturnMapTypeId  = (long)RespawnType.DefaultOasis
            };

            if (list.All(s => s.MapTypeId != mt25.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt25);
            }

            var mt26 = new MapTypeDto
            {
                MapTypeId   = (short)MapTypeType.Act42,
                MapTypeName = "Act42",
                PotionDelay = 5000
            };

            if (list.All(s => s.MapTypeId != mt26.MapTypeId))
            {
                _dropDao.InsertOrUpdate(ref mt26);
            }

            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.MAPTYPES_PARSED));
        }
Esempio n. 22
0
        public void InsertNpcMonsters(string folder)
        {
            _skilldb = _skillDao.LoadAll().ToDictionary(x => x.SkillVNum, x => x);
            _dropdb  = _dropDao.LoadAll().Where(x => x.MonsterVNum != null).GroupBy(x => x.MonsterVNum).ToDictionary(x => (short)x.Key, x => x.ToList());
            var actionList = new Dictionary <string, Func <Dictionary <string, string[][]>, object> >
            {
                { nameof(NpcMonsterDto.NpcMonsterVNum), chunk => Convert.ToInt16(chunk["VNUM"][0][2]) },
                { nameof(NpcMonsterDto.NameI18NKey), chunk => chunk["NAME"][0][2] },
                { nameof(NpcMonsterDto.Level), chunk => Level(chunk) },
                { nameof(NpcMonsterDto.HeroXp), chunk => ImportHeroXp(chunk) },
                { nameof(NpcMonsterDto.Race), chunk => Convert.ToByte(chunk["RACE"][0][2]) },
                { nameof(NpcMonsterDto.RaceType), chunk => Convert.ToByte(chunk["RACE"][0][3]) },
                { nameof(NpcMonsterDto.Element), chunk => Convert.ToByte(chunk["ATTRIB"][0][2]) },
                { nameof(NpcMonsterDto.ElementRate), chunk => Convert.ToInt16(chunk["ATTRIB"][0][3]) },
                { nameof(NpcMonsterDto.FireResistance), chunk => Convert.ToInt16(chunk["ATTRIB"][0][4]) },
                { nameof(NpcMonsterDto.WaterResistance), chunk => Convert.ToInt16(chunk["ATTRIB"][0][5]) },
                { nameof(NpcMonsterDto.LightResistance), chunk => Convert.ToInt16(chunk["ATTRIB"][0][6]) },
                { nameof(NpcMonsterDto.DarkResistance), chunk => Convert.ToInt16(chunk["ATTRIB"][0][7]) },
                { nameof(NpcMonsterDto.MaxHp), chunk => Convert.ToInt32(chunk["HP/MP"][0][2]) + _basicHp[Level(chunk)] },
                { nameof(NpcMonsterDto.MaxMp), chunk => Convert.ToInt32(chunk["HP/MP"][0][3]) + Convert.ToByte(chunk["RACE"][0][2]) == 0 ? _basicPrimaryMp[Level(chunk)] : _basicSecondaryMp[Level(chunk)] },
                { nameof(NpcMonsterDto.Xp), chunk => Math.Abs(Convert.ToInt32(chunk["EXP"][0][2]) + _basicXp[Level(chunk)]) },
                { nameof(NpcMonsterDto.JobXp), chunk => Convert.ToInt32(chunk["EXP"][0][3]) + _basicJXp[Level(chunk)] },
                { nameof(NpcMonsterDto.IsHostile), chunk => chunk["PREATT"][0][2] != "0" },
                { nameof(NpcMonsterDto.NoticeRange), chunk => Convert.ToByte(chunk["PREATT"][0][4]) },
                { nameof(NpcMonsterDto.Speed), chunk => Convert.ToByte(chunk["PREATT"][0][5]) },
                { nameof(NpcMonsterDto.RespawnTime), chunk => Convert.ToInt32(chunk["PREATT"][0][6]) },
                { nameof(NpcMonsterDto.CloseDefence), chunk => Convert.ToInt16((Convert.ToInt16(chunk["ARMOR"][0][2]) - 1) * 2 + 18) },
                { nameof(NpcMonsterDto.DistanceDefence), chunk => Convert.ToInt16((Convert.ToInt16(chunk["ARMOR"][0][2]) - 1) * 3 + 17) },
                { nameof(NpcMonsterDto.MagicDefence), chunk => Convert.ToInt16((Convert.ToInt16(chunk["ARMOR"][0][2]) - 1) * 2 + 13) },
                { nameof(NpcMonsterDto.DefenceDodge), chunk => Convert.ToInt16((Convert.ToInt16(chunk["ARMOR"][0][2]) - 1) * 5 + 31) },
                { nameof(NpcMonsterDto.DistanceDefenceDodge), chunk => Convert.ToInt16((Convert.ToInt16(chunk["ARMOR"][0][2]) - 1) * 5 + 31) },
                { nameof(NpcMonsterDto.AttackClass), chunk => Convert.ToByte(chunk["ZSKILL"][0][2]) },
                { nameof(NpcMonsterDto.BasicRange), chunk => Convert.ToByte(chunk["ZSKILL"][0][3]) },
                { nameof(NpcMonsterDto.BasicArea), chunk => Convert.ToByte(chunk["ZSKILL"][0][5]) },
                { nameof(NpcMonsterDto.BasicCooldown), chunk => Convert.ToInt16(chunk["ZSKILL"][0][6]) },
                { nameof(NpcMonsterDto.AttackUpgrade), chunk => Convert.ToByte(LoadUnknownData(chunk) == 1?chunk["WINFO"][0][2]:chunk["WINFO"][0][4]) },
                { nameof(NpcMonsterDto.DefenceUpgrade), chunk => Convert.ToByte(LoadUnknownData(chunk) == 1? chunk["WINFO"][0][2]:chunk["AINFO"][0][3]) },
                { nameof(NpcMonsterDto.BasicSkill), chunk => Convert.ToInt16(chunk["EFF"][0][2]) },
                { nameof(NpcMonsterDto.VNumRequired), chunk => Convert.ToInt16(chunk["SETTING"][0][4] != "0" && ShouldLoadPetinfo(chunk) ? chunk["PETINFO"][0][2] : chunk["SETTING"][0][4]) },
                { nameof(NpcMonsterDto.AmountRequired), chunk => Convert.ToByte(chunk["SETTING"][0][4] == "0" ? "1" : ShouldLoadPetinfo(chunk) ? chunk["PETINFO"][0][3] : "0") },
                { nameof(NpcMonsterDto.DamageMinimum), chunk => ImportDamageMinimum(chunk) },
                { nameof(NpcMonsterDto.DamageMaximum), chunk => ImportDamageMaximum(chunk) },
                { nameof(NpcMonsterDto.Concentrate), chunk => ImportConcentrate(chunk) },
                { nameof(NpcMonsterDto.CriticalChance), chunk => ImportCriticalChance(chunk) },
                { nameof(NpcMonsterDto.CriticalRate), chunk => ImportCriticalRate(chunk) },
                { nameof(NpcMonsterDto.NpcMonsterSkill), chunk => ImportNpcMonsterSkill(chunk) },
                { nameof(NpcMonsterDto.BCards), chunk => ImportBCards(chunk) },
                { nameof(NpcMonsterDto.Drop), chunk => ImportDrops(chunk) },
                { nameof(NpcMonsterDto.MonsterType), chunk => ImportMonsterType(chunk) },
                { nameof(NpcMonsterDto.NoAggresiveIcon), chunk => {
                      var unknowndata = LoadUnknownData(chunk);
                      return((unknowndata == -2147483616 ||
                              unknowndata == -2147483647 ||
                              unknowndata == -2147483646) && ((Convert.ToByte(chunk["RACE"][0][2]) == 8) && (Convert.ToByte(chunk["RACE"][0][3]) == 0)));
                  } }
            };

            var genericParser = new GenericParser <NpcMonsterDto>(folder + FileNpcId,
                                                                  "#========================================================", 1, actionList, _logger);
            var monsters = genericParser.GetDtos().GroupBy(p => p.NpcMonsterVNum).Select(g => g.First()).ToList();

            _npcMonsterDao.InsertOrUpdate(monsters);
            _bCardDao.InsertOrUpdate(monsters.Where(s => s.BCards != null).SelectMany(s => s.BCards));
            _dropDao.InsertOrUpdate(monsters.Where(s => s.Drop != null).SelectMany(s => s.Drop));
            _npcMonsterSkillDao.InsertOrUpdate(monsters.Where(s => s.NpcMonsterSkill != null).SelectMany(s => s.NpcMonsterSkill));
            _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.NPCMONSTERS_PARSED), monsters.Count);
        }