Planet mining settings interface

* Modified owned planet view to include a field which indicates whether
mining settings are specific to the planet or come from the empire;
modified "simple" game components accordingly

* Modified stored procedures to only allow planet-specific mining
settings updates when the planet actually uses planet-specific settings,
and added a stored procedure which toggles the source of a planet's
settings

* Added corresponding parts to mining settings DAO and resources
controller

* Added session commands and server command handlers that toggle the
source of the settings and that upload the settings

* Split planet page template into multiple files for clarity and added
the mining priorities form to the natural resources tab
This commit is contained in:
Emmanuel BENOîT 2012-02-07 17:03:55 +01:00
parent 51b529a09f
commit e64f847ec3
25 changed files with 1009 additions and 152 deletions
legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets

View file

@ -0,0 +1,38 @@
package com.deepclone.lw.cmd.player.planets;
/**
* Command sent to toggle between empire-wide and planet-specific mining settings
*
* <p>
* Sending this command to the server will try to switch between empire-wide and planet-specific
* settings on a given planet. The planet must be owned by the empire sending the command.
*
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
*/
public class ToggleMiningSettingsCommand
extends ViewPlanetCommand
{
/**
* Serialisation version identifier
*
* <ul>
* <li>Introduced in B6M2 with ID 1.
* </ul>
*/
private static final long serialVersionUID = 1L;
/**
* Initialise the command
*
* @param planet
* the planet's identifier
*/
public ToggleMiningSettingsCommand( int planet )
{
super( planet );
}
}

View file

@ -0,0 +1,56 @@
package com.deepclone.lw.cmd.player.planets;
import java.util.Map;
/**
* Command that updates a planet's mining settings
*
* <p>
* This command must be sent with the identifier of a planet that belongs to the current empire. If
* the planet doesn't exist, if its ownership changed, or if it's configured to use empire-wide
* settings, the command will be ignored.
*
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
*/
public class UpdatePlanetMiningSettingsCommand
extends ViewPlanetCommand
{
/**
* Serialisation version identifier
*
* <ul>
* <li>Introduced in B6M2 with ID 1
* </ul>
*/
private static final long serialVersionUID = 1L;
/** The new mining settings */
private final Map< String , Integer > settings;
/**
* Initialise the command using a planet identifier and mining settings
*
* @param planet
* identifier of the planet to update
* @param settings
* a map that associates resource identifiers to priorities
*/
public UpdatePlanetMiningSettingsCommand( int planet , Map< String , Integer > settings )
{
super( planet );
this.settings = settings;
}
/** @return the mining settings to apply */
public Map< String , Integer > getSettings( )
{
return this.settings;
}
}