Refactoring of BNetServer

This commit is contained in:
hondacrx
2020-07-12 00:06:43 -04:00
parent 4164384b72
commit 581d077acd
318 changed files with 2046 additions and 4694 deletions
@@ -30,7 +30,7 @@ namespace Game.DataStorage
{
bool HasRecord(uint id);
void WriteRecord(uint id, LocaleConstant locale, ByteBuffer buffer);
void WriteRecord(uint id, Locale locale, ByteBuffer buffer);
void EraseRecord(uint id);
}
@@ -191,9 +191,9 @@ namespace Game.DataStorage
if (preparedStatementLocale == 0)
return;
for (LocaleConstant locale = 0; locale < LocaleConstant.Total; ++locale)
for (Locale locale = 0; locale < Locale.Total; ++locale)
{
if (Global.WorldMgr.GetDefaultDbcLocale() == locale || locale == LocaleConstant.None)
if (Global.WorldMgr.GetDefaultDbcLocale() == locale || locale == Locale.None)
continue;
PreparedStatement stmt = DB.Hotfix.GetPreparedStatement(preparedStatementLocale);
@@ -235,7 +235,7 @@ namespace Game.DataStorage
return ContainsKey(id);
}
public void WriteRecord(uint id, LocaleConstant locale, ByteBuffer buffer)
public void WriteRecord(uint id, Locale locale, ByteBuffer buffer)
{
T entry = this.LookupByKey(id);
@@ -536,13 +536,13 @@ namespace Game.DataStorage
LocalizedString localized = new LocalizedString();
if (_stringsTable == null)
{
localized[LocaleConstant.enUS] = _data.ReadCString();
localized[Locale.enUS] = _data.ReadCString();
}
else
{
var pos = _recordsOffset + (_data.Position >> 3);
int ofs = GetFieldValue<int>(fieldIndex);
localized[LocaleConstant.enUS] = _stringsTable.LookupByKey(pos + ofs);
localized[Locale.enUS] = _stringsTable.LookupByKey(pos + ofs);
}
f.SetValue(obj, localized);
@@ -732,12 +732,12 @@ namespace Game.DataStorage
public class LocalizedString
{
public bool HasString(LocaleConstant locale = SharedConst.DefaultLocale)
public bool HasString(Locale locale = SharedConst.DefaultLocale)
{
return !string.IsNullOrEmpty(stringStorage[(int)locale]);
}
public string this[LocaleConstant locale]
public string this[Locale locale]
{
get
{
@@ -749,6 +749,6 @@ namespace Game.DataStorage
}
}
StringArray stringStorage = new StringArray((int)LocaleConstant.Total);
StringArray stringStorage = new StringArray((int)Locale.Total);
}
}