In-game resources views
* Added session records to carry resource information over to the clients * Added SQL support code for the various views * Added interface and implementation of the resource information access component * Hooked resources information queries into both the empire and planet management component * Added resources display to planet and overview pages
This commit is contained in:
parent
56eddcc4f0
commit
597429fadf
45 changed files with 3211 additions and 52 deletions
legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata
|
@ -0,0 +1,109 @@
|
|||
package com.deepclone.lw.cmd.player.gdata;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
public abstract class AbstractResourceRecord
|
||||
implements Serializable
|
||||
{
|
||||
|
||||
/**
|
||||
* The serialisation version identifier
|
||||
*
|
||||
* <ul>
|
||||
* <li>Introduced in B6M2 with ID 1
|
||||
* </ul>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** The text identifier of the resource */
|
||||
private String identifier;
|
||||
|
||||
/** The internationalised name of the resource's category */
|
||||
private String category;
|
||||
|
||||
/** The internationalised name of the resource */
|
||||
private String title;
|
||||
|
||||
/** The internationalised description of the resource */
|
||||
private String description;
|
||||
|
||||
|
||||
/** @return the text identifying the resource */
|
||||
public String getIdentifier( )
|
||||
{
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the text identifying the resource
|
||||
*
|
||||
* @param identifier
|
||||
* the text identifying the resource
|
||||
*/
|
||||
public void setIdentifier( String identifier )
|
||||
{
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
|
||||
/** @return the internationalised title of the resource */
|
||||
public String getTitle( )
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the internationalised title of the resource
|
||||
*
|
||||
* @param title
|
||||
* the internationalised title of the resource
|
||||
*/
|
||||
public void setTitle( String title )
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
||||
/** @return the internationalised name of the category of the resource */
|
||||
public String getCategory( )
|
||||
{
|
||||
return this.category;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the internationalised name of the category of the resource
|
||||
*
|
||||
* @param category
|
||||
* the internationalised name of the category of the resource
|
||||
*/
|
||||
public void setCategory( String category )
|
||||
{
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
/** @return the internationalised description of the resource */
|
||||
public String getDescription( )
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the internationalised description of the resource
|
||||
*
|
||||
* @param description
|
||||
* the internationalised description of the resource
|
||||
*/
|
||||
public void setDescription( String description )
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
package com.deepclone.lw.cmd.player.gdata.empire;
|
||||
|
||||
|
||||
import com.deepclone.lw.cmd.player.gdata.AbstractResourceRecord;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Resource economic record
|
||||
*
|
||||
* <p>
|
||||
* This record describes a resource. It is used in the empire overview's economic information and
|
||||
* for mining settings.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*
|
||||
*/
|
||||
public class EmpireResourceRecord
|
||||
extends AbstractResourceRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* The serialisation version identifier
|
||||
*
|
||||
* <ul>
|
||||
* <li>Introduced in B6M2 with ID 1
|
||||
* </ul>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** The income for this type of resource over 12h RT / 1 month GT */
|
||||
private long income;
|
||||
|
||||
/** The planet upkeep for this type of resource over 12h RT / 1 month GT */
|
||||
private long planetUpkeep;
|
||||
|
||||
/** The fleet upkeep for this type of resource over 12h RT / 1 month GT */
|
||||
private long fleetUpkeep;
|
||||
|
||||
/** The amount of resources of this type possessed by the empire */
|
||||
private long stockpiled;
|
||||
|
||||
/** The resource's mining priority, or <code>null</code> for basic resources */
|
||||
private Integer miningPriority;
|
||||
|
||||
|
||||
/** @return the income for this type of resource over a period of 12h RT / 1 month GT */
|
||||
public long getIncome( )
|
||||
{
|
||||
return this.income;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the income for this type of resource over a period of 12h RT / 1 month GT
|
||||
*
|
||||
* @param income
|
||||
* the income for this type of resource over a period of 12h RT / 1 month GT
|
||||
*/
|
||||
public void setIncome( long income )
|
||||
{
|
||||
this.income = income;
|
||||
}
|
||||
|
||||
|
||||
/** @return the upkeep for this type of resource over a period of 12h RT / 1 month GT on planets */
|
||||
public long getPlanetUpkeep( )
|
||||
{
|
||||
return this.planetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the upkeep for this type of resource over a period of 12h RT / 1 month GT on planets
|
||||
*
|
||||
* @param planetUpkeep
|
||||
* the upkeep for this type of resource over a period of 12h RT / 1 month GT on
|
||||
* planets
|
||||
*/
|
||||
public void setPlanetUpkeep( long planetUpkeep )
|
||||
{
|
||||
this.planetUpkeep = planetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/** @return the upkeep for this type of resource over a period of 12h RT / 1 month GT on planets */
|
||||
public long getFleetUpkeep( )
|
||||
{
|
||||
return this.fleetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the fleet upkeep for this type of resource over a period of 12h RT / 1 month GT
|
||||
*
|
||||
* @param fleetUpkeep
|
||||
* the fleet upkeep for this type of resource over a period of 12h RT / 1 month GT
|
||||
*/
|
||||
public void setFleetUpkeep( long fleetUpkeep )
|
||||
{
|
||||
this.fleetUpkeep = fleetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/** @return the total upkeep (including both fleet and planet upkeep) */
|
||||
public long getUpkeep( )
|
||||
{
|
||||
return this.fleetUpkeep + this.planetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/** @return the amount of resources of this type the empire possesses */
|
||||
public long getStockpiled( )
|
||||
{
|
||||
return this.stockpiled;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the amount of resources of this type the empire possesses
|
||||
*
|
||||
* @param stockpiled
|
||||
* the amount of resources of this type the empire possesses
|
||||
*/
|
||||
public void setStockpiled( long stockpiled )
|
||||
{
|
||||
this.stockpiled = stockpiled;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the mining priority for this type of resource, or <code>null</code> if it is a basic
|
||||
* resource
|
||||
*/
|
||||
public Integer getMiningPriority( )
|
||||
{
|
||||
return this.miningPriority;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the mining priority for this type of resource
|
||||
*
|
||||
* @param miningPriority
|
||||
* the mining priority for this type of resource
|
||||
*/
|
||||
public void setMiningPriority( int miningPriority )
|
||||
{
|
||||
this.miningPriority = miningPriority;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.gdata.empire;
|
|||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
|
@ -9,124 +10,234 @@ public class OverviewData
|
|||
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;
|
||||
|
||||
/** Quantity of planets owned by the empire */
|
||||
private long planets;
|
||||
|
||||
/** Amount of unread messages */
|
||||
private int newMessages;
|
||||
|
||||
/** Total population in the empire */
|
||||
private long population;
|
||||
|
||||
/** Average happiness of the population on the planets, as a percentage */
|
||||
private int avgHappiness;
|
||||
|
||||
/** Total fleet power */
|
||||
private long fleetPower;
|
||||
|
||||
/** Total monetary income from planets */
|
||||
private long planetIncome;
|
||||
|
||||
/** Total monetary upkeep for planets */
|
||||
private long planetUpkeep;
|
||||
|
||||
/** Total monetary fleet upkeep */
|
||||
private long fleetUpkeep;
|
||||
|
||||
/** Total amount of money in the various queues */
|
||||
private long investment;
|
||||
|
||||
/** Economic information */
|
||||
private List< EmpireResourceRecord > economy;
|
||||
|
||||
|
||||
/** @return the quantity of planets owned by the empire */
|
||||
public long getPlanets( )
|
||||
{
|
||||
return planets;
|
||||
return this.planets;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the quantity of planets owned by the empire
|
||||
*
|
||||
* @param planets
|
||||
* the quantity of planets owned by the empire
|
||||
*/
|
||||
public void setPlanets( long planets )
|
||||
{
|
||||
this.planets = planets;
|
||||
}
|
||||
|
||||
|
||||
/** @return the quantity of unread messages */
|
||||
public int getNewMessages( )
|
||||
{
|
||||
return newMessages;
|
||||
return this.newMessages;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the quantity of unread messages
|
||||
*
|
||||
* @param newMessages
|
||||
* the quantity of unread messages
|
||||
*/
|
||||
public void setNewMessages( int newMessages )
|
||||
{
|
||||
this.newMessages = newMessages;
|
||||
}
|
||||
|
||||
|
||||
/** @return the empire's total population */
|
||||
public long getPopulation( )
|
||||
{
|
||||
return population;
|
||||
return this.population;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the empire's total population
|
||||
*
|
||||
* @param population
|
||||
* the empire's total population
|
||||
*/
|
||||
public void setPopulation( long population )
|
||||
{
|
||||
this.population = population;
|
||||
}
|
||||
|
||||
|
||||
/** @return the average happiness on the empire's planets */
|
||||
public int getAvgHappiness( )
|
||||
{
|
||||
return avgHappiness;
|
||||
return this.avgHappiness;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the average happiness on the empire's planets
|
||||
*
|
||||
* @param avgHappiness
|
||||
* the average happiness on the empire's planets
|
||||
*/
|
||||
public void setAvgHappiness( int avgHappiness )
|
||||
{
|
||||
this.avgHappiness = avgHappiness;
|
||||
}
|
||||
|
||||
|
||||
/** @return the total fleet power */
|
||||
public long getFleetPower( )
|
||||
{
|
||||
return fleetPower;
|
||||
return this.fleetPower;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the total fleet power
|
||||
*
|
||||
* @param fleetPower
|
||||
* the total fleet power
|
||||
*/
|
||||
public void setFleetPower( long fleetPower )
|
||||
{
|
||||
this.fleetPower = fleetPower;
|
||||
}
|
||||
|
||||
|
||||
/** @return the monetary income from the empire's planets */
|
||||
public long getPlanetIncome( )
|
||||
{
|
||||
return planetIncome;
|
||||
return this.planetIncome;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the monetary income from the empire's planets
|
||||
*
|
||||
* @param planetIncome
|
||||
* the monetary income from the empire's planets
|
||||
*/
|
||||
public void setPlanetIncome( long planetIncome )
|
||||
{
|
||||
this.planetIncome = planetIncome;
|
||||
}
|
||||
|
||||
|
||||
/** @return the monetary upkeep for the empire's planets */
|
||||
public long getPlanetUpkeep( )
|
||||
{
|
||||
return planetUpkeep;
|
||||
return this.planetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the monetary upkeep for the empire's planets
|
||||
*
|
||||
* @param planetUpkeep
|
||||
* the monetary upkeep for the empire's planets
|
||||
*/
|
||||
public void setPlanetUpkeep( long planetUpkeep )
|
||||
{
|
||||
this.planetUpkeep = planetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/** @return the monetary upkeep for the empire's fleets */
|
||||
public long getFleetUpkeep( )
|
||||
{
|
||||
return fleetUpkeep;
|
||||
return this.fleetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the monetary upkeep for the empire's fleets
|
||||
*
|
||||
* @param fleetUpkeep
|
||||
* the monetary upkeep for the empire's fleets
|
||||
*/
|
||||
public void setFleetUpkeep( long fleetUpkeep )
|
||||
{
|
||||
this.fleetUpkeep = fleetUpkeep;
|
||||
}
|
||||
|
||||
|
||||
/** @return the total amount of money invested in civilian or military queues */
|
||||
public long getInvestment( )
|
||||
{
|
||||
return investment;
|
||||
return this.investment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the total amount of money invested in civilian or military queues
|
||||
*
|
||||
* @param investment
|
||||
* the total amount of money invested in civilian or military queues
|
||||
*/
|
||||
public void setInvestment( long investment )
|
||||
{
|
||||
this.investment = investment;
|
||||
}
|
||||
|
||||
|
||||
/** @return the list of economic information records */
|
||||
public List< EmpireResourceRecord > getEconomy( )
|
||||
{
|
||||
return this.economy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the list of economic information records
|
||||
*
|
||||
* @param economy
|
||||
* the list of economic information records
|
||||
*/
|
||||
public void setEconomy( List< EmpireResourceRecord > economy )
|
||||
{
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,128 +6,283 @@ import java.util.List;
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Planet view details available to planet owners
|
||||
*
|
||||
* <p>
|
||||
* This class carries the part of the planet view which is only available to empires owning the
|
||||
* planet being viewed.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*/
|
||||
public class PlanetOwnView
|
||||
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;
|
||||
|
||||
/** Happiness of the planet's population as a percentage */
|
||||
private int happiness;
|
||||
|
||||
/**
|
||||
* Happiness change indicator
|
||||
*
|
||||
* <p>
|
||||
* This field's value is an integer between -2 and 2 (inclusive). It indicates the direction of
|
||||
* the happiness' change (positive meaning that the happiness is increasing, negative meaning it
|
||||
* is decreasing), and the strength of the change (absolute value 1 meaning a relatively small
|
||||
* change, 2 a bigger one)
|
||||
*/
|
||||
private int hChange;
|
||||
|
||||
/** Planet monetary income for 24h of RL time */
|
||||
private long income;
|
||||
|
||||
/** Planet monetary upkeep for 24h of RL time */
|
||||
private long upkeep;
|
||||
|
||||
/**
|
||||
* Various planet state indicators
|
||||
*
|
||||
* <p>
|
||||
* This field carries a few flags about whether it is possible to rename or abandon the planet,
|
||||
* and similar information.
|
||||
*/
|
||||
private OwnPlanetStatusData status;
|
||||
|
||||
/** Civilian construction queue */
|
||||
private QueueData civQueue;
|
||||
|
||||
/** Military construction queue */
|
||||
private QueueData milQueue;
|
||||
|
||||
/** Descriptions of ships that can be built */
|
||||
private List< BuildableShipData > bShips;
|
||||
|
||||
/** Descriptions of buildings that can be constructed */
|
||||
private List< BuildableBuildingData > bBuildings;
|
||||
|
||||
/** List of the planet's resources */
|
||||
private List< PlanetResourceRecord > resources;
|
||||
|
||||
/** Is the planet using specific mining settings? */
|
||||
private boolean ownMiningSettings;
|
||||
|
||||
|
||||
/** @return the planet's happiness */
|
||||
public int getHappiness( )
|
||||
{
|
||||
return happiness;
|
||||
return this.happiness;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the planet's happiness
|
||||
*
|
||||
* @param happiness
|
||||
* the planet's happiness
|
||||
*/
|
||||
public void setHappiness( int happiness )
|
||||
{
|
||||
this.happiness = happiness;
|
||||
}
|
||||
|
||||
|
||||
/** @return the planet's happiness change indicator */
|
||||
public int gethChange( )
|
||||
{
|
||||
return hChange;
|
||||
return this.hChange;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the planet's happiness change indicator
|
||||
*
|
||||
* @param hChange
|
||||
* the planet's happiness change indicator
|
||||
*/
|
||||
public void sethChange( int hChange )
|
||||
{
|
||||
this.hChange = hChange;
|
||||
}
|
||||
|
||||
|
||||
/** @return the planet's monetary income */
|
||||
public long getIncome( )
|
||||
{
|
||||
return income;
|
||||
return this.income;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the planet's monetary income
|
||||
*
|
||||
* @param income
|
||||
* the planet's monetary income
|
||||
*/
|
||||
public void setIncome( long income )
|
||||
{
|
||||
this.income = income;
|
||||
}
|
||||
|
||||
|
||||
/** @return the planet's monetary upkeep */
|
||||
public long getUpkeep( )
|
||||
{
|
||||
return upkeep;
|
||||
return this.upkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the planet's monetary upkeep
|
||||
*
|
||||
* @param upkeep
|
||||
* the planet's monetary upkeep
|
||||
*/
|
||||
public void setUpkeep( long upkeep )
|
||||
{
|
||||
this.upkeep = upkeep;
|
||||
}
|
||||
|
||||
|
||||
/** @return the planet status object */
|
||||
public OwnPlanetStatusData getStatus( )
|
||||
{
|
||||
return status;
|
||||
return this.status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the planet status object
|
||||
*
|
||||
* @param status
|
||||
* the planet status object
|
||||
*/
|
||||
public void setStatus( OwnPlanetStatusData status )
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
/** @return the civilian construction queue */
|
||||
public QueueData getCivQueue( )
|
||||
{
|
||||
return civQueue;
|
||||
return this.civQueue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the civilian construction queue
|
||||
*
|
||||
* @param civQueue
|
||||
* the civilian construction queue
|
||||
*/
|
||||
public void setCivQueue( QueueData civQueue )
|
||||
{
|
||||
this.civQueue = civQueue;
|
||||
}
|
||||
|
||||
|
||||
/** @return the military construction queue */
|
||||
public QueueData getMilQueue( )
|
||||
{
|
||||
return milQueue;
|
||||
return this.milQueue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the military construction queue
|
||||
*
|
||||
* @param milQueue
|
||||
* the military construction queue
|
||||
*/
|
||||
public void setMilQueue( QueueData milQueue )
|
||||
{
|
||||
this.milQueue = milQueue;
|
||||
}
|
||||
|
||||
|
||||
/** @return the descriptions of all ships which can be constructed */
|
||||
public List< BuildableShipData > getbShips( )
|
||||
{
|
||||
return bShips;
|
||||
return this.bShips;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the descriptions of ships which can be constructed
|
||||
*
|
||||
* @param bShips
|
||||
* the descriptions of ships which can be constructed
|
||||
*/
|
||||
public void setbShips( List< BuildableShipData > bShips )
|
||||
{
|
||||
this.bShips = bShips;
|
||||
}
|
||||
|
||||
|
||||
/** @return the descriptions of all buildings which can be constructed */
|
||||
public List< BuildableBuildingData > getbBuildings( )
|
||||
{
|
||||
return bBuildings;
|
||||
return this.bBuildings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the descriptions of buildings which can be constructed
|
||||
*
|
||||
* @param bBuildings
|
||||
* the descriptions of buildings which can be constructed
|
||||
*/
|
||||
public void setbBuildings( List< BuildableBuildingData > bBuildings )
|
||||
{
|
||||
this.bBuildings = bBuildings;
|
||||
}
|
||||
|
||||
|
||||
/** @return the list of resources */
|
||||
public List< PlanetResourceRecord > getResources( )
|
||||
{
|
||||
return this.resources;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the list of resources
|
||||
*
|
||||
* @param resourceProviders
|
||||
* the list of resources
|
||||
*/
|
||||
public void setResources( List< PlanetResourceRecord > resources )
|
||||
{
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
|
||||
/** @return whether the planet is using specific mining settings */
|
||||
public boolean getOwnMiningSettings( )
|
||||
{
|
||||
return this.ownMiningSettings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set whether the planet is using specific mining settings
|
||||
*
|
||||
* @param ownMiningSettings
|
||||
* whether the planet is using specific mining settings
|
||||
*/
|
||||
public void setOwnMiningSettings( boolean ownMiningSettings )
|
||||
{
|
||||
this.ownMiningSettings = ownMiningSettings;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
package com.deepclone.lw.cmd.player.gdata.planets;
|
||||
|
||||
|
||||
import com.deepclone.lw.cmd.player.gdata.AbstractResourceRecord;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Planet resources information
|
||||
*
|
||||
* <p>
|
||||
* This class carries information about a resource type, including all required strings, as well as
|
||||
* income, upkeep and investment. It also contains information about the planet's resource provider
|
||||
* if there is one.
|
||||
*
|
||||
* <p>
|
||||
* The class is used by {@link PlanetOwnView} to represent all of a planet's resources.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*/
|
||||
public class PlanetResourceRecord
|
||||
extends AbstractResourceRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* The serialisation version identifier
|
||||
*
|
||||
* <ul>
|
||||
* <li>Introduced in B6M2 with ID 1
|
||||
* </ul>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Income for 12h RT / 1 month GT */
|
||||
private long income;
|
||||
|
||||
/** Upkeep for 12h RT / 1 month GT */
|
||||
private long upkeep;
|
||||
|
||||
/** Quantity of that resource that will be used by the planet's queues */
|
||||
private long invested;
|
||||
|
||||
/** Information about the planet's resource provider of that type, if there is one */
|
||||
private ResourceProviderRecord resourceProvider;
|
||||
|
||||
|
||||
/** @return the planet's income for that resource, over 12h RT / 1 month GT */
|
||||
public long getIncome( )
|
||||
{
|
||||
return this.income;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the planet's income for that resource
|
||||
*
|
||||
* @param income
|
||||
* the planet's income for that resource, over 12h RT / 1 month GT
|
||||
*/
|
||||
public void setIncome( long income )
|
||||
{
|
||||
this.income = income;
|
||||
}
|
||||
|
||||
|
||||
/** @return the planet's upkeep for that resource, over 12h RT / 1 month GT */
|
||||
public long getUpkeep( )
|
||||
{
|
||||
return this.upkeep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the planet's upkeep for that resource
|
||||
*
|
||||
* @param upkeep
|
||||
* the planet's upkeep for that resource, over 12h RT / 1 month GT
|
||||
*/
|
||||
public void setUpkeep( long upkeep )
|
||||
{
|
||||
this.upkeep = upkeep;
|
||||
}
|
||||
|
||||
|
||||
/** @return the amount of that resource invested in the planet's build queues */
|
||||
public long getInvested( )
|
||||
{
|
||||
return this.invested;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the amount of that resource invested in the planet's build queues
|
||||
*
|
||||
* @param invested
|
||||
* the amount of that resource invested in the planet's build queues
|
||||
*/
|
||||
public void setInvested( long invested )
|
||||
{
|
||||
this.invested = invested;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the resource provider data on that planet for the current resource type or
|
||||
* <code>null</code> if there is no resource provider of that type.
|
||||
*/
|
||||
public ResourceProviderRecord getResourceProvider( )
|
||||
{
|
||||
return this.resourceProvider;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the resource provider data on that planet for the current resource type
|
||||
*
|
||||
* @param resourceProvider
|
||||
* the resource provider data on that planet for the current resource type
|
||||
*/
|
||||
public void setResourceProvider( ResourceProviderRecord resourceProvider )
|
||||
{
|
||||
this.resourceProvider = resourceProvider;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package com.deepclone.lw.cmd.player.gdata.planets;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Information displayed about a resource provider
|
||||
*
|
||||
* <p>
|
||||
* This class carries the information about a resource provider and associated mining priorities.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*/
|
||||
public class ResourceProviderRecord
|
||||
implements Serializable
|
||||
{
|
||||
|
||||
/**
|
||||
* The serialisation version identifier
|
||||
*
|
||||
* <ul>
|
||||
* <li>Introduced in B6M2 with ID 1
|
||||
* </ul>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** The resource provider's capacity (maximal quantity of resources) */
|
||||
private long capacity;
|
||||
|
||||
/** The current quantity of resources in the provider */
|
||||
private long quantity;
|
||||
|
||||
/** The extraction difficulty as a percentage */
|
||||
private int difficulty;
|
||||
|
||||
/** The extraction priority */
|
||||
private int priority;
|
||||
|
||||
|
||||
/** @return the resource provider's capacity */
|
||||
public long getCapacity( )
|
||||
{
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the resource provider's capacity
|
||||
*
|
||||
* @param capacity
|
||||
* the resource provider's capacity
|
||||
*/
|
||||
public void setCapacity( long capacity )
|
||||
{
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
|
||||
/** @return the resource provider's current quantity */
|
||||
public long getQuantity( )
|
||||
{
|
||||
return this.quantity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the resource provider's current quantity
|
||||
*
|
||||
* @param quantity
|
||||
* the resource provider's current quantity
|
||||
*/
|
||||
public void setQuantity( long quantity )
|
||||
{
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
|
||||
/** @return the extraction difficulty */
|
||||
public int getDifficulty( )
|
||||
{
|
||||
return this.difficulty;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the extraction difficulty
|
||||
*
|
||||
* @param difficulty
|
||||
* the extraction difficulty
|
||||
*/
|
||||
public void setDifficulty( int difficulty )
|
||||
{
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
|
||||
/** @return the extraction priority */
|
||||
public int getPriority( )
|
||||
{
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the extraction priority
|
||||
*
|
||||
* @param priority
|
||||
* the extraction priority
|
||||
*/
|
||||
public void setPriority( int priority )
|
||||
{
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue