Language:
Lua     Change language:
Pastebin: 127651
Author: Dridzt
Subject: Multishot r33+ (multishot.lua)
Created: 2009-11-05 22:21:52
Download and save
Toggle line numbers
1Multishot = LibStub("AceAddon-3.0"):NewAddon("Multishot", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0"); 
2local LibBossIDs = LibStub("LibBossIDs-1.0"); 
3 
4function Multishot:OnInitialize() 
5  Multishot:InitOptions() 
6end 
7 
8function Multishot:OnEnable() 
9  self:RegisterEvent("PLAYER_ENTERING_WORLD"
10  self:RegisterEvent("PLAYER_LEVEL_UP"
11  self:RegisterEvent("ACHIEVEMENT_EARNED"
12  self:RegisterEvent("CHAT_MSG_SYSTEM"
13  self:RegisterChatCommand("multishot", function() 
14    InterfaceOptionsFrame_OpenToCategory(Multishot.PrefPane); 
15  end
16end 
17 
18function Multishot:PLAYER_LEVEL_UP(Q) 
19  if MultishotConfig.levelup then 
20    self:ScheduleTimer("CustomScreenshot", MultishotConfig.delay1, Q); 
21  end 
22end 
23 
24function Multishot:ACHIEVEMENT_EARNED(Q) 
25  if MultishotConfig.achievement then 
26    self:ScheduleTimer("CustomScreenshot", MultishotConfig.delay1, Q); 
27  end 
28end 
29 
30local standing 
31local rep_standing_pattern = string.gsub(FACTION_STANDING_CHANGED,"%%%d?%$?s", "(.+)"
32function Multishot:CHAT_MSG_SYSTEM(Q) 
33    if not arg1 or not type(arg1)=="string" then return end 
34    local newstanding, withfaction = string.match(arg1, rep_standing_pattern) 
35    if not newstanding then return end 
36    standing = nil 
37    for i=1,8 do 
38        if newstanding==_G["FACTION_STANDING_LABEL"..i] or newstanding==_G["FACTION_STANDING_LABEL"..i.."FEMALE"] then 
39            standing = i 
40            break 
41        end 
42    end 
43    if MultishotConfig.repchange and standing then 
44    self:ScheduleTimer("CustomScreenshot", MultishotConfig.delay1, Q .. standing); 
45    end 
46end 
47 
48local isEnabled, isDelayed 
49function Multishot:PLAYER_ENTERING_WORLD() 
50  inInstance, instanceType = IsInInstance() 
51  if (instanceType == "party" or instanceType == "raid") then 
52    isEnabled = true 
53    self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"
54    self:RegisterEvent("PLAYER_REGEN_ENABLED"
55  elseif isEnabled then 
56    isEnabled = false 
57    self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED"
58    self:UnregisterEvent("PLAYER_REGEN_ENABLED"
59  end 
60end 
61 
62function Multishot:COMBAT_LOG_EVENT_UNFILTERED(Q) 
63  inInstance, instanceType = IsInInstance() 
64 
65  if (instanceType == "party" and (not MultishotConfig.party)) then return end 
66  if (instanceType == "raid" and (not MultishotConfig.raid)) then return end 
67 
68  if arg2 == "UNIT_DIED" then 
69    tempID = tonumber("0x" .. string.sub(arg6, 9, 12)); 
70    if LibBossIDs.BossIDs[tempID] then 
71      if UnitIsDead("player") then 
72        self:ScheduleTimer("CustomScreenshot", MultishotConfig.delay2, Q .. tempID); 
73      else 
74        isDelayed = tempID 
75      end 
76    end 
77  end 
78end 
79 
80function Multishot:PLAYER_REGEN_ENABLED(Q) 
81  if isDelayed then 
82    self:ScheduleTimer("CustomScreenshot", MultishotConfig.delay2, Q .. isDelayed); 
83    isDelayed = nil 
84  end 
85end 
86 
87function Multishot:CustomScreenshot(Q) 
88  Screenshot() 
89  if (Q and MultishotConfig.debug) then 
90    self:Print(Q) 
91  end 
92end 
Download and save
Toggle line numbers
Thread:
[127651] Multishot r33+ (multishot.lua) by Dridzt at 2009-11-05 22:21:52
Tip: Click the line numbers to toggle highliting on that line.

Paste followup:

Language:
Author:
Subject:


    Tabstop:     bigger biggest
Note: You can prefix a line with "@@@" to highlight it.