Exemplo n.º 1
0
 public static void LoadEmotes()
 {
     EmoteDBC.EmoteRelationReader =
         new MappedDBCReader <EmoteType, EmoteDBC.EmoteRelationConverter>(
             RealmServerConfiguration.GetDBCFile("EmotesText.dbc"));
 }
Exemplo n.º 2
0
 public static Dictionary <int, TotemCategoryInfo> ReadTotemCategories()
 {
     return(new MappedDBCReader <TotemCategoryInfo, TotemCatConverter>(
                RealmServerConfiguration.GetDBCFile("TotemCategory.dbc")).Entries);
 }
Exemplo n.º 3
0
        internal static void Initialize()
        {
            TierReader = new MappedDBCReader <SkillTiers, SkillTierConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SKILLTIERS));

            var lineReader =
                new MappedDBCReader <SkillLine, SkillLineConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SKILLLINE));

            // make sure that all these skill types have correct tiers
            foreach (var line in lineReader.Entries.Values)
            {
                ById[(uint)line.Id] = line;

                /*if ((line.Category == SkillCategory.WeaponSkill && line.Id != SkillId.DualWield) ||
                 *      line.Category == SkillCategory.ClassSkill ||
                 *      line.Category == SkillCategory.Profession ||
                 *      line.Category == SkillCategory.SecondarySkill)
                 * {
                 *
                 *      line.Tier = new SkillTier(SkillTier.DefaultTier, line.Id);
                 * }
                 * else*/
                if (line.Category == SkillCategory.Language)
                {
                    var lang = LanguageHandler.GetLanguageDescBySkillType(line.Id);
                    if (lang != null)
                    {
                        line.Language = lang.Language;
                    }
                }
            }

            RaceClassReader = new MappedDBCReader <SkillRaceClassInfo, SkillRaceClassInfoConverter>(
                RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SKILLRACECLASSINFO));


            var abilityReader =
                new MappedDBCReader <SkillAbility, SkillAbilityConverter>(
                    RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SKILLLINEABILITY));

            var abilityLists = new List <SkillAbility> [MaxSkillId];

            foreach (var ability in abilityReader.Entries.Values)
            {
                // why would the spell be null?
                if (ability.Spell != null)
                {
                    // some skills link the same spell multiple times
                    //if (!AbilitiesBySpellId.ContainsKey((SpellId)ability.Spell.Id)) {
                    //AbilitiesBySpellId.Add((SpellId)ability.Spell.Id, ability.SkillLine);
                    //}
                    ability.Spell.Ability = ability;
                }
                else
                {
                    // Don't know whats wrong here?
                }

                // create a doubly linked list
                if (ability.NextSpellId > 0)
                {
                    var nextSpell = SpellHandler.Get(ability.NextSpellId);
                    if (nextSpell != null)
                    {
                        ability.NextAbility = nextSpell.Ability;
                        if (nextSpell.Ability != null)
                        {
                            nextSpell.Ability.PreviousAbility = ability;
                        }
                    }
                }

                // initial ability to a skill
                //if (ability.AcquireMethod == SkillAcquireMethod.OnLearningSkill)
                //{
                //    ability.Skill.InitialAbilities.Add(ability);
                //}

                List <SkillAbility> abilities = abilityLists.Get((uint)ability.Skill.Id);

                if (abilities == null)
                {
                    abilities = new List <SkillAbility>();

                    ArrayUtil.Set(ref abilityLists, (uint)ability.Skill.Id, abilities);
                }

                abilities.Add(ability);
            }

            for (int i = 0; i < abilityLists.Length; i++)
            {
                if (abilityLists[i] != null)
                {
                    AbilitiesBySkill[i] = abilityLists[i].ToArray();
                }
            }
        }
Exemplo n.º 4
0
 internal static void InitDbcs()
 {
     mappeddbcDurationReader = new MappedDBCReader <DurationEntry, DBCDurationConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLDURATION));
     mappeddbcRadiusReader   = new MappedDBCReader <float, DBCRadiusConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLRADIUS));
     mappeddbcCastTimeReader = new MappedDBCReader <uint, DBCCastTimeConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLCASTTIMES));
     mappeddbcRangeReader    = new MappedDBCReader <SimpleRange, DBCRangeConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLRANGE));
     //DBCMechanicReader = new DBCReader<SpellMechanic, DBCMechanicConverter>(RealmServerConfiguration.GetDBCFile(WCellDef.DBC_SPELLMECHANIC));
     mappeddbcMechanicReader = new MappedDBCReader <string, DBCMechanicConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLMECHANIC));
     mappeddbcRuneCostReader = new MappedDBCReader <RuneCostEntry, DBCSpellRuneCostConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLRUNECOST));
 }
Exemplo n.º 5
0
        public static void Initialize()
        {
            init = true;
            var taxiNodeReader = new MappedDBCReader <PathNode, DBCTaxiNodeConverter>(
                RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_TAXINODES));

            var taxiPathReader = new MappedDBCReader <TaxiPath, DBCTaxiPathConverter>(
                RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_TAXIPATHES));

            TaxiVertexReader = new MappedDBCReader <PathVertex, DBCTaxiPathNodeConverter>(
                RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_TAXIPATHNODES));

            foreach (var node in taxiNodeReader.Entries.Values)
            {
                // skip inactive nodes
                if (node.Position == Vector3.Zero)
                {
                    continue;
                }

                ArrayUtil.Set(ref PathNodesById, node.Id, node);
                AllActiveMask.Activate(node.Id);
            }

            var nodeLists = new Dictionary <uint, SortedList <uint, PathVertex> >();
            var toRemove  = new List <int>(5);

            foreach (var path in taxiPathReader.Entries.Values)
            {
                if (taxiNodeReader.Entries.TryGetValue((int)path.StartNodeId, out path.From))
                {
                    path.From.AddPath(path);
                    taxiNodeReader.Entries.TryGetValue((int)path.EndNodeId, out path.To);
                    nodeLists[path.Id] = new SortedList <uint, PathVertex>();
                    ArrayUtil.Set(ref PathsById, path.Id, path);
                }
                else
                {
                    toRemove.Add((int)path.StartNodeId);
                    //LogManager.GetCurrentClassLogger().Warn("Taxi-Path has no valid starting-point: " + path.StartNodeId);
                }
            }

            // remove invalid taxi paths
            foreach (var path in toRemove)
            {
                taxiPathReader.Entries.Remove(path);
            }

            // add all vertices to their path
            foreach (var vertex in TaxiVertexReader.Entries.Values)
            {
                SortedList <uint, PathVertex> vertices;
                if (nodeLists.TryGetValue(vertex.PathId, out vertices))
                {
                    vertices.Add(vertex.NodeIndex, vertex);
                }
            }

            foreach (var nodeList in nodeLists)
            {
                TaxiPath path;
                if (!taxiPathReader.Entries.TryGetValue((int)nodeList.Key, out path))
                {
                    continue;
                }

                LinkedListNode <PathVertex> current = null;
                float totalLength = 0;

                foreach (var vertex in nodeList.Value.Values)
                {
                    if (current == null)
                    {
                        // This is the first PathNode in the TaxiPath
                        current = path.Nodes.AddFirst(vertex);
                        current.Value.DistFromStart = 0;
                        current.Value.TimeFromStart = 0;

                        current.Value.DistFromPrevious = 0;
                        current.Value.TimeFromPrevious = 0;
                    }
                    else
                    {
                        var isTeleport = current.Value.HasMapChange = current.Previous != null && (current.Value.MapId != current.Previous.Value.MapId ||
                                                                                                   current.Value.Flags.HasFlag(TaxiPathNodeFlags.IsTeleport));

                        if (isTeleport)
                        {
                            // Since we teleported, there is no distance from previous, and we reset the dist from start
                            current.Value.DistFromPrevious = 0;
                            current.Value.DistFromStart    = 0;
                            current.Value.TimeFromPrevious = 0;
                            current.Value.TimeFromStart    = 0;
                        }
                        else
                        {
                            // Get the distance from the current to the next
                            if (current.Previous != null)
                            {
                                var last = current.Previous.Value;
                                current.Value.DistFromPrevious = current.Value.Pos.GetDistance(ref last.Pos);
                                (current.Value.FromLastNode = (current.Value.Pos - last.Pos)).Normalize();
                                current.Value.TimeFromPrevious = (int)((current.Value.DistFromPrevious * 1000) / AirSpeed);

                                totalLength += current.Value.DistFromPrevious;
                            }

                            current.Value.DistFromStart = totalLength;
                            current.Value.TimeFromStart = (int)((totalLength * 1000) / AirSpeed);
                        }

                        current = path.Nodes.AddAfter(current, vertex);
                    }
                    vertex.ListEntry = current;
                    vertex.Path      = path;
                }

                path.PathLength = totalLength;
                path.PathTime   = (uint)((totalLength * 1000) / AirSpeed);
                var map = path.From.Map;
                if (map != null && map.FirstTaxiNode == null)
                {
                    map.FirstTaxiNode = path.From;
                }
            }
        }
Exemplo n.º 6
0
        internal static void Initialize()
        {
            TierReader =
                new MappedDBCReader <SkillTiers, SkillTierConverter>(
                    RealmServerConfiguration.GetDBCFile("SkillTiers.dbc"));
            foreach (SkillLine skillLine in new MappedDBCReader <SkillLine, SkillLineConverter>(
                         RealmServerConfiguration.GetDBCFile("SkillLine.dbc")).Entries.Values)
            {
                ById[(uint)skillLine.Id] = skillLine;
                if (skillLine.Category == SkillCategory.Language)
                {
                    LanguageDescription languageDescBySkillType =
                        LanguageHandler.GetLanguageDescBySkillType(skillLine.Id);
                    if (languageDescBySkillType != null)
                    {
                        skillLine.Language = languageDescBySkillType.Language;
                    }
                }
            }

            RaceClassReader =
                new MappedDBCReader <SkillRaceClassInfo, SkillRaceClassInfoConverter>(
                    RealmServerConfiguration.GetDBCFile("SkillRaceClassInfo.dbc"));
            MappedDBCReader <SkillAbility, SkillAbilityConverter> mappedDbcReader =
                new MappedDBCReader <SkillAbility, SkillAbilityConverter>(
                    RealmServerConfiguration.GetDBCFile("SkillLineAbility.dbc"));

            List <SkillAbility>[] arr = new List <SkillAbility> [2000];
            foreach (SkillAbility skillAbility in mappedDbcReader.Entries.Values)
            {
                if (skillAbility.Spell != null)
                {
                    skillAbility.Spell.Ability = skillAbility;
                }
                if (skillAbility.NextSpellId > SpellId.None)
                {
                    Spell spell = SpellHandler.Get(skillAbility.NextSpellId);
                    if (spell != null)
                    {
                        skillAbility.NextAbility = spell.Ability;
                        if (spell.Ability != null)
                        {
                            spell.Ability.PreviousAbility = skillAbility;
                        }
                    }
                }

                List <SkillAbility> val = arr.Get((uint)skillAbility.Skill.Id);
                if (val == null)
                {
                    val = new List <SkillAbility>();
                    ArrayUtil.Set(ref arr, (uint)skillAbility.Skill.Id, val);
                }

                val.Add(skillAbility);
            }

            for (int index = 0; index < arr.Length; ++index)
            {
                if (arr[index] != null)
                {
                    AbilitiesBySkill[index] = arr[index].ToArray();
                }
            }
        }
Exemplo n.º 7
0
 // [Initialization(InitializationPass.Fifth)]
 public static void InitTitles()
 {
     new DBCReader <TitleConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CHARTITLES));
 }
Exemplo n.º 8
0
 private static void LoadLocks()
 {
     MappedDBCReader <LockEntry, LockEntry.LockConverter> mappedDbcReader =
         new MappedDBCReader <LockEntry, LockEntry.LockConverter>(
             RealmServerConfiguration.GetDBCFile("Lock.dbc"));
 }
Exemplo n.º 9
0
        /// <summary>
        /// Depends on SpellHandler
        /// </summary>
        internal static void Initialize()
        {
            var treeReader = new MappedDBCReader <TalentTree, TalentTreeConverter>(
                RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_TALENTTREES));

            //Init our GlyphInfoHolder
            GlyphInfoHolder.Init();

            foreach (var tree in treeReader.Entries.Values)
            {
                ArrayUtil.Set(ref TalentTrees, (uint)tree.Id, tree);

                var trees = TreesByClass[(uint)tree.Class];
                if (trees == null)
                {
                    TreesByClass[(uint)tree.Class] = trees = new TalentTree[MaxTabCount];
                }

                trees[tree.TabIndex] = tree;
            }


            var talentReader = new ListDBCReader <TalentEntry, TalentConverter>(
                RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_TALENTS));

            foreach (var talent in talentReader.EntryList)
            {
                if (talent == null)
                {
                    continue;
                }

                ArrayUtil.Set(ref Entries, (uint)talent.Id, talent);
                talent.Tree.Talents.Add(talent);

                var talentRow = talent.Tree.TalentTable[talent.Row];
                if (talentRow == null)
                {
                    talent.Tree.TalentTable[talent.Row] = talentRow = new TalentEntry[MaxTalentColCount];
                }
                talentRow[talent.Col] = talent;

                for (var i = 0; i < talent.Spells.Length; i++)
                {
                    var spell = talent.Spells[i];
                    if (spell != null)
                    {
                        //if (spell.Talent != null)
                        //{
                        //    log.Warn("Spell {0} has Talents: {1} + {2}", spell, spell.Talent, talent);
                        //}
                        spell.Talent  = talent;
                        spell.ClassId = talent.Tree.Class;
                        spell.Rank    = i + 1;
                    }
                }
            }

            // calculate total count of Ranks per Tree and the index of each Talent
            foreach (var tree in treeReader.Entries.Values)
            {
                var rankCount = 0;
                foreach (var talent in tree.Talents)
                {
                    rankCount += talent.MaxRank;
                }
                tree.TotalRankCount = rankCount;

                ArrayUtil.Prune(ref tree.TalentTable);

                uint talentIndex = 0;
                for (var rowNum = 0; rowNum < tree.TalentTable.Length; rowNum++)
                {
                    if (tree.TalentTable[rowNum] != null)
                    {
                        ArrayUtil.Prune(ref tree.TalentTable[rowNum]);

                        var row = tree.TalentTable[rowNum];
                        for (var colNum = 0; colNum < row.Length; colNum++)
                        {
                            var talent = row[colNum];
                            if (talent != null)
                            {
                                talent.Index = talentIndex;
                                talentIndex += (uint)talent.MaxRank;
                            }
                        }
                    }
                }
            }
        }         // end initialize
Exemplo n.º 10
0
 public static void InitTitles()
 {
     DBCReader <TitleConverter> dbcReader =
         new DBCReader <TitleConverter>(RealmServerConfiguration.GetDBCFile("CharTitles.dbc"));
 }
Exemplo n.º 11
0
        private static void InitFactionTemplateDBC()
        {
            var dbcRdr =
                new MappedDBCReader <FactionTemplateEntry, FactionTemplateConverter>(
                    RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_FACTION_TEMPLATES));

            foreach (var templ in dbcRdr.Entries.Values)
            {
                FactionTplEntries[templ.Id] = templ;

                if (templ.FactionId == 0)
                {
                    // some templates do not have an actual faction
                    continue;
                }

                var entry   = FactionEntries[templ.FactionId];
                var faction = new Faction(entry, templ);
                ArrayUtil.Set(ref ByTemplateId, templ.Id, faction);

                // there are several templates for one faction
                if (Get(templ.FactionId) != null)
                {
                    continue;
                }

                ArrayUtil.Set(ref ById, (uint)entry.Id, faction);

                if (entry.FactionIndex > 0)
                {
                    ArrayUtil.Set(ref ByReputationIndex, (uint)entry.FactionIndex, faction);
                }
            }

            // add Factions for Races and set their faction-group
            Faction fac;

            ByRace[(uint)RaceId.Human] = fac = ById[(uint)FactionId.PLAYERHuman];
            fac.SetAlliancePlayer();

            ByRace[(uint)RaceId.Dwarf] = fac = ById[(uint)FactionId.PLAYERDwarf];
            fac.SetAlliancePlayer();

            ByRace[(uint)RaceId.NightElf] = fac = ById[(uint)FactionId.PLAYERNightElf];
            fac.SetAlliancePlayer();

            ByRace[(uint)RaceId.Gnome] = fac = ById[(uint)FactionId.PLAYERGnome];
            fac.SetAlliancePlayer();

            ByRace[(uint)RaceId.Draenei] = fac = ById[(uint)FactionId.PLAYERDraenei];
            fac.SetAlliancePlayer();


            ByRace[(uint)RaceId.Orc] = fac = ById[(uint)FactionId.PLAYEROrc];
            fac.SetHordePlayer();

            ByRace[(uint)RaceId.Undead] = fac = ById[(uint)FactionId.PLAYERUndead];
            fac.SetHordePlayer();

            ByRace[(uint)RaceId.Tauren] = fac = ById[(uint)FactionId.PLAYERTauren];
            fac.SetHordePlayer();

            ByRace[(uint)RaceId.Troll] = fac = ById[(uint)FactionId.PLAYERTroll];
            fac.SetHordePlayer();

            ByRace[(uint)RaceId.BloodElf] = fac = ById[(uint)FactionId.PLAYERBloodElf];
            fac.SetHordePlayer();

            foreach (var faction in ById)
            {
                if (faction != null)
                {
                    faction.Init();
                    if (faction.Entry.ParentId != FactionId.None)
                    {
                        var parent = Get(faction.Entry.ParentId);
                        // some factions are pointing to invalid other factions (so we have to use TryGetValue)
                        if (parent != null)
                        {
                            parent.Children.Add(faction);
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
        private static void LoadDBCs()
        {
            RandomPropPointReader = new MappedDBCReader <ItemLevelInfo, ItemRandPropPointConverter>(
                RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_RANDPROPPOINTS));

            EnchantMgr.Init();

            RandomPropertiesReader =
                new MappedDBCReader <ItemRandomPropertyEntry, ItemRandomPropertiesConverter>(RealmServerConfiguration.GetDBCFile(
                                                                                                 WCellConstants.DBC_ITEMRANDOMPROPERTIES));

            RandomSuffixReader =
                new MappedDBCReader <ItemRandomSuffixEntry, ItemRandomSuffixConverter>(RealmServerConfiguration.GetDBCFile(
                                                                                           WCellConstants.DBC_ITEMRANDOMSUFFIX));

            ScalingStatDistributionReader = new MappedDBCReader <ScalingStatDistributionEntry, ScalingStatDistributionConverter>(RealmServerConfiguration.GetDBCFile(
                                                                                                                                     WCellConstants.DBC_SCALINGSTATDISTRIBUTION));

            ScalingStatValuesReader = new MappedDBCReader <ScalingStatValues, ScalingStatValuesConverter>(RealmServerConfiguration.GetDBCFile(
                                                                                                              WCellConstants.DBC_SCALINGSTATVALUES));
        }
Exemplo n.º 13
0
 static void LoadDBCs()
 {
     new DBCReader <AchievementEntryConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_ACHIEVEMENTS));
     new DBCReader <AchievementCategoryEntryConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_ACHIEVEMENT_CATEGORIES));
     new DBCReader <AchievementCriteriaConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_ACHIEVEMENT_CRITERIAS));
 }
