Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- message('hi there')
- local on = "Interface\Icons\Ability_dualwield"
- local off = "Interface\Icons\Ability_warrior_ability_stealth"
- local running = "no"
- --CHARACTER
- local name = GetUnitName("player")
- local realm = GetRealmName()
- local gender = UnitSex("player")
- local race = UnitRace("player");
- local class = UnitClass("player")
- local spec = currentSpec and select(2, GetSpecializationInfo(currentSpec)) or ""
- local talent = ""
- local profession1 = GetProfessions(prof1)
- local profession2 = GetProfessions(prof2)
- if profession1 == nil then profession1 = "" end
- if profession2 == nil then profession2 = "" end
- if gender == 2 then gender = "Male" end
- if gender == 3 then gender = "Female" end
- if characters == nil then characters = "" end
- if duels == nil then duels = "" end
- characters = name .. "-" .. realm .. "," .. gender .. "," .. race .. "," .. class .. ",".. spec .. "," .. talent .. "," .. profession1 .. "," .. profession2
- --DUEL
- local buff = ""
- local buffs = ""
- local spell = ""
- local combat = ""
- local starttime = ""
- local endtime = ""
- local frame = CreateFrame("Frame")
- frame:RegisterEvent("CHAT_MSG_SYSTEM")
- frame:RegisterEvent("DUEL_REQUESTED")
- local function EventHandler(self,event,...)
- local arg1 = select(1,...)
- local requestcheck = strmatch(arg1, "requested")
- local duelerercheck = strmatch(arg1, "Duel starting: 3")
- local duelcheck = strmatch(arg1, "defeated")
- local charcheck = strmatch(arg1, GetUnitName("player"))
- local level = UnitLevel("player")
- arg1 = arg1:gsub(" has defeated ", "-" .. realm ..",")
- arg1 = arg1:gsub(" in a duel", "-" .. realm)
- --DUEL CHECK
- if status == "on" then
- if requestcheck then
- SendChatMessage("Rated Duel on", "WHISPER", "Common" ,GetUnitName("target"))
- end
- if event == "DUEL_REQUESTED" then
- SendChatMessage("Rated Duel on", "WHISPER", "Common" ,arg1)
- end
- else
- if requestcheck then
- SendChatMessage("Rated Duel off", "WHISPER", "Common" ,GetUnitName("target"))
- end
- if event == "DUEL_REQUESTED" then
- SendChatMessage("Rated Duel off", "WHISPER" ,"Common" ,arg1)
- end
- end
- --DUEL START
- if duelerercheck then
- running = "yes"
- --print(running)
- local WoWDuelLDB = LibStub("LibDataBroker-1.1"):NewDataObject("WoWDuel!", {
- type = "data source",
- text = "WoWDuel",
- icon = on,
- OnTooltipShow = function(tooltip) tooltip:AddLine("WoWDuel") end,
- OnClick = function() hide() end,
- })
- print("Rated Duel starting:")
- starttime = GetServerTime()
- for i=1,10 do
- local spellId = UnitBuff("player", i)
- typus = "A"
- if spellId then
- buff = GetServerTime() .. "-" .. spellId .. "-" .. "" .. "-" .. typus
- buffs = buffs .. buff .. "_"
- end
- end
- end
- --DUEL END
- if (duelcheck and charcheck and status == "on" and level <= 60) then --LEVEL = 60
- if combat == "" then combat = "," end
- local endtime = GetServerTime()
- Screenshot()
- duel = starttime .. "," .. endtime .. "," .. arg1 .. "," .. buffs .. combat
- duel = duel:sub(1, -2) .. ";"
- duels = duels .. duel
- --print('this was a rated duel')
- end
- if (duelcheck and charcheck and level <= 60) then
- running = "no"
- end
- end
- --COMBAT
- local playerGUID = UnitGUID("player")
- local f = CreateFrame("Frame")
- f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
- f:SetScript("OnEvent", function(self, event)
- self:OnEvent(event, CombatLogGetCurrentEventInfo())
- end)
- function f:OnEvent(event, ...)
- local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
- local spellId, spellName, spellSchool
- local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand
- if subevent == "SWING_DAMAGE" then
- typus = "D"
- amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
- spellId = "Autohit"
- elseif subevent == "RANGE_DAMAGE" then
- typus = "D"
- spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
- elseif subevent == "SPELL_DAMAGE" then
- typus = "D"
- spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
- elseif subevent == "SPELL_AURA_APPLIED" then
- typus = "A"
- spellId, spellName, spellSchool, auraType, amount = select(12, ...)
- elseif subevent == "SPELL_HEAL" then
- typus = "H"
- spellId, spellName, spellSchool, amount, overhealing, absorbed, critical = select(12, ...)
- end
- if amount == nil then amount = "" end
- if spellId == nil then spellId = "" end
- if typus == nil then typus = "" end
- if health == nil then health = "" end
- if sourceGUID == playerGUID then
- if (destName == GetUnitName("target")) then
- health = UnitHealth("target")
- end
- if (destName == GetUnitName("target")) then
- power = UnitPower("target")
- print(power)
- end
- spell = GetServerTime() .. "-" .. spellId .. "-" .. amount .. "-" .. typus .. "-" .. health .."_"
- combat = combat .. spell
- end
- end
- --COMBAT
- frame:SetScript("OnEvent", EventHandler)
- local addon = LibStub("AceAddon-3.0"):NewAddon("WoWDuel", "AceConsole-3.0")
- local WoWDuelLDB = LibStub("LibDataBroker-1.1"):NewDataObject("WoWDuel!", {
- type = "data source",
- text = "WoWDuel",
- icon = on,
- OnTooltipShow = function(tooltip) tooltip:AddLine("WoWDuel") end,
- OnClick = function() toggleRatedDuel() end,
- })
- local icon = LibStub("LibDBIcon-1.0")
- function toggleRatedDuel()
- CancelDuel()
- --print(running)
- if (running == 'no') then
- if (WoWDuelLDB.icon == on) then
- print("rated duel is now Off")
- WoWDuelLDB.icon = off
- status = "off"
- else
- WoWDuelLDB.icon = on
- print("rated duel is now On")
- status = "on"
- end
- end
- end
- function addon:OnInitialize()
- self.db = LibStub("AceDB-3.0"):New("WoWDuel", {
- profile = {
- minimap = {
- hide = false,
- },
- },
- })
- icon:Register("WoWDuel!", WoWDuelLDB, self.db.profile.minimap)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement