From 4e65887226a447459979ea809736bd658f847415 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 18 Nov 2010 17:17:51 -0600 Subject: [PATCH] added library of jith --- docs/Empire.pod | 39 ++++++++++--------- docs/LibraryOfJith.pod | 38 ++++++++++++++++++ lib/Lacuna/Constants.pm | 1 + lib/Lacuna/DB/Result/Building/Archaeology.pm | 7 ++++ lib/Lacuna/RPC/Building/LibraryOfJith.pm | 41 ++++++++++++++++++++ var/www/public/changes.txt | 1 + 6 files changed, 108 insertions(+), 19 deletions(-) diff --git a/docs/Empire.pod b/docs/Empire.pod index 2f485e92..f5925169 100644 --- a/docs/Empire.pod +++ b/docs/Empire.pod @@ -831,25 +831,26 @@ See the C list in the C method. Returns a list of the stats associated with an empire's species as it was originally created. An empire can only view it's own species stats through this method. - "species" : { - "name" : "Human", - "description" : "The descendants of Earth.", - "min_orbit" : 3, - "max_orbit" : 3, - "manufacturing_affinity" : 4, - "deception_affinity" : 4, - "research_affinity" : 4, - "management_affinity" : 4, - "farming_affinity" : 4, - "mining_affinity" : 4, - "science_affinity" : 4, - "environmental_affinity" : 4, - "political_affinity" : 4, - "trade_affinity" : 4, - "growth_affinity" : 4 - }, - "status" : { ... } - + { + "species" : { + "name" : "Human", + "description" : "The descendants of Earth.", + "min_orbit" : 3, + "max_orbit" : 3, + "manufacturing_affinity" : 4, + "deception_affinity" : 4, + "research_affinity" : 4, + "management_affinity" : 4, + "farming_affinity" : 4, + "mining_affinity" : 4, + "science_affinity" : 4, + "environmental_affinity" : 4, + "political_affinity" : 4, + "trade_affinity" : 4, + "growth_affinity" : 4 + }, + "status" : { ... } + } =head2 get_species_templates ( ) diff --git a/docs/LibraryOfJith.pod b/docs/LibraryOfJith.pod index 3f508e90..7a867de5 100644 --- a/docs/LibraryOfJith.pod +++ b/docs/LibraryOfJith.pod @@ -4,4 +4,42 @@ Library of Jith is accessible via the URL C. The list of methods below represents changes and additions to the methods that all L share. + +=head2 research_species (session_id, building_id, empire_id ) + +Returns a list of species stats for any species in the game. + + { + "species" : { + "name" : "Human", + "description" : "The descendants of Earth.", + "min_orbit" : 3, + "max_orbit" : 3, + "manufacturing_affinity" : 4, + "deception_affinity" : 4, + "research_affinity" : 4, + "management_affinity" : 4, + "farming_affinity" : 4, + "mining_affinity" : 4, + "science_affinity" : 4, + "environmental_affinity" : 4, + "political_affinity" : 4, + "trade_affinity" : 4, + "growth_affinity" : 4 + }, + "status" : { ... } + } + +=head3 session_id + +A session id. + +=head3 building_id + +The unique id of this building. + +=head3 empire_id + +The unique id of an empire you'd like to know more about. See L to turn a name into an id. + =cut \ No newline at end of file diff --git a/lib/Lacuna/Constants.pm b/lib/Lacuna/Constants.pm index c220ae4b..135c7dae 100644 --- a/lib/Lacuna/Constants.pm +++ b/lib/Lacuna/Constants.pm @@ -9,6 +9,7 @@ use constant FOOD_TYPES => (qw(cheese bean lapis potato apple root corn cider wh use constant ORE_TYPES => (qw(rutile chromite chalcopyrite galena gold uraninite bauxite goethite halite gypsum trona kerogen methane anthracite sulfur zircon monazite fluorite beryl magnetite)); use constant FINDABLE_PLANS => (qw( Lacuna::DB::Result::Building::Permanent::Lagoon + Lacuna::DB::Result::Building::Permanent::LibraryOfJith Lacuna::DB::Result::Building::Permanent::Sand Lacuna::DB::Result::Building::Permanent::Grove Lacuna::DB::Result::Building::Permanent::TempleOfTheDrajilites diff --git a/lib/Lacuna/DB/Result/Building/Archaeology.pm b/lib/Lacuna/DB/Result/Building/Archaeology.pm index 0f04f03a..e4e4c12a 100644 --- a/lib/Lacuna/DB/Result/Building/Archaeology.pm +++ b/lib/Lacuna/DB/Result/Building/Archaeology.pm @@ -120,6 +120,13 @@ before finish_work => sub { my %recipies = ( anthracite => { + bauxite => { + beryl => { + chalcopyrite=> { + plan => 'Lacuna::DB::Result::Building::Permanent::LibraryOfJith', + }, + }, + }, trona => { kerogen => { plan => 'Lacuna::DB::Result::Building::Permanent::BeeldebanNest', diff --git a/lib/Lacuna/RPC/Building/LibraryOfJith.pm b/lib/Lacuna/RPC/Building/LibraryOfJith.pm index 994ecbb0..a7974e9b 100644 --- a/lib/Lacuna/RPC/Building/LibraryOfJith.pm +++ b/lib/Lacuna/RPC/Building/LibraryOfJith.pm @@ -13,6 +13,47 @@ sub model_class { return 'Lacuna::DB::Result::Building::Permanent::LibraryOfJith'; } +sub research_species { + my ($self, $session_id, $building_id, $view_empire_id) = @_; + my $empire = $self->get_empire_by_session($session_id); + my $building = $self->get_building($empire, $building_id); + my $view_empire = Lacuna->db->resultset('Lacuna::DB::Result::Empire')->find($view_empire_id); + + unless (defined $view_empire) { + confess [1002, 'Could not locate that empire.']; + } + if ($building->is_working) { + confess [1010, 'The researchers are busy now. Come back later.']; + } + + $building->start_work({}, (60 * 60 * 90) - ($building->level * 3)); + + return { + status => $self->format_status($empire, $building->body), + species => { + name => $view_empire->species_name, + description => $view_empire->species_description, + min_orbit => $view_empire->min_orbit, + max_orbit => $view_empire->max_orbit, + manufacturing_affinity => $view_empire->manufacturing_affinity, + deception_affinity => $view_empire->deception_affinity, + research_affinity => $view_empire->research_affinity, + management_affinity => $view_empire->management_affinity, + farming_affinity => $view_empire->farming_affinity, + mining_affinity => $view_empire->mining_affinity, + science_affinity => $view_empire->science_affinity, + environmental_affinity => $view_empire->environmental_affinity, + political_affinity => $view_empire->political_affinity, + trade_affinity => $view_empire->trade_affinity, + growth_affinity => $view_empire->growth_affinity, + }, + }; +} + + +__PACKAGE__->register_rpc_method_names(qw(research_species)); + + no Moose; __PACKAGE__->meta->make_immutable; diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index a62567c0..48427ccb 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -10,3 +10,4 @@ - Can no longer use scows for mining. - Created stubs for Black Hole Generator, Gratch's Gauntlet, Halls of Vrbansk, Kastern's Keep, The Dillon Forge, and Theme Park. - Fixed the bug that caused the Saben to instantly auto-recolonize planets after abandoning them. + - Added Library of Jith. -- 2.51.2