Core/Realms: Replaced hardcoded realm category list with Cfg_Categories.db2
Port From (https://github.com/TrinityCore/TrinityCore/commit/e161874695c5506bfa3cbcddf944d68b11cbc124)
This commit is contained in:
@@ -32,46 +32,4 @@ namespace Framework.Constants
|
||||
FFAPVP = 16 // custom, free for all pvp mode like arena PvP in all zones except rest activated places and sanctuaries
|
||||
// replaced by REALM_PVP in realm list
|
||||
}
|
||||
|
||||
public enum RealmZones
|
||||
{
|
||||
Unknown = 0, // Any Language
|
||||
Development = 1, // Any Language
|
||||
UnitedStates = 2, // Extended-Latin
|
||||
Oceanic = 3, // Extended-Latin
|
||||
LatinAmerica = 4, // Extended-Latin
|
||||
Tournament5 = 5, // Basic-Latin At Create, Any At Login
|
||||
Korea = 6, // East-Asian
|
||||
Tournament7 = 7, // Basic-Latin At Create, Any At Login
|
||||
English = 8, // Extended-Latin
|
||||
German = 9, // Extended-Latin
|
||||
French = 10, // Extended-Latin
|
||||
Spanish = 11, // Extended-Latin
|
||||
Russian = 12, // Cyrillic
|
||||
Tournament13 = 13, // Basic-Latin At Create, Any At Login
|
||||
Taiwan = 14, // East-Asian
|
||||
Tournament15 = 15, // Basic-Latin At Create, Any At Login
|
||||
China = 16, // East-Asian
|
||||
Cn1 = 17, // Basic-Latin At Create, Any At Login
|
||||
Cn2 = 18, // Basic-Latin At Create, Any At Login
|
||||
Cn3 = 19, // Basic-Latin At Create, Any At Login
|
||||
Cn4 = 20, // Basic-Latin At Create, Any At Login
|
||||
Cn5 = 21, // Basic-Latin At Create, Any At Login
|
||||
Cn6 = 22, // Basic-Latin At Create, Any At Login
|
||||
Cn7 = 23, // Basic-Latin At Create, Any At Login
|
||||
Cn8 = 24, // Basic-Latin At Create, Any At Login
|
||||
Tournament25 = 25, // Basic-Latin At Create, Any At Login
|
||||
TestServer = 26, // Any Language
|
||||
Tournament27 = 27, // Basic-Latin At Create, Any At Login
|
||||
QaServer = 28, // Any Language
|
||||
Cn9 = 29, // Basic-Latin At Create, Any At Login
|
||||
TestServer2 = 30, // Any Language
|
||||
Cn10 = 31, // Basic-Latin At Create, Any At Login
|
||||
Ctc = 32,
|
||||
Cnc = 33,
|
||||
Cn14 = 34, // Basic-Latin At Create, Any At Login
|
||||
Cn269 = 35, // Basic-Latin At Create, Any At Login
|
||||
Cn37 = 36, // Basic-Latin At Create, Any At Login
|
||||
Cn58 = 37 // Basic-Latin At Create, Any At Login
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1079,6 +1079,22 @@ namespace Framework.Constants
|
||||
Factional = 0x40
|
||||
}
|
||||
|
||||
public enum CfgCategoriesCharsets
|
||||
{
|
||||
Any = 0x00,
|
||||
Latin1 = 0x01,
|
||||
English = 0x02,
|
||||
Russian = 0x04,
|
||||
Korean = 0x08,
|
||||
Chinese = 0x10
|
||||
}
|
||||
|
||||
public enum CfgCategoriesFlags
|
||||
{
|
||||
None = 0x0,
|
||||
Tournament = 0x1
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum ChrRacesFlag
|
||||
{
|
||||
|
||||
@@ -1272,13 +1272,4 @@ namespace Framework.Constants
|
||||
CallForHelp = 2541,
|
||||
FleeForAssist = 1150
|
||||
}
|
||||
|
||||
public enum LanguageType
|
||||
{
|
||||
BasicLatin = 0x00,
|
||||
ExtendenLatin = 0x01,
|
||||
Cyrillic = 0x02,
|
||||
EastAsia = 0x04,
|
||||
Any = 0xFFFF
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,11 @@ namespace Framework.Database
|
||||
PrepareStatement(HotfixStatements.SEL_BROADCAST_TEXT_DURATION, "SELECT ID, BroadcastTextID, Locale, Duration FROM broadcast_text_duration" +
|
||||
" WHERE (`VerifiedBuild` > 0) = ?");
|
||||
|
||||
// CfgCategories.db2
|
||||
PrepareStatement(HotfixStatements.SEL_CFG_CATEGORIES, "SELECT ID, Name, LocaleMask, CreateCharsetMask, ExistingCharsetMask, Flags, `Order`" +
|
||||
" FROM cfg_categories WHERE (`VerifiedBuild` > 0) = ?");
|
||||
PrepareStatement(HotfixStatements.SEL_CFG_CATEGORIES_LOCALE, "SELECT ID, Name_lang FROM cfg_categories_locale WHERE (`VerifiedBuild` > 0) = ? AND locale = ?");
|
||||
|
||||
// CfgRegions.db2
|
||||
PrepareStatement(HotfixStatements.SEL_CFG_REGIONS, "SELECT ID, Tag, RegionID, Raidorigin, RegionGroupMask, ChallengeOrigin FROM cfg_regions" +
|
||||
" WHERE (`VerifiedBuild` > 0) = ?");
|
||||
@@ -1681,6 +1686,9 @@ namespace Framework.Database
|
||||
|
||||
SEL_BROADCAST_TEXT_DURATION,
|
||||
|
||||
SEL_CFG_CATEGORIES,
|
||||
SEL_CFG_CATEGORIES_LOCALE,
|
||||
|
||||
SEL_CFG_REGIONS,
|
||||
|
||||
SEL_CHALLENGE_MODE_ITEM_BONUS_OVERRIDE,
|
||||
|
||||
@@ -15,6 +15,8 @@ using Framework.Realm;
|
||||
|
||||
public class RealmManager : Singleton<RealmManager>
|
||||
{
|
||||
public static uint HardcodedDevelopmentRealmCategoryId = 1;
|
||||
|
||||
RealmManager() { }
|
||||
|
||||
public void Initialize(int updateInterval)
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace Game.DataStorage
|
||||
BattlemasterListStorage = ReadDB2<BattlemasterListRecord>("BattlemasterList.db2", HotfixStatements.SEL_BATTLEMASTER_LIST, HotfixStatements.SEL_BATTLEMASTER_LIST_LOCALE);
|
||||
BroadcastTextStorage = ReadDB2<BroadcastTextRecord>("BroadcastText.db2", HotfixStatements.SEL_BROADCAST_TEXT, HotfixStatements.SEL_BROADCAST_TEXT_LOCALE);
|
||||
BroadcastTextDurationStorage = ReadDB2<BroadcastTextDurationRecord>("BroadcastTextDuration.db2", HotfixStatements.SEL_BROADCAST_TEXT_DURATION);
|
||||
CfgCategoriesStorage = ReadDB2<Cfg_CategoriesRecord>("Cfg_Categories.db2", HotfixStatements.SEL_CFG_CATEGORIES, HotfixStatements.SEL_CFG_CATEGORIES_LOCALE);
|
||||
CfgRegionsStorage = ReadDB2<Cfg_RegionsRecord>("Cfg_Regions.db2", HotfixStatements.SEL_CFG_REGIONS);
|
||||
ChallengeModeItemBonusOverrideStorage = ReadDB2<ChallengeModeItemBonusOverrideRecord>("ChallengeModeItemBonusOverride.db2", HotfixStatements.SEL_CHALLENGE_MODE_ITEM_BONUS_OVERRIDE);
|
||||
CharTitlesStorage = ReadDB2<CharTitlesRecord>("CharTitles.db2", HotfixStatements.SEL_CHAR_TITLES, HotfixStatements.SEL_CHAR_TITLES_LOCALE);
|
||||
@@ -525,6 +526,7 @@ namespace Game.DataStorage
|
||||
public static DB6Storage<BattlemasterListRecord> BattlemasterListStorage;
|
||||
public static DB6Storage<BroadcastTextRecord> BroadcastTextStorage;
|
||||
public static DB6Storage<BroadcastTextDurationRecord> BroadcastTextDurationStorage;
|
||||
public static DB6Storage<Cfg_CategoriesRecord> CfgCategoriesStorage;
|
||||
public static DB6Storage<Cfg_RegionsRecord> CfgRegionsStorage;
|
||||
public static DB6Storage<ChallengeModeItemBonusOverrideRecord> ChallengeModeItemBonusOverrideStorage;
|
||||
public static DB6Storage<CharTitlesRecord> CharTitlesStorage;
|
||||
|
||||
@@ -6,6 +6,21 @@ using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
public sealed class Cfg_CategoriesRecord
|
||||
{
|
||||
public uint Id;
|
||||
public LocalizedString Name;
|
||||
public ushort LocaleMask;
|
||||
public byte CreateCharsetMask;
|
||||
public byte ExistingCharsetMask;
|
||||
public byte Flags;
|
||||
public sbyte Order;
|
||||
|
||||
public CfgCategoriesCharsets GetCreateCharsetMask() { return (CfgCategoriesCharsets)CreateCharsetMask; }
|
||||
public CfgCategoriesCharsets GetExistingCharsetMask() { return (CfgCategoriesCharsets)ExistingCharsetMask; }
|
||||
public CfgCategoriesFlags GetFlags() { return (CfgCategoriesFlags)Flags; }
|
||||
}
|
||||
|
||||
public sealed class Cfg_RegionsRecord
|
||||
{
|
||||
public uint Id;
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace Game
|
||||
name = new string(charArray);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ExtendedPlayerName ExtractExtendedPlayerName(string name)
|
||||
{
|
||||
int pos = name.IndexOf('-');
|
||||
@@ -55,32 +56,14 @@ namespace Game
|
||||
else
|
||||
return new ExtendedPlayerName(name, "");
|
||||
}
|
||||
static LanguageType GetRealmLanguageType(bool create)
|
||||
|
||||
static CfgCategoriesCharsets GetRealmLanguageType(bool create)
|
||||
{
|
||||
switch ((RealmZones)WorldConfig.GetIntValue(WorldCfg.RealmZone))
|
||||
{
|
||||
case RealmZones.Unknown: // any language
|
||||
case RealmZones.Development:
|
||||
case RealmZones.TestServer:
|
||||
case RealmZones.QaServer:
|
||||
return LanguageType.Any;
|
||||
case RealmZones.UnitedStates: // extended-Latin
|
||||
case RealmZones.Oceanic:
|
||||
case RealmZones.LatinAmerica:
|
||||
case RealmZones.English:
|
||||
case RealmZones.German:
|
||||
case RealmZones.French:
|
||||
case RealmZones.Spanish:
|
||||
return LanguageType.ExtendenLatin;
|
||||
case RealmZones.Korea: // East-Asian
|
||||
case RealmZones.Taiwan:
|
||||
case RealmZones.China:
|
||||
return LanguageType.EastAsia;
|
||||
case RealmZones.Russian: // Cyrillic
|
||||
return LanguageType.Cyrillic;
|
||||
default:
|
||||
return create ? LanguageType.BasicLatin : LanguageType.Any; // basic-Latin at create, any at login
|
||||
}
|
||||
Cfg_CategoriesRecord category = CliDB.CfgCategoriesStorage.LookupByKey(Global.WorldMgr.GetRealm().Timezone);
|
||||
if (category != null)
|
||||
return create ? category.GetCreateCharsetMask() : category.GetExistingCharsetMask();
|
||||
|
||||
return create ? CfgCategoriesCharsets.English : CfgCategoriesCharsets.Any; // basic-Latin at create, any at login
|
||||
}
|
||||
|
||||
public static CreatureModel ChooseDisplayId(CreatureTemplate cinfo, CreatureData data = null)
|
||||
@@ -175,44 +158,43 @@ namespace Game
|
||||
{
|
||||
if (strictMask == 0) // any language, ignore realm
|
||||
{
|
||||
if (IsCultureString(LanguageType.BasicLatin, str, numericOrSpace))
|
||||
if (IsCultureString(CfgCategoriesCharsets.Latin1, str, numericOrSpace))
|
||||
return true;
|
||||
if (IsCultureString(LanguageType.ExtendenLatin, str, numericOrSpace))
|
||||
if (IsCultureString(CfgCategoriesCharsets.Russian, str, numericOrSpace))
|
||||
return true;
|
||||
if (IsCultureString(LanguageType.Cyrillic, str, numericOrSpace))
|
||||
if (IsCultureString(CfgCategoriesCharsets.Korean, str, numericOrSpace))
|
||||
return true;
|
||||
if (IsCultureString(LanguageType.EastAsia, str, numericOrSpace))
|
||||
if (IsCultureString(CfgCategoriesCharsets.Chinese, str, numericOrSpace))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Convert.ToBoolean(strictMask & 0x2)) // realm zone specific
|
||||
{
|
||||
LanguageType lt = GetRealmLanguageType(create);
|
||||
if (lt.HasAnyFlag(LanguageType.ExtendenLatin))
|
||||
{
|
||||
if (IsCultureString(LanguageType.BasicLatin, str, numericOrSpace))
|
||||
CfgCategoriesCharsets lt = GetRealmLanguageType(create);
|
||||
if (lt == CfgCategoriesCharsets.Any)
|
||||
return true;
|
||||
if (IsCultureString(LanguageType.ExtendenLatin, str, numericOrSpace))
|
||||
if (lt.HasFlag(CfgCategoriesCharsets.Latin1) && IsCultureString(CfgCategoriesCharsets.Latin1, str, numericOrSpace))
|
||||
return true;
|
||||
}
|
||||
if (lt.HasAnyFlag(LanguageType.Cyrillic))
|
||||
if (IsCultureString(LanguageType.Cyrillic, str, numericOrSpace))
|
||||
if (lt.HasFlag(CfgCategoriesCharsets.English) && IsCultureString(CfgCategoriesCharsets.English, str, numericOrSpace))
|
||||
return true;
|
||||
if (lt.HasAnyFlag(LanguageType.EastAsia))
|
||||
if (IsCultureString(LanguageType.EastAsia, str, numericOrSpace))
|
||||
if (lt.HasFlag(CfgCategoriesCharsets.Russian) && IsCultureString(CfgCategoriesCharsets.Russian, str, numericOrSpace))
|
||||
return true;
|
||||
if (lt.HasFlag(CfgCategoriesCharsets.Korean) && IsCultureString(CfgCategoriesCharsets.Korean, str, numericOrSpace))
|
||||
return true;
|
||||
if (lt.HasFlag(CfgCategoriesCharsets.Chinese) && IsCultureString(CfgCategoriesCharsets.Chinese, str, numericOrSpace))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Convert.ToBoolean(strictMask & 0x1)) // basic Latin
|
||||
{
|
||||
if (IsCultureString(LanguageType.BasicLatin, str, numericOrSpace))
|
||||
if (IsCultureString(CfgCategoriesCharsets.English, str, numericOrSpace))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
static bool IsCultureString(LanguageType culture, string str, bool numericOrSpace)
|
||||
static bool IsCultureString(CfgCategoriesCharsets culture, string str, bool numericOrSpace)
|
||||
{
|
||||
foreach (var wchar in str)
|
||||
{
|
||||
@@ -221,13 +203,17 @@ namespace Game
|
||||
|
||||
switch (culture)
|
||||
{
|
||||
case LanguageType.BasicLatin:
|
||||
case CfgCategoriesCharsets.English:
|
||||
if (wchar >= 'a' && wchar <= 'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z
|
||||
return true;
|
||||
if (wchar >= 'A' && wchar <= 'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z
|
||||
return true;
|
||||
break;
|
||||
case CfgCategoriesCharsets.Latin1:
|
||||
if (wchar >= 'a' && wchar <= 'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z
|
||||
return true;
|
||||
if (wchar >= 'A' && wchar <= 'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z
|
||||
return true;
|
||||
return false;
|
||||
case LanguageType.ExtendenLatin:
|
||||
if (wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS
|
||||
return true;
|
||||
if (wchar >= 0x00D8 && wchar <= 0x00DE) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN
|
||||
@@ -242,31 +228,33 @@ namespace Game
|
||||
return true;
|
||||
if (wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S
|
||||
return true;
|
||||
return false;
|
||||
case LanguageType.Cyrillic:
|
||||
break;
|
||||
case CfgCategoriesCharsets.Russian:
|
||||
if (wchar >= 0x0410 && wchar <= 0x044F) // CYRILLIC CAPITAL LETTER A - CYRILLIC SMALL LETTER YA
|
||||
return true;
|
||||
if (wchar == 0x0401 || wchar == 0x0451) // CYRILLIC CAPITAL LETTER IO, CYRILLIC SMALL LETTER IO
|
||||
return true;
|
||||
return false;
|
||||
case LanguageType.EastAsia:
|
||||
break;
|
||||
case CfgCategoriesCharsets.Korean:
|
||||
if (wchar >= 0x1100 && wchar <= 0x11F9) // Hangul Jamo
|
||||
return true;
|
||||
if (wchar >= 0x3041 && wchar <= 0x30FF) // Hiragana + Katakana
|
||||
return true;
|
||||
if (wchar >= 0x3131 && wchar <= 0x318E) // Hangul Compatibility Jamo
|
||||
return true;
|
||||
if (wchar >= 0x31F0 && wchar <= 0x31FF) // Katakana Phonetic Ext.
|
||||
return true;
|
||||
if (wchar >= 0x3400 && wchar <= 0x4DB5) // CJK Ideographs Ext. A
|
||||
return true;
|
||||
if (wchar >= 0x4E00 && wchar <= 0x9FC3) // Unified CJK Ideographs
|
||||
return true;
|
||||
if (wchar >= 0xAC00 && wchar <= 0xD7A3) // Hangul Syllables
|
||||
return true;
|
||||
if (wchar >= 0xFF01 && wchar <= 0xFFEE) // Halfwidth forms
|
||||
return true;
|
||||
return false;
|
||||
break;
|
||||
case CfgCategoriesCharsets.Chinese:
|
||||
if (wchar >= 0x4E00 && wchar <= 0x9FFF) // Unified CJK Ideographs
|
||||
return true;
|
||||
if (wchar >= 0x3400 && wchar <= 0x4DBF) // CJK Ideographs Ext. A
|
||||
return true;
|
||||
if (wchar >= 0x3100 && wchar <= 0x312C) // Bopomofo
|
||||
return true;
|
||||
if (wchar >= 0xF900 && wchar <= 0xFAFF) // CJK Compatibility Ideographs
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using Framework.Configuration;
|
||||
using Framework.Constants;
|
||||
using Game.DataStorage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -312,12 +313,12 @@ namespace Game
|
||||
|
||||
if (reload)
|
||||
{
|
||||
int val = (int)GetDefaultValue("RealmZone", RealmZones.Development);
|
||||
int val = (int)GetDefaultValue("RealmZone", RealmManager.HardcodedDevelopmentRealmCategoryId);
|
||||
if (val != (int)Values[WorldCfg.RealmZone])
|
||||
Log.outError(LogFilter.ServerLoading, "RealmZone option can't be changed at worldserver.conf reload, using current value ({0}).", Values[WorldCfg.RealmZone]);
|
||||
}
|
||||
else
|
||||
Values[WorldCfg.RealmZone] = GetDefaultValue("RealmZone", (int)RealmZones.Development);
|
||||
Values[WorldCfg.RealmZone] = GetDefaultValue("RealmZone", RealmManager.HardcodedDevelopmentRealmCategoryId);
|
||||
|
||||
Values[WorldCfg.AllowTwoSideInteractionCalendar] = GetDefaultValue("AllowTwoSide.Interaction.Calendar", false);
|
||||
Values[WorldCfg.AllowTwoSideInteractionChannel] = GetDefaultValue("AllowTwoSide.Interaction.Channel", false);
|
||||
@@ -702,8 +703,11 @@ namespace Game
|
||||
|
||||
Values[WorldCfg.ThreatRadius] = GetDefaultValue("ThreatRadius", 60.0f);
|
||||
|
||||
Values[WorldCfg.DeclinedNamesUsed] = GetDefaultValue("DeclinedNames", false);
|
||||
// always use declined names in the russian client
|
||||
Values[WorldCfg.DeclinedNamesUsed] = (RealmZones)Values[WorldCfg.RealmZone] == RealmZones.Russian || GetDefaultValue("DeclinedNames", false);
|
||||
var category = CliDB.CfgCategoriesStorage.LookupByKey((uint)Values[WorldCfg.RealmZone]);
|
||||
if (category != null && category.GetCreateCharsetMask().HasFlag(CfgCategoriesCharsets.Russian))
|
||||
Values[WorldCfg.DeclinedNamesUsed] = true;
|
||||
|
||||
Values[WorldCfg.ListenRangeSay] = GetDefaultValue("ListenRange.Say", 25.0f);
|
||||
Values[WorldCfg.ListenRangeTextemote] = GetDefaultValue("ListenRange.TextEmote", 25.0f);
|
||||
|
||||
Reference in New Issue
Block a user