From c8e1aac21fdb142af23d1915ec4b7fc332b43b5e Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 16 Nov 2010 11:47:45 -0600 Subject: [PATCH] add warnings for overflow --- lib/Lacuna.pm | 2 +- lib/Lacuna/DB/Result/Map/Body/Planet.pm | 12 ++++++++++++ var/messages/complaint_overflow.txt | 7 +++++++ var/missions/industrial-espionage.mission | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 var/messages/complaint_overflow.txt diff --git a/lib/Lacuna.pm b/lib/Lacuna.pm index 70fb1c9b..7d968602 100644 --- a/lib/Lacuna.pm +++ b/lib/Lacuna.pm @@ -7,7 +7,7 @@ use Config::JSON; useall __PACKAGE__; -our $VERSION = 2.3000; +our $VERSION = 2.3100; my $config = Config::JSON->new('/data/Lacuna-Server/etc/lacuna.conf'); my $db = Lacuna::DB->connect($config->get('db/dsn'),$config->get('db/username'),$config->get('db/password'), { mysql_enable_utf8 => 1}); diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet.pm b/lib/Lacuna/DB/Result/Map/Body/Planet.pm index 3e9d2a91..6fa57f01 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet.pm @@ -936,6 +936,18 @@ sub add_type { my ($self, $type, $value) = @_; my $method = 'add_'.$type; $self->$method($value); + unless (eval{$self->can_add_type($type, $value)}) { + my $empire = $self->empire; + if (!$empire->skip_resource_warnings && !$empire->check_for_repeat_message('complaint_overflow'.$self->id)) { + $empire->send_predefined_message( + filename => 'complaint_overflow.txt', + params => [$type, $self->id, $self->name], + repeat_check=> 'complaint_overflow'.$self->id, + tags => ['Alert'], + ); + } + + } return $self; } diff --git a/var/messages/complaint_overflow.txt b/var/messages/complaint_overflow.txt new file mode 100644 index 00000000..1f5b98a6 --- /dev/null +++ b/var/messages/complaint_overflow.txt @@ -0,0 +1,7 @@ +Wasting Resources +~~~ +We've lost some %s due to a lack of storage on {Planet %s %s}. Perhaps we should increase the amount of storage available there. + +Regards, + +Your Humble Assistant diff --git a/var/missions/industrial-espionage.mission b/var/missions/industrial-espionage.mission index a5502d84..be5c4d36 100644 --- a/var/missions/industrial-espionage.mission +++ b/var/missions/industrial-espionage.mission @@ -1,2 +1,2 @@ # config-file-type: JSON 1 -{"network_19_headline":"Developing Empire Trabblx seeks to quickly develop its technology base.","max_university_level":"10","mission_type":"trade","network_19_completion":"A spy shuttle was stolen from %s by an unknown entity.","mission_reward":{"glyphs":["anthracite","fluorite"],"resources":{"sulfur":1500,"zircon":1500,"bauxite":2500,"chalcopyrite":1000,"halite":1000,"beryl":1500}},"name":"Industrial Espionage","description":"We the Trabblx wish to expand our technology base, but due to the single-minded nature of our race we find it very difficult to develop or discover on our own. We would gladly offer you an array of supplies if you would allow our scientists to work with your security ministry to understand the inner-workings of your shuttle technology.\n\nIn exchange for having a close look at a spy shuttle from your empire we will offer a significant quantity of ores and a pair of glyphs.","mission_objective":{"ships":[{"speed":0,"stealth":0,"type":"spy_shuttle","hold_size":0}]}} \ No newline at end of file +{"network_19_headline":"Developing Empire Trabblx seeks to quickly develop its technology base.","network_19_completion":"A spy shuttle was stolen from %s by an unknown entity.","description":"We the Trabblx wish to expand our technology base, but due to the single-minded nature of our race we find it very difficult to develop or discover on our own. We would gladly offer you an array of supplies if you would allow our scientists to work with your security ministry to understand the inner-workings of your shuttle technology.\n\nIn exchange for having a close look at a spy shuttle from your empire we will offer a significant quantity of ores and a pair of glyphs.","mission_objective":{"ships":[{"stealth":0,"type":"spy_shuttle","hold_size":0,"speed":0}]},"max_university_level":"15","name":"Industrial Espionage","mission_reward":{"resources":{"sulfur":1500,"zircon":1500,"chalcopyrite":1000,"beryl":1500,"halite":1000,"bauxite":2500},"glyphs":["anthracite","fluorite"]},"mission_type":"trade"} \ No newline at end of file -- 2.51.2