erste vorarbeiten für JSON
authorBenni Bärmann <benni@obda.de>
Fri, 19 Oct 2012 16:19:47 +0000 (18:19 +0200)
committerBenni Bärmann <benni@obda.de>
Fri, 19 Oct 2012 16:19:47 +0000 (18:19 +0200)
INSTALL
agrep [deleted file]
allgrep [new file with mode: 0755]
html/login.epl
src/Aymargeddon.pm
src/FROGS/Command.pm
withoutsqlgrep [new file with mode: 0755]

diff --git a/INSTALL b/INSTALL
index a861536..ccaac02 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -15,9 +15,12 @@ apt-get install libembperl-perl
 
 *    folgende Perl-Module müssen vorhanden sein: 
 
 
 *    folgende Perl-Module müssen vorhanden sein: 
 
-     Date::Calc;
-     Mail::Mailer;
-     Data::Dumper;
+     Date::Calc
+     Mail::Mailer
+     Data::Dumper
+     JSON
+     
+     gibts alle auch als Debian-Pakete.
 
 *    MySQL als DBMS 
 
 
 *    MySQL als DBMS 
 
diff --git a/agrep b/agrep
deleted file mode 100755 (executable)
index 1229a61..0000000
--- a/agrep
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-grep $1 src/*.pl src/*.pm src/FROGS/*.pm html/*.epl var/*.sql
-
diff --git a/allgrep b/allgrep
new file mode 100755 (executable)
index 0000000..1229a61
--- /dev/null
+++ b/allgrep
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+grep $1 src/*.pl src/*.pm src/FROGS/*.pm html/*.epl var/*.sql
+
index 55066e2..c4602cd 100644 (file)
@@ -33,7 +33,7 @@
 
 [- 
   my $lang = 'DE'; # TODO: use DEFAULT_LANGUAGE from config
 
 [- 
   my $lang = 'DE'; # TODO: use DEFAULT_LANGUAGE from config
-  # TODO BUG: default-language looks to be allways EN here...
+  # TODO BUG: default-language seems to be allways EN here...
   $lang = $udat{-lang} if exists $udat{-lang};
   
   $new_passwd = $db->new_account($fdat{'newlogin'},
   $lang = $udat{-lang} if exists $udat{-lang};
   
   $new_passwd = $db->new_account($fdat{'newlogin'},
index 7b93246..e4fa7d1 100644 (file)
@@ -38,7 +38,7 @@ use Data::Dumper;
 @Aymargeddon::ISA = qw(Game);
 
 sub new{
 @Aymargeddon::ISA = qw(Game);
 
 sub new{
-  my ($class,$game,$user,$db,$lang) = @_;
+  my ($class,$game,$user,$db,$lang) = @_; #TODO: $lang not used here?
 
   my $self = Game->new($game,$user,$db);
 
 
   my $self = Game->new($game,$user,$db);
 
@@ -49,6 +49,7 @@ sub get_map{
   my $self = shift;
 
   unless (exists $self->{-map}){
   my $self = shift;
 
   unless (exists $self->{-map}){
+      # TODO: HOME dupplication correct?
     $self->{-map} = $self->read_map("TERRAIN,HOME,OCCUPANT,TEMPLE,PLAGUE,HOME");
   }
   return $self->{-map};
     $self->{-map} = $self->read_map("TERRAIN,HOME,OCCUPANT,TEMPLE,PLAGUE,HOME");
   }
   return $self->{-map};
index 056f9ec..3507535 100644 (file)
@@ -183,6 +183,31 @@ sub done {
   # TODO?: send messages
 }
 
   # TODO?: send messages
 }
 
+# returns a hash with all data wich is affected from the command
+sub affected{
+    my $self = shift;
+    
+    my $aff = $self->{-affected};
+    for my $field (@{$aff->{-fields}}){
+       #TODO? build field data         
+    }
+    
+    return $aff;
+}
+
+# returns a JSON-Object with all new infos which should displayd from client
+sub first_phase_ajax{
+    my $self = shift;
+    
+    my $ret = $self->first_phase();
+    #TODO: which part of the logic in execute() is needed here?
+    
+    my $aff = $self->affected();
+    use JSON;
+    return encode($aff);
+    
+}
+
 sub setDuration {
 # sets the duration of the command in units. Sheduler will schedule
 # the Phase 2 then for gametime+units*pace(game).
 sub setDuration {
 # sets the duration of the command in units. Sheduler will schedule
 # the Phase 2 then for gametime+units*pace(game).
diff --git a/withoutsqlgrep b/withoutsqlgrep
new file mode 100755 (executable)
index 0000000..a6af5fe
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+grep $1 src/*.pl src/*.pm src/FROGS/*.pm html/*.epl
+