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:
Emmanuel BENOîT 2012-02-04 10:43:12 +01:00
parent 56eddcc4f0
commit 597429fadf
45 changed files with 3211 additions and 52 deletions
legacyworlds-web-main/Content/Raw/WEB-INF/fm

View file

@ -63,4 +63,11 @@
</#macro>
<#macro abbr_bgc><abbr title="billion galactic credits">bgc</abbr></#macro>
<#macro abbr_st><abbr title="Server time">ST</abbr></#macro>
<#macro abbr_gt><abbr title="Time in the game universe">GT</abbr></#macro>
<#macro abbr_gt><abbr title="Time in the game universe">GT</abbr></#macro>
<#macro over_time title>
<#if data.page.useRLTime>
${title?xhtml} (for 12h)
<#else>
Monthly ${title?xhtml}
</#if>
</#macro>

View file

@ -61,7 +61,64 @@
</@right_column>
</@tab>
<@tab id="economy" title="Economy">
<@listview>
<@lv_line headers=true>
<@lv_column width=30>&nbsp;</@lv_column>
<@lv_column width="x">Resource</@lv_column>
<@lv_column width=100 centered=true><@over_time "Income" /></@lv_column>
<@lv_column width=100 centered=true><@over_time "Upkeep" /></@lv_column>
<@lv_column width=100 centered=true>Reserves</@lv_column>
<@lv_column width=100 centered=true>Mining priority</@lv_column>
</@lv_line>
<#list ov.economy as resource>
<#if previousCategory?has_content && !resource.category?has_content
|| resource.category?has_content && !previousCategory?has_content
|| resource.category?has_content && previousCategory?has_content
&& resource.category != previousCategory>
<@lv_line>
<#if resource.category?has_content>
<td colspan="5"><strong>${resource.category?xhtml}</strong></td>
<#else>
<td colspan="5"><hr /></td>
</#if>
</@lv_line>
<#local previousCategory=resource.category>
</#if>
<@lv_line>
<@lv_column>&nbsp;</@lv_column>
<@lv_column>${resource.title?xhtml}
<div class="auto-hide">${resource.description?xhtml}</div>
</@lv_column>
<@lv_column centered=true>${resource.income?string(",##0")}</@lv_column>
<@lv_column centered=true>${resource.upkeep?string(",##0")}</@lv_column>
<@lv_column centered=true>${resource.stockpiled?string(",##0")}</@lv_column>
<@lv_column centered=true>
<#if resource.miningPriority?has_content>
<#switch resource.miningPriority>
<#case 0>lowest<#break>
<#case 1>low<#break>
<#case 2>normal<#break>
<#case 3>high<#break>
<#case 4>highest<#break>
</#switch>
<#else>
N/A
</#if>
</@lv_column>
</@lv_line>
</#list>
</@listview>
</@tab>
<@tab id="research" title="Research">
<#if rs?size == 0>
<p>Our scientists are still settling in.</p>

View file

@ -108,6 +108,55 @@
</#if>
</@tab>
<#if data.own?has_content && data.own.resources?size gt 0>
<@tab id="resources" title="Economy">
<@listview>
<#local previousCategory="">
<@lv_line headers=true>
<@lv_column width=30>&nbsp;</@lv_column>
<@lv_column width="x">Resource</@lv_column>
<@lv_column width=100 centered=true><@over_time "Income" /></@lv_column>
<@lv_column width=100 centered=true><@over_time "Upkeep" /></@lv_column>
<@lv_column width=100 centered=true>Invested</@lv_column>
</@lv_line>
<#list data.own.resources as resource>
<#if previousCategory?has_content && !resource.category?has_content
|| resource.category?has_content && !previousCategory?has_content
|| resource.category?has_content && previousCategory?has_content
&& resource.category != previousCategory>
<@lv_line>
<#if resource.category?has_content>
<td colspan="5"><strong>${resource.category?xhtml}</strong></td>
<#else>
<td colspan="5"><hr /></td>
</#if>
</@lv_line>
<#local previousCategory=resource.category>
</#if>
<@lv_line>
<@lv_column>&nbsp;</@lv_column>
<@lv_column>${resource.title?xhtml}
<div class="auto-hide">${resource.description?xhtml}</div>
</@lv_column>
<@lv_column centered=true>${resource.income?string(",##0")}</@lv_column>
<@lv_column centered=true>${resource.upkeep?string(",##0")}</@lv_column>
<@lv_column centered=true>${resource.invested?string(",##0")}</@lv_column>
</@lv_line>
</#list>
</@listview>
</@tab>
</#if>
<#if data.orbit?has_content>
@ -143,6 +192,7 @@
<#case "DEF">defence<#break>
<#case "WORK">mil. output<#break>
<#case "POP">growth<#break>
<#case "MINE">res. extraction<#break>
</#switch>
</@lv_column>
<@lv_column centered=true>${building.jobs?string(",##0")}</@lv_column>
@ -189,6 +239,7 @@
<#case "DEF">defence<#break>
<#case "WORK">mil. output<#break>
<#case "POP">growth<#break>
<#case "MINE">res. extraction<#break>
</#switch>
</@dt_entry>
</@dt_main>
@ -251,6 +302,7 @@
</#if>
<#if data.own?has_content>
<@tab id="ships" title="Shipyards">
<#if data.page.special! != 'v'>
<#if data.own.milQueue.appendPossible>
@ -321,9 +373,60 @@
</@listview>
</#if>
</@tab>
</#if>
</#if>
</#if>
<#list data.own.resources as resource>
<#if resource.resourceProvider?has_content>
<#local showResources=true>
<#break>
</#if>
</#list>
<#if showResources?has_content>
<@tab id="natres" title="Natural resources">
<@listview>
<@lv_line headers=true>
<@lv_column width="x">Resource</@lv_column>
<@lv_column width=100 right=true>Quantity&nbsp;</@lv_column>
<@lv_column width=100>&nbsp;&nbsp;Capacity</@lv_column>
<@lv_column width=100 centered=true>Extraction<br/>difficulty</@lv_column>
<@lv_column width=100 centered=true>Priority</@lv_column>
</@lv_line>
<#list data.own.resources as resource>
<#if resource.resourceProvider?has_content>
<#local resProv=resource.resourceProvider>
<@lv_line>
<@lv_column>
${resource.title?xhtml}
<div class="auto-hide">${resource.description?xhtml}</div>
</@lv_column>
<@lv_column right=true>${resProv.quantity?string(",##0")}&nbsp;</@lv_column>
<@lv_column>/&nbsp;${resProv.capacity?string(",##0")}</@lv_column>
<@lv_column centered=true>${resProv.difficulty}&nbsp;%</@lv_column>
<@lv_column centered=true>
<#switch resProv.priority>
<#case 0>lowest<#break>
<#case 1>low<#break>
<#case 2>normal<#break>
<#case 3>high<#break>
<#case 4>highest<#break>
</#switch>
</@lv_column>
</@lv_line>
</#if>
</#list>
</@listview>
</@tab>
</#if>
</#if>
</@tabs>
</@page>
</#macro>

