-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFactionizer8.lua
More file actions
571 lines (533 loc) · 15.4 KB
/
Factionizer8.lua
File metadata and controls
571 lines (533 loc) · 15.4 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
------5.04.00.7.2 14.4.27------------------
-- _08_ Faction map --
-----------------------------------
function FIZ_Initmapname(fimap)
--- fpt f_imn FIZ_Printtest(fimap,"","map 1")
local map
if fimap == 1 then
map = FIZ_TXT.srfd
elseif fimap== 2 then
map = FIZ_TXT.tbd
elseif fimap== 3 then
map = FIZ_TXT.mnd
elseif fimap== 5 then
map = FIZ_TXT.nci
elseif fimap == 6 then
map = FIZ_TXT.hci
elseif not fimap then
map = " "
else
local mapName = GetMapNameByID(fimap);
map = mapName
end
--- fpt f_imn FIZ_Printtest(fimap,"","map 2")
if not map then
map = fimap
end
mark_map = map
end
function FIZ_Initmobname(fimob)
--- fpt f_ion FIZ_Printtest(fimob,"","mob 1")
local mob
if fimob == 1 then
mob = FIZ_TXT.tmob
elseif fimob== 2 then
mob = FIZ_TXT.oboss
elseif fimob== 3 then
mob = FIZ_TXT.aboss
elseif fimob == 4 then
mob = FIZ_TXT.pboss
elseif fimob == 5 then
mob = FIZ_TXT.fclear
elseif fimob == 11 then
mob = (FIZ_TXT.AU.." "..FIZ_TXT.BB)
elseif fimob== 12 then
mob = (FIZ_TXT.AU.." "..FIZ_TXT.SSP)
elseif fimob== 13 then
mob = (FIZ_TXT.AU.." "..FIZ_TXT.Wa)
elseif fimob == 14 then
mob = FIZ_TXT.VCm
elseif fimob == 15 then
mob = (FIZ_TXT.AN.." "..FIZ_TXT.BB)
elseif fimob== 16 then
mob = (FIZ_TXT.AN.." "..FIZ_TXT.SSP)
elseif fimob== 17 then
mob = (FIZ_TXT.AN.." "..FIZ_TXT.Wa)
else
--[[-- local mobName = GetmobNameByID(fimob);
mob = mobName --]]--
end
--- fpt f_ion FIZ_Printtest(fimob,mob,"mob 2")
if not mob then
mob = fimob
end
mark_mob = mob
end
function FIZ_Inititemname(fiitem,amt)
--- fpt f_iin FIZ_Printtest(fiitem,amt,"item 1")
if fiitem==1 then
item_name = FIZ_TXT.cdq
elseif fiitem==2 then
item_name = FIZ_TXT.fdq
elseif fiitem==3 then
item_name = FIZ_TXT.ndq
elseif fiitem == 4 then
item_name = FIZ_TXT.cbadge
elseif fiitem == 5 then
item_name = FIZ_TXT.deleted
else
item_name = GetItemInfo(fiitem)
end
mark_I={}
if not item_name then
item_name=fiitem
end
mark_I[item_name]=amt
--- fpt f_iin FIZ_Printtest(item_name,mark_I[item_name],"item 2")
end
local quest_names = setmetatable({}, {
__index = function(t, id_num)
GameTooltip:SetOwner(UIParent, ANCHOR_NONE)
GameTooltip:SetHyperlink(format("quest:%d", id_num))
local quest_name = GameTooltipTextLeft1:GetText()
GameTooltip:Hide()
if id_num == 1 then
quest_name = FIZ_TXT.cdq
elseif id_num == 2 then
quest_name = FIZ_TXT.coq
elseif id_num == 3 then
quest_name = FIZ_TXT.fdq
elseif id_num == 4 then
quest_name = FIZ_TXT.foq
elseif id_num == 5 then
quest_name = FIZ_TXT.ndq
elseif id_num == 6 then
quest_name = FIZ_TXT.deleted
elseif id_num == 7 then
quest_name = FIZ_TXT.Championing
elseif id_num == 8 then
quest_name = FIZ_TXT.bpqfg
elseif id_num== 99 then
quest_name = FIZ_TXT.tbd
else
if not quest_name then
return id_num
end
t[id_num] = quest_name
end
return quest_name
end
})
function FIZ_GetTabardFaction()
for i = 1, 40 do
local _, _, _, _, _, _, _, _, _, _, id = UnitBuff("player", i)
if not id then
break
end
local data = championFactions[id]
if data then
local faction, level = data[2], data[1]
if DEBUG then self:Debug("GetChampionedFaction:", tostring(faction), tostring(level)) end
return faction, level
end
end
if DEBUG then self:Debug("GetChampionedFaction:", "none") end
end
function FIZ_InitFactor(FIZ_IsHuman,faction)
--- Thanks Gwalkmaur for the heads up
local factor=1.0
-- race check
if FIZ_IsHuman then factor = factor + 0.1 end
-- bonus repgain check
local numFactions = GetNumFactions();
local factionOffset=0;
local factionIndex;
local factor_h=0
--- FIZ_Printtest(numFactions,factionOffset,factionIndex)
--- f_if FIZ_Printtest(faction,name)
for i=1,numFactions do
local factionIndex = factionOffset + i;
if (factionIndex <= numFactions) then
local name, hasBonusRepGain;
local name, _, _, _, _, _, _, _, _, _, _, _, _, _, hasBonusRepGain, _ = GetFactionInfo(factionIndex);
if (faction==name) then
--- f_if FIZ_Printtest(faction,name,"test")
if (hasBonusRepGain) then
--- f_if FIZ_Printtest(faction,name,"Gain")
factor=factor+1
end
end
end
end
--- f_if FIZ_Printtest(faction,factor,"fact")
FIZ_factor = factor
end
function FIZ_InitFaction(guildName,faction)
if faction=="guildName" or faction==FIZ_GuildName then
--- f_ifa FIZ_Printtest(faction,guildName,"1")
FIZ_faction = faction
else
--- f_ifa FIZ_Printtest(faction,FIZ_faction,"2")
FIZ_faction = GetFactionInfoByID(faction)
end
end
function FIZ_InitFactionMap(locale, guildName)
FIZ_FactionMapping = {}
FIZ_InitEnFactions()
if (guildName) then
FIZ_AddMapping(guildName, guildName)
end
end
function FIZ_AddMapping(english, localised)
--- f_am FIZ_Printtest(english, localised,"map")
if (not FIZ_FactionMapping) then
FIZ_FactionMapping = {}
end
FIZ_InitFaction(FIZ_GuildName,localised)
if (FIZ_faction) then
FIZ_FactionMapping[string.lower(FIZ_faction)] = string.lower(english)
end
end
------------------------------------
-- _09_ Faction Lists --
------------------------------------
function FIZ_AddSpell(faction, from, to, name, rep, zone, limit)
if not faction then return end
if not from then return end
if not to then return end
if not name then return end
if not rep then return end
if (type(rep) ~= "number") then return end
if ((from<1) or (from>8)) then return end
if ((to<1) or (to>8)) then return end
if (from > to) then return end
faction = string.lower(faction)
--[[-- FIZ_Initspellname(name)
--- FIZ_Initmapname(zone)
FIZ_InitFaction(FIZ_GuildName,faction)
FIZ_InitFactor(FIZ_IsHuman,FIZ_faction)
rep = rep * FIZ_factor
faction = string.lower(FIZ_faction)
--- FIZ_Printtest(faction,FIZ_faction,"spell")--fpt
for standing = from,to do
local faction_info = FIZ_FactionGain[faction]
if not faction_info then
faction_info = {}
FIZ_FactionGain[faction] = faction_info
end
local standing_info = faction_info[standing]
if not standing_info then
standing_info = {}
faction_info[standing] = standing_info
end
local add_info = standing_info.spells
if add_info then
add_info.count = add_info.count + 1
else
add_info = {}
add_info.data = {}
add_info.count = 0
standing_info.spells = add_info
end
local count = add_info.count
add_info.data[count] = {}
local add_count=add_info.data[count]
add_count.name = mark_spell --- name
add_count.rep = rep
add_count.zone = zone --- mark_map
add_count.maxStanding = to
if ((standing == to) and limit) then
add_count.limit = limit
end
FIZ_Debug("Added spell ["..name.."] for faction ["..faction.."] and standing [".._G["FACTION_STANDING_LABEL"..standing].."]")
end --]]--
end
function FIZ_AddMob(faction, from, to, name, rep, zone, limit)
if not faction then return end
if not from then return end
if not to then return end
if not name then return end
if not rep then return end
if (type(rep) ~= "number") then return end
if ((from<1) or (from>8)) then return end
if ((to<1) or (to>8)) then return end
if (from > to) then return end
FIZ_Initmobname(name)
FIZ_Initmapname(zone)
FIZ_InitFaction(FIZ_GuildName,faction)
FIZ_InitFactor(FIZ_IsHuman,FIZ_faction)
rep = rep * FIZ_factor
faction = string.lower(FIZ_faction)
--- f_amo FIZ_Printtest(faction,FIZ_faction,"mob")
for standing = from,to do
local faction_info = FIZ_FactionGain[faction]
if not faction_info then
faction_info = {}
FIZ_FactionGain[faction] = faction_info
end
local standing_info = faction_info[standing]
if not standing_info then
standing_info = {}
faction_info[standing] = standing_info
end
local add_info = standing_info.mobs
if add_info then
add_info.count = add_info.count + 1
else
add_info = {}
add_info.data = {}
add_info.count = 0
standing_info.mobs = add_info
end
local count = add_info.count
add_info.data[count] = {}
local add_count=add_info.data[count]
add_count.name = mark_mob --- name
add_count.rep = rep
add_count.zone = mark_map ---zone
add_count.maxStanding = to
if ((standing == to) and limit) then
add_count.limit = limit
end
FIZ_Debug("Added mob ["..name.."] for faction ["..faction.."] and standing [".._G["FACTION_STANDING_LABEL"..standing].."]")
end
end
function FIZ_AddQuest(faction, from, to, name, rep, itemList, limitType)
if not faction then return end
if not from then return end
if not to then return end
if not name then return end
if not rep then return end
if (type(rep) ~= "number") then return end
if ((from<1) or (from>8)) then return end
if ((to<1) or (to>8)) then return end
if (from > to) then return end
FIZ_InitFaction(FIZ_GuildName,faction)
FIZ_InitFactor(FIZ_IsHuman,FIZ_faction)
rep = rep * FIZ_factor
faction = string.lower(FIZ_faction)
--- f_aq FIZ_Printtest(faction,FIZ_faction,"quest")
for standing = from,to do
local mark_quest = quest_names[name]
local faction_info = FIZ_FactionGain[faction]
if not faction_info then
faction_info = {}
FIZ_FactionGain[faction] = faction_info
end
local standing_info = faction_info[standing]
if not standing_info then
standing_info = {}
faction_info[standing] = standing_info
end
local add_info = standing_info.quests
if add_info then
add_info.count = add_info.count + 1
else
add_info = {}
add_info.data = {}
add_info.count = 0
standing_info.quests = add_info
end
local count=add_info.count
add_info.data[count] = {}
local add_count=add_info.data[count]
add_count.name = mark_quest
add_count.rep = rep
add_count.maxStanding = to
if (itemList) then
if (itemList == "nil") then
add_count.profession = limitType
else
add_count.items = {}
for item in pairs(itemList) do
FIZ_Inititemname(item,itemList[item])
--- f_aq FIZ_Printtest(item_name,mark_I[item_name],"item 3")
add_count.items[item_name] = mark_I[item_name]
--- f_aq FIZ_Printtest(add_count.items[item_name],mark_I[item_name],"item 4")
end
end
end
if ((standing == to) and limit) then
add_count.limit = limit
end
FIZ_Debug("Added quest ["..name.."] for faction ["..faction.."] and standing [".._G["FACTION_STANDING_LABEL"..standing].."]")
end
end
function FIZ_AddInstance(faction, from, to, name, rep, heroic)
if not faction then return end
if not from then return end
if not to then return end
if not name then return end
if not rep then return end
if (type(rep) ~= "number") then return end
if ((from<1) or (from>8)) then return end
if ((to<1) or (to>8)) then return end
if (from > to) then return end
faction = string.lower(faction)
FIZ_Initmapname(name)
FIZ_InitFaction(FIZ_GuildName,faction)
FIZ_InitFactor(FIZ_IsHuman,FIZ_faction)
rep = rep * FIZ_factor
faction = string.lower(FIZ_faction)
--- f_ain FIZ_Printtest(faction,FIZ_faction,"inst")
for standing = from,to do
local faction_info = FIZ_FactionGain[faction]
if not faction_info then
faction_info = {}
FIZ_FactionGain[faction] = faction_info
end
local standing_info = faction_info[standing]
if not standing_info then
standing_info = {}
faction_info[standing] = standing_info
end
local add_info = standing_info.instance
if add_info then
add_info.count = add_info.count + 1
else
add_info = {}
add_info.data = {}
add_info.count = 0
standing_info.instance = add_info
end
local count = add_info.count
add_info.data[count] = {}
local add_count=add_info.data[count]
add_count.name = mark_map
add_count.rep = rep
add_count.maxStanding = to
if (heroic) then --ggg
add_count.level = FIZ_TXT.heroic
else
add_count.level = FIZ_TXT.normal
end
if ((standing == to) and limit) then
add_count.limit = limit
end
FIZ_Debug("Added instance ["..name.."] for faction ["..faction.."] and standing [".._G["FACTION_STANDING_LABEL"..standing].."]")
end
end
function FIZ_AddItems(faction, from, to, rep, itemList)
if not faction then return end
if not from then return end
if not to then return end
if not rep then return end
if not itemList then return end
if (type(rep) ~= "number") then return end
if ((from<1) or (from>8)) then return end
if ((to<1) or (to>8)) then return end
if (from > to) then return end
faction = string.lower(faction)
FIZ_InitFaction(FIZ_GuildName,faction)
FIZ_InitFactor(FIZ_IsHuman,FIZ_faction)
rep = rep * FIZ_factor
faction = string.lower(FIZ_faction)
--- f_ait FIZ_Printtest(faction,FIZ_faction,"item")
local itemString = ""
for standing = from,to do
local faction_info = FIZ_FactionGain[faction]
if not faction_info then
faction_info = {}
FIZ_FactionGain[faction] = faction_info
end
local standing_info = faction_info[standing]
if not standing_info then
standing_info = {}
faction_info[standing] = standing_info
end
local add_info = standing_info.items
if add_info then
add_info.count = add_info.count + 1
else
add_info = {}
add_info.data = {}
add_info.count = 0
standing_info.items = add_info
end
local count=add_info.count
add_info.data[count] = {}
local add_count=add_info.data[count]
add_count.rep = rep
add_count.maxStanding = to
if (itemList) then
add_count.items = {}
for item in pairs(itemList) do
FIZ_Inititemname(item,itemList[item])
if itemString ~= "" then itemString = itemString..", " end
itemString = itemString..mark_I[item_name].."x "..item_name
--- f_ait FIZ_Printtest(item_name,mark_I[item_name],"item")
add_count.items[item_name] = mark_I[item_name]
end
end
if ((standing == to) and limit) then
add_count.limit = limit
end
FIZ_Debug("AddItem: Added items ["..itemString.."] for faction ["..faction.."] and standing [".._G["FACTION_STANDING_LABEL"..standing].."]")
end
end
function FIZ_AddGeneral(faction, from, to, name, rep, head, tip, tipList, flag)
if not faction then return end
if not from then return end
if not to then return end
if not rep then return end
if not name then return end
if (type(rep) ~= "number") then return end
if ((from<1) or (from>8)) then return end
if ((to<1) or (to>8)) then return end
if (from > to) then return end
faction = string.lower(faction)
if name == "1" then
name = FIZ_TXT.tfr
head = FIZ_TXT.tfr
tip = FIZ_TXT.nswts
else
end
FIZ_InitFaction(FIZ_GuildName,faction)
FIZ_InitFactor(FIZ_IsHuman,FIZ_faction)
rep = rep * FIZ_factor
faction = string.lower(FIZ_faction)
--- f_ag FIZ_Printtest(faction,FIZ_faction,"gen")
local tipString = ""
for standing = from,to do
local faction_info = FIZ_FactionGain[faction]
if not faction_info then
faction_info = {}
FIZ_FactionGain[faction] = faction_info
end
local standing_info = faction_info[standing]
if not standing_info then
standing_info = {}
faction_info[standing] = standing_info
end
local add_info = standing_info.general
if add_info then
add_info.count = add_info.count + 1
else
add_info = {}
add_info.data = {}
add_info.count = 0
standing_info.general = add_info
end
local count = add_info.count
add_info.data[count] = {}
local add_count=add_info.data[count]
add_count.name = name
add_count.flag = flag
add_count.head = head
add_count.tip = tip
add_count.rep = rep
add_count.maxStanding = to
if (tipList) then
add_count.tipList = {}
for tip in pairs(tipList) do
if tipString ~= "" then tipString = tipString..", " end
tipString = tipString..tipList[tip]..": "..tip
add_count.tipList[tip] = tipList[tip]
end
end
if ((standing == to) and limit) then
add_count.limit = limit
end
FIZ_Debug("AddGeneral: Added general rep gain ["..name.."] for faction ["..faction.."] and standing [".._G["FACTION_STANDING_LABEL"..standing].."] with tooltip ["..tipString.."]")
end
end