Advertisement
alexdubovyck

Если в чате находит слово - выполняет действие.

Jan 30th, 2016
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. if not dreamsay then
  2.  
  3. CreateFrame("Frame","lapy")
  4. lapy:RegisterEvent("CHAT_MSG_SAY")
  5. lapy:RegisterEvent("CHAT_MSG_YELL")
  6. lapy:RegisterEvent("CHAT_MSG_RAID")
  7. lapy:RegisterEvent("CHAT_MSG_PARTY")
  8. lapy:RegisterEvent("CHAT_MSG_WHISPER")
  9.  
  10. lapy:SetScript("OnEvent",function(self,event,...)
  11. local arg={...}
  12. -- if arg[1]=="Лапу" then CastSpellByName("Дар дикой природы") end
  13.  
  14. local lapytext = {"Лапу","лапу","лапку","Лапку","баф","lapy","lapu","бафните","бафни"}
  15. local i
  16.  
  17. for i = 1, #lapytext do
  18.     if string.find(arg[1],lapytext[i])
  19.     and UnitAffectingCombat("player") == nil then
  20.     -- Cast(48470)
  21.     CastSpellByName("Дар дикой природы")
  22.     end
  23. end
  24.  
  25.  
  26. end)
  27.  
  28. dreamsay = true end
  29.  
  30.  
  31.  
  32.  
  33.  
  34. -- lapy:RegisterEvent("CHAT_MSG_CHANNEL")
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. -- Group setting
  43. if IsInRaid() then group = "raid"
  44.     elseif IsInGroup() then group = "party" end
  45.  
  46. if GetNumGroupMembers() > 0 then
  47.     -- Loop party or raid members
  48.     for i=1,GetNumGroupMembers() do
  49.         local member = group..i
  50.        
  51.         -- Do not dispel these spells
  52.         local blackList = {}
  53.        
  54.         -- Dispel Type
  55.         local dispelType = {Magic,Disease}
  56.        
  57.         -- At any given time, we can only have a total of 40 debuffs
  58.         for i=1,40 do
  59.             -- Loop our dispelTypes
  60.             for x=1,#dispelType do
  61.                 -- Only fetch debuffs matching dispelType
  62.                 if select(5,UnitDebuff(member,i)) == dispelType[x] then
  63.                     -- If it's blacklisted, don't dispel it
  64.                     for i=1,#blackList do
  65.                         if UnitDebuff(member,blackList[i]) then return false end
  66.                     end
  67.                    
  68.                     -- At this point, we've cross referenced everything - Proceed
  69.                     return true
  70.                 end
  71.             end
  72.         end
  73.     end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement