-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFactionizer11.lua
More file actions
1074 lines (1000 loc) · 36.3 KB
/
Factionizer11.lua
File metadata and controls
1074 lines (1000 loc) · 36.3 KB
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
-----------------------------------
-- _11_ Prepare update entries --
-----------------------------------
function FIZ_ParseBagContent()
--fpt hed f_pbc FIZ_Printtest("","","f_pbc 1")
FIZ_ItemsCarried = {}
for i = 0, NUM_BAG_SLOTS do
local num = GetContainerNumSlots(i)
for j = 1, num do
local link = GetContainerItemLink(i, j)
-- |cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0|h[Broken Fang]|h|r
if link then
local count = GetItemCount(link)
local _, _, itemString, itemName = string.find(link, "^|c%x+|H(.+)|h%[(.+)%]")
if count and itemName then
if (not FIZ_ItemsCarried[itemName]) then
FIZ_ItemsCarried[itemName] = count
end
end
end
end
end
end
function FIZ_ParseBankContent()
--fpt hed f_pBc FIZ_Printtest("","","f_pBc 1")
if (not FIZ_Data.Bank) then FIZ_Data.Bank = {} end
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player] = {}
local i = BANK_CONTAINER
local num = GetContainerNumSlots(i)
for j = 1, num do
local link = GetContainerItemLink(i, j)
-- |cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0|h[Broken Fang]|h|r
if link then
local count = GetItemCount(link)
local _, count = GetContainerItemInfo(i, j);
local _, _, itemString, itemName = string.find(link, "^|c%x+|H(.+)|h%[(.+)%]")
if count and itemName then
if (FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][itemName]) then
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][itemName] = FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][itemName] + count
else
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][itemName] = count
end
end
end
end
for i = NUM_BAG_SLOTS+NUM_BAG_SLOTS + NUM_BANKBAGSLOTS, NUM_BAG_SLOTS do
local num = GetContainerNumSlots(i)
for j = 1, num do
local link = GetContainerItemLink(i, j)
-- |cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0|h[Broken Fang]|h|r
if link then
local count = GetItemCount(link)
local _, count = GetContainerItemInfo(i, j);
local _, _, itemString, itemName = string.find(link, "^|c%x+|H(.+)|h%[(.+)%]")
if count and itemName then
if (FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][itemName]) then
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][itemName] = FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][itemName] + count
else
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][itemName] = count
end
end
end
end
end
end
function FIZ_Update_Tooltip(FIZ_Set,FIZ_Detail_1,FIZ_Detail_2)
--- fpt hed f_u_t FIZ_Printtest("","","f_u_t 1")
--- fpt ddd fiz_printtest(FIZ_Set,FIZ_Detail_1,FIZ_Detail_2)
FIZ_UpdateList[index].tooltipDetails[FIZ_Set] = {}
FIZ_UpdateList[index].tooltipDetails[FIZ_Set].l = FIZ_Detail_1
FIZ_UpdateList[index].tooltipDetails[FIZ_Set].r = FIZ_Detail_2
end
function FIZ_BuildUpdateList() --xxx
--- fpt hed f_bul FIZ_Printtest("","","f_bul 1")
FIZ_UpdateList = {}
FIZ_CurrentRepInBag = 0
FIZ_CurrentRepInBagBank = 0
FIZ_CurrentRepInQuest = 0
local index = 1
if (not FIZ_ReputationDetailFrame:IsVisible()) then
return
end
--- fpt pbc FIZ_ParseBagContent()
local factionIndex = GetSelectedFaction()
local faction, description, standingId, barMin, barMax, barValue = GetFactionInfo(factionIndex)
if (faction) then
origFaction = faction
oFaction = string.lower(faction)
faction = string.lower(faction)
if (FIZ_FactionMapping[faction]) then
faction = FIZ_FactionMapping[faction]
end
-- Normalize Values
local normMax = barMax - barMin
local normCurrent = barValue - barMin
local repToNext = barMax - barValue
if (FIZ_FactionGain[oFaction]) then
local fg_sid=FIZ_FactionGain[oFaction][standingId]
if (fg_sid) then
-- instances
if (fg_sid.instance and FIZ_Data.ShowInstances) then
local fg_sid_x=fg_sid.instance
for i = 0, fg_sid.instance.count do
local fg_sid_x_d=fg_sid_x.data[i]
if (not fg_sid_x_d.limit or (normCurrent < fg_sid_x_d.limit)) then
local toDo = string.format("%.2f", repToNext / fg_sid_x_d.rep)
if (fg_sid_x_d.limit) then
toDo = string.format("%.2f", (fg_sid_x_d.limit - normCurrent) / fg_sid_x_d.rep)
end --zzz
FIZ_UpdateList[index] = {}
local FUL_I = FIZ_UpdateList[index]
FUL_I.type = FIZ_TXT.instanceShort
FUL_I.times = toDo.."x"
FUL_I.rep = string.format("%d", fg_sid_x_d.rep)
FUL_I.hasList = false
FUL_I.listShown = nil
FUL_I.index = index
FUL_I.belongsTo = nil
FUL_I.isShown = true
FUL_I.name = fg_sid_x_d.name.." ("..fg_sid_x_d.level..")"
FUL_I.tooltipHead = FIZ_TXT.instanceHead
FUL_I.tooltipTip = FIZ_TXT.instanceTip
FUL_I.tooltipDetails = {}
local FUL_I_TD = FUL_I.tooltipDetails
local x = 0
--- ddd FIZ_Update_Tooltip(x, FIZ_TXT.instance2, fg_sid_x_d.name)
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.instance2
FUL_I_TD[x].r = fg_sid_x_d.name
x = x+1
--- ddd FIZ_Update_Tooltip(x, FIZ_TXT.mode, fg_sid_x_d.level)
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.mode
FUL_I_TD[x].r = fg_sid_x_d.level
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = FUL_I.rep
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.timesToRun
FUL_I_TD[x].r = FUL_I.times
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.maxStanding
FUL_I_TD[x].r = _G["FACTION_STANDING_LABEL"..fg_sid_x_d.maxStanding]
FUL_I_TD.count = x
FUL_I.tooltipDetails = FUL_I_TD
FIZ_UpdateList[index] = FUL_I
index = index + 1
end
end
end
-- mobs
if (fg_sid.mobs and FIZ_Data.ShowMobs) then
local fg_sid_x=fg_sid.mobs
for i = 0, fg_sid_x.count do
local fg_sid_x_d=fg_sid_x.data[i]
if (not fg_sid_x_d.limit or (normCurrent < fg_sid_x_d.limit)) then
local toDo = ceil(repToNext / fg_sid_x_d.rep)
if (fg_sid_x_d.limit) then
toDo = ceil((fg_sid_x_d.limit - normCurrent) / fg_sid_x_d.rep)
end
FIZ_UpdateList[index] = {}
local FUL_I = FIZ_UpdateList[index]
FUL_I.type = FIZ_TXT.mobShort
FUL_I.times = toDo.."x"
FUL_I.rep = string.format("%d", fg_sid_x_d.rep)
FUL_I.hasList = false
FUL_I.listShown = nil
FUL_I.index = index
FUL_I.belongsTo = nil
FUL_I.isShown = true
FUL_I.tooltipHead = FIZ_TXT.mobHead
FUL_I.tooltipTip = FIZ_TXT.mobTip
if (fg_sid_x_d.zone) then
FUL_I.name = fg_sid_x_d.name.." ("..fg_sid_x_d.zone..")"
FUL_I.tooltipDetails = {}
local FUL_I_TD = FUL_I.tooltipDetails
local x = 0
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.mob2
FUL_I_TD[x].r = fg_sid_x_d.name
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.location
FUL_I_TD[x].r = fg_sid_x_d.zone
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = FUL_I.rep
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.toDo
FUL_I_TD[x].r = FUL_I.times
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.maxStanding
FUL_I_TD[x].r = _G["FACTION_STANDING_LABEL"..fg_sid_x_d.maxStanding]
FUL_I_TD.count = x
else
FUL_I.name = fg_sid_x_d.name
FUL_I_TD = {}
local x = 0
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.mob2
FUL_I_TD[x].r = fg_sid_x_d.name
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = FUL_I.rep
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.toDo
FUL_I_TD[x].r = FUL_I.times
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.maxStanding
FUL_I_TD[x].r = _G["FACTION_STANDING_LABEL"..fg_sid_x_d.maxStanding]
FUL_I_TD.count = x
FUL_I.tooltipDetails = FUL_I_TD
end
FIZ_UpdateList[index] = FUL_I
index = index + 1
end
end
end
-- quests (may have items)
local sum = 0
local count = 0
if (fg_sid.quests and FIZ_Data.ShowQuests) then
local fg_sid_x=fg_sid.quests
for i = 0, fg_sid_x.count do
local fg_sid_x_d=fg_sid_x.data[i]
local showQuest = true
if (fg_sid_x_d.profession) then
local fg_sid_x_d_p=fg_sid_x_d.profession
if ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Herb) and not FIZ_Herb) then
-- if list of known professions does not contain Herbology
showQuest = false
--FIZ_Print("Not showing quest ["..FIZ_FactionGain[faction][standingId].quests.data[i].name.."] because you do not know Herbalism")
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Skin) and not FIZ_Skin) then
-- if list of known professions does not contain Herbology
showQuest = false
--FIZ_Print("Not showing quest ["..FIZ_FactionGain[faction][standingId].quests.data[i].name.."] because you do not know Skinning")
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Mine) and not FIZ_Mine) then
-- if list of known professions does not contain Herbology
showQuest = false
--FIZ_Print("Not showing quest ["..FIZ_FactionGain[faction][standingId].quests.data[i].name.."] because you do not know mining")
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Gather) and not (FIZ_Herb or FIZ_Skin or FIZ_Mine)) then
-- no gathering profession
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Jewe) and not FIZ_Jewel) then
-- if list of known professions does not contain jewelcrafting
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Cook) and not FIZ_Cook) then
-- if list of known professions does not contain jewelcrafting
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Arch) and not FIZ_Arch) then
-- if list of known professions does not contain jewelcrafting
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Fish) and not FIZ_Fish) then
-- if list of known professions does not contain jewelcrafting
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Aid) and not FIZ_Aid) then
-- if list of known professions does not contain jewelcrafting
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Blac) and not FIZ_Black) then
-- if list of known professions does not contain BLACKsmith
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Tail) and not FIZ_Tailor) then
-- if list of known professions does not contain tailor
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Leat) and not FIZ_Leath) then
-- if list of known professions does not contain leather
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Ench) and not FIZ_Enchan) then
-- if list of known professions does not contain enchanter
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Engi) and not FIZ_Engin) then
-- if list of known professions does not contain BLACKsmith
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Incr) and not FIZ_Incrip) then
-- if list of known professions does not contain leather
showQuest = false
elseif ((fg_sid_x_d_p == FIZ_LIMIT_TYPE_Alch) and not FIZ_Alche) then
-- if list of known professions does not contain enchanter
showQuest = false
else
-- unexpected limit -> ignore this and still show quest ggg
end
end
if (showQuest) then
if (not fg_sid_x_d.limit or (normCurrent < fg_sid_x_d.limit)) then
local toDo = ceil(repToNext / fg_sid_x_d.rep)
if (fg_sid_x_d.limit) then
toDo = ceil((fg_sid_x_d.limit - normCurrent) / fg_sid_x_d.rep)
end
FIZ_UpdateList[index] = {}
local FUL_I = FIZ_UpdateList[index]
FUL_I.type = FIZ_TXT.questShort
FUL_I.times = toDo.."x"
FUL_I.rep = string.format("%d", fg_sid_x_d.rep)
FUL_I.index = index
FUL_I.belongsTo = nil
FUL_I.isShown = true
FUL_I.name = fg_sid_x_d.name
FUL_I.originalName = FUL_I.name
FUL_I.faction = faction
FUL_I.canSuppress = true
FUL_I.suppress = nil
if (FIZ_Suppressed and FIZ_Suppressed[oFaction] and FIZ_Suppressed[oFaction][FUL_I.originalName]) then
FUL_I.suppress = true
end
FUL_I.tooltipHead = FIZ_TXT.questHead
FUL_I.tooltipTip = FIZ_TXT.questTip
FUL_I.tooltipDetails = {}
local FUL_I_TD = FUL_I.tooltipDetails
local x = 0
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.quest2
FUL_I_TD[x].r = FUL_I.name
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = FUL_I.rep
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.timesToDo
FUL_I_TD[x].r = FUL_I.times
x = x+1
if (not FUL_I.suppress) then
sum = sum + fg_sid_x_d.rep
count = count + 1
end
if (fg_sid_x_d.items) then
FUL_I.hasList = true
FUL_I.listShown = false
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.itemsRequired
FUL_I_TD[x].r = " "
x = x+1
-- quest In log?
FUL_I.lowlight = nil
-- check if this quest is known
local entries, quests = GetNumQuestLogEntries()
for z=1,entries do
local title,level,tag,group,header,collapsed,complete,daily = GetQuestLogTitle(z)
if (title and not header) then
if string.find(string.lower(fg_sid_x_d.name), string.lower(title)) then
-- this quest matches
FUL_I.lowlight = true
FUL_I.name = FUL_I.name..FIZ_QUEST_ACTIVE_COLOUR.." ("..FIZ_TXT.active..")|r"
end
end
end
-- add items
local itemIndex = index+1
local currentQuestTimesBag = -1
local currentQuestTimesBagBank = -1
for item in pairs(fg_sid_x_d.items) do
FIZ_UpdateList[itemIndex] = {}
local FUL_II = FIZ_UpdateList[itemIndex]
FUL_II.type = ""
FUL_II.times = (fg_sid_x_d.items[item] * toDo).."x"
FUL_II.rep = nil
FUL_II.index = itemIndex
FUL_II.belongsTo = index
FUL_II.hasList = nil
FUL_II.listShown = nil
FUL_II.isShown = FUL_I.listShown
FUL_II.name = item.." ("..fg_sid_x_d.items[item].."x)"
FUL_I_TD[x] = {}
FUL_I_TD[x].l = fg_sid_x_d.items[item].."x"
FUL_I_TD[x].r = item
x = x+1
if (FIZ_ItemsCarried and FIZ_ItemsCarried[item]) then
if ((FIZ_ItemsCarried[item] >= fg_sid_x_d.items[item]) and (fg_sid_x_d.items[item] > 0)) then
FUL_II.name = FUL_II.name..FIZ_BAG_COLOUR.." ["..FIZ_ItemsCarried[item].."x]|r"
FUL_II.currentTimesBag = floor(FIZ_ItemsCarried[item] / fg_sid_x_d.items[item])
if (currentQuestTimesBag == -1) then
-- first items for this quest --> take value
currentQuestTimesBag = FUL_II.currentTimesBag
else
-- some items already Set
if (FUL_II.currentTimesBag < currentQuestTimesBag) then
-- fewer of this item than of others, reduce quest count
currentQuestTimesBag = FUL_II.currentTimesBag
end
end
else
-- not enough of this item for quest -> set to 0
currentQuestTimesBag = 0
FUL_II.name = FUL_II.name.." ["..FIZ_ItemsCarried[item].."x]"
end
if (FIZ_Data.Bank and
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player] and
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][item]) then
local total = FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][item] + FIZ_ItemsCarried[item]
if ((total >= fg_sid_x_d.items[item]) and (fg_sid_x_d.items[item] > 0)) then
FUL_II.name = FUL_II.name..FIZ_BAG_BANK_COLOUR.." ["..total.."x]|r"
FUL_II.currentTimesBagBank = floor(total / fg_sid_x_d.items[item])
if (currentQuestTimesBagBank == -1) then
-- first items for this quest --> take value
currentQuestTimesBagBank = FUL_II.currentTimesBagBank
else
-- some items already Set
if (FUL_II.currentTimesBagBank < currentQuestTimesBagBank) then
-- fewer of this item than of others, reduce quest count
currentQuestTimesBagBank = FUL_II.currentTimesBagBank
end
end
else
-- not enough of this item for quest -> set to 0
currentQuestTimesBagBank = 0
FUL_II.name = FUL_II.name.." ["..total.."x]"
end
else
-- none of this carried In bank
end
else
-- not enough of this item for quest -> set to 0
currentQuestTimesBag = 0
end
FIZ_UpdateList[itemIndex] = FUL_II
itemIndex = itemIndex + 1
end
if (currentQuestTimesBag > 0) then
FUL_I.name = FUL_I.name..FIZ_BAG_COLOUR.." ["..currentQuestTimesBag.."x]|r"
FUL_I.currentTimesBag = currentQuestTimesBag
FUL_I.currentRepBag = currentQuestTimesBag * FUL_I.rep
FUL_I.highlight = true
FUL_I.name = FUL_I.originalName
FUL_I.lowlight = nil
FIZ_CurrentRepInBag = FIZ_CurrentRepInBag + FUL_I.currentRepBag
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.inBag
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.turnIns
FUL_I_TD[x].r = string.format("%d", FUL_I.currentTimesBag)
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = string.format("%d", FUL_I.currentRepBag)
x = x+1
else
FUL_I.currentTimesBag = nil
FUL_I.currentRepBag = nil
end
if (currentQuestTimesBagBank > 0) then
FUL_I.name = FUL_I.name..FIZ_BAG_BANK_COLOUR.." ["..currentQuestTimesBagBank.."x]|r"
FUL_I.currentTimesBagBank = currentQuestTimesBagBank
FUL_I.currentRepBagBank = currentQuestTimesBagBank * FUL_I.rep
FUL_I.highlight = true
FUL_I.name = FUL_I.originalName
FUL_I.lowlight = nil
FIZ_CurrentRepInBagBank = FIZ_CurrentRepInBagBank + FUL_I.currentRepBagBank
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.inBagBank
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.turnIns
FUL_I_TD[x].r = string.format("%d", FUL_I.currentTimesBagBank)
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = string.format("%d", FUL_I.currentRepBagBank)
x = x+1
else
FUL_I.currentTimesBagBank = nil
FUL_I.currentRepBagBank = nil
end
if ((currentQuestTimesBag == 0) and (currentQuestTimesBagBank)) then
FUL_I.highlight = nil
end
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.maxStanding
FUL_I_TD[x].r = _G["FACTION_STANDING_LABEL"..fg_sid_x_d.maxStanding]
x = x+1
FUL_I_TD.count = x-1
index = itemIndex
else
-- no items to add
FUL_I.hasList = false
FUL_I.listShown = nil
FUL_I.highlight = nil -- will be Changed below if needed
FUL_I.lowlight = nil
-- check if this quest is known and/or completed
local entries, quests = GetNumQuestLogEntries()
for z=1,entries do
local title,level,tag,group,header,collapsed,complete,daily = GetQuestLogTitle(z)
if (title and not header) then
if string.find(string.lower(fg_sid_x_d.name), string.lower(title)) then
-- this quest matches
if (complete) then
FUL_I.highlight = true
FUL_I.name = FUL_I.name..FIZ_QUEST_COLOUR.." ("..FIZ_TXT.complete..")|r"
FUL_I.currentTimesQuest = 1
FUL_I.currentRepQuest = FUL_I.rep
FIZ_CurrentRepInQuest = FIZ_CurrentRepInQuest + fg_sid_x_d.rep
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.questCompleted
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = string.format("%d", FUL_I.currentRepQuest)
x = x+1
else
FUL_I.lowlight = true
FUL_I.name = FUL_I.name..FIZ_QUEST_ACTIVE_COLOUR.." ("..FIZ_TXT.active..")|r"
end
end
end
end
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.maxStanding
FUL_I_TD[x].r = _G["FACTION_STANDING_LABEL"..fg_sid_x_d.maxStanding]
x = x+1
FUL_I_TD.count = x-1
FIZ_UpdateList[index] = FUL_I
index = index + 1
end
end
end
end
if ((sum > 0) and (count > 1)) then
-- add virtual quest to show summary of all quests:
local toDo = ceil(repToNext / sum)
FIZ_UpdateList[index] = {}
local FUL_I = FIZ_UpdateList[index]
FUL_I.type = FIZ_TXT.questShort
FUL_I.times = toDo.."x"
FUL_I.rep = string.format("%d", sum)
FUL_I.index = index
FUL_I.belongsTo = nil
FUL_I.isShown = true
FUL_I.name = string.format(FIZ_TXT.allOfTheAbove, count)
FUL_I.tooltipHead = string.format(FIZ_TXT.questSummaryHead, count)
FUL_I.tooltipTip = FIZ_TXT.questSummaryTip
FUL_I_TD = {}
local x = 0
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = FUL_I.rep
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.timesToDo
FUL_I_TD[x].r = FUL_I.times
FUL_I_TD.count = x
FUL_I.tooltipDetails = FUL_I_TD
FIZ_UpdateList[index] = FUL_I
index = index + 1
end
end
-- items
if (fg_sid.items and FIZ_Data.ShowItems) then
local fg_sid_x=fg_sid.items
for i = 0, fg_sid_x.count do
local fg_sid_x_d=fg_sid_x.data[i]
if (not fg_sid_x_d.limit or (normCurrent < fg_sid_x_d.limit)) then
local toDo = ceil(repToNext / fg_sid_x_d.rep)
if (fg_sid_x_d.limit) then
toDo = ceil((fg_sid_x_d.limit - normCurrent) / fg_sid_x_d.rep)
end
if (fg_sid_x_d.items) then
FIZ_UpdateList[index] = {}
local FUL_I = FIZ_UpdateList[index]
FUL_I.type = FIZ_TXT.itemsShort
FUL_I.times = toDo.."x"
FUL_I.rep = string.format("%d", fg_sid_x_d.rep)
FUL_I.index = index
FUL_I.belongsTo = nil
FUL_I.isShown = true
FUL_I.name = FIZ_TXT.itemsName
FUL_I.hasList = true
FUL_I.listShown = false
FUL_I.tooltipHead = FIZ_TXT.itemsHead
FUL_I.tooltipTip = FIZ_TXT.itemsTip
FUL_I.tooltipDetails = {}
local FUL_I_TD = FUL_I.tooltipDetails
local x = 0
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FUL_I.name
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.itemsRequired
FUL_I_TD[x].r = " "
x = x+1
-- add items
local itemIndex = index+1
local currentQuestTimesBag = -1
local currentQuestTimesBagBank = -1
for item in pairs(fg_sid_x_d.items) do
FIZ_UpdateList[itemIndex] = {}
local FUL_II = FIZ_UpdateList[itemIndex]
FUL_II.type = ""
FUL_II.times = (fg_sid_x_d.items[item] * toDo).."x"
FUL_II.rep = nil
FUL_II.index = itemIndex
FUL_II.belongsTo = index
FUL_II.hasList = nil
FUL_II.listShown = nil
FUL_II.isShown = FUL_I.listShown
FUL_II.name = item.." ("..fg_sid_x_d.items[item].."x)"
FUL_I_TD[x] = {}
FUL_I_TD[x].l = fg_sid_x_d.items[item].."x"
FUL_I_TD[x].r = item
x = x+1
if (FIZ_ItemsCarried and FIZ_ItemsCarried[item]) then
if ((FIZ_ItemsCarried[item] >= fg_sid_x_d.items[item]) and (fg_sid_x_d.items[item] > 0)) then
FUL_II.currentTimesBag = floor(FIZ_ItemsCarried[item] / fg_sid_x_d.items[item])
FUL_II.name = FUL_II.name..FIZ_BAG_COLOUR.." ["..FIZ_ItemsCarried[item].."x]|r"
if (currentQuestTimesBag == -1) then
-- first items for this quest --> take value
currentQuestTimesBag = FUL_II.currentTimesBag
else
-- some items already Set
if (FUL_II.currentTimesBag < currentQuestTimesBag) then
-- fewer of this item than of others, reduce quest count
currentQuestTimesBag = FUL_II.currentTimesBag
end
end
else
-- not enough of this item for quest -> set to 0
currentQuestTimesBag = 0
FUL_II.name = FUL_II.name.." ["..FIZ_ItemsCarried[item].."x]"
end
if (FIZ_Data.Bank and
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player] and
FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][item]) then
local total = FIZ_Data.Bank[FIZ_Realm.." - "..FIZ_Player][item] + FIZ_ItemsCarried[item]
if ((total >= fg_sid_x_d.items[item]) and (fg_sid_x_d.items[item] > 0)) then
FUL_II.name = FUL_II.name..FIZ_BAG_BANK_COLOUR.." ["..total.."x]|r"
FUL_II.currentTimesBagBank = floor(total / fg_sid_x_d.items[item])
if (currentQuestTimesBagBank == -1) then
-- first items for this quest --> take value
currentQuestTimesBagBank = FUL_II.currentTimesBagBank
else
-- some items already Set
if (FUL_II.currentTimesBagBank < currentQuestTimesBagBank) then
-- fewer of this item than of others, reduce quest count
currentQuestTimesBagBank = FUL_II.currentTimesBagBank
end
end
else
-- not enough of this item for quest -> set to 0
currentQuestTimesBagBank = 0
FUL_II.name = FUL_II.name.." ["..total.."x]"
end
else
-- none of this carried In bank
end
else
-- not enough of this item for quest -> set to 0
currentQuestTimesBag = 0
end
FIZ_UpdateList[itemIndex] = FUL_II
itemIndex = itemIndex + 1
end
if (currentQuestTimesBag > 0) then
FUL_I.highlight = true
FUL_I.lowlight = nil
FUL_I.name = FUL_I.name..FIZ_BAG_COLOUR.." ["..currentQuestTimesBag.."x]|r"
FUL_I.currentTimesBag = currentQuestTimesBag
FUL_I.currentRepBag = currentQuestTimesBag * FUL_I.rep
FIZ_CurrentRepInBag = FIZ_CurrentRepInBag + FUL_I.currentRepBag
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.inBag
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.turnIns
FUL_I_TD[x].r = string.format("%d", FUL_I.currentTimesBag)
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = string.format("%d", FUL_I.currentRepBag)
x = x+1
else
FUL_I.currentTimesBag = nil
FUL_I.currentRepBag = nil
FUL_I.highlight = nil
end
if (currentQuestTimesBagBank > 0) then
FUL_I.highlight = true
FUL_I.lowlight = nil
FUL_I.name = FUL_I.name..FIZ_BAG_BANK_COLOUR.." ["..currentQuestTimesBagBank.."]|r"
FUL_I.currentTimesBagBank = currentQuestTimesBagBank
FUL_I.currentRepBagBank = currentQuestTimesBagBank * FUL_I.rep
FIZ_CurrentRepInBagBank = FIZ_CurrentRepInBagBank + FUL_I.currentRepBagBank
FUL_I_TD[x] = {}
if (not FIZ_UpdateList[index].hasList) then return end -- not a list Header entry
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.inBagBank
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.turnIns
FUL_I_TD[x].r = string.format("%d", FUL_I.currentTimesBagBank)
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = string.format("%d", FUL_I.currentRepBagBank)
x = x+1
else
FUL_I.currentTimesBagBank = nil
FUL_I.currentRepBagBank = nil
FUL_I.highlight = nil
end
if ((currentQuestTimesBag == 0) and (currentQuestTimesBagBank)) then
FUL_I.highlight = nil
end
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.maxStanding
FUL_I_TD[x].r = _G["FACTION_STANDING_LABEL"..fg_sid_x_d.maxStanding]
x = x+1
FUL_I_TD.count = x-1
FUL_I.tooltipDetails = FUL_I_TD
FIZ_UpdateList[index] = FUL_I
index = itemIndex
end
end
end
end
-- General
if (fg_sid.general and FIZ_Data.ShowGeneral) then
local fg_sid_x=fg_sid.general
for i = 0, fg_sid_x.count do
local fg_sid_x_d=fg_sid_x.data[i]
if (not fg_sid_x_d.limit or (normCurrent < fg_sid_x_d.limit)) then
local toDo = string.format("%.2f", repToNext / fg_sid_x_d.rep)
if (fg_sid_x_d.limit) then
toDo = string.format("%.2f", (fg_sid_x_d.limit - normCurrent) / fg_sid_x_d.rep)
end
-- calculate Number of times to do differently for Guild cap
--[[-- if (fg_sid_x_d.flag == FIZ_FLAG_GUILD_CAP) then
toDo = string.format("%.2f", (barMax - FIZ_Data.cap[FIZ_CapIndex].base) / fg_sid_x_d.rep)
end --]]--
FIZ_UpdateList[index] = {}
local FUL_I = FIZ_UpdateList[index]
FUL_I.type = FIZ_TXT.generalShort
FUL_I.times = toDo.."x"
FUL_I.rep = string.format("%d", fg_sid_x_d.rep)
FUL_I.hasList = false
FUL_I.listShown = nil
FUL_I.index = index
FUL_I.belongsTo = nil
FUL_I.isShown = true
FUL_I.name = fg_sid_x_d.name
if (fg_sid_x_d.head and fg_sid_x_d.head ~= "") then
FUL_I.tooltipHead = fg_sid_x_d.head
else
FUL_I.tooltipHead = FIZ_TXT.generalHead
end
if (fg_sid_x_d.tip and fg_sid_x_d.tip ~= "") then
FUL_I.tooltipTip = fg_sid_x_d.tip
else
FUL_I.tooltipTip = FIZ_TXT.generalTip
end
FUL_I.tooltipDetails = {}
local FUL_I_TD = FUL_I.tooltipDetails
local x = 0
--[[-- if (fg_sid_x_d.flag == FIZ_FLAG_GUILD_CAP) then
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputationCap
FUL_I_TD[x].r = FUL_I.rep
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputationCapCurrent
FUL_I_TD[x].r = FIZ_Data.cap[FIZ_CapIndex].rep
else --]]--
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.general2
FUL_I_TD[x].r = fg_sid_x_d.name
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.reputation
FUL_I_TD[x].r = FUL_I.rep
-- end
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.timesToRun
FUL_I_TD[x].r = FUL_I.times
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
if (fg_sid_x_d.tipList) then
for tip in pairs(fg_sid_x_d.tipList) do
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = tip
FUL_I_TD[x].r = fg_sid_x_d.tipList[tip]
end
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = " "
FUL_I_TD[x].r = " "
end
x = x+1
FUL_I_TD[x] = {}
FUL_I_TD[x].l = FIZ_TXT.maxStanding
FUL_I_TD[x].r = _G["FACTION_STANDING_LABEL"..fg_sid_x_d.maxStanding]
FUL_I_TD.count = x
local FUL_I_TD = FUL_I.tooltipDetails
FIZ_UpdateList[index] = FUL_I
index = index + 1
end
end
end
end
end
end
--FIZ_Print("Added "..(index-1).." entries for ["..faction.."] at standing "..standingId)
FIZ_UpdateList_Update()
end
function FIZ_GetUpdateListSize()
-- sub function of FIZ_UpdateList_Update()
--fpt hed f_guls FIZ_Printtest("","","f_guls 1")
local count = 0
local highest = 0
for i in pairs(FIZ_UpdateList) do
if (FIZ_UpdateList[i].isShown) then
count = count + 1
if (i > highest) then
highest = i
end
end
end
return count, highest
end
function FIZ_ShowUpdateEntry(index, show)
--fpt hed f_sue FIZ_Printtest("","","f_sue 1")
if (not FIZ_UpdateList[index]) then return end -- invalid index
if (not FIZ_UpdateList[index].hasList) then return end -- not a list Header entry
if (type(show)~="boolean") then return end -- wrong data type
FIZ_UpdateList[index].listShown = show
for i in pairs(FIZ_UpdateList) do
if (FIZ_UpdateList[i].belongsTo == index) then
FIZ_UpdateList[i].isShown = show
end
end
FIZ_UpdateList_Update()
end
function FIZ_ShowUpdateEntries(show)
if (type(show)~="boolean") then return end -- wrong data type
for i in pairs(FIZ_UpdateList) do
if (FIZ_UpdateList[i].belongsTo == nil) then
-- always show parent entries, show or Hide their children
FIZ_UpdateList[i].isShown = true
FIZ_UpdateList[i].listShown = show
else
-- show or Hide child entries
FIZ_UpdateList[i].isShown = show
end
end
FIZ_UpdateList_Update()
end
function FIZ_ShowLineToolTip(self)
if not self then return end
if (self.tooltipHead) then
GameTooltip_SetDefaultAnchor(GameTooltip, self)
GameTooltip:SetText(self.tooltipHead, 1, 1, 0.5, 1)
if (self.tooltipTip) then
GameTooltip:AddLine(self.tooltipTip, 1, 1, 1, 1)
end
if (self.tooltipDetails and type(self.tooltipDetails) == "table") then
GameTooltip:AddLine(" ", 1, 1, 1, 1)
for i = 0, self.tooltipDetails.count do
if (self.tooltipDetails[i].l and self.tooltipDetails[i].r) then
if (self.tooltipDetails[i].r == " " or self.tooltipDetails[i].r=="") then
GameTooltip:AddDoubleLine(self.tooltipDetails[i].l, self.tooltipDetails[i].r, 1, 1, 0, 1, 1, 1)
else
GameTooltip:AddDoubleLine(self.tooltipDetails[i].l, self.tooltipDetails[i].r, 1, 1, 0.5, 1, 1, 1)
end
end
end
end
GameTooltip:Show()