-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWoWinArabic_Quests.lua
2030 lines (1914 loc) · 99.7 KB
/
WoWinArabic_Quests.lua
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Addon: WoWinArabic_Quests (version: 10.2) 2023.11.25
-- Note: AddOn displays translated quests in Arabic.
-- Autor: Platine (e-mail: [email protected])
-- Contributor: DragonArab - Developed letter reshaping tables and ligatures (http://WoWinArabic.com)
-- Zmienne lokalne
local QTR_version = GetAddOnMetadata("WoWinArabic_Quests", "Version");
local QTR_limit1 = 45; -- limit znaków w linii opisującej zadanie w Map&Quest Log
local QTR_limit2 = 35; -- character limit in the line describing the quest in the conversation with the NPC window
local QTR_limit3 = 25; -- character limit in the line describing the monster in QuestNPCModelText
local QTR_onDebug = false;
local QTR_name = UnitName("player");
local QTR_class = UnitClass("player");
local QTR_race = UnitRace("player");
local QTR_sex = UnitSex("player"); -- 1:neutral, 2:męski, 3:żeński
local QTR_waitTable = {};
local QTR_waitFrame = nil;
local QTR_MessOrig = {
details = "Description",
objectives = "Quest Objectives",
rewards = "Rewards",
itemchoose0 = "You will receive:",
itemchoose1 = "You will be able to choose one of these rewards:",
itemchoose2 = "Choose one of these rewards:",
itemchoose3 = "You receiving the reward:",
itemreceiv0 = "You will receive:",
itemreceiv1 = "You will also receive:",
itemreceiv2 = "You receiving the reward:",
itemreceiv3 = "You also receiving the reward:",
learnspell = "Learn Spell:",
reqmoney = "Required Money:",
reqitems = "Required items:",
experience = "Experience:",
currquests = "Current Quests",
avaiquests = "Available Quests",
reward_aura = "The following will be cast on you:",
reward_spell = "You will learn the following:",
reward_companion = "You will gain these Companions:",
reward_follower = "You will gain these followers:",
reward_reputation = "Reputation awards:",
reward_title = "You shall be granted the title:",
reward_tradeskill = "You will learn how to create:",
reward_unlock = "You will unlock access to the following:",
reward_bonus = "Completing this quest while in Party Sync may reward:",
};
local QTR_quest_ID = 0;
local QTR_quest_EN = {};
local QTR_quest_LG = {};
QTR_quest_EN[0] = {};
QTR_quest_LG[0] = {};
local last_time = GetTime();
local last_text = 0;
local curr_trans = "1";
local curr_goss = "X";
local curr_hash = 0;
local QTR_first_show = 0;
local QTR_first_show2 = 0;
local QTR_first_voice = 0;
local QTR_first_gs_show = 0;
local QTR_first_gs_voice = 0;
local QTR_ModelTextHash = 0;
local QTR_ModelText_EN = "";
local QTR_ModelText_PL = "";
local aktShow = 0; -- liczba aktualnie przypisanych zdarzeń OnShow do NPE_PointerFrame
local tutShow = 0; -- znacznik przypisania skryptu od wyświetlenia okienka tutoriału
local Original_Font1 = "Fonts\\MORPHEUS.ttf";
local Original_Font2 = "Fonts\\FRIZQT__.ttf";
local QTR_FrameOnLine, QTR_FrameOnLineButton, QTR_FrameOnLineHash;
local Tut_ID = 0;
local Tut_race = string.gsub(strupper(QTR_race), " ", "");
local Tut_class = string.gsub(strupper(QTR_class), " ", "");
if (Tut_class == "DEATHKNIGHT") then
Tut_race = "DEATHKNIGHT";
end
local quest_numReward = {}; -- liczba dostępnych nagród do questu
local time_ver = GetTime() - 15 * 60;
local p_race = {
["Blood Elf"] = { M1 = "بلود إيلف", M2 = "بلود إيلف" },
["Dark Iron Dwarf"] = { M1 = "دارك ايرون دوارف", M2 = "دارك ايرون دوارف" },
["Dracthyr"] = { M1 = "دراكثير", M2 = "دراكثير" },
["Draenei"] = { M1 = "دريناي", M2 = "دريناي" },
["Dwarf"] = { M1 = "دوارف", M2 = "دوارف" },
["Gnome"] = { M1 = "قنوم", M2 = "قنوم" },
["Goblin"] = { M1 = "قوبلن", M2 = "قوبلن" },
["Highmountain Tauren"] = { M1 = "هايماونتن تورين", M2 = "هايماونتن تورين" },
["Human"] = { M1 = "بشري", M2 = "بشري" },
["Kul Tiran"] = { M1 = "كول تيران", M2 = "كول تيران" },
["Lightforged Draenei"] = { M1 = "لايتفورج دريناي", M2 = "لايتفورج دريناي" },
["Mag'har Orc"] = { M1 = "ماقهار اورك", M2 = "ماقهار اورك" },
["Mechagnome"] = { M1 = "ميكاقنوم", M2 = "ميكاقنوم" },
["Nightborne"] = { M1 = "نايتبرون", M2 = "نايتبرون" },
["Night Elf"] = { M1 = "نايت إيلف", M2 = "نايت إيلف" },
["Orc"] = { M1 = "اورك", M2 = "اورك" },
["Pandaren"] = { M1 = "باندارين", M2 = "باندارين" },
["Tauren"] = { M1 = "تورين", M2 = "تورين" },
["Troll"] = { M1 = "ترول", M2 = "ترول" },
["Undead"] = { M1 = "انديد", M2 = "انديد" },
["Void Elf"] = { M1 = "فويد إيلف", M2 = "فويد إيلف" },
["Worgen"] = { M1 = "وارقين", M2 = "وارقين" },
["Zandalari Troll"] = { M1 = "زندلاري ترول", M2 = "زندلاري ترول" }
};
local p_class = {
["Death Knight"] = { M1 = "ديث نايت", M2 = "ديث نايت" },
["Demon Hunter"] = { M1 = "ديمون هنتر", M2 = "ديمون هنتر" },
["Druid"] = { M1 = "درود", M2 = "درود" },
["Hunter"] = { M1 = "هنتر", M2 = "هنتر" },
["Mage"] = { M1 = "ميج", M2 = "ميج" },
["Monk"] = { M1 = "مونك", M2 = "مونك" },
["Paladin"] = { M1 = "بلدين", M2 = "بلدين" },
["Priest"] = { M1 = "بريست", M2 = "بريست" },
["Rogue"] = { M1 = "روق", M2 = "روق" },
["Shaman"] = { M1 = "شامان", M2 = "شامان" },
["Warlock"] = { M1 = "ورلوك", M2 = "ورلوك" },
["Warrior"] = { M1 = "وارير", M2 = "وارير" }
};
if (p_race[QTR_race]) then
player_race = { M1 = p_race[QTR_race].M1, M2 = p_race[QTR_race].M2 };
else
player_race = { M1 = QTR_race, M2 = QTR_race };
print("|cff55ff00QTR - new race: " .. QTR_race);
end
if (p_class[QTR_class]) then
player_class = { M1 = p_class[QTR_class].M1, M2 = p_class[QTR_class].M2 };
else
player_class = { M1 = QTR_class, M2 = QTR_class };
print("|cff55ff00QTR - new class: " .. QTR_class);
end
-------------------------------------------------------------------------------------------------------
local function StringHash(text) -- funkcja tworząca Hash (32-bitowa liczba) podanego tekstu
local counter = 1;
local pomoc = 0;
local dlug = string.len(text);
for i = 1, dlug, 3 do
counter = math.fmod(counter * 8161, 4294967279); -- 2^32 - 17: Prime!
pomoc = (string.byte(text, i) * 16776193);
counter = counter + pomoc;
pomoc = ((string.byte(text, i + 1) or (dlug - i + 256)) * 8372226);
counter = counter + pomoc;
pomoc = ((string.byte(text, i + 2) or (dlug - i + 256)) * 3932164);
counter = counter + pomoc;
end
return math.fmod(counter, 4294967291) -- 2^32 - 5: Prime (and different from the prime in the loop)
end
-------------------------------------------------------------------------------------------------------
-- Zmienne programowe zapisane na stałe na komputerze
function QTR_CheckVars()
if (not QTR_PS) then
QTR_PS = {};
end
if (not QTR_SAVED) then
QTR_SAVED = {};
end
if (not QTR_GOSSIP) then
QTR_GOSSIP = {};
end
-- zapis wersji patcha Wow'a
QTR_PS["patch"] = GetBuildInfo(); -- zapisz za każdym razem, bo może masz nową wersję gry
-- inicjalizacja: tłumaczenia włączone
if (not QTR_PS["active"]) then
QTR_PS["active"] = "1";
end
-- inicjalizacja: tłumaczenie tytułu questu włączone
if (not QTR_PS["transtitle"]) then
QTR_PS["transtitle"] = "1";
end
if (not QTR_PS["transfixed"]) then
QTR_PS["transfixed"] = "1";
end
if (not QTR_PS["ownname"]) then
QTR_PS["ownname"] = "1";
end
if (not QTR_PS["ownname_obj"]) then
QTR_PS["ownname_obj"] = "1";
end
-- table for original gossip texts
QTR_GS = {};
QTR_GS2 = {};
QTR_PS["fontsize"] = "14";
-- zmienna specjalna dostępności funkcji GetQuestID
if (QTR_PS["isGetQuestID"]) then
isGetQuestID = QTR_PS["isGetQuestID"];
end;
end
-------------------------------------------------------------------------------------------------------
-- Sprawdza dostępność funkcji specjalnej Wow'a: GetQuestID()
function DetectEmuServer()
QTR_PS["isGetQuestID"] = "0";
isGetQuestID = "0";
-- funkcja GetQuestID() występuje tylko na serwerach Blizzarda
if (GetQuestID()) then
QTR_PS["isGetQuestID"] = "1";
isGetQuestID = "1";
end
end
-------------------------------------------------------------------------------------------------------
-- Obsługa komend slash
function QTR_SlashCommand(msg)
if (msg == "on" or msg == "ON" or msg == "1") then
if (QTR_PS["active"] == "1") then
print("QTR - translations are enabled.");
else
print("|cffffff00QTR - I turn on quest translations.");
QTR_PS["active"] = "1";
QTR_ToggleButton0:Enable();
QTR_ToggleButton1:Enable();
QTR_ToggleButton2:Enable();
QTR_Translate_On(1);
end
elseif (msg == "off" or msg == "OFF" or msg == "0") then
if (QTR_PS["active"] == "0") then
print("QTR - translations are disabled.");
else
print("|cffffff00QTR - I turn off quest translations.");
QTR_PS["active"] = "0";
QTR_ToggleButton0:Disable();
QTR_ToggleButton1:Disable();
QTR_ToggleButton2:Disable();
QTR_Translate_Off(1);
end
elseif (msg == "title on" or msg == "TITLE ON" or msg == "title 1") then
if (QTR_PS["transtilte"] == "1") then
print("QTR - translation of quest titles is enabled.");
else
print("|cffffff00QTR - I turn on quest title translations.");
QTR_PS["transtitle"] = "1";
QuestInfoTitleHeader:SetFont(QTR_Font1, 18);
end
elseif (msg == "title off" or msg == "TITLE OFF" or msg == "title 0") then
if (QTR_PS["transtilte"] == "0") then
print("QTR - translation of quest titles is disabled.");
else
print("|cffffff00QTR - I turn off quest title translations.");
QTR_PS["transtitle"] = "0";
QuestInfoTitleHeader:SetFont(Original_Font1, 18);
end
elseif (msg == "title" or msg == "TITLE") then
if (QTR_PS["transtilte"] == "1") then
print("QTR - translation of quest titles is enabled.");
else
print("QTR - translation of quest titles is disabled.");
end
elseif (msg == "") then
Settings.OpenToCategory("WoWinArabic-Quests");
else
print("QTR - addon's quick commands:");
print(" /qtr on|1 - turn on the quest transtalions");
print(" /qtr off|0 - turn off the quest translations");
print(" /qtr title on|1 - turn on the quest title translations");
print(" /qtr title off|0 - turn off the quest title translations");
end
end
-------------------------------------------------------------------------------------------------------
function QTR_SetCheckButtonState()
QTRCheckButton0:SetValue(QTR_PS["active"] == "1");
QTRCheckButton3:SetValue(QTR_PS["transtitle"] == "1");
QTRCheckButton5:SetValue(QTR_PS["transfixed"] == "1");
QTRCheckButton7:SetValue(QTR_PS["gossipON"] == "1");
end
-------------------------------------------------------------------------------------------------------
function QTR_BlizzardOptions()
-- Create main frame for information text
local QTROptions = CreateFrame("FRAME", "WoWinArabic_Quests_Options");
QTROptions.name = "WoWinArabic-Quests";
QTROptions.refresh = function(self) QTR_SetCheckButtonState() end;
InterfaceOptions_AddCategory(QTROptions);
local QTROptionsHeader = QTROptions:CreateFontString(nil, "ARTWORK");
QTROptionsHeader:SetFontObject(GameFontNormalLarge);
QTROptionsHeader:SetJustifyH("LEFT");
QTROptionsHeader:SetJustifyV("TOP");
QTROptionsHeader:ClearAllPoints();
QTROptionsHeader:SetPoint("TOPLEFT", 120, -16);
QTROptionsHeader:SetText("2023 ﺔﻨﺴﻟ Platine ﺭﻮﻄﻤﻟﺍ" ..
" (" .. QTR_base .. ") " .. QTR_version .. " ﺔﺨﺴﻧ WoWinArabic-Quests ﺔﻓﺎﺿﺇ");
QTROptionsHeader:SetFont(QTR_Font2, 16);
local QTRDateOfBase = QTROptions:CreateFontString(nil, "ARTWORK");
QTRDateOfBase:SetFontObject(GameFontNormalLarge);
QTRDateOfBase:SetJustifyH("LEFT");
QTRDateOfBase:SetJustifyV("TOP");
QTRDateOfBase:ClearAllPoints();
QTRDateOfBase:SetPoint("TOPRIGHT", QTROptionsHeader, "TOPRIGHT", 0, -22);
QTRDateOfBase:SetText("DragonArab :ﺔﻴﺑﺮﻌﻟﺍ ﺔﻐﻠﻟﺍ ﻞﻴﻜﺸﺗ ﺭﻮﻄﻣ " .. QTR_date .. " : ﺔﻤﺟﺮﺘﻟﺍ ﺕﺎﻧﺎﻴﺑ ﺓﺪﻋﺎﻗ ﺦﻳﺭﺎﺗ");
QTRDateOfBase:SetFont(QTR_Font2, 16);
local QTRCheckButton0 = CreateFrame("CheckButton", "QTRCheckButton0", QTROptions, "SettingsCheckBoxControlTemplate");
QTRCheckButton0.CheckBox:SetScript("OnClick",
function(self) if (QTR_PS["active"] == "1") then QTR_PS["active"] = "0" else QTR_PS["active"] = "1" end; end);
QTRCheckButton0.CheckBox:SetPoint("TOPLEFT", QTRDateOfBase, "BOTTOMLEFT", 456, -50); -- pozycja przycisku CheckBox
QTRCheckButton0:SetPoint("TOPRIGHT", QTRDateOfBase, "BOTTOMRIGHT", 48, -52); -- pozycja opisu przycisku CheckBox
QTRCheckButton0.Text:SetFont(QTR_Font2, 18);
QTRCheckButton0.Text:SetText(AS_UTF8reverse(QTR_Interface.active)); -- Aktywuj dodatek
QTRCheckButton0.Text:SetJustifyH("RIGHT");
local QTROptionsMode1 = QTROptions:CreateFontString(nil, "ARTWORK");
QTROptionsMode1:SetFontObject(GameFontWhite);
QTROptionsMode1:SetJustifyH("RIGHT");
QTROptionsMode1:SetJustifyV("TOP");
QTROptionsMode1:ClearAllPoints();
QTROptionsMode1:SetPoint("TOPRIGHT", QTRDateOfBase, "BOTTOMRIGHT", -10, -120);
QTROptionsMode1:SetFont(QTR_Font2, 18);
QTROptionsMode1:SetText(":" .. AS_UTF8reverse(QTR_Interface.settings)); -- Ustawienia dodatku
local QTRCheckButton3 = CreateFrame("CheckButton", "QTRCheckButton3", QTROptions, "SettingsCheckBoxControlTemplate");
QTRCheckButton3.CheckBox:SetScript("OnClick",
function(self) if (QTR_PS["transtitle"] == "0") then QTR_PS["transtitle"] = "1" else QTR_PS["transtitle"] = "0" end; end);
QTRCheckButton3.CheckBox:SetPoint("TOPLEFT", QTRDateOfBase, "BOTTOMLEFT", 456, -160);
QTRCheckButton3:SetPoint("TOPRIGHT", QTRDateOfBase, "BOTTOMRIGHT", 100, -162);
QTRCheckButton3.Text:SetFont(QTR_Font2, 18);
QTRCheckButton3.Text:SetText(AS_UTF8reverse(QTR_Interface.transtitle)); -- Przetłumacz tytuł questu
QTRCheckButton3.Text:SetJustifyH("RIGHT");
local QTRCheckButton5 = CreateFrame("CheckButton", "QTRCheckButton5", QTROptions, "SettingsCheckBoxControlTemplate");
QTRCheckButton5.CheckBox:SetScript("OnClick",
function(self) if (QTR_PS["transfixed"] == "1") then QTR_PS["transfixed"] = "0" else QTR_PS["transfixed"] = "1" end; end);
QTRCheckButton5.CheckBox:SetPoint("TOPLEFT", QTRCheckButton3.CheckBox, "BOTTOMLEFT", 0, -10);
QTRCheckButton5:SetPoint("TOPRIGHT", QTRCheckButton3.CheckBox, "BOTTOMRIGHT", 75, -12);
QTRCheckButton5.Text:SetFont(QTR_Font2, 18);
QTRCheckButton5.Text:SetText(AS_UTF8reverse(QTR_Interface.transfixed)); -- Przetłumacz stałe elementy zadań: Objectives, Rewards
QTRCheckButton5.Text:SetJustifyH("RIGHT");
local QTRCheckButton7 = CreateFrame("CheckButton", "QTRCheckButton7", QTROptions, "SettingsCheckBoxControlTemplate");
QTRCheckButton7.CheckBox:SetScript("OnClick",
function(self) if (QTR_PS["gossipON"] == "1") then QTR_PS["gossipON"] = "0" else QTR_PS["gossipON"] = "1" end; end);
QTRCheckButton7.CheckBox:SetPoint("TOPLEFT", QTRCheckButton5.CheckBox, "BOTTOMLEFT", 0, -10);
QTRCheckButton7:SetPoint("TOPRIGHT", QTRCheckButton5.CheckBox, "BOTTOMRIGHT", 5, -12);
QTRCheckButton7.Text:SetFont(QTR_Font2, 18);
QTRCheckButton7.Text:SetText(AS_UTF8reverse(QTR_Interface.gossipON)); -- Włącz tłumaczenie tekstów gossip
QTRCheckButton7.Text:SetJustifyH("RIGHT");
local QTRText0 = QTROptions:CreateFontString(nil, "ARTWORK");
QTRText0:SetFontObject(GameFontWhite);
QTRText0:SetJustifyH("LEFT");
QTRText0:SetJustifyV("TOP");
QTRText0:ClearAllPoints();
QTRText0:SetPoint("BOTTOMLEFT", 16, 120);
QTRText0:SetFont(QTR_Font2, 13);
QTRText0:SetText("Quick commands from the chat line:");
local QTRText7 = QTROptions:CreateFontString(nil, "ARTWORK");
QTRText7:SetFontObject(GameFontWhite);
QTRText7:SetJustifyH("LEFT");
QTRText7:SetJustifyV("TOP");
QTRText7:ClearAllPoints();
QTRText7:SetPoint("TOPLEFT", QTRText0, "BOTTOMLEFT", 0, -10);
QTRText7:SetFont(QTR_Font2, 13);
QTRText7:SetText("/qtr to bring up this addon settings window");
local QTRText1 = QTROptions:CreateFontString(nil, "ARTWORK");
QTRText1:SetFontObject(GameFontWhite);
QTRText1:SetJustifyH("LEFT");
QTRText1:SetJustifyV("TOP");
QTRText1:ClearAllPoints();
QTRText1:SetPoint("TOPLEFT", QTRText7, "BOTTOMLEFT", 0, -10);
QTRText1:SetFont(QTR_Font2, 13);
QTRText1:SetText("/qtr 1 or /qtr on to activate the addon");
local QTRText2 = QTROptions:CreateFontString(nil, "ARTWORK");
QTRText2:SetFontObject(GameFontWhite);
QTRText2:SetJustifyH("LEFT");
QTRText2:SetJustifyV("TOP");
QTRText2:ClearAllPoints();
QTRText2:SetPoint("TOPLEFT", QTRText1, "BOTTOMLEFT", 0, -4);
QTRText2:SetFont(QTR_Font2, 13);
QTRText2:SetText("/qtr 0 or /qtr off to deactivate the addon");
local QTRText3 = QTROptions:CreateFontString(nil, "ARTWORK");
QTRText3:SetFontObject(GameFontWhite);
QTRText3:SetJustifyH("LEFT");
QTRText3:SetJustifyV("TOP");
QTRText3:ClearAllPoints();
QTRText3:SetPoint("TOPLEFT", QTRText2, "BOTTOMLEFT", 0, -4);
QTRText3:SetFont(QTR_Font2, 13);
QTRText3:SetText("/qtr title 1 or /qtr title on to activate translation of titles");
local QTRText4 = QTROptions:CreateFontString(nil, "ARTWORK");
QTRText4:SetFontObject(GameFontWhite);
QTRText4:SetJustifyH("LEFT");
QTRText4:SetJustifyV("TOP");
QTRText4:ClearAllPoints();
QTRText4:SetPoint("TOPLEFT", QTRText3, "BOTTOMLEFT", 0, -4);
QTRText4:SetFont(QTR_Font2, 13);
QTRText4:SetText("/qtr title 0 or /qtr title off to deactivate translation of titles");
end
-------------------------------------------------------------------------------------------------------
function QTR_wait(delay, func, ...)
if (type(delay) ~= "number" or type(func) ~= "function") then
return false;
end
if (QTR_waitFrame == nil) then
QTR_waitFrame = CreateFrame("Frame", "QTR_WaitFrame", UIParent);
QTR_waitFrame:SetScript("onUpdate", function(self, elapse)
local count = #QTR_waitTable;
local i = 1;
while (i <= count) do
local waitRecord = tremove(QTR_waitTable, i);
local d = tremove(waitRecord, 1);
local f = tremove(waitRecord, 1);
local p = tremove(waitRecord, 1);
if (d > elapse) then
tinsert(QTR_waitTable, i, { d - elapse, f, p });
i = i + 1;
else
count = count - 1;
f(unpack(p));
end
end
end);
end
tinsert(QTR_waitTable, { delay, func, { ... } });
return true;
end
-------------------------------------------------------------------------------------------------------
function QTR_ON_OFF()
if (curr_trans == "1") then
curr_trans = "0";
QTR_Translate_Off(1);
else
curr_trans = "1";
QTR_Translate_On(1);
end
end
-------------------------------------------------------------------------------------------------------
-- Pierwsza funkcja wywoływana po załadowaniu dodatku
function QTR_START()
-- przycisk z nr ID questu w QuestFrame (NPC)
QTR_ToggleButton0 = CreateFrame("Button", nil, QuestFrame, "UIPanelButtonTemplate");
QTR_ToggleButton0:SetWidth(150);
QTR_ToggleButton0:SetHeight(20);
QTR_ToggleButton0:SetText("Quest ID=?");
QTR_ToggleButton0:Show();
QTR_ToggleButton0:ClearAllPoints();
QTR_ToggleButton0:SetPoint("TOPLEFT", QuestFrame, "TOPLEFT", 105, -32);
QTR_ToggleButton0:SetScript("OnClick", QTR_ON_OFF);
-- przycisk z nr ID questu w QuestLogPopupDetailFrame
QTR_ToggleButton1 = CreateFrame("Button", nil, QuestLogPopupDetailFrame, "UIPanelButtonTemplate");
QTR_ToggleButton1:SetWidth(150);
QTR_ToggleButton1:SetHeight(20);
QTR_ToggleButton1:SetText("Quest ID=?");
QTR_ToggleButton1:Show();
QTR_ToggleButton1:ClearAllPoints();
QTR_ToggleButton1:SetPoint("TOPLEFT", QuestLogPopupDetailFrame, "TOPLEFT", 45, -31);
QTR_ToggleButton1:SetScript("OnClick", QTR_ON_OFF);
-- przycisk z nr ID questu w QuestMapDetailsScrollFrame
QTR_ToggleButton2 = CreateFrame("Button", nil, QuestMapDetailsScrollFrame, "UIPanelButtonTemplate");
QTR_ToggleButton2:SetWidth(150);
QTR_ToggleButton2:SetHeight(20);
QTR_ToggleButton2:SetText("Quest ID=?");
QTR_ToggleButton2:Show();
QTR_ToggleButton2:ClearAllPoints();
QTR_ToggleButton2:SetPoint("TOPLEFT", QuestMapDetailsScrollFrame, "TOPLEFT", 116, 29);
QTR_ToggleButton2:SetScript("OnClick", QTR_ON_OFF);
-- przycisk z nr HASH gossip w GossipFrame
QTR_ToggleButtonGS1 = CreateFrame("Button", nil, GossipFrame, "UIPanelButtonTemplate");
QTR_ToggleButtonGS1:SetWidth(220);
QTR_ToggleButtonGS1:SetHeight(20);
QTR_ToggleButtonGS1:SetText("Gossip-Hash=?");
QTR_ToggleButtonGS1:ClearAllPoints();
QTR_ToggleButtonGS1:SetPoint("TOPLEFT", GossipFrame, "TOPLEFT", 75, -20);
QTR_ToggleButtonGS1:Disable();
QTR_ToggleButtonGS1:Show();
QTR_ToggleButtonGS1:SetScript("OnClick", GS_ON_OFF);
-- funkcja wywoływana po wyświetleniu się obiektu GreetingText w oknie QuestFrame
QuestFrame:SetScript("OnShow", GossipOnQuestFrame);
WorldMapFrame:HookScript("OnShow", function()
if (not QTR_wait(0.2, QTR_QuestScrollFrame_OnShow)) then
-- opóźnienie 0.2 sek
end
end);
-- funkcja wywoływana po kliknięciu na nazwę questu w QuestMapFrame
hooksecurefunc("QuestMapFrame_ShowQuestDetails", QTR_PrepareReload);
-- funkcja wywoływana po wyświetleniu się obiektu GreetingText w oknie QuestFrame
QuestFrameAcceptButton:HookScript("OnClick", QTR_QuestFrameButton_OnClick);
QuestFrameCompleteQuestButton:HookScript("OnClick", QTR_QuestFrameButton_OnClick);
QuestLogPopupDetailFrame:HookScript("OnShow", QTR_QuestLogPopupShow);
end
-------------------------------------------------------------------------------------------------------
function QTR_QuestLogPopupShow()
if (QuestLogPopupDetailFrame:IsVisible()) then
QTR_QuestPrepare("QUEST_DETAIL");
end
end
-------------------------------------------------------------------------------------------------------
-- Kolejny quest w otwartym już oknie QuestFrame?
function QTR_QuestFrameButton_OnClick()
if (not QTR_wait(0.5, QTR_QuestFrameWithoutOpenQuestFrame)) then
-- opóźnienie 0.5 sek
end
end
-------------------------------------------------------------------------------------------------------
function Spr_Gender(msg) -- miało być używane w QTR_Messages.itemchoose1 - na razie wyłączone
local nr_1, nr_2, nr_3 = 0;
local QTR_forma = "";
local licznik = 0;
local nr_poz = string.find(msg, "YOUR_GENDER"); -- gdy nie znalazł - jest: nil; liczy od 1
while (nr_poz and nr_poz > 0) do
nr_1 = nr_poz + 1;
if (string.sub(msg, nr_1, nr_1) ~= "(") then -- szukaj nawiasu otwierającego, 1 spacja są dopuszczalna
nr_1 = nr_1 + 1;
end
if (string.sub(msg, nr_1, nr_1) == "(") then
nr_2 = nr_1 + 1;
licznik = 0;
while (string.sub(msg, nr_2, nr_2) ~= ";") do -- szukaj średnika oddzielającego
licznik = licznik + 1;
if (licznik > 50) then
break;
else
nr_2 = nr_2 + 1;
end
end
if (string.sub(msg, nr_2, nr_2) == ";") then
nr_3 = nr_2 + 1;
licznik = 0;
while (string.sub(msg, nr_3, nr_3) ~= ")") do -- szukaj nawiasu zamykającego
if (licznik > 50) then
break;
else
nr_3 = nr_3 + 1;
end
end
if (string.sub(msg, nr_3, nr_3) == ")") then
if (QTR_sex == 3) then -- forma żeńska
QTR_forma = string.sub(msg, nr_2 + 1, nr_3 - 1);
else -- forma męska
QTR_forma = string.sub(msg, nr_1 + 1, nr_2 - 1);
end
msg = string.sub(msg, 1, nr_poz - 1) .. QTR_forma .. string.sub(msg, nr_3 + 1);
else -- niewłaściwa składnia kodu
msg = string.gsub(msg, "YOUR_GENDER", "G$");
end
else -- niewłaściwa składnia kodu
msg = string.gsub(msg, "YOUR_GENDER", "G$");
end
else -- niewłaściwa składnia kodu
msg = string.gsub(msg, "YOUR_GENDER", "G$");
end
nr_poz = string.find(msg, "YOUR_GENDER");
end
return msg;
end
-------------------------------------------------------------------------------------------------------
function QTR_SaveQuest(event)
if (event == "QUEST_DETAIL") then
QTR_SAVED[QTR_quest_ID .. " TITLE"] = GetTitleText(); -- save original title to future translation
QTR_SAVED[QTR_quest_ID .. " DESCRIPTION"] = GetQuestText(); -- save original text to future translation
QTR_SAVED[QTR_quest_ID .. " OBJECTIVE"] = GetObjectiveText(); -- save original text to future translation
local QTR_mapID = C_Map.GetBestMapForUnit("player");
if (QTR_mapID) then
local QTR_mapINFO = C_Map.GetMapInfo(QTR_mapID);
QTR_SAVED[QTR_quest_ID .. " MAPID"] = QTR_mapID ..
"@" .. QTR_mapINFO.name .. "@" .. QTR_mapINFO.mapType .. "@" .. QTR_mapINFO.parentMapID; -- save mapID to locale place of this quest
end
end
if (event == "QUEST_PROGRESS") then
QTR_SAVED[QTR_quest_ID .. " PROGRESS"] = GetProgressText(); -- save original text to future translation
end
if (event == "QUEST_COMPLETE") then
QTR_SAVED[QTR_quest_ID .. " COMPLETE"] = GetRewardText(); -- save original text to future translation
end
if (QTR_SAVED[QTR_quest_ID .. " TITLE"] == nil) then
QTR_SAVED[QTR_quest_ID .. " TITLE"] = GetTitleText(); -- zapisz tytuł w przypadku tylko Zakończenia
end
QTR_SAVED[QTR_quest_ID .. " PLAYER"] = QTR_name .. '@' .. QTR_race .. '@' .. QTR_class; -- zapisz dane gracza
end
-------------------------------------------------------------------------------------------------------
-- Określa aktualny numer ID questu z różnych metod
function QTR_GetQuestID()
local quest_ID;
if (QuestFrame:IsVisible() and (isGetQuestID == "1")) then
quest_ID = GetQuestID();
end
if (QuestMapDetailsScrollFrame:IsVisible() and ((quest_ID == nil) or (quest_ID == 0))) then
quest_ID = QuestMapFrame.DetailsFrame.questID;
end
if (QuestLogPopupDetailFrame:IsVisible() and ((quest_ID == nil) or (quest_ID == 0))) then
quest_ID = QuestLogPopupDetailFrame.questID;
end
if (quest_ID == nil) then
quest_ID = 0;
end
return (quest_ID);
end
-------------------------------------------------------------------------------------------------------
-- Wywoływane przy przechwytywanych zdarzeniach
function QTR_OnEvent(self, event, name, ...)
if (event == "ADDON_LOADED" and name == "WoWinArabic_Quests") then
QTR_f:UnregisterEvent("ADDON_LOADED");
local _fontC, _sizeC, _C = DEFAULT_CHAT_FRAME:GetFont(); -- odczytaj aktualną czcionkę, rozmiar i typ
DEFAULT_CHAT_FRAME:SetFont(QTR_Font2, _sizeC, _C);
QTR_START();
SlashCmdList["WOWINARABIC_QUESTS"] = function(msg) QTR_SlashCommand(msg); end
SLASH_WOWINARABIC_QUESTS1 = "/wowinarabic-quests";
SLASH_WOWINARABIC_QUESTS2 = "/qtr";
QTR_CheckVars();
-- twórz interface Options w Blizzard-Interface-Addons
QTR_BlizzardOptions();
print("|cffffff00WoWinArabic-Quests ver. " .. QTR_version .. " - " .. QTR_Messages.started);
QTR_f.ADDON_LOADED = nil;
-- QTR_Messages.itemchoose1 = Spr_Gender(QTR_Messages.itemchoose1);
if (not isGetQuestID) then
DetectEmuServer();
end
elseif (event == "QUEST_DETAIL" or event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE") then
if (QuestFrame:IsVisible()) then
QTR_QuestPrepare(event);
end -- QuestFrame is Visible
elseif (event == "GOSSIP_SHOW") then
if (QTR_PS["gossipON"] == "1") then
if (ElvUI) then
if (not QTR_wait(0.5, QTR_Gossip_Show)) then
-- opóźnienie 0.5 sek
end
else
QTR_Gossip_Show();
end
end
end
end
-------------------------------------------------------------------------------------------------------
-- Otworzono okienko QuestLogPopupDetailFrame lub QuestMapDetailsScrollFrame
function QTR_QuestPrepare(zdarzenie)
q_ID = QTR_GetQuestID(); -- uzyskaj aktualne ID questu
if (q_ID == 0) then
return
end
QTR_quest_ID = q_ID;
str_ID = tostring(q_ID);
if (not (QTR_quest_EN[QTR_quest_ID])) then
QTR_quest_EN[QTR_quest_ID] = {};
QTR_quest_LG[QTR_quest_ID] = {};
end
if (QTR_PS["active"] == "1") then -- tłumaczenia włączone
QTR_ToggleButton0:Enable(); -- przycisk w ramce QuestFrame (NPC)
QTR_ToggleButton1:Enable(); -- przycisk w ramce QuestLogPopupDetailFrame
QTR_ToggleButton2:Enable(); -- przycisk w ramce QuestMapDetailsScrollFrame
curr_trans = "1"; -- aktualnie wyświetlane jest tłumaczenie PL
if (QTR_QuestData[str_ID]) then -- wyświetlaj tylko, gdy istnieje tłumaczenie
if (QTR_quest_EN[QTR_quest_ID].title == nil) then
QTR_quest_LG[QTR_quest_ID].title = QTR_ExpandUnitInfo(QTR_QuestData[str_ID]["Title"], false);
QTR_quest_EN[QTR_quest_ID].title = GetTitleText();
if (QTR_quest_EN[QTR_quest_ID].title == "") then
QTR_quest_EN[QTR_quest_ID].title = QuestInfoTitleHeader:GetText();
end
end
if (QTR_quest_LG[QTR_quest_ID].details == nil) then
QTR_quest_LG[QTR_quest_ID].details = QTR_ExpandUnitInfo(QTR_QuestData[str_ID]["Description"], false);
QTR_quest_LG[QTR_quest_ID].objectives = QTR_ExpandUnitInfo(QTR_QuestData[str_ID]["Objectives"], false);
end
if (zdarzenie == "QUEST_DETAIL") then
if (QTR_quest_EN[QTR_quest_ID].details == nil) then
QTR_quest_EN[QTR_quest_ID].details = GetQuestText();
QTR_quest_EN[QTR_quest_ID].objectives = GetObjectiveText();
end
-- sprawdź ile jest nagród za ten quest?
quest_numReward[str_ID] = GetNumQuestChoices();
if (quest_numReward[str_ID] > 1) then
QTR_quest_EN[QTR_quest_ID].itemchoose = QTR_MessOrig.itemchoose1;
QTR_quest_LG[QTR_quest_ID].itemchoose = QTR_Messages.itemchoose1;
else
QTR_quest_EN[QTR_quest_ID].itemchoose = QTR_MessOrig.itemchoose0;
QTR_quest_LG[QTR_quest_ID].itemchoose = QTR_Messages.itemchoose0;
end
-- czy jest jeszcze kasa w nagrodę? a może jest tylko sama kasa?
if (quest_numReward[str_ID] > 0) then
QTR_quest_EN[QTR_quest_ID].itemreceive = QTR_MessOrig.itemreceiv1;
QTR_quest_LG[QTR_quest_ID].itemreceive = QTR_Messages.itemreceiv1;
else
QTR_quest_EN[QTR_quest_ID].itemreceive = QTR_MessOrig.itemreceiv0;
QTR_quest_LG[QTR_quest_ID].itemreceive = QTR_Messages.itemreceiv0;
end
else -- nie jest to zdarzenie QUEST_DETAILS
if (QTR_quest_EN[QTR_quest_ID].details == nil) then
QTR_quest_EN[QTR_quest_ID].details = QuestInfoDescriptionText:GetText();
end
if (QTR_quest_EN[QTR_quest_ID].objectives == nil) then
QTR_quest_EN[QTR_quest_ID].objectives = QuestInfoObjectivesText:GetText();
end
if (quest_numReward[str_ID] == nil) then -- mamy zapamiętaną liczbę nagród do tego questu
QTR_quest_EN[QTR_quest_ID].itemchoose = QTR_MessOrig.itemchoose0;
QTR_quest_LG[QTR_quest_ID].itemchoose = QTR_Messages.itemchoose0;
if (MapQuestInfoRewardsFrame.ItemChooseText:IsVisible()) then
QTR_quest_EN[QTR_quest_ID].itemreceive = QTR_MessOrig.itemreceiv1;
QTR_quest_LG[QTR_quest_ID].itemreceive = QTR_Messages.itemreceiv1;
else
QTR_quest_EN[QTR_quest_ID].itemreceive = QTR_MessOrig.itemreceiv0;
QTR_quest_LG[QTR_quest_ID].itemreceive = QTR_Messages.itemreceiv0;
end
else
if (quest_numReward[str_ID] > 1) then
QTR_quest_EN[QTR_quest_ID].itemchoose = QTR_MessOrig.itemchoose1;
QTR_quest_LG[QTR_quest_ID].itemchoose = QTR_Messages.itemchoose1;
else
QTR_quest_EN[QTR_quest_ID].itemchoose = QTR_MessOrig.itemchoose0;
QTR_quest_LG[QTR_quest_ID].itemchoose = QTR_Messages.itemchoose0;
end
-- czy jest jeszcze kasa w nagrodę? a może jest tylko sama kasa?
if (quest_numReward[str_ID] > 0) then
QTR_quest_EN[QTR_quest_ID].itemreceive = QTR_MessOrig.itemreceiv1;
QTR_quest_LG[QTR_quest_ID].itemreceive = QTR_Messages.itemreceiv1;
else
QTR_quest_EN[QTR_quest_ID].itemreceive = QTR_MessOrig.itemreceiv0;
QTR_quest_LG[QTR_quest_ID].itemreceive = QTR_Messages.itemreceiv0;
end
end
end
if (zdarzenie == "QUEST_PROGRESS") then
if (QTR_quest_EN[QTR_quest_ID].progress == nil) then
QTR_quest_EN[QTR_quest_ID].progress = GetProgressText();
QTR_quest_LG[QTR_quest_ID].progress = QTR_ExpandUnitInfo(QTR_QuestData[str_ID]["Progress"], false);
end
if (strlen(QTR_quest_LG[QTR_quest_ID].progress) == 0) then -- treść jest pusta, a otworzono okienko Progress
QTR_quest_LG[QTR_quest_ID].progress = QTR_ExpandUnitInfo('YOUR_NAME أنت بخير يا', false);
end
end
if (zdarzenie == "QUEST_COMPLETE") then
if (QTR_quest_EN[QTR_quest_ID].completion == nil) then
QTR_quest_EN[QTR_quest_ID].completion = GetRewardText();
QTR_quest_LG[QTR_quest_ID].completion = QTR_ExpandUnitInfo(QTR_QuestData[str_ID]["Completion"], false);
end
-- sprawdź ile jest nagród za ten quest?
if (quest_numReward[str_ID] == nil) then
quest_numReward[str_ID] = GetNumQuestChoices();
end
if (quest_numReward[str_ID] > 1) then
QTR_quest_EN[QTR_quest_ID].itemchoose = QTR_MessOrig.itemchoose2;
QTR_quest_LG[QTR_quest_ID].itemchoose = QTR_Messages.itemchoose2;
else
QTR_quest_EN[QTR_quest_ID].itemchoose = QTR_MessOrig.itemchoose3;
QTR_quest_LG[QTR_quest_ID].itemchoose = QTR_Messages.itemchoose3;
end
-- czy jest jeszcze kasa w nagrodę? a może jest tylko sama kasa?
if (quest_numReward[str_ID] > 0) then
QTR_quest_EN[QTR_quest_ID].itemreceive = QTR_MessOrig.itemreceiv3;
QTR_quest_LG[QTR_quest_ID].itemreceive = QTR_Messages.itemreceiv3;
else
QTR_quest_EN[QTR_quest_ID].itemreceive = QTR_MessOrig.itemreceiv2;
QTR_quest_LG[QTR_quest_ID].itemreceive = QTR_Messages.itemreceiv2;
end
end
QTR_ToggleButton0:SetText("Quest ID=" .. QTR_quest_ID .. " (" .. QTR_lang .. ")");
QTR_ToggleButton1:SetText("Quest ID=" .. QTR_quest_ID .. " (" .. QTR_lang .. ")");
QTR_ToggleButton2:SetText("Quest ID=" .. QTR_quest_ID .. " (" .. QTR_lang .. ")");
QTR_Translate_On(1);
if (QTR_first_show == 0) then -- pierwsze wyświetlenie, daj opóźnienie i przełączaj, bo nie wyświetla danych stałych
if (not QTR_wait(0.2, QTR_ON_OFF)) then -- przeładuj wpierw na OFF
---
end
if (not QTR_wait(0.2, QTR_ON_OFF)) then -- przeładuj ponownie na ON
---
end
QTR_first_show = 1;
end
else -- nie ma przetłumaczonego takiego questu
QTR_ToggleButton0:Disable(); -- przycisk w ramce QuestFrame (NPC)
QTR_ToggleButton1:Disable(); -- przycisk w ramce QuestLogPopupDetailFrame
QTR_ToggleButton2:Disable(); -- przycisk w ramce QuestMapDetailsScrollFrame
QTR_ToggleButton0:SetText("Quest ID=" .. str_ID);
QTR_ToggleButton1:SetText("Quest ID=" .. str_ID);
QTR_ToggleButton2:SetText("Quest ID=" .. str_ID);
QTR_Translate_On(0);
QTR_SaveQuest(zdarzenie);
end -- jest przetłumaczony quest w bazie
else -- tłumaczenia wyłączone
QTR_ToggleButton0:Disable(); -- przycisk w ramce QuestFrame (NPC)
QTR_ToggleButton1:Disable(); -- przycisk w ramce QuestLogPopupDetailFrame
QTR_ToggleButton2:Disable(); -- przycisk w ramce QuestMapDetailsScrollFrame
if (QTR_QuestData[str_ID]) then -- ale jest tłumaczenie w bazie
QTR_ToggleButton1:SetText("Quest ID=" .. str_ID .. " (EN)");
QTR_ToggleButton2:SetText("Quest ID=" .. str_ID .. " (EN)");
else
QTR_ToggleButton1:SetText("Quest ID=" .. str_ID);
QTR_ToggleButton2:SetText("Quest ID=" .. str_ID);
end
end -- tłumaczenia są włączone
end
-------------------------------------------------------------------------------------------------------
-- wyświetla tłumaczenie
function QTR_Translate_On(typ)
if (QTR_PS["transfixed"] == "1") then
QTR_display_constants(1);
end
-- if (QuestNPCModelText:IsVisible() and (QTR_ModelTextHash>0)) then -- jest wyświetlony tekst QuestNPCModelText
-- QuestNPCModelText:SetFont(QTR_Font2, 13);
-- QuestNPCModelText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
-- QuestNPCModelText:SetText(QTR_LineReverse(QTR_ModelText_PL,QTR_limit3)); -- tłumaczenie z bazy Gossip
-- end
if (typ == 1) then -- pełne przełączenie (jest tłumaczenie)
-- Set vertical justification for all text elements
QuestInfoTitleHeader:SetJustifyV("TOP");
QuestProgressTitleText:SetJustifyV("TOP");
QuestInfoDescriptionText:SetJustifyV("TOP");
QuestInfoObjectivesText:SetJustifyV("TOP");
QuestProgressText:SetJustifyV("TOP");
QuestInfoRewardText:SetJustifyV("TOP");
local numer_ID = QTR_quest_ID;
str_ID = tostring(numer_ID);
if (numer_ID > 0 and QTR_QuestData[str_ID]) then -- przywróć przetłumaczoną wersję napisów
QTR_ToggleButton0:SetText("Quest ID=" .. QTR_quest_ID .. " (" .. QTR_lang .. ")");
QTR_ToggleButton1:SetText("Quest ID=" .. QTR_quest_ID .. " (" .. QTR_lang .. ")");
QTR_ToggleButton2:SetText("Quest ID=" .. QTR_quest_ID .. " (" .. QTR_lang .. ")");
if ((QTR_PS["transtitle"] == "1") and QTR_quest_LG[QTR_quest_ID].title) then
if (WorldMapFrame:IsVisible()) then
QuestInfoTitleHeader:SetWidth(246);
QuestProgressTitleText:SetWidth(246);
QuestInfoObjectivesText:SetWidth(246);
else
QuestInfoTitleHeader:SetWidth(276);
QuestProgressTitleText:SetWidth(276);
QuestInfoObjectivesText:SetWidth(268);
end
QuestInfoTitleHeader:SetFont(QTR_Font1, 18);
QuestInfoTitleHeader:SetJustifyH("RIGHT"); -- wyrównanie od prawego
QuestInfoTitleHeader:SetText(AS_UTF8reverse(QTR_quest_LG[QTR_quest_ID].title));
QuestProgressTitleText:SetFont(QTR_Font1, 15);
QuestProgressTitleText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
QuestProgressTitleText:SetText(AS_UTF8reverse(QTR_quest_LG[QTR_quest_ID].title));
end
local QTR_limit12 = 50;
if (WorldMapFrame:IsVisible()) then
QTR_limit12 = QTR_limit2;
else
QTR_limit12 = QTR_limit1;
end
QuestInfoDescriptionText:SetFont(QTR_Font2, 14);
if (QTR_quest_LG[QTR_quest_ID].details) then
QuestInfoDescriptionText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
QuestInfoDescriptionText:SetText(QTR_LineReverse(QTR_quest_LG[QTR_quest_ID].details, QTR_limit12));
else
QuestInfoDescriptionText:SetText(QTR_Messages.missing);
end
QuestInfoObjectivesText:SetFont(QTR_Font2, 14);
if (QTR_quest_LG[QTR_quest_ID].objectives) then
QuestInfoObjectivesText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
QuestInfoObjectivesText:SetText(QTR_LineReverse(QTR_quest_LG[QTR_quest_ID].objectives, QTR_limit12));
else
QuestInfoObjectivesText:SetText(QTR_Messages.missing);
end
QuestProgressText:SetFont(QTR_Font2, 14);
if (QTR_quest_LG[QTR_quest_ID].progress) then
QuestProgressText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
QuestProgressText:SetText(QTR_LineReverse(QTR_quest_LG[QTR_quest_ID].progress, QTR_limit12));
else
-- QuestProgressText:SetJustifyH("LEFT"); -- wyrównanie od lewego
QuestProgressText:SetText(QTR_Messages.missing);
end
QuestInfoRewardText:SetWidth(276);
QuestInfoRewardText:SetFont(QTR_Font2, 14);
if (QTR_quest_LG[QTR_quest_ID].completion) then
QuestInfoRewardText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
QuestInfoRewardText:SetText(QTR_LineReverse(QTR_quest_LG[QTR_quest_ID].completion, QTR_limit12));
else
QuestInfoRewardText:SetText(QTR_Messages.missing);
end
end
if ((QuestInfoDescriptionText ~= QTR_quest_LG[QTR_quest_ID].details) and (QTR_first_show2 == 0)) then -- nie wczytały się tłumaczenia
QTR_first_show2 = 1;
if (not QTR_wait(0.2, QTR_ON_OFF)) then -- przeładuj wpierw na OFF
---
end
if (not QTR_wait(0.2, QTR_ON_OFF)) then -- przeładuj ponownie na ON
---
end
end
end
end
-------------------------------------------------------------------------------------------------------
-- wyświetla oryginalny tekst angielski
function QTR_Translate_Off(typ)
if (QTR_PS["transfixed"] == "1") then
QTR_display_constants(0);
end
-- if (QuestNPCModelText:IsVisible() and (QTR_ModelTextHash>0)) then -- jest wyświetlony tekst QuestNPCModelText
-- QuestNPCModelText:SetFont(Original_Font2, 13);
-- QuestNPCModelText:SetJustifyH("LEFT"); -- wyrównanie od lewego
-- QuestNPCModelText:SetText(QTR_ModelText_EN);
-- end
if (typ == 1) then -- pełne przełączenie (jest tłumaczenie)
local numer_ID = QTR_quest_ID;
str_ID = tostring(numer_ID);
if (numer_ID > 0 and QTR_QuestData[str_ID]) then -- przywróć oryginalną wersję napisów
QTR_ToggleButton0:SetText("Quest ID=" .. QTR_quest_ID .. " (EN)");
QTR_ToggleButton1:SetText("Quest ID=" .. QTR_quest_ID .. " (EN)");
QTR_ToggleButton2:SetText("Quest ID=" .. QTR_quest_ID .. " (EN)");
QuestInfoTitleHeader:SetFont(Original_Font1, 18);
QuestInfoTitleHeader:SetJustifyH("LEFT"); -- wyrównanie od lewego
QuestInfoTitleHeader:SetText(QTR_quest_EN[QTR_quest_ID].title);
QuestProgressTitleText:SetFont(Original_Font1, 18);
QuestProgressTitleText:SetJustifyH("LEFT"); -- wyrównanie od lewego
QuestProgressTitleText:SetText(QTR_quest_EN[QTR_quest_ID].title);
QuestInfoDescriptionText:SetFont(Original_Font2, 13);
QuestInfoDescriptionText:SetJustifyH("LEFT"); -- wyrównanie od lewego
QuestInfoDescriptionText:SetText(QTR_quest_EN[QTR_quest_ID].details);
QuestInfoObjectivesText:SetFont(Original_Font2, 13);
QuestInfoObjectivesText:SetJustifyH("LEFT"); -- wyrównanie od lewego
QuestInfoObjectivesText:SetText(QTR_quest_EN[QTR_quest_ID].objectives);
QuestProgressText:SetFont(Original_Font2, 13);
QuestProgressText:SetJustifyH("LEFT"); -- wyrównanie od lewego
QuestProgressText:SetText(QTR_quest_EN[QTR_quest_ID].progress);
QuestInfoRewardText:SetFont(Original_Font2, 13);
QuestInfoRewardText:SetJustifyH("LEFT"); -- wyrównanie od lewego
QuestInfoRewardText:SetText(QTR_quest_EN[QTR_quest_ID].completion);
end
end
end
-------------------------------------------------------------------------------------------------------
function QTR_display_constants(lg)
if (lg == 1) then -- dane stałe po arabsku
QuestInfoObjectivesHeader:SetFont(QTR_Font1, 18);
QuestInfoObjectivesHeader:SetWidth(270);
QuestInfoObjectivesHeader:SetJustifyH("RIGHT"); -- wyrównanie do prawego
QuestInfoObjectivesHeader:SetText(AS_UTF8reverse(QTR_Messages.objectives));
QuestInfoRewardsFrame.Header:SetFont(QTR_Font1, 18);
QuestInfoRewardsFrame.Header:SetWidth(270);
QuestInfoRewardsFrame.Header:SetJustifyH("RIGHT"); -- wyrównanie do prawego
QuestInfoRewardsFrame.Header:SetText(AS_UTF8reverse(QTR_Messages.rewards));
QuestInfoDescriptionHeader:SetFont(QTR_Font1, 18);
QuestInfoDescriptionHeader:SetWidth(243);
QuestInfoDescriptionHeader:SetJustifyH("RIGHT"); -- wyrównanie do prawego
QuestInfoDescriptionHeader:SetText(AS_UTF8reverse(QTR_Messages.details));
QuestProgressRequiredItemsText:SetFont(QTR_Font1, 18);
QuestProgressRequiredItemsText:SetWidth(272);
QuestProgressRequiredItemsText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
QuestProgressRequiredItemsText:SetText(AS_UTF8reverse(QTR_Messages.reqitems));
CurrentQuestsText:SetWidth(270);
CurrentQuestsText:SetFont(QTR_Font1, 18);
CurrentQuestsText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
CurrentQuestsText:SetText(AS_UTF8reverse(QTR_Messages.currquests));
AvailableQuestsText:SetWidth(270);
AvailableQuestsText:SetFont(QTR_Font1, 18);
AvailableQuestsText:SetJustifyH("RIGHT"); -- wyrównanie od prawego
AvailableQuestsText:SetText(AS_UTF8reverse(QTR_Messages.avaiquests));
local regions = { QuestMapFrame.DetailsFrame.RewardsFrame:GetRegions() };
for index = 1, #regions do
local region = regions[index];
if ((region:GetObjectType() == "FontString") and (region:GetText() == QUEST_REWARDS)) then
local _font1, _size1, _3 = region:GetFont(); -- odczytaj aktualną czcionkę i rozmiar
region:SetFont(QTR_Font1, _size1);
region:SetJustifyH("RIGHT"); -- wyrównanie od prawego
region:SetText(AS_UTF8reverse(QTR_Messages.rewards));
end
end