View file

@ -63,4 +63,11 @@
</#macro>
<#macro abbr_bgc><abbr title="milliards de crédits galactiques">mcg</abbr></#macro>
<#macro abbr_st><abbr title="Temps Serveur">TS </abbr></#macro>
<#macro abbr_gt><abbr title="Temps dans l'univers du jeu">TJ </abbr></#macro>
<#macro abbr_gt><abbr title="Temps dans l'univers du jeu">TJ </abbr></#macro>
<#macro over_time title feminin=false pluriel=false>
<#if data.page.useRLTime>
${title?xhtml} (pour 12h)
<#else>
${title?xhtml} mensuel<#if feminin>le</#if><#if pluriel>s</#if>
</#if>
</#macro>

View file

@ -62,6 +62,63 @@
</@right_column>
</@tab>
<@tab id="economy" title="Économie">
<@listview>
<@lv_line headers=true>
<@lv_column width=30>&nbsp;</@lv_column>
<@lv_column width="x">Ressource</@lv_column>
<@lv_column width=100 centered=true><@over_time "Bénéfice" /></@lv_column>
<@lv_column width=100 centered=true><@over_time title="Charges" feminin=true pluriel=true /></@lv_column>
<@lv_column width=100 centered=true>Réserves</@lv_column>
<@lv_column width=100 centered=true>Priorité d'extraction</@lv_column>
</@lv_line>
<#list ov.economy as resource>
<#if previousCategory?has_content && !resource.category?has_content
|| resource.category?has_content && !previousCategory?has_content
|| resource.category?has_content && previousCategory?has_content
&& resource.category != previousCategory>
<@lv_line>
<#if resource.category?has_content>
<td colspan="5"><strong>${resource.category?xhtml}</strong></td>
<#else>
<td colspan="5"><hr /></td>
</#if>
</@lv_line>
<#local previousCategory=resource.category>
</#if>
<@lv_line>
<@lv_column>&nbsp;</@lv_column>
<@lv_column>${resource.title?xhtml}
<div class="auto-hide">${resource.description?xhtml}</div>
</@lv_column>
<@lv_column centered=true>${resource.income?string(",##0")}</@lv_column>
<@lv_column centered=true>${resource.upkeep?string(",##0")}</@lv_column>
<@lv_column centered=true>${resource.stockpiled?string(",##0")}</@lv_column>
<@lv_column centered=true>
<#if resource.miningPriority?has_content>
<#switch resource.miningPriority>
<#case 0>très basse<#break>
<#case 1>basse<#break>
<#case 2>normale<#break>
<#case 3>haute<#break>
<#case 4>très haute<#break>
</#switch>
<#else>
N/A
</#if>
</@lv_column>
</@lv_line>
</#list>
</@listview>
</@tab>
<@tab id="research" title="Recherche">
<#if rs?size == 0>
<p>Nos scientifiques sont encore en train de s'installer.</p>

View file

