mirror of
https://github.com/arnaucube/gogame.git
synced 2026-02-06 19:16:40 +01:00
all buildings working
This commit is contained in:
@@ -181,8 +181,26 @@ func (u *User) GetBuildingCost(planet Planet, building string) (Resources, error
|
||||
return DeuteriumMineCost(planet.Buildings["deuteriummine"] + 1), nil
|
||||
case "energymine":
|
||||
return EnergyMineCost(planet.Buildings["energymine"] + 1), nil
|
||||
case "fusionreactor":
|
||||
return FussionReactorCost(planet.Buildings["fusionreactor"] + 1), nil
|
||||
case "roboticsfactory":
|
||||
return RoboticsFactoryCost(planet.Buildings["roboticsfactory"] + 1), nil
|
||||
case "shipyard":
|
||||
return ShipyardCost(planet.Buildings["shipyard"] + 1), nil
|
||||
case "metalstorage":
|
||||
return MetalStorageCost(planet.Buildings["metalstorage"] + 1), nil
|
||||
case "crystalstorage":
|
||||
return CrystalStorageCost(planet.Buildings["crystalstorage"] + 1), nil
|
||||
case "deuteriumstorage":
|
||||
return DeuteriumStorageCost(planet.Buildings["deuteriumstorage"] + 1), nil
|
||||
case "ressearchlab":
|
||||
return RessearchLabCost(planet.Buildings["ressearchlab"] + 1), nil
|
||||
case "alliancedepot":
|
||||
return AllianceDepotCost(planet.Buildings["alliancedepot"] + 1), nil
|
||||
case "missilesilo":
|
||||
return MissileSiloCost(planet.Buildings["missilesilo"] + 1), nil
|
||||
case "spacedock":
|
||||
return SpaceDockCost(planet.Buildings["spacedock"] + 1), nil
|
||||
default:
|
||||
return Resources{}, errors.New("building not found")
|
||||
}
|
||||
|
||||
@@ -91,7 +91,9 @@ func (srv Service) GetUserById(userid bson.ObjectId) (*models.User, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return models.UserDbToUser(srv.db, userDb), nil
|
||||
user := models.UserDbToUser(srv.db, userDb)
|
||||
_, err = user.GetResources()
|
||||
return user, err
|
||||
}
|
||||
|
||||
func (srv Service) GetUserPlanetsById(userid bson.ObjectId) ([]*models.Planet, error) {
|
||||
@@ -102,15 +104,3 @@ func (srv Service) GetUserPlanetsById(userid bson.ObjectId) ([]*models.Planet, e
|
||||
}
|
||||
return planets, err
|
||||
}
|
||||
|
||||
// func (srv Service) GetUser(id bson.ObjectId) (*models.User, error) {
|
||||
// // update user stats
|
||||
// user := getUserFromDB
|
||||
// user.GetStats()
|
||||
//
|
||||
// }
|
||||
//
|
||||
// func (srv Service) GetUser(id bson.ObjectId) (*models.User, error) {
|
||||
// // update user stats
|
||||
//
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user