YAML files for rarely changed data. New weapon stats.
This commit is contained in:
210
static/ab0x.go
Normal file
210
static/ab0x.go
Normal file
@@ -0,0 +1,210 @@
|
||||
// Code generated by fileb0x at "2018-04-30 19:42:29.945122063 +0400 +04 m=+0.004478925" from config file "b0x.yaml" DO NOT EDIT.
|
||||
// modification hash(4eca41b6607bbac040da73b72d816cc7.81c8b21350256c12bfec846430631e9b)
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"context"
|
||||
"golang.org/x/net/webdav"
|
||||
)
|
||||
|
||||
var (
|
||||
// CTX is a context for webdav vfs
|
||||
CTX = context.Background()
|
||||
|
||||
// FS is a virtual memory file system
|
||||
FS = webdav.NewMemFS()
|
||||
|
||||
// Handler is used to server files through a http handler
|
||||
Handler *webdav.Handler
|
||||
|
||||
// HTTP is the http file system
|
||||
HTTP http.FileSystem = new(HTTPFS)
|
||||
)
|
||||
|
||||
// HTTPFS implements http.FileSystem
|
||||
type HTTPFS struct{}
|
||||
|
||||
// FileElementsYml is "elements.yml"
|
||||
var FileElementsYml = []byte("\x2d\x20\x69\x64\x3a\x20\x31\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x91\x8a\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x91\xd0\xbe\xd0\xb5\xd0\xb2\xd0\xbe\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x31\x0a\x2d\x20\x69\x64\x3a\x20\x32\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x8c\x80\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9b\xd0\xb5\xd1\x82\xd0\xb0\xd1\x8e\xd1\x89\xd0\xb8\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x31\x0a\x2d\x20\x69\x64\x3a\x20\x33\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x92\x80\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\xaf\xd0\xb4\xd0\xbe\xd0\xb2\xd0\xb8\xd1\x82\xd1\x8b\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x31\x0a\x2d\x20\x69\x64\x3a\x20\x34\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x97\xbf\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9a\xd0\xb0\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xbd\xd1\x8b\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x31\x0a\x2d\x20\x69\x64\x3a\x20\x35\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x94\xa5\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9e\xd0\xb3\xd0\xbd\xd0\xb5\xd0\xbd\xd0\xbd\xd1\x8b\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x32\x0a\x2d\x20\x69\x64\x3a\x20\x36\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xe2\x9a\xa1\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\xad\xd0\xbb\xd0\xb5\xd0\xba\xd1\x82\xd1\x80\xd0\xb8\xd1\x87\xd0\xb5\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x32\x0a\x2d\x20\x69\x64\x3a\x20\x37\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x92\xa7\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x92\xd0\xbe\xd0\xb4\xd1\x8f\xd0\xbd\xd0\xbe\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x32\x0a\x2d\x20\x69\x64\x3a\x20\x38\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x8d\x80\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\xa2\xd1\x80\xd0\xb0\xd0\xb2\xd1\x8f\xd0\xbd\xd0\xbe\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x32\x0a\x2d\x20\x69\x64\x3a\x20\x39\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x92\xa9\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9e\xd1\x82\xd0\xb2\xd0\xb0\xd0\xb6\xd0\xbd\xd1\x8b\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x33\x0a\x2d\x20\x69\x64\x3a\x20\x31\x30\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x91\x81\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9f\xd1\x81\xd0\xb8\xd1\x85\xd0\xb8\xd1\x87\xd0\xb5\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x33\x0a\x2d\x20\x69\x64\x3a\x20\x31\x31\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x91\xbf\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\xa2\xd0\xb5\xd0\xbc\xd0\xbd\xd1\x8b\xd0\xb9\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x33\x0a\x2d\x20\x69\x64\x3a\x20\x31\x32\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xe2\x8c\x9b\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x92\xd1\x80\xd0\xb5\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8\x22\x0a\x20\x20\x6c\x65\x61\x67\x75\x65\x5f\x69\x64\x3a\x20\x33")
|
||||
|
||||
// FileLeaguesYml is "leagues.yml"
|
||||
var FileLeaguesYml = []byte("\x2d\x20\x69\x64\x3a\x20\x31\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\xf0\x9f\x88\xb8\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x98\xd0\x9d\xd0\xa1\xd0\xa2\xd0\x98\xd0\x9d\xd0\x9a\xd0\xa2\x22\x0a\x2d\x20\x69\x64\x3a\x20\x32\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\xf0\x9f\x88\xb3\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9c\xd0\x98\xd0\xa1\xd0\xa2\xd0\x98\xd0\x9a\xd0\x90\x22\x0a\x2d\x20\x69\x64\x3a\x20\x33\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\xf0\x9f\x88\xb5\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9e\xd0\xa2\xd0\x92\xd0\x90\xd0\x93\xd0\x90\x22")
|
||||
|
||||
// FileLocationsYml is "locations.yml"
|
||||
var FileLocationsYml = []byte("\x2d\x20\x69\x64\x3a\x20\x31\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x8c\xb2\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9b\xd0\xb5\xd1\x81\x22\x0a\x2d\x20\x69\x64\x3a\x20\x32\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xe2\x9b\xb0\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x93\xd0\xbe\xd1\x80\xd1\x8b\x22\x0a\x2d\x20\x69\x64\x3a\x20\x33\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x9a\xa3\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9e\xd0\xb7\xd0\xb5\xd1\x80\xd0\xbe\x22\x0a\x2d\x20\x69\x64\x3a\x20\x34\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x8f\x99\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x93\xd0\xbe\xd1\x80\xd0\xbe\xd0\xb4\x22\x0a\x2d\x20\x69\x64\x3a\x20\x35\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xf0\x9f\x8f\x9b\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9a\xd0\xb0\xd1\x82\xd0\xb0\xd0\xba\xd0\xbe\xd0\xbc\xd0\xb1\xd1\x8b\x22\x0a\x2d\x20\x69\x64\x3a\x20\x36\x0a\x20\x20\x73\x79\x6d\x62\x6f\x6c\x3a\x20\x22\xe2\x9b\xaa\xef\xb8\x8f\x22\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9a\xd0\xbb\xd0\xb0\xd0\xb4\xd0\xb1\xd0\xb8\xd1\x89\xd0\xb5\x22")
|
||||
|
||||
// FileWeaponsYml is "weapons.yml"
|
||||
var FileWeaponsYml = []byte("\x2d\x20\x69\x64\x3a\x20\x31\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x91\xd0\xb8\xd1\x82\xd0\xb0\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x33\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x35\x0a\x2d\x20\x69\x64\x3a\x20\x32\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\xa1\xd1\x82\xd0\xb0\xd0\xbb\xd1\x8c\xd0\xbd\xd0\xb0\xd1\x8f\x20\xd0\xb1\xd0\xb8\xd1\x82\xd0\xb0\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x33\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x32\x37\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x33\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\xa7\xd1\x83\xd0\xb3\xd1\x83\xd0\xbd\xd0\xbd\xd0\xb0\xd1\x8f\x20\xd0\xb1\xd0\xb8\xd1\x82\xd0\xb0\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x36\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x35\x34\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x34\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\xa2\xd0\xb8\xd1\x82\xd0\xb0\xd0\xbd\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x8f\x20\xd0\xb1\xd0\xb8\xd1\x82\xd0\xb0\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x31\x30\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x39\x30\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x35\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x90\xd0\xbb\xd0\xbc\xd0\xb0\xd0\xb7\xd0\xbd\xd0\xb0\xd1\x8f\x20\xd0\xb1\xd0\xb8\xd1\x82\xd0\xb0\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x31\x34\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x31\x32\x35\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x36\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9a\xd1\x80\xd0\xb8\xd0\xbf\xd1\x82\xd0\xbe\xd0\xbd\xd0\xb8\xd1\x82\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x8f\x20\xd0\xb1\xd0\xb8\xd1\x82\xd0\xb0\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x31\x36\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x31\x34\x35\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x37\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x91\xd1\x83\xd1\x85\xd0\xb0\xd0\xbd\xd0\xba\xd0\xb0\x20\xd0\xb8\xd0\xb7\x20\xd0\xbf\xd1\x8f\xd1\x82\xd1\x91\xd1\x80\xd1\x8b\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x31\x38\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x31\x36\x30\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x38\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\xa0\xd1\x83\xd0\xba\xd0\xb8\x2d\xd0\xb1\xd0\xb0\xd0\xb7\xd1\x83\xd0\xba\xd0\xb8\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x32\x30\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x31\x38\x30\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x39\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x9a\xd0\xb0\xd0\xba\xd0\xb0\xd1\x85\xd0\xb8\x2d\xd1\x82\xd0\xbe\xd1\x80\xd0\xbf\xd0\xb5\xd0\xb4\xd1\x8b\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x32\x32\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x32\x30\x30\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x31\x30\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x91\xd0\xb8\xd1\x82\xd0\xb0\x20\xd0\x91\xd0\xb5\xd1\x81\xd0\xba\xd0\xbe\xd0\xbd\xd0\xb5\xd1\x87\xd0\xbd\xd0\xbe\xd1\x81\xd1\x82\xd0\xb8\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x32\x35\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x32\x33\x30\x30\x30\x0a\x2d\x20\x69\x64\x3a\x20\x31\x31\x0a\x20\x20\x6e\x61\x6d\x65\x3a\x20\x22\xd0\x91\xd0\xb8\xd1\x82\xd0\xb0\x20\x32\x38\x30\x22\x0a\x20\x20\x70\x6f\x77\x65\x72\x3a\x20\x32\x38\x30\x0a\x20\x20\x70\x72\x69\x63\x65\x3a\x20\x32\x35\x30\x30\x30")
|
||||
|
||||
func init() {
|
||||
if CTX.Err() != nil {
|
||||
panic(CTX.Err())
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
var f webdav.File
|
||||
|
||||
f, err = FS.OpenFile(CTX, "elements.yml", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = f.Write(FileElementsYml)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
f, err = FS.OpenFile(CTX, "leagues.yml", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = f.Write(FileLeaguesYml)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
f, err = FS.OpenFile(CTX, "locations.yml", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = f.Write(FileLocationsYml)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
f, err = FS.OpenFile(CTX, "weapons.yml", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = f.Write(FileWeaponsYml)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Handler = &webdav.Handler{
|
||||
FileSystem: FS,
|
||||
LockSystem: webdav.NewMemLS(),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Open a file
|
||||
func (hfs *HTTPFS) Open(path string) (http.File, error) {
|
||||
|
||||
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return f, nil
|
||||
}
|
||||
|
||||
// ReadFile is adapTed from ioutil
|
||||
func ReadFile(path string) ([]byte, error) {
|
||||
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
buf := bytes.NewBuffer(make([]byte, 0, bytes.MinRead))
|
||||
|
||||
// If the buffer overflows, we will get bytes.ErrTooLarge.
|
||||
// Return that as an error. Any other panic remains.
|
||||
defer func() {
|
||||
e := recover()
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
if panicErr, ok := e.(error); ok && panicErr == bytes.ErrTooLarge {
|
||||
err = panicErr
|
||||
} else {
|
||||
panic(e)
|
||||
}
|
||||
}()
|
||||
_, err = buf.ReadFrom(f)
|
||||
return buf.Bytes(), err
|
||||
}
|
||||
|
||||
// WriteFile is adapTed from ioutil
|
||||
func WriteFile(filename string, data []byte, perm os.FileMode) error {
|
||||
f, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n, err := f.Write(data)
|
||||
if err == nil && n < len(data) {
|
||||
err = io.ErrShortWrite
|
||||
}
|
||||
if err1 := f.Close(); err == nil {
|
||||
err = err1
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// WalkDirs looks for files in the given dir and returns a list of files in it
|
||||
// usage for all files in the b0x: WalkDirs("", false)
|
||||
func WalkDirs(name string, includeDirsInList bool, files ...string) ([]string, error) {
|
||||
f, err := FS.OpenFile(CTX, name, os.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fileInfos, err := f.Readdir(0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, info := range fileInfos {
|
||||
filename := path.Join(name, info.Name())
|
||||
|
||||
if includeDirsInList || !info.IsDir() {
|
||||
files = append(files, filename)
|
||||
}
|
||||
|
||||
if info.IsDir() {
|
||||
files, err = WalkDirs(filename, includeDirsInList, files...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return files, nil
|
||||
}
|
Reference in New Issue
Block a user