-
Notifications
You must be signed in to change notification settings - Fork 1
/
BattlePets.lua
83 lines (68 loc) · 3.11 KB
/
BattlePets.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
local addonName, ATOM = ...
local Module = ATOM:NewModule('BattlePets')
local petBattleRoundTitle, petBattleRoundsCompleted
function Module:OnEnable()
petBattleRoundTitle = PetBattleFrame:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
petBattleRoundTitle:SetPoint('BOTTOM', PetBattleFrame.TopVersusText, 'TOP', 1, 2)
petBattleRoundTitle:SetText('Round')
petBattleRoundTitle:Hide()
self:RegisterEvent('PET_BATTLE_OPENING_START')
self:RegisterEvent('PET_BATTLE_PET_ROUND_PLAYBACK_COMPLETE')
self:RegisterEvent('PET_BATTLE_FINAL_ROUND')
self:RegisterEvent('PET_BATTLE_CLOSE')
end
function Module:PET_BATTLE_OPENING_START()
petBattleRoundsCompleted = nil
end
function Module:PET_BATTLE_PET_ROUND_PLAYBACK_COMPLETE(event, round)
petBattleRoundsCompleted = tonumber(round) and round + 1 or '?'
PetBattleFrame.TopVersusText:SetPoint('TOP', PetBattleFrame, 'TOP', -1, -17)
PetBattleFrame.TopVersusText:SetFontObject('Game24Font')
PetBattleFrame.TopVersusText:SetText(petBattleRoundsCompleted)
petBattleRoundTitle:Show()
end
function Module:PET_BATTLE_FINAL_ROUND(event, winner)
local outcomeText = (winner == Enum.BattlePetOwner.Ally) and 'victory' or 'failure'
if petBattleRoundsCompleted then
ATOM:Print(('Pet Battle finished in %s after |cff00ff00%s|r rounds.'):format(outcomeText, petBattleRoundsCompleted - 1))
end
end
function Module:PET_BATTLE_CLOSE()
PetBattleFrame.TopVersusText:SetPoint('TOP', PetBattleFrame, 'TOP', 0, -6)
PetBattleFrame.TopVersusText:SetFontObject('GameFont_Gigantic')
PetBattleFrame.TopVersusText:SetText(PET_BATTLE_UI_VS)
petBattleRoundTitle:Hide()
end
function Module:GetActivePowerlevelingBattlePetTrainer()
local worldQuests = {
[41935] = 'Beasts of Burden',
[41990] = 'Chopped',
[41860] = 'Dealing with Satyrs',
[42442] = 'Fight Night: Amalia',
[40299] = 'Fight Night: Bodhi Sunwayver',
[40298] = 'Fight Night: Sir Galveston',
[40277] = 'Fight Night: Tiffany Nelson',
[41944] = 'Jarrun\'s Ladder',
[40278] = 'My Beast\'s Bidding',
[41687] = 'Snail Fight!',
[41895] = 'The Master of Pets',
[40282] = 'Tiny Poacher, Tiny Animals',
[40280] = 'Training with Bredda',
[40279] = 'Training with Durian',
[42159] = 'Training with the Nightwatchers',
}
local powerlevelingBattlePetWorldQuest
for questID, questTitle in pairs(worldQuests) do
local timeRemaining = C_TaskQuest.GetQuestTimeLeftMinutes(questID)
if timeRemaining and timeRemaining > 5 then
powerlevelingBattlePetWorldQuest = questID
end
end
if powerlevelingBattlePetWorldQuest then
local questTitle = C_TaskQuest.GetQuestInfoByQuestID(powerlevelingBattlePetWorldQuest)
local questMapInfo = C_Map.GetMapInfo(C_TaskQuest.GetQuestZoneID(powerlevelingBattlePetWorldQuest))
ATOM:Print('The powerleveling Battle Pet World Quest: |c00b4ff00%s|r in |c00b4ff00%s|r', questTitle, questMapInfo.name)
else
ATOM:Print('There are currently no powerleveling Battle Pet trainers up.')
end
end