Example #1
0
        private void LoadMaps()
        {
            var mapFile = MAPS_D2P_DIRECTORY + "maps0.d2p"; // put this in const field

            string eleFile = MAPS_D2P_DIRECTORY + "elements.ele";

            if (!File.Exists(mapFile))
            {
                return;
            }

            logger.White("Loading Maps from d2p...");

            EleReader eleReader = new EleReader(eleFile);

            Elements elements = eleReader.ReadElements();

            D2pFile d2p   = new D2pFile(mapFile);
            var     datas = d2p.ReadAllFiles();

            UpdateLogger m_logger = new UpdateLogger();

            int x = 0;

            foreach (var data in datas)
            {
                DlmReader mapReader = new DlmReader(new MemoryStream(data.Value));
                mapReader.DecryptionKey = SqlSyncConfiguration.Instance.MapKey;
                ReadMap(mapReader, elements); //elements
                x++;
                m_logger.Update(x.Percentage(datas.Count) + "%");
            }
        }
Example #2
0
        public static void CreateInstances()
        {
            UpdateLogger updateLogger = new UpdateLogger();

            int num = 0;

            foreach (var record in Maps)
            {
                record.InteractiveElements = InteractiveElementRecord.GetActiveElementsOnMap(record.Id);

                record.Position = MapPositionRecord.GetMapPosition(record.Id);

                record.MonsterSpawnsSubArea = MonsterSpawnRecord.GetSpawns(record.SubAreaId).ToArray();

                record.NpcsRecord = NpcSpawnRecord.GetMapNpcs(record.Id).ToArray();

                record.Instance = new MapInstance(record);

                NpcSpawnsManager.Instance.SpawnAtStartup(record);

                if (record.AbleToSpawn)
                {
                    MonsterSpawnManager.Instance.SpawnMonsters(record);
                }

                updateLogger.Update(num.Percentage(Maps.Count));
                num++;
            }
        }
Example #3
0
        //     [StartupInvoke("MonsterPowerCalculator", StartupInvokePriority.Modules)]
        public static void Initialize()
        {
            UpdateLogger logger = new UpdateLogger();
            int          i      = 0;

            foreach (var monster in MonsterRecord.Monsters)
            {
                i++;

                MonsterGrade grade = monster.GetGrade(5);

                monster.Power  = grade.Level * 2;
                monster.Power += (int)(grade.LifePoints / 10);

                if (monster.Power > 1000)
                {
                    monster.Power = 1000;
                }

                if (monster.IsMiniBoss)
                {
                    monster.Power += 300;
                }

                if (monster.IsBoss)
                {
                    monster.Power += 500;
                }

                monster.UpdateInstantElement();

                logger.Update(i.Percentage(MonsterRecord.Monsters.Count));
            }
        }