Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pldcanfly committed Aug 20, 2019
1 parent 73ec207 commit b09e688
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
local _, SimpleAutoCombatLog = ...;

L = SimpleAutoCombatLog.L;

SimpleAutoCombatLog.Zones = {
["ZoneOnly"] = { -- Only Zone must be entered
L["The Molten Core"],
L["Blackwing Lair"],
L["Onyxia's Lair"],
L["Ruins of Ahn'Qiraj"],
L["Ahn'Qiraj"],
L["Zul'Gurub"],
L["Naxxramas"],
},
["ZoneAndMob"] = { -- A Zone must be entered and a Mob must be targeted
["Zones"] = {
L["Duskwood"],
L["Hinterlands"],
L["Feralas"],
L["Ashenvale"],
L["Blasted Lands"],
L["Azshara"],
},
["Mobs"] = {
L["Emeriss"],
L["Lethon"],
L["Ysondre"],
L["Taerar "],
L["Doomlord Kazzak"],
L["Azuregos"],
}
}



}
42 changes: 42 additions & 0 deletions Localization.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
local _, SimpleAutoCombatLog = ...;

SimpleAutoCombatLog.L = {};

local function defaultFunc(L, key)
-- If this function was called, we have no localization for this key.
-- We could complain loudly to allow localizers to see the error of their ways,
-- but, for now, just return the key as its own localization. This allows you to—avoid writing the default localization out explicitly.
return key;
end
setmetatable(SimpleAutoCombatLog.L, {__index=defaultFunc});

if GetLocale() == "deDE" then
-- Zones
SimpleAutoCombatLog.L["The Molten Core"] = "Der Geschmolzene Kern";
SimpleAutoCombatLog.L["Onyxia's Lair"] = "Onyxias Hort";
SimpleAutoCombatLog.L["Blackwing Lair"] = "Pechschwingenhort";
SimpleAutoCombatLog.L["Ruins of Ahn'Qiraj"] = "Ruinen von Ahn'Qiraj";
SimpleAutoCombatLog.L["Ahn'Qiraj"] = "Ahn'Qiraj";
SimpleAutoCombatLog.L["Zul'Gurub"] = "Zul'Gurub";
SimpleAutoCombatLog.L["Naxxramas"] = "Naxxramas";

SimpleAutoCombatLog.L["Azshara"] = "Azshara";
SimpleAutoCombatLog.L["Blasted Lands"] = "Verwüstete Lande";
SimpleAutoCombatLog.L["Hinterlands"] = "Hinterland";
SimpleAutoCombatLog.L["Ashenvale"] = "Ashenvale";
SimpleAutoCombatLog.L["Feralas"] = "Feralas";
SimpleAutoCombatLog.L["Duskwood"] = "Dämmerwald";

-- Text
SimpleAutoCombatLog.L["Combatlog enabled"] = "Kampflog aktiviert";
SimpleAutoCombatLog.L["Combatlog disabled"] = "Kampflog deaktiviert";

-- Mobs
SimpleAutoCombatLog.L["Emeriss"] = "Emeriss";
SimpleAutoCombatLog.L["Lethon"] = "Lethon";
SimpleAutoCombatLog.L["Ysondre"] = "Ysondre";
SimpleAutoCombatLog.L["Taerar"] = "Taerar";
SimpleAutoCombatLog.L["Lord Kazzak"] = "Lord Kazzak";
SimpleAutoCombatLog.L["Azuregos"] = "Azuregos";

end
63 changes: 63 additions & 0 deletions SimpleAutoCombatLog.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
local addonName, SimpleAutoCombatLog = ...;

local EventHandler = CreateFrame("Frame");
local LookForMob = false;

EventHandler:RegisterEvent("ZONE_CHANGED_NEW_AREA");
EventHandler:RegisterEvent("PLAYER_TARGET_CHANGED");

EventHandler:SetScript("OnEvent", function(self, event, ...)

if event == "ZONE_CHANGED_NEW_AREA" then
SimpleAutoCombatLog:OnZoneChanged(...);
elseif LookForMob and event == "PLAYER_TARGET_CHANGED" then
SimpleAutoCombatLog:OnTargetChanged(...);
end
end);


function SimpleAutoCombatLog:OnZoneChanged(...)
local zone = GetRealZoneText();

if self:IsInList( self.Zones.ZoneOnly, zone ) then -- No Mob needs to be tagged
self:StartLog();
elseif self:IsInList( self.Zones.ZoneAndMob.Zones, zone ) then -- No Mobs need to be tagged
LookForMob = true;
else
self:StopLog();
LookForMob = false;
end

end

function SimpleAutoCombatLog:OnTargetChanged(...)
local name = UnitName("target");
if self:IsInList( self.Zones.ZoneAndMob.Mobs, name ) then
self:StartLog();
end
end

function SimpleAutoCombatLog:StartLog()
if not LoggingCombat() then
LoggingCombat(true);
print("|cffffff00".. L["Combatlog enabled"] .."|r");
SetCVar("advancedCombatLogging", 1);
end

end

function SimpleAutoCombatLog:StopLog()
if LoggingCombat() then
LoggingCombat(false);
print("|cffffff00".. L["Combatlog disabled"] .."|r");
end
end

function SimpleAutoCombatLog:IsInList( list, search_value )
for _, value in pairs( list ) do
if value == search_value then
return true;
end
end
return false;
end
9 changes: 9 additions & 0 deletions SimpleAutoCombatLog.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Interface: 11302
## Title: |cff00ccffSimpleAutoCombatLog|r
## Author: |cff00ccffKessedy|r
## Version: 1.0
## Notes: Automatically starts /combatlog for raids

Localization.lua
Config.lua
SimpleAutoCombatLog.lua

0 comments on commit b09e688

Please sign in to comment.