Planet resources and resource providers in XML dumps

* Dump version bumped up to 2

* Added SQL view that shows resource delta and provider information for
all empire-owned planets

* Added new storage classes for resource providers and resource deltas

* Added row mapper which extracts all planet resources information
(providers and deltas)

* Modified dump generator to include planet resources / resource
providers
This commit is contained in:
Emmanuel BENOîT 2012-01-18 09:28:35 +01:00
parent 95e6019c12
commit ce6d86d344
17 changed files with 1607 additions and 50 deletions
legacyworlds-server-data/db-structure/parts/040-functions

View file

@ -1220,6 +1220,54 @@ CREATE VIEW bugs.dump_planets_view
GRANT SELECT ON bugs.dump_planets_view TO :dbuser;
/*
* Planet resources view for XML dumps
* ------------------------------------
*
* This view combines both planet resources and resource providers for all
* empire-owned planets. It is meant to be used in the XML dump generator.
*
*
* Columns:
* empire_id The empire's identifier
* planet_id The planet's identifier
* resource_name The string identifying the resource
* pres_income The planet's income for that resource type
* pres_upkeep The planet's upkeep for that resource type
* resprov_quantity_max The resource provider's capacity, or NULL
* if there is no resource provider of that
* type on the planet
* resprov_quantity The resource provider's current quantity, or
* NULL if there is no resource provider of
* that type on the planet
* resprov_difficulty The resource provider's extraction difficulty,
* or NULL if there is no resource provider
* of that type on the planet
* resprov_recovery The resource provider's recovery rate, or NULL
* if there is no resource provider of that
* type on the planet
*/
CREATE VIEW bugs.dump_planet_resources_view
AS SELECT empire_id , planet_id ,
name AS resource_name ,
pres_income , pres_upkeep ,
resprov_quantity_max , resprov_quantity ,
resprov_difficulty , resprov_recovery
FROM emp.planets
INNER JOIN verse.planet_resources
USING ( planet_id )
INNER JOIN defs.strings
ON resource_name_id = id
LEFT OUTER JOIN verse.resource_providers
USING ( planet_id , resource_name_id )
ORDER BY name;
GRANT SELECT
ON bugs.dump_planet_resources_view
TO :dbuser;
CREATE VIEW bugs.dump_queues_view
AS SELECT ep.empire_id , ep.planet_id , FALSE AS military , q.queue_order ,
q.building_id AS item_id , qin.name AS item_name ,