Skip to content

Commit

Permalink
Tentool yadisk support (#14)
Browse files Browse the repository at this point in the history
* Support downloads from yadisk. Closes #5 #6 #8
  • Loading branch information
dnovikoff committed Dec 5, 2018
1 parent 8b58077 commit f9e634a
Show file tree
Hide file tree
Showing 157 changed files with 24,954 additions and 4,467 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gobin
88 changes: 75 additions & 13 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,11 @@
# unused-packages = true


[[constraint]]
branch = "master"
name = "github.com/dnovikoff/tempai-core"
required = ["github.com/golang/protobuf/protoc-gen-go"]

[[constraint]]
branch = "master"
name = "github.com/facebookgo/stackerr"

[[constraint]]
branch = "master"
name = "github.com/hashicorp/go-multierror"
name = "github.com/dnovikoff/tempai-core"

[prune]
go-tests = true
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
gobin:
mkdir gobin

gobin/protoc-gen-go: gobin
go build -o ./gobin/protoc-gen-go ./vendor/github.com/golang/protobuf/protoc-gen-go

# github.com/golang/protobuf/protoc-gen-go
CMD := protoc --plugin=protoc-gen-go=./gobin/protoc-gen-go --go_out=paths=source_relative,plugins=grpc:./genproto --proto_path=./proto

generate: gobin/protoc-gen-go
rm -rf genproto
mkdir genproto
# cd proto &&
$(CMD) ./proto/stats/*.proto

test:
go test ./...
120 changes: 5 additions & 115 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,121 +11,11 @@ This package contains functions for parsing/generating:
2. Client messages
3. Server messages

## Howto use proxy server
I've made this small proxy for researching tenhou.net flash client protocol content.
## Proxy logging server
See documentation [here](cmd/tenhou-proxy/README.md)

Download application
```
go get -u github.com/dnovikoff/tenhou/cmd/tenhou-proxy
```

Run application
```
$GOPATH/bin/tenhou-proxy
```

Add to your `hosts` file
```
127.0.0.1 b.mjv.jp
```

Login into flash client http://tenhou.net/0/ .
Application output would look like
```
2018/01/27 00:26:42 Started server on addr ':10080'. Sequence id is 'baab75ab'
2018/01/27 00:26:55 File for new connection is 'baab75ab_0001.log'
2018/01/27 00:26:55 Error: EOF
2018/01/27 00:26:55 Error: Read context done
2018/01/27 00:26:55 Done with 1
2018/01/27 00:26:55 File for new connection is 'baab75ab_0002.log'
2018/01/27 00:26:56 Error: EOF
2018/01/27 00:26:56 Error: Read context done
2018/01/27 00:26:56 Done with 2
2018/01/27 00:26:57 File for new connection is 'baab75ab_0003.log'
```

Protocol logs will appear in workdir.
Short example of log result.
```
Send: <Z />
Send: <HELO name="NoName" tid="f0" sx="M" />
Get: <HELO uname="%4E%6F%4E%61%6D%65" auth="20180127-c5f19a8e" ratingscale="PF3=1.000000&PF4=1.000000&PF01C=0.582222&PF02C=0.501632&PF03C=0.414869&PF11C=0.823386&PF12C=0.709416&PF13C=0.586714&PF23C=0.378722&PF33C=0.535594&PF1C00=8.000000"/>
Send: <AUTH val="20180127-e3afc0df"/>
Send: <PXR V="1" />
Send: <PXR V="1" />
Get: <LN n="bw1aJ1Pm1y" j="B8C4B11B1D4B8D4D24C3C2C3C1B2C2C" g="o4CM3E1Q12Co4g12BM4M12Q12D1e2P2J2G1G1P1D1G2G"/>
Send: <Z />
Get: <LN n="by1aL1Ph1BC" j="B4B4D4B8C3B5B8D4D12B12C3B5C1B4B" g="o4CM3E1Q12Co4k12BM4M12Q12D1e2M2M2G1G1P1D1J2G"/>
Send: <PXR V="129" />
```

## pimbooo example server
Pimboo (Pin-Man-Bamboo) is a small example server for a game of two players.
The server is created in demonstration purposes only and does not aim for a production.

Download example server
```
go get -u github.com/dnovikoff/tenhou/cmd/pimboo-server
```

Run application
```
$GOPATH/bin/pimboo-server
```

Add to your `hosts` file
```
127.0.0.1 b.mjv.jp
```

1. Login into flash client http://tenhou.net/0/ .
2. Click on any lobby
3. See start of the game

![Example of game](https://raw.githubusercontent.com/dnovikoff/tenhou/master/cmd/pimboo-server/example.gif)

The server suggests Ron on any opponent drop and Tsumo on any take.
If you call a Noten-agari, a Furiten-Ron or agari on a wrong tile, you will pay a penalty.

The game continues until one of the opponents will drop under zero points.
## Pimbooo example server
See documentation [here](cmd/pimboo-server/README.md)

## Tenhou stats and log downloader
Download tool by typing
```
go get github.com/dnovikoff/tenhou/tools/tentool
```

Initialize the stats repo in current working dir
```
./tentool stats init
```

Download stat files by typing
```
./tentool stats download
```
The files will be downloaded to ./tenhou/stats folder.
Repeat this action to get updates.

Initialize the logs repo in current working dir
```
./tentool logs init
```

Collect all log ids from stat files by typing
```
./tentool logs update
```
Repeat this action, after next download of stats repo

You can download some log archives to reduce download time from here https://yadi.sk/d/D_0tO_135zIKPw
Place this files into ./tenhou/logs dir and run
Download log files from collected log ids by typing
```
./tentool logs import ./tenhou/logs/file.zip ./tenhou/logs/otherfile.zip
```

Download log files from collected log ids by typing
```
./tentool logs download
```
See documentation [here](tools/tentool/README.md)
Loading

0 comments on commit f9e634a

Please sign in to comment.