From 44b6ec1920e553358efc3a17e971ab64d00ada34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 30 Jan 2012 09:18:20 +0100 Subject: [PATCH] Fixed resource extraction * Formula was mis-copied from the wiki, the result was multiplied by the provider's current quantity * Changed extraction per work unit from 1 to 10 --- .../deepclone/lw/beans/sys/ConstantsRegistrarBean.java | 3 +-- .../db-structure/parts/050-updates/120-planet-mining.sql | 6 ++++-- .../120-planet-mining/040-gu-pmc-update-resource.sql | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsRegistrarBean.java b/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsRegistrarBean.java index 598e896..75d3a9c 100644 --- a/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsRegistrarBean.java +++ b/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsRegistrarBean.java @@ -66,8 +66,7 @@ public class ConstantsRegistrarBean defs.add( new ConstantDefinition( "game.resources.weightBase" , "Natural resources" , cDesc , 10.0 , 1.1 , 100.0 ) ); cDesc = "Resources extracted per work unit, per (real) day, from a full provider with minimal difficulty."; - defs.add( new ConstantDefinition( "game.resources.extraction" , "Natural resources" , cDesc , 1.0 , 1.0 , - true ) ); + defs.add( new ConstantDefinition( "game.resources.extraction" , "Natural resources" , cDesc , 10.0 , 1.0 , true ) ); // Happiness String[] hcNames = { diff --git a/legacyworlds-server-data/db-structure/parts/050-updates/120-planet-mining.sql b/legacyworlds-server-data/db-structure/parts/050-updates/120-planet-mining.sql index dd16737..b641762 100644 --- a/legacyworlds-server-data/db-structure/parts/050-updates/120-planet-mining.sql +++ b/legacyworlds-server-data/db-structure/parts/050-updates/120-planet-mining.sql @@ -209,7 +209,7 @@ DECLARE BEGIN - _extraction := _input.quantity * verse.get_extraction_factor( + _extraction := verse.get_extraction_factor( _input.quantity / _input.quantity_max , _input.difficulty ); _allocation := _input.weight / _input.total_weight; @@ -219,7 +219,9 @@ BEGIN * sys.get_constant( 'game.resources.extraction' ) / 1440.0; -- FIXME: hardcoded! - RAISE NOTICE 'Extraction % , allocation % , production %' , _extraction , _allocation , _production; + PERFORM sys.write_sql_log( 'MiningUpdate' , 'TRACE' , 'Resource #' || _input.resource + || ' @ planet #' || _input.planet || ': extraction ' || _extraction + || ', allocation ' || _allocation || ', production ' || _production ); _quantity := _allocation * _production * _extraction; IF _quantity > _input.quantity THEN _quantity := _input.quantity; diff --git a/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/040-gu-pmc-update-resource.sql b/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/040-gu-pmc-update-resource.sql index c8181f2..f25019f 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/040-gu-pmc-update-resource.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/040-gu-pmc-update-resource.sql @@ -60,12 +60,12 @@ BEGIN; ) ); SELECT diag_test_name( 'sys.gu_pmc_update_resource( ) - Provider udpated' ); - SELECT is( resprov_quantity , 999.0::DOUBLE PRECISION ) + SELECT is( resprov_quantity , 999.999::DOUBLE PRECISION ) FROM verse.resource_providers WHERE planet_id = 1 AND resource_name_id = 1; SELECT diag_test_name( 'sys.gu_pmc_update_resource( ) - Planet resources income udpated' ); - SELECT is( pres_income , 1.0::DOUBLE PRECISION ) + SELECT is( pres_income , 0.001::DOUBLE PRECISION ) FROM verse.planet_resources WHERE planet_id = 1 AND resource_name_id = 1; @@ -78,12 +78,12 @@ BEGIN; ) ); SELECT diag_test_name( 'sys.gu_pmc_update_resource( ) - Bounded extraction quantity (1/2)' ); - SELECT is( resprov_quantity , 0.0::DOUBLE PRECISION ) + SELECT is( resprov_quantity , 990.0::DOUBLE PRECISION ) FROM verse.resource_providers WHERE planet_id = 1 AND resource_name_id = 1; SELECT diag_test_name( 'sys.gu_pmc_update_resource( ) - Bounded extraction quantity (2/2)' ); - SELECT is( pres_income , 1000.0::DOUBLE PRECISION ) + SELECT is( pres_income , 10.0::DOUBLE PRECISION ) FROM verse.planet_resources WHERE planet_id = 1 AND resource_name_id = 1;