private static IEnumerable <MapInfo> GetMapEntries() { var dbcPath = Path.Combine(TerrainDisplayConfig.DBCDir, TerrainDisplayConfig.MapDBCName); var dbcMapReader = new MappedDBCReader <MapInfo, DBCMapEntryConverter>(dbcPath); return(dbcMapReader.Entries.Values.ToList()); }
internal static void Init() { ApplyEnchantHandlers[(uint)ItemEnchantmentType.CombatSpell] = ApplyCombatSpell; ApplyEnchantHandlers[(uint)ItemEnchantmentType.Damage] = ApplyDamage; ApplyEnchantHandlers[(uint)ItemEnchantmentType.EquipSpell] = ApplyEquipSpell; ApplyEnchantHandlers[(uint)ItemEnchantmentType.Resistance] = ApplyResistance; ApplyEnchantHandlers[(uint)ItemEnchantmentType.Stat] = ApplyStat; ApplyEnchantHandlers[(uint)ItemEnchantmentType.Totem] = ApplyTotem; RemoveEnchantHandlers[(uint)ItemEnchantmentType.CombatSpell] = RemoveCombatSpell; RemoveEnchantHandlers[(uint)ItemEnchantmentType.Damage] = RemoveDamage; RemoveEnchantHandlers[(uint)ItemEnchantmentType.EquipSpell] = RemoveEquipSpell; RemoveEnchantHandlers[(uint)ItemEnchantmentType.Resistance] = RemoveResistance; RemoveEnchantHandlers[(uint)ItemEnchantmentType.Stat] = RemoveStat; RemoveEnchantHandlers[(uint)ItemEnchantmentType.Totem] = RemoveTotem; EnchantmentConditionReader = new MappedDBCReader<ItemEnchantmentCondition, ItemEnchantmentConditionConverter>( RealmServerConfiguration.GetDBCFile("SpellItemEnchantmentCondition.dbc")); EnchantmentEntryReader = new MappedDBCReader<ItemEnchantmentEntry, ItemEnchantmentConverter>( RealmServerConfiguration.GetDBCFile("SpellItemEnchantment.dbc")); GemPropertiesReader = new MappedDBCReader<GemProperties, GemPropertiesConverter>( RealmServerConfiguration.GetDBCFile("GemProperties.dbc")); }
internal static void Init() { ApplyEnchantToItemHandlers[(uint)ItemEnchantmentType.Damage] = ApplyDamageToItem; RemoveEnchantFromItemHandlers[(uint)ItemEnchantmentType.Damage] = RemoveDamageFromItem; ApplyEquippedEnchantHandlers[(uint)ItemEnchantmentType.Damage] = DoNothing; ApplyEquippedEnchantHandlers[(uint)ItemEnchantmentType.Resistance] = DoNothing; ApplyEquippedEnchantHandlers[(uint)ItemEnchantmentType.CombatSpell] = ApplyCombatSpell; ApplyEquippedEnchantHandlers[(uint)ItemEnchantmentType.EquipSpell] = ApplyEquipSpell; ApplyEquippedEnchantHandlers[(uint)ItemEnchantmentType.Stat] = ApplyStat; ApplyEquippedEnchantHandlers[(uint)ItemEnchantmentType.Totem] = ApplyTotem; RemoveEquippedEnchantHandlers[(uint)ItemEnchantmentType.Damage] = DoNothing; RemoveEquippedEnchantHandlers[(uint)ItemEnchantmentType.Resistance] = DoNothing; RemoveEquippedEnchantHandlers[(uint)ItemEnchantmentType.CombatSpell] = RemoveCombatSpell; RemoveEquippedEnchantHandlers[(uint)ItemEnchantmentType.EquipSpell] = RemoveEquipSpell; RemoveEquippedEnchantHandlers[(uint)ItemEnchantmentType.Stat] = RemoveStat; RemoveEquippedEnchantHandlers[(uint)ItemEnchantmentType.Totem] = RemoveTotem; EnchantmentConditionReader = new MappedDBCReader <ItemEnchantmentCondition, ItemEnchantmentConditionConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLITEMENCHANTMENTCONDITION)); EnchantmentEntryReader = new MappedDBCReader <ItemEnchantmentEntry, ItemEnchantmentConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLITEMENCHANTMENT)); GemPropertiesReader = new MappedDBCReader <GemProperties, GemPropertiesConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_GEMPROPERTIES)); }
public static void InitDefault() { var npcSpells = new MappedDBCReader <Spell[], DBCCreatureSpellConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CREATURESPELLDATA)).Entries; PetSpells = new Spell[10000][]; foreach (var pair in npcSpells) { ArrayUtil.Set(ref PetSpells, (uint)pair.Key, pair.Value); } ArrayUtil.Prune(ref PetSpells); CreatureFamilies = new MappedDBCReader <CreatureFamily, DBCCreatureFamilyConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CREATUREFAMILIES)).Entries; BankBagSlotPrices = new ListDBCReader <uint, DBCBankBagSlotConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_BANKBAGSLOTPRICES)).EntryList.ToArray(); DefaultFaction = FactionMgr.ById[(uint)FactionId.Creature]; VehicleSeatEntries = new MappedDBCReader <VehicleSeatEntry, DBCVehicleSeatConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_VEHICLESEATS)).Entries; VehicleEntries = new MappedDBCReader <VehicleEntry, DBCVehicleConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_VEHICLES)).Entries; BarberShopStyles = new MappedDBCReader <BarberShopStyleEntry, BarberShopStyleConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_BARBERSHOPSTYLE)).Entries; InitTypeHandlers(); }
internal static void Init() { ApplyEnchantHandlers[(uint)ItemEnchantmentType.CombatSpell] = ApplyCombatSpell; ApplyEnchantHandlers[(uint)ItemEnchantmentType.Damage] = ApplyDamage; ApplyEnchantHandlers[(uint)ItemEnchantmentType.EquipSpell] = ApplyEquipSpell; ApplyEnchantHandlers[(uint)ItemEnchantmentType.Resistance] = ApplyResistance; ApplyEnchantHandlers[(uint)ItemEnchantmentType.Stat] = ApplyStat; ApplyEnchantHandlers[(uint)ItemEnchantmentType.Totem] = ApplyTotem; RemoveEnchantHandlers[(uint)ItemEnchantmentType.CombatSpell] = RemoveCombatSpell; RemoveEnchantHandlers[(uint)ItemEnchantmentType.Damage] = RemoveDamage; RemoveEnchantHandlers[(uint)ItemEnchantmentType.EquipSpell] = RemoveEquipSpell; RemoveEnchantHandlers[(uint)ItemEnchantmentType.Resistance] = RemoveResistance; RemoveEnchantHandlers[(uint)ItemEnchantmentType.Stat] = RemoveStat; RemoveEnchantHandlers[(uint)ItemEnchantmentType.Totem] = RemoveTotem; EnchantmentConditionReader = new MappedDBCReader<ItemEnchantmentCondition, ItemEnchantmentConditionConverter>( RealmServerConfiguration.GetDBCFile(WCellDef.DBC_SPELLITEMENCHANTMENTCONDITION)); EnchantmentEntryReader = new MappedDBCReader<ItemEnchantmentEntry, ItemEnchantmentConverter>( RealmServerConfiguration.GetDBCFile(WCellDef.DBC_SPELLITEMENCHANTMENT)); GemPropertiesReader = new MappedDBCReader<GemProperties, GemPropertiesConverter>( RealmServerConfiguration.GetDBCFile(WCellDef.DBC_GEMPROPERTIES)); }
public static Dictionary <int, TotemCategoryInfo> ReadTotemCategories() { var reader = new MappedDBCReader <TotemCategoryInfo, TotemCatConverter>(RealmServerConfiguration.GetDBCFile( WCellConstants.DBC_TOTEMCATEGORY)); return(reader.Entries); }
internal static void Init() { ApplyEnchantToItemHandlers[2] = ApplyDamageToItem; RemoveEnchantFromItemHandlers[2] = RemoveDamageFromItem; ApplyEquippedEnchantHandlers[2] = DoNothing; ApplyEquippedEnchantHandlers[4] = DoNothing; ApplyEquippedEnchantHandlers[1] = ApplyCombatSpell; ApplyEquippedEnchantHandlers[3] = ApplyEquipSpell; ApplyEquippedEnchantHandlers[5] = ApplyStat; ApplyEquippedEnchantHandlers[6] = ApplyTotem; RemoveEquippedEnchantHandlers[2] = DoNothing; RemoveEquippedEnchantHandlers[4] = DoNothing; RemoveEquippedEnchantHandlers[1] = RemoveCombatSpell; RemoveEquippedEnchantHandlers[3] = RemoveEquipSpell; RemoveEquippedEnchantHandlers[5] = RemoveStat; RemoveEquippedEnchantHandlers[6] = RemoveTotem; EnchantmentConditionReader = new MappedDBCReader <ItemEnchantmentCondition, ItemEnchantmentConditionConverter>( RealmServerConfiguration.GetDBCFile("SpellItemEnchantmentCondition.dbc")); EnchantmentEntryReader = new MappedDBCReader <ItemEnchantmentEntry, ItemEnchantmentConverter>( RealmServerConfiguration.GetDBCFile("SpellItemEnchantment.dbc")); GemPropertiesReader = new MappedDBCReader <GemProperties, GemPropertiesConverter>( RealmServerConfiguration.GetDBCFile("GemProperties.dbc")); }
static void LoadItemExtendedCostEntries() { var reader = new MappedDBCReader <ItemExtendedCostEntry, DBCItemExtendedCostConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_ITEMEXTENDEDCOST)); ItemExtendedCostEntries = reader.Entries; ItemExtendedCostEntries.Add(0, ItemExtendedCostEntry.NullEntry); }
public static void LoadWorldSafeLocs() { var reader = new MappedDBCReader <WorldSafeLocation, DBCWorldSafeLocationConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_WORLDSAFELOCATION)); WorldSafeLocs = reader.Entries; }
public static Dictionary <int, MapInfo> GetMapInfoMap() { if (dbcMapReader == null) { var dbcPath = Path.Combine(WCellTerrainSettings.DBCDir, WCellTerrainSettings.MapDBCName); dbcMapReader = new MappedDBCReader <MapInfo, DBCMapEntryConverter>(dbcPath); } return(dbcMapReader.Entries); }
private static void InitFactionDBC() { var dbcRdr = new MappedDBCReader <FactionEntry, FactionConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_FACTIONS)); foreach (var entry in dbcRdr.Entries.Values) { FactionEntries[entry.Id] = entry; } }
public static void WriteRangeEnum() { var ranges = new MappedDBCReader <DistanceEntry, DistanceConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLRANGE)); WriteEnum("Range", " : uint", "Spells", ranges.Entries.Values, (entry) => { return(entry.Distance == (int)entry.Distance); }, (entry) => { return(entry.Name); }, (entry) => { return(entry.Distance.ToString()); }); }
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)); }
private static void InitFactionDBC() { var dbcRdr = new MappedDBCReader<FactionEntry, FactionConverter>(RealmServerConfiguration.GetDBCFile(WCellDef.DBC_FACTIONS)); foreach (var entry in dbcRdr.Entries.Values) { FactionEntries[entry.Id] = entry; } }
public static Dictionary<uint, string> Read() { var reader = new MappedDBCReader<Spell.SpellFocusEntry, Spell.DBCSpellFocusConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLFOCUSOBJECT)); var dict = new Dictionary<uint, string>(300); foreach (var entry in reader.Entries.Values) { dict.Add(entry.Id, entry.Name); } return dict; }
public static Dictionary <uint, string> Read() { var reader = new MappedDBCReader <Spell.SpellFocusEntry, Spell.DBCSpellFocusConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELLFOCUSOBJECT)); var dict = new Dictionary <uint, string>(300); foreach (var entry in reader.Entries.Values) { dict.Add(entry.Id, entry.Name); } return(dict); }
public static void InitializeBGs() { BattlegroundMgr.BattlemasterListReader = new MappedDBCReader <BattlemasterList, BattlemasterConverter>( RealmServerConfiguration.GetDBCFile("BattlemasterList.dbc")); BattlegroundMgr.PVPDifficultyReader = new MappedDBCReader <PvPDifficultyEntry, PvPDifficultyConverter>( RealmServerConfiguration.GetDBCFile("PvpDifficulty.dbc")); ContentMgr.Load <BattlegroundTemplate>(); BattlegroundMgr.DeserterSpell = SpellHandler.Get(BattlegroundMgr.DeserterSpellId); BattlegroundMgr.Loaded = true; BattlegroundConfig.LoadSettings(); BattlegroundMgr.EnsureBattlemasterRelations(); }
/// <summary> /// Load item-set info from the DBCs (automatically called on startup) /// </summary> public static void LoadSets() { var reader = new MappedDBCReader <ItemSet, ItemSet.ItemSetDBCConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_ITEMSET)); foreach (var set in reader.Entries.Values) { if (set.Id >= Sets.Length) { Array.Resize(ref Sets, (int)set.Id + 10); } Sets[(int)set.Id] = set; } }
/// <summary> /// Depends on Table-Creation (Third) /// </summary> //[Initialization(InitializationPass.Fourth, "Initialize AreaTriggers")] public static void Initialize() { var reader = new MappedDBCReader <AreaTrigger, ATConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_AREATRIGGER)); foreach (var at in reader.Entries) { ArrayUtil.Set(ref AreaTriggers, (uint)at.Key, at.Value); } ContentMgr.Load <ATTemplate>(); if (RealmServer.InitMgr != null) { RealmServer.InitMgr.SignalGlobalMgrReady(typeof(AreaTriggerMgr)); } }
//[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(); }
private static void LoadChatChannelsDBC() { var ccDbcPath = RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CHATCHANNELS); var reader = new MappedDBCReader <ChatChannelEntry, ChatChannelConverter>(ccDbcPath); foreach (var entry in reader.Entries.Values) { ChatChannelGroup.DefaultChannelFlags.Add(entry.Id, new ChatChannelFlagsEntry { Flags = entry.ChannelFlags, ClientFlags = ChatMgr.Convert(entry.ChannelFlags) }); } return; }
static TileIdentifier() { InternalMapNames = new Dictionary <MapId, string>((int)MapId.End); var dbcPath = Path.GetFullPath(Path.Combine(TerrainDisplayConfig.DBCDir, mapDBCName)); var dbcMapReader = new MappedDBCReader <MapInfo, DBCMapEntryConverter>(dbcPath); foreach (var mapInfo in dbcMapReader.Entries.Select(entry => entry.Value)) { InternalMapNames.Add(mapInfo.Id, mapInfo.InternalName); } Redridge = new TileIdentifier { TileName = "Redridge", MapId = MapId.EasternKingdoms, MapName = InternalMapNames[MapId.EasternKingdoms], TileX = 49, TileY = 36 }; CenterTile = new TileIdentifier { TileName = "Map Center", MapId = MapId.EasternKingdoms, MapName = InternalMapNames[MapId.EasternKingdoms], TileX = 32, TileY = 32 }; Stormwind = new TileIdentifier { TileName = "Stormwind", MapId = MapId.EasternKingdoms, MapName = InternalMapNames[MapId.EasternKingdoms], TileX = 48, TileY = 30 }; BurningSteppes = new TileIdentifier { TileName = "Burning Steppes", MapId = MapId.EasternKingdoms, MapName = InternalMapNames[MapId.EasternKingdoms], TileX = 49, TileY = 33 }; }
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)); }
private static void LoadZoneInfos() { var atDbcPath = RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_AREATABLE); var dbcRdr = new MappedDBCReader <ZoneTemplate, AreaTableConverter>(atDbcPath); foreach (var zone in dbcRdr.Entries.Values) { ArrayUtil.Set(ref s_ZoneTemplates, (uint)zone.Id, zone); var map = s_MapTemplates.Get((uint)zone.MapId); if (map != null) { zone.MapTemplate = map; map.ZoneInfos.Add(zone); } } // Set ParentZone and ChildZones foreach (var zone in s_ZoneTemplates) { if (zone != null) { zone.ParentZone = s_ZoneTemplates.Get((uint)zone.ParentZoneId); } } foreach (var zone in s_ZoneTemplates) { if (zone != null) { zone.FinalizeZone(); } } new DBCReader <WorldMapOverlayConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_WORLDMAPOVERLAY)); }
//[Initialization(InitializationPass.First, null)] public static void LoadEmotes() { EmoteRelationReader = new MappedDBCReader <EmoteType, EmoteRelationConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_EMOTESTEXT)); }
private static void LoadChatChannelsDBC() { var ccDbcPath = RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CHATCHANNELS); var reader = new MappedDBCReader<ChatChannelEntry, ChatChannelConverter>(ccDbcPath); foreach (var entry in reader.Entries.Values) { ChatChannelGroup.DefaultChannelFlags.Add(entry.Id, new ChatChannelFlagsEntry { Flags = entry.ChannelFlags, ClientFlags = ChatMgr.Convert(entry.ChannelFlags) }); } return; }
internal static void Initialize() { TierReader = new MappedDBCReader<SkillTiers, SkillTierConverter>(RealmServerConfiguration.GetDBCFile(WCellDef.DBC_SKILLTIERS)); var lineReader = new MappedDBCReader<SkillLine, SkillLineConverter>(RealmServerConfiguration.GetDBCFile(WCellDef.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(WCellDef.DBC_SKILLRACECLASSINFO)); var abilityReader = new MappedDBCReader<SkillAbility, SkillAbilityConverter>( RealmServerConfiguration.GetDBCFile(WCellDef.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(); } } }
private static IEnumerable<MapInfo> GetMapEntries() { var dbcPath = Path.Combine(TerrainDisplayConfig.DBCDir, TerrainDisplayConfig.MapDBCName); var dbcMapReader = new MappedDBCReader<MapInfo, DBCMapEntryConverter>(dbcPath); return dbcMapReader.Entries.Values.ToList(); }
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(); } } }
public static void LoadEmotes() { EmoteDBC.EmoteRelationReader = new MappedDBCReader <EmoteType, EmoteDBC.EmoteRelationConverter>( RealmServerConfiguration.GetDBCFile("EmotesText.dbc")); }
public static void LoadWorldSafeLocs() { var reader = new MappedDBCReader<WorldSafeLocation, DBCWorldSafeLocationConverter>( RealmServerConfiguration.GetDBCFile(WCellDef.DBC_WORLDSAFELOCATION)); WorldSafeLocs = reader.Entries; }
public static void LoadWorldSafeLocs() { var reader = new MappedDBCReader<WorldSafeLocation, DBCWorldSafeLocationConverter>( RealmServerConfiguration.GetDBCFile("WorldSafeLocs.dbc")); WorldSafeLocs = reader.Entries; }
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); } } } } }
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(); } } }
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; } } }
public static void InitializeBGs() { BattlemasterListReader = new MappedDBCReader<BattlemasterList, BattlemasterConverter>(RealmServerConfiguration.GetDBCFile("BattlemasterList.dbc")); ContentHandler.Load<BattlegroundTemplate>(); DeserterSpell = SpellHandler.Get(DeserterSpellId); Loaded = true; BattlegroundConfig.LoadSettings(); //LoadWorldSafeLocs(); EnsureBattlemasterRelations(); }
private static void LoadZoneInfos() { var atDbcPath = RealmServerConfiguration.GetDBCFile(WCellDef.DBC_AREATABLE); var dbcRdr = new MappedDBCReader<ZoneInfo, AreaTableConverter>(atDbcPath); foreach (var zone in dbcRdr.Entries.Values) { ArrayUtil.Set(ref s_ZoneInfos, (uint)zone.Id, zone); var region = s_regionInfos.Get((uint)zone.RegionId); if (region != null) { zone.RegionInfo = region; region.ZoneInfos.Add(zone); } } // Set ParentZone and ChildZones foreach (var zone in s_ZoneInfos) { if (zone != null) { zone.ParentZone = s_ZoneInfos.Get((uint)zone.ParentZoneId); } } foreach (var zone in s_ZoneInfos) { if (zone != null) { zone.FinalizeZone(); } } }
public static void Initialize() { var reader = new MappedDBCReader<AreaTrigger, ATConverter>(RealmServerConfiguration.GetDBCFile(WCellDef.DBC_AREATRIGGER)); foreach (var at in reader.Entries) { ArrayUtil.Set(ref AreaTriggers, (uint)at.Key, at.Value); } ContentMgr.Load<ATTemplate>(); if (RealmServer.InitMgr != null) { RealmServer.InitMgr.SignalGlobalMgrReady(typeof (AreaTriggerMgr)); } }
/// <summary> /// Depends on SpellHandler /// </summary> internal static void Initialize() { var treeReader = new MappedDBCReader<TalentTree, TalentTreeConverter>( RealmServerConfiguration.GetDBCFile("TalentTab.dbc")); 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("Talent.dbc")); foreach (var talent in talentReader.EntryList) { 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; foreach (var spell in talent.Spells) { 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; } } } // 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
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; } } }
/// <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
private static void InitFactionTemplateDBC() { var dbcRdr = new MappedDBCReader<FactionTemplateEntry, FactionTemplateConverter>( RealmServerConfiguration.GetDBCFile(WCellDef.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); } } } } }
public static void InitializeBGs() { BattlemasterListReader = new MappedDBCReader<BattlemasterList, BattlemasterConverter>(RealmServerConfiguration.GetDBCFile(WCellDef.DBC_BATTLEMASTERLIST)); PVPDifficultyReader = new MappedDBCReader<PvPDifficultyEntry, PvPDifficultyConverter>(RealmServerConfiguration.GetDBCFile(WCellDef.DBC_PVPDIFFICULTY)); ContentMgr.Load<BattlegroundTemplate>(); DeserterSpell = SpellHandler.Get(DeserterSpellId); Loaded = true; BattlegroundConfig.LoadSettings(); //LoadWorldSafeLocs(); EnsureBattlemasterRelations(); }
private static void LoadZoneInfos() { var atDbcPath = RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_AREATABLE); var dbcRdr = new MappedDBCReader<ZoneTemplate, AreaTableConverter>(atDbcPath); foreach (var zone in dbcRdr.Entries.Values) { ArrayUtil.Set(ref s_ZoneTemplates, (uint)zone.Id, zone); var map = s_MapTemplates.Get((uint)zone.MapId); if (map != null) { zone.MapTemplate = map; map.ZoneInfos.Add(zone); } } // Set ParentZone and ChildZones foreach (var zone in s_ZoneTemplates) { if (zone != null) { zone.ParentZone = s_ZoneTemplates.Get((uint)zone.ParentZoneId); } } foreach (var zone in s_ZoneTemplates) { if (zone != null) { zone.FinalizeZone(); } } new DBCReader<WorldMapOverlayConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_WORLDMAPOVERLAY)); }
private static void LoadLocks() { MappedDBCReader <LockEntry, LockEntry.LockConverter> mappedDbcReader = new MappedDBCReader <LockEntry, LockEntry.LockConverter>( RealmServerConfiguration.GetDBCFile("Lock.dbc")); }
public static Dictionary <int, string> ReadCategories() { var reader = new MappedDBCReader <string, DBCCtfCategoriesConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CFGCATEGORIES)); return(reader.Entries); }
/// <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); if ((uint)tree.Class >= TreesByClass.Length) { log.Error("Talent Tree out of range {1}:{0} TreeByClass.Length {2}", tree.Class, (uint) tree.Class, TreesByClass.Length); continue; } 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