Skip to content

Commit

Permalink
Renamed level parameter in defences, fleet and shipyard to amount.
Browse files Browse the repository at this point in the history
  • Loading branch information
skiwi2 committed Jan 8, 2016
1 parent af209b7 commit 03b6c65
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class UserscriptController {
def planetPosition = json.planetPosition.toInteger()
def planet = planetService.findPlanet(universe, planetId) ?: planetService.createPlanet(player, planetId, planetGalaxy, planetSolarSystem, planetPosition, planetName)

def defencesMap = json.defences.collectEntries { [it.id.toInteger(), it.level.toInteger()] }
def defencesMap = json.defences.collectEntries { [it.id.toInteger(), it.amount.toInteger()] }
def defencesNumbers = [401, 402, 403, 404, 405, 406, 407, 408, 502, 503].collect { defencesMap[it] }
defencesService.updatePlanetDefences(planet, *defencesNumbers)

Expand All @@ -201,7 +201,7 @@ class UserscriptController {
def planetPosition = json.planetPosition.toInteger()
def planet = planetService.findPlanet(universe, planetId) ?: planetService.createPlanet(player, planetId, planetGalaxy, planetSolarSystem, planetPosition, planetName)

def fleetMap = json.fleet.collectEntries { [it.id.toInteger(), it.level.toInteger()] }
def fleetMap = json.fleet.collectEntries { [it.id.toInteger(), it.amount.toInteger()] }
def fleetNumbers = [204, 205, 206, 207, 202, 203, 208, 215, 211, 213, 214, 209, 210].collect { fleetMap[it] }
fleetService.updatePlanetFleet(planet, *fleetNumbers)

Expand All @@ -228,7 +228,7 @@ class UserscriptController {
def planetPosition = json.planetPosition.toInteger()
def planet = planetService.findPlanet(universe, planetId) ?: planetService.createPlanet(player, planetId, planetGalaxy, planetSolarSystem, planetPosition, planetName)

def shipyardMap = json.shipyard.collectEntries { [it.id.toInteger(), it.level.toInteger()] }
def shipyardMap = json.shipyard.collectEntries { [it.id.toInteger(), it.amount.toInteger()] }
def shipyardNumbers = [204, 205, 206, 207, 202, 203, 208, 215, 211, 213, 214, 209, 210].collect { shipyardMap[it] }
def solarSatellites = shipyardMap[212]
fleetService.updatePlanetFleet(planet, *shipyardNumbers)
Expand Down
74 changes: 37 additions & 37 deletions src/test/groovy/com/ognext/api/UserscriptControllerSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,16 @@ class UserscriptControllerSpec extends Specification {
planetSolarSystem: "204",
planetPosition: "8",
defences: [
[id: "401", level: "69"],
[id: "402", level: "158"],
[id: "403", level: "12"],
[id: "404", level: "14"],
[id: "405", level: "0"],
[id: "406", level: "1"],
[id: "407", level: "1"],
[id: "408", level: "1"],
[id: "502", level: "20"],
[id: "503", level: "0"]
[id: "401", amount: "69"],
[id: "402", amount: "158"],
[id: "403", amount: "12"],
[id: "404", amount: "14"],
[id: "405", amount: "0"],
[id: "406", amount: "1"],
[id: "407", amount: "1"],
[id: "408", amount: "1"],
[id: "502", amount: "20"],
[id: "503", amount: "0"]
]
] as JSON
request.method = "POST"
Expand Down Expand Up @@ -432,19 +432,19 @@ class UserscriptControllerSpec extends Specification {
planetSolarSystem: "204",
planetPosition: "8",
fleet: [
[id: "204", level: "0"],
[id: "205", level: "0"],
[id: "206", level: "106"],
[id: "207", level: "20"],
[id: "202", level: "63"],
[id: "203", level: "25"],
[id: "208", level: "0"],
[id: "215", level: "0"],
[id: "211", level: "5"],
[id: "213", level: "0"],
[id: "214", level: "0"],
[id: "209", level: "35"],
[id: "210", level: "12"]
[id: "204", amount: "0"],
[id: "205", amount: "0"],
[id: "206", amount: "106"],
[id: "207", amount: "20"],
[id: "202", amount: "63"],
[id: "203", amount: "25"],
[id: "208", amount: "0"],
[id: "215", amount: "0"],
[id: "211", amount: "5"],
[id: "213", amount: "0"],
[id: "214", amount: "0"],
[id: "209", amount: "35"],
[id: "210", amount: "12"]
]
] as JSON
request.method = "POST"
Expand Down Expand Up @@ -483,20 +483,20 @@ class UserscriptControllerSpec extends Specification {
planetSolarSystem: "204",
planetPosition: "8",
shipyard: [
[id: "204", level: "0"],
[id: "205", level: "0"],
[id: "206", level: "106"],
[id: "207", level: "20"],
[id: "202", level: "63"],
[id: "203", level: "25"],
[id: "208", level: "0"],
[id: "215", level: "0"],
[id: "211", level: "5"],
[id: "213", level: "0"],
[id: "214", level: "0"],
[id: "209", level: "35"],
[id: "210", level: "12"],
[id: "212", level: "5"]
[id: "204", amount: "0"],
[id: "205", amount: "0"],
[id: "206", amount: "106"],
[id: "207", amount: "20"],
[id: "202", amount: "63"],
[id: "203", amount: "25"],
[id: "208", amount: "0"],
[id: "215", amount: "0"],
[id: "211", amount: "5"],
[id: "213", amount: "0"],
[id: "214", amount: "0"],
[id: "209", amount: "35"],
[id: "210", amount: "12"],
[id: "212", amount: "5"]
]
] as JSON
request.method = "POST"
Expand Down

0 comments on commit 03b6c65

Please sign in to comment.