WoWInterface SVN AutoReply

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 14 to Rev 15
    Reverse comparison

Rev 14 → Rev 15

AutoReply.toc
1,7 → 1,7
## Interface: 40300
## Author: Animor
## Title: Animor's AutoReply
## Version: 0.9.03
## Version: 0.9.04
## Notes: Auto reply whispers in specific combat related situations.
## OptionalDeps: Ace3, Recount, LibDataBroker-1.1
## X-Embeds: Ace3, LibDataBroker-1.1
BossFight.lua
60,6 → 60,19
end
end
 
-------------------------------------------------
-- Boss engage event - check for start/kill/wipe
-------------------------------------------------
function AutoReply:INSTANCE_ENCOUNTER_ENGAGE_UNIT()
if self.db.profile.raidEn or self.db.profile.dungeonEn then
if not self.bossEngaged then
self:CheckBossFightStart()
else
self:CheckBossKill("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
end
end
end
 
----------------------------------------
-- Check if boss fight started
----------------------------------------
70,7 → 83,6
-- self:Print("boss fight start")
self.bossEngaged = true
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT", "CheckBossKill")
self:RegisterEvent("CHAT_MSG_MONSTER_YELL", "CheckBossKill")
self:RegisterEvent("CHAT_MSG_MONSTER_EMOTE", "CheckBossKill")
self:RegisterEvent("RAID_BOSS_EMOTE", "CheckBossKill")
116,7 → 128,6
self.bossID = nil
self.bossName = "Unknown"
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:UnregisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
self:UnregisterEvent("CHAT_MSG_MONSTER_YELL")
self:UnregisterEvent("CHAT_MSG_MONSTER_EMOTE")
self:UnregisterEvent("RAID_BOSS_EMOTE")
176,7 → 187,7
end
end
 
return allBossesDead
return allBossesDead, bossFound
end
 
----------------------------------------
184,10 → 195,10
----------------------------------------
function AutoReply:CheckBossKill(eventname)
-- self:Print(eventname)
if self.bossEngaged and (self.db.profile.raidEn or self.db.profile.dungeonEn) then
if self.bossEngaged and (not UnitAffectingCombat("player")) and (self.db.profile.raidEn or self.db.profile.dungeonEn) then
-- self:Print("CheckBossKill")
-- if self:AllBossesDead() or self:GroupSurvived() then
if self:AllBossesDead() then
local allBossesDead, bossFound = self:AllBossesDead()
if allBossesDead or (self:GroupSurvived() and not bossFound) then
-- self:Print("boss fight: kill")
self.numKilledBosses = self.numKilledBosses + 1
self:ReplyAllMissedBoss("kill")
214,24 → 225,19
-- Check if group is alive
----------------------------------------
function AutoReply:GroupSurvived()
local playerInInstance = IsInInstance()
local posX, posY = nil
local playerSurvived = false
if not IsInInstance() then return false end -- Do not check if player is not in instance (return false).
local unitId = ((GetNumRaidMembers() == 0) and "party") or "raid"
SetMapToCurrentZone() -- Sets the current world map continent and zone to be the zone the player is currently in.
for i = 0, math.max(GetNumRaidMembers(), GetNumPartyMembers()) do
local id = (i == 0 and "player") or unitId..i
-- Check if player is out of combat and didn't use any feign death ability to reset the boss.
if not (UnitAffectingCombat(id) or UnitIsDeadOrGhost(id) or UnitIsFeignDeath(id) or
-- Check in addition if player is in 100 yard range.
if UnitIsVisible(id) and not (UnitAffectingCombat(id) or UnitIsDeadOrGhost(id) or UnitIsFeignDeath(id) or
UnitAura(id, "Vanish") or UnitAura(id, "Invisibility") or UnitAura(id, "Shadowmeld")) then
-- Check if player is in the instance
posX, posY = GetPlayerMapPosition(id)
if (posX ~= 0 and posY ~= 0 and playerInInstance) or (posX == 0 and posY == 0 and not playerInInstance) then
playerSurvived = true
end
-- self:Print(UnitName(id))
return true
end
end
return playerSurvived
return false
end
 
---------------------------------------------
Core.lua
698,8 → 698,13
-- Get initial dungeon progress
----------------------------------------
function AutoReply:LFG_PROPOSAL_SHOW()
local _, _, _, _, _, _, _, _, totalEncounters, completedEncounters = GetLFGProposal()
local _, id, _, _, instanceName, _, _, _, _, completedEncounters = GetLFGProposal()
self.numKilledBosses = completedEncounters
if id == 416 or id == 417 then -- Siege of Wyrmrest Temple or Fall of Deathwing
self.locationName = "Dragon Soul"
else
self.locationName = instanceName
end
end
 
--======================================
789,7 → 794,7
 
-- Send to missed senders list
for sender in pairs(self.missedSenders) do
if IsInInstance() or not sender:find("-") then -- Do not reply cross-realm whisperes when out of instance
if type(sender) == "number" or IsInInstance() or not sender:find("-") then -- Do not reply cross-realm whisperes when out of instance
self:SendReply(replyMsg, sender)
end
end
942,6 → 947,7
self:RegisterEvent("CHAT_MSG_BN_WHISPER")
self:RegisterEvent("LFG_PROPOSAL_SHOW")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:RegisterEvent("PLAYER_LOGOUT")
954,6 → 960,7
self:UnregisterEvent("CHAT_MSG_BN_WHISPER")
self:UnregisterEvent("LFG_PROPOSAL_SHOW")
self:UnregisterEvent("PLAYER_REGEN_DISABLED")
self:UnregisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
self:UnregisterEvent("ZONE_CHANGED_NEW_AREA")
self:UnregisterEvent("PLAYER_LOGOUT")