feat: api - add 3 new endpoints
This commit is contained in:
parent
50d83fcc14
commit
6a4e896cd4
647
api/openapi3.yml
647
api/openapi3.yml
|
@ -82,6 +82,51 @@ paths:
|
||||||
$ref: "#/components/responses/GetServerResponse"
|
$ref: "#/components/responses/GetServerResponse"
|
||||||
default:
|
default:
|
||||||
$ref: "#/components/responses/ErrorResponse"
|
$ref: "#/components/responses/ErrorResponse"
|
||||||
|
/v2/versions/{versionCode}/servers/{serverKey}/config:
|
||||||
|
get:
|
||||||
|
operationId: getServerConfig
|
||||||
|
tags:
|
||||||
|
- versions
|
||||||
|
- servers
|
||||||
|
description: Get server config
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/VersionCodePathParam"
|
||||||
|
- $ref: "#/components/parameters/ServerKeyPathParam"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/responses/GetServerConfigResponse"
|
||||||
|
default:
|
||||||
|
$ref: "#/components/responses/ErrorResponse"
|
||||||
|
/v2/versions/{versionCode}/servers/{serverKey}/building-info:
|
||||||
|
get:
|
||||||
|
operationId: getBuildingInfo
|
||||||
|
tags:
|
||||||
|
- versions
|
||||||
|
- servers
|
||||||
|
description: Get building info
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/VersionCodePathParam"
|
||||||
|
- $ref: "#/components/parameters/ServerKeyPathParam"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/responses/GetBuildingInfoResponse"
|
||||||
|
default:
|
||||||
|
$ref: "#/components/responses/ErrorResponse"
|
||||||
|
/v2/versions/{versionCode}/servers/{serverKey}/unit-info:
|
||||||
|
get:
|
||||||
|
operationId: getUnitInfo
|
||||||
|
tags:
|
||||||
|
- versions
|
||||||
|
- servers
|
||||||
|
description: Get unit info
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/VersionCodePathParam"
|
||||||
|
- $ref: "#/components/parameters/ServerKeyPathParam"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/responses/GetUnitInfoResponse"
|
||||||
|
default:
|
||||||
|
$ref: "#/components/responses/ErrorResponse"
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
Error:
|
Error:
|
||||||
|
@ -176,6 +221,575 @@ components:
|
||||||
createdAt:
|
createdAt:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
|
ServerConfig:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- ally
|
||||||
|
- build
|
||||||
|
- buildings
|
||||||
|
- commands
|
||||||
|
- coord
|
||||||
|
- game
|
||||||
|
- misc
|
||||||
|
- moral
|
||||||
|
- newbie
|
||||||
|
- night
|
||||||
|
- sitter
|
||||||
|
- sleep
|
||||||
|
- snob
|
||||||
|
- speed
|
||||||
|
- unitSpeed
|
||||||
|
- win
|
||||||
|
properties:
|
||||||
|
ally:
|
||||||
|
$ref: "#/components/schemas/ServerConfigAlly"
|
||||||
|
build:
|
||||||
|
$ref: "#/components/schemas/ServerConfigBuild"
|
||||||
|
buildings:
|
||||||
|
$ref: "#/components/schemas/ServerConfigBuildings"
|
||||||
|
commands:
|
||||||
|
$ref: "#/components/schemas/ServerConfigCommands"
|
||||||
|
coord:
|
||||||
|
$ref: "#/components/schemas/ServerConfigCoord"
|
||||||
|
game:
|
||||||
|
$ref: "#/components/schemas/ServerConfigGame"
|
||||||
|
misc:
|
||||||
|
$ref: "#/components/schemas/ServerConfigMisc"
|
||||||
|
moral:
|
||||||
|
type: integer
|
||||||
|
newbie:
|
||||||
|
$ref: "#/components/schemas/ServerConfigNewbie"
|
||||||
|
night:
|
||||||
|
$ref: "#/components/schemas/ServerConfigNight"
|
||||||
|
sitter:
|
||||||
|
$ref: "#/components/schemas/ServerConfigSitter"
|
||||||
|
sleep:
|
||||||
|
$ref: "#/components/schemas/ServerConfigSleep"
|
||||||
|
snob:
|
||||||
|
$ref: "#/components/schemas/ServerConfigSnob"
|
||||||
|
speed:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
unitSpeed:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
win:
|
||||||
|
$ref: "#/components/schemas/ServerConfigWin"
|
||||||
|
ServerConfigAlly:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- allytimeSupport
|
||||||
|
- fixedAllies
|
||||||
|
- levels
|
||||||
|
- limit
|
||||||
|
- noHarm
|
||||||
|
- noJoin
|
||||||
|
- noLeave
|
||||||
|
- noOtherSupport
|
||||||
|
- noOtherSupportType
|
||||||
|
- pointsMemberCount
|
||||||
|
- warsAutoacceptDays
|
||||||
|
- warsMemberRequirement
|
||||||
|
- warsPointsRequirement
|
||||||
|
- xpRequirements
|
||||||
|
properties:
|
||||||
|
allytimeSupport:
|
||||||
|
type: integer
|
||||||
|
fixedAllies:
|
||||||
|
type: integer
|
||||||
|
levels:
|
||||||
|
type: integer
|
||||||
|
limit:
|
||||||
|
type: integer
|
||||||
|
noHarm:
|
||||||
|
type: integer
|
||||||
|
noJoin:
|
||||||
|
type: integer
|
||||||
|
noLeave:
|
||||||
|
type: integer
|
||||||
|
noOtherSupport:
|
||||||
|
type: integer
|
||||||
|
noOtherSupportType:
|
||||||
|
type: integer
|
||||||
|
pointsMemberCount:
|
||||||
|
type: integer
|
||||||
|
warsAutoacceptDays:
|
||||||
|
type: integer
|
||||||
|
warsMemberRequirement:
|
||||||
|
type: integer
|
||||||
|
warsPointsRequirement:
|
||||||
|
type: integer
|
||||||
|
xpRequirements:
|
||||||
|
type: string
|
||||||
|
ServerConfigBuild:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- destroy
|
||||||
|
properties:
|
||||||
|
destroy:
|
||||||
|
type: integer
|
||||||
|
ServerConfigBuildings:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- customBarracks
|
||||||
|
- customChurch
|
||||||
|
- customFarm
|
||||||
|
- customGarage
|
||||||
|
- customHide
|
||||||
|
- customIron
|
||||||
|
- customMain
|
||||||
|
- customMarket
|
||||||
|
- customPlace
|
||||||
|
- customSmith
|
||||||
|
- customSnob
|
||||||
|
- customStable
|
||||||
|
- customStatue
|
||||||
|
- customStone
|
||||||
|
- customStorage
|
||||||
|
- customWall
|
||||||
|
- customWatchtower
|
||||||
|
- customWood
|
||||||
|
properties:
|
||||||
|
customBarracks:
|
||||||
|
type: integer
|
||||||
|
customChurch:
|
||||||
|
type: integer
|
||||||
|
customFarm:
|
||||||
|
type: integer
|
||||||
|
customGarage:
|
||||||
|
type: integer
|
||||||
|
customHide:
|
||||||
|
type: integer
|
||||||
|
customIron:
|
||||||
|
type: integer
|
||||||
|
customMain:
|
||||||
|
type: integer
|
||||||
|
customMarket:
|
||||||
|
type: integer
|
||||||
|
customPlace:
|
||||||
|
type: integer
|
||||||
|
customSmith:
|
||||||
|
type: integer
|
||||||
|
customSnob:
|
||||||
|
type: integer
|
||||||
|
customStable:
|
||||||
|
type: integer
|
||||||
|
customStatue:
|
||||||
|
type: integer
|
||||||
|
customStone:
|
||||||
|
type: integer
|
||||||
|
customStorage:
|
||||||
|
type: integer
|
||||||
|
customWall:
|
||||||
|
type: integer
|
||||||
|
customWatchtower:
|
||||||
|
type: integer
|
||||||
|
customWood:
|
||||||
|
type: integer
|
||||||
|
ServerConfigCommands:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- commandCancelTime
|
||||||
|
- millisArrival
|
||||||
|
properties:
|
||||||
|
commandCancelTime:
|
||||||
|
type: integer
|
||||||
|
millisArrival:
|
||||||
|
type: integer
|
||||||
|
ServerConfigCoord:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- bonusNew
|
||||||
|
- bonusVillages
|
||||||
|
- emptyVillages
|
||||||
|
- func
|
||||||
|
- inner
|
||||||
|
- mapSize
|
||||||
|
- nobleRestart
|
||||||
|
- selectStart
|
||||||
|
- startVillages
|
||||||
|
- villageMoveWait
|
||||||
|
properties:
|
||||||
|
bonusNew:
|
||||||
|
type: integer
|
||||||
|
bonusVillages:
|
||||||
|
type: integer
|
||||||
|
emptyVillages:
|
||||||
|
type: integer
|
||||||
|
func:
|
||||||
|
type: integer
|
||||||
|
inner:
|
||||||
|
type: integer
|
||||||
|
mapSize:
|
||||||
|
type: integer
|
||||||
|
nobleRestart:
|
||||||
|
type: integer
|
||||||
|
selectStart:
|
||||||
|
type: integer
|
||||||
|
startVillages:
|
||||||
|
type: integer
|
||||||
|
villageMoveWait:
|
||||||
|
type: integer
|
||||||
|
ServerConfigGame:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- archer
|
||||||
|
- barbarianMaxPoints
|
||||||
|
- barbarianRise
|
||||||
|
- barbarianShrink
|
||||||
|
- baseProduction
|
||||||
|
- buildtimeFormula
|
||||||
|
- church
|
||||||
|
- event
|
||||||
|
- fakeLimit
|
||||||
|
- farmLimit
|
||||||
|
- hauls
|
||||||
|
- haulsBase
|
||||||
|
- haulsMax
|
||||||
|
- knight
|
||||||
|
- knightNewItems
|
||||||
|
- scavenging
|
||||||
|
- stronghold
|
||||||
|
- suppressEvents
|
||||||
|
- tech
|
||||||
|
- watchtower
|
||||||
|
properties:
|
||||||
|
archer:
|
||||||
|
type: integer
|
||||||
|
barbarianMaxPoints:
|
||||||
|
type: integer
|
||||||
|
barbarianRise:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
barbarianShrink:
|
||||||
|
type: integer
|
||||||
|
baseProduction:
|
||||||
|
type: integer
|
||||||
|
buildtimeFormula:
|
||||||
|
type: integer
|
||||||
|
church:
|
||||||
|
type: integer
|
||||||
|
event:
|
||||||
|
type: integer
|
||||||
|
fakeLimit:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
farmLimit:
|
||||||
|
type: integer
|
||||||
|
hauls:
|
||||||
|
type: integer
|
||||||
|
haulsBase:
|
||||||
|
type: integer
|
||||||
|
haulsMax:
|
||||||
|
type: integer
|
||||||
|
knight:
|
||||||
|
type: integer
|
||||||
|
knightNewItems:
|
||||||
|
type: integer
|
||||||
|
scavenging:
|
||||||
|
type: integer
|
||||||
|
stronghold:
|
||||||
|
type: integer
|
||||||
|
suppressEvents:
|
||||||
|
type: integer
|
||||||
|
tech:
|
||||||
|
type: integer
|
||||||
|
watchtower:
|
||||||
|
type: integer
|
||||||
|
ServerConfigMisc:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- killRanking
|
||||||
|
- tradeCancelTime
|
||||||
|
- tutorial
|
||||||
|
properties:
|
||||||
|
killRanking:
|
||||||
|
type: integer
|
||||||
|
tradeCancelTime:
|
||||||
|
type: integer
|
||||||
|
tutorial:
|
||||||
|
type: integer
|
||||||
|
ServerConfigNewbie:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- days
|
||||||
|
- ratio
|
||||||
|
- ratioDays
|
||||||
|
- removeNewbieVillages
|
||||||
|
properties:
|
||||||
|
days:
|
||||||
|
type: integer
|
||||||
|
ratio:
|
||||||
|
type: integer
|
||||||
|
ratioDays:
|
||||||
|
type: integer
|
||||||
|
removeNewbieVillages:
|
||||||
|
type: integer
|
||||||
|
ServerConfigNight:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- active
|
||||||
|
- defFactor
|
||||||
|
- duration
|
||||||
|
- endHour
|
||||||
|
- startHour
|
||||||
|
properties:
|
||||||
|
active:
|
||||||
|
type: integer
|
||||||
|
defFactor:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
duration:
|
||||||
|
type: integer
|
||||||
|
endHour:
|
||||||
|
type: integer
|
||||||
|
startHour:
|
||||||
|
type: integer
|
||||||
|
ServerConfigSitter:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- allow
|
||||||
|
properties:
|
||||||
|
allow:
|
||||||
|
type: integer
|
||||||
|
ServerConfigSleep:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- active
|
||||||
|
- delay
|
||||||
|
- max
|
||||||
|
- maxAwake
|
||||||
|
- min
|
||||||
|
- minAwake
|
||||||
|
- warnTime
|
||||||
|
properties:
|
||||||
|
active:
|
||||||
|
type: integer
|
||||||
|
delay:
|
||||||
|
type: integer
|
||||||
|
max:
|
||||||
|
type: integer
|
||||||
|
maxAwake:
|
||||||
|
type: integer
|
||||||
|
min:
|
||||||
|
type: integer
|
||||||
|
minAwake:
|
||||||
|
type: integer
|
||||||
|
warnTime:
|
||||||
|
type: integer
|
||||||
|
ServerConfigSnob:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- cheapRebuild
|
||||||
|
- coinIron
|
||||||
|
- coinStone
|
||||||
|
- coinWood
|
||||||
|
- factor
|
||||||
|
- gold
|
||||||
|
- maxDist
|
||||||
|
- noBarbConquer
|
||||||
|
- rise
|
||||||
|
properties:
|
||||||
|
cheapRebuild:
|
||||||
|
type: integer
|
||||||
|
coinIron:
|
||||||
|
type: integer
|
||||||
|
coinStone:
|
||||||
|
type: integer
|
||||||
|
coinWood:
|
||||||
|
type: integer
|
||||||
|
factor:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
gold:
|
||||||
|
type: integer
|
||||||
|
maxDist:
|
||||||
|
type: integer
|
||||||
|
noBarbConquer:
|
||||||
|
type: integer
|
||||||
|
rise:
|
||||||
|
type: integer
|
||||||
|
ServerConfigWin:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- check
|
||||||
|
properties:
|
||||||
|
check:
|
||||||
|
type: integer
|
||||||
|
Unit:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- attack
|
||||||
|
- buildTime
|
||||||
|
- carry
|
||||||
|
- defense
|
||||||
|
- defenseArcher
|
||||||
|
- defenseCavalry
|
||||||
|
- pop
|
||||||
|
- speed
|
||||||
|
properties:
|
||||||
|
attack:
|
||||||
|
type: integer
|
||||||
|
buildTime:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
carry:
|
||||||
|
type: integer
|
||||||
|
defense:
|
||||||
|
type: integer
|
||||||
|
defenseArcher:
|
||||||
|
type: integer
|
||||||
|
defenseCavalry:
|
||||||
|
type: integer
|
||||||
|
pop:
|
||||||
|
type: integer
|
||||||
|
speed:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
UnitInfo:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- archer
|
||||||
|
- axe
|
||||||
|
- catapult
|
||||||
|
- heavy
|
||||||
|
- knight
|
||||||
|
- light
|
||||||
|
- marcher
|
||||||
|
- militia
|
||||||
|
- ram
|
||||||
|
- snob
|
||||||
|
- spear
|
||||||
|
- spy
|
||||||
|
- sword
|
||||||
|
properties:
|
||||||
|
archer:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
axe:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
catapult:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
heavy:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
knight:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
light:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
marcher:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
militia:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
ram:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
snob:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
spear:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
spy:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
sword:
|
||||||
|
$ref: "#/components/schemas/Unit"
|
||||||
|
Building:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- buildTime
|
||||||
|
- buildTimeFactor
|
||||||
|
- iron
|
||||||
|
- ironFactor
|
||||||
|
- maxLevel
|
||||||
|
- minLevel
|
||||||
|
- pop
|
||||||
|
- popFactor
|
||||||
|
- stone
|
||||||
|
- stoneFactor
|
||||||
|
- wood
|
||||||
|
- woodFactor
|
||||||
|
properties:
|
||||||
|
buildTime:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
buildTimeFactor:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
iron:
|
||||||
|
type: integer
|
||||||
|
ironFactor:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
maxLevel:
|
||||||
|
type: integer
|
||||||
|
minLevel:
|
||||||
|
type: integer
|
||||||
|
pop:
|
||||||
|
type: integer
|
||||||
|
popFactor:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
stone:
|
||||||
|
type: integer
|
||||||
|
stoneFactor:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
wood:
|
||||||
|
type: integer
|
||||||
|
woodFactor:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
BuildingInfo:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- barracks
|
||||||
|
- farm
|
||||||
|
- garage
|
||||||
|
- hide
|
||||||
|
- iron
|
||||||
|
- main
|
||||||
|
- market
|
||||||
|
- place
|
||||||
|
- smith
|
||||||
|
- snob
|
||||||
|
- stable
|
||||||
|
- statue
|
||||||
|
- stone
|
||||||
|
- storage
|
||||||
|
- wall
|
||||||
|
- watchtower
|
||||||
|
- wood
|
||||||
|
properties:
|
||||||
|
barracks:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
farm:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
garage:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
hide:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
iron:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
main:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
market:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
place:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
smith:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
snob:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
stable:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
statue:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
stone:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
storage:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
wall:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
watchtower:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
|
wood:
|
||||||
|
$ref: "#/components/schemas/Building"
|
||||||
Cursor:
|
Cursor:
|
||||||
type: object
|
type: object
|
||||||
x-go-type-skip-optional-pointer: true
|
x-go-type-skip-optional-pointer: true
|
||||||
|
@ -279,6 +893,39 @@ components:
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
$ref: "#/components/schemas/Server"
|
$ref: "#/components/schemas/Server"
|
||||||
|
GetServerConfigResponse:
|
||||||
|
description: ""
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- data
|
||||||
|
properties:
|
||||||
|
data:
|
||||||
|
$ref: "#/components/schemas/ServerConfig"
|
||||||
|
GetUnitInfoResponse:
|
||||||
|
description: ""
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- data
|
||||||
|
properties:
|
||||||
|
data:
|
||||||
|
$ref: "#/components/schemas/UnitInfo"
|
||||||
|
GetBuildingInfoResponse:
|
||||||
|
description: ""
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- data
|
||||||
|
properties:
|
||||||
|
data:
|
||||||
|
$ref: "#/components/schemas/BuildingInfo"
|
||||||
ErrorResponse:
|
ErrorResponse:
|
||||||
description: Default error response.
|
description: Default error response.
|
||||||
content:
|
content:
|
||||||
|
|
|
@ -7,18 +7,18 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Building struct {
|
type Building struct {
|
||||||
MaxLevel int
|
|
||||||
MinLevel int
|
|
||||||
Wood int
|
|
||||||
Stone int
|
|
||||||
Iron int
|
|
||||||
Pop int
|
|
||||||
WoodFactor float64
|
|
||||||
StoneFactor float64
|
|
||||||
IronFactor float64
|
|
||||||
PopFactor float64
|
|
||||||
BuildTime float64
|
BuildTime float64
|
||||||
BuildTimeFactor float64
|
BuildTimeFactor float64
|
||||||
|
Iron int
|
||||||
|
IronFactor float64
|
||||||
|
MaxLevel int
|
||||||
|
MinLevel int
|
||||||
|
Pop int
|
||||||
|
PopFactor float64
|
||||||
|
Stone int
|
||||||
|
StoneFactor float64
|
||||||
|
Wood int
|
||||||
|
WoodFactor float64
|
||||||
}
|
}
|
||||||
|
|
||||||
type BuildingInfo struct {
|
type BuildingInfo struct {
|
||||||
|
|
|
@ -12,106 +12,106 @@ type ServerConfigBuild struct {
|
||||||
|
|
||||||
type ServerConfigMisc struct {
|
type ServerConfigMisc struct {
|
||||||
KillRanking int
|
KillRanking int
|
||||||
Tutorial int
|
|
||||||
TradeCancelTime int
|
TradeCancelTime int
|
||||||
|
Tutorial int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigCommands struct {
|
type ServerConfigCommands struct {
|
||||||
MillisArrival int
|
|
||||||
CommandCancelTime int
|
CommandCancelTime int
|
||||||
|
MillisArrival int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigNewbie struct {
|
type ServerConfigNewbie struct {
|
||||||
Days int
|
Days int
|
||||||
RatioDays int
|
|
||||||
Ratio int
|
Ratio int
|
||||||
|
RatioDays int
|
||||||
RemoveNewbieVillages int
|
RemoveNewbieVillages int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigGame struct {
|
type ServerConfigGame struct {
|
||||||
BuildtimeFormula int
|
|
||||||
Knight int
|
|
||||||
KnightNewItems int
|
|
||||||
Archer int
|
Archer int
|
||||||
Tech int
|
BarbarianMaxPoints int
|
||||||
FarmLimit int
|
|
||||||
Church int
|
|
||||||
Watchtower int
|
|
||||||
Stronghold int
|
|
||||||
FakeLimit float64
|
|
||||||
BarbarianRise float64
|
BarbarianRise float64
|
||||||
BarbarianShrink int
|
BarbarianShrink int
|
||||||
BarbarianMaxPoints int
|
BaseProduction int
|
||||||
Scavenging int
|
BuildtimeFormula int
|
||||||
|
Church int
|
||||||
|
Event int
|
||||||
|
FakeLimit float64
|
||||||
|
FarmLimit int
|
||||||
Hauls int
|
Hauls int
|
||||||
HaulsBase int
|
HaulsBase int
|
||||||
HaulsMax int
|
HaulsMax int
|
||||||
BaseProduction int
|
Knight int
|
||||||
Event int
|
KnightNewItems int
|
||||||
|
Scavenging int
|
||||||
|
Stronghold int
|
||||||
SuppressEvents int
|
SuppressEvents int
|
||||||
|
Tech int
|
||||||
|
Watchtower int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigBuildings struct {
|
type ServerConfigBuildings struct {
|
||||||
CustomMain int
|
|
||||||
CustomFarm int
|
|
||||||
CustomStorage int
|
|
||||||
CustomPlace int
|
|
||||||
CustomBarracks int
|
CustomBarracks int
|
||||||
CustomChurch int
|
CustomChurch int
|
||||||
CustomSmith int
|
CustomFarm int
|
||||||
CustomWood int
|
|
||||||
CustomStone int
|
|
||||||
CustomIron int
|
|
||||||
CustomMarket int
|
|
||||||
CustomStable int
|
|
||||||
CustomWall int
|
|
||||||
CustomGarage int
|
CustomGarage int
|
||||||
CustomHide int
|
CustomHide int
|
||||||
|
CustomIron int
|
||||||
|
CustomMain int
|
||||||
|
CustomMarket int
|
||||||
|
CustomPlace int
|
||||||
|
CustomSmith int
|
||||||
CustomSnob int
|
CustomSnob int
|
||||||
|
CustomStable int
|
||||||
CustomStatue int
|
CustomStatue int
|
||||||
|
CustomStone int
|
||||||
|
CustomStorage int
|
||||||
|
CustomWall int
|
||||||
CustomWatchtower int
|
CustomWatchtower int
|
||||||
|
CustomWood int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigSnob struct {
|
type ServerConfigSnob struct {
|
||||||
Gold int
|
|
||||||
CheapRebuild int
|
CheapRebuild int
|
||||||
Rise int
|
|
||||||
MaxDist int
|
|
||||||
Factor float64
|
|
||||||
CoinWood int
|
|
||||||
CoinStone int
|
|
||||||
CoinIron int
|
CoinIron int
|
||||||
|
CoinStone int
|
||||||
|
CoinWood int
|
||||||
|
Factor float64
|
||||||
|
Gold int
|
||||||
|
MaxDist int
|
||||||
NoBarbConquer int
|
NoBarbConquer int
|
||||||
|
Rise int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigAlly struct {
|
type ServerConfigAlly struct {
|
||||||
|
AllytimeSupport int
|
||||||
|
FixedAllies int
|
||||||
|
Levels int
|
||||||
|
Limit int
|
||||||
NoHarm int
|
NoHarm int
|
||||||
|
NoJoin int
|
||||||
|
NoLeave int
|
||||||
NoOtherSupport int
|
NoOtherSupport int
|
||||||
NoOtherSupportType int
|
NoOtherSupportType int
|
||||||
AllytimeSupport int
|
|
||||||
NoLeave int
|
|
||||||
NoJoin int
|
|
||||||
Limit int
|
|
||||||
FixedAllies int
|
|
||||||
PointsMemberCount int
|
PointsMemberCount int
|
||||||
|
WarsAutoacceptDays int
|
||||||
WarsMemberRequirement int
|
WarsMemberRequirement int
|
||||||
WarsPointsRequirement int
|
WarsPointsRequirement int
|
||||||
WarsAutoacceptDays int
|
|
||||||
Levels int
|
|
||||||
XpRequirements string
|
XpRequirements string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigCoord struct {
|
type ServerConfigCoord struct {
|
||||||
MapSize int
|
|
||||||
Func int
|
|
||||||
EmptyVillages int
|
|
||||||
BonusVillages int
|
|
||||||
BonusNew int
|
BonusNew int
|
||||||
|
BonusVillages int
|
||||||
|
EmptyVillages int
|
||||||
|
Func int
|
||||||
Inner int
|
Inner int
|
||||||
SelectStart int
|
MapSize int
|
||||||
VillageMoveWait int
|
|
||||||
NobleRestart int
|
NobleRestart int
|
||||||
|
SelectStart int
|
||||||
StartVillages int
|
StartVillages int
|
||||||
|
VillageMoveWait int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigSitter struct {
|
type ServerConfigSitter struct {
|
||||||
|
@ -121,19 +121,19 @@ type ServerConfigSitter struct {
|
||||||
type ServerConfigSleep struct {
|
type ServerConfigSleep struct {
|
||||||
Active int
|
Active int
|
||||||
Delay int
|
Delay int
|
||||||
Min int
|
|
||||||
Max int
|
Max int
|
||||||
MinAwake int
|
|
||||||
MaxAwake int
|
MaxAwake int
|
||||||
|
Min int
|
||||||
|
MinAwake int
|
||||||
WarnTime int
|
WarnTime int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigNight struct {
|
type ServerConfigNight struct {
|
||||||
Active int
|
Active int
|
||||||
StartHour int
|
|
||||||
EndHour int
|
|
||||||
DefFactor float64
|
DefFactor float64
|
||||||
Duration int
|
Duration int
|
||||||
|
EndHour int
|
||||||
|
StartHour int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigWin struct {
|
type ServerConfigWin struct {
|
||||||
|
|
|
@ -7,14 +7,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Unit struct {
|
type Unit struct {
|
||||||
|
Attack int
|
||||||
BuildTime float64
|
BuildTime float64
|
||||||
|
Carry int
|
||||||
|
Defense int
|
||||||
|
DefenseArcher int
|
||||||
|
DefenseCavalry int
|
||||||
Pop int
|
Pop int
|
||||||
Speed float64
|
Speed float64
|
||||||
Attack int
|
|
||||||
Defense int
|
|
||||||
DefenseCavalry int
|
|
||||||
DefenseArcher int
|
|
||||||
Carry int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnitInfo struct {
|
type UnitInfo struct {
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
package domain
|
package domain
|
||||||
|
|
||||||
type Building struct {
|
type Building struct {
|
||||||
MaxLevel int
|
|
||||||
MinLevel int
|
|
||||||
Wood int
|
|
||||||
Stone int
|
|
||||||
Iron int
|
|
||||||
Pop int
|
|
||||||
WoodFactor float64
|
|
||||||
StoneFactor float64
|
|
||||||
IronFactor float64
|
|
||||||
PopFactor float64
|
|
||||||
BuildTime float64
|
BuildTime float64
|
||||||
BuildTimeFactor float64
|
BuildTimeFactor float64
|
||||||
|
Iron int
|
||||||
|
IronFactor float64
|
||||||
|
MaxLevel int
|
||||||
|
MinLevel int
|
||||||
|
Pop int
|
||||||
|
PopFactor float64
|
||||||
|
Stone int
|
||||||
|
StoneFactor float64
|
||||||
|
Wood int
|
||||||
|
WoodFactor float64
|
||||||
}
|
}
|
||||||
|
|
||||||
type BuildingInfo struct {
|
type BuildingInfo struct {
|
||||||
|
|
|
@ -6,106 +6,106 @@ type ServerConfigBuild struct {
|
||||||
|
|
||||||
type ServerConfigMisc struct {
|
type ServerConfigMisc struct {
|
||||||
KillRanking int
|
KillRanking int
|
||||||
Tutorial int
|
|
||||||
TradeCancelTime int
|
TradeCancelTime int
|
||||||
|
Tutorial int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigCommands struct {
|
type ServerConfigCommands struct {
|
||||||
MillisArrival int
|
|
||||||
CommandCancelTime int
|
CommandCancelTime int
|
||||||
|
MillisArrival int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigNewbie struct {
|
type ServerConfigNewbie struct {
|
||||||
Days int
|
Days int
|
||||||
RatioDays int
|
|
||||||
Ratio int
|
Ratio int
|
||||||
|
RatioDays int
|
||||||
RemoveNewbieVillages int
|
RemoveNewbieVillages int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigGame struct {
|
type ServerConfigGame struct {
|
||||||
BuildtimeFormula int
|
|
||||||
Knight int
|
|
||||||
KnightNewItems int
|
|
||||||
Archer int
|
Archer int
|
||||||
Tech int
|
BarbarianMaxPoints int
|
||||||
FarmLimit int
|
|
||||||
Church int
|
|
||||||
Watchtower int
|
|
||||||
Stronghold int
|
|
||||||
FakeLimit float64
|
|
||||||
BarbarianRise float64
|
BarbarianRise float64
|
||||||
BarbarianShrink int
|
BarbarianShrink int
|
||||||
BarbarianMaxPoints int
|
BaseProduction int
|
||||||
Scavenging int
|
BuildtimeFormula int
|
||||||
|
Church int
|
||||||
|
Event int
|
||||||
|
FakeLimit float64
|
||||||
|
FarmLimit int
|
||||||
Hauls int
|
Hauls int
|
||||||
HaulsBase int
|
HaulsBase int
|
||||||
HaulsMax int
|
HaulsMax int
|
||||||
BaseProduction int
|
Knight int
|
||||||
Event int
|
KnightNewItems int
|
||||||
|
Scavenging int
|
||||||
|
Stronghold int
|
||||||
SuppressEvents int
|
SuppressEvents int
|
||||||
|
Tech int
|
||||||
|
Watchtower int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigBuildings struct {
|
type ServerConfigBuildings struct {
|
||||||
CustomMain int
|
|
||||||
CustomFarm int
|
|
||||||
CustomStorage int
|
|
||||||
CustomPlace int
|
|
||||||
CustomBarracks int
|
CustomBarracks int
|
||||||
CustomChurch int
|
CustomChurch int
|
||||||
CustomSmith int
|
CustomFarm int
|
||||||
CustomWood int
|
|
||||||
CustomStone int
|
|
||||||
CustomIron int
|
|
||||||
CustomMarket int
|
|
||||||
CustomStable int
|
|
||||||
CustomWall int
|
|
||||||
CustomGarage int
|
CustomGarage int
|
||||||
CustomHide int
|
CustomHide int
|
||||||
|
CustomIron int
|
||||||
|
CustomMain int
|
||||||
|
CustomMarket int
|
||||||
|
CustomPlace int
|
||||||
|
CustomSmith int
|
||||||
CustomSnob int
|
CustomSnob int
|
||||||
|
CustomStable int
|
||||||
CustomStatue int
|
CustomStatue int
|
||||||
|
CustomStone int
|
||||||
|
CustomStorage int
|
||||||
|
CustomWall int
|
||||||
CustomWatchtower int
|
CustomWatchtower int
|
||||||
|
CustomWood int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigSnob struct {
|
type ServerConfigSnob struct {
|
||||||
Gold int
|
|
||||||
CheapRebuild int
|
CheapRebuild int
|
||||||
Rise int
|
|
||||||
MaxDist int
|
|
||||||
Factor float64
|
|
||||||
CoinWood int
|
|
||||||
CoinStone int
|
|
||||||
CoinIron int
|
CoinIron int
|
||||||
|
CoinStone int
|
||||||
|
CoinWood int
|
||||||
|
Factor float64
|
||||||
|
Gold int
|
||||||
|
MaxDist int
|
||||||
NoBarbConquer int
|
NoBarbConquer int
|
||||||
|
Rise int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigAlly struct {
|
type ServerConfigAlly struct {
|
||||||
|
AllytimeSupport int
|
||||||
|
FixedAllies int
|
||||||
|
Levels int
|
||||||
|
Limit int
|
||||||
NoHarm int
|
NoHarm int
|
||||||
|
NoJoin int
|
||||||
|
NoLeave int
|
||||||
NoOtherSupport int
|
NoOtherSupport int
|
||||||
NoOtherSupportType int
|
NoOtherSupportType int
|
||||||
AllytimeSupport int
|
|
||||||
NoLeave int
|
|
||||||
NoJoin int
|
|
||||||
Limit int
|
|
||||||
FixedAllies int
|
|
||||||
PointsMemberCount int
|
PointsMemberCount int
|
||||||
|
WarsAutoacceptDays int
|
||||||
WarsMemberRequirement int
|
WarsMemberRequirement int
|
||||||
WarsPointsRequirement int
|
WarsPointsRequirement int
|
||||||
WarsAutoacceptDays int
|
|
||||||
Levels int
|
|
||||||
XpRequirements string
|
XpRequirements string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigCoord struct {
|
type ServerConfigCoord struct {
|
||||||
MapSize int
|
|
||||||
Func int
|
|
||||||
EmptyVillages int
|
|
||||||
BonusVillages int
|
|
||||||
BonusNew int
|
BonusNew int
|
||||||
|
BonusVillages int
|
||||||
|
EmptyVillages int
|
||||||
|
Func int
|
||||||
Inner int
|
Inner int
|
||||||
SelectStart int
|
MapSize int
|
||||||
VillageMoveWait int
|
|
||||||
NobleRestart int
|
NobleRestart int
|
||||||
|
SelectStart int
|
||||||
StartVillages int
|
StartVillages int
|
||||||
|
VillageMoveWait int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigSitter struct {
|
type ServerConfigSitter struct {
|
||||||
|
@ -115,19 +115,19 @@ type ServerConfigSitter struct {
|
||||||
type ServerConfigSleep struct {
|
type ServerConfigSleep struct {
|
||||||
Active int
|
Active int
|
||||||
Delay int
|
Delay int
|
||||||
Min int
|
|
||||||
Max int
|
Max int
|
||||||
MinAwake int
|
|
||||||
MaxAwake int
|
MaxAwake int
|
||||||
|
Min int
|
||||||
|
MinAwake int
|
||||||
WarnTime int
|
WarnTime int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigNight struct {
|
type ServerConfigNight struct {
|
||||||
Active int
|
Active int
|
||||||
StartHour int
|
|
||||||
EndHour int
|
|
||||||
DefFactor float64
|
DefFactor float64
|
||||||
Duration int
|
Duration int
|
||||||
|
EndHour int
|
||||||
|
StartHour int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigWin struct {
|
type ServerConfigWin struct {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package domain
|
package domain
|
||||||
|
|
||||||
type Unit struct {
|
type Unit struct {
|
||||||
|
Attack int
|
||||||
BuildTime float64
|
BuildTime float64
|
||||||
|
Carry int
|
||||||
|
Defense int
|
||||||
|
DefenseArcher int
|
||||||
|
DefenseCavalry int
|
||||||
Pop int
|
Pop int
|
||||||
Speed float64
|
Speed float64
|
||||||
Attack int
|
|
||||||
Defense int
|
|
||||||
DefenseCavalry int
|
|
||||||
DefenseArcher int
|
|
||||||
Carry int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnitInfo struct {
|
type UnitInfo struct {
|
||||||
|
|
|
@ -139,7 +139,7 @@ func (re apiErrorRenderer) invalidParamFormatErrorToAPIError(
|
||||||
|
|
||||||
func (re apiErrorRenderer) domainErrorToAPIError(domainErr domain.Error) apiError {
|
func (re apiErrorRenderer) domainErrorToAPIError(domainErr domain.Error) apiError {
|
||||||
message := domainErr.Error()
|
message := domainErr.Error()
|
||||||
var pathElems []errorPathSegment
|
var pathSegments []errorPathSegment
|
||||||
|
|
||||||
var err error = domainErr
|
var err error = domainErr
|
||||||
for err != nil {
|
for err != nil {
|
||||||
|
@ -148,7 +148,7 @@ func (re apiErrorRenderer) domainErrorToAPIError(domainErr domain.Error) apiErro
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case errors.As(err, &validationErr):
|
case errors.As(err, &validationErr):
|
||||||
pathElems = append(pathElems, errorPathSegment{
|
pathSegments = append(pathSegments, errorPathSegment{
|
||||||
model: validationErr.Model,
|
model: validationErr.Model,
|
||||||
field: validationErr.Field,
|
field: validationErr.Field,
|
||||||
index: -1,
|
index: -1,
|
||||||
|
@ -156,7 +156,7 @@ func (re apiErrorRenderer) domainErrorToAPIError(domainErr domain.Error) apiErro
|
||||||
err = validationErr.Unwrap()
|
err = validationErr.Unwrap()
|
||||||
message = err.Error()
|
message = err.Error()
|
||||||
case errors.As(err, &sliceElementValidationErr):
|
case errors.As(err, &sliceElementValidationErr):
|
||||||
pathElems = append(pathElems, errorPathSegment{
|
pathSegments = append(pathSegments, errorPathSegment{
|
||||||
model: sliceElementValidationErr.Model,
|
model: sliceElementValidationErr.Model,
|
||||||
field: sliceElementValidationErr.Field,
|
field: sliceElementValidationErr.Field,
|
||||||
index: sliceElementValidationErr.Index,
|
index: sliceElementValidationErr.Index,
|
||||||
|
@ -170,12 +170,12 @@ func (re apiErrorRenderer) domainErrorToAPIError(domainErr domain.Error) apiErro
|
||||||
|
|
||||||
var path []string
|
var path []string
|
||||||
|
|
||||||
if len(pathElems) > 0 {
|
if len(pathSegments) > 0 {
|
||||||
if re.formatErrorPath == nil {
|
if re.formatErrorPath == nil {
|
||||||
return errAPIInternalServerError
|
return errAPIInternalServerError
|
||||||
}
|
}
|
||||||
|
|
||||||
path = re.formatErrorPath(pathElems)
|
path = re.formatErrorPath(pathSegments)
|
||||||
|
|
||||||
if len(path) == 0 {
|
if len(path) == 0 {
|
||||||
return errAPIInternalServerError
|
return errAPIInternalServerError
|
||||||
|
|
|
@ -71,6 +71,36 @@ func (h *apiHTTPHandler) GetServer(
|
||||||
renderJSON(w, r, http.StatusOK, apimodel.NewGetServerResponse(server))
|
renderJSON(w, r, http.StatusOK, apimodel.NewGetServerResponse(server))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *apiHTTPHandler) GetBuildingInfo(
|
||||||
|
w http.ResponseWriter,
|
||||||
|
r *http.Request,
|
||||||
|
_ apimodel.VersionCodePathParam,
|
||||||
|
_ apimodel.ServerKeyPathParam,
|
||||||
|
) {
|
||||||
|
server, _ := serverFromContext(r.Context())
|
||||||
|
renderJSON(w, r, http.StatusOK, apimodel.NewGetBuildingInfoResponse(server.BuildingInfo()))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *apiHTTPHandler) GetServerConfig(
|
||||||
|
w http.ResponseWriter,
|
||||||
|
r *http.Request,
|
||||||
|
_ apimodel.VersionCodePathParam,
|
||||||
|
_ apimodel.ServerKeyPathParam,
|
||||||
|
) {
|
||||||
|
server, _ := serverFromContext(r.Context())
|
||||||
|
renderJSON(w, r, http.StatusOK, apimodel.NewGetServerConfigResponse(server.Config()))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *apiHTTPHandler) GetUnitInfo(
|
||||||
|
w http.ResponseWriter,
|
||||||
|
r *http.Request,
|
||||||
|
_ apimodel.VersionCodePathParam,
|
||||||
|
_ apimodel.ServerKeyPathParam,
|
||||||
|
) {
|
||||||
|
server, _ := serverFromContext(r.Context())
|
||||||
|
renderJSON(w, r, http.StatusOK, apimodel.NewGetUnitInfoResponse(server.UnitInfo()))
|
||||||
|
}
|
||||||
|
|
||||||
func (h *apiHTTPHandler) serverMiddleware(next http.Handler) http.Handler {
|
func (h *apiHTTPHandler) serverMiddleware(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
|
|
|
@ -55,8 +55,87 @@ func NewListServersResponse(res domain.ListServersResult) ListServersResponse {
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGetServerResponse(v domain.Server) GetServerResponse {
|
func NewGetServerResponse(s domain.Server) GetServerResponse {
|
||||||
return GetServerResponse{
|
return GetServerResponse{
|
||||||
Data: NewServer(v),
|
Data: NewServer(s),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewServerConfig(cfg domain.ServerConfig) ServerConfig {
|
||||||
|
return ServerConfig{
|
||||||
|
Speed: cfg.Speed(),
|
||||||
|
UnitSpeed: cfg.UnitSpeed(),
|
||||||
|
Moral: cfg.Moral(),
|
||||||
|
Build: ServerConfigBuild(cfg.Build()),
|
||||||
|
Misc: ServerConfigMisc(cfg.Misc()),
|
||||||
|
Commands: ServerConfigCommands(cfg.Commands()),
|
||||||
|
Newbie: ServerConfigNewbie(cfg.Newbie()),
|
||||||
|
Game: ServerConfigGame(cfg.Game()),
|
||||||
|
Buildings: ServerConfigBuildings(cfg.Buildings()),
|
||||||
|
Snob: ServerConfigSnob(cfg.Snob()),
|
||||||
|
Ally: ServerConfigAlly(cfg.Ally()),
|
||||||
|
Coord: ServerConfigCoord(cfg.Coord()),
|
||||||
|
Sitter: ServerConfigSitter(cfg.Sitter()),
|
||||||
|
Sleep: ServerConfigSleep(cfg.Sleep()),
|
||||||
|
Night: ServerConfigNight(cfg.Night()),
|
||||||
|
Win: ServerConfigWin(cfg.Win()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetServerConfigResponse(cfg domain.ServerConfig) GetServerConfigResponse {
|
||||||
|
return GetServerConfigResponse{
|
||||||
|
Data: NewServerConfig(cfg),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewBuildingInfo(info domain.BuildingInfo) BuildingInfo {
|
||||||
|
return BuildingInfo{
|
||||||
|
Main: Building(info.Main()),
|
||||||
|
Barracks: Building(info.Barracks()),
|
||||||
|
Stable: Building(info.Stable()),
|
||||||
|
Garage: Building(info.Garage()),
|
||||||
|
Watchtower: Building(info.Watchtower()),
|
||||||
|
Snob: Building(info.Snob()),
|
||||||
|
Smith: Building(info.Smith()),
|
||||||
|
Place: Building(info.Place()),
|
||||||
|
Statue: Building(info.Statue()),
|
||||||
|
Market: Building(info.Market()),
|
||||||
|
Wood: Building(info.Wood()),
|
||||||
|
Stone: Building(info.Stone()),
|
||||||
|
Iron: Building(info.Iron()),
|
||||||
|
Farm: Building(info.Farm()),
|
||||||
|
Storage: Building(info.Storage()),
|
||||||
|
Hide: Building(info.Hide()),
|
||||||
|
Wall: Building(info.Wall()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetBuildingInfoResponse(info domain.BuildingInfo) GetBuildingInfoResponse {
|
||||||
|
return GetBuildingInfoResponse{
|
||||||
|
Data: NewBuildingInfo(info),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUnitInfo(info domain.UnitInfo) UnitInfo {
|
||||||
|
return UnitInfo{
|
||||||
|
Spear: Unit(info.Spear()),
|
||||||
|
Sword: Unit(info.Sword()),
|
||||||
|
Axe: Unit(info.Axe()),
|
||||||
|
Archer: Unit(info.Archer()),
|
||||||
|
Spy: Unit(info.Spy()),
|
||||||
|
Light: Unit(info.Light()),
|
||||||
|
Marcher: Unit(info.Marcher()),
|
||||||
|
Heavy: Unit(info.Heavy()),
|
||||||
|
Ram: Unit(info.Ram()),
|
||||||
|
Catapult: Unit(info.Catapult()),
|
||||||
|
Knight: Unit(info.Knight()),
|
||||||
|
Snob: Unit(info.Snob()),
|
||||||
|
Militia: Unit(info.Militia()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetUnitInfoResponse(info domain.UnitInfo) GetUnitInfoResponse {
|
||||||
|
return GetUnitInfoResponse{
|
||||||
|
Data: NewUnitInfo(info),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,18 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Building struct {
|
type Building struct {
|
||||||
MaxLevel int `xml:"max_level"`
|
|
||||||
MinLevel int `xml:"min_level"`
|
|
||||||
Wood int `xml:"wood"`
|
|
||||||
Stone int `xml:"stone"`
|
|
||||||
Iron int `xml:"iron"`
|
|
||||||
Pop int `xml:"pop"`
|
|
||||||
WoodFactor float64 `xml:"wood_factor"`
|
|
||||||
StoneFactor float64 `xml:"stone_factor"`
|
|
||||||
IronFactor float64 `xml:"iron_factor"`
|
|
||||||
PopFactor float64 `xml:"pop_factor"`
|
|
||||||
BuildTime float64 `xml:"build_time"`
|
BuildTime float64 `xml:"build_time"`
|
||||||
BuildTimeFactor float64 `xml:"build_time_factor"`
|
BuildTimeFactor float64 `xml:"build_time_factor"`
|
||||||
|
Iron int `xml:"iron"`
|
||||||
|
IronFactor float64 `xml:"iron_factor"`
|
||||||
|
MaxLevel int `xml:"max_level"`
|
||||||
|
MinLevel int `xml:"min_level"`
|
||||||
|
Pop int `xml:"pop"`
|
||||||
|
PopFactor float64 `xml:"pop_factor"`
|
||||||
|
Stone int `xml:"stone"`
|
||||||
|
StoneFactor float64 `xml:"stone_factor"`
|
||||||
|
Wood int `xml:"wood"`
|
||||||
|
WoodFactor float64 `xml:"wood_factor"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BuildingInfo struct {
|
type BuildingInfo struct {
|
||||||
|
|
|
@ -12,19 +12,19 @@ type ServerConfigBuild struct {
|
||||||
|
|
||||||
type ServerConfigMisc struct {
|
type ServerConfigMisc struct {
|
||||||
KillRanking int `xml:"kill_ranking"`
|
KillRanking int `xml:"kill_ranking"`
|
||||||
Tutorial int `xml:"tutorial"`
|
|
||||||
TradeCancelTime int `xml:"trade_cancel_time"`
|
TradeCancelTime int `xml:"trade_cancel_time"`
|
||||||
|
Tutorial int `xml:"tutorial"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigCommands struct {
|
type ServerConfigCommands struct {
|
||||||
MillisArrival int `xml:"millis_arrival"`
|
|
||||||
CommandCancelTime int `xml:"command_cancel_time"`
|
CommandCancelTime int `xml:"command_cancel_time"`
|
||||||
|
MillisArrival int `xml:"millis_arrival"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigNewbie struct {
|
type ServerConfigNewbie struct {
|
||||||
Days int `xml:"days"`
|
Days int `xml:"days"`
|
||||||
RatioDays int `xml:"ratio_days"`
|
|
||||||
Ratio int `xml:"ratio"`
|
Ratio int `xml:"ratio"`
|
||||||
|
RatioDays int `xml:"ratio_days"`
|
||||||
RemoveNewbieVillages int `xml:"removeNewbieVillages"`
|
RemoveNewbieVillages int `xml:"removeNewbieVillages"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,89 +54,89 @@ func (k *KnightNewItems) UnmarshalXML(d *xml.Decoder, start xml.StartElement) er
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigGame struct {
|
type ServerConfigGame struct {
|
||||||
BuildtimeFormula int `xml:"buildtime_formula"`
|
|
||||||
Knight int `xml:"knight"`
|
|
||||||
KnightNewItems KnightNewItems `xml:"knight_new_items"`
|
|
||||||
Archer int `xml:"archer"`
|
Archer int `xml:"archer"`
|
||||||
Tech int `xml:"tech"`
|
BarbarianMaxPoints int `xml:"barbarian_max_points"`
|
||||||
FarmLimit int `xml:"farm_limit"`
|
|
||||||
Church int `xml:"church"`
|
|
||||||
Watchtower int `xml:"watchtower"`
|
|
||||||
Stronghold int `xml:"stronghold"`
|
|
||||||
FakeLimit float64 `xml:"fake_limit"`
|
|
||||||
BarbarianRise float64 `xml:"barbarian_rise"`
|
BarbarianRise float64 `xml:"barbarian_rise"`
|
||||||
BarbarianShrink int `xml:"barbarian_shrink"`
|
BarbarianShrink int `xml:"barbarian_shrink"`
|
||||||
BarbarianMaxPoints int `xml:"barbarian_max_points"`
|
BaseProduction int `xml:"base_production"`
|
||||||
Scavenging int `xml:"scavenging"`
|
BuildtimeFormula int `xml:"buildtime_formula"`
|
||||||
|
Church int `xml:"church"`
|
||||||
|
Event int `xml:"event"`
|
||||||
|
FakeLimit float64 `xml:"fake_limit"`
|
||||||
|
FarmLimit int `xml:"farm_limit"`
|
||||||
Hauls int `xml:"hauls"`
|
Hauls int `xml:"hauls"`
|
||||||
HaulsBase int `xml:"hauls_base"`
|
HaulsBase int `xml:"hauls_base"`
|
||||||
HaulsMax int `xml:"hauls_max"`
|
HaulsMax int `xml:"hauls_max"`
|
||||||
BaseProduction int `xml:"base_production"`
|
Knight int `xml:"knight"`
|
||||||
Event int `xml:"event"`
|
KnightNewItems KnightNewItems `xml:"knight_new_items"`
|
||||||
|
Scavenging int `xml:"scavenging"`
|
||||||
|
Stronghold int `xml:"stronghold"`
|
||||||
SuppressEvents int `xml:"suppress_events"`
|
SuppressEvents int `xml:"suppress_events"`
|
||||||
|
Tech int `xml:"tech"`
|
||||||
|
Watchtower int `xml:"watchtower"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigBuildings struct {
|
type ServerConfigBuildings struct {
|
||||||
CustomMain int `xml:"custom_main"`
|
|
||||||
CustomFarm int `xml:"custom_farm"`
|
|
||||||
CustomStorage int `xml:"custom_storage"`
|
|
||||||
CustomPlace int `xml:"custom_place"`
|
|
||||||
CustomBarracks int `xml:"custom_barracks"`
|
CustomBarracks int `xml:"custom_barracks"`
|
||||||
CustomChurch int `xml:"custom_church"`
|
CustomChurch int `xml:"custom_church"`
|
||||||
CustomSmith int `xml:"custom_smith"`
|
CustomFarm int `xml:"custom_farm"`
|
||||||
CustomWood int `xml:"custom_wood"`
|
|
||||||
CustomStone int `xml:"custom_stone"`
|
|
||||||
CustomIron int `xml:"custom_iron"`
|
|
||||||
CustomMarket int `xml:"custom_market"`
|
|
||||||
CustomStable int `xml:"custom_stable"`
|
|
||||||
CustomWall int `xml:"custom_wall"`
|
|
||||||
CustomGarage int `xml:"custom_garage"`
|
CustomGarage int `xml:"custom_garage"`
|
||||||
CustomHide int `xml:"custom_hide"`
|
CustomHide int `xml:"custom_hide"`
|
||||||
|
CustomIron int `xml:"custom_iron"`
|
||||||
|
CustomMain int `xml:"custom_main"`
|
||||||
|
CustomMarket int `xml:"custom_market"`
|
||||||
|
CustomPlace int `xml:"custom_place"`
|
||||||
|
CustomSmith int `xml:"custom_smith"`
|
||||||
CustomSnob int `xml:"custom_snob"`
|
CustomSnob int `xml:"custom_snob"`
|
||||||
|
CustomStable int `xml:"custom_stable"`
|
||||||
CustomStatue int `xml:"custom_statue"`
|
CustomStatue int `xml:"custom_statue"`
|
||||||
|
CustomStone int `xml:"custom_stone"`
|
||||||
|
CustomStorage int `xml:"custom_storage"`
|
||||||
|
CustomWall int `xml:"custom_wall"`
|
||||||
CustomWatchtower int `xml:"custom_watchtower"`
|
CustomWatchtower int `xml:"custom_watchtower"`
|
||||||
|
CustomWood int `xml:"custom_wood"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigSnob struct {
|
type ServerConfigSnob struct {
|
||||||
Gold int `xml:"gold"`
|
|
||||||
CheapRebuild int `xml:"cheap_rebuild"`
|
CheapRebuild int `xml:"cheap_rebuild"`
|
||||||
Rise int `xml:"rise"`
|
|
||||||
MaxDist int `xml:"max_dist"`
|
|
||||||
Factor float64 `xml:"factor"`
|
|
||||||
CoinWood int `xml:"coin_wood"`
|
|
||||||
CoinStone int `xml:"coin_stone"`
|
|
||||||
CoinIron int `xml:"coin_iron"`
|
CoinIron int `xml:"coin_iron"`
|
||||||
|
CoinStone int `xml:"coin_stone"`
|
||||||
|
CoinWood int `xml:"coin_wood"`
|
||||||
|
Factor float64 `xml:"factor"`
|
||||||
|
Gold int `xml:"gold"`
|
||||||
|
MaxDist int `xml:"max_dist"`
|
||||||
NoBarbConquer int `xml:"no_barb_conquer"`
|
NoBarbConquer int `xml:"no_barb_conquer"`
|
||||||
|
Rise int `xml:"rise"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigAlly struct {
|
type ServerConfigAlly struct {
|
||||||
|
AllytimeSupport int `xml:"allytime_support"`
|
||||||
|
FixedAllies int `xml:"fixed_allies"`
|
||||||
|
Levels int `xml:"levels"`
|
||||||
|
Limit int `xml:"limit"`
|
||||||
NoHarm int `xml:"no_harm"`
|
NoHarm int `xml:"no_harm"`
|
||||||
|
NoJoin int `xml:"no_join"`
|
||||||
|
NoLeave int `xml:"no_leave"`
|
||||||
NoOtherSupport int `xml:"no_other_support"`
|
NoOtherSupport int `xml:"no_other_support"`
|
||||||
NoOtherSupportType int `xml:"no_other_support_type"`
|
NoOtherSupportType int `xml:"no_other_support_type"`
|
||||||
AllytimeSupport int `xml:"allytime_support"`
|
|
||||||
NoLeave int `xml:"no_leave"`
|
|
||||||
NoJoin int `xml:"no_join"`
|
|
||||||
Limit int `xml:"limit"`
|
|
||||||
FixedAllies int `xml:"fixed_allies"`
|
|
||||||
PointsMemberCount int `xml:"points_member_count"`
|
PointsMemberCount int `xml:"points_member_count"`
|
||||||
|
WarsAutoacceptDays int `xml:"wars_autoaccept_days"`
|
||||||
WarsMemberRequirement int `xml:"wars_member_requirement"`
|
WarsMemberRequirement int `xml:"wars_member_requirement"`
|
||||||
WarsPointsRequirement int `xml:"wars_points_requirement"`
|
WarsPointsRequirement int `xml:"wars_points_requirement"`
|
||||||
WarsAutoacceptDays int `xml:"wars_autoaccept_days"`
|
|
||||||
Levels int `xml:"levels"`
|
|
||||||
XpRequirements string `xml:"xp_requirements"`
|
XpRequirements string `xml:"xp_requirements"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigCoord struct {
|
type ServerConfigCoord struct {
|
||||||
MapSize int `xml:"map_size"`
|
|
||||||
Func int `xml:"func"`
|
|
||||||
EmptyVillages int `xml:"empty_villages"`
|
|
||||||
BonusVillages int `xml:"bonus_villages"`
|
|
||||||
BonusNew int `xml:"bonus_new"`
|
BonusNew int `xml:"bonus_new"`
|
||||||
|
BonusVillages int `xml:"bonus_villages"`
|
||||||
|
EmptyVillages int `xml:"empty_villages"`
|
||||||
|
Func int `xml:"func"`
|
||||||
Inner int `xml:"inner"`
|
Inner int `xml:"inner"`
|
||||||
SelectStart int `xml:"select_start"`
|
MapSize int `xml:"map_size"`
|
||||||
VillageMoveWait int `xml:"village_move_wait"`
|
|
||||||
NobleRestart int `xml:"noble_restart"`
|
NobleRestart int `xml:"noble_restart"`
|
||||||
|
SelectStart int `xml:"select_start"`
|
||||||
StartVillages int `xml:"start_villages"`
|
StartVillages int `xml:"start_villages"`
|
||||||
|
VillageMoveWait int `xml:"village_move_wait"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigSitter struct {
|
type ServerConfigSitter struct {
|
||||||
|
@ -146,19 +146,19 @@ type ServerConfigSitter struct {
|
||||||
type ServerConfigSleep struct {
|
type ServerConfigSleep struct {
|
||||||
Active int `xml:"active"`
|
Active int `xml:"active"`
|
||||||
Delay int `xml:"delay"`
|
Delay int `xml:"delay"`
|
||||||
Min int `xml:"min"`
|
|
||||||
Max int `xml:"max"`
|
Max int `xml:"max"`
|
||||||
MinAwake int `xml:"min_awake"`
|
|
||||||
MaxAwake int `xml:"max_awake"`
|
MaxAwake int `xml:"max_awake"`
|
||||||
|
Min int `xml:"min"`
|
||||||
|
MinAwake int `xml:"min_awake"`
|
||||||
WarnTime int `xml:"warn_time"`
|
WarnTime int `xml:"warn_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigNight struct {
|
type ServerConfigNight struct {
|
||||||
Active int `xml:"active"`
|
Active int `xml:"active"`
|
||||||
StartHour int `xml:"start_hour"`
|
|
||||||
EndHour int `xml:"end_hour"`
|
|
||||||
DefFactor float64 `xml:"def_factor"`
|
DefFactor float64 `xml:"def_factor"`
|
||||||
Duration int `xml:"duration"`
|
Duration int `xml:"duration"`
|
||||||
|
EndHour int `xml:"end_hour"`
|
||||||
|
StartHour int `xml:"start_hour"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfigWin struct {
|
type ServerConfigWin struct {
|
||||||
|
|
|
@ -5,14 +5,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Unit struct {
|
type Unit struct {
|
||||||
|
Attack int `xml:"attack"`
|
||||||
BuildTime float64 `xml:"build_time"`
|
BuildTime float64 `xml:"build_time"`
|
||||||
|
Carry int `xml:"carry"`
|
||||||
|
Defense int `xml:"defense"`
|
||||||
|
DefenseArcher int `xml:"defense_archer"`
|
||||||
|
DefenseCavalry int `xml:"defense_cavalry"`
|
||||||
Pop int `xml:"pop"`
|
Pop int `xml:"pop"`
|
||||||
Speed float64 `xml:"speed"`
|
Speed float64 `xml:"speed"`
|
||||||
Attack int `xml:"attack"`
|
|
||||||
Defense int `xml:"defense"`
|
|
||||||
DefenseCavalry int `xml:"defense_cavalry"`
|
|
||||||
DefenseArcher int `xml:"defense_archer"`
|
|
||||||
Carry int `xml:"carry"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnitInfo struct {
|
type UnitInfo struct {
|
||||||
|
|
Loading…
Reference in New Issue