public static void LoadSpells(bool init) { if (!loaded) { InitEffectHandlers(); LoadOtherDBCs(); SpellEffect.InitMiscValueTypes(); loaded = true; Spell.InitDbcs(); new DBCReader <Spell.SpellDBCConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELL)); ContentMgr.Load <SpellLearnRelation>(); InitSummonHandlers(); SkillHandler.Initialize(); TalentMgr.Initialize(); SpellLines.InitSpellLines(); ContentMgr.Load <SpellProcEventEntry>(); ProcEventHelper.PatchSpells(ById); } if (init) { Initialize2(); } }
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(); }
private static bool LoadGtCombatRatingsDBC(out Dictionary <CombatRating, float[]> combatRatings) { combatRatings = new Dictionary <CombatRating, float[]>(); string dbcFile = RealmServerConfiguration.GetDBCFile("gtCombatRatings.dbc"); if (!File.Exists(dbcFile)) { s_log.Error(string.Format(WCell_RealmServer.DBCFileDoesntExist, dbcFile)); return(false); } ListDBCReader <float, GameTableConverter> listDbcReader = new ListDBCReader <float, GameTableConverter>(dbcFile); for (int index1 = 1; index1 < 25; ++index1) { combatRatings[(CombatRating)index1] = new float[100]; for (int index2 = (index1 - 1) * 100; index2 < index1 * 100; ++index2) { combatRatings[(CombatRating)index1][index2 - (index1 - 1) * 100] = listDbcReader.EntryList[index2]; } } return(true); }
protected static T LoadSettings(string fileName) { filename = RealmServerConfiguration.GetContentPath(fileName); T settings; if (File.Exists(filename)) { settings = Load(filename); } else { settings = new T(); } settings.Setup(); try { settings.SaveAs(filename); } catch (Exception e) { LogUtil.WarnException(e, "Unable to save Configuration file"); } return(settings); }
public static Dictionary <int, TotemCategoryInfo> ReadTotemCategories() { var reader = new MappedDBCReader <TotemCategoryInfo, TotemCatConverter>(RealmServerConfiguration.GetDBCFile( WCellConstants.DBC_TOTEMCATEGORY)); return(reader.Entries); }
private static bool LoadGtCombatRatingsDBC(out Dictionary <CombatRating, float[]> combatRatings) { combatRatings = new Dictionary <CombatRating, float[]>(); string gtDbcPath = RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_COMBATRATINGS); if (!File.Exists(gtDbcPath)) { s_log.Error(string.Format(Resources.DBCFileDoesntExist, gtDbcPath)); return(false); } var dbcRdr = new ListDBCReader <float, GameTableConverter>(gtDbcPath); for (int rating = (int)CombatRating.WeaponSkill; rating < ((int)CombatRating.Expertise + 1); rating++) { combatRatings[(CombatRating)rating] = new float[100]; for (int i = (rating - 1) * 100; i < rating * 100; i++) { combatRatings[(CombatRating)rating][i - (rating - 1) * 100] = dbcRdr.EntryList[i]; } } return(true); }
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)); }
private static void InitMisc() { StableSlotPrices = new ListDBCReader <uint, DBCStableSlotPriceConverter>( RealmServerConfiguration.GetDBCFile("StableSlotPrices.dbc")).EntryList.ToArray(); MaxStableSlots = StableSlotPrices.Length; }
private static void LoadMapData() { Instance.WorldStates = new WorldStateCollection(Instance, Constants.World.WorldStates.GlobalStates); new DBCReader <MapConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_MAPS)); new DBCReader <MapDifficultyConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_MAPDIFFICULTY)); // add existing MapTemplate objects to mapper var mapper = ContentMgr.GetMapper <MapTemplate>(); mapper.AddObjectsUInt(s_MapTemplates); // Add additional data from DB ContentMgr.Load <MapTemplate>(); // when only updating, it won't call FinalizeAfterLoad automatically: foreach (var rgn in s_MapTemplates) { if (rgn != null) { rgn.FinalizeDataHolder(); } } SetupBoundaries(); }
private static void LoadItemExtendedCostEntries() { NPCMgr.ItemExtendedCostEntries = new MappedDBCReader <ItemExtendedCostEntry, DBCItemExtendedCostConverter>( RealmServerConfiguration.GetDBCFile("ItemExtendedCost.dbc")).Entries; NPCMgr.ItemExtendedCostEntries.Add(0, ItemExtendedCostEntry.NullEntry); }
public static void LoadItems() { // ContentHandler.Load<PlayerItemEntry>(); //var reader = new DBCReader <DBCStartOutfitConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CHARSTARTOUTFIT)); }
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")); }
private static void InitFactionDBC() { foreach (FactionEntry factionEntry in new MappedDBCReader <FactionEntry, FactionConverter>( RealmServerConfiguration.GetDBCFile("Faction.dbc")).Entries.Values) { FactionMgr.FactionEntries[factionEntry.Id] = factionEntry; } }
private void StartTcpServer() { RealmServerConfiguration configuration = configurationProvider.GetConfiguration(); IPEndPoint endpoint = IPEndPoint.Parse(configuration.RealmServerEndpoint); tcpServer.Start(endpoint, 10); logger.Debug("Tcp server has been started"); }
public static void LoadWorldSafeLocs() { var reader = new MappedDBCReader <WorldSafeLocation, DBCWorldSafeLocationConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_WORLDSAFELOCATION)); WorldSafeLocs = reader.Entries; }
static void LoadItemExtendedCostEntries() { var reader = new MappedDBCReader <ItemExtendedCostEntry, DBCItemExtendedCostConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_ITEMEXTENDEDCOST)); ItemExtendedCostEntries = reader.Entries; ItemExtendedCostEntries.Add(0, ItemExtendedCostEntry.NullEntry); }
private static void InitMisc() { // Read in the prices for Stable Slots from the dbc var stableSlotPriceReader = new ListDBCReader<uint, DBCStableSlotPriceConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_STABLESLOTPRICES)); StableSlotPrices = stableSlotPriceReader.EntryList.ToArray(); MaxStableSlots = StableSlotPrices.Length; }
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; } }
private static void InitRaces() { //ContentHandler.Load<BaseRace>(); var reader = new ListDBCReader <BaseRace, DBCRaceConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CHRRACES)); foreach (var race in reader.EntryList) { race.FinalizeAfterLoad(); } }
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()); }); }
public static void EnsureMinimalSetup() { if (!initialized) { initialized = true; if (!Directory.Exists(RunDir)) { // Maybe the CWD randomly moved to Run/Debug/TestResults/TestRunName123424239453285894983435/Out/ // Use Directory.SetCurrentDirectory(...); to change it RunDir = "../../../../"; if (!Directory.Exists(RunDir)) { throw new DirectoryNotFoundException(string.Format("RunDir was not found at {0} (CWD = {1})", new DirectoryInfo(RunDir).FullName, new DirectoryInfo(Directory.GetCurrentDirectory()).FullName)); } } if (!File.Exists(WCellRealmServerConsoleExe)) { throw new DirectoryNotFoundException(string.Format("WCellRealmServerConsole.exe was not found at {0} (CWD = {1})", new FileInfo(WCellRealmServerConsoleExe).FullName, new DirectoryInfo(Directory.GetCurrentDirectory()).FullName)); } // since console will not show, lets echo console output to a file: Console.SetOut(m_output = new IndentTextWriter(LogFile) { AutoFlush = true }); LogUtil.SetupStreamLogging(m_output); RealmServer.EntryLocation = WCellRealmServerConsoleExe; var realmServ = RealmServer.Instance; // make sure to create the RealmServer instance first RealmServerConfiguration.Instance.AutoSave = false; RealmServer.ConsoleActive = false; RealmServerConfiguration.ContentDirName = Path.GetFullPath(ContentDir); RealmServerConfiguration.Initialize(); RealmAddonMgr.AddonDir = RealmAddonDir; DebugUtil.DumpDirName = DumpDir; DebugUtil.Init(); LogUtil.ExceptionRaised += new Action <string, Exception>(LogUtil_ExceptionRaised); // some sample roles PrivilegeMgr.Instance.SetGroupInfo(new[] { RoleGroupInfo.LowestRole = new RoleGroupInfo("Guest", 1, RoleStatus.Player, true, true, true, true, false, true, null, new[] { "*" }), RoleGroupInfo.HighestRole = new RoleGroupInfo("Admin", 1000, RoleStatus.Admin, true, true, true, true, true, false, null, new [] { "*" }) }); } }
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); }
/// <summary> /// Load item-set info from the DBCs (automatically called on startup) /// </summary> public static void LoadSets() { foreach (ItemSet itemSet in new MappedDBCReader <ItemSet, ItemSet.ItemSetDBCConverter>( RealmServerConfiguration.GetDBCFile("ItemSet.dbc")).Entries.Values) { if (itemSet.Id >= Sets.Length) { Array.Resize(ref Sets, (int)itemSet.Id + 10); } Sets[(int)itemSet.Id] = itemSet; } }
public static void Initialize() { ListDBCReader <DurabilityCost, DBCDurabilityCostsConverter> listDbcReader1 = new ListDBCReader <DurabilityCost, DBCDurabilityCostsConverter>( RealmServerConfiguration.GetDBCFile("DurabilityCosts.dbc")); ListDBCReader <DurabilityQuality, DBCDurabilityQualityConverter> listDbcReader2 = new ListDBCReader <DurabilityQuality, DBCDurabilityQualityConverter>( RealmServerConfiguration.GetDBCFile("DurabilityQuality.dbc")); itemClassRepairModifiers = listDbcReader1.EntryList.ToArray(); itemQualityRepairModifiers = listDbcReader2.EntryList.ToArray(); }
private static bool LoadGtBarberShopCostDBC(out float[] vals) { ListDBCReader <float, GameTableConverter> listDbcReader = new ListDBCReader <float, GameTableConverter>( RealmServerConfiguration.GetDBCFile("gtBarberShopCostBase.dbc")); vals = new float[listDbcReader.EntryList.Count]; for (int index = 0; index < vals.Length; ++index) { vals[index] = listDbcReader.EntryList[index]; } return(true); }
public static void Initialize() { var durabilityCostsReader = new ListDBCReader <DurabilityCost, DBCDurabilityCostsConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_DURABILITYCOSTS)); var durabilityQualityReader = new ListDBCReader <DurabilityQuality, DBCDurabilityQualityConverter>( RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_DURABILITYQUALITY)); itemClassRepairModifiers = durabilityCostsReader.EntryList.ToArray(); itemQualityRepairModifiers = durabilityQualityReader.EntryList.ToArray(); }
private static void InitFactionTemplateDBC() { foreach (FactionTemplateEntry template in new MappedDBCReader <FactionTemplateEntry, FactionTemplateConverter>( RealmServerConfiguration.GetDBCFile("FactionTemplate.dbc")).Entries.Values) { FactionMgr.FactionTplEntries[template.Id] = template; if (template.FactionId != FactionId.None) { FactionEntry factionEntry = FactionMgr.FactionEntries[template.FactionId]; Faction val = new Faction(factionEntry, template); ArrayUtil.Set <Faction>(ref FactionMgr.ByTemplateId, template.Id, val); if (FactionMgr.Get(template.FactionId) == null) { ArrayUtil.Set <Faction>(ref FactionMgr.ById, (uint)factionEntry.Id, val); if (factionEntry.FactionIndex > FactionReputationIndex.None) { ArrayUtil.Set <Faction>(ref FactionMgr.ByReputationIndex, (uint)factionEntry.FactionIndex, val); } } } } (FactionMgr.ByRace[1] = FactionMgr.ById[1]).SetAlliancePlayer(); (FactionMgr.ByRace[3] = FactionMgr.ById[3]).SetAlliancePlayer(); (FactionMgr.ByRace[4] = FactionMgr.ById[4]).SetAlliancePlayer(); (FactionMgr.ByRace[7] = FactionMgr.ById[8]).SetAlliancePlayer(); (FactionMgr.ByRace[11] = FactionMgr.ById[927]).SetAlliancePlayer(); (FactionMgr.ByRace[2] = FactionMgr.ById[2]).SetHordePlayer(); (FactionMgr.ByRace[5] = FactionMgr.ById[5]).SetHordePlayer(); (FactionMgr.ByRace[6] = FactionMgr.ById[6]).SetHordePlayer(); (FactionMgr.ByRace[8] = FactionMgr.ById[9]).SetHordePlayer(); (FactionMgr.ByRace[10] = FactionMgr.ById[914]).SetHordePlayer(); foreach (Faction faction1 in FactionMgr.ById) { if (faction1 != null) { faction1.Init(); if (faction1.Entry.ParentId != FactionId.None) { Faction faction2 = FactionMgr.Get(faction1.Entry.ParentId); if (faction2 != null) { faction2.Children.Add(faction1); } } } } }
private static bool LoadGtBarberShopCostDBC(out float[] vals) { string gtDbcPath = RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_BARBERSHOPCOST); var dbcRdr = new ListDBCReader <float, GameTableConverter>(gtDbcPath); vals = new float[dbcRdr.EntryList.Count]; for (int i = 0; i < vals.Length; i++) { vals[i] = dbcRdr.EntryList[i]; } return(true); }
/// <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; } }
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(); }