Fixed db2 loading, and world login.

This commit is contained in:
hondacrx
2023-01-11 16:38:29 -05:00
parent dd8d17a4da
commit 3dad3747ce
8 changed files with 34 additions and 65 deletions
+8 -8
View File
@@ -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));
@@ -152,11 +152,17 @@ namespace Game.DataStorage
// string data
stringsTable = new Dictionary<long, string>();
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<int, int>();
ReferenceEntry[] entries = reader.ReadArray<ReferenceEntry>((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;
+3 -3
View File
@@ -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()
+1 -1
View File
@@ -196,7 +196,7 @@ namespace Game
for (int i = 0; i < SharedConst.QuestEmoteCount; ++i)
{
short emoteId = fields.Read<short>(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<uint>(0));
continue;
+1 -1
View File
@@ -2325,7 +2325,7 @@ namespace Game.Spells
break;
default:
if (miscVal < 1)
return;
break;
mechanicImmunityMask |= 1ul << miscVal;
break;
+4 -1
View File
@@ -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)
+3 -3
View File
@@ -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...");
-42
View File
@@ -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
{