Skip to content

Commit

Permalink
examples: wowjump remove stat
Browse files Browse the repository at this point in the history
  • Loading branch information
whtiehack committed Jul 1, 2024
1 parent eb665f7 commit f0b3896
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 118 deletions.
3 changes: 0 additions & 3 deletions examples/wowjump/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/whtiehack/wingui/winapi"
"log"
"math/rand"
"strconv"
"time"

"github.com/lxn/win"
Expand Down Expand Up @@ -82,8 +81,6 @@ func (l *Logout) input() {
log.Println(l.hwnd, "小退中。。。", l.subTime)
if !l.logout() {
l.subTime = 0
} else {
stat.Stat("/logout/"+strconv.Itoa(l.count), "wowjump-logout")
}
return
}
Expand Down
7 changes: 0 additions & 7 deletions examples/wowjump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"strconv"
"syscall"

"github.com/lxn/win"
Expand All @@ -13,7 +12,6 @@ import (

var dlg *wingui.Dialog
var out *wingui.Edit
var stat *Statistics

// ProcessMutex 防止进程多开,返回 true 表示进程已经开启
func ProcessMutex(name string) bool {
Expand All @@ -34,7 +32,6 @@ func init() {
win.MessageBox(0, &syscall.StringToUTF16("进程已经开启了,不可以多开")[0], nil, 0)
os.Exit(-1)
}
stat = NewStatistics("https://smallwhite.ml/wingui/wowjump", "d36d3fe91a80f7e10b5757b91896bc98")
// control
go process()
}
Expand Down Expand Up @@ -66,7 +63,6 @@ func main() {
config.editInputTime, config.editCharWaitTime, config.btnCheckChangeChar, config.btnCheckLogoutFlash)
config.flashHwnd = dlg.Handle()
config.InitVal()
go stat.Stat("/main", "wowjump-main")
dlg.Show()
setLogOutput(editLog)
// Make sure Tabstop can work.
Expand Down Expand Up @@ -112,7 +108,6 @@ func btnClick() {
if len(logouts) == 0 {
running = !running
log.Println("没有找到WOW窗口,如果确认已经开启了wow窗口\n可以使用管理员身份运行程序试试")
go stat.Stat("/cancel", "wowjump-cancel")
return
}
out.SetText("")
Expand All @@ -122,10 +117,8 @@ func btnClick() {
//config.SkillKey = str
//randomSkill.ParseSkillKey(str)
log.Println("开始运行")
go stat.Stat("/start", "wowjump-start:"+strconv.Itoa(len(logouts)))
} else {
log.Println("已经停止运行")
go stat.Stat("/stop", "wowjump-stop")
}
config.EditEnable(!running)
btn.SetText(text)
Expand Down
108 changes: 0 additions & 108 deletions examples/wowjump/utils.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package main

import (
"github.com/whtiehack/wingui/winapi"
"log"
"math/rand"
"net"
"net/url"
"strconv"
"time"
"unsafe"

Expand Down Expand Up @@ -114,107 +110,3 @@ func randomMoveMouse() {
//mouse_move(x, y, 0, win.MOUSEEVENTF_LEFTUP)

}

type Statistics struct {
prevTime time.Time
si string
curPath string
params url.Values
baseUrl string
lt int
}

func NewStatistics(baseUrl string, si string) *Statistics {
params := url.Values{}
params.Add("cc", "1")
params.Add("ck", "1")
params.Add("cl", "24-bit")
params.Add("ds", strconv.Itoa(int(win.GetSystemMetrics(win.SM_CXSCREEN)))+"x"+strconv.Itoa(int(win.GetSystemMetrics(win.SM_CYSCREEN))))
params.Add("vl", "797")
params.Add("et", "0")
params.Add("ja", "0")
params.Add("ln", "zh-cn")
lang := winapi.GetSystemDefaultLocaleName()
if lang != "" {
params.Set("ln", lang)
}
params.Add("lo", "0")
// params.Add("rnd", "0")
params.Add("si", si)
params.Add("v", "1.2.61")
params.Add("lv", "2")
// params.Add("sn", "30541")
return &Statistics{baseUrl: baseUrl, lt: 0, si: si, params: params}
}

func (s *Statistics) Stat(path string, title string) {
// tt title
// ep 停留时间,活跃时间
// et 初始进入页面 0, 当前页面有时间 3
// rnd 随机数
// su 前一个页面 离开页面时
// ct 新的一个页面开始 !!
val, _ := url.ParseQuery(s.params.Encode())
val.Set("rnd", strconv.Itoa(int(rand.Int31())))
val.Set("sn", strconv.Itoa(int(time.Now().Unix()%65535)))
if s.lt != 0 && int(time.Now().Unix())-s.lt > 2592e3 {
s.lt = int(time.Now().Unix())
}
if s.lt != 0 {
val.Set("lt", strconv.Itoa(s.lt))
}
if s.curPath == "" {
// 第一次打开
val.Set("ct", "!!")
val.Set("tt", title)
val.Set("et", "0")
s.get(val.Encode(), s.baseUrl+path)
} else {
// 离开页面
val.Set("et", "3")
t := time.Now().Sub(s.prevTime).Milliseconds()
ep := strconv.Itoa(int(t)) + "," + strconv.Itoa(int(t))
val.Set("ep", ep)
prevPath := s.baseUrl + s.curPath
s.get(val.Encode(), prevPath)
val.Set("rnd", strconv.Itoa(int(rand.Int31())))
// 进入新页面
val.Set("u", prevPath)
s.get(val.Encode(), s.baseUrl+path)
val.Set("rnd", strconv.Itoa(int(rand.Int31())))
val.Del("u")
val.Set("su", prevPath)
val.Set("tt", title)
val.Del("ep")
val.Set("et", "0")
val.Set("ct", "!!")

if int(time.Now().Unix())-s.lt > 2592e3 {
s.lt = int(time.Now().Unix())
}
val.Set("lt", strconv.Itoa(s.lt))
s.get(val.Encode(), s.baseUrl+path)
}
s.prevTime = time.Now()
s.curPath = path
}

func (s *Statistics) get(params string, referer string) error {
conn, err := net.Dial("tcp", "hm.baidu.com:80")
if err != nil {
print("what err:", err, "\n")
return err
}
defer conn.Close()
_, err = conn.Write([]byte("GET /hm.gif?" + params + " HTTP/1.1\r\n" +
"User-Agent: Wingui\r\n" +
"Referer: " + referer + "\r\n" +
"Host: hm.baidu.com\r\n" +
"Connection: close\r\n" +
"\r\n\r\n"))
if err != nil {
print("write err:", err, "\n")
return err
}
return nil
}

0 comments on commit f0b3896

Please sign in to comment.