1 | local old_QuestLog_UpdateQuestDetails=QuestLog_UpdateQuestDetails;
|
---|
2 | local old_GossipFrameOptionsUpdate=GossipFrameOptionsUpdate;
|
---|
3 | local old_GossipFrameUpdate=GossipFrameUpdate;
|
---|
4 | local old_QuestLog_Update=QuestLog_Update;
|
---|
5 | local old_GossipFrameAvailableQuestsUpdate=GossipFrameAvailableQuestsUpdate;
|
---|
6 | local old_GossipFrameActiveQuestsUpdate=GossipFrameActiveQuestsUpdate;
|
---|
7 |
|
---|
8 | --TODO: Prohledat dbc soubory na texty rozhovodů NPC, commitnout ty error zprávy
|
---|
9 |
|
---|
10 | local trim=function(text)
|
---|
11 | if not text then return nil; end
|
---|
12 | return gsub(gsub(gsub(string.lower(text), "%s+", " "), "%s+$", ""), "^%s+", "");
|
---|
13 | end
|
---|
14 |
|
---|
15 | local Translate=function(text)
|
---|
16 | local en = text;
|
---|
17 | text = trim(text);
|
---|
18 | for i=1, CZWOW_QuestTitle_count, 1 do
|
---|
19 | if getglobal("CZWOW_QuestTitle_"..i)[text] then
|
---|
20 | return getglobal("CZWOW_QuestTitle_"..i)[text];
|
---|
21 | end
|
---|
22 | end
|
---|
23 | for i=1, CZWOW_QuestObjective_count, 1 do
|
---|
24 | if getglobal("CZWOW_QuestObjective_"..i)[text] then
|
---|
25 | return getglobal("CZWOW_QuestObjective_"..i)[text];
|
---|
26 | end
|
---|
27 | end
|
---|
28 | for i=1, CZWOW_QuestDescription_count, 1 do
|
---|
29 | if getglobal("CZWOW_QuestDescription_"..i)[text] then
|
---|
30 | return getglobal("CZWOW_QuestDescription_"..i)[text];
|
---|
31 | end
|
---|
32 | end
|
---|
33 | for i=1, CZWOW_QuestProgress_count, 1 do
|
---|
34 | if getglobal("CZWOW_QuestProgress_"..i)[text] then
|
---|
35 | return getglobal("CZWOW_QuestProgress_"..i)[text];
|
---|
36 | end
|
---|
37 | end
|
---|
38 | for i=1, CZWOW_QuestReward_count, 1 do
|
---|
39 | if getglobal("CZWOW_QuestReward_"..i)[text] then
|
---|
40 | return getglobal("CZWOW_QuestReward_"..i)[text];
|
---|
41 | end
|
---|
42 | end
|
---|
43 | for i=1, CZWOW_NPCAction_count, 1 do
|
---|
44 | if getglobal("CZWOW_NPCAction_"..i)[text] then
|
---|
45 | return getglobal("CZWOW_NPCAction_"..i)[text];
|
---|
46 | end
|
---|
47 | end
|
---|
48 | for i=1, CZWOW_BookPage_count, 1 do
|
---|
49 | if getglobal("CZWOW_BookPage_"..i)[text] then
|
---|
50 | return getglobal("CZWOW_BookPage_"..i)[text];
|
---|
51 | end
|
---|
52 | end
|
---|
53 | for i=1, CZWOW_NPCText_count, 1 do
|
---|
54 | if getglobal("CZWOW_NPCText_"..i)[text] then
|
---|
55 | return getglobal("CZWOW_NPCText_"..i)[text];
|
---|
56 | end
|
---|
57 | end
|
---|
58 | return en;
|
---|
59 | end
|
---|
60 |
|
---|
61 | CzWoW_OnLoad=function()
|
---|
62 | DEFAULT_CHAT_FRAME:AddMessage("CzWoW načteno. Díky addonu by měl fungovat překlad výprav, NPC textů, textů knížek, rozhraní klienta, tutoriál, chybové hlášení uprostřed obrazovky. Pomoci překladu můžete na stránkách http://wowpreklad.zdechov.net/");
|
---|
63 | end
|
---|
64 |
|
---|
65 | CZWOW_OnUpdate=function()
|
---|
66 | if QuestFrameProgressPanel:IsVisible() then QuestFrameProgressPanel_OnShow(); end
|
---|
67 | if QuestFrameRewardPanel:IsVisible() then QuestFrameRewardPanel_OnShow(); end
|
---|
68 | if QuestFrameDetailPanel:IsVisible() then QuestFrameDetailPanel_OnShow(); end
|
---|
69 | if ItemTextFrame:IsVisible() then ItemTextFrame_OnEvent(); end
|
---|
70 | end
|
---|
71 |
|
---|
72 | --formuláře výprav u NPC
|
---|
73 | QuestFrameDetailPanel_OnShow=function()
|
---|
74 | if getglobal("CZWOW_QuestTitle_1")[trim(GetTitleText())] then
|
---|
75 | QuestTitleText:SetText(Translate(GetTitleText()));
|
---|
76 | QuestObjectiveText:SetText(Translate(GetObjectiveText()));
|
---|
77 | QuestDescription:SetText(Translate(GetQuestText()));
|
---|
78 | end
|
---|
79 | end
|
---|
80 |
|
---|
81 | QuestFrameProgressPanel_OnShow=function()
|
---|
82 | if getglobal("CZWOW_QuestTitle_1")[trim(GetTitleText())] then
|
---|
83 | QuestProgressTitleText:SetText(Translate(GetTitleText()));
|
---|
84 | QuestProgressText:SetText(Translate(GetProgressText()));
|
---|
85 | end
|
---|
86 | end
|
---|
87 |
|
---|
88 | QuestFrameRewardPanel_OnShow=function()
|
---|
89 | if getglobal("CZWOW_QuestTitle_1")[trim(GetTitleText())] then
|
---|
90 | QuestRewardTitleText:SetText(Translate(GetTitleText()));
|
---|
91 | QuestRewardText:SetText(Translate(GetRewardText()));
|
---|
92 | end;
|
---|
93 | end
|
---|
94 | --konec formuláře výprav
|
---|
95 |
|
---|
96 | --questlog
|
---|
97 | QuestLog_UpdateQuestDetails=function(...)
|
---|
98 |
|
---|
99 | old_QuestLog_UpdateQuestDetails(...);
|
---|
100 |
|
---|
101 | local questDescription;
|
---|
102 | local questObjectives;
|
---|
103 | questDescription, questObjectives=GetQuestLogQuestText();
|
---|
104 |
|
---|
105 | questLogTitleText, _, _, _, _, _, _, _ = GetQuestLogTitle(GetQuestLogSelection());
|
---|
106 | if getglobal("CZWOW_QuestTitle_1")[trim(questLogTitleText)] then
|
---|
107 | QuestLogQuestTitle:SetText(Translate(questLogTitleText));
|
---|
108 | QuestLogObjectivesText:SetText(Translate(questObjectives));
|
---|
109 | QuestLogQuestDescription:SetText(Translate(questDescription));
|
---|
110 | end
|
---|
111 | end
|
---|
112 |
|
---|
113 | QuestLog_Update=function()
|
---|
114 | old_QuestLog_Update();
|
---|
115 | local buttons = QuestLogScrollFrame.buttons;
|
---|
116 | local numButtons = #buttons;
|
---|
117 | local scrollOffset = HybridScrollFrame_GetOffset(QuestLogScrollFrame);
|
---|
118 |
|
---|
119 | local questIndex, questTitleTag, questNumGroupMates, questNormalText, questCheck;
|
---|
120 | local title, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily;
|
---|
121 | local partyMembersOnQuest, tempWidth, textWidth;
|
---|
122 | for i=1, numButtons do
|
---|
123 | local questLogTitle = buttons[i];
|
---|
124 | questIndex = i + scrollOffset;
|
---|
125 | questLogTitle:SetID(questIndex);
|
---|
126 | title, _, _, _, _, _, _, _ = GetQuestLogTitle(questIndex);
|
---|
127 | if questLogTitle then questLogTitle:SetText(Translate(title)); end
|
---|
128 | end
|
---|
129 | end
|
---|
130 | --konec questlog
|
---|
131 |
|
---|
132 | --Formuláře NPC postav
|
---|
133 | GossipFrameOptionsUpdate=function(...)
|
---|
134 | if select("#", ...)>0 then
|
---|
135 | old_GossipFrameOptionsUpdate(...);
|
---|
136 | for i=1, NUMGOSSIPBUTTONS, 1 do
|
---|
137 | titleButton=getglobal("GossipTitleButton" .. i);
|
---|
138 | local en=trim(titleButton:GetText());
|
---|
139 | if getglobal("CZWOW_NPCAction_1")[en] then
|
---|
140 | titleButton:SetText(Translate(en));
|
---|
141 | GossipResize(titleButton);
|
---|
142 | end
|
---|
143 | -- TODO: kontrolovat také s bez "The"
|
---|
144 | end
|
---|
145 | end
|
---|
146 | end
|
---|
147 |
|
---|
148 | GossipFrameUpdate=function()
|
---|
149 | old_GossipFrameUpdate();
|
---|
150 | local en=trim(GossipGreetingText:GetText());
|
---|
151 | GossipGreetingText:SetText(Translate(en));
|
---|
152 | end;
|
---|
153 |
|
---|
154 | GossipFrameActiveQuestsUpdate=function(...)
|
---|
155 | local titleButton;
|
---|
156 | local titleIndex = 1;
|
---|
157 | old_GossipFrameActiveQuestsUpdate(...);
|
---|
158 | for i=1, select("#", ...), 3 do
|
---|
159 | titleButton = _G["GossipTitleButton" .. titleIndex];
|
---|
160 | if getglobal("CZWOW_QuestTitle_1")[trim(select(i, ...))] then
|
---|
161 | titleButton:SetText(Translate(select(i, ...)));
|
---|
162 | end
|
---|
163 | titleIndex = titleIndex + 1;
|
---|
164 | end
|
---|
165 | end
|
---|
166 |
|
---|
167 | GossipFrameAvailableQuestsUpdate=function(...)
|
---|
168 | local titleButton;
|
---|
169 | local titleIndex = 1;
|
---|
170 | old_GossipFrameAvailableQuestsUpdate(...);
|
---|
171 | for i=1, select("#", ...), 3 do
|
---|
172 | titleButton = _G["GossipTitleButton" .. titleIndex];
|
---|
173 | if getglobal("CZWOW_QuestTitle_1")[trim(select(i, ...))] then
|
---|
174 | titleButton:SetText(Translate(select(i, ...)));
|
---|
175 | end
|
---|
176 | titleIndex = titleIndex + 1;
|
---|
177 | end
|
---|
178 | end
|
---|
179 | --konec formuláře NPC postav
|
---|
180 |
|
---|
181 | --page texty
|
---|
182 | ItemTextFrame_OnEvent=function(self, event, ...)
|
---|
183 | local en=ItemTextGetText();
|
---|
184 | if getglobal("CZWOW_BookPage_1")[trim(en)] then
|
---|
185 | ItemTextPageText:SetText(Translate(en));
|
---|
186 | end
|
---|
187 | end;
|
---|
188 | --konec page texty
|
---|
189 |
|
---|
190 |
|
---|
191 |
|
---|
192 | --DEFAULT_CHAT_FRAME:AddMessage("NPC");
|
---|