#NoEnv
#SingleInstance, Force
#Persistent
Menu, Tray, NoStandard
Menu, Tray, add, % "Инструкция", about
Menu, Tray, add, Закрыть, leave
global mainPach := ""
SerchScreenPenta()
global chatLog := new LogRead(mainPach, 0)
global _timer := 600
global timer := _timer
calc := ComObjCreate("ScriptControl")
calc.Language := "VBScript"
SetTimer, Chat, 150
SetTimer, Timer, 1000
return
Chat:
messages := chatLog.getLastStr()
for k, v in messages
{
if (RegExMatch(v, "\[Викторина\] Первый игрок, решивший (.*) (\+|\-|\*|\/) (.*), выиграет .* монет.", chattext))
{
timer := _timer
SoundBeep
result := calc.Eval(chattext1 " " chattext2 " " chattext3)
output := "| Ответ: " result
copy(result)
}
else if (RegExMatch(v, "\[Викторина\] Первый игрок, правильно ответивший на вопрос ниже, выиграет .* монет.") && RegExMatch(messages[k + 1], "\[CHAT\] (.*)", out_pars))
{
timer := _timer
SoundBeep
RegExMatch(GET("https://baza-otvetov.ru/search/view/?q=" out_pars1), "U)<h3><span>Вопрос: <\/span>.*<\/h3>\s+<h3><span>Ответ: <\/span>(.*)<\/h3>", out)
output := "| " (out1 ? "Ответ: " out1 : "Ответ не найден")
copy(out1)
}
}
Return
about:
MsgBox,, Инструкция, % "Об скрипте`nСкрипт был сделать для фарма местной валюты.`nДанный скрипт имеет 99% ответ на все вопросы викторины.`nСКРИПТ НЕ ДЛЯ ПРОДАЖИn`n`nИнструкция`n1)Запустить Ваш сервер PentaCraft.`n2)Запустить скрипт`n3)С вверху должен появится таймер, если он есть тогда вы сделали --всё верно.`n4)Как только викторина объявится в чат поступит звуковое --оповещение, и с сверху покажет возможный ответ на вопрос.`n--Так же ответ с копируется в буфер обмена, это значит что можно --открыть чат и нажать сочетание клавиш Ctrl + V`n"
return
leave:
ExitApp
Timer:
WinGetTitle, title, A
timer--
if (RegExMatch(title, "Pentacraft .*"))
ToolTip, % "До викторины: " times(timer) " " output , 7, 0
else
ToolTip
Return
times(sec)
{
h := sec/3600 ^ 0
m := (sec-h*3600)/60 ^ 0
s := sec-h*3600-m*60
return "~" m " мин. " s " сек."
}
SerchScreenPenta()
{
ToolTip, % "Поиск окна Pentacraft: Это не то окно.`nЕсли что-то не понятно прочти инструкцию" , 7, 0
While(True)
{
WinGetTitle, title, A
if (RegExMatch(title, "Pentacraft\s+(?<Server>Galaxy|Evo|Tria|Lite|Chaos|Sky|MagicRPG|Epsilon)\s+\[[A-z]+\](\s+\[.*\]|)\s+\[[0-9.]+\]", out))
{
for Process in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process where Name='javaw.exe'")
RegExMatch(process.ExecutablePath, "(?<Pach>.*)\\.*\\bin\\javaw\.exe", out)
location:= [outPach "\" outServer "\logs\latest.log", outPach "\" outServer "-Shaders\logs\latest.log"]
if (FileExist(location[1]) && FileExist(location[2]))
{
if(getTimeFile(location[1]) > getTimeFile(location[2]))
mainPach := location[1]
else
mainPach := location[2]
Break
}
else if (FileExist(location[1]))
{
mainPach := location[1]
Break
}
else if (FileExist(location[2]))
{
mainPach := location[2]
Break
}
else
{
ToolTip
MsgBox, 0x10, Ошибка, % "Не удалось распознать игру"
ExitApp
}
}
}
}
getTitle()
{
WinGetTitle, title, A
return title
}
getTimeFile(param)
{
FileGetTime, OutputVar, % param
return OutputVar
}
Copy(Text, LocaleID=0x419)
{
CF_TEXT:=1, CF_LOCALE:=16, GMEM_MOVEABLE:=2
TextLen :=StrLen(Text)
HmemText :=DllCall("GlobalAlloc", "UInt", GMEM_MOVEABLE, "UInt", TextLen+1)
HmemLocale:=DllCall("GlobalAlloc", "UInt", GMEM_MOVEABLE, "UInt", 4)
If(!HmemText || !HmemLocale)
Return
PtrText :=DllCall("GlobalLock", "UInt", HmemText)
PtrLocale :=DllCall("GlobalLock", "UInt", HmemLocale)
DllCall("msvcrt\memcpy", "UInt", PtrText, "Str", Text, "UInt", TextLen+1, "Cdecl")
NumPut(LocaleID, PtrLocale+0)
DllCall("GlobalUnlock", "UInt", HmemText)
DllCall("GlobalUnlock", "UInt", HmemLocale)
If not DllCall("OpenClipboard", "UInt", 0)
{
DllCall("GlobalFree", "UInt", HmemText)
DllCall("GlobalFree", "UInt", HmemLocale)
Return
}
DllCall("EmptyClipboard")
DllCall("SetClipboardData", "UInt", CF_TEXT, "UInt", HmemText)
DllCall("SetClipboardData", "UInt", CF_LOCALE, "UInt", HmemLocale)
DllCall("CloseClipboard")
}
GET(adress)
{
WinHTTP := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
WinHTTP.Open("GET", adress, 0)
WinHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:65.0) Gecko/20100101 Firefox/65.0")
WinHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
WinHTTP.SetRequestHeader("Pragma", "no-cache")
WinHTTP.SetRequestHeader("Cache-Control", "no-cache, no-store")
WinHTTP.SetRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT")
WinHTTP.Send("")
Return WinHTTP.ResponseText
}
class LogRead
{
__New(LogWay)
{
this.LogWay := LogWay
this.sizeLast := 0
}
getLastStr()
{
FileGetSize, fileSize, % this.LogWay
if(fileSize <= this.sizeLast || this.sizeLast == 0)
{
this.sizeLast := fileSize
Return
}
file := FileOpen(this.LogWay, "r")
file.Seek(this.sizeLast)
fileText := file.Read()
file.Close()
this.sizeLast := fileSize
Return StrSplit(fileText, "`r`n")
}
}