-
Notifications
You must be signed in to change notification settings - Fork 11
/
cmangos_ruRU_support.patch
260 lines (238 loc) · 9.76 KB
/
cmangos_ruRU_support.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
src/game/Chat/Chat.cpp | 6 +++---
src/game/Chat/Level1.cpp | 4 ++--
src/game/Chat/Level2.cpp | 8 ++++----
src/game/Chat/Level3.cpp | 16 ++++++++--------
src/game/World/World.cpp | 12 ++++++------
src/shared/Common.cpp | 2 ++
src/shared/Common.h | 4 +++-
7 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp
index 34d99f6f0..732fc0991 100644
--- a/src/game/Chat/Chat.cpp
+++ b/src/game/Chat/Chat.cpp
@@ -1883,7 +1883,7 @@ bool ChatHandler::isValidChatMessage(const char* message) const
return false;
}
- for (uint8 i = 0; i < MAX_LOCALE; ++i)
+ for (uint8 i = 0; i < MAX_DBC_LOCALE; ++i)
{
uint32 skillLineNameLength = strlen(skillLine->name[i]);
if (skillLineNameLength > 0 && strncmp(skillLine->name[i], buffer, skillLineNameLength) == 0)
@@ -1896,7 +1896,7 @@ bool ChatHandler::isValidChatMessage(const char* message) const
}
}
bool foundName = false;
- for (uint8 i = 0; i < MAX_LOCALE; ++i)
+ for (uint8 i = 0; i < MAX_DBC_LOCALE; ++i)
{
if (*linkedSpell->SpellName[i] && strcmp(linkedSpell->SpellName[i], buffer) == 0)
{
@@ -1944,7 +1944,7 @@ bool ChatHandler::isValidChatMessage(const char* message) const
ItemLocale const* il = sObjectMgr.GetItemLocale(linkedItem->ItemId);
bool foundName = false;
- for (uint8 i = LOCALE_koKR; i < MAX_LOCALE; ++i)
+ for (uint8 i = LOCALE_koKR; i < MAX_DBC_LOCALE; ++i)
{
int8 dbIndex = sObjectMgr.GetIndexForLocale(LocaleConstant(i));
if (dbIndex == -1 || il == nullptr || (size_t)dbIndex >= il->Name.size())
diff --git a/src/game/Chat/Level1.cpp b/src/game/Chat/Level1.cpp
index be8ea1a35..ad1dbe992 100644
--- a/src/game/Chat/Level1.cpp
+++ b/src/game/Chat/Level1.cpp
@@ -1497,7 +1497,7 @@ bool ChatHandler::HandleLookupAreaCommand(char* args)
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
- for (; loc < MAX_LOCALE; ++loc)
+ for (; loc < MAX_DBC_LOCALE; ++loc)
{
if (loc == GetSessionDbcLocale())
continue;
@@ -1511,7 +1511,7 @@ bool ChatHandler::HandleLookupAreaCommand(char* args)
}
}
- if (loc < MAX_LOCALE)
+ if (loc < MAX_DBC_LOCALE)
{
// send area in "id - [name]" format
std::ostringstream ss;
diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp
index 913816cd6..5869ddd63 100644
--- a/src/game/Chat/Level2.cpp
+++ b/src/game/Chat/Level2.cpp
@@ -1408,7 +1408,7 @@ bool ChatHandler::HandleLookupFactionCommand(char* args)
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
- for (; loc < MAX_LOCALE; ++loc)
+ for (; loc < MAX_DBC_LOCALE; ++loc)
{
if (loc == GetSessionDbcLocale())
continue;
@@ -1422,7 +1422,7 @@ bool ChatHandler::HandleLookupFactionCommand(char* args)
}
}
- if (loc < MAX_LOCALE)
+ if (loc < MAX_DBC_LOCALE)
{
FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : nullptr;
ShowFactionListHelper(factionEntry, LocaleConstant(loc), repState, target);
@@ -4147,7 +4147,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args)
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
- for (; loc < MAX_LOCALE; ++loc)
+ for (; loc < MAX_DBC_LOCALE; ++loc)
{
if (loc == GetSessionDbcLocale())
continue;
@@ -4161,7 +4161,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args)
}
}
- if (loc < MAX_LOCALE)
+ if (loc < MAX_DBC_LOCALE)
{
targetSkillInfo = skillInfo;
break;
diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp
index 19256b3e4..be1250c09 100644
--- a/src/game/Chat/Level3.cpp
+++ b/src/game/Chat/Level3.cpp
@@ -2228,7 +2228,7 @@ bool ChatHandler::HandleLookupItemSetCommand(char* args)
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
- for (; loc < MAX_LOCALE; ++loc)
+ for (; loc < MAX_DBC_LOCALE; ++loc)
{
if (loc == GetSessionDbcLocale())
continue;
@@ -2242,7 +2242,7 @@ bool ChatHandler::HandleLookupItemSetCommand(char* args)
}
}
- if (loc < MAX_LOCALE)
+ if (loc < MAX_DBC_LOCALE)
{
// send item set in "id - [namedlink locale]" format
if (m_session)
@@ -2291,7 +2291,7 @@ bool ChatHandler::HandleLookupSkillCommand(char* args)
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
- for (; loc < MAX_LOCALE; ++loc)
+ for (; loc < MAX_DBC_LOCALE; ++loc)
{
if (loc == GetSessionDbcLocale())
continue;
@@ -2305,7 +2305,7 @@ bool ChatHandler::HandleLookupSkillCommand(char* args)
}
}
- if (loc < MAX_LOCALE)
+ if (loc < MAX_DBC_LOCALE)
{
char valStr[50] = "";
char const* knownStr = "";
@@ -2416,7 +2416,7 @@ bool ChatHandler::HandleLookupSpellCommand(char* args)
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
- for (; loc < MAX_LOCALE; ++loc)
+ for (; loc < MAX_DBC_LOCALE; ++loc)
{
if (loc == GetSessionDbcLocale())
continue;
@@ -2430,7 +2430,7 @@ bool ChatHandler::HandleLookupSpellCommand(char* args)
}
}
- if (loc < MAX_LOCALE)
+ if (loc < MAX_DBC_LOCALE)
{
ShowSpellListHelper(target, spellInfo, LocaleConstant(loc));
++counter;
@@ -2655,7 +2655,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(char* args)
if (!Utf8FitTo(name, wnamepart))
{
loc = 0;
- for (; loc < MAX_LOCALE; ++loc)
+ for (; loc < MAX_DBC_LOCALE; ++loc)
{
if (loc == GetSessionDbcLocale())
continue;
@@ -2669,7 +2669,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(char* args)
}
}
- if (loc < MAX_LOCALE)
+ if (loc < MAX_DBC_LOCALE)
{
// send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
if (m_session)
diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp
index 22f4efee8..430008faf 100644
--- a/src/game/World/World.cpp
+++ b/src/game/World/World.cpp
@@ -1327,9 +1327,9 @@ void World::DetectDBCLang()
{
uint32 m_lang_confid = sConfig.GetIntDefault("DBC.Locale", 255);
- if (m_lang_confid != 255 && m_lang_confid >= MAX_LOCALE)
+ if (m_lang_confid != 255 && m_lang_confid >= MAX_DBC_LOCALE)
{
- sLog.outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", MAX_LOCALE);
+ sLog.outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", MAX_DBC_LOCALE);
m_lang_confid = LOCALE_enUS;
}
@@ -1338,8 +1338,8 @@ void World::DetectDBCLang()
std::string availableLocalsStr;
- uint32 default_locale = MAX_LOCALE;
- for (int i = MAX_LOCALE - 1; i >= 0; --i)
+ uint32 default_locale = MAX_DBC_LOCALE;
+ for (int i = MAX_DBC_LOCALE - 1; i >= 0; --i)
{
if (strlen(race->name[i]) > 0) // check by race names
{
@@ -1350,13 +1350,13 @@ void World::DetectDBCLang()
}
}
- if (default_locale != m_lang_confid && m_lang_confid < MAX_LOCALE &&
+ if (default_locale != m_lang_confid && m_lang_confid < MAX_DBC_LOCALE &&
(m_availableDbcLocaleMask & (1 << m_lang_confid)))
{
default_locale = m_lang_confid;
}
- if (default_locale >= MAX_LOCALE)
+ if (default_locale >= MAX_DBC_LOCALE)
{
sLog.outError("Unable to determine your DBC Locale! (corrupt DBC?)");
Log::WaitBeforeContinueIfNeed();
diff --git a/src/shared/Common.cpp b/src/shared/Common.cpp
index 17b925c52..f8ea2e3fc 100644
--- a/src/shared/Common.cpp
+++ b/src/shared/Common.cpp
@@ -28,6 +28,7 @@ char const* localeNames[MAX_LOCALE] =
"zhTW",
"esES",
"esMX",
+ "ruRU"
};
// used for search by name or iterate all names
@@ -42,6 +43,7 @@ LocaleNameStr const fullLocaleNameList[] =
{ "zhTW", LOCALE_zhTW },
{ "esES", LOCALE_esES },
{ "esMX", LOCALE_esMX },
+ { "ruRU", LOCALE_ruRU },
{ NULL, LOCALE_enUS }
};
diff --git a/src/shared/Common.h b/src/shared/Common.h
index 7d2e54f78..429161757 100644
--- a/src/shared/Common.h
+++ b/src/shared/Common.h
@@ -146,11 +146,13 @@ enum LocaleConstant : uint8
LOCALE_zhTW = 5,
LOCALE_esES = 6,
LOCALE_esMX = 7,
+ LOCALE_ruRU = 8
};
#define DEFAULT_LOCALE LOCALE_enUS
-#define MAX_LOCALE 8
+#define MAX_LOCALE 9
+#define MAX_DBC_LOCALE 8
LocaleConstant GetLocaleByName(const std::string& name);