Removed client-side display for old technology system
* Removed data classes and database access that were used to display technology information * Removed "Research" tab from Overview page on the web client
This commit is contained in:
parent
9a7bc03171
commit
154f215e24
10 changed files with 2 additions and 492 deletions
|
@ -4,9 +4,7 @@ package com.deepclone.lw.beans.empire;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -20,8 +18,6 @@ import com.deepclone.lw.cmd.player.gdata.NameIdPair;
|
|||
import com.deepclone.lw.cmd.player.gdata.PlanetListData;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.OverviewData;
|
||||
import com.deepclone.lw.interfaces.game.EmpireDAO;
|
||||
import com.deepclone.lw.sqld.game.EmpireTechLine;
|
||||
import com.deepclone.lw.sqld.game.EmpireTechnology;
|
||||
import com.deepclone.lw.sqld.game.GeneralInformation;
|
||||
import com.deepclone.lw.utils.StoredProc;
|
||||
|
||||
|
@ -145,58 +141,6 @@ public class EmpireDAOBean
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List< EmpireTechLine > getTechnology( int empireId )
|
||||
{
|
||||
String sql = "SELECT * FROM emp.tech_lines_view WHERE empire = ?";
|
||||
RowMapper< EmpireTechLine > lineMapper = new RowMapper< EmpireTechLine >( ) {
|
||||
@Override
|
||||
public EmpireTechLine mapRow( ResultSet rs , int rowNum )
|
||||
throws SQLException
|
||||
{
|
||||
EmpireTechLine etl = new EmpireTechLine( );
|
||||
etl.setId( rs.getInt( "tech_line" ) );
|
||||
etl.setName( rs.getString( "name" ) );
|
||||
etl.setDescription( rs.getString( "description" ) );
|
||||
return etl;
|
||||
}
|
||||
};
|
||||
|
||||
List< EmpireTechLine > lines = this.dTemplate.query( sql , lineMapper , empireId );
|
||||
if ( lines.isEmpty( ) ) {
|
||||
return lines;
|
||||
}
|
||||
|
||||
Map< Integer , EmpireTechLine > linesById = new HashMap< Integer , EmpireTechLine >( );
|
||||
for ( EmpireTechLine etl : lines ) {
|
||||
linesById.put( etl.getId( ) , etl );
|
||||
}
|
||||
|
||||
sql = "SELECT * FROM emp.technologies_view WHERE empire = ?";
|
||||
RowMapper< EmpireTechnology > techMapper = new RowMapper< EmpireTechnology >( ) {
|
||||
@Override
|
||||
public EmpireTechnology mapRow( ResultSet rs , int rowNum )
|
||||
throws SQLException
|
||||
{
|
||||
EmpireTechnology et = new EmpireTechnology( );
|
||||
et.setLine( rs.getInt( "tech_line" ) );
|
||||
et.setName( rs.getString( "name" ) );
|
||||
et.setDescription( rs.getString( "description" ) );
|
||||
et.setImplemented( rs.getBoolean( "implemented" ) );
|
||||
et.setProgress( (int) rs.getDouble( "progress" ) );
|
||||
et.setCost( rs.getInt( "cost" ) );
|
||||
return et;
|
||||
}
|
||||
};
|
||||
|
||||
for ( EmpireTechnology et : this.dTemplate.query( sql , techMapper , empireId ) ) {
|
||||
linesById.get( et.getLine( ) ).addTechnology( et );
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void implementTechnology( int empireId , int lineId )
|
||||
{
|
||||
|
|
|
@ -21,8 +21,6 @@ import com.deepclone.lw.cmd.player.gdata.PlanetListData;
|
|||
import com.deepclone.lw.cmd.player.gdata.PlanetListResourceRecord;
|
||||
import com.deepclone.lw.cmd.player.gdata.battles.BattleListEntry;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.OverviewData;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.ResearchLineData;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.TechnologyData;
|
||||
import com.deepclone.lw.interfaces.acm.UsersDAO;
|
||||
import com.deepclone.lw.interfaces.game.BattlesCache;
|
||||
import com.deepclone.lw.interfaces.game.BattlesDAO;
|
||||
|
@ -33,8 +31,6 @@ import com.deepclone.lw.interfaces.naming.NamingDAO;
|
|||
import com.deepclone.lw.interfaces.prefs.AccountPreferences;
|
||||
import com.deepclone.lw.interfaces.prefs.PreferencesDAO;
|
||||
import com.deepclone.lw.sqld.accounts.Account;
|
||||
import com.deepclone.lw.sqld.game.EmpireTechLine;
|
||||
import com.deepclone.lw.sqld.game.EmpireTechnology;
|
||||
import com.deepclone.lw.sqld.game.GeneralInformation;
|
||||
import com.deepclone.lw.sqld.game.battle.BattleListRecord;
|
||||
import com.deepclone.lw.utils.EmailAddress;
|
||||
|
@ -125,25 +121,6 @@ public class EmpireManagementBean
|
|||
public EmpireResponse getOverview( int empireId )
|
||||
{
|
||||
OverviewData overview = this.empireDao.getOverview( empireId );
|
||||
List< ResearchLineData > research = new LinkedList< ResearchLineData >( );
|
||||
|
||||
for ( EmpireTechLine etl : this.empireDao.getTechnology( empireId ) ) {
|
||||
List< TechnologyData > implemented = new LinkedList< TechnologyData >( );
|
||||
TechnologyData current = null;
|
||||
|
||||
for ( EmpireTechnology et : etl.getTechnologies( ) ) {
|
||||
if ( et.isImplemented( ) ) {
|
||||
implemented.add( new TechnologyData( et.getName( ) , et.getDescription( ) ) );
|
||||
} else if ( et.getProgress( ) == 100 ) {
|
||||
current = new TechnologyData( et.getName( ) , et.getDescription( ) , 100 , et.getCost( ) );
|
||||
} else {
|
||||
current = new TechnologyData( et.getName( ) , et.getDescription( ) , et.getProgress( ) );
|
||||
}
|
||||
}
|
||||
|
||||
research.add( new ResearchLineData( etl.getId( ) , etl.getName( ) , etl.getDescription( ) , implemented ,
|
||||
current ) );
|
||||
}
|
||||
|
||||
List< BattleListEntry > battles = new LinkedList< BattleListEntry >( );
|
||||
for ( BattleListRecord record : this.battlesDao.getBattles( empireId ) ) {
|
||||
|
@ -165,7 +142,7 @@ public class EmpireManagementBean
|
|||
|
||||
overview.setEconomy( this.resourcesInformationDao.getEmpireInformation( empireId ) );
|
||||
|
||||
return new EmpireResponse( this.getGeneralInformation( empireId ) , overview , research , battles );
|
||||
return new EmpireResponse( this.getGeneralInformation( empireId ) , overview , battles );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
package com.deepclone.lw.sqld.game;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
public class EmpireTechLine
|
||||
{
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private List< EmpireTechnology > technologies = new LinkedList< EmpireTechnology >( );
|
||||
|
||||
|
||||
public int getId( )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId( int id )
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getName( )
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription( )
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription( String description )
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public List< EmpireTechnology > getTechnologies( )
|
||||
{
|
||||
return technologies;
|
||||
}
|
||||
|
||||
|
||||
public void addTechnology( EmpireTechnology eTech )
|
||||
{
|
||||
this.technologies.add( eTech );
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
package com.deepclone.lw.sqld.game;
|
||||
|
||||
|
||||
public class EmpireTechnology
|
||||
{
|
||||
private int line;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private boolean implemented;
|
||||
|
||||
private int progress;
|
||||
|
||||
private int cost;
|
||||
|
||||
|
||||
public int getLine( )
|
||||
{
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
public void setLine( int line )
|
||||
{
|
||||
this.line = line;
|
||||
}
|
||||
|
||||
|
||||
public String getName( )
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription( )
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription( String description )
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public boolean isImplemented( )
|
||||
{
|
||||
return implemented;
|
||||
}
|
||||
|
||||
|
||||
public void setImplemented( boolean implemented )
|
||||
{
|
||||
this.implemented = implemented;
|
||||
}
|
||||
|
||||
|
||||
public int getProgress( )
|
||||
{
|
||||
return progress;
|
||||
}
|
||||
|
||||
|
||||
public void setProgress( int progress )
|
||||
{
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
|
||||
public int getCost( )
|
||||
{
|
||||
return cost;
|
||||
}
|
||||
|
||||
|
||||
public void setCost( int cost )
|
||||
{
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,7 +7,6 @@ import com.deepclone.lw.cmd.ObjectNameError;
|
|||
import com.deepclone.lw.cmd.player.gdata.NameIdPair;
|
||||
import com.deepclone.lw.cmd.player.gdata.PlanetListData;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.OverviewData;
|
||||
import com.deepclone.lw.sqld.game.EmpireTechLine;
|
||||
import com.deepclone.lw.sqld.game.GeneralInformation;
|
||||
|
||||
|
||||
|
@ -24,9 +23,6 @@ public interface EmpireDAO
|
|||
public OverviewData getOverview( int empireId );
|
||||
|
||||
|
||||
public List< EmpireTechLine > getTechnology( int empireId );
|
||||
|
||||
|
||||
public void implementTechnology( int empireId , int lineId );
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package com.deepclone.lw.cmd.player;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.deepclone.lw.cmd.player.gdata.GamePageData;
|
||||
import com.deepclone.lw.cmd.player.gdata.GameResponseBase;
|
||||
import com.deepclone.lw.cmd.player.gdata.battles.BattleListEntry;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.OverviewData;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.ResearchLineData;
|
||||
|
||||
|
||||
|
||||
|
@ -18,17 +16,14 @@ public class EmpireResponse
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final OverviewData overview;
|
||||
private final List< ResearchLineData > research;
|
||||
private final List< BattleListEntry > battles;
|
||||
|
||||
|
||||
public EmpireResponse( GamePageData page , OverviewData overview , List< ResearchLineData > research ,
|
||||
List< BattleListEntry > battles )
|
||||
public EmpireResponse( GamePageData page , OverviewData overview , List< BattleListEntry > battles )
|
||||
{
|
||||
super( page );
|
||||
this.overview = overview;
|
||||
this.battles = battles;
|
||||
this.research = Collections.unmodifiableList( research );
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,12 +33,6 @@ public class EmpireResponse
|
|||
}
|
||||
|
||||
|
||||
public List< ResearchLineData > getResearch( )
|
||||
{
|
||||
return research;
|
||||
}
|
||||
|
||||
|
||||
public List< BattleListEntry > getBattles( )
|
||||
{
|
||||
return battles;
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
package com.deepclone.lw.cmd.player.gdata.empire;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
public class ResearchLineData
|
||||
implements Serializable , Comparable< ResearchLineData >
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final long id;
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final List< TechnologyData > implemented;
|
||||
private final TechnologyData current;
|
||||
|
||||
|
||||
public ResearchLineData( long id , String name , String description , List< TechnologyData > implemented ,
|
||||
TechnologyData current )
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.implemented = Collections.unmodifiableList( implemented );
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo( ResearchLineData other )
|
||||
{
|
||||
return this.name.compareTo( other.name );
|
||||
}
|
||||
|
||||
|
||||
public long getId( )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public String getName( )
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription( )
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public List< TechnologyData > getImplemented( )
|
||||
{
|
||||
return implemented;
|
||||
}
|
||||
|
||||
|
||||
public TechnologyData getCurrent( )
|
||||
{
|
||||
return current;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package com.deepclone.lw.cmd.player.gdata.empire;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
public class TechnologyData
|
||||
implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final Integer researched;
|
||||
private final Long cost;
|
||||
|
||||
|
||||
public TechnologyData( String name , String description )
|
||||
{
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.researched = null;
|
||||
this.cost = null;
|
||||
}
|
||||
|
||||
|
||||
public TechnologyData( String name , String description , int researched )
|
||||
{
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.researched = researched;
|
||||
this.cost = null;
|
||||
}
|
||||
|
||||
|
||||
public TechnologyData( String name , String description , int researched , long cost )
|
||||
{
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.researched = researched;
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
|
||||
public String getName( )
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription( )
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public Integer getResearched( )
|
||||
{
|
||||
return researched;
|
||||
}
|
||||
|
||||
|
||||
public Long getCost( )
|
||||
{
|
||||
return cost;
|
||||
}
|
||||
|
||||
}
|
|
@ -67,56 +67,6 @@
|
|||
<@overviewResources />
|
||||
</@tab>
|
||||
|
||||
<@tab id="research" title="Research">
|
||||
<#if rs?size == 0>
|
||||
<p>Our scientists are still settling in.</p>
|
||||
</#if>
|
||||
<#list rs as research>
|
||||
<div>
|
||||
<h3>${research.name?xhtml}</h3>
|
||||
<p>${research.description?xhtml}</p>
|
||||
|
||||
<@left_column>
|
||||
<#if research.implemented?size == 0>
|
||||
<p>No usable technologies.</p>
|
||||
<#else>
|
||||
<@dt_main>
|
||||
<#list research.implemented as tech>
|
||||
<@dt_status>
|
||||
${tech.name?xhtml}
|
||||
<div class="auto-hide">${tech.description?xhtml}</div>
|
||||
</@dt_status>
|
||||
</#list>
|
||||
</@dt_main>
|
||||
</#if>
|
||||
</@left_column>
|
||||
|
||||
<#if research.current?has_content>
|
||||
<@right_column>
|
||||
<@dt_main>
|
||||
<@dt_status>
|
||||
Current research: <strong>${research.current.name?xhtml}</strong>
|
||||
<p>
|
||||
${research.current.description?xhtml}
|
||||
</p>
|
||||
</@dt_status>
|
||||
<@dt_entry title="Progress">${research.current.researched}%</@dt_entry>
|
||||
<#if research.current.cost?has_content>
|
||||
<@dt_entry title="Cost">${research.current.cost?string(",##0")} <@abbr_bgc/></@dt_entry>
|
||||
<#if data.page.cash gte research.current.cost && data.page.special! != 'v'>
|
||||
<@dt_status><form action="implement-${research.id}.action#research" method="post">
|
||||
<div><@ff_submit label="Implement technology" /></div>
|
||||
</form></@dt_status>
|
||||
</#if>
|
||||
</#if>
|
||||
</@dt_main>
|
||||
</@right_column>
|
||||
</#if>
|
||||
|
||||
</div>
|
||||
</#list>
|
||||
</@tab>
|
||||
|
||||
</@tabs>
|
||||
|
||||
</@page>
|
||||
|
|
|
@ -66,56 +66,6 @@
|
|||
<#include "overview/resources.ftl" />
|
||||
<@overviewResources />
|
||||
</@tab>
|
||||
|
||||
<@tab id="research" title="Recherche">
|
||||
<#if rs?size == 0>
|
||||
<p>Nos scientifiques sont encore en train de s'installer.</p>
|
||||
</#if>
|
||||
<#list rs as research>
|
||||
<div>
|
||||
<h3>${research.name?xhtml}</h3>
|
||||
<p>${research.description?xhtml}</p>
|
||||
|
||||
<@left_column>
|
||||
<#if research.implemented?size == 0>
|
||||
<p>Aucune technologie utilisable.</p>
|
||||
<#else>
|
||||
<@dt_main>
|
||||
<#list research.implemented as tech>
|
||||
<@dt_status>
|
||||
${tech.name?xhtml}
|
||||
<div class="auto-hide">${tech.description?xhtml}</div>
|
||||
</@dt_status>
|
||||
</#list>
|
||||
</@dt_main>
|
||||
</#if>
|
||||
</@left_column>
|
||||
|
||||
<#if research.current?has_content>
|
||||
<@right_column>
|
||||
<@dt_main>
|
||||
<@dt_status>
|
||||
Recherche actuelle : <strong>${research.current.name?xhtml}</strong>
|
||||
<p>
|
||||
${research.current.description?xhtml}
|
||||
</p>
|
||||
</@dt_status>
|
||||
<@dt_entry title="Progression">${research.current.researched}%</@dt_entry>
|
||||
<#if research.current.cost?has_content>
|
||||
<@dt_entry title="Coût">${research.current.cost?string(",##0")} <@abbr_bgc/></@dt_entry>
|
||||
<#if data.page.cash gte research.current.cost && data.page.special! != 'v'>
|
||||
<@dt_status><form action="implement-${research.id}.action#research" method="post">
|
||||
<div><@ff_submit label="Appliquer la technologie" /></div>
|
||||
</form></@dt_status>
|
||||
</#if>
|
||||
</#if>
|
||||
</@dt_main>
|
||||
</@right_column>
|
||||
</#if>
|
||||
|
||||
</div>
|
||||
</#list>
|
||||
</@tab>
|
||||
|
||||
</@tabs>
|
||||
|
||||
|
|
Reference in a new issue