コード例 #1
0
        public override void Convert(byte[] rawData)
        {
            MapDifficultyEntry mapDifficultyEntry = new MapDifficultyEntry();

            mapDifficultyEntry.Id                = (uint)GetInt32(rawData, 0);
            mapDifficultyEntry.MapId             = (MapId)GetUInt32(rawData, 1);
            mapDifficultyEntry.Index             = GetUInt32(rawData, 2);
            mapDifficultyEntry.RequirementString = GetString(rawData, 3);
            mapDifficultyEntry.ResetTime         = GetInt32(rawData, 20);
            mapDifficultyEntry.MaxPlayerCount    = GetInt32(rawData, 21);
            MapTemplate mapTemplate = World.GetMapTemplate(mapDifficultyEntry.MapId);

            if (mapTemplate == null)
            {
                return;
            }
            if (mapDifficultyEntry.Index >= 4.0)
            {
                LogManager.GetCurrentClassLogger().Warn("Invalid MapDifficulty for {0} with Index {1}.",
                                                        mapDifficultyEntry.MapId, mapDifficultyEntry.Index);
            }
            else
            {
                if (mapDifficultyEntry.MaxPlayerCount == 0)
                {
                    mapDifficultyEntry.MaxPlayerCount = mapTemplate.MaxPlayerCount;
                }
                if (mapTemplate.Difficulties == null)
                {
                    mapTemplate.Difficulties = new MapDifficultyEntry[4];
                }
                mapDifficultyEntry.Finalize(mapTemplate);
                mapTemplate.Difficulties[mapDifficultyEntry.Index] = mapDifficultyEntry;
            }
        }
コード例 #2
0
ファイル: World.DBC.cs プロジェクト: ebakkedahl/WCell
        public override void Convert(byte[] rawData)
        {
            var entry = new MapDifficultyEntry();

            entry.Id = (uint)GetInt32(rawData, 0);
            entry.MapId = (MapId)GetUInt32(rawData, 1);
            entry.Index = GetUInt32(rawData, 2);
            entry.RequirementString = GetString(rawData, 3);
            //info.TextFlags = GetUInt32(rawData, 19);
            entry.ResetTime = GetInt32(rawData, 20);
            entry.MaxPlayerCount = GetInt32(rawData, 21);

            var map = World.GetMapTemplate(entry.MapId);
            if (map != null)
            {
                if (entry.Index >= (double)RaidDifficulty.End)
                {
                    LogManager.GetCurrentClassLogger().Warn("Invalid MapDifficulty for {0} with Index {1}.", entry.MapId, entry.Index);
                    return;
                }

                if (entry.MaxPlayerCount == 0)
                {
                    entry.MaxPlayerCount = map.MaxPlayerCount;
                }

                if (map.Difficulties == null)
                {
                    map.Difficulties = new MapDifficultyEntry[(int)RaidDifficulty.End];
                }

                entry.Finalize(map);
                map.Difficulties[entry.Index] = entry;
            }
        }
コード例 #3
0
ファイル: World.DBC.cs プロジェクト: NecroSharper/WCell
        public override void Convert(byte[] rawData)
        {
            var entry = new MapDifficultyEntry();

            entry.Id                = (uint)GetInt32(rawData, 0);
            entry.MapId             = (MapId)GetUInt32(rawData, 1);
            entry.Index             = GetUInt32(rawData, 2);
            entry.RequirementString = GetString(rawData, 3);
            //info.TextFlags = GetUInt32(rawData, 19);
            entry.ResetTime      = GetInt32(rawData, 20);
            entry.MaxPlayerCount = GetInt32(rawData, 21);

            var map = World.GetMapTemplate(entry.MapId);

            if (map != null)
            {
                if (entry.Index >= (double)RaidDifficulty.End)
                {
                    LogManager.GetCurrentClassLogger().Warn("Invalid MapDifficulty for {0} with Index {1}.", entry.MapId, entry.Index);
                    return;
                }

                if (entry.MaxPlayerCount == 0)
                {
                    entry.MaxPlayerCount = map.MaxPlayerCount;
                }

                if (map.Difficulties == null)
                {
                    map.Difficulties = new MapDifficultyEntry[(int)RaidDifficulty.End];
                }

                entry.Finalize(map);
                map.Difficulties[entry.Index] = entry;
            }
        }