Guest User

Untitled

a guest
Apr 9th, 2023
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.52 KB | None | 0 0
  1. flocal GC_Sniffer = CreateFrame("Frame")
  2. GC_Sniffer:RegisterEvent("CHAT_MSG_OFFICER")
  3. GC_Sniffer:SetScript("OnEvent", function (self, event, message, sender)
  4. --команды для управления квестами
  5. local nik=sender
  6. local endQuests="простые_квесты"
  7. local qAchiv="взят_ли_квест_простая_ачивка"
  8. local timeLimit="время_последнего_обращения"
  9. local str = string.gsub(message, "%s+", "")
  10. function all_trim(s)
  11.     return s:match( "^%s*(.-)%s*$" )
  12. end
  13. function mysplit (inputstr, sep)
  14.     if sep == nil then
  15.         sep = "%s"
  16.         end
  17.         local t={}
  18.         for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  19.             table.insert(t, str)
  20.         end
  21.         return t
  22. end
  23. function tablelength(T)
  24.     local count = 0
  25.     for _ in pairs(T) do count = count + 1 end
  26.     return count
  27. end
  28. function hashStr (nome)
  29.     hours, minutes = GetGameTime()
  30.     count1=hours* 3.1415926535
  31.     count2=minutes* 3.1415926535
  32.     count3=count1*count2
  33.     count3=string.sub(count3, 1, 3)
  34.     count3=string.format("%03d",count3)
  35.     hNik=string.byte(nome,1)
  36.     hNik2=string.byte(nome,2)
  37.     hNome=hNik*hNik2
  38.     hNome=string.sub(hNome, 1, 3)
  39.     hNome=string.format("%03d",hNome)
  40.     r1=string.sub(count3, 1, 1)
  41.     r2=string.sub(hNome, 1, 1)
  42.     r3=string.sub(count3, 2, 2)
  43.     r4=string.sub(hNome, 2, 2)
  44.     r5=string.sub(count3, 3, 3)
  45.     r6=string.sub(hNome, 3, 3)
  46.     r=r1 .. r2 .. r3 .. r4 .. r5 .. r6
  47.     return r
  48. end
  49. hsh=hashStr(sender)
  50. print (hsh)
  51. if TDG[sender]==nil then
  52.     TDG[sender]={}
  53. end
  54. if TDG[nik][endQuests] == nil then
  55.     TDG[nik][endQuests]={}
  56. end
  57. if pQuests == nil then
  58.     pQuests={}
  59. end
  60. if pQuests[1] == nil then
  61.    pQuests[1]={}
  62. end
  63. if pQuests[2] == nil then
  64.     pQuests[2]={}
  65. end
  66. if pQuests[3] == nil then
  67.     pQuests[3]={}
  68. end
  69. local nachalo = string.sub(message, 1, 1)
  70.     print (str)
  71.     print (message)
  72.     if message == "ВОЖДЬ, простой!" and nachalo~="*" then
  73.         if TDG[sender]==nil then
  74.             TDG[sender]={}
  75.         end
  76.         if TDG[sender][endQuests]==nil then
  77.             TDG[sender][endQuests]={}
  78.         end
  79.         local guokTimerStart=pQuests[1][1]
  80.         if TDG[sender][endQuests][guokTimerStart]~=nil then
  81.             if TDG[sender][qAchiv]==nil of TDG[sender][qAchiv]=="9999" then
  82.                 countQ=tablelength(pQuests[1])
  83.                 local chisloProstyhQComplit=0
  84.                 chisloProstyhQComplit=tonumber(chisloProstyhQComplit)
  85.                 for testQ=1, countQ do
  86.                     local x = math.random(1, countQ)
  87.                     ach=pQuests[1][x]
  88.                     if TDG[sender][endQuests][x]~="1" then
  89.                         SendChatMessage(hsh .. " 001 " .. sender .. ", покажи мне ачивку " .. ach .. " " .. GetAchievementLink(ach), "OFFICER", nil, 1)
  90.                         break
  91.                     else
  92.                         chisloProstyhQComplit=chisloProstyhQComplit + 1
  93.                         if chisloProstyhQComplit==countQ then
  94.                             SendChatMessage("*" .. sender .. ", все простые квесты уже выполнены. Добавить переход на следущий уровень квестов.", "OFFICER", nil, 1)
  95.                         end
  96.                     end
  97.                 end
  98.             else
  99.                 ach=TDG[sender][qAchiv]
  100.                 SendChatMessage(hsh .. " 004 " .. sender .. ", у тебя уже взят квест: " .. ach .. GetAchievementLink(ach), "OFFICER", nil, 1)
  101.             end
  102.         else
  103.             ach=pQuests[1][1]
  104.             SendChatMessage(hsh .. " 001 " .. sender .. ", покажи мне ачивку " .. ach .. " " .. GetAchievementLink(ach), "OFFICER", nil, 1)
  105.         end
  106.     end
  107.  
  108.     if string.find (message, hsh) and string.find (message, "002") then
  109.         msg1=mysplit(message)
  110.         msg1=msg[6]
  111.         TDG[sender][endQuests][msg1]="1"
  112.     end
  113.  
  114.  
  115.  
  116.  
  117. end
  118. )
  119.  
Add Comment
Please, Sign In to add comment