Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.03 KB | None | 0 0
  1. message('hi there')
  2.  
  3. local on = "Interface\Icons\Ability_dualwield"
  4. local off = "Interface\Icons\Ability_warrior_ability_stealth"
  5. local running = "no"
  6.  
  7. --CHARACTER
  8. local name = GetUnitName("player")
  9. local realm = GetRealmName()
  10. local gender = UnitSex("player")
  11. local race = UnitRace("player");
  12. local class = UnitClass("player")
  13. local spec = currentSpec and select(2, GetSpecializationInfo(currentSpec)) or ""
  14. local talent = ""
  15. local profession1 = GetProfessions(prof1)
  16. local profession2 = GetProfessions(prof2)
  17. if profession1 == nil then profession1 = "" end
  18. if profession2 == nil then profession2 = "" end
  19. if gender == 2 then gender = "Male" end
  20. if gender == 3 then gender = "Female" end
  21. if characters == nil then characters = "" end
  22. if duels == nil then duels = "" end
  23.  
  24. characters = name .. "-" .. realm .. "," .. gender .. "," .. race .. "," .. class .. ",".. spec .. "," .. talent .. "," .. profession1 .. "," .. profession2
  25.  
  26.  
  27. --DUEL
  28. local buff = ""
  29. local buffs = ""
  30. local spell = ""
  31. local combat = ""
  32. local starttime = ""
  33. local endtime = ""
  34.  
  35. local frame = CreateFrame("Frame")
  36. frame:RegisterEvent("CHAT_MSG_SYSTEM")
  37. frame:RegisterEvent("DUEL_REQUESTED")
  38.  
  39. local function EventHandler(self,event,...)
  40. local arg1 = select(1,...)
  41. local requestcheck = strmatch(arg1, "requested")
  42. local duelerercheck = strmatch(arg1, "Duel starting: 3")
  43. local duelcheck = strmatch(arg1, "defeated")
  44. local charcheck = strmatch(arg1, GetUnitName("player"))
  45. local level = UnitLevel("player")
  46.  
  47. arg1 = arg1:gsub(" has defeated ", "-" .. realm ..",")
  48. arg1 = arg1:gsub(" in a duel", "-" .. realm)
  49.  
  50. --DUEL CHECK
  51. if status == "on" then
  52. if requestcheck then
  53. SendChatMessage("Rated Duel on", "WHISPER", "Common" ,GetUnitName("target"))
  54. end
  55.  
  56. if event == "DUEL_REQUESTED" then
  57. SendChatMessage("Rated Duel on", "WHISPER", "Common" ,arg1)
  58. end
  59. else
  60. if requestcheck then
  61. SendChatMessage("Rated Duel off", "WHISPER", "Common" ,GetUnitName("target"))
  62. end
  63.  
  64. if event == "DUEL_REQUESTED" then
  65. SendChatMessage("Rated Duel off", "WHISPER" ,"Common" ,arg1)
  66. end
  67. end
  68.  
  69. --DUEL START
  70. if duelerercheck then
  71. running = "yes"
  72. --print(running)
  73. local WoWDuelLDB = LibStub("LibDataBroker-1.1"):NewDataObject("WoWDuel!", {
  74. type = "data source",
  75. text = "WoWDuel",
  76. icon = on,
  77. OnTooltipShow = function(tooltip) tooltip:AddLine("WoWDuel") end,
  78. OnClick = function() hide() end,
  79. })
  80. print("Rated Duel starting:")
  81. starttime = GetServerTime()
  82.  
  83. for i=1,10 do
  84. local spellId = UnitBuff("player", i)
  85. typus = "A"
  86.  
  87. if spellId then
  88. buff = GetServerTime() .. "-" .. spellId .. "-" .. "" .. "-" .. typus
  89. buffs = buffs .. buff .. "_"
  90. end
  91. end
  92. end
  93.  
  94. --DUEL END
  95.  
  96. if (duelcheck and charcheck and status == "on" and level <= 60) then --LEVEL = 60
  97. if combat == "" then combat = "," end
  98. local endtime = GetServerTime()
  99. Screenshot()
  100. duel = starttime .. "," .. endtime .. "," .. arg1 .. "," .. buffs .. combat
  101. duel = duel:sub(1, -2) .. ";"
  102. duels = duels .. duel
  103. --print('this was a rated duel')
  104. end
  105. if (duelcheck and charcheck and level <= 60) then
  106. running = "no"
  107. end
  108. end
  109.  
  110.  
  111. --COMBAT
  112. local playerGUID = UnitGUID("player")
  113. local f = CreateFrame("Frame")
  114. f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  115. f:SetScript("OnEvent", function(self, event)
  116. self:OnEvent(event, CombatLogGetCurrentEventInfo())
  117. end)
  118. function f:OnEvent(event, ...)
  119. local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
  120. local spellId, spellName, spellSchool
  121. local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand
  122.  
  123. if subevent == "SWING_DAMAGE" then
  124. typus = "D"
  125. amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
  126. spellId = "Autohit"
  127.  
  128. elseif subevent == "RANGE_DAMAGE" then
  129. typus = "D"
  130. spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
  131.  
  132. elseif subevent == "SPELL_DAMAGE" then
  133. typus = "D"
  134. spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
  135.  
  136. elseif subevent == "SPELL_AURA_APPLIED" then
  137. typus = "A"
  138. spellId, spellName, spellSchool, auraType, amount = select(12, ...)
  139.  
  140. elseif subevent == "SPELL_HEAL" then
  141. typus = "H"
  142. spellId, spellName, spellSchool, amount, overhealing, absorbed, critical = select(12, ...)
  143. end
  144.  
  145. if amount == nil then amount = "" end
  146. if spellId == nil then spellId = "" end
  147. if typus == nil then typus = "" end
  148. if health == nil then health = "" end
  149.  
  150. if sourceGUID == playerGUID then
  151. if (destName == GetUnitName("target")) then
  152. health = UnitHealth("target")
  153. end
  154. if (destName == GetUnitName("target")) then
  155. power = UnitPower("target")
  156. print(power)
  157. end
  158. spell = GetServerTime() .. "-" .. spellId .. "-" .. amount .. "-" .. typus .. "-" .. health .."_"
  159. combat = combat .. spell
  160.  
  161.  
  162.  
  163. end
  164. end
  165. --COMBAT
  166.  
  167. frame:SetScript("OnEvent", EventHandler)
  168.  
  169.  
  170. local addon = LibStub("AceAddon-3.0"):NewAddon("WoWDuel", "AceConsole-3.0")
  171. local WoWDuelLDB = LibStub("LibDataBroker-1.1"):NewDataObject("WoWDuel!", {
  172. type = "data source",
  173. text = "WoWDuel",
  174. icon = on,
  175. OnTooltipShow = function(tooltip) tooltip:AddLine("WoWDuel") end,
  176. OnClick = function() toggleRatedDuel() end,
  177. })
  178. local icon = LibStub("LibDBIcon-1.0")
  179.  
  180. function toggleRatedDuel()
  181. CancelDuel()
  182. --print(running)
  183. if (running == 'no') then
  184. if (WoWDuelLDB.icon == on) then
  185. print("rated duel is now Off")
  186. WoWDuelLDB.icon = off
  187. status = "off"
  188. else
  189. WoWDuelLDB.icon = on
  190. print("rated duel is now On")
  191. status = "on"
  192. end
  193. end
  194. end
  195.  
  196.  
  197. function addon:OnInitialize()
  198.  
  199. self.db = LibStub("AceDB-3.0"):New("WoWDuel", {
  200. profile = {
  201. minimap = {
  202. hide = false,
  203. },
  204. },
  205. })
  206. icon:Register("WoWDuel!", WoWDuelLDB, self.db.profile.minimap)
  207.  
  208. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement