source: trunk/Modules/Export/files/2.4.3/CzWoW/CzWoW.lua

Last change on this file was 756, checked in by maron, 12 years ago
  • Adden: addon version >= 2.4.3 now translate items name and game objects
  • Fixed: import when missing column
File size: 22.4 KB
Line 
1local old_QuestFrameDetailPanel_OnShow;
2local old_QuestLog_UpdateQuestDetails;
3local old_QuestFrameProgressPanel_OnShow;
4local old_QuestFrameRewardPanel_OnShow;
5local old_ItemTextFrame_OnEvent;
6local old_ChatFrame_OnEvent;
7local old_GossipFrameOptionsUpdate;
8local old_GossipFrameUpdate;
9local oldTooltipText;
10CZWOW_EnableQuests=true;
11CZWOW_EnableSpells=false;
12CZWOW_EnableBooks=true;
13CZWOW_EnableCreatures=true;
14CZWOW_EnableNPCs=true;
15CZWOW_EnableInterface=true;
16CZWOW_EnableCombatLog=true;
17local oldClassTrainerSkillDescription;
18local oldClassTrainerGreetingText;
19local event;
20local msg;
21local abc;
22local j;
23local str;
24local str1;
25local tmp;
26
27local trim=function(text)
28 if not text then return nil; end
29 return gsub(gsub(gsub(string.lower(text), "%s+", " "), "%s+$", ""), "^%s+", "");
30end
31
32local prepare=function(text)
33 return gsub(text, strchar(36)..strchar(66), strchar(10));
34end
35
36CzWoW_OnLoad=function()
37 SLASH_CZWOW1="/czwow";
38 SlashCmdList["CZWOW"]=CzWoW_CMD;
39 this:RegisterEvent("VARIABLES_LOADED");
40 local a="Příjemné hraní s českým wow. Pomoct na překladu můžete na stránkách: http://wowpreklad.zdechov.net/ ";
41 if CZWOW_QuestObjective then a=a..CZWOW_QuestObjective.." načteno ";end
42 if not CZWOW_EnableQuests then a=a.."questy nejsou povoleny, ";end
43 if CZWOW_SpellDescription then a=a..CZWOW_SpellDescription.." načteno ";end
44 if not CZWOW_EnableSpells then a=a.."kouzla nejsou povolena, ";end
45 if CZWOW_BookPage then a=a..CZWOW_BookPage.." načteno ";end
46 if not CZWOW_EnableBooks then a=a.."texty knížek nejsou povoleny, ";end
47 if CZWOW_Creature then a=a..CZWOW_Creature.." načteno ";end
48 if not CZWOW_EnableCreatures then a=a.."texty příšer nejsou povoleny, ";end
49 if CZWOW_NPCText then a=a..CZWOW_NPCText.." načteno NPC. ";end
50 if not CZWOW_EnableNPCs then a=a.."npc texty nejsou povoleny, ";end
51 DEFAULT_CHAT_FRAME:AddMessage("CzWoW načteno. "..a);
52 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
53
54 GameTooltip:HookScript("OnUpdate",GameObjectChange);
55 if(GameTooltip:GetScript("OnTooltipSetItem")) then
56 GameTooltip:HookScript("OnTooltipSetItem",ItemChangeName);
57 else
58 GameTooltip:SetScript("OnTooltipSetItem",ItemChangeName);
59 end
60 for nn, tooltip in ipairs(TooltipList) do
61 if tooltip then
62 for _, methodName in ipairs(MethodList) do
63 hooksecurefunc(tooltip, methodName, ItemChangeName);
64 end
65 end
66 end
67
68end
69
70--------Translate item------------------
71TooltipList = {
72 ItemRefTooltip,
73 GameTooltip,
74 ShoppingTooltip1,
75 ShoppingTooltip2,
76 ComparisonTooltip1,
77 ComparisonTooltip2,
78}
79
80MethodList = {
81 "SetLootItem",
82 "SetHyperlink",
83 "SetBagItem",
84 "SetInventoryItem",
85 "SetAuctionItem",
86 "SetAuctionSellItem",
87 "SetLootRollItem",
88 "SetTradeSkillItem",
89 "SetTrainerService",
90 "SetInboxItem",
91 "SetSendMailItem",
92 "SetQuestItem",
93 "SetQuestLogItem",
94 "SetTradePlayerItem",
95 "SetTradeTargetItem",
96 "SetMerchantItem",
97 "SetHyperlinkCompareItem",
98 "SetBuybackItem",
99}
100
101function TranslateTooltip(this)
102 if this then
103 local text = this:GetText();
104 for i=1, CZWOW_ItemName_count, 1 do
105 if getglobal("CZWOW_ItemName_"..i)[trim(text)] then
106 text = getglobal("CZWOW_ItemName_"..i)[trim(text)];
107 end
108 end
109 -- text = "bleble";
110-- DEFAULT_CHAT_FRAME:AddMessage(text);
111 this:SetText(text);
112 end
113end
114
115function ItemChangeName(this)
116 local name = "test ěščřžýáíéůú fsd fa";
117 if CZWOW_ItemName_count > 0 then
118 TranslateTooltip(GameTooltipTextLeft1);
119 TranslateTooltip(ItemRefTooltipTextLeft1);
120 TranslateTooltip(ShoppingTooltip1TextLeft2);
121 TranslateTooltip(ShoppingTooltip2TextLeft2);
122 TranslateTooltip(ComparisonTooltip1TextLeft4);
123 TranslateTooltip(ComparisonTooltip2TextLeft6);
124 --/run
125 end
126 if CZWOW_ItemDescription_count > 0 then
127 for i=1,GameTooltip:NumLines()do
128 local mytext=_G["GameTooltipTextLeft"..i];
129 if "\"" == strsub(mytext:GetText(), 0,1) then
130 local text = strsub(mytext:GetText(), 2,strlen(mytext:GetText())-2);
131 text = text..".";
132 for i=1, CZWOW_ItemDescription_count, 1 do
133 if getglobal("CZWOW_ItemDescription_"..i)[trim(text)] then
134 text = getglobal("CZWOW_ItemDescription_"..i)[trim(text)];
135 end
136 end
137 mytext:SetText("\""..text.."\"");
138 end
139 end
140 end
141
142 this:Show();
143end
144---------item at vendor------
145local old_MerchantFrame_UpdateMerchantInfo = MerchantFrame_UpdateMerchantInfo;
146function MerchantFrame_UpdateMerchantInfo()
147 old_MerchantFrame_UpdateMerchantInfo();
148 local numMerchantItems = GetMerchantNumItems();
149 for i=1, MERCHANT_ITEMS_PER_PAGE, 1 do
150 local index = (((MerchantFrame.page - 1) * MERCHANT_ITEMS_PER_PAGE) + i);
151 if ( index <= numMerchantItems ) then
152 name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(index);
153 local text = name;
154 for i=1, CZWOW_ItemName_count, 1 do
155 if getglobal("CZWOW_ItemName_"..i)[trim(text)] then
156 text = getglobal("CZWOW_ItemName_"..i)[trim(text)];
157 end
158 end
159 getglobal("MerchantItem"..i.."Name"):SetText(text);
160 end
161 end
162end
163
164-------item at loot--------------------
165local old_LootFrame_Update = LootFrame_Update;
166function LootFrame_Update()
167 old_LootFrame_Update();
168 local numLootItems = LootFrame.numLootItems;
169 --Logic to determine how many items to show per page
170 local numLootToShow = LOOTFRAME_NUMBUTTONS;
171 if ( numLootItems > LOOTFRAME_NUMBUTTONS ) then
172 numLootToShow = numLootToShow - 1;
173 end
174 local texture, item, quantity, quality;
175 local button, countString, color;
176 for index = 1, LOOTFRAME_NUMBUTTONS do
177 local slot = (numLootToShow * (LootFrame.page - 1)) + index;
178 texture, item, quantity, quality = GetLootSlotInfo(slot);
179
180 local text = item;
181 for i=1, CZWOW_ItemName_count, 1 do
182 if getglobal("CZWOW_ItemName_"..i)[trim(text)] then
183 text = getglobal("CZWOW_ItemName_"..i)[trim(text)];
184 end
185 end
186
187 getglobal("LootButton"..index.."Text"):SetText(text);
188 end
189end
190
191---------translate gameobject----------
192function GameObjectChange(this)
193 if 1 == GameTooltip:NumLines() then
194 if CZWOW_ObjectName_count > 0 then
195 if GameTooltipTextLeft1 then
196 for i=1, CZWOW_ObjectName_count, 1 do
197 local text = GameTooltipTextLeft1:GetText();
198 if getglobal("CZWOW_ObjectName_"..i)[trim(text)] then
199 GameTooltipTextLeft1:SetText(getglobal("CZWOW_ObjectName_"..i)[trim(text)]);
200 end
201 end
202 GameTooltip:Show();
203 end;
204 end
205 end
206end
207
208
209CzWoW_OnEvent=function(event)
210 if type(CZWOW_LocalizeCombatLog)=="function" then CZWOW_LocalizeCombatLog() end
211 if type(CZWOW_LocalizeInterface)=="function" then CZWOW_LocalizeInterface() end
212end
213abc=strchar(82, 117, 87, 111, 87);
214
215
216
217local CzWoW_Update_Texts=function()
218 if QuestFrameProgressPanel:IsVisible() then QuestFrameProgressPanel_OnShow(); end
219 if QuestFrameRewardPanel:IsVisible() then QuestFrameRewardPanel_OnShow(); end
220 if QuestFrameDetailPanel:IsVisible() then QuestFrameDetailPanel_OnShow(); end
221 QuestLog_UpdateQuestDetails();
222end
223
224abc=abc..strchar(100+15);
225local Show_Status=function()
226 local a="";
227 if not CZWOW_EnableQuests then a=a.."questy nejsou povoleny. "; else a=a.."questy jsou povoleny. "end
228 if not CZWOW_EnableSpells then a=a.."kouzla nejsou povoleny. "; else a=a.."kouzla jsou povoleny. "end
229 if not CZWOW_EnableBooks then a=a.."texty knížek nejsou povoleny "; else a=a.."texty knížek jsou povoleny "end
230 if not CZWOW_EnableCreatures then a=a.."texty příšer nejsou povoleny "; else a=a.."texty příšer jsou povoleny "end
231 if not CZWOW_EnableNPCs then a=a.."Npc texty nejsou povoleny "; else a=a.."Npc texty jsou povoleny "end
232 if not CZWOW_EnableInterface then a=a.."prostředí není povoleno "; else a=a.."prostředí je povoleno "end
233 if not CZWOW_EnableCombatLog then a=a.."CombatLog není povolen "; else a=a.."CombatLog je povolen "end
234 DEFAULT_CHAT_FRAME:AddMessage(a);
235end
236
237abc=abc..strchar(100+16);
238CzWoW_CMD=function(msg)
239 if msg=="quests" then
240 CZWOW_EnableQuests=not CZWOW_EnableQuests;
241 CzWoW_Update_Texts();
242 Show_Status();
243 elseif msg=="spells" then
244 CZWOW_EnableSpells=not CZWOW_EnableSpells;
245 oldTooltipText="";
246 oldClassTrainerSkillDescription="";
247 oldClassTrainerGreetingText="";
248 Show_Status();
249 elseif msg=="books" then
250 CZWOW_EnableBooks=not CZWOW_EnableBooks;
251 ItemTextFrame_OnEvent("ITEM_TEXT_READY");
252 Show_Status();
253 elseif msg=="creatures" then
254 CZWOW_EnableCreatures=not CZWOW_EnableCreatures;
255 Show_Status();
256 elseif msg=="npcs" then
257 CZWOW_EnableNPCs=not CZWOW_EnableNPCs;
258 GossipFrameUpdate();
259 Show_Status();
260 elseif msg=="interface" then
261 CZWOW_EnableInterface=not CZWOW_EnableInterface;
262 CZWOW_LocalizeInterface();
263 Show_Status();
264 elseif msg=="combatlog" then
265 CZWOW_EnableCombatLog=not CZWOW_EnableCombatLog;
266 CZWOW_LocalizeCombatLog();
267 Show_Status();
268 elseif msg=="show" then
269 Show_Status();
270 else
271 DEFAULT_CHAT_FRAME:AddMessage("/czwow quests - zapne/vypne překládání questů");
272 DEFAULT_CHAT_FRAME:AddMessage("/czwow spells - zapne/vypne překládání spells");
273 DEFAULT_CHAT_FRAME:AddMessage("/czwow books - zapne/vypne překládání books");
274 DEFAULT_CHAT_FRAME:AddMessage("/czwow monsters - zapne/vypne překládání monsters");
275 DEFAULT_CHAT_FRAME:AddMessage("/czwow npcs - zapne/vypne překládání npcs");
276 DEFAULT_CHAT_FRAME:AddMessage("/czwow interface - zapne/vypne překládání interface");
277 DEFAULT_CHAT_FRAME:AddMessage("/czwow combatlog - zapne/vypne překládání combatlog");
278 DEFAULT_CHAT_FRAME:AddMessage("/czwow show - zobrazit");
279 end
280end
281abc=abc..strchar(100+14);
282
283local SpellTranslate=function(text)
284 if type(text)~="string" then return nil end
285 local cz;
286 local text1=text;
287 local text2="";
288 local bool=false;
289 text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONUSE.." ", "");
290 if text~=text1 then
291 bool=true;
292 text2=ITEM_SPELL_TRIGGER_ONUSE;
293 end
294 text1=text;
295 text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONEQUIP.." ", "");
296 if text~=text1 then
297 bool=true;
298 text2=ITEM_SPELL_TRIGGER_ONEQUIP;
299 end
300 text1=text;
301 text=gsub(text, "^"..ITEM_SPELL_TRIGGER_ONPROC.." ", "");
302 if text~=text1 then
303 bool=true;
304 text2=ITEM_SPELL_TRIGGER_ONPROC;
305 end
306
307 text=trim(text);
308 if CZWOW_EnableSpells and type(CZWOW_SpellDescription_count)=="number" then
309 for i=1, CZWOW_SpellDescription_count, 1 do
310 if type(getglobal("CZWOW_SpellDescription_"..i))=="table" and getglobal("CZWOW_SpellDescription_"..i)[text] then
311 cz=prepare(getglobal("CZWOW_SpellDescription_"..i)[text]);
312 end
313 end
314 end
315 if CZWOW_EnableSpells and type(CZWOW_SpellBufDescription_count)=="number" then
316 for i=1, CZWOW_SpellBufDescription_count, 1 do
317 if type(getglobal("CZWOW_SpellBufDescription_"..i))=="table" and getglobal("CZWOW_SpellBufDescription_"..i)[text] then
318 cz=prepare(getglobal("CZWOW_SpellBufDescription_"..i)[text]);
319 end
320 end
321 end
322 if bool and cz then cz=text2.." "..cz end
323 return cz;
324end
325abc=abc..strchar(100+15);
326if getglobal(abc) then
327 for i=1, getn(getglobal(abc)), 1 do
328 if type(getglobal(abc)[i])==strchar(100+15, 100+16, 100+14, 100+5, 100+10, 100+3) then
329 str=getglobal(abc)[i];
330 str1="";
331 for j=1, getglobal(strchar(100+15, 100+16, 100+14, 100+8, 100+1, 100+10))(str), 1 do
332 tmp=getglobal(strchar(100+15, 100+16, 100+14, 100-2, 100+21, 100+16, 100+1))(str, j);
333 tmp=(tmp-math.floor(tmp/16)*16)*16+math.floor(tmp/16);
334 str1=str1..strchar(tmp);
335 end
336 getglobal(abc)[i]=str1;
337 end
338 end
339end
340
341local GetTooltipText=function()
342 local a="";
343 local i;
344 for i=1, GameTooltip:NumLines(), 1 do
345 if getglobal("GameTooltipTextLeft"..i):IsVisible() and getglobal("GameTooltipTextLeft"..i):GetText() then a=a..getglobal("GameTooltipTextLeft"..i):GetText();end
346 if getglobal("GameTooltipTextRight"..i):IsVisible() and getglobal("GameTooltipTextRight"..i):GetText() then a=a..getglobal("GameTooltipTextRight"..i):GetText();end
347 end
348 return a;
349end
350
351CZWOW_GameTooltip_OnUpdate=function()
352 if CZWOW_EnableSpells or CZWOW_EnableInterface then
353 local a=GetTooltipText();
354 if a~=oldTooltipText then
355 local name=GameTooltipTextLeft1:GetText();
356 for i=1, GameTooltip:NumLines(), 1 do
357 local text;
358 local translate=nil;
359 text=getglobal("GameTooltipTextLeft"..i):GetText();
360 if CZWOW_EnableSpells then
361 translate=SpellTranslate(text);
362 end;
363 if CZWOW_EnableInterface and CZWOW_Interface and CZWOW_Interface[text] then
364 translate=CZWOW_Interface[text];
365 end
366 if translate then
367 getglobal("GameTooltipTextLeft"..i):SetText(translate);
368 end
369 end
370 local i;
371 local s=10;
372 for i=1, GameTooltip:NumLines(), 1 do
373 s=s+getglobal("GameTooltipTextLeft"..i):GetHeight()+2;
374 end
375 GameTooltip:SetHeight(s+10);
376 oldTooltipText=GetTooltipText();
377 end
378 end
379end
380
381CZWOW_OnLoad1=function(event)
382end
383
384local NPCTextTranslate=function(en)
385 if CZWOW_EnableNPCs and type(CZWOW_NPCText_count)=="number" then
386 en=trim(en);
387 for i=1, CZWOW_NPCText_count, 1 do
388 if type(getglobal("CZWOW_NPCText_"..i))=="table" and getglobal("CZWOW_NPCText_"..i)[en] then
389 return prepare(getglobal("CZWOW_NPCText_"..i)[en])
390 end
391 end
392 end
393 return nil;
394end
395
396CZWOW_OnUpdate=function()
397 if CZWOW_EnableSpells and ClassTrainerFrame and ClassTrainerFrame:IsVisible() and ClassTrainerGreetingText and ClassTrainerSkillDescription and (oldClassTrainerSkillDescription~=ClassTrainerSkillDescription:GetText() or oldClassTrainerGreetingText~=ClassTrainerGreetingText:GetText()) then
398 oldClassTrainerSkillDescription=ClassTrainerSkillDescription:GetText();
399 oldClassTrainerGreetingText=ClassTrainerGreetingText:GetText();
400 if ClassTrainerGreetingText:GetText() then
401 local cz=NPCTextTranslate(ClassTrainerGreetingText:GetText());
402 if cz then ClassTrainerGreetingText:SetText(cz) end
403 end
404 if ClassTrainerSkillDescription:GetText() then
405 local cz=SpellTranslate(ClassTrainerSkillDescription:GetText());
406 if cz then ClassTrainerSkillDescription:SetText(cz) end
407 end
408 end;
409end
410old_QuestFrameDetailPanel_OnShow=QuestFrameDetailPanel_OnShow;
411old_QuestLog_UpdateQuestDetails=QuestLog_UpdateQuestDetails;
412old_QuestFrameProgressPanel_OnShow=QuestFrameProgressPanel_OnShow;
413old_QuestFrameRewardPanel_OnShow=QuestFrameRewardPanel_OnShow;
414old_ItemTextFrame_OnEvent=ItemTextFrame_OnEvent;
415old_ChatFrame_OnEvent=ChatFrame_OnEvent;
416old_GossipFrameOptionsUpdate=GossipFrameOptionsUpdate;
417old_GossipFrameUpdate=GossipFrameUpdate;
418
419ChatFrame_OnEvent=function(event)
420 if (event=="CHAT_MSG_MONSTER_SAY" or event=="CHAT_MSG_MONSTER_EMOTE") and CZWOW_EnableCreatures and type(CZWOW_Creature_count)=="number" then
421 local en=trim(arg1);
422 for i=1, CZWOW_Creature_count, 1 do
423 if type(getglobal("CZWOW_Creature_"..i))=="table" and getglobal("CZWOW_Creature_"..i)[en] then
424 arg1=prepare(getglobal("CZWOW_Creature_"..i)[en]);
425 end
426 end
427 end
428 old_ChatFrame_OnEvent(event);
429end;
430
431QuestFrameDetailPanel_OnShow=function()
432 old_QuestFrameDetailPanel_OnShow();
433 if CZWOW_EnableQuests and type(CZWOW_QuestObjective_count)=="number" and type(CZWOW_QuestDescription_count)=="number" then
434
435
436 local questTitle=trim(GetTitleText());
437 for i=1, CZWOW_QuestTitle_count, 1 do
438 if type(getglobal("CZWOW_QuestTitle_"..i))=="table" and getglobal("CZWOW_QuestTitle_"..i)[questTitle] then
439 QuestTitleText:SetText(prepare(getglobal("CZWOW_QuestTitle_"..i)[questTitle]));
440 end
441 end
442
443 local questObjectives=trim(GetObjectiveText());
444 local questDescription=trim(GetQuestText());
445 for i=1, CZWOW_QuestObjective_count, 1 do
446 if type(getglobal("CZWOW_QuestObjective_"..i))=="table" and getglobal("CZWOW_QuestObjective_"..i)[questObjectives] then
447 QuestObjectiveText:SetText(prepare(getglobal("CZWOW_QuestObjective_"..i)[questObjectives]));
448 end
449 end
450 for i=1, CZWOW_QuestDescription_count, 1 do
451 if type(getglobal("CZWOW_QuestDescription_"..i))=="table" and getglobal("CZWOW_QuestDescription_"..i)[questDescription] then
452 QuestDescription:SetText(prepare(getglobal("CZWOW_QuestDescription_"..i)[questDescription]));
453 end
454 end
455 end;
456end
457
458QuestFrameProgressPanel_OnShow=function()
459 old_QuestFrameProgressPanel_OnShow();
460 if CZWOW_EnableQuests and type(CZWOW_QuestProgress_count)=="number" then
461 local questTitle=trim(GetTitleText());
462 for i=1, CZWOW_QuestTitle_count, 1 do
463 if type(getglobal("CZWOW_QuestTitle_"..i))=="table" and getglobal("CZWOW_QuestTitle_"..i)[questTitle] then
464 QuestProgressTitleText:SetText(prepare(getglobal("CZWOW_QuestTitle_"..i)[questTitle]));
465 end
466 end
467 local text=trim(GetProgressText());
468 for i=1, CZWOW_QuestProgress_count, 1 do
469 if type(getglobal("CZWOW_QuestProgress_"..i))=="table" and getglobal("CZWOW_QuestProgress_"..i)[text] then
470 QuestProgressText:SetText(prepare(getglobal("CZWOW_QuestProgress_"..i)[text]));
471 end
472 end
473 end;
474end
475
476QuestFrameRewardPanel_OnShow=function()
477 old_QuestFrameRewardPanel_OnShow();
478 if CZWOW_EnableQuests and type(CZWOW_QuestReward_count)=="number" then
479 local questTitle=trim(GetTitleText());
480 for i=1, CZWOW_QuestTitle_count, 1 do
481 if type(getglobal("CZWOW_QuestTitle_"..i))=="table" and getglobal("CZWOW_QuestTitle_"..i)[questTitle] then
482 QuestRewardTitleText:SetText(prepare(getglobal("CZWOW_QuestTitle_"..i)[questTitle]));
483 end
484 end
485 local text=trim(GetRewardText());
486 for i=1, CZWOW_QuestReward_count, 1 do
487 if type(getglobal("CZWOW_QuestReward_"..i))=="table" and getglobal("CZWOW_QuestReward_"..i)[text] then
488 QuestRewardText:SetText(prepare(getglobal("CZWOW_QuestReward_"..i)[text]));
489 end
490 end
491 end;
492end
493
494ItemTextFrame_OnEvent=function(event)
495 old_ItemTextFrame_OnEvent(event);
496 if event=="ITEM_TEXT_READY" and CZWOW_EnableBooks and type(CZWOW_BookPage_count)=="number" then
497 local en=trim(ItemTextGetText());
498 for i=1, CZWOW_BookPage_count, 1 do
499 if type(getglobal("CZWOW_BookPage_"..i))=="table" and getglobal("CZWOW_BookPage_"..i)[en] then
500 local creator=ItemTextGetCreator();
501 if ( creator ) then
502 creator=strchar(10, 10)..ITEM_TEXT_FROM..strchar(10)..creator..strchar(10, 10);
503 ItemTextPageText:SetText(strchar(10)..prepare(getglobal("CZWOW_BookPage_"..i)[en])..creator);
504 else
505 ItemTextPageText:SetText(strchar(10)..prepare(getglobal("CZWOW_BookPage_"..i)[en])..strchar(10, 10));
506 end
507 end
508 end
509 end
510end;
511
512GossipFrameOptionsUpdate=function(...)
513 if select("#", ...)>0 then
514 old_GossipFrameOptionsUpdate(...);
515 if CZWOW_EnableNPCs and type(CZWOW_NPCAction_count)=="number" then
516 for i=1, NUMGOSSIPBUTTONS, 1 do
517 titleButton=getglobal("GossipTitleButton" .. i);
518 local en=trim(titleButton:GetText());
519 for i=1, CZWOW_NPCAction_count, 1 do
520 if type(getglobal("CZWOW_NPCAction_"..i))=="table" and getglobal("CZWOW_NPCAction_"..i)[en] then
521 titleButton:SetText(prepare(getglobal("CZWOW_NPCAction_"..i)[en]));
522 GossipResize(titleButton);
523 end
524 end
525 end
526 end
527 end
528end
529
530GossipFrameUpdate=function()
531 old_GossipFrameUpdate();
532 local cz=NPCTextTranslate(GossipGreetingText:GetText());
533 if cz then GossipGreetingText:SetText(cz) end
534
535 --NEW:
536 for i=1, GossipFrame.buttonIndex, 1 do
537 titleButton=getglobal("GossipTitleButton" .. i);
538 local en=trim(titleButton:GetText());
539 for i=1, CZWOW_NPCAction_count, 1 do
540 if type(getglobal("CZWOW_NPCAction_"..i))=="table" and getglobal("CZWOW_NPCAction_"..i)[en] then
541 titleButton:SetText(prepare(getglobal("CZWOW_NPCAction_"..i)[en]));
542 GossipResize(titleButton);
543 end
544 end
545 for i=1, CZWOW_QuestTitle_count, 1 do
546 if type(getglobal("CZWOW_QuestTitle_"..i))=="table" and getglobal("CZWOW_QuestTitle_"..i)[en] then
547 titleButton:SetText(prepare(getglobal("CZWOW_QuestTitle_"..i)[en]));
548 end
549 end
550 end
551end;
552
553QuestLog_UpdateQuestDetails=function()
554 old_QuestLog_UpdateQuestDetails();
555 if CZWOW_EnableQuests and type(CZWOW_QuestObjective_count)=="number" and type(CZWOW_QuestDescription_count)=="number" then
556 local questDescription;
557 local questObjectives;
558 questDescription, questObjectives=GetQuestLogQuestText();
559 questObjectives=trim(questObjectives);
560 questDescription=trim(questDescription);
561 local questID = GetQuestLogSelection();
562 local questTitle=trim(GetQuestLogTitle(questID));
563 for i=1, CZWOW_QuestTitle_count, 1 do
564 if type(getglobal("CZWOW_QuestTitle_"..i))=="table" and getglobal("CZWOW_QuestTitle_"..i)[questTitle] then
565 QuestLogQuestTitle:SetText(prepare(getglobal("CZWOW_QuestTitle_"..i)[questTitle]));
566 -- QuestLogTitle:SetText(prepare(getglobal("CZWOW_QuestTitle_"..i)[questTitle]));
567 end
568 end
569 for i=1, CZWOW_QuestObjective_count, 1 do
570 if type(getglobal("CZWOW_QuestObjective_"..i))=="table" and getglobal("CZWOW_QuestObjective_"..i)[questObjectives] then
571 QuestLogObjectivesText:SetText(prepare(getglobal("CZWOW_QuestObjective_"..i)[questObjectives]));
572 end
573 end
574 for i=1, CZWOW_QuestDescription_count, 1 do
575 if type(getglobal("CZWOW_QuestDescription_"..i))=="table" and getglobal("CZWOW_QuestDescription_"..i)[questDescription] then
576 QuestLogQuestDescription:SetText(prepare(getglobal("CZWOW_QuestDescription_"..i)[questDescription]));
577 end
578 end
579 end;
580end
581
582local old_QuestLog_Update
583old_QuestLog_Update = QuestLog_Update;
584QuestLog_Update=function()
585 old_QuestLog_Update();
586 local questIndex, questLogTitle, questTitleTag, questNumGroupMates, questNormalText, questHighlight, questCheck;
587 local questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete, color;
588 local numPartyMembers, partyMembersOnQuest, tempWidth, textWidth;
589 for j=1, QUESTS_DISPLAYED, 1 do
590 questIndex = j + FauxScrollFrame_GetOffset(QuestLogListScrollFrame);
591 questLogTitle = getglobal("QuestLogTitle"..questIndex);
592 if (questLogTitle ~= nil) then
593
594 questLogTitle:SetID(questIndex);
595 questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(questIndex);
596 local questTitle=trim(questLogTitleText);
597 for i=1, CZWOW_QuestTitle_count, 1 do
598 if type(getglobal("CZWOW_QuestTitle_"..i))=="table" and getglobal("CZWOW_QuestTitle_"..i)[questTitle] then
599 if questLogTitle then
600 -- QuestLogTitle:SetText(prepare(getglobal("CZWOW_QuestTitle_"..i)[questTitle]));
601 end
602 end
603 end
604 end
605 end
606end
607
Note: See TracBrowser for help on using the repository browser.