Resources information on planet list
* Added resource information records to the planet list's response. * Added a database view and the corresponding row mapper and DAO method which can be used as the data source for the planet list's resource information. For now this view always returns 0 for both civilian and military investments. * Added new tab to display resource information on the planet list page. The old version of the economy tab will be kept until the corresponding data no longer exists. * The following SQL scripts must be re-executed to upgrade a database: -> 040-functions/167-planet-list.sql
This commit is contained in:
parent
bf6bea5a79
commit
96670d45be
15 changed files with 1079 additions and 31 deletions
legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata
|
@ -2,331 +2,663 @@ package com.deepclone.lw.cmd.player.gdata;
|
|||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An entry in the planet list
|
||||
*
|
||||
* <p>
|
||||
* This class represents an entry in the planet list. It contains all available information about a
|
||||
* single planet.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*/
|
||||
public class PlanetListData
|
||||
implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* Serialisation version identifier
|
||||
*
|
||||
* <ul>
|
||||
* <li>Introduced in B6M1 with ID 1
|
||||
* <li>Modified in B6M2, ID set to 2
|
||||
* </ul>
|
||||
*/
|
||||
private static final long serialVersionUID = 2L;
|
||||
|
||||
/** Identifier of the planet */
|
||||
private int id;
|
||||
/** Name of the planet */
|
||||
private String name;
|
||||
|
||||
/** Abscissa of the planet's system */
|
||||
private int x;
|
||||
/** Ordinates of the planet's system */
|
||||
private int y;
|
||||
/** Orbit of the planet in its system */
|
||||
private int orbit;
|
||||
|
||||
/** Current population */
|
||||
private long population;
|
||||
/** Happiness percentage */
|
||||
private int happiness;
|
||||
|
||||
/** Resources information (income, upkeep, etc...) */
|
||||
private List< PlanetListResourceRecord > resources;
|
||||
|
||||
/** Monetary income of the planet */
|
||||
private long income;
|
||||
/** Monetary upkeep of the planet */
|
||||
private long upkeep;
|
||||
|
||||
/** Current military production */
|
||||
private long militaryProduction;
|
||||
/** Current industrial production */
|
||||
private long industrialProduction;
|
||||
/** Current "extra population growth" production */
|
||||
private long growthProduction;
|
||||
|
||||
/** Money invested in the civilian queue */
|
||||
private long civInvestment;
|
||||
/** Amount of buildings in the civilian queue */
|
||||
private int civAmount;
|
||||
/** Whether the current operation on the civilian queue is a destruction */
|
||||
private boolean civDestroy;
|
||||
/** Name of the buildings being destroyed or constructed */
|
||||
private String civName;
|
||||
|
||||
/** Money invested in the military build queue */
|
||||
private long milInvestment;
|
||||
/** Amount of ships in the civilian queue */
|
||||
private int milAmount;
|
||||
/** Name of the ships being constructed */
|
||||
private String milName;
|
||||
|
||||
/** Fleet power from turrets */
|
||||
private long fpStatic;
|
||||
/** Power of the owner's fleets */
|
||||
private long fpOwn;
|
||||
/** Power of the friendly fleets */
|
||||
private long fpFriendly;
|
||||
/** Power of the hostile fleets */
|
||||
private long fpHostile;
|
||||
|
||||
/** Battle identifier or <code>null</code> if there is no battle */
|
||||
private Long battle;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the identifier of the planet.
|
||||
*
|
||||
* @return the identifier of the planet
|
||||
*/
|
||||
public int getId( )
|
||||
{
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the identifier of the planet.
|
||||
*
|
||||
* @param id
|
||||
* the new identifier of the planet
|
||||
*/
|
||||
public void setId( int id )
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the name of the planet.
|
||||
*
|
||||
* @return the name of the planet
|
||||
*/
|
||||
public String getName( )
|
||||
{
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the name of the planet.
|
||||
*
|
||||
* @param name
|
||||
* the new name of the planet
|
||||
*/
|
||||
public void setName( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the abscissa of the planet's system.
|
||||
*
|
||||
* @return the abscissa of the planet's system
|
||||
*/
|
||||
public int getX( )
|
||||
{
|
||||
return x;
|
||||
return this.x;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the abscissa of the planet's system.
|
||||
*
|
||||
* @param x
|
||||
* the new abscissa of the planet's system
|
||||
*/
|
||||
public void setX( int x )
|
||||
{
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the ordinates of the planet's system.
|
||||
*
|
||||
* @return the ordinates of the planet's system
|
||||
*/
|
||||
public int getY( )
|
||||
{
|
||||
return y;
|
||||
return this.y;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the ordinates of the planet's system.
|
||||
*
|
||||
* @param y
|
||||
* the new ordinates of the planet's system
|
||||
*/
|
||||
public void setY( int y )
|
||||
{
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the orbit of the planet in its system.
|
||||
*
|
||||
* @return the orbit of the planet in its system
|
||||
*/
|
||||
public int getOrbit( )
|
||||
{
|
||||
return orbit;
|
||||
return this.orbit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the orbit of the planet in its system.
|
||||
*
|
||||
* @param orbit
|
||||
* the new orbit of the planet in its system
|
||||
*/
|
||||
public void setOrbit( int orbit )
|
||||
{
|
||||
this.orbit = orbit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current population.
|
||||
*
|
||||
* @return the current population
|
||||
*/
|
||||
public long getPopulation( )
|
||||
{
|
||||
return population;
|
||||
return this.population;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current population.
|
||||
*
|
||||
* @param population
|
||||
* the new current population
|
||||
*/
|
||||
public void setPopulation( long population )
|
||||
{
|
||||
this.population = population;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the happiness percentage.
|
||||
*
|
||||
* @return the happiness percentage
|
||||
*/
|
||||
public int getHappiness( )
|
||||
{
|
||||
return happiness;
|
||||
return this.happiness;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the happiness percentage.
|
||||
*
|
||||
* @param happiness
|
||||
* the new happiness percentage
|
||||
*/
|
||||
public void setHappiness( int happiness )
|
||||
{
|
||||
this.happiness = happiness;
|
||||
}
|
||||
|
||||
|
||||
public long getIncome( )
|
||||
/**
|
||||
* Gets the resources information records
|
||||
*
|
||||
* @return the resources information records
|
||||
*/
|
||||
public List< PlanetListResourceRecord > getResources( )
|
||||
{
|
||||
return income;
|
||||
return this.resources;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the resources information records
|
||||
*
|
||||
* @param resources
|
||||
* the new resources information records
|
||||
*/
|
||||
public void setResources( List< PlanetListResourceRecord > resources )
|
||||
{
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the monetary income of the planet.
|
||||
*
|
||||
* @return the monetary income of the planet
|
||||
*/
|
||||
public long getIncome( )
|
||||
{
|
||||
return this.income;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the monetary income of the planet.
|
||||
*
|
||||
* @param income
|
||||
* the new monetary income of the planet
|
||||
*/
|
||||
public void setIncome( long income )
|
||||
{
|
||||
this.income = income;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the monetary upkeep of the planet.
|
||||
*
|
||||
* @return the monetary upkeep of the planet
|
||||
*/
|
||||
public long getUpkeep( )
|
||||
{
|
||||
return upkeep;
|
||||
return this.upkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the monetary upkeep of the planet.
|
||||
*
|
||||
* @param upkeep
|
||||
* the new monetary upkeep of the planet
|
||||
*/
|
||||
public void setUpkeep( long upkeep )
|
||||
{
|
||||
this.upkeep = upkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current military production.
|
||||
*
|
||||
* @return the current military production
|
||||
*/
|
||||
public long getMilitaryProduction( )
|
||||
{
|
||||
return militaryProduction;
|
||||
return this.militaryProduction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current military production.
|
||||
*
|
||||
* @param militaryProduction
|
||||
* the new current military production
|
||||
*/
|
||||
public void setMilitaryProduction( long militaryProduction )
|
||||
{
|
||||
this.militaryProduction = militaryProduction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current industrial production.
|
||||
*
|
||||
* @return the current industrial production
|
||||
*/
|
||||
public long getIndustrialProduction( )
|
||||
{
|
||||
return industrialProduction;
|
||||
return this.industrialProduction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current industrial production.
|
||||
*
|
||||
* @param industrialProduction
|
||||
* the new current industrial production
|
||||
*/
|
||||
public void setIndustrialProduction( long industrialProduction )
|
||||
{
|
||||
this.industrialProduction = industrialProduction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current "extra population growth" production.
|
||||
*
|
||||
* @return the current "extra population growth" production
|
||||
*/
|
||||
public long getGrowthProduction( )
|
||||
{
|
||||
return growthProduction;
|
||||
return this.growthProduction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current "extra population growth" production.
|
||||
*
|
||||
* @param growthProduction
|
||||
* the new current "extra population growth" production
|
||||
*/
|
||||
public void setGrowthProduction( long growthProduction )
|
||||
{
|
||||
this.growthProduction = growthProduction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the money invested in the civilian queue.
|
||||
*
|
||||
* @return the money invested in the civilian queue
|
||||
*/
|
||||
public long getCivInvestment( )
|
||||
{
|
||||
return civInvestment;
|
||||
return this.civInvestment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the money invested in the civilian queue.
|
||||
*
|
||||
* @param civInvestment
|
||||
* the new money invested in the civilian queue
|
||||
*/
|
||||
public void setCivInvestment( long civInvestment )
|
||||
{
|
||||
this.civInvestment = civInvestment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the amount of buildings in the civilian queue.
|
||||
*
|
||||
* @return the amount of buildings in the civilian queue
|
||||
*/
|
||||
public int getCivAmount( )
|
||||
{
|
||||
return civAmount;
|
||||
return this.civAmount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the amount of buildings in the civilian queue.
|
||||
*
|
||||
* @param civAmount
|
||||
* the new amount of buildings in the civilian queue
|
||||
*/
|
||||
public void setCivAmount( int civAmount )
|
||||
{
|
||||
this.civAmount = civAmount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether the current operation on the civilian queue is a destruction.
|
||||
*
|
||||
* @return <code>true</code> if the current operation on the civilian queue is a destruction
|
||||
*/
|
||||
public boolean isCivDestroy( )
|
||||
{
|
||||
return civDestroy;
|
||||
return this.civDestroy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether the current operation on the civilian queue is a destruction.
|
||||
*
|
||||
* @param civDestroy
|
||||
* <code>true</code> if the current operation on the civilian queue is a destruction
|
||||
*/
|
||||
public void setCivDestroy( boolean civDestroy )
|
||||
{
|
||||
this.civDestroy = civDestroy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the name of the buildings being destroyed or constructed.
|
||||
*
|
||||
* @return the name of the buildings being destroyed or constructed
|
||||
*/
|
||||
public String getCivName( )
|
||||
{
|
||||
return civName;
|
||||
return this.civName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the name of the buildings being destroyed or constructed.
|
||||
*
|
||||
* @param civName
|
||||
* the new name of the buildings being destroyed or constructed
|
||||
*/
|
||||
public void setCivName( String civName )
|
||||
{
|
||||
this.civName = civName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the money invested in the military build queue.
|
||||
*
|
||||
* @return the money invested in the military build queue
|
||||
*/
|
||||
public long getMilInvestment( )
|
||||
{
|
||||
return milInvestment;
|
||||
return this.milInvestment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the money invested in the military build queue.
|
||||
*
|
||||
* @param milInvestment
|
||||
* the new money invested in the military build queue
|
||||
*/
|
||||
public void setMilInvestment( long milInvestment )
|
||||
{
|
||||
this.milInvestment = milInvestment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the amount of ships in the civilian queue.
|
||||
*
|
||||
* @return the amount of ships in the civilian queue
|
||||
*/
|
||||
public int getMilAmount( )
|
||||
{
|
||||
return milAmount;
|
||||
return this.milAmount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the amount of ships in the civilian queue.
|
||||
*
|
||||
* @param milAmount
|
||||
* the new amount of ships in the civilian queue
|
||||
*/
|
||||
public void setMilAmount( int milAmount )
|
||||
{
|
||||
this.milAmount = milAmount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the name of the ships being constructed.
|
||||
*
|
||||
* @return the name of the ships being constructed
|
||||
*/
|
||||
public String getMilName( )
|
||||
{
|
||||
return milName;
|
||||
return this.milName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the name of the ships being constructed.
|
||||
*
|
||||
* @param milName
|
||||
* the new name of the ships being constructed
|
||||
*/
|
||||
public void setMilName( String milName )
|
||||
{
|
||||
this.milName = milName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the fleet power from turrets.
|
||||
*
|
||||
* @return the fleet power from turrets
|
||||
*/
|
||||
public long getFpStatic( )
|
||||
{
|
||||
return fpStatic;
|
||||
return this.fpStatic;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the fleet power from turrets.
|
||||
*
|
||||
* @param fpStatic
|
||||
* the new fleet power from turrets
|
||||
*/
|
||||
public void setFpStatic( long fpStatic )
|
||||
{
|
||||
this.fpStatic = fpStatic;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the power of the owner's fleets.
|
||||
*
|
||||
* @return the power of the owner's fleets
|
||||
*/
|
||||
public long getFpOwn( )
|
||||
{
|
||||
return fpOwn;
|
||||
return this.fpOwn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the power of the owner's fleets.
|
||||
*
|
||||
* @param fpOwn
|
||||
* the new power of the owner's fleets
|
||||
*/
|
||||
public void setFpOwn( long fpOwn )
|
||||
{
|
||||
this.fpOwn = fpOwn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the power of the friendly fleets.
|
||||
*
|
||||
* @return the power of the friendly fleets
|
||||
*/
|
||||
public long getFpFriendly( )
|
||||
{
|
||||
return fpFriendly;
|
||||
return this.fpFriendly;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the power of the friendly fleets.
|
||||
*
|
||||
* @param fpFriendly
|
||||
* the new power of the friendly fleets
|
||||
*/
|
||||
public void setFpFriendly( long fpFriendly )
|
||||
{
|
||||
this.fpFriendly = fpFriendly;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the power of the hostile fleets.
|
||||
*
|
||||
* @return the power of the hostile fleets
|
||||
*/
|
||||
public long getFpHostile( )
|
||||
{
|
||||
return fpHostile;
|
||||
return this.fpHostile;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the power of the hostile fleets.
|
||||
*
|
||||
* @param fpHostile
|
||||
* the new power of the hostile fleets
|
||||
*/
|
||||
public void setFpHostile( long fpHostile )
|
||||
{
|
||||
this.fpHostile = fpHostile;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the battle identifier or <code>null</code> if there is no battle.
|
||||
*
|
||||
* @return the battle identifier or <code>null</code> if there is no battle
|
||||
*/
|
||||
public Long getBattle( )
|
||||
{
|
||||
return battle;
|
||||
return this.battle;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the battle identifier.
|
||||
*
|
||||
* @param battle
|
||||
* the new battle identifier or <code>null</code> if there is no battle
|
||||
*/
|
||||
public void setBattle( Long battle )
|
||||
{
|
||||
this.battle = battle;
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
package com.deepclone.lw.cmd.player.gdata;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A resource record for the planet list
|
||||
*
|
||||
* <p>
|
||||
* This class is used by {@link PlanetListData} to carry information about resources for the planet
|
||||
* list page.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*/
|
||||
public class PlanetListResourceRecord
|
||||
implements Serializable
|
||||
|
||||
{
|
||||
|
||||
/**
|
||||
* Serialisation version identifier
|
||||
*
|
||||
* <ul>
|
||||
* <li>Introduced in B6M2 with ID 1
|
||||
* </ul>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** The name of the resource */
|
||||
private String name;
|
||||
|
||||
/** The income for that resource type */
|
||||
private long income;
|
||||
|
||||
/** The upkeep for that resource type */
|
||||
private long upkeep;
|
||||
|
||||
/** The amount of that resource invested into the civilian construction queue */
|
||||
private long civInvestment;
|
||||
|
||||
/** The amount of that resource invested into the military construction queue */
|
||||
private long milInvestment;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the name of the resource.
|
||||
*
|
||||
* @return the name of the resource
|
||||
*/
|
||||
public String getName( )
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the name of the resource.
|
||||
*
|
||||
* @param name
|
||||
* the new name of the resource
|
||||
*/
|
||||
public void setName( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the income for that resource type.
|
||||
*
|
||||
* @return the income for that resource type
|
||||
*/
|
||||
public long getIncome( )
|
||||
{
|
||||
return this.income;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the income for that resource type.
|
||||
*
|
||||
* @param income
|
||||
* the new income for that resource type
|
||||
*/
|
||||
public void setIncome( long income )
|
||||
{
|
||||
this.income = income;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the upkeep for that resource type.
|
||||
*
|
||||
* @return the upkeep for that resource type
|
||||
*/
|
||||
public long getUpkeep( )
|
||||
{
|
||||
return this.upkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the upkeep for that resource type.
|
||||
*
|
||||
* @param upkeep
|
||||
* the new upkeep for that resource type
|
||||
*/
|
||||
public void setUpkeep( long upkeep )
|
||||
{
|
||||
this.upkeep = upkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the amount of that resource invested into the civilian construction queue.
|
||||
*
|
||||
* @return the amount of that resource invested into the civilian construction queue
|
||||
*/
|
||||
public long getCivInvestment( )
|
||||
{
|
||||
return this.civInvestment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the amount of that resource invested into the civilian construction queue.
|
||||
*
|
||||
* @param civInvestment
|
||||
* the new amount of that resource invested into the civilian construction queue
|
||||
*/
|
||||
public void setCivInvestment( long civInvestment )
|
||||
{
|
||||
this.civInvestment = civInvestment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the amount of that resource invested into the military construction queue.
|
||||
*
|
||||
* @return the amount of that resource invested into the military construction queue
|
||||
*/
|
||||
public long getMilInvestment( )
|
||||
{
|
||||
return this.milInvestment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the amount of that resource invested into the military construction queue.
|
||||
*
|
||||
* @param milInvestment
|
||||
* the new amount of that resource invested into the military construction queue
|
||||
*/
|
||||
public void setMilInvestment( long milInvestment )
|
||||
{
|
||||
this.milInvestment = milInvestment;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue