cmd: upgrade group

This commit is contained in:
Ilia Denisov
2026-01-04 19:22:06 +02:00
parent 6157c07a35
commit c6e1cb5cdf
17 changed files with 918 additions and 245 deletions
+27
View File
@@ -20,6 +20,8 @@ const (
ErrShipsBusy = 5007
ErrShipsNotOnSamePlanet = 5008
ErrGiveawayGroupShipsTypeNotEqual = 5009
ErrUpgradeGroupNumberNotEnough = 5010
ErrUpgradeInsufficientResources = 5011
)
const (
@@ -49,6 +51,13 @@ const (
ErrInputCargoUnloadEmpty
ErrInputCargoUnoadNotEnough
ErrInputBreakGroupIllegalNumber
ErrInputTechUnknown
ErrInputTechInvalidMixing
ErrInputUpgradeShipTechNotUsed
ErrInputUpgradeParameterNotAllowed
ErrInputUpgradeShipsAlreadyUpToDate
ErrInputUpgradeGroupBreakNotAllowed
ErrInputUpgradeTechLevelInsufficient
)
func GenericErrorText(code int) string {
@@ -131,6 +140,24 @@ func GenericErrorText(code int) string {
return "Ships not on the same planet"
case ErrGiveawayGroupShipsTypeNotEqual:
return "Ship type already defined with different specifications"
case ErrInputTechUnknown:
return "Technology name unknown"
case ErrInputTechInvalidMixing:
return "Technologies list must containt only specific values"
case ErrInputUpgradeShipTechNotUsed:
return "Technology is not used with ship class"
case ErrInputUpgradeParameterNotAllowed:
return "Parameter not allowed for upgrade"
case ErrInputUpgradeShipsAlreadyUpToDate:
return "Ships already up to date, nothing to upgrade"
case ErrUpgradeGroupNumberNotEnough:
return "Not enough ships in the group to make an upgrade"
case ErrUpgradeInsufficientResources:
return "Insufficient planet production capacity"
case ErrInputUpgradeGroupBreakNotAllowed:
return "The Group is already in upgrade state and can't be divided to a smaller group"
case ErrInputUpgradeTechLevelInsufficient:
return "Insifficient Tech level for requested upgrade"
default:
return fmt.Sprintf("Undescribed error with code %d", code)
}
+36
View File
@@ -131,3 +131,39 @@ func NewShipsNotOnSamePlanetError(arg ...any) error {
func NewGiveawayGroupShipsTypeNotEqualError(arg ...any) error {
return newGenericError(ErrGiveawayGroupShipsTypeNotEqual, arg...)
}
func NewTechUnknownError(arg ...any) error {
return newGenericError(ErrInputTechUnknown, arg...)
}
func NewTechInvalidMixingError(arg ...any) error {
return newGenericError(ErrInputTechInvalidMixing, arg...)
}
func NewUpgradeShipTechNotUsedError(arg ...any) error {
return newGenericError(ErrInputUpgradeShipTechNotUsed, arg...)
}
func NewUpgradeParameterNotAllowedError(arg ...any) error {
return newGenericError(ErrInputUpgradeParameterNotAllowed, arg...)
}
func NewUpgradeShipsAlreadyUpToDateError(arg ...any) error {
return newGenericError(ErrInputUpgradeShipsAlreadyUpToDate, arg...)
}
func NewUpgradeGroupNumberNotEnoughError(arg ...any) error {
return newGenericError(ErrUpgradeGroupNumberNotEnough, arg...)
}
func NewUpgradeInsufficientResourcesError(arg ...any) error {
return newGenericError(ErrUpgradeInsufficientResources, arg...)
}
func NewUpgradeGroupBreakNotAllowedError(arg ...any) error {
return newGenericError(ErrInputUpgradeGroupBreakNotAllowed, arg...)
}
func NewUpgradeTechLevelInsufficientError(arg ...any) error {
return newGenericError(ErrInputUpgradeTechLevelInsufficient, arg...)
}