diff --git a/Source/Game/DataStorage/CliDB.cs b/Source/Game/DataStorage/CliDB.cs index 902c7f1ba..1090b344a 100644 --- a/Source/Game/DataStorage/CliDB.cs +++ b/Source/Game/DataStorage/CliDB.cs @@ -426,16 +426,16 @@ namespace Game.DataStorage } // Check loaded DB2 files proper version - if (!CliDB.AreaTableStorage.ContainsKey(14618) || // last area added in 10.0.2 (46741) - !CliDB.CharTitlesStorage.ContainsKey(749) || // last char title added in 10.0.2 (46741) - !CliDB.GemPropertiesStorage.ContainsKey(4028) || // last gem property added in 10.0.2 (46741) - !CliDB.ItemStorage.ContainsKey(202712) || // last item added in 10.0.2 (46741) - !CliDB.ItemExtendedCostStorage.ContainsKey(7862) || // last item extended cost added in 10.0.2 (46741) - !CliDB.MapStorage.ContainsKey(2582) || // last map added in 10.0.2 (46741) - !CliDB.SpellNameStorage.ContainsKey(399311)) // last spell added in 10.0.2 (46741) + if (!AreaTableStorage.ContainsKey(14618) || // last area added in 10.0.2 (46741) + !CharTitlesStorage.ContainsKey(749) || // last char title added in 10.0.2 (46741) + !GemPropertiesStorage.ContainsKey(4028) || // last gem property added in 10.0.2 (46741) + !ItemStorage.ContainsKey(202712) || // last item added in 10.0.2 (46741) + !ItemExtendedCostStorage.ContainsKey(7862) || // last item extended cost added in 10.0.2 (46741) + !MapStorage.ContainsKey(2582) || // last map added in 10.0.2 (46741) + !SpellNameStorage.ContainsKey(399311)) // last spell added in 10.0.2 (46741) { Log.outError(LogFilter.Misc, "You have _outdated_ DB2 files. Please extract correct versions from current using client."); - Global.WorldMgr.ShutdownServ(10, ShutdownMask.Force, ShutdownExitCode.Error); + Environment.Exit(1); } Log.outInfo(LogFilter.ServerLoading, "Initialized {0} DB2 data storages in {1} ms", loadedFileCount, Time.GetMSTimeDiffToNow(oldMSTime)); diff --git a/Source/Game/DataStorage/ClientReader/DBReader.cs b/Source/Game/DataStorage/ClientReader/DBReader.cs index 5f2e3554e..6bf17dfaa 100644 --- a/Source/Game/DataStorage/ClientReader/DBReader.cs +++ b/Source/Game/DataStorage/ClientReader/DBReader.cs @@ -152,11 +152,17 @@ namespace Game.DataStorage // string data stringsTable = new Dictionary(); + long stringDataOffset = 0; + if (sectionIndex == 0) + stringDataOffset = (Header.RecordCount - sections[sectionIndex].NumRecords) * Header.RecordSize; + else + stringDataOffset = previousStringTableSize; + for (int i = 0; i < sections[sectionIndex].StringTableSize;) { long oldPos = reader.BaseStream.Position; - stringsTable[i + previousStringTableSize] = reader.ReadCString(); + stringsTable[i + stringDataOffset] = reader.ReadCString(); i += (int)(reader.BaseStream.Position - oldPos); } @@ -200,8 +206,7 @@ namespace Game.DataStorage refData.Entries = new Dictionary(); ReferenceEntry[] entries = reader.ReadArray((uint)refData.NumRecords); foreach (var entry in entries) - if (!refData.Entries.ContainsKey(entry.Index)) - refData.Entries[entry.Index] = entry.Id; + refData.Entries[entry.Index] = entry.Id; } else { @@ -243,9 +248,12 @@ namespace Game.DataStorage foreach (var copyRow in copyData) { - var rec = _records[copyRow.Value].Clone(); - rec.Id = copyRow.Key; - _records.Add(copyRow.Key, rec); + if (copyRow.Key != 0) + { + var rec = _records[copyRow.Value].Clone(); + rec.Id = copyRow.Key; + _records.Add(copyRow.Key, rec); + } } previousStringTableSize += sections[sectionIndex].StringTableSize; diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 095a7cd41..fb6b07da2 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -295,7 +295,7 @@ namespace Game } //General - public void LoadCypherStrings() + public bool LoadCypherStrings() { var time = Time.GetMSTime(); CypherStringStorage.Clear(); @@ -304,8 +304,7 @@ namespace Game if (result.IsEmpty()) { Log.outInfo(LogFilter.ServerLoading, "Loaded 0 CypherStrings. DB table `trinity_string` is empty."); - Global.WorldMgr.StopNow(); - return; + return false; } uint count = 0; do @@ -321,6 +320,7 @@ namespace Game while (result.NextRow()); Log.outInfo(LogFilter.ServerLoading, "Loaded {0} CypherStrings in {1} ms", count, Time.GetMSTimeDiffToNow(time)); + return true; } public void LoadRaceAndClassExpansionRequirements() diff --git a/Source/Game/Quest/Quest.cs b/Source/Game/Quest/Quest.cs index ee6476995..33b76c390 100644 --- a/Source/Game/Quest/Quest.cs +++ b/Source/Game/Quest/Quest.cs @@ -196,7 +196,7 @@ namespace Game for (int i = 0; i < SharedConst.QuestEmoteCount; ++i) { short emoteId = fields.Read(1 + i); - if (!CliDB.EmotesStorage.ContainsKey(emoteId)) + if (emoteId < 0 || !CliDB.EmotesStorage.ContainsKey(emoteId)) { Log.outError(LogFilter.Sql, "Table `quest_offer_reward` has non-existing Emote{0} ({1}) set for quest {2}. Skipped.", 1 + i, emoteId, fields.Read(0)); continue; diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 9417d5d13..0136e40af 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -2325,7 +2325,7 @@ namespace Game.Spells break; default: if (miscVal < 1) - return; + break; mechanicImmunityMask |= 1ul << miscVal; break; diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 0f4992f06..c95ce4b82 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -88,7 +88,7 @@ namespace Game.Entities if (SpellEffectsHandlers.Count == 0) { Log.outFatal(LogFilter.ServerLoading, "Could'nt find any SpellEffectHandlers. Dev needs to check this out."); - Global.WorldMgr.ShutdownServ(0, ShutdownMask.Force, ShutdownExitCode.Error); + Environment.Exit(1); } } @@ -2724,6 +2724,9 @@ namespace Game.Entities { uint enchantId = (uint)spellEffectInfo.MiscValue; var enchant = CliDB.SpellItemEnchantmentStorage.LookupByKey(enchantId); + if (enchant == null) + break; + for (var s = 0; s < ItemConst.MaxItemEnchantmentEffects; ++s) { if (enchant.Effect[s] != ItemEnchantmentType.CombatSpell) diff --git a/Source/Game/World/WorldManager.cs b/Source/Game/World/WorldManager.cs index bdfd5e466..e57ad14c9 100644 --- a/Source/Game/World/WorldManager.cs +++ b/Source/Game/World/WorldManager.cs @@ -421,7 +421,8 @@ namespace Game Global.GameEventMgr.Initialize(); Log.outInfo(LogFilter.ServerLoading, "Loading Cypher Strings..."); - Global.ObjectMgr.LoadCypherStrings(); + if (!Global.ObjectMgr.LoadCypherStrings()) + Environment.Exit(1); // not send custom type REALM_FFA_PVP to realm list RealmType server_type = IsFFAPvPRealm() ? RealmType.PVP : (RealmType)WorldConfig.GetIntValue(WorldCfg.GameType); @@ -507,11 +508,10 @@ namespace Game Global.LanguageMgr.LoadLanguagesWords(); Log.outInfo(LogFilter.ServerLoading, "Loading GameObject models..."); - GameObjectModel.LoadGameObjectModelList(); if (!GameObjectModel.LoadGameObjectModelList()) { Log.outFatal(LogFilter.ServerLoading, "Unable to load gameobject models, objects using WMO models will crash the client - server shutting down!"); - ShutdownServ(0, ShutdownMask.Force, ShutdownExitCode.Shutdown); + Environment.Exit(1); } Log.outInfo(LogFilter.ServerLoading, "Loading Instance Template..."); diff --git a/Source/Scripts/World/ItemScripts.cs b/Source/Scripts/World/ItemScripts.cs index 286eff035..b195b6e13 100644 --- a/Source/Scripts/World/ItemScripts.cs +++ b/Source/Scripts/World/ItemScripts.cs @@ -39,9 +39,6 @@ namespace Scripts.World.ItemScripts //Pilefakefur public const uint NesingwaryTrapper = 25835; - //Helpthemselves - public const uint TrappedMammothCalf = 25850; - //Theemissary public const uint Leviroth = 26452; @@ -59,16 +56,6 @@ namespace Scripts.World.ItemScripts 187999, 188000, 188001, 188002, 188003, 188004, 188005, 188006, 188007, 188008, }; - - //Helpthemselves - public static uint[] MammothTraps = - { - 188022, 188024, 188025, 188026, 188027, - 188028, 188029, 188030, 188031, 188032, - 188033, 188034, 188035, 188036, 188037, - 188038, 188039, 188040, 188041, 188042, - 188043, 188044 - }; } struct QuestIds @@ -199,35 +186,6 @@ namespace Scripts.World.ItemScripts } } - [Script] - class item_dehta_trap_smasher : ItemScript - { - public item_dehta_trap_smasher() : base("item_dehta_trap_smasher") { } - - public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId) - { - if (player.GetQuestStatus(QuestIds.CannotHelpThemselves) != QuestStatus.Incomplete) - return false; - - Creature pMammoth = player.FindNearestCreature(CreatureIds.TrappedMammothCalf, 5.0f); - if (!pMammoth) - return false; - - foreach (var id in GameObjectIds.MammothTraps) - { - GameObject pTrap = player.FindNearestGameObject(id, 11.0f); - if (pTrap) - { - pMammoth.GetAI().DoAction(1); - pTrap.SetGoState(GameObjectState.Ready); - player.KilledMonsterCredit(CreatureIds.TrappedMammothCalf); - return true; - } - } - return false; - } - } - [Script] class item_captured_frog : ItemScript {