@ -108,6 +108,55 @@
</#if>
</@tab>
<#if data.own?has_content && data.own.resources?size gt 0>
<@tab id="resources" title="Économie">
<@listview>
<#local previousCategory="">
<@lv_line headers=true>
<@lv_column width=30>&nbsp;</@lv_column>
<@lv_column width="x">Ressource</@lv_column>
<@lv_column width=100 centered=true><@over_time "Bénéfice" /></@lv_column>
<@lv_column width=100 centered=true><@over_time title="Charges" feminin=true pluriel=true /></@lv_column>
<@lv_column width=100 centered=true>Investissement</@lv_column>
</@lv_line>
<#list data.own.resources as resource>
<#if previousCategory?has_content && !resource.category?has_content
|| resource.category?has_content && !previousCategory?has_content
|| resource.category?has_content && previousCategory?has_content
&& resource.category != previousCategory>
<@lv_line>
<#if resource.category?has_content>
<td colspan="5"><strong>${resource.category?xhtml}</strong></td>
<#else>
<td colspan="5"><hr /></td>
</#if>
</@lv_line>
<#local previousCategory=resource.category>
</#if>
<@lv_line>
<@lv_column>&nbsp;</@lv_column>
<@lv_column>${resource.title?xhtml}
<div class="auto-hide">${resource.description?xhtml}</div>
</@lv_column>
<@lv_column centered=true>${resource.income?string(",##0")}</@lv_column>
<@lv_column centered=true>${resource.upkeep?string(",##0")}</@lv_column>
<@lv_column centered=true>${resource.invested?string(",##0")}</@lv_column>
</@lv_line>
</#list>
</@listview>
</@tab>
</#if>
<#if data.orbit?has_content>
@ -143,6 +192,7 @@
<#case "DEF">défense<#break>
<#case "WORK">production mil.<#break>
<#case "POP">croissance<#break>
<#case "MINE">extraction<#break>
</#switch>
</@lv_column>
<@lv_column centered=true>${building.jobs?string(",##0")}</@lv_column>
@ -189,6 +239,7 @@
<#case "DEF">défense<#break>
<#case "WORK">production mil.<#break>
<#case "POP">croissance<#break>
<#case "MINE">extraction<#break>
</#switch>
</@dt_entry>
</@dt_main>
@ -322,6 +373,56 @@
</#if>
</@tab>
</#if>
<#list data.own.resources as resource>
<#if resource.resourceProvider?has_content>
<#local showResources=true>
<#break>
</#if>
</#list>
<#if showResources?has_content>
<@tab id="natres" title="Ressources naturelles">
<@listview>
<@lv_line headers=true>
<@lv_column width="x">Ressource</@lv_column>
<@lv_column width=100 right=true>Quantité&nbsp;</@lv_column>
<@lv_column width=100>&nbsp;&nbsp;Capacité</@lv_column>
<@lv_column width=100 centered=true>Difficulté<br/>d'extraction</@lv_column>
<@lv_column width=100 centered=true>Priorité</@lv_column>
</@lv_line>
<#list data.own.resources as resource>
<#if resource.resourceProvider?has_content>
<#local resProv=resource.resourceProvider>
<@lv_line>
<@lv_column>
${resource.title?xhtml}
<div class="auto-hide">${resource.description?xhtml}</div>
</@lv_column>
<@lv_column right=true>${resProv.quantity?string(",##0")}&nbsp;</@lv_column>
<@lv_column>/&nbsp;${resProv.capacity?string(",##0")}</@lv_column>
<@lv_column centered=true>${resProv.difficulty}&nbsp;%</@lv_column>
<@lv_column centered=true>
<#switch resProv.priority>
<#case 0>très basse<#break>
<#case 1>basse<#break>
<#case 2>normale<#break>
<#case 3>haute<#break>
<#case 4>très haute<#break>
</#switch>
</@lv_column>
</@lv_line>
</#if>
</#list>
</@listview>
</@tab>
</#if>
</#if>
</@tabs>

View file

@ -8,17 +8,17 @@
<#nested>
</tr>
</#macro>
<#macro lv_column width=0 centered=false right=false>
<#macro lv_column width=0 centered=false right=false colspan=0>
<#if width?is_string>
<th style="text-align: <#if centered>center<#elseif right>right<#else>left</#if>">
<th style="text-align: <#if centered>center<#elseif right>right<#else>left</#if>"<#if colspan gt 1>colspan="${colspan}"</#if>>
<#nested>
</th>
<#elseif width gt 0>
<th style="width: ${width}px; text-align: <#if centered>center<#elseif right>right<#else>left</#if>">
<th style="width: ${width}px; text-align: <#if centered>center<#elseif right>right<#else>left</#if>"<#if colspan gt 1>colspan="${colspan}"</#if>>
<#nested>
</th>
<#else>
<td style="text-align: <#if centered>center<#elseif right>right<#else>left</#if>">
<td style="text-align: <#if centered>center<#elseif right>right<#else>left</#if>" <#if colspan gt 1>colspan="${colspan}"</#if>>
<#nested>
</td>
</#if>