Exemplo n.º 14
0
 public static Dictionary <int, string> ReadCategories()
 {
     return(new MappedDBCReader <string, DBCCtfCategoriesConverter>(
                RealmServerConfiguration.GetDBCFile("Cfg_Categories.dbc")).Entries);
 }
Exemplo n.º 15
0
 //[Initialization(InitializationPass.First, null)]
 public static void LoadEmotes()
 {
     EmoteRelationReader = new MappedDBCReader <EmoteType, EmoteRelationConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_EMOTESTEXT));
 }
Exemplo n.º 16
0
 private static void LoadLocks()
 {
     new MappedDBCReader <LockEntry, LockConverter>(
         RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_LOCKS));
 }
Exemplo n.º 17
0
        //[Initialization(InitializationPass.Eighth, "Initialize Battlegrounds")]
        public static void InitializeBGs()
        {
            BattlemasterListReader = new MappedDBCReader <BattlemasterList, BattlemasterConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_BATTLEMASTERLIST));

            PVPDifficultyReader = new MappedDBCReader <PvPDifficultyEntry, PvPDifficultyConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_PVPDIFFICULTY));

            ContentMgr.Load <BattlegroundTemplate>();

            DeserterSpell = SpellHandler.Get(DeserterSpellId);

            Loaded = true;

            BattlegroundConfig.LoadSettings();

            EnsureBattlemasterRelations();
        }
Exemplo n.º 18
0
 public static void Init()
 {
     new DBCReader <GlyphSlotConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_GLYPHSLOT));
     new DBCReader <GlyphPropertiesConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_GLYPHPROPERTIES));
 }
Exemplo n.º 19
0
        public static Dictionary <int, string> ReadCategories()
        {
            var reader = new MappedDBCReader <string, DBCCtfCategoriesConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CFGCATEGORIES));

            return(reader.Entries);
        }
Exemplo n.º 20
0
 private static void LoadOtherDBCs()
 {
     new DBCReader <ShapeshiftEntryConverter>(RealmServerConfiguration.GetDBCFile("SpellShapeshiftForm"));
     new DBCReader <SummonPropertiesConverter>(RealmServerConfiguration.GetDBCFile("SummonProperties"));
 }