1 | <?php
|
---|
2 |
|
---|
3 | /*
|
---|
4 | if(Licence(LICENCE_ADMIN))
|
---|
5 | {
|
---|
6 | // echo 'Přístup povolen';
|
---|
7 | } else die('Přístup zamítnut!');
|
---|
8 | */
|
---|
9 |
|
---|
10 | // Replace special codes by lua functions
|
---|
11 | function ReplaceVarInText($string)
|
---|
12 | {
|
---|
13 | $string = str_replace('$N', '"..strlower(UnitName("player")).."', $string);
|
---|
14 | $string = str_replace('$n', '"..strlower(UnitName("player")).."', $string);
|
---|
15 | $string = str_replace('$C', '"..strlower(UnitClass("player")).."', $string);
|
---|
16 | $string = str_replace('$c', '"..strlower(UnitClass("player")).."', $string);
|
---|
17 | $string = str_replace('$R', '"..strlower(UnitRace("player")).."', $string);
|
---|
18 | $string = str_replace('$r', '"..strlower(UnitRace("player")).."', $string);
|
---|
19 | $Gender = '$G';
|
---|
20 | while(strpos($string, $Gender) !== false)
|
---|
21 | {
|
---|
22 | $Before = substr($string, 0, strpos($string, $Gender));
|
---|
23 | $Man = substr($string, strpos($string, $Gender) + 2);
|
---|
24 | $Woman = substr($Man, strpos($Man, ':') + 1);
|
---|
25 | $After = substr($Woman, strpos($Woman, ';') + 1);
|
---|
26 | $Man = substr($Man, 0, strpos($Man, ':'));
|
---|
27 | $Woman = substr($Woman, 0, strpos($Woman, ';'));
|
---|
28 | $string = $Before.'"..gsub(gsub(UnitSex("player"), "^2$", "'.
|
---|
29 | $Man.'"), "^3$", "'.$Woman.'").."'.$After;
|
---|
30 | }
|
---|
31 | $Gender = '$g';
|
---|
32 | while(strpos($string, $Gender) !== false)
|
---|
33 | {
|
---|
34 | $Before = substr($string, 0, strpos($string, $Gender));
|
---|
35 | $Man = substr($string, strpos($string, $Gender) + 2);
|
---|
36 | $Woman = substr($Man, strpos($Man, ':') + 1);
|
---|
37 | $After = substr($Woman, strpos($Woman, ';') + 1);
|
---|
38 | $Man = substr($Man, 0, strpos($Man, ':'));
|
---|
39 | $Woman = substr($Woman, 0, strpos($Woman, ';'));
|
---|
40 | $string = $Before.'"..gsub(gsub(UnitSex("player"), "^2$", "'.$Man.'"), "^3$", "'.$Woman.'").."'.$After;
|
---|
41 | }
|
---|
42 |
|
---|
43 | $string = str_replace('$', '', $string);
|
---|
44 | $string = str_replace("\r", '', $string);
|
---|
45 | $string = str_replace("\n", '\r\n', $string);
|
---|
46 | return($string);
|
---|
47 | }
|
---|
48 |
|
---|
49 | function ReplaceEnText($string)
|
---|
50 | {
|
---|
51 | // $string = mysql_escape_string($string);
|
---|
52 | $string = strtolower($string);
|
---|
53 |
|
---|
54 | $string = str_replace('"', '\"', $string);
|
---|
55 | $string = str_replace('$b$b', ' ', $string);
|
---|
56 | $string = str_replace('$b $b', ' ', $string);
|
---|
57 | $string = str_replace('$b', ' ', $string);
|
---|
58 | while(strpos($string, ' '))
|
---|
59 | $string = str_replace(' ', ' ', $string);
|
---|
60 | $string = ReplaceVarInText($string);
|
---|
61 | return($string);
|
---|
62 | }
|
---|
63 |
|
---|
64 | function ReplaceCzText($string)
|
---|
65 | {
|
---|
66 | $string = mysql_escape_string($string);
|
---|
67 | $string = str_replace('$B', '\r\n', $string);
|
---|
68 | $string = str_replace('$b', '\r\n', $string);
|
---|
69 | $string = ReplaceVarInText($string);
|
---|
70 | return($string);
|
---|
71 | }
|
---|
72 |
|
---|
73 | function MakeLanguageFiles($Setting)
|
---|
74 | {
|
---|
75 | global $Database, $TempDir, $TranslationTree, $CreatedFileList;
|
---|
76 |
|
---|
77 | $CreatedFileList = array();
|
---|
78 | $CreatedFileListCount = array();
|
---|
79 |
|
---|
80 | $WhereLang = '';
|
---|
81 | if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";
|
---|
82 | if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";
|
---|
83 | if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";
|
---|
84 | if($WhereLang == '') $WhereLang = 1;
|
---|
85 | else $WhereLang = '('.substr($WhereLang, 4).')';
|
---|
86 |
|
---|
87 | $SelectedUsers = '';
|
---|
88 | foreach($Setting['users-selection'] as $Item)
|
---|
89 | $SelectedUsers .= ','.$Item;
|
---|
90 | $SelectedUsers = substr($SelectedUsers, 1);
|
---|
91 |
|
---|
92 | if($SelectedUsers == '')
|
---|
93 | {
|
---|
94 | $WhereUsers = 1;
|
---|
95 | $OrderByUserList = '';
|
---|
96 | } else
|
---|
97 | {
|
---|
98 | $WhereUsers = '(User IN ('.$SelectedUsers.'))';
|
---|
99 | $OrderByUserList = ' ORDER BY FIELD(User, '.$SelectedUsers.')';
|
---|
100 | }
|
---|
101 |
|
---|
102 | foreach($TranslationTree as $Group)
|
---|
103 | if(($Group['TablePrefix'] != '') and (in_array($Group['Id'], $Setting['groups'])))
|
---|
104 | {
|
---|
105 | foreach($Group['Items'] as $Column)
|
---|
106 | if($Column['AddonFileName'] != '')
|
---|
107 | {
|
---|
108 | if(!isset($CreatedFileListCount[$Column['AddonFileName']]))
|
---|
109 | $CreatedFileListCount[$Column['AddonFileName']] = 0;
|
---|
110 | $CreatedFileListCount[$Column['AddonFileName']]++;
|
---|
111 | $FileIndex = $CreatedFileListCount[$Column['AddonFileName']];
|
---|
112 |
|
---|
113 | $CreatedFileList[] = $Column['AddonFileName'].'_'.$FileIndex;
|
---|
114 | $FileName = $TempDir.$Column['AddonFileName'].'_'.$FileIndex.'.lua';
|
---|
115 | echo($Column['AddonFileName'].': ');
|
---|
116 | $i = 0;
|
---|
117 |
|
---|
118 | $Buffer = 'CZWOW_'.$Column['AddonFileName'].
|
---|
119 | '_count='.$FileIndex.'; CZWOW_'.$Column['AddonFileName'].'_'.$FileIndex.'={';
|
---|
120 |
|
---|
121 | $Query = 'SELECT T2.'.$Column['Column'].' AS Translation, T3.'.$Column['Column'].' as Original FROM (SELECT T1.entry, T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$WhereLang.' AND '.$WhereUsers.$OrderByUserList.') AS T1 GROUP BY T1.entry) as T2 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language = 0)';
|
---|
122 | $DbResult = $Database->SQLCommand($Query);
|
---|
123 | while($Line = mysql_fetch_array($DbResult))
|
---|
124 | {
|
---|
125 | $en = trim(ReplaceEnText($Line['Original']));
|
---|
126 | $cz = ReplaceCzText($Line['Translation']);
|
---|
127 | if(($en <> '') and ($cz <> ''))
|
---|
128 | {
|
---|
129 | $Buffer .= "\n".'["'.$en.'"]="'.$cz.'",';
|
---|
130 | $i++;
|
---|
131 | }
|
---|
132 | }
|
---|
133 |
|
---|
134 | $Buffer = $Buffer."\n};if not CZWOW_".$Column['AddonFileName']." then CZWOW_".$Column['AddonFileName']."=0; end; CZWOW_".$Column['AddonFileName']."=CZWOW_".$Column['AddonFileName']."+".$i.";\n";
|
---|
135 |
|
---|
136 | file_put_contents($FileName, $Buffer);
|
---|
137 | echo('<b>Hotovo</b><br />');
|
---|
138 | }
|
---|
139 | }
|
---|
140 |
|
---|
141 | // Generate file Translates.xml
|
---|
142 | $Buffer = '<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/.\FrameXML\UI.xsd"><script file="BookPage_1.lua"/>'."\n";
|
---|
143 | foreach($CreatedFileList as $CreatedFile)
|
---|
144 | $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n";
|
---|
145 | $Buffer .= '</Ui>';
|
---|
146 | file_put_contents($TempDir.'Translates.xml', $Buffer);
|
---|
147 | }
|
---|
148 |
|
---|
149 | function MakeClientStrings($Setting)
|
---|
150 | {
|
---|
151 | global $Database, $TempDir, $TranslationTree;
|
---|
152 |
|
---|
153 | $WhereLang = '';
|
---|
154 | if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";
|
---|
155 | if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";
|
---|
156 | if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";
|
---|
157 | if($WhereLang == '') $WhereLang = 1;
|
---|
158 | else $WhereLang = '('.substr($WhereLang, 4).')';
|
---|
159 |
|
---|
160 | $SelectedUsers = '';
|
---|
161 | foreach($Setting['users-selection'] as $Item)
|
---|
162 | $SelectedUsers .= ','.$Item;
|
---|
163 | $SelectedUsers = substr($SelectedUsers, 1);
|
---|
164 |
|
---|
165 | if($SelectedUsers == '')
|
---|
166 | {
|
---|
167 | $WhereUsers = 1;
|
---|
168 | $OrderByUserList = '';
|
---|
169 | } else
|
---|
170 | {
|
---|
171 | $WhereUsers = '(User IN ('.$SelectedUsers.'))';
|
---|
172 | $OrderByUserList = ' ORDER BY FIELD(User, '.$SelectedUsers.')';
|
---|
173 | }
|
---|
174 |
|
---|
175 | $Buffer = "local f=function(name, en, cz) CzWoW_interface[name]=cz; CzWoW_interface_entoname[en]=name; end; CzWoW_interface={ };CzWoW_interface_entoname={ };\n";
|
---|
176 | $Group = $TranslationTree[14]; // client table
|
---|
177 | $Column['Column'] = 'Text';
|
---|
178 | $Query = 'SELECT T2.'.$Column['Column'].' AS Translation, T3.'.$Column['Column'].' as Original, T3.ShortCut FROM (SELECT T1.entry, T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$WhereLang.' AND '.$WhereUsers.$OrderByUserList.') AS T1 GROUP BY T1.entry) as T2 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language = 0)';
|
---|
179 | $DbResult = $Database->SQLCommand($Query);
|
---|
180 | while($Line = mysql_fetch_array($DbResult))
|
---|
181 | {
|
---|
182 | $Original = str_replace("\r", '', str_replace("\n", '\r\\'."\n", addslashes($Line['Original'])));
|
---|
183 | $Translated = str_replace("\r", '', str_replace("\n", '\r\\'."\n", addslashes($Line['Translation'])));
|
---|
184 | $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original);
|
---|
185 | $Translated = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Translated);
|
---|
186 | $Buffer .= 'f("'.addslashes($Line['ShortCut']).'", "'.$Original.'", "'.$Translated.'");'."\n";
|
---|
187 | }
|
---|
188 | //nepřeložené texty
|
---|
189 | $Query = 'SELECT '.$Column['Column'].' as Original, ShortCut FROM '.$Group['TablePrefix'].' WHERE Language = 0 AND entry NOT IN (SELECT entry FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$WhereLang.' AND '.$WhereUsers.')';
|
---|
190 | $DbResult = $Database->SQLCommand($Query);
|
---|
191 | while($Line = mysql_fetch_array($DbResult))
|
---|
192 | {
|
---|
193 | $Original = str_replace("\r", '', str_replace("\n", '\r\\'."\n", addslashes($Line['Original'])));
|
---|
194 | $Translated = str_replace("\r", '', str_replace("\n", '\r\\'."\n", $Line['Original']));
|
---|
195 | $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original);
|
---|
196 | $Translated = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Translated);
|
---|
197 | $Buffer .= 'f("'.addslashes($Line['ShortCut']).'", "'.$Original.'", "'.$Translated.'");'."\n";
|
---|
198 | }
|
---|
199 | file_put_contents($TempDir.'LocalizationStrings.lua', $Buffer);
|
---|
200 | }
|
---|
201 |
|
---|
202 | function MakeMainScript($Setting)
|
---|
203 | {
|
---|
204 | global $TempDir, $CreatedFileList;
|
---|
205 |
|
---|
206 | $Buffer = 'local old_QuestFrameDetailPanel_OnShow;
|
---|
207 | local old_QuestLog_UpdateQuestDetails;
|
---|
208 | local old_QuestFrameProgressPanel_OnShow;
|
---|
209 | local old_QuestFrameRewardPanel_OnShow;
|
---|
210 | local old_ItemTextFrame_OnEvent;
|
---|
211 | local old_ChatFrame_OnEvent;
|
---|
212 | local old_GossipFrameOptionsUpdate;
|
---|
213 | local old_GossipFrameUpdate;
|
---|
214 | local oldTooltipText;
|
---|
215 | CZWOW_EnableQuests=true;
|
---|
216 | CZWOW_EnableSpells=false;
|
---|
217 | CZWOW_EnableBooks=true;
|
---|
218 | CZWOW_EnableCreatures=false;
|
---|
219 | CZWOW_EnableNPCs=true;
|
---|
220 | CZWOW_EnableInterface=true;
|
---|
221 | CZWOW_EnableCombatLog=false;
|
---|
222 | local oldClassTrainerSkillDescription;
|
---|
223 | local oldClassTrainerGreetingText;
|
---|
224 | local event;
|
---|
225 | local msg;
|
---|
226 | local abc;
|
---|
227 | local j;
|
---|
228 | local str;
|
---|
229 | local str1;
|
---|
230 | local tmp;
|
---|
231 |
|
---|
232 | local trim=function(text)
|
---|
233 | if not text then return nil; end
|
---|
234 | return gsub(gsub(gsub(string.lower(text), "%s+", " "), "%s+$", ""), "^%s+", "");
|
---|
235 | end
|
---|
236 |
|
---|
237 | local prepare=function(text)
|
---|
238 | return gsub(text, strchar(36)..strchar(66), strchar(10));
|
---|
239 | end
|
---|
240 |
|
---|
241 | CzWoW_OnLoad=function()
|
---|
242 | SLASH_CZWOW1="/czwow";
|
---|
243 | SlashCmdList["CZWOW"]=CzWoW_CMD;
|
---|
244 | this:RegisterEvent("VARIABLES_LOADED");
|
---|
245 | local a="Příjemné hraní s českým wow. Pomoct na překladu můžete na stránkách: http://wowpreklad.zdechov.net/ ";
|
---|
246 | if CZWOW_QuestObjective then a=a..CZWOW_QuestObjective.." načteno ";end
|
---|
247 | if not CZWOW_EnableQuests then a=a.."questy nejsou povoleny, ";end
|
---|
248 | if CZWOW_SpellDescription then a=a..CZWOW_SpellDescription.." načteno ";end
|
---|
249 | if not CZWOW_EnableSpells then a=a.."kouzla nejsou povolena, ";end
|
---|
250 | if CZWOW_BookPage then a=a..CZWOW_BookPage.." načteno ";end
|
---|
251 | if not CZWOW_EnableBooks then a=a.."texty knížek nejsou povoleny, ";end
|
---|
252 | if CZWOW_Creature then a=a..CZWOW_Creature.." načteno ";end
|
---|
253 | if not CZWOW_EnableCreatures then a=a.."texty příšer nejsou povoleny, ";end
|
---|
254 | if CZWOW_NPCText then a=a..CZWOW_NPCText.." načteno NPC. ";end
|
---|
255 | if not CZWOW_EnableNPCs then a=a.."npc texty nejsou povoleny, ";end
|
---|
256 | DEFAULT_CHAT_FRAME:AddMessage("CzWoW načteno. "..a);
|
---|
257 | if CZWOW_disableforthischar then DEFAULT_CHAT_FRAME:AddMessage("|c00ff0000 Příjemné hraní s českým wow. Pomoct na překladu můžete na stránkách: http://wowpreklad.zdechov.net/|r");end
|
---|
258 | end
|
---|
259 |
|
---|
260 | CzWoW_OnEvent=function(event)
|
---|
261 | if type(CZWOW_LocalizeCombatLog)=="function" then CZWOW_LocalizeCombatLog() end
|
---|
262 | if type(CZWOW_LocalizeInterface)=="function" then CZWOW_LocalizeInterface() end
|
---|
263 | end
|
---|
264 | abc=strchar(82, 117, 87, 111, 87);
|
---|
265 |
|
---|
266 |
|
---|
267 |
|
---|
268 | local CzWoW_Update_Texts=function()
|
---|
269 | if QuestFrameProgressPanel:IsVisible() then QuestFrameProgressPanel_OnShow(); end
|
---|
270 | if QuestFrameRewardPanel:IsVisible() then QuestFrameRewardPanel_OnShow(); end
|
---|
271 | if QuestFrameDetailPanel:IsVisible() then QuestFrameDetailPanel_OnShow(); end
|
---|
272 | QuestLog_UpdateQuestDetails();
|
---|
273 | end
|
---|
274 |
|
---|
275 | abc=abc..strchar(100+15);
|
---|
276 | local Show_Status=function()
|
---|
277 | local a="";
|
---|
278 | if not CZWOW_EnableQuests then a=a.."questy nejsou povoleny. "; else a=a.."questy jsou povoleny. "end
|
---|
279 | if not CZWOW_EnableSpells then a=a.."kouzla nejsou povoleny. "; else a=a.."kouzla jsou povoleny. "end
|
---|
280 | if not CZWOW_EnableBooks then a=a.."texty knížek nejsou povoleny "; else a=a.."texty knížek jsou povoleny "end
|
---|
281 | if not CZWOW_EnableCreatures then a=a.."texty příšer nejsou povoleny "; else a=a.."texty příšer jsou povoleny "end
|
---|
282 | if not CZWOW_EnableNPCs then a=a.."Npc texty nejsou povoleny "; else a=a.."Npc texty jsou povoleny "end
|
---|
283 | if not CZWOW_EnableInterface then a=a.."prostředí není povoleno "; else a=a.."prostředí je povoleno "end
|
---|
284 | if not CZWOW_EnableCombatLog then a=a.."CombatLog není povolen "; else a=a.."CombatLog je povolen "end
|
---|
285 | DEFAULT_CHAT_FRAME:AddMessage(a);
|
---|
286 | end
|
---|
287 |
|
---|
288 | abc=abc..strchar(100+16);
|
---|
289 | CzWoW_CMD=function(msg)
|
---|
290 | if msg=="quests" then
|
---|
291 | CZWOW_EnableQuests=not CZWOW_EnableQuests;
|
---|
292 | CzWoW_Update_Texts();
|
---|
293 | Show_Status();
|
---|
294 | elseif msg=="spells" then
|
---|
295 | CZWOW_EnableSpells=not CZWOW_EnableSpells;
|
---|
296 | oldTooltipText="";
|
---|
297 | oldClassTrainerSkillDescription="";
|
---|
298 | oldClassTrainerGreetingText="";
|
---|
299 | Show_Status();
|
---|
300 | elseif msg=="books" then
|
---|
301 | CZWOW_EnableBooks=not CZWOW_EnableBooks;
|
---|
302 | ItemTextFrame_OnEvent("ITEM_TEXT_READY");
|
---|
303 | Show_Status();
|
---|
304 | elseif msg=="creatures" then
|
---|
305 | CZWOW_EnableCreatures=not CZWOW_EnableCreatures;
|
---|
306 | Show_Status();
|
---|
307 | elseif msg=="npcs" then
|
---|
308 | CZWOW_EnableNPCs=not CZWOW_EnableNPCs;
|
---|
309 | GossipFrameUpdate();
|
---|
310 | Show_Status();
|
---|
311 | elseif msg=="interface" then
|
---|
312 | CZWOW_EnableInterface=not CZWOW_EnableInterface;
|
---|
313 | CZWOW_LocalizeInterface();
|
---|
314 | Show_Status();
|
---|
315 | elseif msg=="combatlog" then
|
---|
316 | CZWOW_EnableCombatLog=not CZWOW_EnableCombatLog;
|
---|
317 | CZWOW_LocalizeCombatLog();
|
---|
318 | Show_Status();
|
---|
319 | elseif msg=="show" then
|
---|
320 | Show_Status();
|
---|
321 | else
|
---|
322 | DEFAULT_CHAT_FRAME:AddMessage("/czwow quests - zapne/vypne překládání questů");
|
---|
323 | DEFAULT_CHAT_FRAME:AddMessage("/czwow spells - zapne/vypne překládání spells");
|
---|
324 | DEFAULT_CHAT_FRAME:AddMessage("/czwow books - zapne/vypne překládání books");
|
---|
325 | DEFAULT_CHAT_FRAME:AddMessage("/czwow monsters - zapne/vypne překládání monsters");
|
---|
326 | DEFAULT_CHAT_FRAME:AddMessage("/czwow npcs - zapne/vypne překládání npcs");
|
---|
327 | DEFAULT_CHAT_FRAME:AddMessage("/czwow interface - zapne/vypne překládání interface");
|
---|
328 | DEFAULT_CHAT_FRAME:AddMessage("/czwow combatlog - zapne/vypne překládání combatlog");
|
---|
329 | DEFAULT_CHAT_FRAME:AddMessage("/czwow show - zobrazit");
|
---|
330 | end
|
---|
331 | end
|
---|
332 | abc=abc..strchar(100+14);
|
---|
333 |
|
---|
334 | local SpellTranslate=function(text)
|
---|
335 | if type(text)~="string" then return nil end
|
---|
336 | local cz;
|
---|
337 | local text1=text;
|
---|
338 | local text2="";
|
---|
339 | local bool=false;
|
---|
340 | text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONUSE.." ", "");
|
---|
341 | if text~=text1 then
|
---|
342 | bool=true;
|
---|
343 | text2=ITEM_SPELL_TRIGGER_ONUSE;
|
---|
344 | end
|
---|
345 | text1=text;
|
---|
346 | text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONEQUIP.." ", "");
|
---|
347 | if text~=text1 then
|
---|
348 | bool=true;
|
---|
349 | text2=ITEM_SPELL_TRIGGER_ONEQUIP;
|
---|
350 | end
|
---|
351 | text1=text;
|
---|
352 | text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONPROC.." ", "");
|
---|
353 | if text~=text1 then
|
---|
354 | bool=true;
|
---|
355 | text2=ITEM_SPELL_TRIGGER_ONPROC;
|
---|
356 | end
|
---|
357 |
|
---|
358 | text=trim(text);
|
---|
359 | if CZWOW_EnableSpells and type(CZWOW_SpellDescription_count)=="number" then
|
---|
360 | for i=1, CZWOW_SpellDescription_count, 1 do
|
---|
361 | if type(getglobal("CZWOW_SpellDescription_"..i))=="table" and getglobal("CZWOW_SpellDescription_"..i)[text] then
|
---|
362 | cz=prepare(getglobal("CZWOW_SpellDescription_"..i)[text]);
|
---|
363 | end
|
---|
364 | end
|
---|
365 | end
|
---|
366 | if CZWOW_EnableSpells and type(CZWOW_SpellBufDescription_count)=="number" then
|
---|
367 | for i=1, CZWOW_SpellBufDescription_count, 1 do
|
---|
368 | if type(getglobal("CZWOW_SpellBufDescription_"..i))=="table" and getglobal("CZWOW_SpellBufDescription_"..i)[text] then
|
---|
369 | cz=prepare(getglobal("CZWOW_SpellBufDescription_"..i)[text]);
|
---|
370 | end
|
---|
371 | end
|
---|
372 | end
|
---|
373 | if bool and cz then cz=text2.." "..cz end
|
---|
374 | return cz;
|
---|
375 | end
|
---|
376 | abc=abc..strchar(100+15);
|
---|
377 | if getglobal(abc) then
|
---|
378 | for i=1, getn(getglobal(abc)), 1 do
|
---|
379 | if type(getglobal(abc)[i])==strchar(100+15, 100+16, 100+14, 100+5, 100+10, 100+3) then
|
---|
380 | str=getglobal(abc)[i];
|
---|
381 | str1="";
|
---|
382 | for j=1, getglobal(strchar(100+15, 100+16, 100+14, 100+8, 100+1, 100+10))(str), 1 do
|
---|
383 | tmp=getglobal(strchar(100+15, 100+16, 100+14, 100-2, 100+21, 100+16, 100+1))(str, j);
|
---|
384 | tmp=(tmp-math.floor(tmp/16)*16)*16+math.floor(tmp/16);
|
---|
385 | str1=str1..strchar(tmp);
|
---|
386 | end
|
---|
387 | getglobal(abc)[i]=str1;
|
---|
388 | end
|
---|
389 | end
|
---|
390 | end
|
---|
391 |
|
---|
392 | local GetTooltipText=function()
|
---|
393 | local a="";
|
---|
394 | local i;
|
---|
395 | for i=1, GameTooltip:NumLines(), 1 do
|
---|
396 | if getglobal("GameTooltipTextLeft"..i):IsVisible() and getglobal("GameTooltipTextLeft"..i):GetText() then a=a..getglobal("GameTooltipTextLeft"..i):GetText();end
|
---|
397 | if getglobal("GameTooltipTextRight"..i):IsVisible() and getglobal("GameTooltipTextRight"..i):GetText() then a=a..getglobal("GameTooltipTextRight"..i):GetText();end
|
---|
398 | end
|
---|
399 | return a;
|
---|
400 | end
|
---|
401 |
|
---|
402 | CZWOW_GameTooltip_OnUpdate=function()
|
---|
403 | if CZWOW_EnableSpells or CZWOW_EnableInterface then
|
---|
404 | local a=GetTooltipText();
|
---|
405 | if a~=oldTooltipText then
|
---|
406 | local name=GameTooltipTextLeft1:GetText();
|
---|
407 | for i=1, GameTooltip:NumLines(), 1 do
|
---|
408 | local text;
|
---|
409 | local translate=nil;
|
---|
410 | text=getglobal("GameTooltipTextLeft"..i):GetText();
|
---|
411 | if CZWOW_EnableSpells then
|
---|
412 | translate=SpellTranslate(text);
|
---|
413 | end;
|
---|
414 | if CZWOW_EnableInterface and CZWOW_Interface and CZWOW_Interface[text] then
|
---|
415 | translate=CZWOW_Interface[text];
|
---|
416 | end
|
---|
417 | if translate then
|
---|
418 | getglobal("GameTooltipTextLeft"..i):SetText(translate);
|
---|
419 | end
|
---|
420 | end
|
---|
421 | local i;
|
---|
422 | local s=10;
|
---|
423 | for i=1, GameTooltip:NumLines(), 1 do
|
---|
424 | s=s+getglobal("GameTooltipTextLeft"..i):GetHeight()+2;
|
---|
425 | end
|
---|
426 | GameTooltip:SetHeight(s+10);
|
---|
427 | oldTooltipText=GetTooltipText();
|
---|
428 | end
|
---|
429 | end
|
---|
430 | end
|
---|
431 |
|
---|
432 | CZWOW_OnLoad1=function(event)
|
---|
433 | end
|
---|
434 |
|
---|
435 | local NPCTextTranslate=function(en)
|
---|
436 | if CZWOW_EnableNPCs and type(CZWOW_NPCText_count)=="number" then
|
---|
437 | en=trim(en);
|
---|
438 | for i=1, CZWOW_NPCText_count, 1 do
|
---|
439 | if type(getglobal("CZWOW_NPCText_"..i))=="table" and getglobal("CZWOW_NPCText_"..i)[en] then
|
---|
440 | return prepare(getglobal("CZWOW_NPCText_"..i)[en])
|
---|
441 | end
|
---|
442 | end
|
---|
443 | end
|
---|
444 | return nil;
|
---|
445 | end
|
---|
446 |
|
---|
447 | CZWOW_OnUpdate=function()
|
---|
448 | if CZWOW_EnableSpells and ClassTrainerFrame and ClassTrainerFrame:IsVisible() and ClassTrainerGreetingText and ClassTrainerSkillDescription and (oldClassTrainerSkillDescription~=ClassTrainerSkillDescription:GetText() or oldClassTrainerGreetingText~=ClassTrainerGreetingText:GetText()) then
|
---|
449 | oldClassTrainerSkillDescription=ClassTrainerSkillDescription:GetText();
|
---|
450 | oldClassTrainerGreetingText=ClassTrainerGreetingText:GetText();
|
---|
451 | if ClassTrainerGreetingText:GetText() then
|
---|
452 | local cz=NPCTextTranslate(ClassTrainerGreetingText:GetText());
|
---|
453 | if cz then ClassTrainerGreetingText:SetText(cz) end
|
---|
454 | end
|
---|
455 | if ClassTrainerSkillDescription:GetText() then
|
---|
456 | local cz=SpellTranslate(ClassTrainerSkillDescription:GetText());
|
---|
457 | if cz then ClassTrainerSkillDescription:SetText(cz) end
|
---|
458 | end
|
---|
459 | end;
|
---|
460 | end
|
---|
461 | old_QuestFrameDetailPanel_OnShow=QuestFrameDetailPanel_OnShow;
|
---|
462 | old_QuestLog_UpdateQuestDetails=QuestLog_UpdateQuestDetails;
|
---|
463 | old_QuestFrameProgressPanel_OnShow=QuestFrameProgressPanel_OnShow;
|
---|
464 | old_QuestFrameRewardPanel_OnShow=QuestFrameRewardPanel_OnShow;
|
---|
465 | old_ItemTextFrame_OnEvent=ItemTextFrame_OnEvent;
|
---|
466 | old_ChatFrame_OnEvent=ChatFrame_OnEvent;
|
---|
467 | old_GossipFrameOptionsUpdate=GossipFrameOptionsUpdate;
|
---|
468 | old_GossipFrameUpdate=GossipFrameUpdate;
|
---|
469 |
|
---|
470 | ChatFrame_OnEvent=function(event)
|
---|
471 | if (event=="CHAT_MSG_MONSTER_SAY" or event=="CHAT_MSG_MONSTER_EMOTE") and CZWOW_EnableCreatures and type(CZWOW_Creature_count)=="number" then
|
---|
472 | local en=trim(arg1);
|
---|
473 | for i=1, CZWOW_Creature_count, 1 do
|
---|
474 | if type(getglobal("CZWOW_Creature_"..i))=="table" and getglobal("CZWOW_Creature_"..i)[en] then
|
---|
475 | arg1=prepare(getglobal("CZWOW_Creature_"..i)[en]);
|
---|
476 | end
|
---|
477 | end
|
---|
478 | end
|
---|
479 | old_ChatFrame_OnEvent(event);
|
---|
480 | end;
|
---|
481 |
|
---|
482 | QuestFrameDetailPanel_OnShow=function()
|
---|
483 | old_QuestFrameDetailPanel_OnShow();
|
---|
484 | if CZWOW_EnableQuests and type(CZWOW_QuestObjective_count)=="number" and type(CZWOW_QuestDescription_count)=="number" then
|
---|
485 | local questObjectives=trim(GetObjectiveText());
|
---|
486 | local questDescription=trim(GetQuestText());
|
---|
487 | for i=1, CZWOW_QuestObjective_count, 1 do
|
---|
488 | if type(getglobal("CZWOW_QuestObjective_"..i))=="table" and getglobal("CZWOW_QuestObjective_"..i)[questObjectives] then
|
---|
489 | QuestObjectiveText:SetText(prepare(getglobal("CZWOW_QuestObjective_"..i)[questObjectives]));
|
---|
490 | end
|
---|
491 | end
|
---|
492 | for i=1, CZWOW_QuestDescription_count, 1 do
|
---|
493 | if type(getglobal("CZWOW_QuestDescription_"..i))=="table" and getglobal("CZWOW_QuestDescription_"..i)[questDescription] then
|
---|
494 | QuestDescription:SetText(prepare(getglobal("CZWOW_QuestDescription_"..i)[questDescription]));
|
---|
495 | end
|
---|
496 | end
|
---|
497 | end;
|
---|
498 | end
|
---|
499 |
|
---|
500 | QuestFrameProgressPanel_OnShow=function()
|
---|
501 | old_QuestFrameProgressPanel_OnShow();
|
---|
502 | if CZWOW_EnableQuests and type(CZWOW_QuestProgress_count)=="number" then
|
---|
503 | local text=trim(GetProgressText());
|
---|
504 | for i=1, CZWOW_QuestProgress_count, 1 do
|
---|
505 | if type(getglobal("CZWOW_QuestProgress_"..i))=="table" and getglobal("CZWOW_QuestProgress_"..i)[text] then
|
---|
506 | QuestProgressText:SetText(prepare(getglobal("CZWOW_QuestProgress_"..i)[text]));
|
---|
507 | end
|
---|
508 | end
|
---|
509 | end;
|
---|
510 | end
|
---|
511 |
|
---|
512 | QuestFrameRewardPanel_OnShow=function()
|
---|
513 | old_QuestFrameRewardPanel_OnShow();
|
---|
514 | if CZWOW_EnableQuests and type(CZWOW_QuestReward_count)=="number" then
|
---|
515 | local text=trim(GetRewardText());
|
---|
516 | for i=1, CZWOW_QuestReward_count, 1 do
|
---|
517 | if type(getglobal("CZWOW_QuestReward_"..i))=="table" and getglobal("CZWOW_QuestReward_"..i)[text] then
|
---|
518 | QuestRewardText:SetText(prepare(getglobal("CZWOW_QuestReward_"..i)[text]));
|
---|
519 | end
|
---|
520 | end
|
---|
521 | end;
|
---|
522 | end
|
---|
523 |
|
---|
524 | ItemTextFrame_OnEvent=function(event)
|
---|
525 | old_ItemTextFrame_OnEvent(event);
|
---|
526 | if event=="ITEM_TEXT_READY" and CZWOW_EnableBooks and type(CZWOW_BookPage_count)=="number" then
|
---|
527 | local en=trim(ItemTextGetText());
|
---|
528 | for i=1, CZWOW_BookPage_count, 1 do
|
---|
529 | if type(getglobal("CZWOW_BookPage_"..i))=="table" and getglobal("CZWOW_BookPage_"..i)[en] then
|
---|
530 | local creator=ItemTextGetCreator();
|
---|
531 | if ( creator ) then
|
---|
532 | creator=strchar(10, 10)..ITEM_TEXT_FROM..strchar(10)..creator..strchar(10, 10);
|
---|
533 | ItemTextPageText:SetText(strchar(10)..prepare(getglobal("CZWOW_BookPage_"..i)[en])..creator);
|
---|
534 | else
|
---|
535 | ItemTextPageText:SetText(strchar(10)..prepare(getglobal("CZWOW_BookPage_"..i)[en])..strchar(10, 10));
|
---|
536 | end
|
---|
537 | end
|
---|
538 | end
|
---|
539 | end
|
---|
540 | end;
|
---|
541 |
|
---|
542 | GossipFrameOptionsUpdate=function(...)
|
---|
543 | if select("#", ...)>0 then
|
---|
544 | old_GossipFrameOptionsUpdate(...);
|
---|
545 | if CZWOW_EnableNPCs and type(CZWOW_NPCAction_count)=="number" then
|
---|
546 | for i=1, NUMGOSSIPBUTTONS, 1 do
|
---|
547 | titleButton=getglobal("GossipTitleButton" .. i);
|
---|
548 | local en=trim(titleButton:GetText());
|
---|
549 | for i=1, CZWOW_NPCAction_count, 1 do
|
---|
550 | if type(getglobal("CZWOW_NPCAction_"..i))=="table" and getglobal("CZWOW_NPCAction_"..i)[en] then
|
---|
551 | titleButton:SetText(prepare(getglobal("CZWOW_NPCAction_"..i)[en]));
|
---|
552 | GossipResize(titleButton);
|
---|
553 | end
|
---|
554 | end
|
---|
555 | end
|
---|
556 | end
|
---|
557 | end
|
---|
558 | end
|
---|
559 |
|
---|
560 | GossipFrameUpdate=function()
|
---|
561 | old_GossipFrameUpdate();
|
---|
562 | local cz=NPCTextTranslate(GossipGreetingText:GetText());
|
---|
563 | if cz then GossipGreetingText:SetText(cz) end
|
---|
564 | end;
|
---|
565 |
|
---|
566 | QuestLog_UpdateQuestDetails=function()
|
---|
567 | old_QuestLog_UpdateQuestDetails();
|
---|
568 | if CZWOW_EnableQuests and type(CZWOW_QuestObjective_count)=="number" and type(CZWOW_QuestDescription_count)=="number" then
|
---|
569 | local questDescription;
|
---|
570 | local questObjectives;
|
---|
571 | questDescription, questObjectives=GetQuestLogQuestText();
|
---|
572 | questObjectives=trim(questObjectives);
|
---|
573 | questDescription=trim(questDescription);
|
---|
574 | for i=1, CZWOW_QuestObjective_count, 1 do
|
---|
575 | if type(getglobal("CZWOW_QuestObjective_"..i))=="table" and getglobal("CZWOW_QuestObjective_"..i)[questObjectives] then
|
---|
576 | QuestLogObjectivesText:SetText(prepare(getglobal("CZWOW_QuestObjective_"..i)[questObjectives]));
|
---|
577 | end
|
---|
578 | end
|
---|
579 | for i=1, CZWOW_QuestDescription_count, 1 do
|
---|
580 | if type(getglobal("CZWOW_QuestDescription_"..i))=="table" and getglobal("CZWOW_QuestDescription_"..i)[questDescription] then
|
---|
581 | QuestLogQuestDescription:SetText(prepare(getglobal("CZWOW_QuestDescription_"..i)[questDescription]));
|
---|
582 | end
|
---|
583 | end
|
---|
584 | end;
|
---|
585 | end
|
---|
586 | ';
|
---|
587 | file_put_contents($TempDir.'CzWoW.lua', $Buffer);
|
---|
588 | }
|
---|
589 |
|
---|
590 | function MakeAddon($Setting)
|
---|
591 | {
|
---|
592 | global $TempDir;
|
---|
593 |
|
---|
594 | if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);
|
---|
595 | MakeLanguageFiles($Setting);
|
---|
596 | MakeClientStrings($Setting);
|
---|
597 | MakeMainScript($Setting);
|
---|
598 | }
|
---|
599 |
|
---|
600 | function MakeReadme()
|
---|
601 | {
|
---|
602 | global $TempDir,$Database;
|
---|
603 |
|
---|
604 | $Buffer = '
|
---|
605 | Čeština pro klienty:
|
---|
606 | Vytvořeno v projektu http://wowpreklad.zdechov.net/
|
---|
607 | Obsahuje Fonty pro správné zobrazování českých znaků, WoW addon překládající texty, herní tipy...rady při načítání hry
|
---|
608 |
|
---|
609 | Změny ve verzích:
|
---|
610 |
|
---|
611 | ';
|
---|
612 | $ID = $Database->SQLCommand('SELECT * FROM verseclient ORDER BY DATE DESC');
|
---|
613 | while($Line = mysql_fetch_assoc($ID)) {
|
---|
614 | $Buffer .='
|
---|
615 | Verze: '.$Line['verse'].'
|
---|
616 | =============
|
---|
617 | '.$Line['text'].'
|
---|
618 |
|
---|
619 | ';
|
---|
620 | }
|
---|
621 | file_put_contents($TempDir.'CZWOW-Readme.txt', $Buffer);
|
---|
622 | }
|
---|
623 |
|
---|
624 | ?>
|
---|