X-Git-Url: http://aymargeddon.de/gitweb/?p=aymargeddon%2Fcurrent.git;a=blobdiff_plain;f=src%2FFROGS%2FCommand.pm;h=58bf52a6bc12c538ba2de513ce7d7f43e2db9490;hp=056f9ec8b99a3b1f327fd227fb1c8660f0c9d5dc;hb=4f47adab27e4a1d41cf6eea144a68d1ae6bff05d;hpb=d327e42a55ad2d206902528e923164946c653c6a diff --git a/src/FROGS/Command.pm b/src/FROGS/Command.pm index 056f9ec..58bf52a 100644 --- a/src/FROGS/Command.pm +++ b/src/FROGS/Command.pm @@ -183,6 +183,31 @@ sub done { # 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_json($aff); + +} + sub setDuration { # sets the duration of the command in units. Sheduler will schedule # the Phase 2 then for gametime+units*pace(game).