add LICENSE

This commit is contained in:
Dawid Wysokiński 2020-08-24 11:42:14 +02:00
parent fb8892ceb2
commit fb06ce0a6b
3 changed files with 40 additions and 10 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2020 Dawid Wysokiński
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# map-generator
[TribalWars](https://www.tribalwars.net/en-dk/) server map generation package.

View File

@ -24,22 +24,28 @@ const (
type Marker struct {
Larger bool
Villages []*models.Village `json:"villages" gqlgen:"villages" xml:"villages"`
Color string `json:"color" gqlgen:"color" xml:"color"`
// Color in HEX format
Color string `json:"color" gqlgen:"color" xml:"color"`
}
type Config struct {
Markers []*Marker
Destination io.Writer
MapSize int
ContinentGrid bool
ContinentNumbers bool
BackgroundColor string
GridLineColor string
Markers []*Marker
Destination io.Writer
// Default 1000x1000
MapSize int
ContinentGrid bool
ContinentNumbers bool
// BackgroundColor in HEX format
BackgroundColor string
// GridLineColor in HEX format
GridLineColor string
// ContinentNumberColor in HEX format
ContinentNumberColor string
Scale float32
CenterX int
CenterY int
Quality int
// Quality of image (1-100)
Quality int
}
func (cfg *Config) init() {
@ -55,7 +61,7 @@ func (cfg *Config) init() {
if cfg.MapSize <= 0 {
cfg.MapSize = defaultMapSize
}
if cfg.Quality <= 0 {
if cfg.Quality <= 0 || cfg.Quality > 100 {
cfg.Quality = defaultQuality
}
if cfg.Scale < 1 {